Thursday, June 17, 2021

Git: A cheat sheet


Git is an easy to use open source tool for team collaboration, though developers primarily use it to manage source code. Get details about this Linus Torvalds-created version control system.

Git is the most widely-used, modern version control system in the world. This tool enables users and developers to collaborate on local machines/networks or via public servers. Developers should think of Git as their go-to collaboration tool.

Also, the git command works seamlessly with GitHub (the world’s leading git repository code for remote repository hosting), though it doesn’t require the use of a public-facing service; in fact, Git can be easily used on a single machine or via a Git server on your own private network. Either way, collaboration on code or every kind of file is made exponentially easier.

This Git cheat sheet is a quick way to get up to speed on the version control system. We’ll update this resource when there is new information about Git.

SEE: Git guide for IT pros (free PDF) (TechRepublic)

Executive summary

  • What is Git? Git is a version control system that enables individuals or teams to collaborate and work with the same code on a local or remote repository. Git isn’t just for programmers–users can check out files, modify them and check them back in. Any document can be collaborated on in this version control system. Git can be used from within a text-based terminal window or one of the many GUI Git clients. Git is also a handy way to install applications from source on Linux.
  • Why do developers like Git? There are only a few other tools that make collaboration as easy, and Git has become the de facto standard for developers around the world. With Git, collaborators can avoid the confusion that often accompanies users editing the same files. Git makes all of this seamless and easy.
  • Who should use Git? Git can be used by collaborators of all kinds, as well as anyone looking to install applications on Linux.
  • When was Git released? Git was developed by Linus Torvalds and was initially released on April 7, 2005. The current stable release of Git, 2.30.1, was released on Feb. 8, 2021.
  • How do I install and use Git? Git can be installed from the standard Linux repositories or on Windows/macOS using their respective installers.

SEE: Job description: DevOps engineer (TechRepublic Premium)

What is Git?

Git is a version control system that enables users to track changes in files and collaborate on those files with numerous people. Git was written by Linus Torvalds to help maintain the development of the Linux kernel; it was inspired by BitKeeper and Monotone. The initial release was April 7, 2005, and Git has been in steady development ever since.

Although the git command is primarily used by developers for the management of computer source code, it can be used to track changes with any file type. Git also allows Linux users to easily pull down source code from hosting websites, so it can be installed on a local machine.

Git is what is known as a distributed revision control system, and it uses snapshots as opposed to differences, which are used in standard version control systems. Instead of storing its data as a list of file-based changes, Git stores data as a set of snapshots within a miniature file system. As soon as a commit is made to a file within Git, it takes a snapshot and stores a reference to the snapshot–this makes the system more lightweight and the process of merging files and code much easier.

SEE: All of TechRepublic’s cheat sheets and smart person’s guides

Every Git directory on every computer is a complete repository with a full history and version tracking ability that is independent of network access or a centralized server; this means a single machine can be used as a complete Git repository. Git works seamlessly with GitHub to create an efficient means of global collaboration within user repositories.

From a Git repository, a user can pull down a file, commit changes to the file, push the file back to the repository and even merge two more file histories together. Git can be used from within a terminal window or from within one of the many GUI tools; some of the popular GUIs are GitKraken, SmartGit, Git Extensions, Sourcetree, Tower, Git Cola, GitUp, TortoiseGit and GitHub Desktop.

Features of Git include:

  • Cross-platform (Git is compatible with all operating systems)
  • Allows for non-linear and distributed development
  • Branching
  • Small footprint
  • Very fast
  • Open source
  • Secure
  • Staging areas
  • Multiple workflows
  • History tracking
  • Automatic backups
  • Scalable
  • Easy collaboration
  • Git archive allows compression levels higher than 9 for .tar.gz output 

Why do developers like Git?

When Larry McVoy withdrew free usage of the BitKeeper product, many of the Linux kernel developers gave up using the tool. Because of this, Linus Torvalds (the creator of the Linux kernel) decided he needed a distributed system that would meet his demand for higher performance. Out of this was born the open source Git, one of the most efficient version control systems available.

A version control system is essential for the development process. With such a system, you can return to any version of your code or file with ease, rendering it unnecessary to constantly save under different file names to ensure you can return to a previous state. With Git, a developer can easily give collaborators access to their code without worrying those developers might overwrite their work. Without Git, open source developers around the globe would have a much harder time collaborating.

Git redefined how developers work together. When you add the seamless integration with GitHub, Git becomes a must-have for collaborators.

SEE: Pro tips to master any Linux admin task (TechRepublic Premium)

Who should use Git?

Developers, from individuals to staff at small companies or enterprises, work with Git. When you look at the companies that use Git–which include Google, Facebook, Apple, Microsoft, NVIDIA, Quara, Twitter, eBay, Intel and GE Aviation–you get an idea of the system’s dominance.

Git is especially popular within the realm of open source. Without Git, the development of the Linux kernel wouldn’t progress as quickly or efficiently.

All of this, in turn, affects consumers, as they are the recipient of vastly improved development cycles.

SEE: 10 ways to prevent developer burnout (free PDF) (TechRepublic)

When was Git released?

Linus Torvalds began developing the Git project on or around April 3, 2005 and made the first announcement of the project on April 6, 2005. Git became self-hosting as of April 7, 2005. Ever since its initial release, Git has seen steady development. The current version is 2.30.1, but versions all the way back to 2.22 (released June 6, 2019) are still supported.

What are the main competitors to Git?

Git does have competitors, though not many of them are nearly as popular.

How can I install and use Git?

Git can be installed on any Linux distribution from the standard repositories. For example, with Ubuntu, the installation of Git can be handled via a single command:

sudo apt install git

On the macOS and Windows platforms, you must download and install using the dedicated installation files (macOS, Windows).

Once installed, create your first repository and start adding files. A local Git repository can be connected to a GitHub repository for public collaboration.

Also see

git-logo.jpg

Image: Git



Source link

MORE Articles

Report: Ring provided at least 100 LAPD officers with free devices or discount codes and encouraged them to recommend its products to fellow LAPD...

Johana Bhuiyan / Los Angeles Times: Report: Ring provided at least 100 LAPD officers with free devices or discount codes and encouraged them...

హైకోర్టుకు చేరిన గెలుపు పంచాయతీ: సువేంద్ విక్టరీపై కోర్టులో మమతా సవాల్

పశ్చిమ బెంగాల్‌ అసెంబ్లీ ఎన్నికల్లో ముఖ్యమంత్రి మమతా బెనర్జీపై బీజేపీ నేత సువేందు అధికారి గెలుపొందిన సంగతి తెలిసిందే. ఊగిసిలాట మధ్య స్వల్ప మెజారిటీతో గెలుపొందారు. అయితే న్నికల ఫలితాలను సవాల్‌ చేస్తూ...

శభాష్ హర్లీ.. నదిలో కొట్టుకుపోతున్న జింక పిల్లను కాపాడి.. నెటిజన్ల ప్రశంసలు

కనిపించని హర్లీ.. అమెరికాలో హర్లీ అనే శునకాన్ని పెంచుకుంటున్నారు. అయితే అదీ ఈ నెల మొదటి వారం నుంచి కనిపించడం లేదు. దీంతో యజమాని కంగారు పడ్డారు....

इस समस्या से जूझ रहे पुरुष करें कद्दू के बीज का सेवन, मिलेंगे गजब के फायदे!

नई दिल्ली: अगर आप शुगर पेशेंट हैं या फिर शारीरिक कमजोरी से जूझ रहे हैं तो ये खबर आपके काम की है. इस...

43 కిలోల బంగారం స్వాధీనం.. రూ.21 కోట్లు విలువ.. ఇక్కడే

మణిపూర్‌లో భారీగా బంగారం పట్టుబడింది. ఇంఫాల్‌లో డైరెక్టరేట్‌ ఆఫ్‌ రెవెన్యూ ఇంటెలిజెన్స్‌ అధికారులు చేసిన తనిఖీల్లో ఏకంగా రూ.21 కోట్లు విలువ చేసే గోల్డ్ స్వాధీనం చేసుకున్నారు. అదీ మొత్తం 43 కిలోలు...

శంషాబాద్ ఎయిర్‌పోర్టులో గ్యాస్ లీకేజీ: తీవ్ర అస్వస్థతో ఒకరు మృతి, ఆస్పత్రిలో మరో ఇద్దరు

హైదరాబాద్: శంషాబాద్ విమానాశ్రయం(రాజీవ్ గాంధీ అంతర్జాతీయ విమానాశ్రయం)లో గ్యాస్ పైప్ లీకైంది. దీంతో అక్కడే ఉన్న ముగ్గురు వ్యక్తులు తీవ్ర అస్వస్థతకు గురయ్యారు. వెంటనే వారిని ఆస్పత్రికి తరలించారు. నర్సింహా రెడ్డి అనే...

Woman: బాలుడి ప్రాణం పోయింది, మంత్రగత్తె అని ముస్లీం మహిళను చితకబాదేసి, ఇంట్లో నుంచి లాగి !

మంత్రాలు వేస్తున్న మంత్రగత్తె ? రాజస్థాన్ లోని బుండి జిల్లాలోని భజన్రి అనే గ్రామంలో ఓ ముస్లీం మహిళ నివాసం ఉంటున్నది. ముస్లీం మహిళ మంత్రాలు వేస్తోందని...

Stay Connected

98,675FansLike
224,586FollowersFollow
56,656SubscribersSubscribe