M. Dhaouadi
M. Dhaouadi

Reputation: 625

get an old repo pushed instead of the new one

I have a git repo named A.

Now I created another one, named B, from the website.

Using the CMD, I went to my project B folder and I did;

git remote add originB master xxxxx.git
git push -u originB master

The problem is that in the new repoB, I found old project A.

I'm pretty sure I am in right local directory, so why the old repo is being pushed instead of the new one?

Upvotes: 0

Views: 39

Answers (1)

rüff0
rüff0

Reputation: 943

maybe you copy the directory and the .git hidden directory is in there..

if you want to switch to another repo from the same project folder structure the command

git init 

will make .git re-initialization.. all the checkouts will be gone away.

ex:

cd route_to/A_project/
git init 
git remote add originB master xxxx.git
git push -u origin master.. 

if you need to copy some of your projectB to projectA without losing the chekouts. then create a temp directory.. ex.

mkdir tempdir
cd tempdir
git clone https://myrepoB.git
cp * -R ../
cd ..
git status 
git add (add the needed)
git commit -m "this checkout contains the last checkout of B project"

Upvotes: 1

Related Questions