I've read the Basic Branching and Merging section of the Git Community Book.
So I follow it and create one branch: experimental
.
Then I:
there are some conflicts but after I resolve them, I did 'git add myfile'
And now i am stuck, I can't move back to master
when I do
$ git checkout master error: Entry 'res/layout/my_item.xml' would be overwritten by merge. Cannot merge.
and I did:
$ git rebase --abort
No rebase in progress?
and I did :
$ git add res/layout/socialhub_list_item.xml $ git checkout master error: Entry 'res/layout/my_item.xml' would be overwritten by merge. Cannot merge.
What can I do so that I can go back to my master branch?
Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.
After a git merge stops due to conflicts you can conclude the merge by running git merge --continue (see "HOW TO RESOLVE CONFLICTS" section below). Commits, usually other branch heads, to merge into our branch.
press "esc" (escape) write ":wq" (write & quit)
On the command line, a simple "git merge --abort" will do this for you. In case you've made a mistake while resolving a conflict and realize this only after completing the merge, you can still easily undo it: just roll back to the commit before the merge happened with "git reset --hard " and start over again.
When there is a conflict during a merge, you have to finish the merge commit manually. It sounds like you've done the first two steps, to edit the files that conflicted and then run git add
on them to mark them as resolved. Finally, you need to actually commit the merge with git commit
. At that point you will be able to switch branches again.
Quick Tip: You can use git commit -am "your commit message"
to perform add and commit operations on tracked files simultaneously. (Credit: @vaheeds)
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