Basic GIT Commands Flashcards
working directory
where you have a local copy of the git repository checked out
staging area
where files are added before being committed
git init
initializes a directory as a Git repository
git clone [url]
copy a git repository so you can add to it
git add [file]
adds a new file or new modifications of an existing file to the staging area
git status -s
view the (short) status of your files in the working directory and staging area
git diff
shows diff of unstaged changes
git diff
cached
git diff HEAD
show diff of all changes (staged or unstaged)
git diff
stat
git commit -m ‘message’
records a snapshot of the staging area (all those files and modifications that have been added to it)
git commit -a
automatically stage all tracked, modified files before the commit
git reset HEAD
[file]
git branch
list your available branches
git branch [branchname]
create a new branch
git checkout [branchname]
switch to a new branch context
git checkout -b [branchname]
create and immediately switch to a branch
git branch -d [branchname]
delete a branch
git merge [branchname]
merge a branch context into your current one
git log
show commit history of a branch
git tag -a [tag] [commit SHA]
tag a point (the current commit or the given commit) in history
git remote
list your remote aliases
git remote add [alias] [url]
add a new remote repository of your project
git remote rm [alias]
removing an existing remote alias