You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git checkout master
# do code stuff, decide to start a branch
git checkout -b newbranch
# do more code stuff
git commit -m "commit one"
git push
git commit -m "commit two"
git push
# ... etc
# decide to squash commits for a pull request:
git reset --soft $(git merge-base --fork-point master)
git commit -m "feature xxx complete"
git push --force
# boom - single commit with specified message
Create and apply patches:
# clone repoX
git checkout master
# do code stuff, perhaps start a branch
git checkout -b newbranch
# do more code stuff
git commit -m "commit one"
git commit -m "commit two"
# ... etc
# decide to create a patch without pushing commits
# (useful when you don't have write access to a repository,
# or maybe you just don't want to pollute the branch):
git format-patch origin/master --stdout > repoX_diff_to_master.patch
# woot, 'reponameX_diff_to_master.patch' has a formatted diff of all commits
# clone repoX somewhere new
git checkout master
git apply reponameX_diff_to_master.patch
git status
# boom, all files are patched (but not committed)