Changes

Jump to navigation Jump to search
3,448 bytes added ,  14:41, 19 January 2012
Created page with "== Summary == Support long or ever standing, all time being on top, downstream patchsets in a Git repository. == Install == Clone Gatch repository: git clone git://git.sugar..."
== Summary ==

Support long or ever standing, all time being on top, downstream patchsets in a Git repository.

== Install ==

Clone Gatch repository:

git clone git://git.sugarlabs.org/sdk/gatch.git ''<INSTALL-PATH>''

Add {{Code|gatch}} command to the {{Code|PATH}} environment variable, e.g., in {{Code|~/.bashrc}} file (you need to relogin):

echo PATH=''<INSTALL-PATH>'':$PATH >> ~/.bashrc

== Usage ==

This section operates with the following terms:

* ''upstream remote''<br>The name (from {{Code|git remote}} command output) of repository that contain ''upstream branch'';
* ''upstream branch''<br>Git branch in ''upstream remote'' repository that is beeing used as a basis for ''downstream branch'';
* ''downstream remote''<br>The name (from {{Code|git remote}} command output) of repository that contains ''downstream branch'', might be the same as ''upstream remote'';
* ''downstream branch''<br>Git branch in ''downstream remote'' that is based on ''upstream branch'' and contains downstream commits all time on top of ones from ''upstream branch''.

=== Initiate downstream branch ===

Add upstream remote (if it is not the same as the current remote, {{Code|origin}}) for repository downstream branch will be based on:

git remote add ''<UPSTREAM-REMOTE>'' ''<UPSTREAM-URL>''

Create downstream branch:

git fetch ''<UPSTREAM-REMOTE>'' --no-tags
git checkout ''<UPSTREAM-REMOTE>''/''<UPSTREAM-BRANCH>'' -b ''<DOWNSTREAM-BRANCH>''

Register downstream branch as a Gatch branch:

gatch init ''<UPSTREAM-REMOTE>'' ''<UPSTREAM-BRANCH>''

This command will create watershed commit with comment {{Code|[gatch-''<DOWNSTREAM-BRANCH>''] Initiate downstream branch}}. Since this time, all downstream commits will be after watershed one, even after re-basing to the recent upstream branch.

=== Populate downstream commits ===

Use downstream branch as a regular Git branch, i.e., create new commits.

=== Merge upstream updates ===

Being in downstream branch, type:

gatch merge

This command will:

# fetch recent upstream branch commits;
# rollback downstream commits to the currently local upstream HEAD;
# pull upstream commits on top on currently local upstream HEAD;
# re-apply all downstream commits on top on new upstream HEAD.

The whole process does not break Git's consistent history, i.e., while pushing new downstream branch to the server, there is no need in {{Code|--force}} argument.

The one obvious cave is that on the 4th step, git might complain about not possible merging. These conflict need to be solved as regular Git's merge conflicts.

=== Tips ===

''Upstream merge right after clone''
: {{Code|init}} command keeps all information regarding upstream repository and branch in {{Code|.sweets/gatch*}} files. So, it is possible to clone downstream branch and run {{Code|merge}} command, gatch will add upstream remote if it absent in local repository.

''Avoid upstream merge history''
: Gatch does not break Git history, thus, it is possible to see downstream commits that existed before every upstream merge. It is useful to {{Code|git --hard reset}} sometimes, but might be annoying to see all of them in {{Code|git log}} output. To suppress showing these commits, use {{Code|git log --first-parent}} command.

== Getting involved ==

* Read the [http://git.sugarlabs.org/sdk/gatch/blobs/master/HACKING HACKING] file to know how to contribute with code.
* Gatch [http://git.sugarlabs.org/sdk/gatch sources].

Navigation menu