loading...

Don't copy and paste git changed files path anymore, use 'git add -i'

luciunknown profile image Luciano Cardoso Updated on ・1 min read

It's usual to see beginners developers copy and paste paths when they are pushing some change on git repository. A good way to avoid it is use 'git add -i' and select files that you want to add.

A brief explanation of -i argument

" Add modified contents in the working tree interactively to the index. Optional path arguments may be supplied to limit operation to a subset of the working tree. See “Interactive mode” for details." (https://git-scm.com/docs/git-add)

1 - Inside a git repository type git add -i

2 - Type 2 to update

3 - Type the file numbers to add, you can specify comma separated values (1,2,3) or an interval (1-7) to add at once.

4 - Hit Enter

5 - Type 7 to quit interactive mode

tip: To remove some file you can type -fileNumber. Ex: -5,-1

git add -i example

:) :) :)

Discussion

pic
Editor guide