> INIT AND REMOTE


Créer le repo

Using Github CLI

run `gh auth login`
puis `gh repo create [name] --public`


Create Git

#1: Create a folder for this project on your local hard drive
mkdir my-project
#2: change into this folder
cd my-project
#3: initialize a new, empty Git repository here
git init
...after having written some code + created some files...
#4: add all changes to the next (= first) commit
git add .
#5: create the first commit
git commit -m "Initial commit"

Link Git to Github Repo

git remote add origin https://github.com/GithubUserName/RepoName
git remote -v #check if it worked
git push --set-upstream origin master

Add a sub module

git submodule add [github link]

Clone Private Repo

git clone https://[PAT]@github.com/[account]/[repo].git
Generate Private Acess Token at
/Settings/Developer Settings/Personal access Token
StackOF source

> BRANCH

COMMIT BEFORE DOING ANYTHING
origin : remote alias

Create Branch From Master

git branch [new-branch]

Create New branch from a branch

git checkout -b [new-branch] [existing-branch]

Switch Branch

git checkout [branch]

Merge Branch in Master

git checkout master
git pull [origin] master
git merge branch
git push [origin] master

Merge Master in Branch

git checkout [branch]
git pull [origin] master

Delete branch

git branch -d [branch]

Add and Commit

git commit -am "message"

Add Alias "ac" for the previous command

git config --global alias.ac "commit -am"

Edit comment

git --amend -m "edited message"

Rollback to a commit

git revert [commitID]

Test successive commit to find bug origin

git bisect [commit de départ]
git bisect good #To Go to next commit

Nice logs

git log --graph --oneline --decorate

Go Back to previous Branch

git checkout -


website to dowload a specific directory from a repo


- home -