$ mkdir lol_DS
$ cd lol_DS
$ git init
# => Initialized empty Git repository in /private/tmp/lol_DS/.git
$ touch README
$ git add README
$ git commit -m 'Initial commit'
$ touch .DS_Store
$ git add .DS_Store
$ git commit -m 'OH NOES I'M COMMITTING A DS_STORE FILE'
$ git r
# * 06466b3 (13 seconds) <Maximilian Haack [email protected]> (HEAD, master) OH NOES I'M COMMITTING A DS_STORE FILE
# * 874484d (74 seconds) <Maximilian Haack [email protected]> Initial commit
$ touch lol
$ git add lol
$ git commit -m 'rolf ich hab lol gesagt'
# * ecfebb6 (8 seconds) <Maximilian Haack [email protected]> (HEAD, master) rolf ich hab lol gesagt
# * 06466b3 (31 seconds) <Maximilian Haack [email protected]> OH NOES I'M COMMITTING A DS_STORE FILE
# * 874484d (2 minutes) <Maximilian Haack [email protected]> Initial commit
$ git rebase -i HEAD~2
# now the $EDITOR opens up with the following content
#
# 0 pick 06466b3 OH NOES I'M COMMITTING A DS_STORE FILE
# 1 pick ecfebb6 rolf ich hab lol gesagt
# 2
# 3 # Rebase 874484d..ecfebb6 onto 874484d
# 4 #
# 5 # Commands:
# 6 # p, pick = use commit
# 7 # r, reword = use commit, but edit the commit message
# 8 # e, edit = use commit, but stop for amending
# 9 # s, squash = use commit, but meld into previous commit
# 10 # f, fixup = like "squash", but discard this commit's log message
# 11 # x, exec = run command (the rest of the line) using shell
# 12 #
# 13 # These lines can be re-ordered; they are executed from top to bottom.
# 14 #
# 15 # If you remove a line here THAT COMMIT WILL BE LOST.
# 16 #
# 17 # However, if you remove everything, the rebase will be aborted.
# 18 #
# 19 # Note that empty commits are commented out
#
# change pick to 'edit' in line 2, save and close the editor, git now goes back in time (tm)
# and stops at the selected commit for you to change history!!!!
#
# Stopped at 06466b3... OH NOES I'M COMMITTING A DS_STORE FILE
# You can amend the commit now, with
#
# git commit --amend
#
# Once you are satisfied with your changes, run
#
# git rebase --continue
#
$ git status
# # Not currently on any branch.
# # You are currently editing a commit during a rebase.
# # (use "git commit --amend" to amend the current commit)
# # (use "git rebase --continue" once you are satisfied with your changes)
# #
# nothing to commit, working directory clean
$ git reset HEAD~
$ git status
# # On branch master
# # Untracked files:
# # (use "git add <file>..." to include in what will be committed)
# #
# # .DS_Store
# nothing added to commit but untracked files present (use "git add" to track)
$ rm .DS_Store
$ git status
# # On branch master
# nothing to commit, working directory clean
$ git rebase --continue
# Successfully rebased and updated refs/heads/master.
$ git r
# * dbdb679 (57 seconds) <Maximilian Haack [email protected]> (HEAD, master) rolf ich hab lol gesagt
# * 874484d (2 minutes) <Maximilian Haack [email protected]> Initial commit
Created
November 28, 2012 12:44
-
-
Save coffeejunk/4161005 to your computer and use it in GitHub Desktop.
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git ris just my fancygit log --onelinethingy see: https://github.com/coffeejunk/dotfiles/blob/master/git/githelpers