![]() It is best practice to always rebase your local commits when you pull before pushing them. ![]() This results in a merge commit that points to the latest local commit and the latest remote commit. If you pull remote changes with the flag -merge, which is also the default, then your local changes are merged with the remote changes. If you pull remote changes with the flag -rebase, then your local changes are reapplied on top of the remote changes. If you want to understand the details of rebasing and merging for changes and branches, then syou should read a blogpost by Mislav Marohnić and the chapter on rebasing and merging from the Pro Git book. There is another wikipage on how to rebase or merge a branch. Both of these commands have their own use cases and benefits but we still consider the Git Fetch command as a safer option.This page briefly explains the difference between rebasing and merging in git while pulling.īoth techniques are used to combine your local unpublished changes with the published remote changes. We learned that when we just want to take a look at the changes in the remote repository without affecting our local work we can use the Git Fetch command but instead if we want to merge the new commits of the remote repository with our local repository then we may use the Git Pull command. Git Pull and Git Fetch are two very important commands which we will often use to interact with our remote repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |