Skip to content

Instantly share code, notes, and snippets.

@bitops
Created April 15, 2016 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitops/a1596862eb6620c9deeb9037b6ab69c8 to your computer and use it in GitHub Desktop.
Save bitops/a1596862eb6620c9deeb9037b6ab69c8 to your computer and use it in GitHub Desktop.
$ git init .
Initialized empty Git repository in /Users/swittnekamp/tmp/git_index/.git/
$ cat <<EOF > foo.txt
Some example content
EOF
$ git add foo.txt
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: foo.txt
$ git commit -m "Add foo"
[master (root-commit) 0cf172d] Add foo
1 file changed, 1 insertion(+)
create mode 100644 foo.txt
$ sed -i -e 's/example/banana/' foo.txt
$ git diff
diff --git a/foo.txt b/foo.txt
index e8ef7a2..162472c 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1 @@
-Some example content
+Some banana content
$ git add foo.txt
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: foo.txt
$ sed -i -e 's/Some/Yellow/' foo.txt
$ git diff
diff --git a/foo.txt b/foo.txt
index 162472c..366cb25 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1 @@
-Some banana content
+Yellow banana content
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: foo.txt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: foo.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment