Skip to content

Instantly share code, notes, and snippets.

@jcsalterego
Created August 10, 2010 18:03
Show Gist options
  • Select an option

  • Save jcsalterego/517705 to your computer and use it in GitHub Desktop.

Select an option

Save jcsalterego/517705 to your computer and use it in GitHub Desktop.
1. Make directory.
overworked ~ $ mkdir lists
2. Get in it.
overworked ~ $ cd lists
3. Make a file of awesome.
overworked ~/lists $ cat > awesome
beets
bears
battlestar galactica
4. Initializing directory as a git repo.
overworked ~/lists $ git init
Initialized empty Git repository in /overworked/lists/.git/
5. Add awesome to this commit.
overworked ~/lists $ git add awesome
6. See progress so far.
overworked ~/lists $ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: awesome
#
7. Make first commit.
overworked ~/lists $ git commit -m "Awesome list"
[master (root-commit) bc59a66] Awesome list
1 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 awesome
8. Change the awesome list.
overworked ~/lists $ cat > awesome
beet
bears
battlestar galactica
9. See what changed.
overworked ~/lists $ git diff
diff --git a/awesome b/awesome
index ca033a9..192532d 100644
--- a/awesome
+++ b/awesome
@@ -1,3 +1,3 @@
-beets
+beet
bears
battlestar galactica
10. Check out the status.
overworked ~/lists $ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: awesome
#
no changes added to commit (use "git add" and/or "git commit -a")
11. Because the changes have not been explicitly added ("git add awesome"),
you'll need to use the -a (all) switch.
overworked ~/lists $ git commit -a -m "Just one beet."
[master d383d02] Just one beet.
1 files changed, 1 insertions(+), 1 deletions(-)
12. View the commits so far.
overworked ~/lists $ git log
commit d383d023fb512b434720b2441224a88490dea02c
Author: Overworked
Date: Tue Aug 10 11:55:02 2010 -0500
Just one beet.
commit bc59a667200221833a146133eec4bb84a693be62
Author: Overworked
Date: Tue Aug 10 11:49:08 2010 -0500
Awesome list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment