tags:

views:

78

answers:

3

Hello 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

A: 

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.)

Marcus Lindblom
I didnt create any branches on either, so they're both working with the master branch. when I cloned it creates a from scratch repo so I couldnt create branches even if I wanted tothanks
deepblue
+1  A: 

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.

samg
ok so 'git branch -a' on the original repo is showing only the master branch (* master), while on the new clone repo its showing (* master\n origin/HEAD \n origin/master). Honestly Im not sure what this indicates. I just did 'git pull origin master' and its telling me that its up to date... so I think that its the original thats somehow not in correct state, or should I say I think that the repo checked in is not representing the working directory state... on the original repo every time I do a "git commit -m 'test'" it submits the latest changes as if it sees them for the first time...
deepblue
You may have "unstaged" changes on your remote repo. On the remote repo run `git add .` to stage all changes. Then `git commit -m "my message"`. Then try running `git pull origin master` again from your local repo.
samg
deepblue
A: 

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"

Antony Hatchkins