Guide To Git on the command line

Table of contents

Every single place I've worked at or company I've worked with in the last decade has used git. Its just part of every developers work day.

(And I'm a big fan of git).

Theres only really a few commands you need to know

git pull

This will pull the latest commits for the current branch.

git push

Push your current branch / commit to the remote server (github etc)

git add

Stage file(s)

git commit

Commit the staged files as a new commit

git checkout

Change branches (or create a branch with -b)

git rebase

Rebase current commit ontop of another commit/branch

git merge

Merge in other commits/branch(es)

git bisect

Use binary search to find a commit (useful when something is failing/there is a bug - you can use binary search to quickly find what commit introduced the bug)

git stash

"stash" the uncommitted changes. This saves it locally (in your .git directory), and resets the files back so they have no uncommited changes. You can get them back with git stash apply

Comments Guide To Git on the command line