[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Git fun, or Turning off autocommit when importing descriptors



Hi Kevin,

I'm moving this discussion to or-dev, as it might be of interest for the
other GSoC students, too.

On 5/18/10 6:58 PM, kevin berry wrote:
> I fixed everything in the code, whitespace, javadoc, etc. I reverted my
> master github branch, then created a branch called "autocommit", fixed
> stuff, and then pushed the changes. So my master branch should reflect
> gitweb.torproject.org/ernie.git, and I should do my development in other
> branches? I think I'm finally gitting the hang of it (har har). Thanks for
> the help

In your public repository (http://github.com/kjbbb/ernie) you don't need
a master branch reflecting the official repository
(git://git.torproject.org/ernie). Nobody would pull from it, and it
would be out-of-date most of the time.

You only need to push branches to your public repository that you want
others to look at. Once the changes are in the official repository, you
can delete your public branches using "git push public :somebranch" with
'public' being the name you picked for your public repository and
'somebranch' being the name of your public branch.

Here are some comments on your autocommit branch:

- When I look at the logs using "git log", I see that you didn't set
Author to your full name. You can do this by typing "git config --global
user.name "Kevin Berry"", though this won't be effective for the commits
you already made.

- I also see in "git log -p" that you changed things back and forth.
This is not so nice, because people reading the commit history will have
a hard time figuring out what changes were made. The solution to this
problem is to squash the four commits using "git rebase -i". In general,
be careful with squashing commits that you pushed and asked others to
review, because you're "changing history". But in this case it makes
sense to squash the commits and have a single commit for your change.
Here are the commands I'd use to squash your commits:

$ git rebase -i HEAD~4
Change "pick" in lines 2, 3, and 4 to "squash"
$ git add src/RelayDescriptorDatabaseImporter.java
$ git rebase --continue
Delete all but the 3rd commit message.

You should try squashing the commits in your local branch, just to see
how convenient it is when you do it right. However, in case you're
unhappy with the result, just kick out your last four commits and make a
new one:

$ git reset --soft HEAD~4
$ git commit

- "git log -p" further reveals some unnecessary whitespace in the
Javadoc lines.

Can you fix these things, push a new branch, e.g. "autocommit2" to your
public repository, and let me know it's there?

A lot of trouble for getting a patch in, agreed, but imagine we'd go
through this at the end of summer with all your changes! :)

I bet you'll also enjoy reading
https://gitweb.torproject.org//githax.git?a=blob;f=doc/Howto.txt;h=0a502904ba33ba2778670fd6b513637311e6b5c7;hb=HEAD

Thanks,
--Karsten