Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 159

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 162

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 165

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 168

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 171

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 173

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 175

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 197

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 201

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 224

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 225

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 226

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316
Rails Moving To Git: How To Really Understand And Master Git

It appears that Rails will switch to git real soon. Nice! However, it means confusion for developers used to svn. You might find a few tips on this blog to help you get started, but right now I want to give you the secret to git mastery:

You need to think in terms of how you want to modify your graph. My what you say?!? A git repository is a directed acyclic graph of commits (the nodes). Huh?? Read this article: Git for Computer Scientists. Do not continue reading before you understand that article. Everything falls into place when you understand that all git commands manipulate these four basic structures: blobs, trees, commits and tags.

From now on, before typing a git command in the shell, try to picture in your head how you want your repository to look after the command. Your best friend is gitk for visualization (use the –all option to see all branches). Run it before and after each command you do with git. Here is what you should be thinking when using these commands:

  • git commit: I am creating a new node in my graph, linked to the current node.
  • git branch branch_name: I am tagging a node with a name.
  • git merge: I am creating a new node that will link two parents nodes, one for each branch I am merging (could be more than two).
  • git fetch remote_repos: I am adding all the nodes from a distant repository to my graph.
  • git push: I am sending all the nodes I created to a distant repository.
  • git pull: I want to fetch all remote nodes AND merge.

Once you think like this, “advanced” git stuff becomes trivial. For example, this morning one coworker realized that his last three commits actually belonged to a branch. Try to visualize the solution. When you think about it, nothing has to change about the actual graph, just which nodes the tag (the branch name) needs to point at. So you just create a branch where you are, on the last commit, and then you can use the reset command to move back the other branch to the correct commit.

That’s the core of git. There are maybe two other things to worry about when using git. The first is the index, which is sort of a staging area where you prepare your commits. The other thing is the way git configuration works and the way it names and references branches (and the special reference HEAD) and remote repositories. Check out the git user manual.

Popularity: 37% [?]

 

6 Responses to Rails Moving To Git: How To Really Understand And Master Git

  1. Luke Randall says:

    Hey, I just wanted to say thank you for your tutorials on using git. It was your Guerilla Guide to Git that convinced me to try Git out, since I was happily using SVN & Beanstalk prior to that. So I was happy that I’d be able to try Git but still use Beanstalk.

    Needless to say, a couple of weeks and a GitHub invite later and my Beanstalk account is lying dormant. Git is awesome.

    But yeah, thanks for what you’re doing. Keep up the good work.

    • Zulekha says:

      That’s not bad. Though, you really have to try somtiheng like that with 1000 nodes to see how it’s going to work in the real world.I’ve only seen the couple of screenshots you guys have published for 5.0. I think I’ve mentioned it on the board, but towards the top of my list were things like centering on a function, having selection in the graph relate back to the IDA view, being able to prune everything below a library function, etc

  2. [...] I didn’t think I would blog about the launch of github, because I thought it was pretty meh. Sure it’s nice to put your projects on it and be able to fork other projects, but it was still pretty useless as there was no way of visualizing all the branches (git is all about the commit graph). [...]

  3. Timothy says:

    I read a lot of interesting articles here. Probably you spend a lot of time writing, i
    know how to save you a lot of time, there is an online tool that creates readable,
    SEO friendly posts in seconds, just search in google – laranitas free content source

    • Degleng says:

      Hi Satsi. Thanks for trying the app. My guess is that you had diculffity using the app because you used the wrong case when typing in your username. Be sure to get the same capital letters when you enter your username. Like this : SATSItheSTRANGE’. I think Last.fm’s API is case sensitive for usernames.

  4. Anthdonitula says:

    День добрый. На нашем веб-портале интересная информация
    http://u.to/W-MjDw

Leave a Reply to Timothy Cancel reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>