Changes

Jump to navigation Jump to search

Git asynchronous development

2,361 bytes added, 09:42, 16 October 2020
m
Switch to the {{relax developer link}} template to remove dead Gna! links.
{{historical svn}}
{{caution|This article is out of date, please see the [[Git_svn|article on using git-svn]] for a more appropriate development strategy.}}
 
== Motivation ==
Subversion needs an online repository, to store each commits. Subsequent calls to '''svn diff > patch''' will generate the difference according to the last revision. Therefore the development at the moment, require to
== Initialization of git ==
Navigate to the root folder of the branch of relax, you want to develop. Initialize with: git initThen follow the this post [[Git_svn#relax_branches_at_github | relax_branches_at_github]]
=== Setup commit information ===
As an example, we can take the development of the NMRPipe SeriesTab reader: [https://gna.org/support/index.php?3043 sr #3043: Support for NMRPipe seriesTab format *.ser]
We are going to make a support request '''sr''' branch. [http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging See ref. on branching]. In this branch we add the files we would like to track for changes. Then we create a branch '''sr/seriestab''' from '''sr'''. We then track and create patches of the differences between '''sr/seriestab''' and '''sr'''.
Create the support request '''sr''' branch.
git br -a
Then we add the files git add lib/software/nmrpipe.py git commit commit message<source lang="text">Added nmrpipe into git</source>  # To see the commit message git log # Or see last changes by git log -p Then we create the '''seriestabnmrpipe''' branch(because we edit nmrpipe.py), from where we will create the patch according to the differences of the '''sr''' branch. git co -b seriestab nmrpipe sr
=== Checking out a development branch ===
git log -p
Now create your [[Git_patch | git patch]], comparing to the sr branch git format-patch sr--stdout > nmrpipe.patch
=== Modification 2 ===
Now create your patches, comparing to the sr branch
git format-patch sr--stdout > nmrpipe2.patchThis should provide two you with a second patch files, with more commits.
=== Getting an overview ===
Now create your patch, comparing to the sr branch
git format-patch sr--stdout > nmrpipe3.patch
=== Continuation ===
=== Upload patches ===
First delete all the previous made patches.
rm -r 000*.patch
Now create your patches, comparing to the sr branch
git format-patch sr--stdout > nmrpipe.patch Then upload the [[git_patch|git patch]] to the [https://gna.org/support/?group=relax support tracker]. == Reviewing suggestions and modify commit ==There were a number of [http://article.gmane.org/gmane.science.nmr.relax.devel/4120 suggestions] to the patches from {{relax developer link|username=bugman|text=Edward}}. === Squash commits ===[http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html You can squash commits], which essentially take smaller commits and combine them into larger ones. This can be useful if you’re are wrapping up the day’s work of code. Then you can also prepare a better commit message. First get an overview, over which commits should be squashed git logLet's say you wan't to squash the last 6 commits. Set HEAD~6+1. git rebase -i HEAD~7In the pop-up editor, for all the commits who should be squashed, replace '''pick''' with '''s''' or '''squash'''. Do not change the '''pick''' for the first commit.Save and exit editor. Now compose a new commit message, which can be combined of the earlier commit messages. Comment out lines with "#" which should not be added.<source lang="text">Completed NMRPipe SeriesTab reader Progress sr #3043: (https://gna.org/support/index.php?3043) Support for NMRPipe seriesTab format *.ser Completed NMRPipe SeriesTab reader for assignment according to SPARKY format.Changes implemented according to: http://article.gmane.org/gmane.science.nmr.relax.devel/4120</source>Then we test if the changes passed our test relax -s Peak_lists.test_read_peak_list_NMRPipe_seriesTab === Changes to pipe_control.spectrum.read() ===The above test, showed that the reading function had to be adjusted. So now we create a new branch, which is based on the branch we last edited. Meaning we copy the content of the modified files. git co -b spectrum nmrpipe git diff --stat --color nmrpipe..spectrumThe last line, should show an empty line for "no changes". Now we change spectrum.py in read(), # NMRPipe SeriesTab, and add a commit message to each commit. === Finishing up ===Delete old patches rm *.patch
Then upload a zip file with all the patches First change to the [https://gnafirst branch we made changes is git co nmrpipe git format-patch sr --stdout > nmrpipe.org/support/?group=relax support tracker]patch git co spectrum git format-patch nmrpipe --stdout > spectrum.patch
== See also ==
Trusted, Bureaucrats
4,228

edits

Navigation menu