I am collaboratively working on a project with someone, so we decided to use git. Unfortunately, we frequently code in locations with no internet, so we end up with something like this:
master (local): D---E---F
Merge remote-tracking branch 'origin/master'
You can omit creating merge commits, by using rebase instead of merge.
As @Dougal said, if you do
git fetch, you can execute
git rebase afterwards to change the base of your changes to the fetched
Usually you create those unwanted merge commits, by pulling from remote repository.
In that case you can add
git pull --rebase
or add the proper option to Git config file (locally):
git config branch.<branch-name-here>.rebase true
or for all the new repositories and branches:
git config branch.autosetuprebase always --global
However, rebasing creates cleaner, more linear history it is good to create merge commits, where there are massive changes in both branches (use
git merge to do so).