I have a remote that is the same, or similar, to the rails project in my current directory. To sync the two, I do
git remote add origin [email protected]
The problem is that some of the files I had in my working copy were added (ie not in the remote), so when I do
it should show a bunch of untracked files. Instead I see the files from the repo that are out of date.
Why didn't it ask me to resolve conflicts in these files? And where are my old files?
The merge implicit in "git pull" must have overwritten local files that were not committed.
I would suggest this sequence:
git init git add . git commit -m"local" git remote add origin [email protected] git fetch origin
At this point, observe the repository with "gitk --all"
git merge remotes/origin/master
This should let you know of conflicts, if any. And local files won't be overwritten.
What if, after the commands you did above, you try doing this?
git checkout blah git pull origin blah
I'm still learning git, so I'm not positive, but just a guess. (Might need to replace
[email protected] in the commands above too.)
If you have a local repo (with its working directory), you shouldn't need to '
git init' anything.
git remote add origin [email protected] git pull
should be enough.
If you have made a
git init, that should be in an empty repository, where you then imported the master content of '
I didn't have a local repo, just the local files.
Then you need to add them first (see r-mercado's answer).
git pull man page:
git pull(actually, the underlying
git merge) with uncommitted changes is discouraged: while possible, it leaves you in a state that is hard to back out of in the case of a conflict.