Git and GitHub

Git is a popular version control software. (Version-control: Software tools that enable the management of changes to our source code.)


GitHub is a provider of Internet hosting for software development and version control using Git.


How to set up Git on your computer?


1)Visit https://git-scm.com/ and download the latest release.

2) then open a command prompt and type command,

git -- version

to check the version of installed git.

3)Installing some of the GUI tools like GitHub Desktop will also install Git on your computer.

4) Git configuration:

git config --global user.name "your user name"

git config --global user.email youremail


So we are done with setting up Git on our computer


Online Git repository:

There are several online git repositories providers:

1)GitHub

2)Bitbucket

Here we will see how to use GitHub

1) Visit https://github.com/ Sign up and create an account.

2) Then click on repositories --> new repositories --> Give a name to your repository --> Click on Create repository


Basic git commands:

1) git remote add origin repository_url

Add the remote online repository or synchronize the local repository with an online repository.

2)git init

initializes the current folder as a Git repository.

3)git status

States the current status of the folder

4)git add . 

It will add all the files in the created folder to the staging area.


git add filename

It will add all the files in a created folder to the staging area.

5)git commit -m "your message"

Commit the changes to the git repository

6)git push -u origin master

push the local repository to the master to the online repository.

7)git clone repository_url

Clone an online repository to your computer 

8) Hide files 

create a .gitignore file in working directory and inside that file add the names of all the files which you want to hide/ don't want to push to GitHub




Comments

Popular Posts