Last active
January 22, 2018 17:24
-
-
Save MariaSzubski/17d89d2d53c4dba6cdf79f994cacec0b to your computer and use it in GitHub Desktop.
Useful git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log/diff --stat | |
# diagram of changes per file | |
log/diff --shortstat | |
# count of changes | |
log --oneline | |
# sha + commit messages | |
shortlog | |
# commit messages | |
shortlog -s | |
# commit count per author | |
branch <branch-name> | |
# create new branch | |
checkout -b <branch-name> | |
# create new branch and move to it | |
fork | |
# Create your own copy of a repo | |
# push changes to your fork before creating a pull request | |
clone | |
# Pull repo to new directory (or remote -> local) | |
fetch | |
# get latest changes from origin, don't merge | |
fetch upstream | |
# sync with upstream repo | |
checkout master | |
# ready to sync | |
merge upstream/master | |
# merge upstream repo into local files | |
rebase master | |
# if upstream adds new commits | |
git pull | |
# fetch + merge | |
git push | |
# push changes to origin | |
git push -u origin <branch_name> | |
# link local branch to existing repository | |
git remote | |
# add connection to original repository to pull down changes | |
reset | |
# unstage, keep changes | |
reset --hard | |
# back to last commit | |
reset --hard origin/master | |
# reset to remote repository | |
------ | |
To merge branches: | |
git checkout <branch> | |
git merge master | |
git checkout master | |
git merge <branch> | |
------ | |
To Upload: | |
git push gdi master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment