Git How do I Push a project, that was Downloaded from Source
I worked with a graphic designer that did not clone from my github account. He downloaded the project from source rather than using the command "git clone". Since he pulled his files, a month has gone by and I want to do the following tasks:
- Create a new branch
- Push the graphic designers project into that branch
- Merge his branch with Master
I've tried the following the github forking guide with not much luck; when I attempt to push the files 开发者_运维百科into a new branch I get an error: fatal: Not a git repository (or any of the parent directories): .git
How do I do this?
You can do this using an existing checkout. First, create a branch to store the designer's changes:
git checkout -b graphics
Next, copy his files on top of the existing files in that project. You can use git status
to confirm that you've got all the files. Then, commit the changes to that new branch.
You can then merge that branch into master
using the usual merge methods.
Clone the repository, make the branch, check it out, put the files in place, add, commit, push.
Try looking into rebase --onto
Basically, init a git repo in the designer's working directory, let him commit his work as a first commit.
then add a remote to your github, fetch it, then rebase his local master --onto the github master
Note: I haven't tried this myself, so you might wanna try it on a dummy project first.
git init
git add <stuff>
git commit -m"designer's work"
git remote add hub <github-clone-url>
git fetch hub
git rebase --onto hub/master
精彩评论