Welcome to the wiki.
Git for writers
(overly simplified)
Update local repo, main branch, to be the same as the upstream main (sync)
git checkout main
git pull upstream main
Push the local main to your remote fork main
git push origin main
update the local branches to be in line with the local main. IMPORTANT: the follow assumes your remote fork is named origin in your git configuration.
git checkout <branch-name>
If have previously stashed work run:
git stash pop
git rebase main
Notes: rebase instead of merge as rebase doesn't create any new commits, it applies commits that have been added to main to your feature branch, so it stays clean.
Danger zone - Reset your feature branch to match your main branches state exactly, disregarding all changes to your feature branch (nukes the feature branch).
git checkout your-branch-name
git reset --hard main
Update your local branch so that it is the same as your branch on your remote Fork: Us this if you have made changes to your Forks branch in the Forge Web Interface.
git pull --rebase origin <name-of-branch>
See what files have changed when you push:
git diff --name-status origin/main..HEAD
Output:
- A - added
- M - modified
- D - deleted
List the commits about to be pushed
git log --oneline origin/main..main
or
git diff --name-only --staged
Push your local branch to you remote branch (of your fork)
git checkout <name of branch>
git push origin <name of branch>
Reset the current working branch to be the same as the main branch:
git reset --hard main