Notes about how to use git
There are cheat sheets available that contain advanced features, but this intro is intented to provide a quick start to learn git. Start with the core commands, and then learn new features as they are needed.
Concept: All git work is local, until published (git push)
Commands:
[Checkout] git init / git clone
[Change]
[Stage] git add .
[Commit] git commit
[Publish to origin] git push
Git Core Commands
- git init
- git add .
- git commit -m "initial commit"
Supporting Commands
- git status
- git log
Remote Repository Commands
- git clone [url]
- git pull
- git push
Install Git
Git Reference
Git Cheat Sheets
- https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf
- http://www.cheat-sheets.org/saved-copy/git-cheat-sheet.pdf
- https://jan-krueger.net/wordpress/wp-content/uploads/2007/09/git-cheat-sheet.pdf
Git Repositories
Remember when learing vi, there are basic concepts, and basic commands. The concepts, are that vi is a text editor, and that there are two modes. The main commands to know are to how modify a file, and then either save it, or discard changes.
[Vi Modes] vi is a text editor, with two basic modes
- Command Mode
- Insert Mode
To edit a text file:
-
[Open a file] ** vi filename
-
[Enter insert mode] ** i
-
[Make Changes]
-
[Quit, with saving] ** [Esc]:wq!
-
[Quit, without saving] ** [Esc]:q!
Later, we learn about moving, deleting, copying, searching, save as, opening multiple files, etc.