Development, Working-in Team: Version Control, Team Coding, Git

Andhar Dezan
Moodah POS
Published in
5 min readOct 11, 2019

Hello everyone, in this blog post, I would like to share with you my understanding of version control, team coding, and git. Also, I would like to share with you how I implemented it in the software engineering project.

What is Git?

Git Version Control System

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. A version control system is a software tool that manages changes to source code over time. It keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can see and compare earlier versions of the code to help fix the mistake while minimizing disruption to all members of the team. Git is a free and open-source, which means the developers can use Git for free, inspect, modify, and enhance the source code. It is also a distributed version control system, which means the developers can do automatic management branching and merging, do their work offline and store it in the remote repository, and they do not have to rely on a single location for backups since the complete codebase, including its full history, is mirrored on every developer’s computer.

Git Manual

Git Pull

Git pull is used to fetch and download content from a remote repository and immediately update the local repository to match that content. The git pull command is actually a combination of two other commands, git fetch followed by git merge. In the first stage of the operation, git pull will execute a git fetch scoped to the local branch that HEAD is pointed at. Once the content is downloaded, git pull will enter a merge workflow. A new merge commit will be-created and HEAD updated to point at the new commit.

Example:

git pull

Git Push

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repository. It is the counterpart to git fetch, but whereas fetching imports commits to local branches, pushing exports commits to remote branches. Remote branches are configured using the git remote command. Pushing has the potential to overwrite changes, so developers should be careful when pushing.

Example:

git push

Git Clone

git clone is a Git command-line utility that is used to target an existing repository and create a clone, or copy of the target repository. The target repository can be a local or remote repository.

Example:

git clone

Git Merge

The git merge command lets you take the independent lines of development created by the git branch command and integrate them into a single branch. It combines multiple sequences of commits into one unified history. In the most frequent use cases, git merge command is used to combine two branches. Example:

git merge

Git Rebase

Rebasing is the process of moving or combining a sequence of commits to a new base commit. From a content perspective, rebasing is changing the base of your branch from one commit to another making it appear as if you’d created your branch from a different commit. Internally, Git accomplishes this by creating new commits and applying them to the specified base.

Example:

git rebase

Git Revert

The git revert command can be considered an 'undo' type command, however, it is not a traditional undo operation. Instead of removing the commit from the project history, it figures out how to invert the changes introduced by the commit and appends a new commit with the resulting inverse content. This prevents Git from losing history, which is important for the integrity of your revision history and for reliable collaboration.

Reverting should be used when you want to apply the inverse of a commit from your project history. The git revert command is used for undoing changes to a repository's commit history. Other 'undo' commands like, git checkout and git reset, move the HEAD and branch ref pointers to a specified commit. Git revert also takes a specified commit, however, git revert does not move ref pointers to this commit. A revert operation will take the specified commit, inverse the changes from that commit, and create a new "revert commit". The ref pointers are then updated to point at the new revert commit making it the tip of the branch.

Example:

git revert

Git Stash

The git stash command temporarily shelves (or stashes) changes you have made to your working copy so you can work on something else, and then come back and re-apply them later on. Stashing is useful if you need to quickly switch context and work on something else, but you are mid-way through a code change and are not quite ready to commit.

Example:

git stash

Git Remote

The git remote command lets you create, view, and delete connections to other repositories. It is essentially an interface for managing a list of remote entries that are stored in the repository’s ./.git file.

Example:

git remote

Git Checkout

The git checkout command lets you navigate between the branches created by the git branch command. Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch.

Example:

git checkout

Git Branch

The git branch command lets you create, list, rename and delete branches. It does not let you switch between branches or put a forked history back together again.

Example:

git branch

Conclusion

Overall, I think Git is an amazing tool that can serve many purposes to help you manage your source code and software development.

Thank you for reading :)

--

--