3

Kind of a long story, but here's the deal:

on GitHub:

a repo that I downloaded the source code from (just via a zip, not by cloning it) a fork of that repo that I was going to push changes to.

on my local machine, I unzipped the master repo's source code that I downloaded and did some work on it.

Now, I'm in the situation where I want to push these changes back to the remote forked repo, but since I didn't set up the repo locally when I first got the source code, I'm not sure what to do.

Any help?

Thanks

Mustafa

0

4 Answers 4

4
  1. clone the project (in another directory than your zip extracted directory)
  2. copy the contents of the zip extracted directory (with your modifications)
  3. paste it over the contents of the cloned project
  4. commit the changes
  5. push to remote
Sign up to request clarification or add additional context in comments.

2 Comments

Step 1.5: Create and check out a branch at commit in the repository corresponding to the source you downloaded. Hopefully it's a tagged version number. (git checkout -b <branch> <commit>) If you don't do this, you'll be overwriting new content with old content that you didn't modify.
Step 4.5: Rebase your branch onto master (git rebase master <branch>). If conflicts arise, deal with them. Then merge your branch into master (git checkout master; git merge <branch>).
2

If your changes are relatively minor, just checkout the remote repo into a local repo, then apply your changes on top of it as a single commit, or over a series of reasonably-demarcated commits if necessary.

Comments

1

Clone the repo the proper way.

From the cloned repo, do:

GIT_WORK_TREE=../test.wd git commit -am "Commit from work tree" 

( you will have to add files if you have added new one: GIT_WORK_TREE=../test.wd git add )

where ../test.wd is the path to the working directory where you had unzipped and done your changes

Now, git push origin master

Alternatively, you can just copy files over to the clone and commit and push.

1 Comment

Exactly what I did - thanks! Sorry for long delay in marking you as the answer - it was my bad!
1

Simply add the remote repo as origin

git remote add origin <repo url taken from github> 

I am unsure if that sets everything up the way that git does from the beginning but it should be sufficient to be able to push

2 Comments

The directory where the OP has made the changes is NOT a git repository. It's just a snapshot of the remote repository (it doesn't have a .git directory) so it's not possible to add a remote.
Ah, missunderstood that. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.