Work with other's Github Repository

Work with other's Github Repository


Never edit and commit code under origin repository, you need to Fork other's repo to yours, and clone into your local, and add upstream to your remote

git clone [email protected]
git remote add upstream [email protected]

Before you need to create Pull Request(PR) of origin repo, make sure your forked repo is sync with origin's by:

git pull upstream

After code merged and conflicts are all addressed, you can push to your forked repo.

git push origin

And Raise an PR

Optional Step


You can make commit history more clear by package your local change history into one commit.

git rebase -i HEAD~~

Then change the keyword pick into squash for all commits that you want to merge

pick 033beb4 b1
squash d426a8a b2

# Rebase 49687a0..d426a8a onto 49687a0
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

After done it, type :wq to confirm your change

results for ""

    No results matching ""