GIT COMMANDS
Mahnoor Rana
Software Engineer @ Devflovv | Machine Learning Engineer | AIOps | GDSC Lead
OVERVIEW OF GIT
An overview of Git and GitHub, which are popular environments among developers and data scientists for performing version control of source code files and projects and collaborating with others.
You can’t talk about Git and GitHub without a basic understanding of what version control is.
A version control system allows you to keep track of changes to your documents.
This makes it easy for you to recover older versions of your document if you make a mistake and it makes collaboration with others much easier.
Git is free and open source software distributed under the GNU General Public License.
Git is a distributed version control system, which means that users anywhere in the world can have a copy of your project on their own computer; when they’ve made changes.
You can use Git without a web interface by using your command line interface, but
GitHub is one of the most popular web-hosted services for Git repositories. Others include GitLab, BitBucket, and Beanstalk.
BASIC COMMANDS:
There are few?basics commands?of git.
Git init command :
When starting with a new repo we have create it once by cloning repo by using this command.
Git clone command:
Git clone is a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository.
Git add . command:
It moves from working directory to the staging area (That's something in-between your local folder and your local repository.)
Git status command :
This command allows you to see the state of your working directory.
Git commit command :
A commit is a snapshot of your repo at a specific point in time.
Git reset command :
Undoes changes that you have made to files.
Git log command :
It shows the list of all the commits mad to repo. This command also used to displaying the history of repo.
Or you can simply use git log.
Git remote –v command :
Shows URLs of remote repositories when listing your current remote connections. By default, listing remote repositories only shows you their shortnames (e.g. "origin"). Using the "-v" option, you will also see the remote's URLs in listings.
Git branch command :
Git “branch” commads lets make you to create , list and remane and delete branches. Git branch is tightly intregrated with checkout and merge commands.
Git push command:
The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo.
Git pull command :
The git pull command is actually a combination of two other command i.e. git fetch and git merge . Firstly git pull will execute a git fetch scoped to the local branch then git pull will enter a merge workflow.
And finally your files is on your github profile.
Now following commands are used while hosting website.
1- git init
2- git clone (“repo link”)
3- git status
4- git commit -m "initial commit"
5- git add . (“write file names of your folder”)
6- git status
7- git remote -v
8- git remote add origin (“repo link”)
9- git branch -M main
10-git push -u origin main
11-git pull
BOOM!!!
Your website has been hosted.
Software Engineer @ TenX | Python | Building robust AI solutions for clients
2 年good job keep sharing your knowledge with community :)
Trainee Software Engineer @ OSOL | UE Grad 24' | Leetcode 200+ | MERN Stack | JavaScript | React JS | Express JS | Node JS
2 年Tysm It's simple and very easy to understand ?????