Instead of selecting files manually when using git add, is there a way to group these files and assign them a name so all I have to do would be something like git add <groupname>. That would then add all files within that group? Does that feature exist?
Edit: Thanks for all your replies. I know about git add <folder>/*, but what if not all files within that folder are needed? I'm asking so a group of files (let's say 17 files) can be one fork while another group can be from another fork. The thing which bothers me is these files are spread out in different folders so uploading the folder alone won't work. It has to be by file.
You might consider using a git alias. For example, you can add this to the .git/config file in your repository (or in your ~/.gitconfig):
[alias]
add-foo = add foo1 foo2 foo3
add-bar = add bar1 bar2 bar3
Then you can run git add-foo to add the files foo1, foo2, and foo3.
man git-config for more details on git aliases.
Of course, you could always use shell aliases too.
You can add folders as a group, by basically doing git add [foldername]* but no, git doesn't include a functionality to name a group of files. Can you explain exactly why and what the use case going forward would be? Would you want that name to persist between commits? Would you want the name to be stored in the repo and pulled down if someone cloned your repo?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With