Skip to content

Instantly share code, notes, and snippets.

@jsolis
Last active December 21, 2015 22:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jsolis/6378336 to your computer and use it in GitHub Desktop.
Save jsolis/6378336 to your computer and use it in GitHub Desktop.
A collection of some useful advanced git commands
# Add a little color to your git cli
git config --global color.ui auto
# Git will automatically manage line endings for you if you set autocrlf option
# on a mac / linux machine you'll want do this
git config --global core.autocrlf input
# one a windows machine you'll want to do this
git config --global core.autocrlf true
# Instead of just showing highlighting the entire line that changed
# this will highlight what in the line has changed. This is one of my favorite options
git diff --color-words
# Adds a graphical representation of the branching and merging history of a repo
git log --graph --oneline --decorate --all
# This turns off fast forwarding when merging.
# This means the merge itself will show up as a commit
git merge --no-ff cart
# This is an example of how to use alias to save some typing
# Now you would be able to type "git lol"
# instead of "git log --oneline --graph --all --decorate"
git config --global alias.lol "log --oneline --graph --all --decorate"
# Date based filter on your git log? Yes please.
git lol --since=30.minutes.ago
git lol --since=yesterday
## git svn for those who still need to use svn for their deployment process
# git clone that svn project
# -s is for --stdlayout which presumes the svn recommended layout for tags, trunk, and branches.
# -r can also be used like -r 40000:HEAD to take specific revisions.
# If you want to include all of the history, just leave that option off, but it will take a very long time, and you really don't need all of it.
# The older a revision you choose, the longer it will take to import. But you will not be able to "git blame" past the earliest revision you import. Choose wisely.
git svn clone -s svn://jsolis@svn/mkt/smartphone
# After working with git locally and you want to populate svn with your changes you'll need to dcommit
git svn dcommit
# More info on git svn
# RTFM
# https://www.kernel.org/pub/software/scm/git/docs/git-svn.html
# A nice write up
# http://viget.com/extend/effectively-using-git-with-subversion
# Great resources for continuing eduction
# Free on-line web classes
http://training.github.com/web/free-classes/
# Don't have time to sit through classes or have a specific question or issue?
# checkout their repo and open an issue
https://github.com/githubtraining/feedback
# Have questions? Try posting to stackoverflow using these hash tags: #git #github
Shared from Google Keep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment