Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically show status after git add

Tags:

git

My usual git workflow is

<make changes>
git add FILES
git status
git commit -m "some remarks"

where I need the git status just to check if I added the correct files.

Is there a way to tell git to automatically display the status after each git add?

like image 720
flonk Avatar asked Jul 31 '13 11:07

flonk


Video Answer


2 Answers

When run with -v (verbose) option, git add outputs the name of files that were added:

» git add -v hello?
add 'hello1'
add 'hello2'
like image 140
CharlesB Avatar answered Oct 04 '22 01:10

CharlesB


Here's what I have using the answer at https://stackoverflow.com/a/26243454 and combining it with devnull's answer:

[alias]
    sadd = !sh -c 'cd -- ${GIT_PREFIX:-.} && git add -- "$@" && git status' --

This way you don't need to pass in the working directory manually.

like image 34
Andrew Keeton Avatar answered Oct 04 '22 00:10

Andrew Keeton