>gitinit:tocreate`.git`inthefolder
>gitstatus:whatisthestatusofthecurrentrepository# see your changes>gitadd<files>/gitadd.
>gitcommit-m"commit-message">gitlog--all--graph--decorate:visualizeshistoryasaDAG
>gitcheckoutaddress:enterdifferentnodes(changepointer`HEAD`)>gitcheckout<file>:throwawaythechangesintheworkingdirectoryandsetitbackastheversionof`HEAD`>gitdiff<file>:finddifferenceswiththelastsnapshot(knownas`HEAD`)>gitdiffpointer/address<file>:finddifferenceswithspecificsnapshot
>gitdiffaddress1address2<file>:finddifferencesbetweentwosnapshot
>gitremote:listremotes
>gitremoteadd<name><url>:addaremoteandnameit.
>gitpush<remote><localbranch>:<remotebranch>:sendobjectstoremote,andupdateremotereference
>gitbranch--set-upstream-to=<remote>/<remotebranch>:setupcorrespondencebetweenlocalandremotebranch
# then I can simply use `git push`(In github, it has already be done)>gitfetch:retrieveobjects/referencesfromaremote
>gitpull:sameasgitfetch;gitmerge
# git is very smart, it will always keep the latest version, do you don't have to worry that this command will cover your local changes.>gitclone:downloadrepositoryfromremote
# git clone will clone the whole history from remote, and use `git clone --shallow` can just clone the latest snapshot
When using git pull, you might encounter the error Your local changes would be overwritten by merge because you have make some changes to the last commit. If you don't want to commit your current changes, you can temporarily push your changes to a stack.
>gitstash# back up the changes to the stack; use `git status` after this command you will find no changes>gitstashlist[<options>]# list all the backups>gitstashshow[<options>][<stash>]>gitstashdrop[-q|--quiet][<stash>]# drop the backup at the top>gitstash(pop|apply)[--index][-q|--quiet][<stash>]# apply: merge the top backup with current workspace# apply + drop, files that have conflicts won't be deleted>gitstashbranch<branchname>[<stash>]>gitstash[push[-p|--patch][-k|--[no-]keep-index][-q|--quiet][-u|--include-untracked][-a|--all][-m|--message<message>][--][<pathspec>…]]>gitstashclear# clear the stack>gitstashcreate[<message>]>gitstashstore[-m|--message<message>][-q|--quiet]<commit>
tmuxnew-s<session-name># set up a new session<prefix>d||tmuxdetach# hang up the session and exittmuxls# list all sessionstmuxattach-t<name># attach to specific sessiontmuxkill-session-t<name># kill specific session<prefix>$||tmuxrename-session-t<name><newname># rename current session<prefix>m# Mouse mode toggle<prefix>-# splits the current pane vertically<prefix>_# splits the current pane horizontally