Header Ads

GIT COMMANDS - CHEAT SHEET

What is GIT? 

Git is a free and open-source distributed version control system for software development. It was initially created by Linus Torvalds in 2005 to manage the development of the Linux kernel, but it has since become one of the most popular version control systems in the world and is used for managing the source code of all kinds of software projects. 

Git is designed to allow multiple developers to work on a project simultaneously and independently, while keeping track of all changes made to the code. It provides a mechanism for developers to save their work, track changes to their code over time, and collaborate with others on the same project.

Some key features of Git include its ability to create and manage multiple branches of code, its distributed architecture, and its support for non-linear development workflows. Git is also designed to be fast, efficient, and flexible, making it well-suited for a wide range of software development projects.

Git is widely used by software development teams around the world, including many large organizations such as Google, Facebook, and Microsoft. There are many different tools and services available that integrate with Git, including hosting services like GitHub, GitLab, and Bitbucket, and development environments like Visual Studio Code and Eclipse.
Git Command
GIT BASICS
git initwill create a new local GIT repository.
git cloneis used to copy a repository.
git addadd a file as it looks now to your next commit(stage).
git commitwill create a snapshot of the changes and save it to GIT directory.
git pushpush local changes to the original.
GIT BRANCHING AND MERGING
git branchwill list your branches.
git checkoutswitch to another branch and check it out into your working directory.
git mergewill merge the specified branch's history into the current branch.
git logshow all commits in the branch's history.
MAKE A CHANGE
git statuslist new or modified files not yet committed.
git diffstages the file, ready for commit.
git add(file)will merge the specified branch's history into the current branch.
git reset(file)unstages file,keeping the file changes.
git commit -m ["descriptive message"]commit all stages files to versioned history.
SYNCHRONIZE
git remote add [name][url]create a new connection to a remote repo.
git fetchget all the changes from the origin(no merge).
git pullget all the latest from the origin and merge.
git Pushis used to upload your local repository changes to the origin remote repo.

No comments:

Powered by Blogger.