Git terminology you should know before joining as a programmer

– Branch

branch in Git is simply a lightweight movable pointer to one of these commits. As you initially make commits, you’re given a master branch that points to the last commit you made. Every time you commit, it moves forward automatically.

Note: Every circle in the above image is a commit.

– Master branch

The default branch name in Git is master.

– git commit

The commit is the process of marking and saving your latest changes local repository. Using the “git commit” command only saves a new commit object in the local Git repository.

commit is also known as a version, i.e once you commit the changes git will create a new version of the changed files and store the meta information about all those changes. So later if you did multiple commits and wants to revert back to previous commit then you can do it by just restoring the selected commit.

Or if you want to compare two consecutive files to see what changed

– Remote

Remote is a reference to remote repository.

– Repository

Git repository is a storage place where all the necessary information like branches, commits, tags will be organized and stored.

Whenever a new repository is created, a new sub-directory named .git will be created by git and that contains all of your necessary repository files — a Git repository skeleton. 

– Local repository

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. So whenever an existing repository copied to local it’ll setup a local repository. i.e you can create new branches or commit new changes but all of them stays in your local PC, until you want to push these changes to remote repository explicitly.

– Remote repository – bitbucket, github, gitlab

Remote repository sits in a remote server over internet or in LAN, However it depends on how the git workflow setup is done.

Remote repository is the Single Source of Truth, no matter how many developers working on codebase but all of them has to push their changes back to central repository(remote) at the end of the day.

– Git log/history

It is history of changes in the form of commits in the commit order. This log will help developers to know what changes they have committed and, or what changes are going into the release.

– pull request

This action pulls all the latest changes (commits) from a branch to another branch repository. Generally this happens between developer’s individual branches to master (or main) branch.

– Review

Pull Requests will be reviewed by reviewers. The main purpose of review is to identify any issues before merging developers code to main branch.

– Clone

Clone operation copies remote repository into local

– push, pull, fetch

  • Push – Push operation pushes local commits to remote repository. In a typical scenario, developers work on assigned tasks in their local system and once they are done with the changes then they’ll push the changes to remote central repository.
  • Pull – Pull is opposite of Push operation. When multiple developers working on an application they usually push their changes on daily bases, so that other developers can pull those changes back to their local systems.
  • fetch – Fetch is like pull BUT it’ll not apply changes in local. Fetch will fetch all the changes into local repository but it’ll not apply those changes in the code. This operation will be used in case developer wants to see history of all the changes happened since last pull but do not want to update his local code with those changes.

– Gitignore file

.gitignore file helps developers, not to consider some files into commits during committing the changes, such as compiled classes in local workspace and IDE related configuration files etc.

– Merge

Merge operation is invoked when two branches needs to be merged into either of the branches.

– Checkout

When developer is working on multiple branches, check out operation helps switching between branches.

– Tagging

Tagging is useful in tracking releases, whenever code is deployed to production usually repository admin will tag that branch at that commit, so that it can be referred later to understand what changes went in that particular release.