Detaching HEAD:
Detaching HEAD just means attaching it to a commit instead of a branch. This is what it looks like beforehand:
Start:
git checkout C1 ->
- git checkout master
- git commit
- git checkout C2
- Examples:
2.Purpose branch:Type command:- git checkout C4.
Moving around in Git by specifying commit hashes can get a bit tedious. In the real world you won't have a nice commit tree visualization next to your terminal, so you'll have to usegit logto see hashes.
Furthermore, hashes are usually a lot longer in the real Git world as well. For instance, the hash of the commit that introduced the previous level isfed2da64c0efc5293610bdd892f82a58e8cbc5d8. Doesn't exactly roll off the tongue...
The upside is that Git is smart about hashes. It only requires you to specify enough characters of the hash until it uniquely identifies the commit. So I can typefed2instead of the long string above.
Monday, October 29, 2018
Lesson5: Detaching Head in git
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment