*Deprecated* See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation

I am a Git-rookie, and this information may need corrections, but I think that rough documentation is better than no documentation. I'm hoping that this will turn into a fully polished page. Please comment or contribute, or just complain in order to make it better.

VIVO 1.6 is the first release cycle since we switched our version control system from Subversion to Git.

We are trying to adhere to the "GitFlow" model. It is a git-based work flow that was originally decribed here: http://nvie.com/posts/a-successful-git-branching-model/. One of the major changes from our previous work flow is the way that the release branch is used.

Do I have to merge? Can I just make my changes twice?

We would like to take full advantage of Git's merge ability. We want to be able to merge the entire maintenance branch back to develop. Git might actually be clever enough to deal with that if you make your changes manually in both places. But until we know...

What if I accidentally make the change on the develop branch first?

Check out the section below entitled Doing it Backwards

To obtain the maintenance branch:

These steps must be performed on:

  • your copy of the VIVO repository
  • your copy of the Vitro repository

using the command line:

CommandsComments
git pull
It may be necessary to update the develop branch first.
git checkout --track origin/maint-rel-1.6

(note: that's dash-dash track)

This will create a maint-rel-1.6 branch in your repository. This local branch is tracking the remote branch on GitHub (origin).

using SourceTree:

ActionsComments

Click the "Checkout" icon in the tool bar.

Select the "Checkout New Branch" tab

In the selection box for "Checkout remote branch:" choose origin/maint-rel-1.6

"Local branch should track remote branch" should be checked.

Click "OK"

This will create a maint-rel-1.6 branch in your repository. This local branch is tracking the remote branch on GitHub (origin).

To commit a change on the maintenance branch

using the command line:

CommandsComments
git fetch origin
Make sure that your repository is up to date.
git checkout maint-rel-1.6
Do this even if you were on maint-rel-1.6 already. This insures that you have the latest changes from the fetch.
Make your changes
git add --all

Stage all of your changes (including new files) for committing.

git status

This is optional. It lets you see:

  • What changes will be committed.
  • What changes are not stages for commit.
  • If any new files are "untracked".
git commit -m "I'm fixing this."
Commit the change to the maintenance branch.

using SourceTree:

ActionsComments

Click on the "Fetch" icon in the toolbar. Click on "OK"

Make sure that your repository is up to date.
Double-click on maint-rel-1.6 in the BRANCHES list.

This checks out the maintenance branch.

Do this even if you were on maint-rel-1.6 already. This insures that you have the latest changes from the fetch.

Make your changes
Drag the changed files to the Index (staging area) 
Click the "Commit" icon in the toolbar. Enter a commit message, and click "OK".Commits the changes to the maintenance branch.

To merge your change to the develop branch

using the command line:

CommandsComments
git checkout develop
Switch to the develop branch, so you can merge the change.
git merge maint-rel-1.6
Note: this merges ALL of the changes from the maintenance branch, including the ones that the previous person forgot to merge.
git push origin develop maint-rel-1.6
Push both branches to GitHub ( origin

using SourceTree:

ActionsComments
Double-click on develop in the BRANCHES list.Switch to the develop branch, so you can merge the change.
Click the "Merge" icon in the toolbar. In the dialog box, see that your commit in the maint-rel-1.6 is selected (see below), and click "OK" 
Click the "Push" icon in the toolbar. Select both "develop" and "maint-rel-1.6" (see below), and click "OK". 

Doing it backwards

You made your change to the develop branch instead of to the maintenance branch. Now what?

Don't panic. Get the number of the commit, pull it into the maintenance branch with git cherry-pick, merge, and push.

using the command line:

Commands

Comments

git checkout maint-rel-1.6
Change to the maintenance branch.
git cherry-pick 0cc3817

Copy your commit from the develop branch to the maintenance branch. If you have more than one commit, you can list them all on this command, or use multiple cherry-pick commands.

git checkout develop

I don't know if these steps are necessary. Your changes are already in the develop branch, so do you still have to do the merge?

In other systems like Subversion, you would do the merge to keep the system's internal "paperwork" up to date. Is this necessary on Git? Until someone explains it to me, I'm going to recommend the merge.

git merge maint-rel-1.6
git push origin develop maint-rel-1.6
Push both branches to GitHub ( origin

 

 

  • No labels