Here are some tips on how to make your life with Git easier when contributing.
How To Set Up Your Git¶
- Create a fork of the Elegant repository by clicking on the “Fork” button.
- Clone your fork to your computer by clicking on the “Clone or download” button and following the instructions there.
- When in the Git repository of your fork, run the following command to set the main repository as the upstream:
git remote add upstream https://github.com/Pelican-Elegant/pelican-elegant.git
Updating/Rebasing to Upstream¶
Occasionally – often before a pull request is able to be merged – you will need to update your own (fork) repository to the upstream (i.e. Elegant) development (i.e.
next) branch. This can be done as follows:
git fetch upstream next
git rebase upstream/next
Squash Commits & More Complex Rebasing¶
When creating a pull request in GitHub, you have the option to squash all commits, but sometimes you need to fix either the mess you made or some clashes that prevent a merge of the two branches.
In both cases, the following command is your Swiss-army knife:
git rebase --interactive upstream/master
For more on the interactive rebase command of Git, see its official documentation.