Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias suggestion apply-gitignore #98

Open
felipecrs opened this issue Oct 4, 2023 · 4 comments
Open

Alias suggestion apply-gitignore #98

felipecrs opened this issue Oct 4, 2023 · 4 comments

Comments

@felipecrs
Copy link
Contributor

felipecrs commented Oct 4, 2023

Applies gitignore to all files (remove files which were previously committed already).

apply-gitignore = "!f() { set -ex; git rm -r --cached . >/dev/null; git add .; }; f"

What do you think?

@joelparkerhenderson
Copy link
Member

joelparkerhenderson commented Oct 4, 2023

I understand the intent. I've done similar many times to fix accidents with a .gitignore file not being ready or complete.

In general, for this repo, can you consider if there are any ways to adjust the alias in these kinds of ways...?

  • can you let the user provide a directory (i.e. don't force pwd)?

  • can you allow stdout through (i.e. don't use /dev/null)?

  • can you do it without needing set flags (i.e. don't use -x to force the user to see commands, and use && or || instead of -e)?

  • can you do less (i.e. alias to do the rm cached, which would then let typical add aliases and add commands to work as expected)?

@felipecrs
Copy link
Contributor Author

I'm just nervous about the last item:

can you do less (i.e. alias to do the rm cached, which would then let typical add aliases and add commands to work as expected)?

If I remove the git add . command, then the alias becomes something else completely.

@joelparkerhenderson
Copy link
Member

Naming is hard. :-)

As an example, when I first read your alias name apply-gitignore, what I anticipated was to provide stdin (because apply can mean apply a function to each input) and append each line to the .gitignore file.

Of course your code is totally different in purpose.

What happens when you ask some developers for opinions and brainstorms of naming ideas?

Maybe some naming brainstorms could involve concepts of redo or undo, repair or fix, "oops", or similar...?

@felipecrs
Copy link
Contributor Author

Oh for sure, I didn't like the name very much but I could not think of something better either.

I am happy to iterate through it as many times as needed. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants