Skip to main content

🚀 TL;DR - Git

·355 words·2 mins· loading · loading · ·
TL;DR dev git tldr
0xNinja
Author
0xNinja
mov al, 11
Table of Contents

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
#

1git init

From an empty repository
#

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

Do some modifications
#

 1vim my_file.txt # haha 🤣 lol my favorite editor
 2# add the file to the repository
 3git add my_file.txt
 4
 5# change the name of the file
 6git mv my_file.txt README.md
 7
 8# delete a file
 9git rm README.md
10
11# commit your changes
12git commit -m 'My changes'
13
14# update the repository
15git push
16# if from scratch
17git remote add origin git@myrepo.org:username/project-0
18git push -u origin master

Update your repository
#

1git pull

Advanced mechanics
#

 1# create new branch and push it to repo
 2git checkout -b my-branch
 3vim ...; git add ...; git commit ...
 4git push -u origin my-branch
 5
 6# tag a commit
 7git tag -a v1.0 -m "My description of the tag"
 8
 9# merge my-branch into master
10git checkout master
11git merge my-branch
12git push
13
14# update your submodules
15git submodule update --remote --merge
16
17# delete a local commit
18git reset HEAD~
19
20# modify a local commit
21git commit --amend
22
23# temporary discard your local changes
24git stash
25
26# config your git variables
27git config user.name PouetPouet
28
29# sign off a commit
30# some opensource project require you to sign your commits, see
31# https://stackoverflow.com/a/1962112
32git commit -s -m "My commit message"
33
34# mutli authors
35git commit -m "My commit message
36You can add co-authors to a commit by adding one line by author like so:
37(note the mandatory 2 empty lines)
38
39
40Co-authored-by: username <user@example.com>"

For more tricks: ohshitgit.com

Related

🚀 TL;DR - pacman
·103 words·1 min· loading · loading
TL;DR archlinux pacman tldr
🚀 TL;DR - nmap
·147 words·1 min· loading · loading
TL;DR tldr nmap
🚀 TL;DR - Docker
·263 words·2 mins· loading · loading
TL;DR docker tldr
🚀 TL;DR - What is the 'TL;DR' series?
·112 words·1 min· loading · loading
TL;DR storytelling tldr
🪛 Build your own mechanical keyboard
·264 words·2 mins· loading · loading
diy hardware
Draft
You want to start to pwn?
·89 words·1 min· loading · loading
notes pwn writeup