It deletes all removed files, updates what was modified, and adds new files.
This command handles git rm'ing files that you've deleted. Show Sample Output
This should work even if the output format changes.
Do a git commit using a random message. Show Sample Output
Print out list of all branches with last commit date to the branch, including relative time since commit and color coding. Show Sample Output
It's pretty common to forgot to commit a files, be it a modification, or a brand new file. If you did forget something, git add the files you want, and then git commit --amend. It will essentially redo the last commit, with the changes you just added. It seeds the commit message with the last commit message by default. You probably shouldn't do this if you've already pushed the commit. Show Sample Output
I've used technicalpickles command a lot, but this one handles whitespaces in filenames. I'm sure you want to create an alias for it :) Show Sample Output
-u tells git to automatically stage all changes to files in the index (eg. deleted and modified files). See: http://stackoverflow.com/questions/1402776/how-do-i-commit-all-deleted-files-in-git http://kernel.org/pub/software/scm/git/docs/git-add.html
This lists all the files in a folder, then finds the commit date for them one by one, then sorts them from newest to oldest
I sometimes (due to mismanagement!) end up with files in a git repo which have had their modes changed, but not their content. This one-liner lets me revert the mode changes, while leaving changed-content files be, so I can commit just the actual changes made.
For editing files added to the index:
vim `git diff --name-only --cached`
To edit all changed files:
vim `git diff --name-only HEAD`
To edit changed files matching glob:
vim `git diff --name-only -- '*.html'`
If the commands needs to support filenames with whitespace, it gets a bit hacky (see http://superuser.com/questions/336016/invoking-vi-through-find-xargs-breaks-my-terminal-why for the reason):
git diff --name-only -z | xargs -0 bash -c '</dev/tty vim "$@"' x
The last part can be put in a script named e.g. vimargs, and used with any command outputting NUL separated filenames:
git grep -lz foobar | vimargs
Figures out total line contribution per author for an entire GIT repo. Includes binary files, which kind of mess up the true count. If crashes or takes too long, mess with the ls-file option at the start: git ls-files -x "*pdf" -x "*psd" -x "*tif" to remove really random binary files git ls-files "*.py" "*.html" "*.css" to only include specific file types Based off my original SVN version: http://www.commandlinefu.com/commands/view/2787/prints-total-line-count-contribution-per-user-for-an-svn-repository Show Sample Output
List everyone who committed to a particular project, listed alphabetically. To list by commits, add -n to the shortlog. Show Sample Output
Better tool for exporting git's repository is Git itself!
Gets the authors, sorts by number of commits (as a vague way of estimating how much of the project is their work, i.e. the higher in the list, the more they've done) and then outputs the results. Show Sample Output
Make sure to run this command in your git toplevel directory. Modify `-j4` as you like. You can also run any arbitrary command beside `git pull` in parallel on all of your git submodules. Show Sample Output
The option --porcelain makes the output of git easier to parse. This one-liner may not work if there is a space in the modified file name.
from http://git-scm.com/book/en/Git-Tools-Stashing Useful for when stash cannot be applied to current branch Show Sample Output
This checks if the branch has been merged with master and then will delete the ones that have been. Keeps your local git repo nice and clean from all the branches. Show Sample Output
Only show a short of important information inline ( include branch info ), and color this log tree. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: