Quick Git Command you can use in your project

By | January 8, 2018

Here are some git commands that you will normally use in a git version controlled project repository.

Commit

For Commiting all modified files use

git commit -am”Message”

Status

For checking the status of the git repository use

git status

Log

For getting the information about the Git checkins use…

git log

To Print in a convenient one line use

git log —oneline

Get the short log

git shortlog

Add Updated Files

To Add all the modified files to the git repository…

git add -u

Add all newly created files

git add -A

Checkout

git checkout file_name

Clean the local repository

git clean -n

Ignore Files

First you have to add the .gitignore file.

vim .gitignore

Then write the files and folders you want to ignore…

For example, if you want to ignore files in logs directory
You can write the file contents like this…


/log
/logs/*.txt
.logs/log.txt

Don’t forget to commit the .gitignore file as well.

Clone

Clone the whole repository to your local repository

git clone clone_url

To find the git url you have cloned

git remote -v

Tag a Repository

This will tag the repository with name “Version1.0”

git tag Version1.0

Update a Repository

git pull

Leave a Reply

Your email address will not be published. Required fields are marked *