On 2014-08-22 12:27-0700 Alan W. Irwin wrote:

> On 2014-08-22 10:23-0000 Arjen Markus wrote:
>
>> Hi everyone,
>> I have subscribed to the git mailing list, got a clone of the repository and 
>> so should be able to do commits and see the result. I did in fact change one 
>> thing and committed it, but presumably that is just in my local copy. I 
>> guess I need to "push" the changes to get them into the "central" repository 
>> - if I understand it all correctly. I hesitate because the Kitware document 
>> is not clear on how to go about with bug fixes. And I am still trying to 
>> understand the git command ;).
>> The change I made (to solve the immediate problem regarding SVG files that 
>> are replotted) consists of some three lines of code, so nothng major. Still, 
>> I would like confirmation that I am going about it the right way:
>>
>> -        I cloned the repository from SF
>>
>> -        I made my changes and did a (local) commit
>>
>> -        I did not do anything wrt tags or branches, so my changes are 
>> likely to be in the main branch
>>
>> -        If I push these changes, then they should end up in the main branch 
>> - if my understanding is correct
>> So, can I simply push this?
>
> Hi Arjen:
>
> Congratulations on trying out git almost as soon as we went live!
>
> Until Hazen can create the README.git_workflow file generalizing the
> results at http://kevinold.com/2013/04/17/my-git-workflow.html for our
> exact needs, you should be paying strict attention to that URL.

To help those inexperienced with git and/or our workflow here is what
I did for my most recent change.

# Confirm that I am up-to-date with most recent changes pushed by
# others to our official server.

software@raven> git checkout master
Already on 'master'
software@raven> git status
# On branch master
nothing to commit (working directory clean)
software@raven> git fetch
software@raven> git log -1 --oneline origin/master
f558488 Add copy of test_ada.
software@raven> git log -1 --oneline master
f558488 Add copy of test_ada.
# The above checks that both origin/master and master point
# to the same commit. Which is confirmed by the command results
# below.
software@raven> git merge origin/master
Already up-to-date.


# Now do your development on a well-named but disposable
# topic branch.
software@raven> git checkout -b add_update_git_hook
Switched to a new branch 'add_update_git_hook'
# Specific development.  git ignores directory creation
# as a separate commit so do that on the command-line.
software@raven> mkdir git_hooks
software@raven> cd git_hooks
# Copy new update hook from where I was working on it
# for a simple "play" repo.
software@raven> cp 
/home/software/plplot_svn/svn2git_conversion/update_hook/update update
software@raven> emacs README
software@raven> git status
# On branch add_update_git_hook
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ./
software@raven> git add .
software@raven> git status
# On branch add_update_git_hook
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   README
#       new file:   update
#
software@raven> git commit
[add_update_git_hook ffada3a] Put our update hook and corresponding
README file under git control.
  2 files changed, 81 insertions(+)
  create mode 100644 git_hooks/README
  create mode 100644 git_hooks/update

# At this stage some time has gone by since I checked whether master was
# up to date.  So go through the above checks again which are

software@raven> git checkout master
Switched to branch 'master'
software@raven> git fetch
fatal: Unable to read current working directory: No such file or directory
software@raven> pwd
/home/software/plplot_svn/HEAD/plplot.git/git_hooks
# No problem.... I am in a directory that does not exist
# on master (since I was working in the add_update_git_hook).
software@raven> cd ..
software@raven> git fetch
software@raven> git log -1 --oneline master
f558488 Add copy of test_ada.
software@raven> git log -1 --oneline origin/master
f558488 Add copy of test_ada.
# So master confirmed up to date so do the next fast
# so nobody else sneaks in with a push.
software@raven> git merge add_update_git_hook 
Updating f558488..ffada3a
Fast-forward
  git_hooks/README |   20 ++++++++++++++++++++
  git_hooks/update |   61 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 81 insertions(+)
  create mode 100644 git_hooks/README
  create mode 100644 git_hooks/update

# N.B. note the Fast-forward above which is essential since a merge
# commit is not allowed by our workflow enforcement.  Also, note if
# master had had an update from someone else's push, then you would
# have wanted to follow the above URL to update your local master
# and rebase your topic branch.
software@raven> git push
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.82 KiB, done.
Total 5 (delta 1), reused 0 (delta 0)
remote: Checking: ffada3ade78b62845e4e70762dd19263c741f291 (ok)
remote: <Repository /git/p/plplot/plplot.git> refresh queued.
To ssh://air...@git.code.sf.net/p/plplot/plplot
    f558488..ffada3a  master -> master

# Now that all is well and ffada3a is now on the server
# (see both the commit and push messages above), then
# I have no further use for this topic branch, and I will
# likely start a new branch if I have to update git_hooks/update
# or git_hooks/README again.
software@raven> git branch --delete add_update_git_hook 
Deleted branch add_update_git_hook (was ffada3a).

That's all that is required for the straightforward task of adding two
files in a new directory.  N.B. This is my 3rd push (two for PLplot
and one for timeephem) to value-packed repos and so far so good.  But
I am in that "new driver" mode where I double-check everything, and
likely several months down the road I will know enough to be dangerous
(like drivers with several months rather than several years of
experience). But when trouble occurs, I will ask our more experienced
git users like Hazen, Hez, and Maurice for help if I cannot figure
out a solution myself.

N.B. git_hooks/update does nothing except put that hook file under git
control in case we want to change it in future.  In the next few
minutes I will actually use scp to copy that file to the right part of
our official git repo so it will become active to enforce the
additional tag rules that Hazen suggested.  But more on that in the
appropriate thread.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to