In this tutorial you will learn a commonly used feature of Git i.e. to mark a change-set’s dependency on another change-set. Consider following scenario:
- A change-set A is pushed for review
- Later, it is found to be dependent on a change-set B, which may already under review
In order to let Git take care of the dependency, following can be done:
- Checkout B and note down its <commit ID>
- Checkout A and run following command.
git rebase -i <commit ID>
This will open up an editor having a single line, prefixed with string: “pick”. No need to modify anything – Just save and close the editor.
Git will continue with the rebasing. You may have to resolve conflicts, if arise any. Finally, you can just push your code for review. If you use Gerrit Code Review system you may see, that “Depends On” field will start showing change-set B.