pwdmkdir myTestRepocd myTestRepo.git initls -a: presence of .gitvi hello.sh - Open a new file in vi (or vim) named hello.sh.i - Enter “Insert” mode. #!/bin/bash
echo "Hello world"
Esc - Leave “Insert” mode.:wq, Enter - Issue the command “Write, then quit.”chmod +x hello.sh./hello.shgit status: “untracked”git add hello.sh
Other wildcards:
*.txt - nonrecursive\*.txt - subdir recursivegit add -A - match working directory.gitignoregit statusgit commit -m "Initial commit."vi hello.sh - Open the editor.j - We’re in command mode, so this doesn’t insert a character, but instead moves the cursor down a line.llllllllllllllllll - Move the cursor between d and ". If you overshoot, you can press h as many times as you need to go back the other way.i - Enter insert mode., I can use git! - Enter some text.Esc, :wq, Enter - Return to command mode, save, and quit, as before../hello.shgit statusgit diff --word-diff hello.shgit commit -a -m "Add qualifications.".git loggit diff --word-diff HEAD~ HEAD hello.sh
HEAD~~~: “the parent of the parent of the parent of HEAD”HEAD~4HEAD@{yesterday}1c002d as shorthand for 1c002dd4b536e7479fe34593e72e6c6c1819e53bDANGER ALERT: If you have uncommitted changes in your working directory, the following commands can destroy them, leading to lost work. Make sure you git status to make sure your working directory is clean!
git checkout HEAD~
'detached HEAD' statecat hello.shgit checkout master.git revert HEAD: add a new commit “reversing” the last oneMake a new bare repo on GitHub
myTestRepogit remote add origin https://github.com/Username/myTestRepo.gitgit push origin mastergit fetchgit pullgit cloneThis page was automagically generated by GitHub Pages from a repo that you can find here. You can see the license for this page below.
git checkout -b <branchname>git refloggit checkout <branchname>We’ll do this live!
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.