Git and Github Flashcards
git config –global user.name “[name]”
This command sets the author name and email address respectively to be used with your commits.
git init [repository name]
This command is used to start a new repository.
git clone [url]
This command is used to obtain a repository from an existing URL.
git add [file]
This command adds a file to the staging area.
git add *
This command adds one or more to the staging area.
git commit -m “[ Type in the commit message]”
This command records or snapshots the file permanently in the version history.
git commit -a
This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.
git diff
This command shows the file differences which are not yet staged.
git diff –staged
This command shows the differences between the files in the staging area and the latest version present.
git diff [first branch] [second branch]
This command shows the differences between the two branches mentioned.
git reset [file]
This command unstages the file, but it preserves the file contents.
git status
This command lists all the files that have to be committed.
git log
This command is used to list the version history for the current branch.
git branch
This command lists all the local branches in the current repository.
git branch [branch name]
This command creates a new branch.