Log in

View Full Version : Help with TortoiseGit


roozhou
19th April 2011, 15:22
I used to use TortoiseSVN to develop ffmpeg and mplayer. I checked out code from remote svn repository and made my local changes upon it. Each time I click "svn update", it will automatically sync to the latest version and merge my local changes to it. If there are conflicts you can click resolve and do a three-way merge.

Now ffmpeg and mplayer have moved to git. I installed TortoiseGit. Unfortunately there is no "Git update" in the menu. "Git fetch" does not change the local repository, "Git pull" tells me something like "error: Entry 'ffmpeg.c' would be overwritten by merge. Cannot merge." and stops. What git command should I use to do a job similar to "SVN update"?

LoRd_MuldeR
19th April 2011, 15:45
Well, Git works decentralized. That is the big difference between Git/Mercurial and older version control systems like SVN/CVS.

You don't check out individual files from a central server. And you don't commit changes (directly) to a central server either.

Instead you "clone" the repository that is located on the server to your local machine (including the complete history!) and then all commit/checkout operations are done locally!

Later on you can "sync" your local repository with the "official" one on the server. The respective operations are called "push" and "pull" (I'm not quite sure what "fetch" does differently).

I usually use the "Git Sync" feature of Tortoise Git, which gives you access to both, push and pull. It also shows the changes of these operations...

(If you don't want to bother with push/pull and you don't make any local changes anyway, then you can of course simply delete the local repository and re-clone from the server)

roozhou
19th April 2011, 16:11
Thank you Mulder.
The problem is I want to keep my local changes while updating to "official" one.

e.g. I clone the x264 repository from the server. The version is 1800. I added a new feature to x264 locally, so several files had been modified, with red excalmatory mark on their icons. I am not a x264 committer so I cannot commit to the repository. After a few months x264 have updated to 1900. Now I need to sync to the latest x264 but keeping my changes. What should I do with TortoiseGit?

LoRd_MuldeR
19th April 2011, 16:29
Thank you Mulder.
The problem is I want to keep my local changes while updating to "official" one.

e.g. I clone the x264 repository from the server. The version is 1800. I added a new feature to x264 locally, so several files had been modified, with red excalmatory mark on their icons. I am not a x264 committer so I cannot commit to the repository. After a few months x264 have updated to 1900. Now I need to sync to the latest x264 but keeping my changes. What should I do with TortoiseGit?

Yes, you can commit! With Git all commits go to your local "clone" of the x264 repository. You cannot push these "local" commits to the official x264 repository on the server though ;)

Moreover you should be able to "update" your local repository with a simple pull operation and still keep your local changes - unless there are conflicts, of course.

BTW: You can also make a patch from your local changes, delete the local repository (but keep the patch!), get a "fresh" clone the from the server and apply your patch on this...

roozhou
19th April 2011, 17:01
WOW it works! After commit if I make further changes do I need to commit again?

LoRd_MuldeR
19th April 2011, 17:23
WOW it works! After commit if I make further changes do I need to commit again?

Well, you don't have to commit anything.

But if you make a lot of local changes, it may be advisable to commit your changes now and then, so you get a history of what you changed and when :)

And even if you don't intend to push your commits to the server, you can easily turn your commits into patches (.diff files) to share them...