From 14353c12bfc35f82441993ddeff0ecd36bcfee86 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 16 Jun 2014 11:02:57 -0400 Subject: [PATCH] Documentation --- src/main/java/com/gitblit/tickets/commands.md | 2 +- src/site/tickets_using.mkd | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gitblit/tickets/commands.md b/src/main/java/com/gitblit/tickets/commands.md index 87fe515c..84d9ccc8 100644 --- a/src/main/java/com/gitblit/tickets/commands.md +++ b/src/main/java/com/gitblit/tickets/commands.md @@ -6,6 +6,6 @@ To review an updated patchset To review a rewritten patchset - git fetch origin && git checkout ${ticketBranch} && git reset --hard origin/${ticketBranch} + git fetch origin && git checkout -B ${ticketBranch} diff --git a/src/site/tickets_using.mkd b/src/site/tickets_using.mkd index 3cda7314..57128457 100644 --- a/src/site/tickets_using.mkd +++ b/src/site/tickets_using.mkd @@ -59,6 +59,14 @@ Any authenticated user who can clone your repository. ...add one or more commits... git push +### Checking-Out a Named Branch for an Existing Ticket with a Patchset + +If you prefer to name your local ticket branches rather than using the default integer ids, you can do this with a little more syntax. + + git checkout -b my_fix --track origin/ticket/{id} + +This will create a local branch named *my_fix* which tracks the upstream ticket branch. + ### Rewriting a Patchset (amend, rebase, squash) *Who can rewrite a patchset?* @@ -76,22 +84,19 @@ OR if you have RW+ permissions, then you can push using *-f* flag. ### Updating your copy of a rewritten Patchset -If a patchset has been rewritten you can no longer simply *pull* to update. Let's assume your checkout **does not** have any unshared commits - i.e. it represents the previous patchset. The simplest way to update your branch to the current patchset is to reset it. +If a patchset has been rewritten you can no longer simply *pull* to update. Let's assume your checkout **does not** have any unshared commits - i.e. it represents the previous patchset. The simplest way to update your branch to the current patchset is to reset it using the `-B` checkout flag. - git fetch && git checkout ticket/{id} - git reset --hard origin/ticket/{id} + git fetch && git checkout -B ticket/{id} If you **do** have unshared commits then you'll could make a new temporary branch and then cherry-pick your changes onto the rewritten patchset. git branch oldticket ticket/{id} - git fetch && git checkout ticket/{id} - git reset --hard origin/ticket/{id} + git fetch && git checkout -B ticket/{id} git cherry-pick git branch -D oldticket Git is a very flexible tool, there are no doubt several other strategies you could use to resolve this situation. The above solution is just one way. - ### Ticket RefSpecs Gitblit supports two primary push ref specs: the magic ref and the patchset ref. -- 2.39.5