Git Guide for Good

What can we do with Git?

  • Working Directory: The part where we code our project
  • Index/Stage: To commit our changes
  • HEAD: Refer to the last commit.

Setup

git init
git clone /path/to/repository

Add & Commit

git add <file-name>
git add .
git add .
git reset <file-name>
git rm <file-name>
git commit -m “Meaningful commit message”

Push

git push origin <branch-name>
git remote add origin <server>

Branch

git checkout -b <branch-name>
git checkout <branch-name>
git branch -d <branch-name>
git branch

Update & Merge

git pull
git pull <remote> <branch>
git merge <branch>

History

git log

Stash & Revert

git stash
git revert HEAD

--

--

--

Penultimate CS Student @ University of Indonesia

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to connect to @holder Section in X-Metaverse Discord

Construction Tools for Compiler Development

How to avoid Big Bang Deployment

SaaS prepper: backing up my Flickr collection with a Raspberry Pi

How to export scrapy result to SQL

DevOps Attacks Managed Kubernetes cluster, Part 1.

Sorting Algorithm: Insertion Sort

4 Best Practices to Guarantee Successful AWS Migration

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fikri Adidharma

Fikri Adidharma

Penultimate CS Student @ University of Indonesia

More from Medium

How to refresh your daily dev environment automated?

How To Reset MySQL Root Password In Centos 7

Backend Development

McBird Technologies Hiring for Python Developer