You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by "Terry P." <te...@gmail.com> on 2013/11/17 21:54:14 UTC

Git question

Greetings folks,
I'm working on ACCUMULO-1901 but am a newbie with git and want to ensure I
do my check-in and patch correctly the first time.

My questions are:

1. 'git help commit' says "even modified files must be 'added'" but the
Accumulo Contributor instructions don't mention doing a 'git add' at all.
Do I need to first to a 'git add' for the filename I'm changing / going to
change?

2. Step 5 "Make commits" mentions "referencing the issue name in the commit
message", but the syntax shown doesn't include the -m switch that I see in
the git commit help. I assume a more complete syntax example for my case
would be:

  git commit -av -m "ACCUMULO-1901" bin/start-here.sh

Or if I do it from the directory where my code change was done, do I even
need to include the filename? Or ever? (meaning does git commit everything
in its index automatically?) Again, I'm brand new to git and want to do
this right the first time.

Thanks for the help!

Re: Git question

Posted by Sean Busbey <bu...@clouderagovt.com>.
Hi Terry!


1. The short answer is no.

the git commands present in our guide tell you to use "git commit -a",
which is a short cut to saying "include all changed files in this commit."
Its use is frowned upon in most of the coding communities I've been in,
because it encourages thinking less about what you do or do not include in
a given patch.


1. The long answer is normally, yes.

Git differentiates between the files that are different in your working
directory and the files you actually want included in a particular commit.
The way you let it know is via the "git add" and "git rm" commands.

You only use either of those commands when you're deciding what goes into a
commit. If you "git add" a changed file and then change it some more you'll
need to "git add" it again; only those changes present as of the last "git
add" will be reflected in a commit.

There's a decent intro to the mechanics of casual git use, it might help
since that's similar to where you are now:

http://try.github.io/levels/1/challenges/1

2. The version of the commit command shown presumes you have an editor
configured.

With the commit command listed in the git guide for Accumulo, git will use
your editor to ask you for a commit message. I think out of the box the
editor will be vim, but whatever is configured for $EDITOR in your shell
should get used. you can also tell git to use a specific editor.

the -m switch is a short cut to avoid using the editor, and how you
describe using it is a fine. Normally, you should also include a short
description of what you're doing:

git commit -av -m "ACCUMULO-1901 Makes start-all.sh spin up multiple GCs."

This command will work if you are in any subdirectory under the root of
your git working directory. You need not add any file names.

As I mentioned earlier, the "-a" flag in the above command will say "add
all changed files." It won't include new files, but will otherwise get
everything. If you want finer control, you'd use "git add" on individual
files and leave the flag off.

There is an astounding depth to what you can do with Git. Hopefully this
will get you past the initial hump of utility so you can get this patch in.
If you'd like some pointers to go further, just let me know.

HTH

On Sun, Nov 17, 2013 at 2:54 PM, Terry P. <te...@gmail.com> wrote:

> Greetings folks,
> I'm working on ACCUMULO-1901 but am a newbie with git and want to ensure I
> do my check-in and patch correctly the first time.
>
> My questions are:
>
> 1. 'git help commit' says "even modified files must be 'added'" but the
> Accumulo Contributor instructions don't mention doing a 'git add' at all.
> Do I need to first to a 'git add' for the filename I'm changing / going to
> change?
>
> 2. Step 5 "Make commits" mentions "referencing the issue name in the commit
> message", but the syntax shown doesn't include the -m switch that I see in
> the git commit help. I assume a more complete syntax example for my case
> would be:
>
>   git commit -av -m "ACCUMULO-1901" bin/start-here.sh
>
> Or if I do it from the directory where my code change was done, do I even
> need to include the filename? Or ever? (meaning does git commit everything
> in its index automatically?) Again, I'm brand new to git and want to do
> this right the first time.
>
> Thanks for the help!
>



-- 
Sean