First, you can use the cherry command to see what commits differ between branches, and in what ways. So in this case, running git cherry origin/feature/worker-interface
shows us the status of commits on the current branch and how they stack up against origin/feature/worker-interface
.
You will find 1 repo which you forgot to commit.
Now, lets see whats happening with the 'origin/feature/worker-interface' and its commits.For this we can run a log command with a special format git log ..origin/feature/worker-interface --oneline
Here we see 4 commits that don't exit in our current branch
So now we have a good idea of what’s happened. you’ve made 1 commits on your local master branch, and it looks like there are 4 commits on origin/feature/worker-interface
which you don’t have merged in yet. So, you could just blindly merge things together and go on your way (if they merge without conflict), but I’d like to show you
how to deal with it in a more controlled manner.
- First, create a branch that points to your current HEAD:
git checkout -b local_changes
- Now that we have that to keep track of those changes, we switch back to feature/worker-interface:
git checkout feature/worker-interface
- At this point, reset the feature/worker-interface branch to get rid of the 1 commit.
- There you go! You can check your status of branch
git status
you will be prompted as nothing to commit