Skip to content

Instantly share code, notes, and snippets.

@alexfu
Last active September 17, 2021 07:39
Show Gist options
  • Select an option

  • Save alexfu/9f152162c105f1f5e787f68f03605423 to your computer and use it in GitHub Desktop.

Select an option

Save alexfu/9f152162c105f1f5e787f68f03605423 to your computer and use it in GitHub Desktop.

git-addi

Add git files interactively from the command line.

asciicast

Requirements

Step 1

Create a new bash script called git-addi...

#!/bin/bash
# Add files interactively

git add $(git status --porcelain | fzf -m | awk '{print $2}')

Make it executable...

$ chmod +x git-addi

Step 2

Move git-addi script to a place that is in your $PATH.

For example, I have ~/.git/bin appended to my $PATH variable. This is where all my git scripts live.

export PATH=$PATH:~/.git/bin
$ mv git-addi ~/.git/bin

Step 3

Execute git addi. To select multiple files, use Shift + Tab. Press ENTER when done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment