From: Oleg Broytman Date: Mon, 1 Jun 2015 12:37:00 +0000 (+0300) Subject: Add a section on commit editing X-Git-Url: https://git.phdru.name/?p=git-wiki.git;a=commitdiff_plain;h=021099ec5db6e77e41c480d68c3c0312d7cabffa Add a section on commit editing --- diff --git a/pep-git.txt b/pep-git.txt index a2e2780..d995d24 100644 --- a/pep-git.txt +++ b/pep-git.txt @@ -102,6 +102,40 @@ local repo has two branches ``v1`` and ``v2``. Usually the currently checked out branch is ``v2``. +Commit editing and caveats +========================== + +A warning not to edit published (pushed) commits also appears in +documentation but it's also repeated here as it's very important. + +It is possible to recover from forced push but it's PITA for the +entire team. Please avoid it. + +To see what commits have not been published yet see the head of the +remote branch:: + + $ git log origin/v2.. + +For every branch that has an upstream remote branch git maintains an +alias @{upstream} (short version @{u}):: + + $ git log @{u}.. + $ git log v1@{u}..v1 + +To see the status of all branches:: + + $ git branch -avv + +Read `how to recover from upstream rebase +`_. +It is in ``git help rebase``. + +On the other hand don't be too afraid about commit editing. You can +safely edit commits that hasn't been pushed yet. You can even push +commits to your own (backup) repo, edit them later and force-push +edited commits to replace what has already been pushed. + + References ==========