Skip to content

Commit

Permalink
Merge pull request #180 from enisozgen/multi-git-add-function
Browse files Browse the repository at this point in the history
Hello this PR supports multiple selection for files in `git diff` and `git add`

In my tests `cd` didn't create problem. Please think about can it create problem.

Best Regards,
  • Loading branch information
denisidoro authored Jan 27, 2020
2 parents dbcd7ea + 57e0f84 commit 68651bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 11 additions & 8 deletions cheats/git.cheat
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ git checkout <branch>
git status

# Displays unstaged changes for file
git diff <toplevel_directory>/<unstaged_files>
cd <toplevel_directory>; \
git diff <unstaged_files>

# Stages a changed file
git add <toplevel_directory>/<unstaged_files>
# Stage single or multiple files
cd <toplevel_directory>; \
git add <changed_files>;

# Stages all changed files
# Stage all files in project
git add -A

# Saves the changes to a file in a commit
Expand Down Expand Up @@ -94,12 +96,13 @@ git submodule foreach git pull origin master
# Update all submodules
git submodule update --init --recursive

# Start ssh agent
eval "$(ssh-agent -s)"; ssh-add

# Skip git hooks
git commit --no-verify

# Create new branch from current HEAD
git checkout -b <new_branch_name>

$ branch: git branch | awk '{print $NF}'
$ toplevel_directory: git rev-parse --show-toplevel
$ unstaged_files: git --no-pager diff --name-only
$ unstaged_files: git status --untracked-files=no -s --porcelain | awk '{print $NF}' --- --multi true
$ changed_files: git status --untracked-files=all -s --porcelain | awk '{print $NF}' --- --multi true
4 changes: 4 additions & 0 deletions cheats/ssh.cheat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
% ssh

# Start ssh agent
eval "$(ssh-agent -s)"; ssh-add

0 comments on commit 68651bb

Please sign in to comment.