git command line commit

Git has a “staging area” where files need to be added before being committed, you can read an explanation of it here.

So if you make some change and commit directly, you get some message like:

no changes added to commit (use “git add” and/or “git commit -a”)



Before you add, you could have done a:

git add -u -n

To check which files you modified and are going to be added (dry run: -n option), and then

git add -u

once you added, another way to preview is:

git diff --cached

add modified files

To commit all the change, you can do any of the following:

git add filename1 filename2

or add all changes (from root path of the project)

git add .

or use the shorthand -a while commiting:

git commit -a -m "message".


git commit . -m "save arezzo files"

One other note for SSH

First follow this official link

To use SSH for github to avoid entering username/password, make sure you’re using the SSH one:


And NOT the https or git one:

You can now validate with just the SSH Key instead of the username and password.

If you need to replace https origin with git one:

git remote set-url

git reset SHA

first see the history by:

 git log

. Then use the first 7 chars of the SHA code to do reset.

git SHA b7cg6h3


git branch

use git branch to see what branch current is in, the * means current.

To create a new branch, just use

git branch BRANCH_NAME

Then switch to the branch with

git checkout BRANCH_NAME

To merge, switch back to master and

git merge BRANCH_NAME

To resolve conflict , just modify the master to the desired status and commit.

To delete a branch

git branch -d BRANCH_NAME

Git Rebase

The major benefit of rebasing is that you get a much cleaner project history

more about rebase vs merge .




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s