This fixes a bug found in the other scripts which fail when a branch has the same name as a file or directory in the current directory. Show Sample Output
Written for Mac OSX. When you are working in a project and want to open it on Github.com, just type "gh" and your default browser will open with the repo you are in. Works for submodules, and repo's that you don't own. You'll need to copy / paste this command into a gh.sh file, then create an alias in your bash or zsh profile to the gh.sh script. Detailed instructions here if you still need help: http://gist.github.com/1917716
Find all the occurrences in the git repo of 'foo' and replace with 'bar'
Branch name may be substituted, of course.
Checks for syntax errors in PHP files modified in current working copy of a Git repository. Show Sample Output
Copy changed files from remote git repository, _including binary ones_, staged and unstaged alike. Note that this command doesn't handle deleted files properly.
How about this one ?
Normally, searching git log comments is case sensitive. The -i luckily applies to the --grep switch.
Rather than complicated and fragile paths relative to a script like "../../other", this command will retrieve the full path of the file's repository head. Safe with spaces in directory names. Works within a symlinked directory. Broken down:
cd "$(dirname "${BASH_SOURCE[0]}")"
temporarily changes directories within this expansion. Double quoted "$(dirname" and ")" with unquoted ${BASH_SOURCE[0]} allows spaces in the path.
git rev-parse --show-toplevel
gets the full path of the repository head of the current working directory, which was temporarily changed by the "cd".
Works for repos cloned via ssh or https. Show Sample Output
gitstart ~/path/to/dir
Initialized empty Git repository in /home/user/path/to/dir/.git/
Can anyone make a shorter one?
This doesn't work:
git log --reverse -1 --format=%H
Show Sample Output
Parse the output of git status. Once the line '# Changed but not updated:' has passed print every last part of the line if it exists on disk.
usage: where COMMIT for instance: where 1178c5950d321a8c5cd8294cd67535157e296554 where HEAD~5 Show Sample Output
attempts to delete all local branches. git will fail on any branches not fully merged into local master, so don't worry about losing work. git will return the names of any successfully deleted branches. Find those in the output with grep, then push null repositories to the corresponding names to your target remote. assumes: - your local and remote branches are identically named, and there's nothing extra in the remote branch that you still want - EDIT: you want to keep your local master branch
If you don't have html2text 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: