TortoiseGit Manual

Copying/Moving/Renaming Files and Folders

It often happens that you already have the files you need in another project in your repository, and you simply want to copy them across. One way is to simply copy the files and add them as described above manually.

The easiest way to copy files and folders from within a working tree is to use the right-drag menu. When you right-drag a file or folder from one working tree to another, or even within the same folder, a context menu appears when you release the mouse.

Figure 2.40. Right drag menu for a directory under version control

Right drag menu for a directory under version control


Now you can copy existing versioned content to a new location, possibly renaming it at the same time.

In order to get older versions of a file you can use the repository browser to locate content you want, and copy it into your working tree directly from the repository, or copy between two locations within the repository. Refer to the section called “The Repository Browser” to find out more.

Cannot copy between repositories

Whilst you can copy and files and folders within a repository, you cannot copy or move from one repository to another while preserving history using TortoiseGit. Not even if the repositories live on the same server. All you can do is copy the content in its current state and add it as new content to the second repository.

Git only tracks content

As Git only tracks content, it is not necessary to explicitly record copies or moves as in version control systems like Subversion. Git automatically detects copies/renames/moves based on the file contents when calculating the log.