Jupyter Snippet CB2nd 03_git

Jupyter Snippet CB2nd 03_git

2.3. Learning the basics of the distributed version control system Git

mkdir myproject
cd myproject
git init
Initialized empty Git repository in
~/git/cookbook-2nd/chapter02/myproject/.git/
pwd
~/git/cookbook-2nd/chapter02/myproject
ls -a
.  ..  .git
git config --global user.name "My Name"
git config --global user.email "me@home.com"
echo "Hello world" > file.txt
git add file.txt
git commit -m "Initial commit"
[master (root-commit) 02971c0] Initial commit
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt
git log
commit 02971c0e1176cd26ec33900e359b192a27df2821
Author: My Name <me@home.com>
Date:   Tue Dec 12 10:50:37 2017 +0100

    Initial commit
echo "Hello world!" > file.txt
cat file.txt
Hello world!
git diff
diff --git a/file.txt b/file.txt
index 802992c..cd08755 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +1 @@
-Hello world
+Hello world!
git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will
      be committed)

    modified:   file.txt

no changes added to commit (use "git add")
git diff --stat
 file.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git commit -am "Add exclamation mark to file.txt"
[master 045df6a] Add exclamation mark to file.txt
 1 file changed, 1 insertion(+), 1 deletion(-)
git log
commit 045df6a6f8a62b19f45025d15168d6d7382a8429
Author: My Name <me@home.com>
Date:   Tue Dec 12 10:59:39 2017 +0100

    Add exclamation mark to file.txt

commit 02971c0e1176cd26ec33900e359b192a27df2821
Author: My Name <me@home.com>
Date:   Tue Dec 12 10:50:37 2017 +0100

    Initial commit
git clone https://github.com/mylogin/myproject.git