Addingselectivelytothestagingarea:
gitaddp
Tagging:
Creatingatag:
Pushingtagtoorigin
gittag<tagname>
gitpushtags//Pushesalltagstoorigin
Deletingatag
gitpushorigin:<tagname>//Identicaltoabranch
Cherrypicking
Diffofcommitsbetweenbranch1andbranch2.Usefulwhenlookingtocherrypick
commitsfrombranch1tobranch2.
gitcheckoutbranch1
gitcherrybranch2
gitcherryvbranch2shallgivethecommitmessagealongwiththecommithash.
Pickingacommitandapplyingit
gitcherrypick<commithash>
Deletingabranchfromorigin//Pleasebeverycarefulwhiledoingso
gitpushorigin:<branchname>
Pruninglistofbrancheswhilefetching
gitfetchp
Waystorecoveradeletedbranch
gitreflog
Lookforyourbranchinthislog.Ifyouhaveswitchedtothatbranchorfromthat
branchinyourlocalhistory,youcancheckoutthecommithashtoretrievethe
branch.Justcheckoutanewbranchusingthatcommithash.
Logoutput
gitloggraphpretty=format:'%Cred%h%Creset%an:%s%Creset
%C(yellow)%d%Creset%Cgreen(%cr)%Creset'abbrevcommitdate=relative#glog
Makethisanaliasorsearchforgloginyourcommandhistory.
//Thesearejustsomeofthecommandsthatarenottoowellknownbutarerequiredfromtimeto
time.Feelfreetoaddyourshere.
Ctrl+N/(Command+Oinmac)openaclass
Ctrl+Shift+N/(Command+Shift+O)openafile
Ctrl+BGotodefinition
Ctrl+Alt+BGotoactualdefinition.Skipsoverinterfaces
Ctrl+Alt+VIntroduceavariable
Ctrl+Alt+MExtractafunction
Ctrl+Alt+LReformatcode
Alt+F7FindUsages
Ctrl+F12Browsemembersmovetothemquickly
Shift+F6Rename
Alt+InsertMagicwand
Linux Tips
LearntouseCtrl+R.
Getyourcurrentlycheckedoutbranchnameonthepromptitself.
ColoredGitdiffoutput.Mucheasiertoseethechanges.