Basic Git Commands

Basic Git Commands

August 14, 2020

Hey folks, how’s it going? I’m here to help those who started using Git and still struggle with the commands. In this tutorial I’ll demonstrate some commands that will make your learning journey much easier.

UNDERSTANDING THE GIT WORKFLOW

Git is the most widely used open-source VCS (Version Control System) in the world, and it lets you track changes in your files. Companies and developers around the world use Git to collaborate on building systems and applications.

Git consists of three sections: the working directory, the staging area, and the git directory.

The Working Directory is where you add, remove, and edit your files. Then the changes get indexed in the Staging Area. After you commit your changes, the snapshot of those changes will be saved in the Git Directory.

BASIC COMMANDS

Here are some basic Git commands. If you want to dive deeper into the commands, just click the link at the end of this article:

git init creates a local repository.

git clone is used to clone a remote or local repository. Examples: Remote: git clone username@host:/path/to/repository Local: git clone /path/to/repository

git add is used to add files to the staging area. Example: git add <file.txt>

git commit will create a snapshot of the changes that will be saved in the git directory. Example: git commit -m "message that will be added to the commit"

git config is used to configure information about a given user, such as email, username, etc. Practical example: git config --global user.email [email protected]

Sources:

https://education.github.com/git-cheat-sheet-education.pdf

https://www.hostinger.com/tutorials/basic-git-commands

💬 Comentários