##// END OF EJS Templates
docs: added release notes for 4.23.0
docs: added release notes for 4.23.0

File last commit:

r1:854a839a default
r4564:46dfa7ae default
Show More
get-start-git.rst
131 lines | 3.6 KiB | text/x-rst | RstLexer

|git| Getting Started

To work locally with |git| |repos|, use the following configuration examples and command line instructions.

  • :ref:`config-git-config`
  • :ref:`config-gitignore`
  • :ref:`use-basic-git`

Configure the .gitconfig file

The :file:`~/.gitconfig` file is a configuration file which controls how |git| interacts between the server and your local setup.

For |git|, you can set this up in your home directory and it will be applied to all |repos|. Use the following example configuration to set up your file, and put your own information into the relevant sections.

For more detailed information, and a full rundown of all configuration options, see the gitconfig documentation.

[user]
name = username
email = user@mail.com

[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore

[rerere]
enabled = 1
autoupdate = 1

[push]
default = matching

[color]
ui = auto

[color "branch"]
current = yellow bold
local = green bold
remote = cyan bold

[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse

[color "status"]
added = green bold
changed = yellow bold
untracked = red bold

[diff]
tool = vimdiff

[difftool]
prompt = false

[alias]
a = add --all
ai = add -i
ap = apply
as = apply --stat
ac = apply --check

Configure the .gitignore file

The :file:`{~path}/{to}/{repo}/.gitignore` file is a configuration file that tells |git| to ignore certain files and not commit them to the |repo|. Files such as build files, or editor tracking files are usually not committed to a |repo|.

Create the .gitignore file in your |repo| and configure it using the following example to ignore the files you do not wish to be added to version control. For more information, see the gitignore documentation

syntax: glob
result
www
*_build/*
*result/*
*.pyc
*.pyo
*.idea
.DS_Store

Using basic |git| commands

The following commands will get you through the basics of using |git| on the command line. For a full run through of all |git| commands and options, see the Git Command Line Reference Guide

  • git init - create a new git repository.
  • git clone URI - Clone a |repo| to your local machine.
  • git add <filename> - Add a file to staging.
  • git commit -m "Commit message" - Commit files in staging to the |repo|
  • git push origin master - Push changes to the master branch.
  • git checkout -b feature_name - Create a new branch named feature_name and switch to it using.
  • git checkout master - Switch back to the master branch.
  • git branch -d feature_name - Delete the branced named feature_name.
  • git pull - Pull changes on the server into the local |repo|.
  • git merge <branch> - Merge another branch into your active branch.