joseluisq / gitnow

Speed up your Git workflow. :tropical_fish:
https://github.com/joseluisq/gitnow
MIT License
391 stars 25 forks source link

Add support for ignoring file changes temporary #5

Closed joseluisq closed 4 years ago

joseluisq commented 4 years ago

Ignoring files temporary is a useful feature when we need to quickly hide changes in a file(s) for awhile.

Using git update-index --[no-]assume-unchanged we can achieve this.

Proposal: I suggest to add an assume command in order to perform this. The idea comes from this link.

  1. Ignoring files: Ignoring two files which contain changes (--assume-unchanged):
~> assume Cargo.toml README.md
# then `state` command should show us a clean working tree
~> state
Current working tree status:
## develop

Behind the scenes:

~> git update-index --assume-unchanged Cargo.toml README.md
  1. Revert ignored files: Reverting ignored files above via --no flag (--no-assume-unchanged):
~> assume --no Cargo.toml README.md
# then `state` command should show us changes in working directory
~> state
Current working tree status:
## master
M README.md
M Cargo.toml

Behind the scenes:

~> git update-index --no-assume-unchanged Cargo.toml README.md