requirement of merging local repos? #51995
-
Bodyhi all, I was wondering if this should be normal procedure in making sure all branches are the same at both local and remotes. Should the locals always have the same This is what happens after I do a remote merge of the master and feature branch, every time, even though I do a pull on the locals after the remote merging. (Formatting is a bit off but I hope this is clear.) I end up with one commit off in one branch. See below: This is the feature branch: (it is short one commit relative to master, see below) This is the master branch: ===== note: show remote origin master and feature show everything is up to date on remotes relative to locals git remote show origin
========== On master looks ok as expected based on the commit logs: git branch --merged
I see this on feature branch: git branch --merged
git branch --no-merged <<< need to merge feature <—— master Checkout feature and do a git merge master ========= I need to merge feature <----- master. Checkout the feature and do a "git merge master" git checkout feature git status git merge master This seems to have addressed the issue: git branch --merged
git branch --no-merged ========== commit logs look good master: feature: ====== now the remotes are off: git checkout feature
git push origin feature git remote show origin
master is ok: git checkout master
======= my question is: this seems circular and tedious in some way. Is there a better way to get locals and remotes all on the same state relative to commits? There were no code changes just a merge done remotely (after a code change) that causes this. After merging remotely it seems like this procedure always has to be always be done, correct? (to get the local feature and master commits in line with that last commit on the merge) It does not seem like leaving in the former state is bad in any way (in terms of synch) because on the next real commit (code change, etc), everything will get updated, correct? warm regards I have read and understood this category's guidelines before making this post.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You did a merge with a merge commit, that's why there's an additional commit on The common approach would be to delete (or just leave) the |
Beta Was this translation helpful? Give feedback.
You did a merge with a merge commit, that's why there's an additional commit on
master. That's entirely normal.The common approach would be to delete (or just leave) the
featurebranch after the merge (git branch -d feature), and create a new feature branch (starting frommasteragain) for the next feature you're working on. If you want to keep working from the same branch for some reason doing a local fast-forward merge frommasteras you did is exactly the right thing to do.