I need help in resolving merge conflict in git pull from GitHub, I did following
on my current branch, I did the following
fa
git pull --rebase master git pull ssh:..... (pulled changes from my review) git add .git commit --amend I got error "fatal: you are in the middle of merge -- cannot amend"
I want to amend same commit again without createating new commit ID. is there a way ?
Given that your history looks like:
B C1 C2
o----o----o master
\
o feature
F
You can either rebase the changes from feature onto the branch you are pulling them in to (master) to make it a "fast-forward merge", creating linear history:
B C1 C2 F
o----o----o----o master, feature
Or, in the stage you describe you can run git commit (without --amend) to proceed to create a commit recording the result of the merge:
B C1 C2 M
o----o----o----o master
\ /
--o-- feature
F
If you prefer to have an explicit merge commit to denote that you merged a feature branch you can rebase and then merge using the --no-ff flag, creating something like this:
B C1 C2 M
o----o----o---------o master
\ /
--o-- feature
F
Which variant you pick is up to you to decide; all three are valid. I typically prefer to rebase feature branches, so as to avoid having to solve merge conflicts in a separate commit (the merge commit). Keeping the history linear (no merges) or not is a matter of workflow and taste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With