Git
It is recommended to learn a little about the theory behind Git before diving in. Codecademy has a free course. This cheat sheet is also helpful.
Installation
Refer to the official documentation.
GUI Clients
- SmartGit - SmartGit is a graphical Git client with support for SVN and Pull Requests for GitHub and Bitbucket. SmartGit runs on Windows, macOS and Linux.
https://www.syntevo.com/smartgit/ - Eclipse EGit VCS Plugin - EGit is an Eclipse Team provider for the Git version control system. The EGit project is implementing Eclipse tooling on top of the JGit Java implementation of Git.
https://www.eclipse.org/egit/ - /wiki/spaces/HOWTO/pages/14288008 - VCS built in to IntelliJ
https://www.jetbrains.com/help/idea/version-control-integration.html - See more: git-scm.com - GUI Clients
Git Configuration
Auditing configuration
It helps to first audit your Git configuration to find any existing configuration files.
To view all configured settings by configuration file, run:
$ git config --list --show-origin
Â
Keep in mind there may be multiple configuration files on your system. You might need admin/root access to edit some of them.
Typical paths for Git configuration files:
~/.config/git/config
~/.gitconfig
Basic configuration options
To set a global configuration value quickly on the command line, use:
$ git config --global group.name value
Â
Note that you must use quotation marks for strings on command line
- Set
user.name
 toFirstname Lastname
 - Set
user.email
 toname@example.com
 - Set
pull.rebase
totrue
 . This helps keep history linear during busy development times. Learn more: http://gitready.com/advanced/2009/02/11/pull-with-rebase.html
Windows line endings
We want to use LF on all files in our repositories to maintain multi-platform compatibility.
Setting core.autocrlf input
should keep all files LF and converting them from CRLF on commit if necessary, but not the other way around.
$ git config --global core.autocrlf input
If you need to change the line endings of a Windows workspace from CRLF to LF, set core.autocrlf = false and then run on all repos:
git add --renormalize . git checkout -- . # Or using vcstool: vcs custom -n -w 1 repos --args add --renormalize . vcs custom -n -w 1 repos --args checkout -- .
You may need to unstage and discard local changes after doing this.
Saving credentials permanently
Ubuntu
Ensure your git config is using libsecret as the credential helper. libsecret stores your credentials in a secure manner.
git config --global credential.helper libsecret
We need to build libsecret for this to work.
sudo apt install -y libsecret-1-0 libsecret-1-dev cd /usr/share/doc/git/contrib/credential/libsecret sudo make git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
Now, you should be able to perform git operations without having to type in your credentials every time.
Windows
Installing Git bash and authenticating once by cloning some private repository (or any other authenticated git request) should permanently store your git credentials. Make sure when you install Git bash that you use the "Git Credential Manager".
Git LFS
We use Git LFS (Large File Storage) for storing large files (URDFs, 3D models, shared libraries, images, log data, etc) in our git repositories. Anything above ~5MB should be stored in git-lfs. This reduces clutter in the git version history and allows us to host large files on GitHub.
If you have installed git-lfs after cloning a git-lfs repo, you may need to run git-lfs pull
from inside the repository directory.
Installation
If these don't work, try the official guide from GitHub.
Ubuntu
cd ~/Downloads && wget https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-linux-amd64-v3.5.1.tar.gz tar -xvf git-lfs-linux-amd64-v3.5.1.tar.gz cd git-lfs-3.5.1 sudo ./install.sh
Windows
Download and extract git-lfs https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-windows-amd64-v3.5.1.zip
Run the extracted .exe installation wizard.