Archive for the ‘GIT’ Category

git’s goodies: git format-patch –cover-letter

Thursday, March 27th, 2008

Sometimes we have to send patch series and it's always useful to add a cover letter (or cover email) explaining what your series is implementing/fixing.

Newest git (currently only on git's git tree) provides a new format-patch option to generate the cover leter for you. In the cover leter git adds shortlog and diffstat, you only need to change the subject and mail body.

It's as simple as:

 
$ git format-patch -o directory -n --cover-letter $commit1..$commit2

After that take a look at directory/0000-* and change what's necessary

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

git-push and ssh-keys

Thursday, January 3rd, 2008

Creating several ssh accounts for allowing push access to developers on a project is, at least, a waste of time and a possible security hole.

Instead of that, let's see how to manage such users using only one user "git" and several ssh-keys for allowing such push access.

(more...)

VN:F [1.9.0_1079]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

Housekeeping your git repository

Wednesday, December 19th, 2007

Housekeeping a git repository is useful to make it smaller and faster. Git has a lot of tools to allow you optimizing your git repository. Let's take a look on a few of them and see what they do.

(more...)

VN:F [1.9.0_1079]
Rating: 5.0/5 (4 votes cast)
VN:F [1.9.0_1079]
Rating: +1 (from 1 vote)

Interactive git-rebase

Tuesday, September 4th, 2007

Hi all,

This will only be possible on git 1.5.3 and later versions (1.5.3 is the most recent at the time of this posting). With interactive rebase you can reorder your commits, meld them together, discard some commits, etc...

Let's see how to do it.

(more...)

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

"git-cvsimport – Salvage your data out of another SCM people love to hate"

Wednesday, August 29th, 2007

Hello all,

The title of this post came from git-cvsimport's man page. Let's try to use it??

NOTE: We're gonna need cvsps 2.1 or higher in order to split cvs log into patch sets.

Once you have the address of the cvs project you wanna import, you just issue:

$ git-cvsimport -d "CVSROOT" "CVS_module"

Example:

$ git-cvsimport -d \
   ":pserver:anonymous@linux-usb.cvs.sourceforge.net:/cvsroot/linux-usb" usbutils

And that's all, you just have to wait now ;-)

See y'all

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

Solving merge conflicts with git

Monday, August 27th, 2007

Hello all,

After a lot of branching, merging, pulling, rebasing, etc we'll probably see some conflicts on the source code.
With this post we're gonna learn what's a conflicted merge and how to solve it.

Let's take a look:

Sometimes the merge can't be automatically resolved. When this happens, git leaves the index and working tree in such a state that gives you some information to help resolving the merge.

(more...)

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

git-checkout: Advanced use

Wednesday, August 15th, 2007

Hello all,

Yes, this post doesn't have a nice name... but let's go anyway:

1st tip: Using git-checkout to produce clean patches.

Assumptions: using that same 'exp' branch

Story: Let's say we're implementing a new driver in our 'exp' branch and we're committing even unbuildable code, of course, git lets us do it. But you won't send the whole change history to any public list. Once you finish the driver you send only one patch with the finished driver. So, how to do it??

We can change to a new branch, let's say 'new-drivers', and commit the finished file there.

$ git-checkout master
$ git-checkout -b new-drivers
$ git-checkout exp path/to/our/driver.c
$ git-commit -s

2nd tip: Tracking remote branches

Assumptions: you're working on a public tree with at least two branches (master and fix - for example)

Story: Let's say you're working on project.git and that tree has two branches: master (of course) and fix. You wanna track what's happening on branch fix. So you'd run:

$ git-clone http://project.org/project.git
$ cd project$ git-checkout --track -b fix
$ git-pull

From now on, when you run:

$ git-pull

It'll fetch differences for both branches.

3rd tip: Switching a file n-commits back

Assumptions: none

Story: Let's say you wanna switch-back a file N-commits earlier. You'd issue:

$ git-checkout branch
$ git-checkout branch~n path/to/file.c
$ git-diff path/to/file.c

That's all for now...

See y'all

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

git-rebase 2: Applying comments to old commits (aka Modifying commits)

Wednesday, August 15th, 2007

Hi all,

we all know when we're working on public projects we'll always get our patches commented; so how to apply those comments and even though keep the patch-series order??

That's what we're learning today. Let's start?

NOTE: I'm assuming we're using the same 'exp' branch as on previous posts.

First of all we need to create a tag to that bad commit. So:

$ git-tag bad COMMIT_ID

Then we should checkout to that tag:

$ git-checkout bad

Edit that bad file to apply the comments and after that:

$ git-add /path/to/modified/file.c$ git-commit --amend$ git-rebase --onto HEAD bad exp

This will left you with exp checked out and with that bad commit corrected. After testing and reviewing our new changes we can delete that bad tag:

$ git-tag -d bad

That's all.

See y'all

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: +1 (from 1 vote)

git-rebase: Updating a patch series

Wednesday, August 15th, 2007

Hi all,

It's getting harder and harder, isn't it?
Not at all :-)

Let's say we have an 'exp' branch where we're implementing a new feature for our project and, of course, committing there. Also, during our development, some interesting work has been done to branch origin (the remote master branch) of our project and we wanna get this interesting work back to our feature. So we would:

$ git-checkout master$ git-pull$ git-checkout exp$ git-rebase master

This will update our exp branch but keep our patch-series as top-most patches. If, during this process, we have a conflict we should solve it by editing the conflicted and run:

$ git-add /path/to/conflicted/file.c$ git-rebase --continue

NOTE: Do not use git-commit during this process.

After this, run:

$ git-log

To see your patch-series updated and still as top-most patches ;-)

That's easy ;-)

See y'all

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

Modifying the top-most commit

Wednesday, August 15th, 2007

Hello all,

after a long, long time I'm back to show you how to modify the top-most commit.
Let's try it?

First of all, you just edit the file:

$ vim file.c-- Save and quit

$ git-add file.c$ git-commit --amend

And that's all. You're gonna commit the changes on the same commit you were.

Easy, isn't it?

On later post we'll see how to use git-rebase.

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)