/belajarGit

Belajar Otodidak Git (Version Control)

BELAJAR GIT

Cara install git di Linux ubuntu

sudo apt-get install git

Cara inisialisasi repository git

git init

Cara menambahkan file ke staging index

git add .

Atau

 git add --all

Update repository

git add .
git commit -m "initial commit"

Note:

  • -m : untuk menambahkan message
  • git add . (dot) untuk memperoses semual file

Cara untuk unstaging index

git reset HEAD

Note :

  • HEAD adalah mereset ke commit terakhir undo

Cara reset soft reset dengan file detail

git reset HEAD File_A

Cara untuk melihat status

git status

Cara untuk melihat log

git log
git bash --oneline
git bash --graph

Cara membatalkan commit

git commit --amend

Cara untuk melihat perbedaan file yang belum di masukan ke staging index

git diff File_A

Cara untuk membuat branch

git checkout -b branch test_branch

Cara pindah branch

git checkout test

Cara merge branch

git merge master

untuk mengedit commentar commit

git commit --amend
  • kemudian untuk push ke git repository nya
git push --force example-branch

Cara setting single repository

git config user.email "your_email@example.com"
git config user.email

Untuk menghapus branch

git push origin --delete <branch_name>
git branch -d <branch_name>

Delete Local Branch

git branch -d branch_name

How to create tag

git tag v1.0.1

How to delete tag

git tag -d v1.0.1