简体   繁体   中英

Old git-commits move to new branch

I have the following problem:
- I have Master branch and a Dev branch and I recently added another one called TA-17.
- I submitted all my commits to this branch merged it with Dev, and closed TA-17 branch.
- Then I commited twice something to Dev branch
- Now I created a new branch (from within JIRA) called TA-38 and made the first commit to it.

Result:
- All old commits from TA-17 now appear as they have been made in the new TA-38 branch (and in DEV)
- No new branch is visible in the graphical display on the left next to my commits

Expected result:
- All old commits should still show as being submitted as TA-17 even though the branch has since be closed.
- A new branch should be visible in the graphical display on the left of my commits
- The 2 commits I submitted to DEv branch only, should not be marked as being TA-38 (63782a8 & 2a93cb3)

After this i played around a bit more:
- Deleted the TA-38 branch and the one commit it contained (and see all old commits now show only as being part of DEV again)
- Merged master into DEV (1 commit behind)
- Created the TA-38 branch again with 'git branch'
- Committed a new commit to TA-38 branch

and again all old commits move to the new branch (now show as part of DEV & TA-38)

What did I do wrong, and how can I fix it ?
https://bitbucket.org/kamaradski/ta/commits/all

This is probably a user error, but I cannot find any information on this topic.
I might be missing something, maybe i need to rebase, or run some sort of reset...?

After looking at your Bitbucket repo, I think the confusion is that TA-38 was created off of dev , but TA-38 's merge destination is master . So yes, you are seeing all the commits between TA-38 and the master / dev branch point ( 5a8d807 ). This includes your old TA-17 branch.

If you change TA-38 's merge destination to dev , the extra TA-17 commits should not appear on the TA-38 web page anymore. (They are still there, but as part of dev .)

Edit: According to this ticket , permanently changing the merge destination in the web interface is an unimplemented feature. You can change it temporarily, but right now after you leave the page it will always default back to the branch defined in Bitbucket as the "main branch".

A workaround for your problem is to set the "main branch" to dev instead. This can be changed in your repository settings. That may be better anyway if you use a "git-flow" style workflow where you merge your feature branches into dev , and then merge dev into master .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM