Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maintain my patches in git repo

Tags:

git

patch

I am just learning how to use git and would like to follow a project. So I clone the project and no I have the most new code.

If I want to add a patch (or more) to that code, what is the best way to do that (and run make and make install) and still be able to git pull from the master repo without creating a conflict?

I have tried making a branch, but I'm not sure if this is the right way.

I'd just like to be able to keep up with new code in master, but be able to apply my own patches as new versions are pushed.

I'd like to know where I can learn how to do this, but I'm not sure what to google for.

like image 560
Edouard Avatar asked Sep 17 '25 15:09

Edouard


1 Answers

You are probably looking for git rebase: Create a local branch from the remote tracking branch and invoke git config branch.mylocalbranch.rebase true (where 'mylocalbranch' is the name of your local branch). Now you can make your local patches and commit them. Everytime you fetch updates with git pull your local modifications are 'rebased' (applied on top of what you've just pulled).

Be careful not to push your local modifications (e.g. the HEAD of your local branch) to the remote as this is probably not what you want. See man git-rebase for further details.

like image 150
u-punkt Avatar answered Sep 20 '25 13:09

u-punkt