Add command in TortoiseGit - windows

I'm just beginning to use TortoiseGit for Windows (I'm new to git) and I don't see the Add command in the context menu when I right-click on a directory or file. As I understand it, I should run this addcommand each time I want an update to a local file to be "staged". Here I don't see such a thing, the only "similar" thing I can do is run a commit instead, which is obviously not the right thing to do.
Besides, when I create a new file I also want to add it, but the context menu only proposes to "Add to ignore list".
Am I missing something here?

You can add a file or folder to a git repository by right-clicking on it, then in "TortoiseGit"-submenu select "Add.." (should be the first menuitem, right above the "Add to ignore list"-submenu).
Anyway... another way of staging files or folders via TortoiseGit is to right-click the repository > TortoiseGit > Check for modifications > select the filed/folders you wish to stage from the list of not versioned files > right-click > add.

Related

Context menu for folder does not contain "Add to ignore list" tortoisegit

I use TortoiseGit 1.8.16. But the context menu for a folder does not contain the "Add to ignore list" option.
Right click on folder in repository. I expect to see "Add to ignore list" in context menu. This item is not in the context menu.
How to add file in ignore via TortoiseGit?
In TortoiseGit the context menu is configurable in two ways.
1) You can configure which entries to show directly on the context menu (and not in the TortoiseGit submenu). This can be configured in TortoiseGit settings -> Context menu.
2) You can hide entries by default, so that those are only visible if you hold the Shift-Key while opening the context menu. This can be configured in TortoiseGit settings -> Set Extended Context menu.
In your case, I suppose that the entry is hidden. Btw. the "Add to ignore list" is only available for unversioned folders (otherwise "Delete and ignore is available").
It is also possible to ignore items from the context menu of the commit dialog.
See the TortoiseGit manual.
Note on Windows 11 the context menu settings choice is different.
1- R.click on the required folder and select Settings:
2- At General>>Context Menu : Check "Add to ignore list", then click OK
3- Icon will appear at the context menu:
For ignoring files, you Can do:
$ git rm -r --cached gen/ bin/
$ echo "gen/" >> .gitignore
$ echo "bin/" >> .gitignore
I can do it with these steps below!
Delete the file you want to ignore first. You can undo it later to get it back from the recycle bin. Or you can move it to another folder temporarily.
Do git commit until the commit window opens. Don't commit!
You'll see the file you want to ignore is going to be committed. Right click on the file and you'd see the option "Add to ignore list".
Click it! Choose what kind of ignore you exactly need, and done!
I know this is really old but I recently had this issue and it was because the directory had been set up for git previously then removed by deleting the .git directory. When re-instating it as a Git Repo the old .gitignore file came back and the directories I was trying to ignore were already listed in it.
To test the theory I removed all entries from the old .gitignore file, saved and the "Add to ignore list" was back in the context menu

TortoiseSVN right click menu gone when selecting files

Short Question
Has anyone had an issue when right clicking files (.c/.h/etc..) and the TortoiseSVN menu is not present? Note that it is there when I right click a folder in the same directory.
Failed Attempts
I have seen that a number of issues like this have been resolved by running the installer again and selecting repair or modify, at this point neither of these attempts have worked.
Is there anything else I can try to get this working again? The DIFF functionality being gone is hurting something fierce.
Edit
I am the only developer working on the files. I actually found a way to see the diff: Move the parent folder TortoiseSVN->Check for modifications. This menu does indeed show all of my versioned files as well as any of them that have been modified.
I have also confirmed that the files really still are version controlled by checking out the same repo in on a different machine.
Edit2
It is worth noting that I am using Macdrive and it's right click menu is present all the time. In addition, I just saw that I am having the same issue with TortoiseGIT as well.
Go to registry editor using regedit
Go to and click on HKEY_CLASSES_ROOT/*/​shellex/ContextMenuH​andlers/TortoiseSVN
Observe error message box saying access is denied.
Right click on the key mentioned above, go to "Permissions"...
In the permission dialog, click on "Advanced"
Click on "Owner" tab, click on your account and click "Apply"
OK the dialog
Right click on the key mentioned above, go to "Permissions"...
Grant permissions for OWNER RIGHTS to "Full Control"
Apply the changes
Source
If still not works so try to use shift key + right click.
Are you sure that these files under version control? It is possible that someone has deleted these files from svn repo and after update your these files has become unversioned.
You can check that by going one dir level up (from folder where these files are located) and choose whether Tortoise-SVN->Repo-Browser menu (check that they are present on SVN server) or SVN Commit (make sure Show unversioned files checkbox is set and check Text Status Column if it contains "non-versioned") .
Shift + Right click on the folder which you want to checkout click TortoiseSVN --> settings --> Context Menu --> uncheck the Hide menus for unversioned paths

How to create a patch in TortoiseSVN while no file is checked out?

I know if some files are checked out (modified) then I could right click on containing folder, then select "create patch". After then I will see list of all checked out files. So I could include them in the patch.
But when no file is checked out, aka everything is committed, create patch window is empty. So the question is how can I create patch from checked-in files? I want to send this patch to colleagues so they can apply them on company svn server.
thanks,
A unified diff is a patch file.
Using TortoiseSVN, right-click on your working folder and select “Show Log”
Select the two revisions (Ctrl-Click)
Right-click on either of the highlighted revisions and select “Show differences as unified diff”
To save the changed files with the folder structure.
Using TortoiseSVN, right-click on your working folder and select “Show Log”
Select the two revisions (Ctrl-Click)
Select "Compare revisions." This would list the modified files between the revisions in a dialog box
Select all the files in the dialog that comes up. Right-click on the selected files and select "Export selection to…"
This should export the modified files with the folder structure.
What you're describing is a diff between two subversion revisions. Check out the SVN Book's section on svn diff to see how to do it.
If you just want colleagues to get the most up-to-date files, they should get it from the svn server using svn-checkout. If for some reason they can't access your svn server, you can also right-click and choose svn-export; this gives you a set of all the files in the containing folder without any of the hidden .svn directories.

Git (TortoiseGit) - How to revert a single file to a previous revision and then undo the revert?

When using Git with TortoiseGit: Does somebody know how to revert a single file(or a complete repository) to a previous revision?
For example I have a repository containing multiple files. One file exists in three revisions (1 ; 2 ; 3). Now I want to change from revision 3 back to 2.
TortoiseGit offers a "Revert" function in the "Show log" dialog which allows to jump back to a specific revision, but this will revert your whole repository instead of a single file.
Also once I have reverted something, I don't have a clue how to undo the revert and jump back to the newest revision.
From the command line: git checkout is probably what you want.
The documentation shows an example of:
$ git checkout master~2 Makefile
to revert Makefile to two revisions back in the master branch
From within TortoiseGit (via Windows Explorer) it looks like you can do this with the following steps:
Navigate in Explorer to the folder where the file is.
Right-click on the file you want to revert, choose Show log from the TortoiseGit context menu
In the top section ("graph") select the revision that has the version of the file you want to revert to
In the third section (file list) right-click the file and choose Revert to this revision
You should get a message like 1 files revert to e19a77
It is also possible to get a specific file:
Right-click on the file
Choose the menu item: Git Show Log
TortoiseGit show a dialog with a list of all revisions
Click on the prior revision (2)
In a list in the bottom of the dialog it shows all the files associated with the commit
Find the file you are looking to view
Right-click on that file and Save Revision To
This will save that previous revision of the file with the commit number concatenated on the file
For example:
- original file is file.txt
- revision 2 will save as file-67b51a8.txt
I'm using TortoiseGit v2.2.0.0
In TortoiseGit the answer is to right-click the project folder and click Show Log, then right-click the change you want to roll back to and click Switch/Checkout to this... . It will let you then proceed from that weird place in the commit stack, or branch in case you plan to commit and want things to stay sane.
Updated my answer, based on these comments:
by Alexander.
by mlibby
by Chris Moschini
Suppose the working tree is clean and you want:
Checkout some file(s) of its previous revision
Testing
Revert to current revision
Checkout some file(s) of its previous revision
(a) Right click the file you want to revert and Show Log for that file
(b) Right click the file in file list and perform Revert to parent revision
(c) repeat (a), (b) until you get all files you want.
Testing
Revert to current revision
(a) perform Revert... in context menu of explorer
This way, you can choose the file(s) you want to revert.
(b) or this quick way: perform Reset Hard in Log dialog
This way, all changed files revert. (=> Lost all working dir changes)
(Tested on TortoiseGit 1.8.16.1, GfW 2.6.4.windows.1, Win 10 64bit)
For Tortoise Version 2.3.0:
You can do it in several ways, but fastest i think is that:
Right click on the file
Click the menu option "Diff with previous version"
Right click on the left (previous) version of file
Click the menu option "Use this whole file"
Save the changes (ctrl+s)

How is "Add Existing Item..." in Visual Studio meant to work?

I never use "Add existing item..." feature in Visual Studio's Solution Explorer because it is confusing:
it seems to me the way it should work is that if you have a Customer.cs file in Models directory, that you could choose "Add existing item", it would then show you which items exist in that directory an allow you to choose one. Instead, it opens a file dialogue to some seemingly random directory on your hard drive, and I'm not sure if it is going to make a copy of that file, or use it outside the solution, etc.
instead, if I want to "add an existimg item", I go into windows explorer, click file, CTRL-C, click folder in solution explorer, ctrl-v, and it is clear
Do others do it differently? Am I missing something about how "add existing item" in solution explorer is supposed to work?
The folder opens where-ever you last left it...
As for using this feature; by default (Add) it does IMO the least useful thing; copy the file. But if you notice, the add button is actually a drop-down; hit the down arrow and you can add a link to the file - i.e. leave it where it is and reference it by location (Add As Link).
The quick and easy way to do what you are trying to do (add an existing file that already exists within the folder in your project) is:
At the top of the Solution Explorer window is an icon/button for "Show All Files", enable it (if it is already enabled and the file you are looking for is not shown, click "Refresh"). Note that this setting is enabled on a per project basis.
Right click on the file that you want to include and select "Include in Project".
Add Existing file adds the file to the project. Keeping it in the project directory is something different and making it a part of the project is something different. By making it a part of the project, its entry is made in .csproj/.vcproj/etc and then further properties can be set of this file such as specifying a custom build step etc.
And No, it doesn't create a copy of the file in your current project's directory in case of a Visual C++ project. In case of a CSharp Project, it does create a copy.
e.g., I use this when I need to add a bitmap/png file in my project which I have gotten from an external source. I just copy the file to my project directory and then use Add Existing File to add this to the project.
I'm using it. I even didn't know it's possible to ctrl+c ctrl+v in solution explorer.
It's particulary handy, if you want to add something 'as link'.
I do use it but often I just add file as a link. That make it easier to maintain some common classes if you do not want to make full assembly out of them.
As far as my experience goes using this function, it does the same copy and paste that you are describing.

Resources