0% found this document useful (0 votes)
9 views

Git

Uploaded by

Pralay Ninave
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Git

Uploaded by

Pralay Ninave
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

What is git ?

Git is a free and open-source distributed version control system designed to manage
software code repositories. It was created by Linus Torvalds in 2005 and has since
become one of the most widely used version control systems.

GitHub, on the other hand, is a web-based platform for hosting and collaborating on
Git repositories. It was launched in 2008 and has quickly become one of the most
popular places for developers to share and collaborate on code.

GitHub allows users to store and manage their Git repositories in the cloud, making
it easy for teams to collaborate on code without needing to be physically located
in the same place. It also provides a range of tools and features for managing and
tracking changes to code, such as pull requests, issues, and code reviews.
IN-SHORT
Git is a version control system for managing code repositories, while GitHub is a
web-based platform that makes it easier for teams to collaborate on Git
repositories.

1)Install Git: The first step is to install Git on your computer. You can download
the latest version of Git from the official website at
https://git-scm.com/downloads.

2)Configure Git: Once Git is installed, you'll need to configure it with your name
and email address. Open a terminal or command prompt and run the following
commands, replacing "Your Name" and "[email protected]" with your own name and
email address:

l
Copy code:-
#git config --global user.name "Your Name"
#git config --global user.email [email protected]
Create a new repository: To create a new Git repository, navigate to the directory
where you want to store your code and run the following command:

#git init
This will initialize a new Git repository in the current directory.

4)Add files to the repository: Next, add the files you want to track to the
repository using the following command:
csharp
Copy code
#git add .
This will add all the files in the current directory to the repository. You can
also add specific files by replacing the "." with the file name.

5)Commit changes: Once you've added your files, you need to commit the changes to
the repository using the following command:

#git commit -m "Initial commit"


This will create a new commit with a message describing the changes you've made.

6)Create a remote repository: To share your code with others, you'll need to create
a remote repository on a platform like GitHub. Once you've created the repository,
copy the repository URL.
7)Connect the local and remote repositories: Finally, connect your local repository
to the remote repository using the following command:

c
Copy code
#git remote add origin <remote repository URL>
This will add a new remote named "origin" and set its URL to the remote repository
you created.

8)Push changes to the remote repository: To push your local changes to the remote
repository, run the following command:
#git push -u origin master
This will push your changes to the "master" branch of the remote repository.

That's it! You've now created a Git repository, added files, committed changes, and
shared your code with others.

You might also like