Skip to content
Browse files

Add a section on rebasing pushed branches.

  • Loading branch information...
1 parent fc70542 commit 11cf803a2a37c0bfd87f07d198a3f670f5d03127 @fatbusinessman fatbusinessman committed Sep 24, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 git.md
View
11 git.md
@@ -48,8 +48,15 @@ this is [positively encouraged](http://git-scm.com/book/en/Git-Branching-Basic-B
You are encouraged to make liberal use of Git's [history rewriting
features](http://git-scm.com/book/en/Git-Tools-Rewriting-History) while working
locally, in order to arrange your commits into appropriate logical chunks that
-will make sense to your fellow developers. In particular, you may find `git
-rebase --interactive` very useful.
+will make sense to your fellow developers. In particular, you may find
+`git rebase --interactive` very useful. However, you should not rewrite commits
+that have been pushed unless:
+
+ * You are **very sure** that no-one else will be affected by you rewriting the
+ branch history, *or*
+ * You have an Extremely Good Reason. For example: someone has committed
+ sensitive information (personally identifiable data, passwords and suchlike)
+ and it needs purging from history.
When merging from a feature branch to master (or any other mainline development
branch), in particular one that has previously been shared with colleagues, you

3 comments on commit 11cf803

@nickstenning

I'd suggest rewriting

"You are **very sure** that no-one else will be affected by you rewriting the branch history"

as

"You are sure that others using your branch understand the impact of a rebase and are happy with you doing so"

Also, the paragraph to which you've appended specifies "while working locally". I'd be tempted to start a new paragraph which starts:

"Rebasing pushed/public branches should be done with extreme care. In particular, you should NEVER rebase the master branch."
@jabley
jabley commented on 11cf803 Sep 24, 2012

I tend to update the README to include a commit warning not to base work off this branch since I will routinely trash it, and then rebase -i to remove that commit when I'm ready to get a branch close to merging.

@bradwright

People never read READMEs if they're familiar with the code base/product though.

Please sign in to comment.
Something went wrong with that request. Please try again.