Git Flashcards
stage file(s) in git start tracking file(s) in git
git add «file1» («file2» «file3»)
git add «folder»
» adds precisely this content to the next commit
show git commit history of the branch
git log
what is a git remote?
a label to a url
add git remote with a label?
git remote add «remote name» «remote label»
show git remotes and their remote URLs
git remote -v
stage all file modifications and new files in git
git add .
show local git branches
git branch
show remote git branches
git branch -r
show all git branches
git branch -a
git branch –all
create and switch to new git branch
git switch -c «branch»
git checkout -b «branch»
download git repository
git clone «repository url»
update local cache of specific git remote and remove outdated branch trackings
git fetch «remote» –prune
download git repo to specific folder
git clone «repository url» «folder»
show short version of git status
what is left and what is right?
git status -s
» left: status of staging area
» right: status of workspace
show differences between git staging area and workspace
git diff
show differences between git staging area and last commit
git diff –cached
git diff –staged
commit all already tracked files in git
git commit -a
delete file(s) and remove file(s) from git as well
git rm «file1» («file2 «file3»)
delete file(s) and remove file(s) from git when content was modified or staged
git rm -f «file1» («file2 «file3»)
remove file(s) from git only
git rm –cached «file1» («file2 «file3»)
show preformatted git log
git log –pretty=oneline/short/full/fuller
show git logs with ASCI graph
git log –graph
show all git commits that changed a specific string
git log -S «string»
show all git commits with specific string in commit message
git log –grep=«string»
show all git commits without merge commits
git log –no-merges
change git commit message
add or update files of last commit
git commit –amend
» overwrites commit with current staging area
unstage file in git
git reset «file»
git restore –staged «file»
*git unstage «file»
reset file in workspace to status of last git commit
git checkout – «file»
what is the difference between git fetch and git pull?
pull = fetch + merge
change name of git remote
git remote rename «old name» «new name»
what additional information does an annotated git tag contain apart from tag name?
» tagger email
» tag date
» tag message
create lightweight git tag
git tag «tag name»
create annotated git tag with a message
git tag -a «tag name» -m «commit message»
put leightweight tag on existing git commit
git tag «commit» «tag name»
upload specific git tag on the remote
git push «remote» «tag name»
delete local git tag
git tag -d «tag name»
delete branch on git remote
git push «remote» –delete «remote branch»
git push «remote» -d «remote branch»
git push «remote» :«remote branch»
create alias for git command
git config –global alias.«alias name» ‘«git command»’
show all git commits of specific branch
git log «local branch»
show all git commits of all branches
git log –all
delete local git branch
git branch -d «local branch»
how does ‘git merge «branch»’ work?
» tries to merge «branch» into current branch
If the merge fails:
» resolve merge conflicts
» stage resolved files
» complete with ‘git commit’
show all merged in git branches
git branch –merged
show all not yet merged in git branches
git branch –no-merged
update local cache of specific git remote
git fetch «remote»
» new remote branches don’t create local copies
push git branch to specific remote branch
git push «remote» «local branch»:«remote branch»
create, name and switch to branch and track specific remote git branch
git switch -c «local branch» «remote»/«remote branch»
git checkout -b «local branch» –track «remote»/«remote branch»
create, name and switch to branch and do not track any remote branch
git switch -c «branch» –no-track
git checkout -b «branch» –no-track
set or update the current git branch’s tracking to specific remote branch
git branch -u «remote»/«remote branch»
get git remote tracking status of all branches
git fetch –all; git branch -vv
rebase git branch onto another branch
git rebase «base branch» «head branch»
add file removal(s) to git staging area
git add «file1» («file2 «file3»)
push a rebased git branch to remote
git push «remote» «local branch» –force-with-lease
merge in whole git branch as a commit
git merge –squash «local branch»
do one time git pull by url
git pull «remote url»
show git commits of one branch since last common ancestor with another branch
git log «old branch»..«new branch»
git log ^«old branch» «new branch»
git log «new branch» –not «old branch»
show git commits of both branches since last common ancestor with another branch
git log «branch1»…«branch2»
show git commits with short hashes
git log –abbrev-commit
show a git commit’s details
git show «commit»
show a git commit parent’s details
git show «commit»^
enter interactive git staging
git add -i
partially add git file
git add -p «file»
save current work on tracked files without git commit and reset workspace
git stash