JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for STARDEV Archives


STARDEV Archives

STARDEV Archives


STARDEV@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

STARDEV Home

STARDEV Home

STARDEV  February 2009

STARDEV February 2009

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: [Scicom] git working patterns

From:

David Berry <[log in to unmask]>

Reply-To:

Starlink development <[log in to unmask]>

Date:

Mon, 9 Feb 2009 08:15:15 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (191 lines)

2009/2/6 Tim Jenness <[log in to unmask]>:
> On Fri, 6 Feb 2009, David Berry wrote:
>
>> Personally I'd feel more comfortable if, at least for the moment, I
>> had some fixed patterns for working with git. Two situations occur to
>> me:
>>
>> A) A minor tweak to the master branch
>> B) A major new development
>>
>>
>>
>> Thinking firstly about A), how would this be:
>>
>> I'll work in the working directory that was created when I cloned the
>> origin/master, on the assumption that the majority of the existing
>> built files in that working directory will be appropriate for me to
>> build and test the bug fix. So
>>
>> 1) git pull      # Ensure we're starting from a current master
>>
>> This reduces the chances of conflicts arising with other people's work
>> later on. After all, someone else may already have fixed the bug.
>>
>
> they have to remember to push it back :-)
>
>> 2) git branch bug-fix      #  Create a branch to work on
>>
>> I should be safe to re-use a single fixed branch name such as
>> "bug-fix" since I'll be deleting the branch at the end of each bug
>> fix.
>
> yep
>
>>
>> 3) git checkout bug-fix      # Check out the new branch
>>
>
> Yes. "git checkout -b bug-fix" may be able to combine 2 and 3 (it creates
> the branch)
>
>> 4) Edit the source files, build the changed system, and test until the
>> bug is fixed.
>>
>> 5) git commit -a      # Commit the changed files to the bug-fix branch
>
> Or commit little bits as appropriate. I'm thinking that git commit -a
> could be dangerous at times so make sure you use $EDITOR to type in your
> comment rather than -m so then at least you can see if it is going to
> commit something extra.

OK. I have EDITOR set so I get chance to review the commits before
accepting them.


>>
>> The commands in step 6) have to be done quickly to minimise the chance
>> of anyone else pushing new stuff to master in the middle of it all.
>>
>> 6) git checkout master      # Go back to the master branch
>>    git pull                           # Get any changes made whilst
>> I've been fixing the bug
>>    git checkout bug-fix      # Go back to the bug-fix branch
>>    git rebase master         # Modify the bug-fix changes so that
>> they can be applied to the current master HEAD
>>    git checkout master      # Go back to master
>
> you can insert a git pull at this point just to make sure that no new
> patches have arrived.

Except if new patches were pulled here, my bug-fix changes would no
longer be re-based at HEAD correctly.

>>    git merge bug-fix          # Append the bug-fix changes to the end
>> of the master branch
>>    git push                        # Send the modified master branch to JAC
>>
>> 7) git branch -d bug-fix     # Delete the bug-fix branch
>>
>> This leaves the built files in the working directory in sync with the
>> current master HEAD.
>>
>
> Yes.
>
>>
>> So question one, does this over-all scheme seem correct, and question
>> two, are the git commands I've used to implement this scheme correct?
>>
>
> Looks okay to me (but I've got it all wrong before :-)
>
>
>>
>>
>> Going on to B) - handling a major new development. The difference is
>> that I will need to keep swapping back and forth between the new
>> development work and day-to-day bug-fixes on master. So I should use a
>> separate working directory for the new development work so I do not
>> need to re-build everything from scratch each time I swap branch:
>>
>> 1) git pull    # Ensure master is up to date
>>
>> 2) git-new-workdir /path/to/my/repo /path/to/new/workdir  # Create a
>> new working directory containing a checkout of master
>>
>> 3) cd  /path/to/new/workdir
>>
>> 4) git branch ast-stcs    #  Create a new branch with a unique name
>> that identifies the development work being done
>>
>> 5) git checkout ast-stcs    # Checkout the new branch
>>
>> 6) Make edits, build, test
>>
>> 7 ) git commit -a
>>
>
> if you don't feel like you are commit worthy you can use git-stash at this
> point.

Since the ast-stcs and bug-fix stuff each have their own working
directory, a stash wouldn't be needed would it? That is, I'm about to
change directory, so my current edits wont get changed.

>> 8) Brad reports a new AST bug...
>>
>> 9) cd /path/to/main/workdir
>>
>> I'm assuming that the main workdir still contains a checkout of
>> master. Maybe I should refer to "master/workdir" rather than
>> "main/workdir" above...
>
> I have not tried this workdir switching scheme so am not sure how it knows
> that each tree is a different branch.

I've given it a go, and it does work. If you check out a different
branch in each working directory, then "cd" into each directory, "git
status" shows a different current branch in each directory.

>>
>> 10) Do the bug fix and push the changes to JAC as per scheme A) above.
>>
>> 11) cd  /path/to/new/workdir      # which still contains a checkout of ast-stcs
>>
>> 12) Loop back to step 6) until the development work is ready for use
>> by others. Then proceed with step 13)
>>
>> 13) cd /path/to/main/workdir
>>
>> 14) git pull
>>      git merge ast-stcs
>>      git push
>>
>> No rebase here in order to retain visibility of the ast-stcs branch.
>
> In my opinion I'd call
>
>   git rebase master
>
> from ast-stcs every day just to keep up to date (most of the patches will
> be irrelevant to ast-stcs development). Knowing that you branched from
> some commit 2 months ago and have now merged does not provide additional
> information. You also have to handle merges all in one go whereas a daily
> git-rebase forces you to resolve conflicts as soon as they would occur
> (which may or may not be a good thing if you have completely rewritten
> the ast source code (such as the threading work) since every time you
> tweak trunk you'll have to work out how that tweak applies to the branch -
> this is what git-rerere is for but I think it's too early for that). Any
> ast patches you've done in trunk will then automatically be integrated
> into your dev branch. Without a daily rebase you end up doing one major
> merge and conflict resolution all in one shot.
>
>>
>> Comments???
>>
>
> You may want to consider simply having two clones, one for your heavy
> development and one for minor bug fixes. May be less confusing.

The git-new-workdir approach seems to be working. I don't suppose I
should say this, but it gives the whole system a bit more of an SVN
feel to it...

I've produced two scripts, one for major works and one for small,
quick changes that implement the above ideas. So hopefully I will at
least be consistent in the stuff I'm pushing to JAC.

David

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
January 2023
December 2022
July 2022
June 2022
April 2022
March 2022
December 2021
October 2021
July 2021
April 2021
January 2021
October 2020
September 2020
August 2020
May 2020
November 2019
October 2019
July 2019
June 2019
February 2019
January 2019
December 2018
November 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
December 2017
October 2017
August 2017
July 2017
May 2017
April 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
October 2015
September 2015
August 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
2004
April 2003
2003


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager