3. Version control systems

Note

Don’t modify this file in RDE-Doc. Update the file in personal notes, then copy it in RDE-doc.

3.1. Git

Pro Git book https://git-scm.com/book/en/v2

3.1.1. Basics

3.1.2. installation

sudo apt install git-all

3.1.3. Configuration

git config --global user.email "abdo_sarter@hotmail.com"
git config --global user.name "Abed"

git config --global core.editor gedit

3.1.4. Create new repository

git init

git add README.md
git commit -m "first commit"
echo "*.o" > .gitignore

git remote add origin https://github.com/abedGNU/abedGNU.github.io.git
git push -u origin master

3.1.5. fd

git config --list

git status

git config user.name

3.1.6. Clone existing repository

Clone repository

git clone https://github.com/abedGNU/QtSnap7.git

3.1.7. Commit and versioning

git status
git add .
git commit -m 'initial project version'
git tag

3.1.8. Ignoring files

# ignore all .a files
*.a

# but do track lib.a, even though you're ignoring .a files above
!lib.a

# only ignore the TODO file in the current directory, not subdir/TODO
/TODO

# ignore all files in the build/ directory
build/

# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt

# ignore all .pdf files in the doc/ directory and any of its subdirectories
doc/**/*.pdf

3.1.9. Working with remote

git remote -v
git remote

git fetch pb

git fetch <remote>

git fetch origin

git remote show origin

git remote rename pb paul

3.1.10. Branching

git branch newbranch

git checkout testing

git checkout master

3.1.11. Github pages

3.1.12. Usefull commands

Check the git official book and documentation for more informations.

git status -s // short status
git diff
git diff --staged
git add *.c

git tag
git tag -a v1.4 -m "my version 1.4"
git show v1.4
git tag -l "v1.8.5*"

git checkout 2.0.0

git push origin v1.5

git log

git clone
git init
git pull
git fetch
git status
git add
git diff
git commit
git push
git rm
git mv
git log
git tag
git merge
git show
git branch
git checkout

3.2. Mercurial

3.3. SVN - Apache SubVersion