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

Places to Create Git Repositories execrise is poorly worded #1028

Open
novica opened this issue Oct 22, 2024 · 7 comments
Open

Places to Create Git Repositories execrise is poorly worded #1028

novica opened this issue Oct 22, 2024 · 7 comments

Comments

@novica
Copy link
Contributor

novica commented Oct 22, 2024

How could the content be improved?

It seems the point of this execrise is to teach that you could accidentaly do git init twice in the same directory and thus checking for status is good practice.

However it is factually incorrect.

  1. Git does not track folders. So when you say "repository will track all files, sub-directories, and subdirectory" this is not correct. Git ignores empty folders. It will not automatically track an empty folder. Maybe there should be a point explaining this

  2. Git repositories can be nested https://git-scm.com/book/en/v2/Git-Tools-Submodules (although this is an advanced topic). So, this is not correct: "Git repositories can interfere with each other if they are “nested”".

Which part of the content does your suggestion apply to?

https://swcarpentry.github.io/git-novice/instructor/03-create.html

@martinosorb
Copy link
Contributor

Thanks for the observation.

Regarding point 1., you are right, although I think this is a relatively minor detail since we are at the very beginning. But a short sentence, or simply saying 'non-empty subdirectories', could be done.
Regarding point 2., I would say it is true that they interfere: the point is precisely to say that they can be nested, and this brings all sorts of advanced topics (and problems, for the novice). I think at this stage, it is best to recommend not doing it at all.

Do you have any suggestion for small changes to this effect?

@novica
Copy link
Contributor Author

novica commented Oct 23, 2024

How about this:

No. Alfredo does not need to make the desserts subdirectory a Git repository because the recipes repository will track all files, non-empty sub-directories, and subdirectory files under the recipes directory. Thus, in order to track all information about desserts, Alfredo only needed to add the desserts subdirectory to the recipes directory.

By convention, a simple way to track an "empty" subdirectory for planned work is to create a .gitkeep file in an empty subdirectory. This is a hidden file that git can track, and thus track its folder as well. So If Alfredo plans to have desserts, but hasn't gottern around to writing those recepies, a .gitkeep file can be a simple solution.

@froggleston
Copy link
Contributor

I would go one step further and suggest:

Alfredo does not need to make the desserts subdirectory a Git repository because the recipes repository will track all files under the recipes directory, including those in any subdirectories. Note that Git does not track empty directories.

The .gitkeep idea is a nice one and fits with convention, but does presuppose that people know the dot syntax for hidden Linux files. Would this need an explicit mention?

@novica
Copy link
Contributor Author

novica commented Oct 23, 2024

Yeah true. Bu there is a .gitignore section in the lesson as well. So hidden files get more mentions:)

@froggleston
Copy link
Contributor

Fair point!

@martinosorb
Copy link
Contributor

I would agree with @froggleston. This is the very beginning of the lesson, and I would say it is a priority not to overwhelm the learner with additional information that is not essential at this stage.

@novica
Copy link
Contributor Author

novica commented Oct 23, 2024

I read over the text a few times, and the way @froggleston phrased that paragraph makes more sense to me.

I think the question should be also amended to include a file creation. Otherwise, the point of not tracking empty directories will be mute.

If I do the two exercises in sequence, after I remove the .git folder in the subdirectory, git status won't tell me that I have a folder to add to my project, because the folder would be empty.

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

3 participants