📝 Edit on GitHub
Rebase
Perform a rebase
$ git pull --rebase
$ git pull --rebase origin master
$ git fetch
$ git rebase origin/master
Dealing with conflicts
Possible actions
Update and continue
Common flow:
- Edit a file to remove conflicts.
- Add or remove.
$ git add PATH $ # OR $ git rm PATH
- Continue.
$ git rebase --continue
I think you can also just run git commit
to add and continue.
Skip
Skip the current commit.
This is useful if after removing conflicts there are no changes to add or commit.
$ git rebase --skip
Abort
$ git rebase --abort
Restore
I am not familiar with this but it comes from the suggested commands.
Unstage a file.
git restore --staged PATH
Show patch
When you experience a conflict, you can use this to see the patch (diff) for the current commit.
This was suggested on a conflict.
$ git am --show-current-patch
Using git am
:
Apply a series of patches from a mailbox
Splits mail messages in a mailbox into commit log message, authorship information and patches, and applies
Messaging
Message from rebase result on a conflict:
CONFLICT (content): Merge conflict in ...
...
git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Message from git status
:
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: ...