The Basics


git version to see whether it is installed git config --helpgit config --global core.editor “nano”
git config --global user.name "Jane Doe"git config --global user.email jane@example.comgit config --list
git help <any command>
git help config will give documentation on git configgit config --help for the same output
--help can be used with (almost) any command, even git help --help
By Jan Misset, uploader: Alf van Beem – Own work (public domain)
git init <optional path>
git init to create the repo in another locationgit status
nano README.mdgit status

Working directory: where untracked changes live
Staging area: where you prepare your snapshots
Repository: tracks the history of changes in your project
git add <filename>git add -A
git add .
git rm --cached <file name>git restore --staged <file name>
git add . or git add -AGit is not a file storage system: do not use it for storing/tracking large files!
git commit
git commit –m “a message briefly saying what you changed and why”
-m option instead

git reset HEAD~


git commit --amend -m "changed commit message”
git commit --amend --no-edit
--amend gradually build up a larger coherent commit.AVOID amending a commit that is already pushed to remote!
--amendgit commit -m "Message" -m "Description"
git log
.gitignore.gitignore is a hidden text file.gitignore!.gitignore wildcards* Matches any number of characters within a filename.
*.txt will match all files with the extension .txt in any directory.? Matches a single character within a filename.
image?.png will match files like image1.png or pictureA.png./ Matches the root directory of the repository.
/config will match a directory named config only in the root of the repository.[] Matches any single character within the brackets.
file[123].txt will match file1.txt, file2.txt, or file3.txt.! Negates a pattern and includes files that would otherwise be ignored.
!important.txt will exclude important.txt from being ignored, even if there’s a wildcard pattern that matches it..gitkeep.gitkeep file to the folder
.gitignore file that ignores any files ending in the extensions from step 4 (tip: use * wildcard!)
git add -p

WHY?? Why did you make use the CLI for Git?? T_T
git st instead of git status for examplegit config --global alias.sw switch
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.last 'log -1 HEAD'