Giuseppe
(Giuseppe)
1
The output of rails new
includes a line that, in my view, could be improved:
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
In reality, the option skips the entire git init
, not just the .gitignore
file.
Is this worth opening an issue or even a PR?
ghiculescu
(Alex Ghiculescu)
2
Yes! Improving the docs is always welcome. Please make a PR
The rails command line options are defined here https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb
class_option :skip_git, type: :boolean, aliases: "-G", default: false,
desc: "Skip .gitignore file"
it’s used here https://github.com/rails/rails/blob/2a98e28a31d3b9a720c4a9571c23b40433a035df/railties/lib/rails/generators/rails/app/app_generator.rb#L73-L77 (searching for skip_git
in the GitHub repository)
def version_control
if !options[:skip_git] && !options[:pretend]
run git_init_command, capture: options[:quiet], abort_on_failure: false
end
end
And also here https://github.com/rails/rails/blob/2a98e28a31d3b9a720c4a9571c23b40433a035df/railties/lib/rails/generators/rails/app/app_generator.rb#L73-L77
unless options[:skip_git]
build(:gitignore)
build(:gitattributes)
end
So --skip-git
skips the git init
, the .gitignore
and the .gitattributes
Made a pull request https://github.com/rails/rails/pull/44935