User Tools

Site Tools


notes:git

Notes on Git.

git config --global push.default matching
 
# Add an upstream remote
git remote add upstream https://github.com/<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 user.name "Jason Johnson"
git config --global user.email jason@jasonjohnson.org
 
# 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.

Guides

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