1

I cloned one open source project. Now, since I would like to backup that and show it to some people, I would like it to push it to my github account. The issue is that the original repo is now changed, it has a lot of commits added after I originally pulled it, and I don't really want those as I haven't tested them with my modifications.

I tried forking that repo from github to my account, but couldn't merge this one due to many changes present there. (I see the files with git status command) Also, I tried creating a new empty repo and tried to commit changes from that code to that new repo (I edited some of the config files to point to that one, (similar to git remote), but still I didn't manage to succeed.

Can anyone provide me with a method which will allow me to push this code I have to my github account, creating a new repo (or inserting it into the new one), without losing the changes or pulling the new commits from the original repo?

Thanks!

2 Answers 2

2

If you forked the project on github and checked out your fork, it is safe to push the changes to the your repo (it will not affect the original project). Just make sure the origin url is pointing to your fork (and not the original).

You can establish the url by running this command:

git remote show origin

I wouldn't worry though because if you have no permissions to push to the original project, you will not commit your changes.

It is pointless to create a new project (licenses withstanding), you can do what you want with-in the git workflow (and subsequently github).

Sign up to request clarification or add additional context in comments.

5 Comments

I checked out the original, but made a fork after that, so that complicated things a bit. I somehow managed to do it, I posed an answer below, to have it visible in case anyone has the same issue. A bit of an issue was that I added some files, which were not included when I tried to push it when I just edited the remote path.
The git/github workflow will make your life easier if you do things the right way (fork, work on fork, make pull requests etc). As long as you vie off the path, it becomes hard to work with.
I see, I realize that and I would like to continue with the right practices. As I mentioned, this was a bit of a specific issue so that caused some of the unnecessary complications for me.
Well, you need to accept one of the answers for future reference.
Of course, I wanted to accept mine one below but it says I have to wait until tomorrow...
2

So, I did these steps do fix the issue:

  1. I created a new repo online
  2. Ran the git init command
  3. Ran the git add * command
  4. Ran the git remote add origin path/to/.git/online
  5. Authenticated
  6. Ran the git commit -m 'blabla' to make the initial commit
  7. Ran the git push origin master to push it to the repo

This solved my issue!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.