Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Simplified git add -p alias #43

Merged
merged 1 commit into from

3 participants

@ghthor

No description provided.

@travisbot

This pull request passes (merged 850be06 into 989b223).

@ndbroadbent
Owner

Awesome, this makes a lot of sense! I think someone else must have committed that a while ago :)

@ndbroadbent ndbroadbent merged commit 79a1132 into ndbroadbent:master
@ghthor

I had it as a part of #39 because it fixed git add -p command with spaces in paths. I figured out that it didn't need the filtering like git add when I was tinkering around trying to fix the spaces issue. =)

@ndbroadbent
Owner

Hey, SCM Breeze doesn't have a mailing list, so I'm sending a quick message this way. I'd like to ask for some help to test out a new feature, which adds more integration with your shell environment. If you are interested, please take a look at: #44

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 12, 2012
  1. @ghthor
This page is out of date. Refresh to see the latest.
View
2  git.scmbrc.example
@@ -29,7 +29,7 @@ git_alias="g"
# 1. 'SCM Breeze' functions
git_status_shortcuts_alias="gs"
git_add_shortcuts_alias="ga"
-git_add_patch_shortcuts_alias="gap"
+git_add_patch_alias="gap"
git_show_files_alias="gsf"
exec_git_expand_args_alias="ge"
# 2. Commands that handle paths (with shortcut args expanded)
View
2  lib/git/aliases_and_bindings.sh
@@ -51,7 +51,6 @@ __git_alias () {
# SCM Breeze functions
_alias $git_status_shortcuts_alias="git_status_shortcuts"
_alias $git_add_shortcuts_alias="git_add_shortcuts"
-_alias $git_add_patch_shortcuts_alias="git_add_patch_shortcuts"
_alias $exec_git_expand_args_alias="exec_git_expand_args"
_alias $git_show_files_alias="git_show_affected_files"
_alias $git_commit_all_alias='git_commit_all'
@@ -67,6 +66,7 @@ __git_alias "$git_rm_alias" "$_exp git" "rm"
__git_alias "$git_blame_alias" "$_exp git" "blame"
__git_alias "$git_diff_alias" "$_exp git" "diff"
__git_alias "$git_diff_cached_alias" "$_exp git" "diff" "--cached"
+__git_alias "$git_add_patch_alias" "$_exp git" "add" "-p"
# Standard commands
__git_alias "$git_clone_alias" "git" 'clone'
View
30 lib/git/status_shortcuts.sh
@@ -92,36 +92,6 @@ git_silent_add_shortcuts() {
fi
}
-# 'git add -p' wrapper
-# This shortcut means 'stage my selection of patchs for the file'
-# Should be used in conjunction with the git_status_shortcuts() function for 'git status'.
-# -------------------------------------------------------------------------------
-git_add_patch_shortcuts() {
- if [ -z "$1" ]; then
- echo "Usage: gap <file> => git add -p <file>"
- echo " gap 1 => git add -p \$e1"
- echo " gap 2-4 => git add -p \$e2 \$e3 \$e4"
- echo " gap 2 5-7 => git add -p \$e2 \$e5 \$e6 \$e7"
- else
- git_silent_add_patch_shortcuts "$@"
- # Makes sense to run 'git status' after this command.
- git_status_shortcuts
- fi
-}
-# Does nothing if no args are given.
-git_silent_add_patch_shortcuts() {
- if [ -n "$1" ]; then
- # Expand args and process resulting set of files.
- IFS=$'\t'
- for file in $(git_expand_args "$@"); do
- git add -p "$file"
- echo -e "# Added '$file'"
- done
- IFS=$' \t\n'
- echo "#"
- fi
-}
-
# Prints a list of all files affected by a given SHA1,
# and exports numbered environment variables for each file.
git_show_affected_files(){
Something went wrong with that request. Please try again.