# Git

# Git


See Finn Arne's git guide for how to use git:

 * [git status must be clean](git-p0.md)

 * [The magic HEAD](git-p1.md)

 * [The index](git-p2.md)

 * [Partial commits](git-p3.md)

 * [The good commit](git-p4.md)

 * [Types of commits](git-p5.md)

 * [Branches](git-p6.md)

 * [Merge requests](git-p7.md)

 * [Merge request title and description](git-p8.md)

 * [Recovering from a non-+2 review](git-p9.md)

 * [Re-arranging and beautifying a merge request](git-p10.md)


# Working with git-fat


git-fat is keeping track of most binary files. The underlying mechanism is .gitattributes and a 'fat' clean/smudge filter.


run `git fat pull` before building


### git-fat access control


git-fat shuffles files back and forth via rsync over ssh, and access control is simply based on the `.ssh/authorized_keys` file of the `gitfat` user on `src.cxense.com`. This file is updated automatically every 5 minutes, so if you have a working GitLab account, you should get access quickly.


### Installing git-fat


git-fat is available in [//build-tools/git-fat](../../build-tools/git-fat), originally from [https://github.com/jedbrown/git-fat](https://github.com/jedbrown/git-fat) but with a small modification to better handle execution somewhere other than the git repository root. Make sure git-fat is in $PATH. The binary is self-contained, requires python. Install it anywhere that works for you, such as ` /usr/local/bin`, `$HOME/bin`.


```bash

$ type git-fat

bash: type: git-fat: not found

$ ln -s ~/cxgit/cx/build-tools/git-fat $HOME/bin/

$ type git-fat

git-fat is /home/finnag/bin/git-fat

```


## When to run git fat pull?


You need to run git fat pull to get new binaries that you have never pulled before. This can only happen when you fetch or pull some change that introduces or modifies a fat file.


To be on the safe side, you can either run git fat pull after a checkout, or before building. If you only want to look at diffs, it should not be required.


## Adding new fat (binary) files


Create/edit the file as normal. Before pushing any branch containing new fat files, you must run `git fat push. `The cx repository automatically enforces this for you, and refuses a push with a helpful message if you have forgot git fat push.


## Debugging git-fat

### Seeing what git-fat is really doing


You can export the variable GIT_FAT_VERBOSE=1 to see what git fat is doing. This can be useful to see what is going on if certain commands (git diff, git add, git status..) are slow.


```bash

$ export GIT_FAT_VERBOSE=1

$ git status

git-fat filter-clean: cache already exists .git/fat/objects/d9784651a8af786ed347a5c4d48506e8a90eb00e

git-fat filter-clean: cache already exists .git/fat/objects/57bc4f614c8b428aafa1a10c344974eb6577a58f

git-fat filter-clean: cache already exists .git/fat/objects/66aab7e28e0da5acac76c60a3259e768325b49f5

```


### Verifying fat files


You can verify that all fat files are intact like this:


```bash

cd .git/fat/objects

for a in *; do echo "$a $a" | sha1sum --quiet -c; done

```


Report Page