Moving Uncommitted changes to new branch

If you’ve made changes that you would not like to the current checkout branch, but rather create a new branch for it, you can do so by creating a new branch first, and then committing the changes:

1. Create a new branch (before committing your changes)

git checkout -b <new-branch-name>

2. Add,commit and push your changes

git add src/main/java/
git commit -m "my new changes"
git push origin <new-branch-name>

How to Test a Pull Request

When someone creates a pull request, it’s your responsibility to either accept the changes and merge it to your repository, or reject the changes and close the pull request. These days, Continuous Integration Development involves automation engines like Jenkins or TeamCity that monitor your source repository and can trigger builds for pull requests to ensure the resulting merge will run. However, it is a good idea to test the pull request locally.

To test pull request code locally follow these steps:

  1. Open git bash and ensure your working directory is clean by running git status
  2. get a copy of the PR by typing git fetch upstream pull/<id>/head:<branch>. for example you would type git fetch upstream pull/123/head:branch-name if you were testing Pull Request number 123 from branch called branch-name.
  3. Now that you have a copy of the branch, switch to it using git checkout branch-name. Your directory will now be an exact copy of the PR. Be sure to tell the author about any bugs or suggestions, as you cannot add your own changes to a pull request directly.
  4. When you are done checking out their work, use git checkout master to return to your local version of the source code.