Git basics: contribute to a github repo

Yiling Liu
1 min readNov 3, 2019

--

I’m contributing to a github, first I changed my code, added some features. Now I feel I’m ready to push to the master branch, but I’ve got my local branch several dirty commits and I don’t want other people to see them. Here is what I did.

  1. Create a branch locally, naming wise you can use yourname/feature.
git branch yiling/cloud-functions

2. Switch to that branch

git checkout yiling/cloud-functions

3. Fetch master branch

git fetch

4. Check logs

git log

5. Rebase, this will bring the my own feature branch to begin on the tip of the master branch.

git rebase -i origin/master

6. I forgot to commit some changes, it’ll ask me to commit first.

git add feature.py
git commit -m "add my feature"

Finished.

https://www.atlassian.com/git/tutorials/merging-vs-rebasing

--

--

Yiling Liu
Yiling Liu

Written by Yiling Liu

Creative Technologist, ex-googler

No responses yet