GithubHelp home page GithubHelp logo

git's Introduction

Git

Clone Repositori

git clone --depth 1 https://[username]:[tokenGithub]@github.com/[username]/[repositori]

Cek Status Repositori di Local

git status

Menyimpan Perubahan di Staging Area

Sebelum melakukan commit, file perlu dipindah ke staging area. Hal ini dilakukan agar Git mengetahui apa yang berubah antara commit saat ini dan commit berikutnya.

git add nama_file_1
git add nama_file_2

atau

git add nama_file_1 nama_file_2

Jika terdapat banyak file yang diubah, perintah berikut dapat dilakukan.

git add -A

atau (untuk semua file dan direktori)

git add .

Menyimpan Perubahan di Local

git commit -m "Tuliskan di sini, apa aja yang berubah"

Upload Repositori dari Local

git push

Mengambil Update Repositori dari Server

Jika belum ada perubahan/commit di Repositori lokal gunakan git pull. Pull akan mengambil commit terbaru dan secara otomatis melakukan merge dengan repositori lokal.

git pull

Jika sudah ada perubahan/commit di Repositori lokal gunakan git fetch. Fetch hanya mengambil commit terbaru dan perlu melakukan merge secara manual.

git fetch

Reset di Local

Untuk membatalkan commit, kembali ke commit sebelumnya yang diinginkan dan menghapus commit berikutnya. Untuk reset dengan file dalam keadaan belum masuk staging area/modified.

git reset --MIXED nomor_commit

Untuk reset dengan file dalam keadaan staged.

git reset --SOFT nomor_commit

Untuk reset dengan file dalam keadaan commited.

git reset --HARD nomor_commit

Revert

Untuk menggabungkan commit terbaru dengan commit sebelumnya. Biasanya akan terjadi konflik file namun bisa diselesaikan secara manual.

git revert nomor_commit

Menambah Branch baru

git branch nama_branch

Berpindah Branch

git checkout nama_branch

Mengubah nama commit

git commit --amend -m "Message Commit Terbaru"

Mengubah origin url

git remote set-url urlorigin-terbaru.git

git's People

Contributors

alfirmanpahlepi avatar justrinoo avatar luminettebourgeons avatar mzaini30 avatar nugraha41 avatar slowy07 avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.