Stephen
Stephen

Reputation: 170

Updating and commiting individual files with TortoiseGit like TortoiseSVN

A client of ours has several version-control projects set up on beanstalkapp.com .

Most of them with subversion. I installed and set up TortoiseSVN on Windows; this allowed me to have a copy of all files on my computer. If I wanted to change a file, I could right click it and choose 'Update' (to ensure it is updated to the latest version before editing), make my changes, and then right click it and choose 'Commit'. I could also select a handful of files that I had changed and commit these all at one.

The newest project uses git. I installed and set up TortoiseGit, cloning the repository on my computer, but have been finding the interface a lot more confusing.

1) I can't seem to find a way of updating just a single file, without downloading every single changed file along the way. I believe this is done globally by right clicking the folder (rather than a file), and choosing TortoiseGit -> Pull. If I try right clicking an individual folder, there is no pull; there is a 'check for modifications' but it doesn't seem to do what it sounds like.

2) I am similarly confused with committing. If I right click and choose Git commit -> master, it does allow me to check/uncheck files which I want to change. But then it appears I also have to do a 'push', which also seems to be something global. When I tried updating a file, committing, and choosing 'push', the file was updated correctly, but Beanstalk also listed in its logs that I had made another change:

'Merge branch 'master' of xxx.beanstalkapp.com:/xxx

including a file that I hadn't touched at all. And I don't see any list of files when I choose 'push'.

I've been reading through various articles on stackoverflow for similar questions, but most seem to be for people who know lots of technical information about git; using the command line, branches, etc.

Is there any simple way of just updating one file, editing it, and committing it, or is this not possible with TortoiseGit?

Upvotes: 1

Views: 5044

Answers (1)

Kevin Reid
Kevin Reid

Reputation: 43773

Git, unlike Subversion, does not support parts of a working tree (svn: working copy) having different base revisions; there is always one “HEAD” commit which is the base revision for the entire tree. Nor is it possible to download some changes and not others; it is expected that you have the entire history available (up to the last time you fetched changes) and you navigate that history locally (still whole commits at a time).

You can commit partial changes using the index, but checkout/push/pull of commits are always operations on the entire tree.

(I'm not familiar with TortoiseGit, but if it added these features, then it would necessarily be incompatible with command-line Git due to needing to extend the repository format.)

If you need to construct a mixed-revision state, then first of all, the changes of interest must be in separate commits (it's generally a good idea in Git to make fine-grained commits; git rebase -i can be used to split and join commits before publishing them). Create a temporary branch derived from one revision of interest; then use git merge or git cherry-pick to add changes from some other branch, or git revert to undo past changes on the history of this branch.

Upvotes: 4

Related Questions