github - How to find the branch number using git -


in git, there command git checkout ***, wondering how number checkout?

git log show commit history respository, include sha1 identifier each commit, this:

commit 7fd1a60b01f91b314f59955a4e4d4e80d8edf11d merge: 553c207 7629413 author: octocat <octocat@nowhere.com> date:   tue mar 6 15:06:50 2012 -0800      merge pull request #6 spaceghost/patch-1      new line @ end of file.  commit 762941318ee16e59dabbacb1b4049eec22f0d303 author: johnneylee jack rollins <johnneylee.rollins@gmail.com> date:   tue sep 13 21:42:41 2011 -0700      new line @ end of file. --signed off spaceghost 

you can check out particular commit this:

git checkout 762941318ee16e59dabbacb1b4049eec22f0d303 

...but isn't want do, because puts in "detached head" state in new commits make not reachable branch, meaning removed garbage collection mechanism. great way lose data.

what makes more sense create new branch based on commit:

git checkout -b mybranch 762941318ee16e59dabbacb1b4049eec22f0d303 

now you're on new branch called mybranch , new commits make work expected. can switch master branch this:

git checkout master 

also, sinelaw's suggestion pro git excellent one.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -