[Freeipa-devel] Questions on git

Jakub Hrozek jhrozek at redhat.com
Mon May 23 14:47:02 UTC 2016


On Mon, May 23, 2016 at 04:33:29PM +0200, Martin Basti wrote:
> 
> 
> On 23.05.2016 16:24, Florence Blanc-Renaud wrote:
> > Hi all,
> > 
> > as I am ramping up with git, I have a few questions. Let's imagine the
> > following development workflow:
> > 
> > - I start working on a specific issue and decide to create a branch on
> > my git repository (on my laptop)
> > git clone git://git.fedorahosted.org/git/freeipa.git
> > git branch -b issue
> > - When my code looks ok, I decide to commit on the branch (still on my
> > ldaptop)
> > git add <file>
> > git commit
> 
> I found handy also 'git add -p' which allows you to choose what commit

...or git add -e

> 
> > 
> > - Now I would like to push this on my development VM (I already cloned
> > the repos on the VM). What would be the right command to push only the
> > branch "issue" to my VM repo? Does the following command push only the
> > current branch?
> > git push --repo=ssh://frenaud@<VM IP@>:/path/to/src/freeipa
> 
> Could work, I usually just rsync the whole folder to VM

For local VMs, I use an NFS share so that I don't rsync anything, but
the sources magically appear in the VMs (vagrant's shared folders make
this easy once you're past the initial setup pain).

> > 
> > - When the tests are ok and I want to submit a patch, can I stay on the
> > branch "issue" to create the patch or should I merge first with the main
> > branch? If a merge is required, is it recommended to pull then merge or
> > merge then pull?
> 
> You can stay on your issue branch, but patch should be rebased to current
> master (patch should apply on top of master)
> 
> something like:
> 
> git checkout master
> git pull
> git check issue
> git rebase master issue
> 
> or interactive rebase if you want change order of patches or something
> git rebase -i master issue

IMO creating the branch with "--track origin/master" helps..

btw I find this man page helpful:
    https://www.kernel.org/pub/software/scm/git/docs/giteveryday.html
as well as this free book:
    https://git-scm.com/book/en/v2




More information about the Freeipa-devel mailing list