WebTools Git/ru

Description
This command allows to manage the current document with GIT. GIT is a powerful file version control system, which can manage different versions of files and keep track of the changes.

Git is a complex tool, consider learning the basics of it before using this tool, to avoid wrong operations that can cause data loss. An abundant literature about GIT is available and easy to find on the internet.

Prerequisite: To be able to use this command, the gitpython package must be installed on your system. On most linux distributions, gitpython is available from the standard software repositories as gitpython or python-git.

Usage

 * 1) Make sure the Report view is open since Git messages will be printed there.
 * 2) Save the current active document making sure the saved file is inside an existing git repository. It can be in a subdirectory.
 * 3) Select menu
 * 4) This opens up a Task panel in the Combo view.

Options



 * The Log button will pop up a dialog showing the most recent log entries. The output corresponds to.
 * The Refresh button will re-scan the repository for changed files. After saving your work you have to do a manual refresh.
 * The Diff button will show the differences between the current version of a selected file and the most recent version stored in the repository. The output corresponds to.
 * By default a binary diff is made, you have to set up the  tool for textual diffing.
 * The Select all button will select all files to be committed.
 * The Commit button will commit the selected files. Be sure to write a commit message that describes the changes you are committing.
 * The Pull button will download any new changes to the repository from the selected remote. If the file currently opened in FreeCAD is being modified by a pull, a warning message will inform you so you can either save the file again or save it elsewhere.
 * The Push button will upload your latest commit(s) to the selected remote.

Limitations

 * The tool cannot create new repositories yet. You must have an existing local repository already created. (FreeCAD will check if the current document file is inside a Git repository.)
 * The tool cannot change or create branches. You must do that manually with standard Git tools.

Enabling human-readable diffs for FCStd files with the fcinfo utility
FreeCAD's FCStd file format is a zip-based binary format, for which Git cannot produce proper diffs. This means that you cannot see what has changed between one version and another, and also that each new version stored in the Git repository is a full copy of the file.

Although the second problem currently has no solution, the first one can be solved with a little tool available from the FreeCAD source code, called fcinfo. Git can be told to use the fcinfo utility to print a human-friendly report of a FCStd file, and, when asked to produce a diff between two FCStd files, will produce a diff between the two fcinfo reports instead. Please note that this is only visual feedback, a full copy of the file will still be stored internally.

Example of a diff produced with fcinfo:

Each FreeCAD file contains a SHA1 checksum number, which will change each time the file is saved, even if no contents was changed. So fcinfo will always print something, no matter of the contents changes.

To enable the use of fcinfo (Linux and Mac only - TODO: add Windows instructions)

*.FCStd diff=fcinfo Add the following lines to the  file in your home directory: [diff "fcinfo"] textconv = /path/to/fcinfo Alternatively, if you want to invoke fcinfo with arguments (e.g., ) use this approach : [diff "fcinfo"] textconv = sh -c '/path/to/fcinfo --gui "$0"'
 * 1) Save the fcinfo file somewhere in your system path
 * 2) Make it executable
 * 3) Create a   file in your Git repository and add the following line in it: