Git is a free and open source distributed version control system.
Purpose of git is to keep track of projects and files as they hang over time with manipulations happenings from different users.
Why Git?
Git helps you keep track of the changes a couple of people make on a single project and then merges the code where people have worked on different parts in a single projects.
Git will be useful for you, Whether you write code that only you will see or work as a part of a team.
Benefits of Git:
1. Free
2. Open Source
3. Super Fast
4. Scalable
5. Makes collaboration easier
6. Allowing changing by other
Basic Git Commands:
1. git init:
Git init will create a new local GIT repository.Command: git init
Alternatively, you can create a repository within a new directory by specifying the project name
Example: git init projectName
2. git clone:
if you want a local copy of a repository from GitHub, this command allows creating a local copy of that repository on your directory from the repository URL.
Command: git clone repository-url
3. git add:
git add is used to add files to the staging area and for removing file from staging area you can use the same command.
Command: git add FileName
To add all the files of local repo
Command: git add*
To add only specific files and folder
Command: git add foleder/file
4. git commit
git commit will create a snapshot of changes and save it to the git directory
Command: git commit -m "Message"
The message in commit command is nothing but a text that tells about what is changes in files.
5. git push:
git push is used to send local commits to the master branch of the remote repository. Here the basic code structure
Command: git push origin <master>
6. git status:
git status displays the list of changed file together with the files that sre yet to be staged or committed
Command: git status
7. git remote
git remote lets you view all the remote repositories also used to connect your local repository to the remote server.
list all connections along with their URLs
Command: git remote -v
To connect the local repository to a remote server.
Command: git remote add orgin RepoURL
Command: git remote rm <repository name>
Complete Git commands: https://git-scm.com/docs
Official websites Link: https://github.com/
Comments
Post a Comment