]> git.phdru.name Git - git-wiki.git/blobdiff - pep-git.txt
Add a section on commit editing
[git-wiki.git] / pep-git.txt
index 118787f5881089b7e77b3804a123503012ac6001..d995d2456fe367ceaa1d0fa0a8081274497d2e2c 100644 (file)
@@ -92,6 +92,50 @@ important so let repeat it here::
     $ git config --global user.email user.name@example.org
 
 
+Examples in this PEP
+====================
+
+Examples of git commands in this PEP use the following approach. It is
+supposed that you, the user, works with a local repository named
+``python`` that has an upstream remote repo named ``origin``. Your
+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
+<https://git-scm.com/docs/git-rebase#_recovering_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
 ==========