-
Notifications
You must be signed in to change notification settings - Fork 262
Workflow
We use a centralized rebase workflow. We have a central repository with a single branch "master" and a linear history. Developers work in local topical branches but commit them to the "master" branch on the central repository.
No local changes should be made to the local "master" branch: all changes should occur on a topical branch. For simplicity, pulls and pushes are done directly on the topical branch, so normally the local "master" branch is rarely used.
Clone the repository, either via ssh if you've set up ssh keys in your Github profile:
git clone [email protected]:DynamoRIO/drmemory.git
Or via https:
git clone https://github.com/DynamoRIO/drmemory.git
Now run the development setup script:
make/git/devsetup.sh
Ensure origin is up to date:
git fetch origin
Then create a new branch for the feature or project, called a "topical" branch. Replace "topical" here with a name of your choice:
git checkout --track -b topical origin/master
If you've run the development setup script, you can shorten this to:
git newbranch topical
Now perform your work in the topical branch, committing locally.
To bring upstream changes into your local topical branch:
git pull --rebase
git submodule update
If you've run the development setup script, you don't need the --rebase
argument, and you can use the alias pullall
to perform both steps at
once:
git pullall
If you've run the development setup script, you can request a code review for the changes on the current branch by executing:
git review
The review script will ask you for the email address of the reviewer. You
can pass it directly via -r
:
git review -r [email protected]
After making and committing changes in response to review comments, you can
upload a new patchset for the review by simply running git review
again.
The script will query you for a summary of the new patchset. This can be
passed directly via the -s
flag:
git review -s "Addressed reviewer concerns"
See the Code Review page for more information on the review process.
Once the code in your topical branch has been reviewed, passed the test suite, and is ready to commit upstream, you can push it by running this command while on the topical branch:
git push origin HEAD:master
If you've run the development setup script, you can shorten this to:
git dcommit
If you're using git review
, you should also use git dcommit
in order to
update the review page with the commit hash and to remove the marker in the
current branch that points at that particular review page.
Once you've pushed your changes upstream, you can delete your topical branch with these commands (substituting your branch's name for "topical"):
git checkout master
git pull --rebase
git branch -d topical
Be careful with submodules when pulling upstream changes. If a submodule
was modified upstream and only a git pull
is run without a subsequent
git submodule update
, that upstream change will be reverted upon the next
git push
. Please use the pullall
alias as described below to avoid
accidentally clobbering submodule changes.
We do have a pre-commit hook in place that will warn you if you try to roll back the dynamorio submodule while checking in at least one other file:
% git commit -a
Error: the dynamorio submodule is being rolled back.
This is likely a mistake: did you pull but not run git submodule update?
Aborting commit.
Run git checkout <hash>
to update DynamoRIO to that hash:
cd dynamorio
git checkout 0c81acfc9aaea949e6f6ecfe0b4157c06a014dda
For more details, see UpdatingDR.
If you want to split off the first commit or two from a feature branch and you issue a command like this:
git checkout -b tocheckin 35d4e9c87de22ec9b3a8a110cae2d83821c88ee0
The tocheckin
branch will not be a tracking branch, and thus the git dcommit
will not work. You'll need to issue this command:
git branch --set-upstream-to=origin/master tocheckin
If you've run the development setup script, you can run both commands at once with:
git split tocheckin 35d4e9c87de22ec9b3a8a110cae2d83821c88ee0
Some potentially useful aliases that are not in the development setup script include the common tasks of looking at the log of changes versus the remote master:
git config alias.dlog "log --stat origin/master.."
And looking at the full diff versus the remote master:
git config alias.ddiff "diff origin/master.."