Creating patches using git

Creating patches using git is very easy and fast.
I will summarize the steps I followed to create my patches to U-Boot:

* First all create a new branch (see below how to do that);

* Change to created branch;

* Make your modification to files;

* For each logical change (a logical change can involve more than one file modification) make a commit;

* Finally create patches between the “master” and your branch.

To visualize branches:
git branch

To create a new branch:
git branch testbranch

To change to created branch:
git checkout testbranch

Track new files:
git add cpu/arm1136/mx31/nand_copy.S

To make a commit:
git commit -a

To submit a branch to repository:
git push origin testbranch

To delete a branch (you need be in other branch to do that):
git branch -D testbranch

To remove a remote branch:
git branch -d -r origin/testbranch

To remove the last commit:
git reset --hard HEAD^

Create patches between two branches:
git format-patch master..testbranch

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s