-
Notifications
You must be signed in to change notification settings - Fork 613
Working with GitHub
-
Fork from the main project. We use the master branch in this example.
Link: https://github.com/eclipse/eclipse-collections -
Copy this forked repository’s link. Usually, this contains your account name.
Example: https://github.com/<username>/eclipse-collections.git -
Create a local clone of this fork. By default git will create a remote named
origin
+cd <working directory>
git clone <link from step 2>
cd eclipse-collections
-
Configure upstream remote
git remote add upstream https://github.com/eclipse/eclipse-collections.git
-
Fetch contents from remote
git fetch --all
Note: git is quite flexible and there are many ways to do this work. The following is a very condensed, simplified outline. For example, it’s prudent to use a branch for working on a sizable code change, which is not discussed below.
-
Syncing fork
git fetch --all
git pull upstream master --rebase
-
Add (or remove) the changes to git (see git add or git rm help online)
-
Commit and push changes to fork
git commit --message "My commit message as per guidelines" --signoff
git push
-
Link to commit message guidelines.
-
If a Github issue exists that this PR is fixing, add "Fixes #<issue>" or "Resolves #<issue>" at the end of the commit message, or on a new line. You don’t have to create a new issue just to close it with a PR. A PR is an issue (they share a namespace / sequence number).
-
-
When you’re ready for the pull request,
-
Sync your fork (See step 1)
-
git push
-
-
Create a Pull request via the Github UI.
-
Pull requests may result in review comments or build failures.
-
Make necessary code changes to address the review feedback.
-
Repeat steps 6 and 7 to add, commit and push changes.
-
If you have more than one commit, squash multiple commits into one and then push them using interactive rebase
git rebase -i upstream/master
-
The interactive rebase is a mechanism to squash all individual commits of the fork to one single commit.
-
You should see a list of commits, each commit starting with the word "pick".
-
Ensure the first commit says "pick" and change the rest from "pick" to "squash". — This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit.
-
Save and close the editor.
-
You will get an opportunity to change the commit message
-
Save and close the editor again.
-
Force push the final, squashed commit
git push -f
-
-
Pull request is automatically updated with the recent changes.
-
Rinse and repeat until pull request is approved and merged.
Eclipse Collections