Let's say I am working on my feature branch A
. After all my changes are pushed into the development branch B
, it is merged by a senior developer. As per the requirement development branch is merged to master which is done by another developer. So, a developer who is viewing the development branch before merging to master wants changes in my code. How do I commit my new changes? Do I choose my previous feature branch to push new changes or create a new branch?
CodePudding user response:
It is better to submit the new changes via your feature branch only (if that branch still exists in your remote repository). This will help in tracking all the feature changes together. Also, since the changes you are supposed to do are review comments, it makes sense for them to be part of the branch itself.
In most cases the feature branch is removed once merged to development / master. If your feature branch does not exist anymore then spawn a new branch by a similar feature name and push your changes. You may create a new subtask, under your feature ticket, in your activity tracking system (e.g. JIRA) as well to facilitate tracking for future.
CodePudding user response:
Ari first run git pull to update local branches (to be the same like remote branches).
Then if are you working on new task create new branch. If you want to move unpushed changes to new branch, your changes should be on stage (git add) then you can run
git shash
git checkout your-branch
git stash pop
You can check if there are more changes in stash by git stash list
If you have rework previous task run
git checkout YOUR-BRANCH
git merge B
Then you can work on your task.