Assume this scenario:
1 - I checkout master, and do a git pull
to get the latest
2 - I checkout my own new branch from master git checkout -b my-branch
3 - Few days pass, I stash my branch changes, checkout master and do git pull
again
4 - I checkout back to my own branch git checkout my-branch
Now the new changes in master (from step 3) are also present in my branch, how is that possible? I thought a branch is an isolated branch from master.
You're doing something wrong. The new changes from master can't appear on your local branch. It breaks the whole git idea.
Just to be sure tested it on new folder with file. I commited it as "1st" commit, then perfomed checkout to new branch my-branch
, then stashed some file edits on it and checkouted back to master
. Then I created "2nd" commit and checkouted to my-branch
and, of course, everything is the same as in "1st" commit because I branched from it and create my-branch
ref on "1st" commit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.