Merge pull request #180 from enisozgen/multi-git-add-function

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,
This commit is contained in:
Denis Isidoro 2020-01-27 10:52:35 -03:00 committed by GitHub
commit 68651bb1c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -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
@ -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
cheats/ssh.cheat Normal file
View file

@ -0,0 +1,4 @@
% ssh
# Start ssh agent
eval "$(ssh-agent -s)"; ssh-add