User Tools

Site Tools


Notes on Git.

git config --global push.default matching
# Add an upstream remote
git remote add upstream<user>/<repo>.git
# Fetch and merge upstream master. Push to origin.
git fetch upstream
git merge upstream/master
git push origin master
# Configuration
git config -l
git config --global "Jason Johnson"
git config --global
# List remotes
git remote -v
# Repository status
git status
# Move uncommitted changes to a new branch
git checkout -b fix/[fix]
git checkout -b feature/[feature]
# Add things to the next commit
git add file
git add -p
# Commit
git commit
git commit -m 'WIP'
# Push
git push -u origin fix/[fix]
git push
# Delete a remote branch (prepend a colon to branch name)
git push origin :fix/[fix]
# To rebase
git checkout fix/[fix]
git rebase master
git push --force origin fix/[fix]
# To interactively rebase
git rebase -i master
# "squash" most, "pick" one.
# Save and close.
# Write new commit message.
# Save and close.
# Force push.


notes/git.txt · Last modified: 2016/01/11 12:35 by jason