1

I have a local project up-to-date with my github repo. Somebody else modified the project (files added, modified, removed) and handed me the new source code on a USB stick. They did not use Github. How do I update the repo with the new source?

amit
  • 1,293
  • 2
  • 16
  • 28

3 Answers3

0

You could simply replace your local content with the content of the USB key, and then:

cd /root/dir/of/your/repo
# rm everything
# cp everything from USB
git add -A .
git commit -m "update from USB key"
git push origin

(See "What's the difference between git add . and git add -u?" for more on git add -A)

I assume your current branch is master, and is already tracking origin/master (meaning the master branch of the GitHub repo)

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Of course, rm everything..., except the `.git` directory within the root dir of your repo ;) – VonC Jul 18 '13 at 21:05
0

If the folder on the stick has the same structure with your project, then just copy the usb folder over your project folder and when you are asked, say you want to merge the folders. Off course, this will still keep files that might have been deleted on the USB, but not in your project. Assuming that this doesn't bother you, you then, from the command line, do inside your project folder:

git add -A
git commit -m "Your message"
git push origin master

This is for the remote named origin (your Github), assuming you are doing this from your master branch.

RedPoppy
  • 463
  • 4
  • 11
0

Copy the project files from the source disk to your working directory and type git status to see what's changed. Then, add the new files with git add ./path/file.ext or add entire directories with git add ./directory

When you are done adding files, git commit -a to commit all files and compose your commit message in the (default) editor or git commit -am'my short commit message' to commit all files with the commit message 'my short commit message'.

Finally, git push origin branchname

I would suggest also keeping the other person's work in a separate branch for ease of merging it into your branch, but that seems like a separate question.

Gui Weinmann
  • 388
  • 1
  • 7