My linux world » Git Survival Guide

Git Survival Guide


Contents

Configure

Global user name (i.e. for every repository on your computer)

To set the global user name :

$> git config --global user.name "John Doe"

To check the global user name :

$>git config --global user.name
John Doe

Local user name (i.e. only for this repository)

To set the local user name :

$> git config user.name "John Doe"

To check the local user name :

$>git config user.name
John Doe

Working Area

Clone repository

$>git clone http://srv-scm/git/myrepo.git

Init repository

$>git init myrepo
Initialized empty Git repository in /opt/git/myrepo/.git/

Local actions

Switch branch

$>git checkout myexistingbranch

Create a new branch

$>git checkout -b newbranch

Publication server actions

Clone repository

$>git clone http://srv-scm/git/myrepo.git

Fetch repository

$>git fetch

Pull repository

git pull = git fetch followed by git merge FETCH_HEAD

$>git pull

Push repository

$>git push

Copyright © 2023 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.

Fork me on GitHub