Commit History in DevOps

After you have created several commits, or if you have cloned a repository with an existing commit history, you’ll probably want to look back to see what has happened. The most basic and powerful tool to do this is the git log command.

Git Log & Other Options


--stat -> Show statistics for files modified in each commit.
--shortstat -> Display only the changed/insertions/deletions line from the --stat command. 


Git Diff

git-diff - Show changes between commits, commit and working tree, etc
The main objective of version controlling is to enable you to work with different versions of files. Git provides a command diff to let you to compare different versions of your files.
The most common scenario to use diff is to see what changes you made after your last commit. Let’s see how to do it. 
Note: Here, In git diff you can use commitId or HEAD
HEAD refers two thing in git:
1. Top/Recent Level commit.
2. Current Working Branch. 

GitHub Quick Setup

1.Sign up for the github account.
2. Create public repository.


Git Clone

1.Clone Empty GitHub Repository: 
The git clone command copies an existing Git repository. This is sort of like svn checkout, except the “working copy” is a full-fledged Git repository—it has its own history, manages its own files, and is a completely isolated environment from the original repository.
As a convenience, cloning automatically creates a remote connection called origin pointing back to the original repository. This makes it very easy to interact with a central repository. 
Clone git repository on your local system
# git clone Git-Repo-URL  
Note: Now we have just clone an empty repository,we can add the content push it to remote repository.
Example :

Push Existing Local Repository to Remote Repo

In git quick start guide we have seen to create git repository on github and then clone/pull that repo to local computer but git clone command. We will see now how to create repo locally and then later how to push it to github.
Create a public Repository and grap the remote url, add it to your local repo as bellow: 



Comments