Git Quick Reference

Git is the most useful tool for developers but if someone does not use it for a while, it all seems confusing. Git is tricky. Here are some of the most commonly used command.

  • Copy remote repository to your local folder.
git clone ssh://abc...xyz.git/  
  • Create new git repositiory
git init
  • To get list of files changed in directory
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: MySQL/MySQL_Select.py

Untracked files:
(use "git add <file>..." to include in what will be committed)

MS Excels/xlsx_read_into_pandas.py
MySQL/MySQL_update.py
image/

no changes added to commit (use "git add" and/or "git commit -a")
  • View remote repository name
$ git remote -v
origin https://github.com/conquistadorjd/python-01-utilities.git (fetch)
origin https://github.com/conquistadorjd/python-01-utilities.git (push)
  • Once you have made your changes and ready for deployment, you following set of commands for deployment.
git add .  
git commit -m "commit comment"  
git push origin master  

For heroku application use following

git push heroku master  
  • What is the difference between git push origin and git push origin master

Following command only pushes your master branch to origin

git push origin master

Following command pushes all your branches to origin

git push origin
  • Get commit history
$git log

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.