Category: git

git | March 13, 2018

Add Git Branch Name to Shell Prompt

PS1=’\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;32m\]\n$(git branch 2>/dev/null | grep “^*” | colrm 1 2)\[\033[0;32m\]??\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] ‘ Credit: https://gist.github.com/justintv/168835  

git | July 19, 2017

Git Stash Commands

Most common commands that I use. Self-explanatory. Save and List Stash git stash save “Some message” git stash list # stash is available to all branches. git stash show stash@{0} […]

git | July 17, 2017

.gitignore file

Ignoring files in git using .gitignore ====================================== create a .gitignore file and put it in the root of a git project. Typically ignore: -Compiled source code -Packages and compressed files […]

git | July 17, 2017

Delete un-tracked files from git

Removing un-tracked files We can use git clean -f to clean up un-tracked files in the working directory. Do a test run to see what files are to be deleted […]

git | July 17, 2017

Changes to Git – Amend

1. Undo changes in the working directory git checkout — unmodifiedFileName # — implies that we are not checking out a branch. Stay on the current branch and check out […]

git | July 16, 2017

Most Common Git Commands

git branch -b new_feature git branch –no-merged # show the branches that are not merged yet. git merge –no-ff new-feature -m “merge new-feature branch” git branch -D new-feature # delete […]

git | July 14, 2017

Viewing Git Logs

Some common git log comments that I use heavily. # view git logs git log #limit number of logs to show git log -n 1 # last commit git log […]

git | July 14, 2017

Sample initial git set up commands

This is a sample initial git set up commands I use for my projects. git config –system git config –global git config # this is for project basis configuration.   […]