Difference between revisions of "Dev:Git Fundamentals"

From Synfig Studio :: Documentation
Jump to: navigation, search
(Synfig git fundamentals forum Postby kinderp + djay comments)
 
(No difference)

Latest revision as of 01:31, 18 February 2016

Would like to fix your ideas about branches on synfig and its git workflow ?

Let's start :)

Branches

The branches are:

 [me@host synfig]$ git branch -r
 origin/0.64.2
 origin/0.64.x
 origin/1.0.x
 origin/HEAD -> origin/master
 origin/dev-1.0.1
 origin/eldruin_new_cairo_core
 origin/eldruin_transformation_matrix
 origin/genete_cairo_core
 origin/genete_new_cairo_core
 origin/master
  • "master" is the stable branch
  • "eldruin_new_cairo_core", "eldruin_transformation_matrix", "genete_cairo_core", "genete_new_cairo_core", are username_feature branches where new features are coded and then merged to master
  • "0.64.2" are the branches of the old releases.
  • "0.64.x", "1.0.x" are the bug fix branch. Example, the 1.0.x version. Last stable from this branch is 1.0.2. This is where a 1.0.3 could be baked.

Stable branchs are tagged:

 [me@host synfig]$ git tag
 0.64.1
 0.64.1-rc1
 0.64.1-rc2
 0.64.2
 0.64.3
 1.0
 1.0.1
 1.0.2
 ...

Workflow

To contribute i should:

  • fork synfig on github
  • clone my forked repo, "origin" for convention, in my local machine
  • add original synfig repo, "upstream" for convention, with
 [me@host synfig]$ git remote add upstream ...

At this point i haven in my local machine, all xx upstream branches, all xx origin branches and one master local branch.

It's recommanded to create a branch from updated master for hosting your contribution

 $ git checkout master
 $ git fetch upstream
 $ git rebase upstream/master
 $ git branch me_mybranch
 $ git checkout me_mybranch

Nota : "git checkout -b me_mybranch" is a shortcut for last two commands

If it's a minor fix (typo / doxygen code documentation / ... for example) you can do it from your origin master. But be aware that a nice name for "me_mybranch" help the brain to work less ;-). It's also useful for the rest of the universe who take a look to your contributions.

So i starts coding in my bug fix, feature, test ... local branch and add has necessary commit and comments.

 $ git add my_files
 $ git commit -m ....

And when i have finished, my local branch is updated.

To synch local with upstream i should :

  $ git fetch upstream (update all branches in upstream)
  $ git checkout master
  $ git merge upstream/master | git rebase upstream/master

So my local branch should be synchronized with original synfig repo (upstream).

Just before sending to github, don't forget to check the final integration of your contribution and the actual master code still are stable. If things are well commented, all files commited ...

Now i can update my forked repo on github (origin)

  $ git push origin me_mybranch

Make a pull request on github.

When the pull is accepted, it's time to update the tracker and documentation part of the project.