Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

bitbucket - Git - My branch is not updating with the latest master

I'm experiencing a really frustrating problem with my branch on bitbucket. I've seen several other similar problems on here but unfortunately, none of the answers really helped.

Whenever I start working on my branch I usually use git fetch && git checkout 'branch name'.

After that, I would add my relevant commits and push onto the master. Now I'm trying to retrieve the latest changes from the master, by doing a git pull origin master, however, I keep getting a message saying that it's already up-to-date, but this is not the case, as I'm not getting the latest changes on my branch.

question from:https://stackoverflow.com/questions/65889606/git-my-branch-is-not-updating-with-the-latest-master

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In Git, commits are the coin of the realm (the things that get created, stored, pushed and pulled between your local Git and a remote Git, etc.), and branches are effectively distinct named worlds for working with commits.

So, if you say

git fetch && git checkout 'branch name'

then the world you are working in is branch name. You can edit your files, add, and commit, and those commits are appended to branch name.

Meanwhile, master is a different branch and is completely unaffected by what you have been doing. Neither pushing master nor pulling master will involve those commits in any way; those commits are on branch name, not master.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...