Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fork Workflow

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

1 - Fork a repo

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

$ git clone

3 - Configure remotes:

$ git remote add upstream 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 - Push branch to GitHub, to allow your mentor to review your code:

$ git push origin my-new-check

8 - Repeat steps 5-7 till development is complete. 9 - Fetch upstream changes that were done by other contributors:

$ git fetch upstream

10 - Update local master:

$ git checkout master
$ git pull upstream master

ATTENTION: any time you lost of track of your code – launch “gitk —all” in source folder, UI application come up that will show all branches and history in pretty view, explanation.

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

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

12 - 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

13 - Push branch to GitHub (with all your final changes and actual code of sevntu.checkstyle): We forcing changes to your issue branch(our sand box) is not common branch, and rebasing means recreation of commits so no way to push without force. NEVER force to common branch.

$ git push origin my-new-check --force

14 - Created build for testing and send it to any mentor for testing.

15 - Only after all testing is done – Send a Pull Request. Attention: Please recheck that in your pull request you send only your changes, and no other changes!! Check it by command:

$ git diff my-new-check upstream/master

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

Copy link

ryuran commented Aug 27, 2018

Hello. AMHA --force should be replaced by --force-with-lease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment