Git How to Add/Create Commit Push to Remote Repo

April 9, 2012 | By Duchateaux.

The Tutorial is based on my actual Experience of Git and SSH practiced by working on my Remote Hosted Server.

Commit mean to Make Git Repo Aware of Changes on the Current Project.

Pushing mean Transfer a Copy of your Changes to a Remote Repository.

Here below are Clearly resumed all the Steps involved:

Adding a Remote Repository
General form of Add Remote:
git add remote repoName repoURL

The Protocol over that the transfer is make are Git and SSH.
Here below is the Command to add the Default Git Repository over SSH.

git remote add origin ssh://yourUserName@yourDomain:portNumber/path/To/yourRepo

Example:
git remote add origin ssh://user@server.hostgator.com:2222/home/user/www/yourRepo

Adding Changes and Commit
To take a Snapshot of your Valid Work you need to Add Changes and Commit on Git.
To Add Changes:
git add nameFile1 nameFile2 nameFile3 ...

Or if you just want to Add all Working Changes:

git add .

To Commit or to Take a Snapshot of your Valid State:

git commit -m "Description of Changes"

In the Case you want an All-in-One Command to Add all your Changes and Commit perform:

git -a -m "Description of Changes"
Pushing to the Remote Repository
General Form of Push Command:
git push repoName branchName

The default Repository Name is the Origin.
The default Branch Name is the Master.
So for pushing to Origin on the Master Branch:

git push origin master

Or Simply:

git push

To Read something more about Git Branching look Here.

Git How to Unstage Already Staged Changes.

Git Unstage Changes

Git How to Push To Remote Repository.


QuickChic Theme • Powered by WordPress