简体   繁体   中英

Git rebasing branch

I am a bit confused by git having previously worked with svn.

I have pulled from the main branch, created my feature branch, worked on it, added and committed my changes locally, pushed to remote and then submitted my branch to jenkins and all tests passed.

In the meantime main branch has moved on so I have checked out development, pulled the latest changes and then rebased my branch against the latest copy of development.

So this means my unit tests and integration tests ran against the latest copy of my code but not the latest copy of development.

I thought that I would now be able to push the chanegs to my remote branch again to give it the latest changes to development and then rerun my tests but git status says there is nothing to commit and that my working directory is clean.

Why is it that my branch does not recognise that there are changes to development that I might want to push to rerun my tests against?

A rebase completely rewrites your changes, replacing the previous commits with new ones. So you do not have anything new to commit (since your old commits were changed), but you should be able to push them again to your CI system.

Note that you may need to force-push using git push --force in order to replace the branch you have already pushed there. Do not do that outside of feature branches that you just want to have your CI run against, otherwise you will cause problems for your other team members.

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