Some references and other readings:
- Documentation/CodingStyle;
- Documentation/SubmittingPatches;
- Documentation/SubmitChecklist;
- git manual;
- Linux Kernel Development 2nd Edition.
Hi again, everybody...
Let's discuss a bit about the common mistakes when preparing patches to send to LKML.
This is right way!
#ifdef CONFIG_BLABLA
extern int foo(int bar);
#else
#define foo(b) NULL
#endif
Hello all,
Now we need to prepare a patch before sending it to the correct mailing list. We can do this by issuing:
$ git-format-patch -o patches_to_send
the start commit id must be one commit before yours, this is an open interval in the beginning and closed at the end (]a,b]).
After formating the patches, is nice to check if they're correct, if you're not missing anything, like white-spaces, commented code, unused variables, etc.
To test email config before sending the patches we just:
$ git-send-email --to
And to really send we just remove the --dry-run flag:
$ git-send-email --to mailing_list_address@domain.com
Now that we know how to use git, we can start modifying the sources. In order to preserve the master branch (the one used when you update your git tree) we're gonna create a new one. Let's call it test. To do this, we just issue:
$ git-checkout -b test
A new branch called test will be created and you'll be switched to this branch.
Now we can edit any file. Do whatever addition, deletion, whatever you want to do with your tree. It's your branch anyway. After you finish, we can check what've we done with our tree. Issue:
$ git-status
To see which files we've modified/added/removed and also issue:
$ git-diff
To get a diff of your changes.
Now, that we've checked everything (it's compiling, it's what we want to do) we have to add files to the commit-ish:
$ git-add "
And after that we run:
$ git-commit --author "My Name
This will start commiting the changes to the current branch. It will open your default text editor for you to edit the commit message. Always use this format:
Small description of what are you doing
Big/detailed description of your changes, what are you implementing,
are you correcting a bug? which bug? how did you test it?
On which architectures did you test it?
Signed-off-by: My Name myemail@mydomain.com
Now we're entering into the subject. First we're gonna define git, who created it and which projects are already using git. So here we go:
Git is a SCM (Source Code Management) created by Linus Torvalds to become the
Bitkeeper's substitute. It's implemented in a distributed way, which means we don't need to stay connected to internet in order to work. We can produce patches whenever we want, wherever we are.
Git is being used in big projects such as:
Git is really a big tool, really better then CVS or SVN, though it has a lot of commands, a lot of documentation and it'll take a while to understand how it works.
I'm listing the main commands every developer should know about git wiling this will help every single new developer to work better with git after 1 week playing around with it. So here we go, be careful :-p
In later posting we'll study every single command in this list.
We can define a patch the following way:
A patch can have all of these definitions and even more, but let's produce a nice and easy-remembering phrase for those topics over there:
"A patch is any kind of modification in a source-code tree"