I have two branches “master” and “experiment”, both locally and at a remote repo. They are both synced, i.e. the HEAD is the same commit, both locally and at remote.
I make a commit to “master” locally and then push it to remote “master”.
I then decide that I’d like to have “experiment” at the current status as “master”(sync/merge with master, yet maintain it as a separate branch).
So locally I move to the “experiment” branch and do :-
git fetch origin mainline
However, after doing the fetch, doing a “git log” in “experiment” does now show the new commits in them. Am I doing something wrong?
This should show all the commit from the various branches:
(you can see a more compact
git loghere)A git fetch alone doesn’t update the commit of your local branch, only of the one in the remote namespace (ie, the branch
origin/mainline).To update your local ‘
experiment‘ branch with a remote one you have fetch, add:Then a simple
git logwill show you a new commit.