This is not a git tutorial or reference manual by any means. This just collects a few best practice for git usage for GDAL developement.
Indicate a component name (eg a driver name), a short description and when relevant, a reference to a issue (with 'fixes #' if it actually fixes it)
COMPONENT_NAME: fix bla bla (fixes #1234)
Details here...
Fork OSGeo/gdal from github UI, and then
git clone https://github.com/OSGeo/gdal
cd gdal
git remote add my_user_name [email protected]/my_user_name/gdal.git
git checkout master
git fetch origin
# Be careful: this will loose all local changes you might have done now
git reset --hard origin/master
git checkout master
(potentially update your local master against upstream, as described above)
git checkout -b my_new_feature_branch
# do work. For example:
git add my_new_file
git add my_modifid_message
git rm old_file
git commit -a
# you may need to resynchronize against master if you need some bugfix
# or new capability that has been added since you created your branch
git fetch origin
git rebase origin/master
# At end of your work, make sure history is reasonable by folding non
# significant commits into a consistant set
git rebase -i master (use fixup for example to merge several commits together)
# push your branch
git push my_user_name my_new_feature_branch
From GitHub UI, issue a pull request
If the pull request discussion or Travis-CI/AppVeyor checks require changes,
commit locally and push. To get a reasonable history, you may need to
git rebase -i master
, in whish case you will have to force-push your
branch with git push -f my_user_name my_new_feature_branch
git checkout master
With git log, identify the sha1sum of the commit you want to backport
git checkout 2.2 (if you want to backport to 2.2)
git cherry-pick the_sha1_sum
If changes are needed, do them and git commit -a --amend
(For anyone with push rights to github.com/OSGeo/gdal) Never modify a commit or the history of anything that has been committed to https://github.com/OSGeo/gdal