I have a local master which is synced with a remote. I create feature branches out of it. Lets say I'm working on feature/a
and some other dev is working on feature/b
. This is my workflow for syncing with master:
//Sync master with upstream and get branch b
>master
- git pull upstream master
- git push origin master
//Return to branch a and get latest code from master
>feature/a
- git merge master
- resolve conflicts manually.
At this stage, if I do a git status
I see a lot of files staged for commit. Most of them are not added by me, but by the other dev. I do not want to commit these files as I have not changed them. How would I do that? I want to commit a whole lot of files for just a few files that I have changed. Is there a better way to do this?
Since you tried to merge master branch into your feature/a branch, you need to resolve conflicts and have to commit it as a merge commit. Also, the results of git merge and git rebase are definitely same. Just only difference is sequence of commit. It means in this case, you should resolve the conflict files and then continue the rebase step even you use git rebase instead of git merge.
Tip, before merge, try git status to check something modified or not and what's your current branch.