-
Notifications
You must be signed in to change notification settings - Fork 9
Branching and Merging
TL,DR: we encourage developing on your own dev branch and merging back to main.
- Make a branch
- Code away on your branch
- Commit changes to your branch
- Commit your local branch to github
- Ask for a Pull Request
- Merge!
After you have checked out a repository, you'll want to make a branch, e.g.
git branch your-branch-name
git switch your-branch-name
Git branches are local to your box; at this moment, github has no information about the branch you created.
If you need to switch back to main
git switch main
The filesystem doesn't provide a lot of clues if you're viewing a branch or main. Use this often:
git status
Periodically, you will want to pull files updated in main up to your branch. You can do this with
git pull
However, if you have "uncommitted" edited files in your branch, you won't be able to pull from main. Thus, you need to commit those changes first: "Add" them, then commit.
git add [filename or directory] ...
git commit
Provide details of what is changing. Note that this doesn't actually write anything back to github, but it will allow you to pull from main. Beware of potential conflicts when you pull from main, and resolve them in your branch.
Before you pull your changes to main, you need to make github aware of your branch.
git push -u origin your-branch-name
This now allows the Github, and most importantly, the Github pull request UI, to be able to manage your pull request.
If you originally checked out code via https, you'll need to re-home your repository to use SSH. See instructions on setting up SSH if you haven't yet set up SSH keys.
git remote set-url origin git@github.com:OurPlanscape/Planscape.git
Go here and click the big green button in the upper-right to create a pull request.
Note that this will bring up a reference to PatManley/Planscape. Change the option to OurPlanscape/Planscape:
Doing this minorly changes the selection dropdowns. On the right-side dropdown, change that to the name of your branch:
Then, hit the big green button on the upper-right again, and you have a pull request! Don't forget to give you pull request a good oneline name and a description.
You'll want to assign the pull request to a team member for review before you can pull it up into main.
The codebase in github will note that OurPlanscape/Planscape came from PatManley/Planscape. We don't need to merge anything back to PatManley/Planscape.