Git πŸ”₯

You want to use Git as a real chad developper? Let’s go - f a s t - then.

Basics

Git is a decentralized versioning tool aimimg to help programmers following source code development.

  • Track file changes
  • Update remote code
  • Work simultaneously with a lot of people
  • Arrange your code organization

Resources:

Create a new project

From scratch

1
git init

From an empty repository

1
2
3
git clone https://myrepo.org/project-0
# or with ssh (use your public key)
git clone git@myrepo.org:username/project-0

Do some modifications

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
vim my_file.txt # haha 🀣 lol my favorite editor
# add the file to the repository
git add my_file.txt

# change the name of the file
git mv my_file.txt README.md

# delete a file
git rm README.md

# commit your changes
git commit -m 'My changes'

# update the repository
git push
# if from scratch
git remote add origin git@myrepo.org:username/project-0
git push -u origin master

Update your repository

1
git pull

Advanced mechanics

1
2
3
4
5
6
7
# create new branch and push it to repo
git checkout -b my-branch
vim ...; git add ...; git commit ...
git push -u origin my-branch

# update your submodules
git submodule update --remote --merge