This is a step-by-step guide for contributing changes to Sachin Sant's repository using the fork-and-pull-request model.
Repository URLs
Original Repository (Upstream)
https://github.ibm.com/ssant/resource-estimator
My Fork
https://github.ibm.com/sachin-pb/resource-estimator
One-Time Setup
1. Fork the Repository
Fork the upstream repository:
ssant/resource-estimator
to your GitHub Enterprise account:
sachin-pb/resource-estimator
2. Clone Your Fork
git clone git@github.ibm.com:sachin-pb/resource-estimator.git
cd resource-estimator
3. Configure Git Identity
git config --global user.name "Sachin P Bappalige"
git config --global user.email "sachinpb@linux.ibm.com"
Verify:
git config --list | grep user
Expected:
user.name=Sachin P Bappalige
user.email=sachinpb@linux.ibm.com
4. Add Upstream Repository
Verify existing remotes:
git remote -v
Add upstream:
git remote add upstream git@github.ibm.com:ssant/resource-estimator.git
Verify:
git remote -v
Expected:
origin git@github.ibm.com:sachin-pb/resource-estimator.git
upstream git@github.ibm.com:ssant/resource-estimator.git
Sync with Upstream
Fetch the latest changes from the upstream repository:
git fetch upstream
Fetch a specific branch:
git fetch upstream program
Create Local Tracking Branch
git checkout -b program upstream/program
Verify:
git branch
Expected:
* program
Make Changes
Edit the required file:
vi README.md
Review changes:
git status
git diff
Stage Changes
git add README.md
Verify:
git status
Expected:
Changes to be committed:
modified: README.md
Commit Changes
Create a signed-off commit:
git commit -s
Example commit message:
Usage error correction to README.md
Push Changes to Your Fork
Push the branch to your fork:
git push origin program
Modify the Last Commit (Optional)
If you need to make additional changes after committing:
vi README.md
git add README.md
git commit --amend
Force-push the updated commit:
git push -f origin program
Create a Pull Request
After pushing successfully, create a Pull Request from:
sachin-pb/program
→
ssant/program
Example Pull Request:
https://github.ibm.com/ssant/resource-estimator/pull/1
Useful Verification Commands
Check Current Branch
git branch
Check Repository Status
git status
View Changes
git diff
View Commit History
git log --oneline
View Remotes
git remote -v
Verify GitHub Authentication
ssh -T git@github.ibm.com
Expected:
Hi sachin-pb! You've successfully authenticated.
Quick Reference
git clone git@github.ibm.com:sachin-pb/resource-estimator.git
cd resource-estimator
git config --global user.name "Sachin P Bappalige"
git config --global user.email "sachinpb@linux.ibm.com"
git remote add upstream git@github.ibm.com:ssant/resource-estimator.git
git fetch upstream
git checkout -b program upstream/program
vi README.md
git status
git diff
git add README.md
git commit -s
git push origin program
# If additional changes are needed
vi README.md
git add README.md
git commit --amend
git push -f origin program
# Create Pull Request
# sachin-pb/program -> ssant/program