WHAT'S NEW?
Loading...

Initially in GIT

I. Configuration

git config --global user.name "your_username"
git config --global user.email "your_email"
this sets the author's identity inside git.

Initializing and Starting Tracking Projects
to initialize a directory as the directory to be tracked for changes, navigate to the directory that is to be tracked and run the command
git init

what this does is create a folder named .git into your the current directory which git uses to track the changes made.

now you can start making changes to the current directory. you can add files, delete them or edit some files. All these activities are tracked and git is informed about the changes made.

suppose you add a file named test.html
to observe the changes made, you can run this command
git status

to add the changed file to the staging index (before you make commit, you should stage the files), simply run the command
git add test.html

to commit the changes, run this command
git commit test.html -m "Your commit message is here"
e.g. git commit test.html -m "Initial commit"

Viewing logs of commits
git log   #displays all commit logs
git log -n 5  #displays 5 latest commit logs
git log --since=2015-04-05  #displays commits since the date specified
git log --until=2015-05-07  #displays commits until the date specified
git log --since=2015-04-05 --until=2015-05-07  #combination of since and until
git log --author="Bikash"  #displays commit logs by the specified author
git log --grep="Init"  #regular expression based searching of logs; search is made on commit messages

suppose we have a commit message "New file created"
we can search for log of this commit  as:
git log --grep="New*"
more information about regular expressions will be in a session in this blog.

1 comment: Leave Your Comments