Tuesday, May 21, 2019

Lesson 5.2: The "~" operator in git

If you want to move a lot of levels up in the commit tree. It might be tedious to type ^ several times, so Git also has the tilde (~) operator.


Example:
Commit tree start:                                                     Commit tree goal:
                                   
Answer:
  •    git checkout master~4 .
Thereout,you can directly reassign a branch to a commit with the -f option.Moves (by force) the master branch to three parents behind HEAD.
Example:
Commit tree start:                                      Commit tree goal
                        
Answer:
  • git branch -f master HEAD~3  .
Other example:

                        



Goal:
                       
          

No comments:

Post a Comment