开发者对GDAL的贡献

安装所有必需的开发包:GNU make、g++、…

建造:

cd gdal
./autogen.sh
./configure [options]
make -j8 -s
cd apps; make -s test_ogrsf; cd ..

运行命令行实用程序(不安装):

. scripts/setdevenv.sh
gdalinfo --version

运行自动测试套件:

cd ../autotest
pip install -r requirements.txt
pytest

带有GDAL的Git工作流

无论如何,这不是git教程或参考手册。这只是为GDAL开发收集了一些git使用的最佳实践。

提交消息

指示组件名称(例如驱动程序名称)、简短描述以及相关问题的引用(如果实际修复了问题,则使用“fixes#”

COMPONENT_NAME: fix bla bla (fixes #1234)

Details here...

启动工作存储库

叉子 OSGeo/GDAL 从GitHub UI,然后

git clone https://github.com/OSGeo/gdal
cd gdal
git remote add my_user_name https://github.com/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 consistent set
git rebase -i master (use 'fixup' for example to merge several commits together,
and 'reword' to modify commit messages)

# or alternatively, in case there is a big number of commits and marking
# all them as 'fixup' is tedious
git fetch origin
git rebase origin/master
git reset --soft origin/master
git commit -a -m "Put here the synthetic commit message"

# 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 CI checks require changes, commit locally and push. To get a reasonable history, you may need to git rebase -i master, in which 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 pull origin 2.2
(git checkout -b branch_name: if you intend to submit the backport as a pull request)
git cherry-pick the_sha1_sum
git push ...

如果需要更改,请执行更改并 git commit -a --amend

你不该做的事

(对于拥有github.com/OSGeo/gdal推送权限的任何人)永远不要修改提交或已提交到https://github.com/OSGeo/gdal的任何内容的历史记录