Pull de novo:
git checkout --track <remote>/<branch>
Point existing remote to new local branch:
git branch --track <new local branch> <remote>/<remote branch>
git log --walk-reflogs <branch>
git branch --contains <commit>
Format is
<<<<<<< their hash
...
<their code>
...
=======
...
<our code>
...
>>>>>>> our hash
(what does it mean if conflicts are nested?)
Resolve with git add
. Finish merge with git commit
, or more recently, git merge --continue
. If conflict arises during rebase or cherry-pick, resume with git {rebase,cherry-pick} --continue
.
If git stash pop
doesn’t apply cleanly, and you want to revert, simply git checkout -f [branch]
. This is especially useful if you stashed changes in order to switch branches and unsucessfully pop them on the new branch:
$ git checkout somebranch
error: Your local changes to the following files would be overwritten by checkout:
file1
file2
Please, commit your changes or stash them before you can switch branches.
Aborting
$ git stash
Saved working directory and index state WIP on <original branch>: <hash> <commit message>
HEAD is now at <hash> <commit message>
$ git checkout somebranch
Switched to branch 'somebranch'
[jh1 canine deloc_hash:11]$ git stash pop
Auto-merging file1
CONFLICT (content): Merge conflict in file2
Of course, you can directly resolve this merge conflict, but sometimes you realize that this isn’t the correct branch to be on. In that case, the pop can easily be resolved by forcing a checkout back to the original branch, and popping again:
$ git checkout -f <original branch>
Switched to branch '<original branch>'
$ git add file2
$ git stash pop
and we are back! Note that you need to explicitly re-add the conflicting file, as it will have implicitly been dropped.
git rebase --onto C A^ B
Note that this will create a detached head downstream of C if you are not already on branch C.
git submodule deinit <path_to_submodule>
git rm <path_to_submodule>
git clone <remote> <path> && cd <path>
git submodule update --init --recursive
git revert --patch
)git revert --no-commit
git reset --patch