17
purist
7y

The more i use git.. more the fun it is.. Just found out the usage of rebase and cherry-pick.. I have read about the implications of these commands in a shared repo.. But it is fun to use it in a solo repo..

Comments
  • 1
    I always wanted to know what rebase did. But I know I won’t google it anytime soon. Mind giving a quick summary of it? I’ll at least read your response!
  • 1
    I hope i wont get crucified for getting it wrong.. But anyway.. assume a branch with commits A and B. At this point let us branch out to another branch . So now both branches have A and B.. Now you commit C and D in the 2nd branch..But in the meantime..Some over enthusiastic guy has commited 10 times on the main branch.. So to include those 10 commits in your branch you can use rebase.. rebase is basically what it means literally.. It changes the base of the branch from B to B+10 ..after which your commits C and D will appear..
  • 0
    rebase also does many things in interactive mode.. It can also be used to copy any range of commits from a branch to another. in interactive mode , you can squash..fixup..edit commits..

    That being said, rebase is a dangerous command in a shared repo as it destroys the original tree..
Add Comment