Skip to content

Development workflow with Git: Fork, Branching, Commits, and Pull Request

romani edited this page Sep 25, 2012 · 15 revisions

Author is Ruslan Dyachenko.

1. Fork a repo sevntu-checkstyle/sevntu.checkstyle.

2. Clone the sevntu.checkstyle project to your local machine (username – your Github user account name.):

$ git clone [email protected]/username/sevntu.checkstyle.git

3. Configure remotes:
$ cd sevntu.checkstyle
$ git remote add upstream git://github.com/sevntu-checkstyle/sevntu.checkstyle.git

4. Create a branch for new check:
$ git checkout -b my-new-check

5. Develop on my-new-check branch only, but Do not merge the upstream master with your development branch!!

6. Commit changes to my-new-check branch:

$ git add .
$ git commit -m "commit message"

7. Fetch upstream:
$ git fetch upstream

8. Update local master:
$ git checkout master
$ git pull upstream master

9. Repeat steps 5-8 till dev is complete.

10. Rebase my-new-check branch on top of the upstream master:

$ git checkout my-new-check
$ git rebase master

11. In the process of the rebase, it may discover conflicts. In that case it will stop and allow you to fix the conflicts. After fixing conflicts, use git add . to update the index with those contents, and then just run:
$ git rebase --continue

12. Push branch to GitHub:
$ git push origin my-new-check

13. Send a Pull Request.

More detailed information you can find on Git-Workflow, Git-rebase and Rebasing.

Clone this wiki locally