Created: 2022-07-11 Mon 11:46
Version Control with GIT | Mon |
Data Structures | Tue |
Intro to Containers | Wed |
Threads and Asynchronicity | Thu |
Software Automation Testing | Fri |
git config --global user.name "Ada Lovelace"
git config --global user.email "ada@lovelace.io"
git config --global core.editor "emacs -nw"
git config --global init.defaultBranch main
git config --list
git config --help
cat ~/.gitconfig
~/.gitconfig
[core] editor = emacs -nw [init] defaultBranch = main [user] name = Ada Lovelace email = ada@lovelace.io
You know the commands:
ls |
list files, with the flags -al |
cd |
change directory |
mkdir |
make directory |
echo |
repeat text |
> |
output redirection |
cd ~/Desktop
ls -al
mkdir Planets
cd Planets
git init
Initialized empty Git repository in /Users/gonsie/Desktop/Planets/.git/
ls -al
total 0 drwxr-xr-x 3 gonsiorowski1 59746 96 Jul 11 10:43 . drwx------@ 16 gonsiorowski1 59746 512 Jul 11 10:43 .. drwxr-xr-x 9 gonsiorowski1 59746 288 Jul 11 10:43 .git
ls
all the timegit status
On branch main No commits yet nothing to commit (create/copy files and use "git add" to track)
echo "Cold and dry, but everything is my favorite color" > mars.txt
ls -al
total 0 drwxr-xr-x 3 gonsiorowski1 59746 96 Jul 11 10:43 . drwx------@ 16 gonsiorowski1 59746 512 Jul 11 10:43 .. drwxr-xr-x 9 gonsiorowski1 59746 288 Jul 11 10:43 .git -rw-r--r-- 1 gonsiorowski1 59746 50 Jul 11 11:08 mars.txt
git status
On branch main No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) mars.txt nothing added to commit but untracked files present (use "git add" to track)
git status
git add mars.txt
git status
On branch main No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: mars.txt
ls -al
total 0 drwxr-xr-x 3 gonsiorowski1 59746 96 Jul 11 10:43 . drwx------@ 16 gonsiorowski1 59746 512 Jul 11 10:43 .. drwxr-xr-x 9 gonsiorowski1 59746 288 Jul 11 10:43 .git -rw-r--r-- 1 gonsiorowski1 59746 50 Jul 11 11:08 mars.txt
git commit -m "Start of mars notes files"
[main (root-commit) a60f2b8] Start of mars notes file 1 file changed, 1 insertion(+) create mode 100644 mars.txt
git status
On branch main nothing to commit, working directory clean
git log
commit a60f2b8d99fe8e803695e7cfd37fc38b846125ad (HEAD -> main) Author: Ada Lovelace <ada@lovelace.io> Date: Mon Jul 11 11:26:25 2022 -0400 Start of mars notes file
ls -al
total 0 drwxr-xr-x 3 gonsiorowski1 59746 96 Jul 11 10:43 . drwx------@ 16 gonsiorowski1 59746 512 Jul 11 10:43 .. drwxr-xr-x 9 gonsiorowski1 59746 384 Jul 11 11:26 .git -rw-r--r-- 1 gonsiorowski1 59746 50 Jul 11 11:08 mars.txt
echo "The two moons may be a problem for Wolfman" >> mars.txt
git status
On branch main 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: mars.txt no changes added to commit (use "git add" and/or "git commit -a")
git diff
diff --git a/mars.txt b/mars.txt index df0654a..315bf3a 100644 --- a/mars.txt +++ b/mars.txt @@ -1 +1,2 @@ Cold and dry, but everything is my favorite color +The two moons may be a problem for Wolfman
git commit -m "Wolfman on mars?"
On branch main Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: mars.txt no changes added to commit (use "git add" and/or "git commit -a")
git add mars.txt
git commit -m "Wolfman on mars?"
[main f43dbe4] Wolfman on mars? 1 file changed, 1 insertion(+)
git log
commit f43dbe4f3e5f5d908500e587e117a998f750b3fe (HEAD -> main) Author: Elsa Gonsiorowski (Pluto) <gonsie@me.com> Date: Mon Jul 11 11:37:54 2022 -0400 Wolfman on mars? commit a60f2b8d99fe8e803695e7cfd37fc38b846125ad Author: Elsa Gonsiorowski (Pluto) <gonsie@me.com> Date: Mon Jul 11 11:26:25 2022 -0400 Start of mars notes file
git show
commit f43dbe4f3e5f5d908500e587e117a998f750b3fe (HEAD -> main) Author: Elsa Gonsiorowski (Pluto) <gonsie@me.com> Date: Mon Jul 11 11:37:54 2022 -0400 Wolfman on mars? diff --git a/mars.txt b/mars.txt index df0654a..315bf3a 100644 --- a/mars.txt +++ b/mars.txt @@ -1 +1,2 @@ Cold and dry, but everything is my favorite color +The two moons may be a problem for Wolfman
whew
git config --global |
Configure settings |
git init |
Create .git directory |
git status |
Query git about what's up |
git add |
'move' a file into git's staging area |
git commit -m |
Create a commit with a message, add a group of changes to the repository |
git log |
Show recent commits |
git diff |
Show what is currently different |
git show |
Detail last commit |
The images and lesson structure were taken from the Software Carpentry: Git Novice course.
The presentation was created with Emacs, Org Mode, and RevealJS.
View the source.