Search code examples
gitlistcommand

overview list - most used git commands


Does anyone has a short list with most used git commands? Not the complete manual, but only what I approximately need daily. I'm new and would like a small list to put under my screen. This to pickup git faster.

That's all folks!


Solution

  • This is what I came up with. I have printed this out, and it helps me getting started with git commands:

    git init
    git status
    git log --summary
    
    git add file.txt
    git add '*.txt'     : add all files, also in subfolders
    git rm file.txt     : remove file
    git rm -r foldername: remove file and folders recursively
    
    git commit -m "Descriptive text of the change"
    
    git remote add origin https://github.com/try-git/try_git.git
    git push -u origin master
    git pull origin master
    git diff --staged
    
    git add folder/file.txt         : Add file to staged area
    git reset folder/file.txt       : Remove file from staged area
    git checkout -- folder/file.txt : checkout the last know version, restore.
    git branch feature      : create branch
    git checkout feature    : use branch (and do the work)
    git checkout master     : go back to master before merge
    git merge feature       : merge branch into master
    git branch -d feature   : delete that branch that is not used any more