Entries Tagged as 'Git'

Working with Git

For the past week and a half, I've been pushing myself to learn and use git. I think I'm using it enough now that I managed to integrate it into my workflow which is probably the thing you have to work through the most. At work, we have access to SVN, but I can't say that everyone uses it - I use it on some projects, but I really should be using it on all projects. At home, when I'm working on my own stuff, I hadn't been using it at all. Well, I'm making an effort to change that and I have an account on github.com ( Sorry, don't have any open source projects yet. :/ ) and I'm using it for a couple of side projects I have.

So, I thought I'd jot down some notes of what has been working well for me:

  • Forget about the GUIs. Learn the command line. Download msysgit and use it. I'm on a windows box, so this is actually a rough sell as we all tend to be GUI-centric, but seriously... open up explorer and right click the folder and "Git Bash Here" - if you're familiar with linux style commands, you'll feel at home here. Type 'ls' to list directory, 'rm' to remove files, etc.
    • Msysgit does have a git gui, but again, learn the command line. If anything does go wrong with GUI interfaces, you're going to have to resort to using the command line anyway.
  • Once you've initialized your project and git is up and running, create a branch and leave master alone. I use "master" as my current stable "ok, I know everything works here." I use branches for new development or bug fixes. I think this is probably the hardest thing for people (working solo) to get used to in their workflow.
    • So, in my current project, I have a user tracking app. "master" already has a working copy of the website, by typing 'git checkout -b tracking' in the command line, I'm basically creating and switching to the branch called 'tracking'. I get everything working there the way I want, at any point, if I seriously screw things up or things aren't going the way I'd like... I just simply blow it away or just switch back to master and create a new branch and start over again.
    • If things are going the way I'd like and I get to a good stopping point and everything is working, I'll switch to the master branch by typing: 'git checkout master' and then merge my code from the branch to the master by typing: 'git merge tracking' and like that, my master branch now has new files and modified files I've worked on over in the tracking branch.

I'm still fairly new at all this and I know that I need to figure out tagging and such. I'd love to list out all the git references I've been using, but honestly I've just been typing git commands into my chrome window and letting google find those answers for me. There's a lot of other CFMLers in the community that have more git knowledge and they've been slowly posting them on their blogs.

I would also suggest getting familiar with git locally first before rushing off to sign up for a github account. Once you're familiar with all the commands locally, trying to work remotely will make more sense. I must have created a couple of test projects on github before I was comfortable with pushing or pulling from an external source. I mention this because working with remote branches and stuff can get a little obscure.

Learning git on windows

So, I've decided to be a sheep and invest my time in learning git. I'm using Windows 7 as my development platform. I have an account on github. There's a lot of tutorials around on the net, all of them point towards a windows client called msysgit. I've been poking at this thing for awhile now, but recently I refreshed my machine with a reformat. So, in setting everything back up again, I noticed there's a new msysgit build out.

So, I pulled up my usual websites that I follow along to install msysgit, and there's a change in the new installer. It no longer prompts for plink.exe and I can't find anything on google about the removal of it. After bumping along tutorials and such, I've come to realize you no longer need it.

So, my suggestions are to follow this instruction first:

Once that's done, everything worked - except, now I have to type in my passphrase every time I commit. Annoying. I came across this:

Doesn't look like it is for windows, but it is. Just follow the directions. So, make sure the bash window is open and then just type: 'vi ~/.profile' - hit 'i' to insert, paste in that entire block, then hit 'escape' then ':wq' to save the file. Once that's done, it'll look like nothing happened, but the next time you open up bash, you'll be prompted for your passphrase and as long as you keep that bash window open, you won't ever be prompted again.

Which is good. This means I no longer have to keep PuTTY's pageant.exe running in the background. One other piece of advice, you'll be tempted to download / use tortoisegit. Don't. Learn the bash / gui first. tortoisegit has issues and in my findings it runs slower.