Push Your First Code On GitHub

Push Your First Code On GitHub

We all know how important is that your code should be visible on Github. So here we are discussing some basic git commands to get started.

git init

Usage: git init [repository name]

This command is used to start a new repository.

git add

Usage: git add [file]

This command adds a file to the staging area.

Usage: git add .

This command adds one or more to the staging area.

git commit

Usage: git commit -m “[ Type in the commit message]”

This command records or snapshots the file permanently in the version history.

Usage: git commit -a

This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.

git status

Usage: git status

This command lists all the files that have to be committed.

git commit

Usage: `git push origin master

This command sends the committed changes of the master branch to your remote repository.

Reference

dzone.com