English 中文(简体)
git confusion - cloning a repo is returning a past version
原标题:
  • 时间:2009-11-15 19:23:37
  •  标签:
  • git

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. when I do git log -n1 to see what the latest commit info of the new repo (the clone) it matches the original repo that I cloned (the latest commit info), so thats confusing me even more since git is indicating that both are the latest versions. Im using git 1.5.4.3 on ubuntu server. any ideas

thanks

问题回答

First make sure all changes are committed on the remote repository.

git add .
git commit -m "my commit message"

Running git status should show no uncommitted changes.

Then on your local copy try running

git pull origin master #or whatever branch you re on

You can list branches by running

git branch -a

The -a shows local branches and those from the repository you cloned from.

It you need to switch to another branch on the from the remote repository you need to set up a local tracking branch first. The command will look something like:

git branch --track my_branch origin/my_branch
git checkout my_branch

When in doubt run

git pull origin master #or whatever branch you re on

This would bring your local working copy up to date with the remote repository.

Are you on the same branch as the other repo?

(you get master by default, and newer commits in other branch aren t possibly hidden until you switch.)

That could possibly happen if you have inconsistent treating of newlines (core.autocrlf).

Make a simple change (add a line into one of your files).

Paste here what git diff, git status, cat .git/config say on and what is the exact output of git commit -am "test"





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签