|
These instructions can be applied to any branch by replacing master with the branch you're interested in keeping up to date, rel-3-2-patches for example.
# retrieve the updates from the upstream repository $ git fetch upstream -p # switch to the master branch $ git checkout master # rebase your local branch onto the the incoming changes # (this rewrites history as if you had done your work on the latest and greatest) # # WARNING: DO NOT DO THIS UNLESS YOU UNDERSTAND WHAT IT MEANS TO REBASE # In particular, if you've shared your local master branch with others, you *might* # want to avoid rebasing so as to avoid the inconvenience of changes to a shared history. # In this as in many things, effective communication and shared expectations are essential. # Littering your history with merge commits has a noise cost too. It's probably worth it to rebase. # # If you can't use rebase, instead do git merge upstream/master. $ git rebase upstream/master # now you're ready to update your fork $ git push origin master |
Use these instructions when making a change that only requires one commit.
Commit your changes
# View the list of your changes $ git status # If all new/modified/deleted files should be committed $ git commit -a # If only some new/modified/deleted files should be committed $ git add each new/changed file $ git rm each deleted file $ git commit |
Push your Changes
# Push changes to your fork first, when this completes you can go to GitHub and verify the commits look as you expect $ git push origin # Push changes to the Jasig repository $ git push upstream |
Use these instructions when making a change that requires multiple commits or review by others
Create a Topic Branch
# Create a topic branch, use the Jira Issue ID for ease of tracking $ git checkout -b UP-XXXX |
Commit your changes
# View the list of your changes $ git status # If all new/modified/deleted files should be committed $ git commit -a # If only some new/modified/deleted files should be committed $ git add each new/changed file $ git rm each deleted file $ git commit |
Push your Topic Branch
# Push the branch to your fork for others to review $ git push origin UP-XXXX |
Merge your topic branch into master
# Switch to the master branch $ git checkout master # Merge the topic branch into master $ git merge UP-XXXX # Resolve merge conflicts if any are reported $ git mergetool -y |
Push your Changes
# Push changes to your fork first, when this completes you can go to GitHub and verify the commits look as you expect $ git push origin # Push changes to the Jasig repository $ git push upstream |
Use these instructions when making a change that is required on multiple branches. For example fixing a bug in 4.1.0 (master) that also exists in 4.0.6 (rel-4-0-patches)
Record the commit ID(s) involved in the change. A tool such as gitk or the commit log on GitHub can be used as well.
# View the commit log for the current branch $ git log |
Checkout the branch to apply the change to
# Switch to the 4.0-patches branch $ git checkout rel-4-0-patches |
Cherry-Pick the commit(s) for the change into the branch
# Switch to the 4.0-patches branch $ git cherry-pick ba5eba11 cab005e 0ddba11 # Resolve merge conflicts if any are reported $ git mergetool -y |
Push your Changes
# Push changes to your fork first, when this completes you can go to GitHub and verify the commits look as you expect $ git push origin # Push changes to the Jasig repository $ git push upstream |
When a pull request from a non-committer comes in the following review steps need to be taken before and after the merge
If there is a problem with the merge do a local revert and then push that to GitHub
# Revert the merge commit $ git revert -m 1 COMMIT_ID_OF_MERGE_COMMIT # Push changes to the Jasig repository $ git push upstream |
Check out a new branch to test the changes — run this from your project directory
$ git checkout -b user-name-UP-XXXX master |
Bring in user-name's changes and test
$ git pull git://github.com/user-name/uPortal.git UP-XXXX |
Merge the changes and update the server
$ git checkout master $ git merge user-name-UP-XXXX $ git push origin master |
To release artifacts perform the following steps. You will also need to setup your account with Sonatype first. See Sonatype documentation.
# Insure you have no changed files or files that are not being tracked $ git status # git stash if need be. If you have files not being tracked, those should be added first to have the stash # remove from from the file system. $ git checkout master $ git pull upstream master # Optional, check for updated dependencies mvn versions:display-dependency-updates # Verify project builds properly $ mvn clean install license:check notice:check javadoc:javadoc # fix any issues # javadoc: Building with Java 8 often reports javadoc issues that did not occur when building with Java 7. # It's strongly discouraged but for Java 8 javadocs issues, you can consider whether it is reasonable # to add '-Xdoclint:none' as specified at the following to not run Xdoclint # http://stackoverflow.com/questions/15886209/maven-is-not-working-in-java-8-when-javadoc-tags-are-incomplete # Update: This did not work for me. The javadoc seemed to run twice. The first time OK and the second with errors # despite mvn help:effective-pom showing that every merged instance had -Xdoclint:none set. # # Here is an approach that sets the parameter based on a profile activated when using Java 8+: # <profiles> # <profile> # <id>disable-java8-doclint</id> # <activation> # <jdk>[1.8,)</jdk> # </activation> # <properties> # <additionalparam>-Xdoclint:none</additionalparam> # </properties> # </profile> # </profiles> # # license: If you get many error about license headers, the headers may have changed (this happened when Jasig # became Apereo). Execute the command 'mvn license:format' to replace existing license headers with # new license headers and commit the result. To update notices, run 'mvn notice:generate'. # if need be, do git commit -m "NOJIRA pre-release prep" $ mvn release:clean $ mvn release:prepare # Temporary: Verify maven release steps are committed. Look for commits like # [maven-release-plugin] prepare for next development iteration # [maven-release-plugin] prepare release jasig-widget-portlets-2.1.4 # # If not present: # - commit the change seen in https://github.com/Jasig/JasigWidgetPortlets/commit/f2597e442be90d350382c69ec5aee62b49b620d5 # - If the tag was pushed to upstream, you'll have to delete the local tag using the command 'git tag -d <tagname>' # and the remote tag using the command 'git push upstream :refs/tags/<tagname>'. Then re-run mvn release:perform. git log # release:perform uploads artifacts to Sonatype $ mvn release:perform # In Sonatype Staging Repository: # - Select repository and close it. Wait a bit and refresh. # - Validate artifacts on Sonatype and release artifacts. # Release is complete. # If you have multiple repositories and origin is not the Jasig repository, # you need to push commits to upstream to push the commits and the tag. git push upstream master git push upstream <tagname> |
If you have a single repository, or your origin repository is the Jasig repository, |
Additionally, it is helpful to do the following:
JIRA
Wiki Documentation