Files
zulip/docs/tutorials/fixing-commits.md
David Rosa Tamsen 7072fa5b37 docs: Reorganize developer docs to improve navigation.
This commit helps reduce clutter on the navigation sidebar.
Creates new directories and moves relevant files into them.
Modifies index.rst, symlinks, and image paths accordingly.

This commit also enables expandable/collapsible navigation items,
renames files in docs/development and docs/production,
modifies /tools/test-documentation so that it overrides a theme setting,
Also updates links to other docs, file paths in the codebase that point
to developer documents, and files that should be excluded from lint tests.

Note that this commit does not update direct links to
zulip.readthedocs.io in the codebase; those will be resolved in an
upcoming follow-up commit (it'll be easier to verify all the links
once this is merged and ReadTheDocs is updated).

Fixes #5265.
2017-11-16 09:45:08 -08:00

1.4 KiB

Fixing Commits

This is mostly from here.

Fixing the last commit

Changing the last commit message

  1. git commit --amend -m "New Message"

Changing the last commit

  1. Make your changes to the files
  2. Run git add <filename> to add one file or git add <filename1> <filename2> ... to add multiple files
  3. git commit --amend

Fixing older commits

Changing commit messages

  1. git rebase -i HEAD~5 (if, for example, you are editing some of the last five commits)
  2. For each commit that you want to change the message, change pick to reword, and save
  3. Change the commit messages

Deleting old commits

  1. git rebase -i HEAD~n where n is the number of commits you are looking at
  2. For each commit that you want to delete, change pick to drop, and save

Squashing commits

Sometimes, you want to make one commit out of a bunch of commits. To do this,

  1. git rebase -i HEAD~n where n is the number of commits you are interested in
  2. Change pick to squash on the lines containing the commits you want to squash and save

Reordering commits

  1. git rebase -i HEAD~n where n is the number of commits you are interested in
  2. Reorder the lines containing the commits and save

Pushing commits after tidying them

  1. git push origin +my-feature-branch (Note the + there and substitute your actual branch name.)