Skip to content

VC | Initial Git Setup

sb edited this page Aug 24, 2022 · 19 revisions

Before getting started using git with Trilinos (or any other project that uses git), one should perform a basic setup of git (see How to Do Version Control with Git in Your CSE Project, an IDEAS Productivity "How To" Document):

1) Set up minimal Git settings for your account, including “user.name,” “user.email,” “color.ui,” “push.default,” and “rerere.enabled”:

Note that if you are working on multiple projects with different Git settings, you can omit the --global flag from the following commands to keep them local to Trilinos

git config --global user.name "First M. Last"
git config --global user.email "[email protected]"
git config --global color.ui true          # Use color in git output to terminal
git config --global push.default tracking  # or 'simple' with git 2.0+
git config --global rerere.enabled 1       # auto resolve of same conflicts on rebase!

For example, set up a shell script like git-config-bartlettra.sh and run it on every new machine to set consistent git settings. The first two settings are required. The last three are recommended.

2) Install Git helper scripts locally for the Git shell prompt git-prompt.sh and Git tab completion git-completion.bash, and add them to your shell, for example, setting the following in your ~/.bash_profile file:

source ~/git-prompt.sh
source ~/git-completion.bash
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

These scripts make using git easier, but are not required.

3) Pull request workflow for developers

(also see feature-branch/develop/master workflow)

Clone this wiki locally