Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

git checkout <commit> doesn't update commit history

agostinox June 5, 2019

I was looking for git HEAD concept and I came across the  Atlassian git tutorial (checking out and reverting)

Now let us execute git checkout b

Sequence of commits on the master branch

This is an update to the "Commit History" tree

What does it mean 'This is an update to the Commit History'? This doesn't touch at all the Commit History, just takes out a specific commit into the working tree and, the most important thing, lets the subsequent commits to attach to the HEAD (and this seems to create an unnamed branch that should be avoided in most cases. The most common use case for this situation, called detached HEAD is for reading purposes).

1 answer

0 votes
BillyP
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2019

Hi @agostinox 

What I think you're asking is about:

git checkout -b [new_branch]

This creates a new branch from the current branch, usually master.  This updates the commit history so others can follow along with what was happening.  Also, it helps with reviewing code at a later time or merging specific features.  

I hope this helps :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events