Git Commands Flashcards
Add current working directory to the repository
git add .
Initialize a Git repository
git init
What command do you use to see what file was changed in your repository since the last commit
git status
Commit staged changes with a message
git commit -m ‘[message goes here]’
Track new file or stage file for commit
git add [file name]
Stage and commit all changes
git commit -a
What commas do you use to list the branches of a repository?
git branch
Switch branch
git checkout [branch name]
Merge branch to current working branch
git merge [branch name]
What command would you use to delete a branch label
git branch -d [branch name]
Stage and commit all changes with a message
git commit -am ‘[message goes here]’
Who would you upload changes from a repository named origin from your computer to a Github repository named master?
Git push origin master
Who would you download changes from a GitHub repository called upstream to a master repository in your computer?
Git pull upstream master
How do you view the commits history of the repository you are working on?
git log
What command is used to compare to commits in git
git diff [commit id] [commit id]