In this chapter some of the functions to maintain a repository are discussed.
Compress Git database¶
Git will create a lot of files. You can run the
Compress git database to pack all small files building up a repository
into one big file. Git will also garbage collect all unused objects that are older then 15 days. When a database is fragmented
into a many small files compressing the database can increase performance.
Recover lost objects¶
If you accidently deleted a commit you can try to recover it using the
Recover lost objects function. A dialog will
show you all dangling objects and will allow you to review and recover them.
Normally Git will not delete files right away when you remove something from your repository. The reason for this is that you
can restore deleted items if you need to. Git will delete removed items when they are older then 15 days and you run
There are several functions to help you find the lost items. By default Git Extensions will only show commits. To show all
items, just uncheck the
Show only commits option. The other options can be checked/unchecked to get more/less results.
Double-click on on item to view the content. When you located the item you want to recover you can tag it using the
selected object button.
Git Extensions also is able to tag all lost objects. Doing this will make all lost objects visible again making it very easy
to locate the commit(s) you would like to recover. After recovering a commit using the
Tag all lost commits button, you can
remove all tags using the
Delete all LOST_AND_FOUND tags button.
Fix user names¶
When someone accidentally committed using a wrong username this can be fixed using the
Edit .mailmap function. Git will use
the username for an email address when it is set in the
Fix user name using commit email:
Proper Name <email@example.com>
Fix email address using commit email:
Fix email address and name using commit email:
Proper Name <firstname.lastname@example.org> <email@example.com>
Fix email address and name using commit name and email:
Proper Name <firstname.lastname@example.org> Commit Name <email@example.com>
Git will track all files that are in the working directory. Normally you do not want to exclude all files that are created
by the compiler. You can add files that should be ignored to the .gitignore file. You can use wildcards and regular expressions.
All entries are case sensitive. The button
Add default ignores will add files that should be ignored when using Visual Studio.
A short overview of the syntax:
|#||Lines started with
|!||Lines started with
|/||A leading slash matches the beginning of the pathname; for example,
|/||If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in git).|
For more detailed information.