init
init --bareMinimal - repo only.
Generally a .git is appended to the root directory name.
Has no working directory and the content of the .git directory is at the root directly.
add
add -A : include file deletionsadd <path:at and underneath .>add -uAll deletes.
reset
reset <path>reset --hardRemoves from staging.
HEAD [~<n>]
N steps before HEAD.
Can be used to remove commits (also from origin).
Force push will be required.
HEAD [~<n>] <commit-hash><commit-hash> --softHEAD [~[n]].
Keep files in index (adds).
Commit.
-m ‘<name>’ [path]--amendMerge current changes with previous edit.
- may cause loss of info.
- do not amend public repos.
--no-editDo not offer to edit commit message.
Fetch.
--prune-- ??.
Clone - make a copy.
clone
[-b <branch].
clone <<url>.git> [target-directory <root-level> : also the new repo name]config [ --global]Username.
user.name "<>”Email.
user.email “<>”Show.
-lLists.
core.autocrlf <true|false>Auto CR LF.
remote
remote -vShows origin.
add origin <>.gitadd set-url origin <>.gitdiff
[path].
update-indexIgnore (even if versioned).
--assume-unchanged [path].git/config.
Enable password caching.
config --global credential.helper osxkeychainCommit.
--amendUndo.
checkout
Select branch.
<file>A particular file.
<file> <commit-hash>Only changes in that commit.
In an empty directory will check-out those files.
-b <branch_name>-- Creates then checkout new branch.
<commit-hash> git checkout stash@{0} -- <filename>clean
clean -d directoriesclean -f ?files?clean -i interactiveDeletes extra, i.e. unversioned files.
Branch.
()
Show the local branches.
<branch_name>
<branch_name> // to also reflect this push to origin :refs/tags/<tag_title>-dDeletes.
-D <branch>Deletes branch locally.
-rShow remote branch.
Exit.
Q.
(shift + q.
Log.
--oneline [branch]--no-merges [branch]cherry-pick<hash>push
push -fForce.
Origin.
push <tag-name> | <branch-name><hash>:<branch>Specific commit only.
Like one of the say two commits ahead of the origin/master.
<hash>:<branch> --set-upstream origin master--tags-- All tags.
pull
pull <source: origin>pull <source: branch>Will overwrite irrespective of branch.
diff
diff HEAD^^ <file_path>amend
Reset commit message.
git commit --amendgit commit --amend -m "New commit message"Tracking branch
branch -vvShows remote tracking branch.
show
show stash@{0}:<path>Display file content on screen.
revert
revert <path>Record new commit to revert previous (usually a faulty one).
remote
remote -vvShows.
remote add <url>remote set-url origin [push] <url>remove
Origin.
rebase
rebase <commit>Rebases current branch on to the referenced commit.
- may cause loss of info.
- do not rebase public repos.
rm
rm --cachedKeep local, delete only from git.
Removed.

