1

I was working in one project file detached from the remote repository for a while, I would like to commit my changes to the old existing repository now.

I have cloned the old version:

git clone <repository path>

How I can merge my new changes? Overwriting the local git folder and run:

git commit

cause me some errors.

tanx

shebelaw
  • 3,992
  • 6
  • 35
  • 48

2 Answers2

0

First, you need to add your files to the list of changes to be committed.

You could say git add myfile.txt anotherfile.txt, or, you could add all files with git add *. Or, you could have Git automatically add file changes to a Git commit by saying git commit -a.

To merge your changes into the remote repo, you need to run git push origin master.

ThatOtherPerson
  • 834
  • 6
  • 18
  • The remote repository have around 50 files my latest project file have around 80 in addition to the new files the old once are modified also. what I need to do once I clone the remote repository? I could follow the basic git documentation but in this case I am trying to commit to an existing repository which wasn't updated for a while. I don't need any file from the remote for this project but the remote contains other project files which I shouldn't overwrite. – shebelaw Feb 09 '12 at 05:40
0

I got the solution.

After I cloned my git repository, I overwrite my latest on the local repository then I run

git commit -a
git push

this probably not the best way to deal with it. But if the changes are a lot before they are checked in this can be an option.

shebelaw
  • 3,992
  • 6
  • 35
  • 48