Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add(['.']) adds the .git folder #1446

Answered by Byron
agirault asked this question in Q&A
Discussion options

Hoping to add all files in the directory using git add ., including files starting with a period like .gitignore.

Calling the following:

repo.index.add(['.'])

Stages the .git folder and all its history.

You must be logged in to vote

repo.index can't be used for cases like this as it's not a complete implementation of 'pathspecs'. It's a much narrower implementation that can be considered 'expert mode'.

By default, I recommend using repo.git.add('.') instead to have the work done by git instead.

Replies: 1 comment

Comment options

repo.index can't be used for cases like this as it's not a complete implementation of 'pathspecs'. It's a much narrower implementation that can be considered 'expert mode'.

By default, I recommend using repo.git.add('.') instead to have the work done by git instead.

You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1444 on May 21, 2022 01:55.

AltStyle によって変換されたページ (->オリジナル) /