When using Git and GitLab to develop and check-in changes to the RAS codebase, follow this process.
Create a new branch in your local git repository that you will use to perform the work. Open a git bash shell within the appropriate repo, then run the command:
The 'branch_name' should be substituted with the JIRA number of the related ticket (e.g., RAS-1234).
This command will create a new branch with the given name and switch your view within git to that new branch. The branch you're currently working in will be displayed in the git bash shell in parentheses.
While in the branch, perform whatever work you need to do as normal. You can add new files to the repo with the command 'git add' and commit changes with 'git commit'. You can commit multiple times on the same branch, and the changes will remain local to your machine until you push them to GitLab in the next step.
If you are working on multiple tickets simultaneously, you can switch between branches with the command 'git checkout another_branch_name'. You will need to commit your outstanding changes in the current branch before switching; if you prefer not to do this, you can also use the 'git stash' command to temporarily save your changes and restore them later (see the documentation for git stash).
Once you've completed work on your branch and are ready to merge it, push it to the GitLab server with the command:
This command will push your branch and all of its committed changes to the central GitLab server.
Log into GitLab and go to the project in which you're working. In the 'Push Activity' feed, you should see that your branch has been pushed to the server and is awaiting merging.
Click the 'Create Merge Request' link beneath the push event to begin this process.
On the New Merge Request page, you can optionally change the title of your merge or add a description, but the most important thing is to assign the merge to someone. RAS policy is that all changes must be reviewed by another developer before they can be merged, so select another team member to assign your merge to.
Once an assignee is selected, click the 'Submit Merge Request' button to create the merge request. The person assigned to the request will be notified, and they should review the request as soon as is feasible and either approve it for merging or request further changes. It's a good idea to keep tabs on the status of your merge request to ensure that it doesn't get forgotten or run into merge problems.
Once the reviewer has approved your merge request, GitLab will merge your branch into the
If you are assigned a merge request to review, you will receive an email notification from GitLab. You can also see the number of outstanding merge requests in the navigation bar at the left side of GitLab.
When viewing a merge request, you can review the contents of the branch and leave comments using the tabs at the bottom of the page:
If you are ready to approve a merge request, check the box for 'Remove source branch' on the main page of the request, then click the 'Accept Merge Request' button.
GitLab will merge the branch into the master branch and report on the results. Usually merges will succeed without any further action necessary, but if merge conflicts are reported they'll need to be manually resolved. (Details TBD)
If it's determined that a branch pushed to GitLab should not be merged, or needs further work before it can be merged, the reviewer can close the merge request without merging the branch by using the 'Close merge request' button (preferably while also leaving a comment explaining why).
The submitter can then make further changes on their branch, if necessary, and push the new commits to GitLab in order to open a revised merge request.
Since a new branch is created for each JIRA ticket, you may end up with a large number of branches in your local git repos. Selecting the 'Remove source branch' option when merging in GitLab removes those branches from the server, but not from your local machine.
Once your branch is merged into master, you probably don't need it anymore. Leaving these branches as-is shouldn't hurt anything, but if you'd like to clean them up, you can use the command 'git branch' to print all of the branches that exist in the current repo, and 'git branch -d branch_name' to delete a branch.
When we want to upgrade to a new Kuali release, we need to update our ras-kuali repos to the latest Kuali revision and then select the appropriate release tags for the new build. Run the following commands in each of the ras-kuali repos:
Replace 'kc-1606' with the version of the new release; this will be the branch name used in the merge.
Run the git remote command to view the remote repositories linked to this repo.
If the output of this command shows the Kuali github addresses as a remote repo in addition to the GitLab addresses, you can skip to the 'git fetch' step below. Otherwise, you'll need to add the github repo as a remote source, replacing the URL here with the correct github address for the matching repo:
Once the github address has been set up as a remote repo, you are ready to fetch the changes from github to your local repository:
This will pull all new commits, branches, and tags that have been added to the github repo since your last fetch into your local repo.
Run the merge command to merge the contents of the Github 'master' branch into the current local branch.
Run the following commands to push the new changes and tags to the GitLab server. New tags are not pushed by default, so the second command is necessary to sync those to the server.
Create a merge request on GitLab as described above, and merge the new branch into the master branch. The repo has now been synced with the Kuali Github repo, and the changes can be pulled down to your local repo using the 'git pull' command.
The repo will be at the latest commit by default, so you may need to checkout a specific release tag in order to build a specific version of the project.