Know how to use Git and GitHub--
3 min read
GIT:- Global Information Tracker
Git is a free and open-source distributed version control system designed to handle everything from small to massive projects quickly and efficiently.
Git is easy to learn and has a tiny footprint with lightning-fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows. Git is fast, scalable, and distributed revision control system with a vibrant command set that provides both high-level operations and full access to internals.
Git commands are a distributed version control system for tracking changes in any set of files. They were originally designed to coordinate work among programmers operating source codes during software development.
git –help: This command helps you to give a list of available git commands on ( Windows), terminal (for Mac), or shell (on Linux).
git clone: This command is used for downloading the latest version of a remote project and copying it to the selected location on the local machine.
-----git clone <repository URL>
git init: This is the command you need to use if you want to start a new empty repository or to reinitialize an existing one in the project root. It will create a .git directory with its subdirectories.
------git init <repository name>
------git remote add origin <repository url>
git add: This is the command you need to use to stage changed files.
-----git add <file path>
git commit: After changes are done locally, you can save them by “committing” them. A commit is like local a snapshot of the current state of the branch, to which you can always come back.
-----git commit -m <commit message>
git push: Git push will push the locally committed changes to the remote branch. If the branch is already remotely tracked.
----- git push origin <branch name>
Importance of git:
Collaboration with Feature branching
Track your changes and revert if necessary
Open source contribution
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. This tutorial teaches you GitHub essentials like repositories, branches, commits, and pull requests.
GitHub’s interface is user-friendly enough so even novice coders can take advantage of Git. Without GitHub, using Git generally requires a bit more technical savvy and the use of the command line.
The GitHub platform is where developers can create, share, and ship the best code possible. Our community is made up of students, hobbyists, consultants, enterprise professionals, partners and executives, building software in the way that works best for them.
How to use Github:
Step 0: Install git and create a GitHub account.
Step 1: Create a local git repository.
Step 2: Add a new file to the repository.
Step 3: Add a file to the staging environment.
Step 4: Create a commit.
Step 5: Create a new branch.
Step 6: Create a new repository on GitHub.
Step 7: Push a branch to GitHub.
These are the steps involved to push the contents into the GitHub account.
Difference between git and GitHub:
Git is a tool that's used to manage multiple versions of source code edits that are then transferred to files in a Git repository, GitHub serves as a location for uploading copies of a Git repository. In a sense, then, there's no comparison when it comes to Git vs. GitHub as far as their function.
GitHub hosts Git repositories and provides developers with tools to ship better code through command line features, issues (threaded discussions), pull requests, code reviews, or the use of a collection of free and for-purchase apps in the GitHub Marketplace.
This is all about git and GitHub which are used to manage the multiple versions of source code.
Did you find this article valuable?
Support Techlearnindia by becoming a sponsor. Any amount is appreciated!