This is collection of most frequently used git commits with explanations to some of the git concepts.

Basic git commands

Initialize Git repo

Bare repositories are usually central repositories where everyone moves their work to. Bare repositories store git revision history in the root folder of your repository instead of .git subfolder.

Working with commits

Fetch vs Pull

Fetch: Only downloads new data from a remote repository. But it doesn’t integrate any of this new data into your working files. This is useful when you need to compare the new commits added to the remote branch with your local repo.

Pull: Download the repo changes integrate with local repo. So it update your current HEAD branch with the latest changes from the remote server.

Merge Vs Rebase

Merge: Incorporate new commits into your feature branch. This will create an extra merge commit every time you need to incorporate changes. So this will pollute the branch history.

Rebase: Move the entirety of a branch to another point in the tree by re-writing the project history by creating brand new commits for each commit in the original branch. The simplest example is moving a branch further up in the tree.

Save the changes temporarily

Working with git tags

Other Useful Commands

Senior Software Engineer | BSc (Hons) Engineering | CIMA | Autodidact | Knowledge-Seeker