mrhrifat
mrhrifat

Reputation: 65

How to get latest code of Open Source Project where I have contributed

I have contributed to a Open Source Project in GitHub. There are only one branch master and in my Local there is also one branch named master. I have contributed about 3-4 times.
When I write git pull it show me Already Up to Date. Now the problem is in Open Source there are some changes but I can't get update with them. Like they have 762 lines of code in README.md but I have only 722 lines of code. I have tried,

  1. git pull
  2. git fetch
  3. git reset --hard origin/master
  4. git fetch --all
  5. git reset --hard HEAD
  6. git stash
    git pull
  7. git fetch origin
    git status

Help to me solve this with safe way without loose any data from local.

Upvotes: 0

Views: 334

Answers (1)

Alecto
Alecto

Reputation: 10740

If it's not showing updates when you pull, that's probably because you forked the project. The origin you've been pushing and pulling from is the one for your forked version.

If you print out .git/config, for your local repository, you can see if this is the case. Just run cat .git/config in the root of the repository.

In order to get updates from the project, add their git repo as an upstream:

git remote add upstream <git url to their project>

Then, fetch changes from that upstream:

git fetch upstream

You can see what changes they've made via git diff:

git diff master upstream/master

Question: How did you contribute your changes to the project?

If you pushed, then it's likely you just pushed to your forked version, not the project yourself.

If you created a pull request that got accepted, then the changes got merged in.

Does their project have your changes? This determines how to proceed.

Upvotes: 1

Related Questions