wont_compile
wont_compile

Reputation: 876

Commit changes to new repository

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!

Upvotes: 1

Views: 1595

Answers (2)

wont_compile
wont_compile

Reputation: 876

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!

Upvotes: 2

user626607
user626607

Reputation:

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).

Upvotes: 2

Related Questions