Git Basics | Hacker Noon

To paying with git you have to do the following things step by step:

An Introduction to Git and Github for beginners

What is Git? medium.com

Configure Git:

1.

Set email: git config --global user.email "[email protected]"

2.

Set username: git config --global user.name "Your Name"

Create a new Repository

To use the git tool for uploading your project in the GitHub repository, you must configure the git tool with your

email 

and

username

. It confirms that the git is installed on your PC. Today I am going to show step by step how can you configure your git tool easily. So, let’s get started.

Step-1: Click new or plus icon

Step-2: Click new Repository Button

Step-3: Type your repository name if its already exits then show the following error like.

Step-4: Provide a unique name

Step-5: You can manage your repository to make, public, or private. In my case, I made my repo public. Then Obviously unmark the checkbox.

Step-6: Copy the following codes

Then go to the project folder and open the git tool by right-clicking the empty window and select Git Bash Here link.

Note that obviously you have installed git tool in your PC.

Initialize the git repository

Add all folders and files to the git repository

Commit the folders and files with a message

git commit -m”my first commit”

Finally, go to the newly created git repository in GitHub and copy the following two lines from your repository.

Run those copied two commands

Done you have succeeded the first time uploading your project to GitHub.

After uploaded the project in the github it looks like

Most useful git commandClone a Git Repository

git clone <clone_url>

Example: git clone https://github.com/jewelcse/login-registeration-in-php.git

Create a Branch

git checkout -b <new_branch_name>

It creates a new branch in your git repository by using your given name.

After creating a new branch it automatically switches your current branch to the new branch.

Switches between Branches

git checkout <existing_branch_name>

This command switches the user to the current branch to another branch.

Track your working status

git status

Add edited or newly created file

Commit files

git commit -m"commit_messages"

Push local files to GitHub

It works when you are in your master branch.

But when you work as in another branch then the command will be

git push origin <your_branch_name>

Happy Learning!!!

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!

read original article here