在线文档 https://tortoisegit.org/docs/tortoisegit/
2. TortoiseGit Daily Use Guide
Preface
Audience
Reading Guide
TortoiseGit is free!
Community
Ackowledgments
Terminology used in this document
1. Introduction
What is TortoiseGit?
TortoiseGit's History
TortoiseGit's Features
Installing TortoiseGit
System requirements
Installation
Language Packs
Spellchecker
2. TortoiseGit Daily Use Guide
Getting Started
Icon Overlays
Context Menus
Some commands which are very rarely used are only available in the extended context menu. To bring up the extended context menu, hold down the Shift key when you right-click
Drag and Drop
Common Shortcuts
Authentication
Maximizing Windows
Create Repository
At an empty directory, just use the explorer context menu and select Git Create Repository Here.
A normal repository has a working tree attached to which files can be checkout and committed whereas a bare repository only can be pushed to and pulled from.
Clone Repository
URL: Input repository URL address, which you will clone from. You can click Browse to browse directory.
Directory: Input your local directory, which you will clone to. You can click Browse to browse directory.
If you check the Load Putty Key checkbox, clone will auto load putty key file with Pageant.
Clone will checkout current HEAD to work space automatically.
Git clones supports http, git and ssh protocol.
Checking Out A Working Tree(Switch to commit)
The Switch/Checkout dialog can be used to checkout a specific version to the working tree(i.e. all files are updated to match their state of the selected version). Normally, a specific version will be represented by a (local)branch which is set as the current branch.
If you enter a branch name at Create New Branch, a new branch will be created. Also, the new branch will be set as the current branch(HEAD)
You can click on the ... to browse the references/branches/log to choose a branch to checkout
Check Overwrite working tree changes (force) will overwrite uncommitted changes in the working tree with the selected version.
When you selected a remote branch, you can check Track in order to track the remote branch. When you open the push, pull or sync dialog, the remote branch will be pre-selected automatically.
Committing Your Changes To The Repository
Storing the changes you made to your working tree is known as committing the changes. you can use TortoiseGit->Check for Modifications first, to see which files have changed locally
The Commit Dialog
If there are no conflicts, you are ready to commit your changes. Select any file and/or folders you want to commit, then TortoiseGit->Commit
Default commit dialog just list select paths and their child directory files. If you want to list all files of project, you can just click Show Whole Project
Please note, that all commits are just local and only affect your local working tree. In order to share them with others you need to push them to a remote repository.
Change Lists
The commit dialog supports changelist feature to help with grouping related files together.
Excluding Items from the Commit List
Sometimes you have versioned files that change frequently but that you really don't want to commit. Sometimes this indicates a flaw in your build process - why are those files versioned? should you be using template files? But occasionally it is inevitable. A classic reason is that your IDE changes a timestamp in the project file every time you build. The project file has to be versioned as it includes all the build settings, but it doesn't need to be committed just because the timestamp changed.
To help out in awkward cases like this, there is a Git flag for files called skip-worktree - then files are treated as unmodified and Git also refuses to merge those on merge/pull. As another way to takle cases like this, we have reserved a changelist called ignore-on-commit. Any file added to this changelist will automatically be unchecked in the commit dialog. You can still commit changes, but you have to select it manually in the commit dialog.
Commit only parts of files
Commit Log Messages
You can apply simple format to your log messages using a convention similar to that used within emails. To apply styling to text, use *text* for bold, _text_ for underlining, and ^text^ for italics
You can re-use previously entered log messages. Just use the command Context Menu->Paste Recent messages to view a list of the last few messages you entered for this working tree. The number of stored messages can be customized in the TortoiseGit settings dialog.
If you want to include the checked paths in your log message, you can use the command Context Menu->Paste filename list in the edit control.
Commit Progress
In the lower left, there is a menu button which provides shortcuts to further steps, such as ReCommit (resets the commit dialog and allows you to continue committing) or Push in order to push your commit to a remote repository.
Getting Status Information
Icon Overlays
A fresh checked out working tree has a green checkmark as overlay. That means the Git status is normal
As soon as you start editing a file, the status changes to modified and the icon overlay then changes to a red exclamation mark. That way you can easily see which files were changed since you last updated your working tree and need to committed.
If during an update a conflict occurs then the icon changes to a yellow exclamation mark.
Staged. If you use "git update-index" to tell git this file will be committed, Git makes that file staged.
This icon shows you that some files or folders inside the currentt folder have been scheduled to be deleted from version control or a file under version control is missing in a folder
The plus sign tells you that a file or folder has been scheduled to be added to version control
The bar sign tells you that a file or folder is ignored for version control purposes. This overlay is optional
This icon shows files and folders which are not under version control, but have not been ignored. This overlay is optional
Status
TortoiseGit -> Check For Modifications
- Blue Locally modified items
- Purple Added Items. Items which have been added with history have a + sign in the Text status column, and a tooltip shows where the item was copied from
- Dark red Deleted or missing items.
- Green Items modified locally and in the repository. The changes will be merged on update. These may produce conflicts on update
- Bright red Items modified locally and deleted in repository, or modified in repository and deleted locally. These will produce conflicts on update
- Black Unchanged and unversioned items.
Viewing Diffs
TortoiseGit's context menu -> Diff This starts the external diff-viewer, which will then compare the current file with the pristine copy (BASE revison), which was stored after the last checkout or update
Pull and Fetch change
Push
Branch
Destination
Options
Sync
Branch
Destination
Options
Daemon
Browse All Refs
Submodules
Change Lists
Log Dialog
Invoking the Revision Log Dialog
Revision Log Actions
Getting Additional Information
Filtering Log Messages
Navigation
Statistical Information
Refreshing the View
Revision Graphs
Revision Graph Nodes
Using the Graph
Refreshing the View
Reference Log
The Repository Browser
Viewing Differences
File Differences
Line-end and Whitespace Options
Comparing Version
Diffing submodules using Submodule Diff Dialog
Diffing Images Using TortoiseGitDiff
External Diff/Merge Tools
Adding New Files
Copying/Moving/Renaming Files and Folders
Ignoring Files And Directories
Pattern Matching in Ignore Lists
Deleting, Moving and Renaming
Deleting files and folders
Moving files and folders
Changing case in a filename
Dealing with filename case conflicts
Deleting Unversioned Files
Undo Changes
Cleanup
Reset
Stash Changes
Bisect
Branching/Tagging
Creating a Branch or Tag
Merging
Cherry picking
Rebase
Resolving Conflicts
Special conflict cases
Creating and Applying Patches and Pull Requests
Creating a Patch Serial
Sending patches by mail
Applying a single Patch File
Applying a Patch Serial
Creating a pull request
Who Changed Which Line?
Blame for Files
Exporting a Git Working Tree
Integration with Bug Tracking Systems/Issue Trackers
Adding Issue Numbers to Log Messages
Getting Information from the Issue Tracker
TortoiseGit's Settings
General Settings
Icon Overlay Settings
Network Settings
External Program Settings
Saved Data Settings
Git
Client Side Hook Scripts
TortoiseGitBlame Settings
TortoiseGitUDiff Settings
Advanced Settings
Exporting TortoiseGit Settings
git svn dcommit
Final Step
3. The GitWCRev Program
The GitWCRev Command Line
Keyword Substitution
Keyword Example
COM interface
Glossary
- Add: A Git command that is used to add a file to your working tree. The new items are added to the repository when you commit.
- BASE revision: This is the common ancestor's version of a conflicted file.
- Blame: This command is for the text files only, and it annotates every line to show the repository revision in which it was last changed, and the author who made that change. Our GUI implementation is called. TortoiseGitBlame and it also shows the commit date/time and the log message when you hover the mouse of the revision number.
- Branch: A term frequently used in revision control systems to describe what happens when development forks at a particular point and follows 2 separate paths. You can create a branch off the main development line so as to develop a new feature without rendering the main line unstable. Or you can branch a stable release to which you make only bug fixes, while new developments take place on the unstable trunk. In Git a branch is implemented as a "pointer to a revision".
- Clone: A Git command which creates a local working tree in an empty directory by downloading a remote repository
- Cleanup: Remove untracked files from the working tree. This is different to TortoiseSVN cleanup
- Commit: This Git command is used to pass the changes in your local working tree back into the repository, creating a new repository revision.
- Conflict: When changes from the repository are merged with local changes, sometimes those chagnes occur on the same lines. In this case Git cannot automatically decide which version to use and the file is said to be in conflict. You have to edit the file manually and resolve the conflict before you can commit any further changes.
- Copy: In a Git repository you can manually create a copy of a single file or an entire tree w/o problems.
- Delete: When you delete a versioned item(and commit the change) the item no longer exists in the repository after the committed revision. But of course it still exists in earlier repository revision, so you can still access it. If necessary, you can copy a deleted item and "resurrect" it complete with history.
- Diff: Shorthand for "Show Differences". Very useful when you want to see exactly what changes have been made.
- Export: This command produces an compressed archive of all versioned files (of a specific revision).
- GPO: Group policy object
- HEAD: Head is a synonym for the currently active branch (to be more precise in Git Head can also be so-called "detached" and directly pointing to a commit instead of a branch).
- History: Show the revision history of a file or folder. Alsk known as "Log"
- Log: Show the revision history of a file or folder. Also known as "History"
- Merge: The process by which changes from the repository are added to your working tree without disrupting any changes you have already made locally. Sometimes these changes cannot be reconciled automatically and the working tree is said to be in conflict. Merging happens automatically when you pull changes, cherry-pick, or rebase. You can also merge specific changes from another branch using TortoiseGit's Merge command.
- Patch: If a working tree has changes to text files only, it is possible to use Git's Diff command to generate a single file summary of those changes in Unified Diff format. A file of this type is often referred to as a "Patch", and it can be emailed to someone else (or to a mailing list) and applied to another working tree. Someone without commit access can make changes and submit a patch file for an authorized committer to apply. Or if you are unsure about a change you can submit a patch for others to review
- Pull: This Git command pulls down the latest changes from the repository into your working tree, merging any changes made by others with local changes in the working tree.
- Repository: A repository is a place where data is stored and maintained. A repository can be a place where multiple databases or files are located for distribution over a network, or a repository can be location that is directly accessible to the user without having to travel across a network. Git is a distributed version control system - each working tree contains its own repository (in the .git folder). A Git repository does not require network to work with most operations. Network is required only when you need to synchronize changes with remote repositories.
- Resolve: When files in a working tree are left in a conflicted state following a merge, those conflict must be sorted out by a human using an editor (or perhaps TortoiseGitMerge). This process is referred to as "Resolving Conflicts". When this is complete you can mark the conflicted files as being resolved, which allows them to be committed.
- Revert: If you have made changes and decide you want to undo them, you can use "revert" command to go back to the version from HEAD.
- Revision: Every time you commit a set of changes, you create one new "revision" in the repository. Each revision represents the state of the repository tree at a certain point in its history. If you want to go back in time you can examine the repository as it was at a specific revision. In another sense, a revision can refer to the set of changes that were made when that revision was created.
- SVN: A frequently-used abbreviation for Subversion. TortoiseGit provides git-svn interoperability. You can fetch partial or whole history from an SVN remote and store as a local git repository. This allows you to browse the history and create commits locally. You can finally commit your changes to an SVN remote.
- Switch/Checkout Updates all files in the working tree to a specific version. This is normally used for switching/checking out branches
- Update The corresponding command for the SVN update command is Pull
- Working Copy See "Working Tree"
- Working Tree This is your local "sandbox", the are where you work on the versioned files, and it normally resides on your local hard disk. You create a working tree by doing a "Clone" of a repository, and you feed your changes back into the repository using "Commit"
Index