I won’t explain here how to clone PostgreSQL repository. I assume you already
know basic usage of
git commit. If you don’t,
please visit that website to download your
free copy of Pro Git and read it.
In that post, I explained how to create a patch with
git diff. Now we will learn how to apply that patch.
No pending changes
Be sure to have no pending changes before trying. That can be done with :
If you have pending changes, you should know what it is. Either it’s a patch you’re writing and you can save it by creating a patch with your modifications then cleaning your git repo
patch p1 > pending_patches/patch_name_v0_x.patch git reset --hard
either you did something wrong and don’t want to keep that changes :
git reset --hard
I know some guys like to
git stash instead and I’m happy for them but my brain
thinks it’s “too messy”. (Nothing rational here, just an impression.)
Be sure you’re on the latest version of master
First, you need to go on the master branch and update your repository.
git checkout master git pull --rebase
You can perform a
git status before, just to know if you have uncommitted
Create a branch and apply
In order to keep your master branch clean without effort, you’ll certainly want to create a branch before applying:
git checkout -b name-of-your-choice patch -p1 < your-patch-path
Then you should be able (or not) to compile your source code.
Drop your branch
Once you’re finished with testing your (or others) patch, you’ll need to destroy your branch :
git checkout master git branch -D name-of-your-choice
Do you need more ?
If you need more informations, please look at that Postgres wiki pages :