[Bioperl-l] git help

Jonathan "Duke" Leto jonathan at leto.net
Fri Apr 1 16:17:27 UTC 2011


Howdy,

Here are some PROTIPs that I think will be of use to many people:

1) Beware of "git commit -a". You can use "git show" to look at your most recent
commit before you push it. Always make sure it contains what you think
it should.

2) As a general rule, you shouldn't do a "git pull" when you have uncommitted
changes. You shouldn't merge branches when you have uncommitted changes,
either. Another way to get around this is to use the git "stash". Think of it
as a cubby hole to put stuff to the side until you need it again.

You could have typed

    git stash
    git pull --rebase
    git stash pop

As you can see, the stash is stack that you can "push" and "pop".

3) Updating the index and updating the actual files in your directory (called
the working copy) can be done independently.

The command:
    git pull --rebase

is equivalent to

    git fetch                   # sync remote index to local index
    git rebase origin/master    # update working copy with local index

The second way which splits it up is useful when you want to do something
in between, such as:

    git fetch
    git diff master...origin/master # what am I going to pull in?
    git rebase origin/master

I hope this arms BioPerl hackers with a better understanding of Git. If you
have more Git questions, feel free to ask.

Duke


On Thu, Mar 31, 2011 at 4:13 PM, Scott Cain <scott at scottcain.net> wrote:
> Hi all,
>
> I just want to know if it is safe for me to commit.  Here is what git
> said to me:
>
> scott-cains-macbook-pro:bioperl-live cain$ git commit
> # On branch master
> # Your branch is behind 'origin/master' by 47 commits, and can be
> fast-forwarded.
> #
> # Changed but not updated:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       modified:   Bio/DB/GFF.pm
> #       modified:   Bio/FeatureIO/gff.pm
> #       modified:   scripts/Bio-DB-GFF/bulk_load_gff.PLS
> #       modified:   scripts/Bio-DB-GFF/fast_load_gff.PLS
> #       modified:   t/SeqFeature/FeatureIO.t
> #       modified:   t/data/knownGene.gff3
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #       scripts/Bio-DB-GFF/genbank2gff3.diff
> no changes added to commit (use "git add" and/or "git commit -a")
> ----------------------
>
> so should I do a git commit -a?
>
> Also, when I try a git pull, this is what it tells me:
>
> scott-cains-macbook-pro:bioperl-live cain$ git pull
> Updating 1c2cf24..d5de022
> error: Your local changes to 'Bio/FeatureIO/gff.pm' would be
> overwritten by merge.  Aborting.
> Please, commit your changes or stash them before you can merge.
>
> Thanks,
> Scott
>
>
>
> --
> ------------------------------------------------------------------------
> Scott Cain, Ph. D.                                   scott at scottcain dot net
> GMOD Coordinator (http://gmod.org/)                     216-392-3087
> Ontario Institute for Cancer Research
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



-- 
Jonathan "Duke" Leto
jonathan at leto.net
http://leto.net




More information about the Bioperl-l mailing list