Git Flashcards
git init
initialize a new Git repo
git status
find out the current state of the repo
git commit
take a snapshot of the repo at a certain time
git add
stage new or changed files
git diff
see what has changed in a repo since the last commit
git reset
reset repo to a prior stat
git checkout
look at the prior state of the repo and switch branches
git branch
create a new branch
git merge
merges branches
git checkout -b
create and go to a new branch
git branch -a
get a list of all the branches in the local repo
git branch -D
delete a branch
git commit -a
- a switch with the ‘commit’ command to automatically:
- “add” changes from all known files (i.e. all files that are already listed in the index)
- automatically “rm” files in the index that have been removed from the working tree
- perform the actual commit;
- “add” changes from all known files (i.e. all files that are already listed in the index)
git commit -m
commit and add comment ‘COMMENT’
git log
shows the commit logs
git merge –no-ff
merges the branch to the master and keeps the merge history
git merge
merges the branch to the master
git add .
adds (stages) all the files in the current directory
echo “console.log(‘foo’)”»_space; foo.js
create a new file called foo.js in the current directory, with the single JavaScript command console.log(‘foo’) in it.
HEAD
a variable that points to a commit