|
Menu location |
---|
Web Tools → Git |
Workbenches |
WebTools |
Default shortcut |
None |
Introduced in version |
0.17 |
See also |
None |
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.
git log
.git diff
.
fcinfo
tool for textual diffing.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:
diff --git a/testhouse.FcStd b/testhouse.FcStd
index 08077b6..985b1d8 100644
--- a/testhouse.FcStd
+++ b/testhouse.FcStd
@@ -1,26 +1,25 @@
-Document: /tmp/43un09_testhouse.FcStd (442K)
- SHA1: 67c1985a45d93cba57d5bf44490897aba460100d
+Document: /tmp/zfXoDd_testhouse.FcStd (370K)
+ SHA1: db1cb5fca18af7bfdca849028f40550df4d845cb
Comment : This is a test house to showcase FreeCAD's BIM worflow and IFC export capabilities
Company : uncreated.net
CreatedBy : Yorik van Havre
CreationDate : Fri May 9 12:05:54 2014
FileVersion : 1
Id :
- Label : testhouse
- LastModifiedBy : Yorik van Havre
- LastModifiedDate : 2016-06-28T17:05:57-03:00
+ Label : testhouse2
+ LastModifiedBy : Yorik van Havre
+ LastModifiedDate : Sat Sep 13 20:46:36 2014
+
License : CC-BY 3.0
LicenseURL : http://creativecommons.org/licenses/by/3.0/
- ProgramVersion : 0.17R7800 (Git)
- TipName :
+ ProgramVersion : 0.15R3989 (Git)
Uid : 67e62d8a-6674-4358-92fe-615443be887a
- Objects: (231)
+ Objects: (221)
Annotation : Drawing::FeatureViewAnnotation
Annotation001 : Drawing::FeatureViewAnnotation
Annotation002 : Drawing::FeatureViewAnnotation
Annotation003 : Drawing::FeatureViewAnnotation
- Annotation004 : Drawing::FeatureViewAnnotation
- Annotation005 : Drawing::FeatureViewAnnotation
Array : Part::FeaturePython (9K)
Box : Part::Box (2K)
Building : App::DocumentObjectGroupPython
@@ -110,7 +109,7 @@ Document: /tmp/43un09_testhouse.FcStd (442K)
Floor : App::DocumentObjectGroupPython
Floor001 : App::DocumentObjectGroupPython
Floor002 : App::DocumentObjectGroupPython
- Frame : Part::FeaturePython (89K)
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)
These are the steps to enable the use of fcinfo tool in a repository basis.
fcinfo
script is included on freecad
package, patch here.fcinfo
is available at /usr/bin/fcinfo
..gitattributes
file in your Git repository and add the following line in it:*.FCStd diff=fcinfo
.gitconfig
file in your home directory:[diff "fcinfo"]
textconv = /path/to/fcinfo
--gui
) use this approach:[diff "fcinfo"]
textconv = sh -c '/path/to/fcinfo --gui "$0"'XD
Note that if you are working in a collaborative project you may want to include the fcinfo tool in your repository, in that case the path is relative to your Git repository root directory.
If you are working on many projects that need fcinfo tool you can enable it globally for your user.
$HOME/.config/git/attributes
file and add the following line on it:*.FCStd diff=fcinfo
$HOME/.config/git/config
file:
git config --global diff.fcinfo.textconv "/path/to/fcinfo"
.freecad
package can use {{{1}}}
since it's already installed on their system.[diff "fcinfo"]
textconv = /path/to/fcinfo
Note that any configuration made in a repository basis overrides global configurations.