Contributing git guide · axmolengine/axmol · Discussion #411 (original) (raw)
All pull requests should want merge to branch dev
Fork and clone
- Fork on github page to your own github account
- Clone your own fork:
git clone https://github.com/<your git accout>/axmol.git - Add remote
officialfrom axmolengine/axmol
cd axmol git remote add official https://github.com/axmolengine/axmol.git
Create pull-request for bugfix or feature
There are two methods to create a pull-request
- For little or 1 file changes,just edit on official repo and press button
Propose file change(please ensure create branch on your own fork), then continue to create pr on github page. - Create a pull-request with multiple files changes:
we assume you already add remote official
Sync official remote
git fetch official
create a branch from official latest for PR source branch
git checkout -b feature1 official/dev
After finish changes on branch feature1, push it to your fork repo
git push origin feature1
Then, please goto github page to create pull-request step by step.
Note: Before a pr mreged, any changes from pr source branch will be applied on pr and trigger ci build
Review pull-request
Usually, you can review PR changes on github web page, but when you want verify the PR changes on your local machine, you can merge PR to your local branch and test:
git fetch origin pull/219/head:pr219 git checkout pr219
The 219 is the PR id, the pr219 is local branch name
Some other commands
- Add chmod to file:
git update-index --chmod=+x path/to/file - Speedup
git add,git status,git commit: Speeding up Git using a built-in file system watcher git-for-windows/git#3251, but may broken visual studio git management - Change commit author email:
git filter-branch --env-filter "GIT_AUTHOR_NAME='newname'; GIT_AUTHOR_EMAIL='newemail@xxx'; GIT_COMMITTER_NAME='newname'; GIT_COMMITTER_EMAIL='newemail@xxx';" HEAD - Clone with submodules,
--recurse-submodulesalso works:git clone --recursive <repo-url>git clone --recursive <repo-url>git clone --recursive -j8 <repo-url>(-j flag only available in version 2.8+):
- show current branch name:
git branch --show-current, empty if not in branch - show short commit hash:
git rev-parse --short HEAD - show commits count:
git rev-list --count HEAD - force reset local branch match with remote origin discard local changes:
git reset --hard origin/dev