-
-
Notifications
You must be signed in to change notification settings - Fork 821
Git Contributor Workflow
- Do not commit to master. Create your own branch and commit to it.
- Be descriptive in your branch names, commit messages, and pull request title and descriptions.
- Use
git status
often to check what branch you are on and see if you have any uncommitted changes.
Assuming you already have created your own fork and cloned it to your computer. Also, that you have configured the original Stellarium repository to upstream
(see Step 3), that is:
git remote add upstream https://github.com/Stellarium/stellarium.git
Initially, make sure you are in the master branch and that it's in sync with upstream/master:
git checkout master
git pull upstream master
You should never touch your master branch, i.e., never make changes and create commits in the master branch. In this way, git pull
should never invoke auto-merge commits. If it happens, stop! cancel the auto-merge commit and do git reset --hard upstream master
.
Create a local branch from master called myBranchName
(you can use any name you want, but try to use one that makes sense with your changes or refer to an issue number as issue123
.
git checkout -b myBranchName
After you finished your changes, use git add
to add the changed files and git commit
to create a local commit with all your changes. Check with git status
that you don’t have any dirty files and uncommitted changes around.
Before pushing your branch, you should ensure that your changes merge cleanly with the main repository. For that, you need to pull all changes done by other developers in the meantime.
git checkout master
git pull upstream master
git checkout myBranchName
git rebase master
If you get conflicts, you will see lines with ">>>>" added to those files. Resolve those conflicts manually, add them and finish the rebase. Check with git status
and/or gitk
if the merge went well and the history now contains your changes.
If all went well, push your changes to your remote fork.
git push origin myBranchName
Now that your changes are on GitHub, create a pull request with a good title and description.