Git : Some usefull commands

1. To view all update history of a file

git log --follow -p -- file_name.py 


2.Different between working file and last commit file

git diff file_name.py


3. Discard all current working update

git checkout . 


4. Discard the all the update on file_name.py

git checkout file_name.py


5. Create a new branch from current branch and checkout to that branch.

git checkout -b new_branch_name


6. Push the new local branch to remote branch

git push origin new_branch_name_to_update_remote


7. Remove all untracked files

git clean -f 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s