Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5954419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:58:06+00:00 2026-05-22T17:58:06+00:00

I apologize if my question is about a very simple topic, and it is

  • 0

I apologize if my question is about a very simple topic, and it is answered elsewhere, but I’m a noob with git, and I couldn’t answer it neither reading the git documentation, nor searching the web.

I’ve created a git repository for a simple test project. I initialized the repository, added some files and directories using some git add commands, and made my first commit.

Just suppose, for example, I’ve added a README and two directories, src1 and src2, which contain some files. Then suppose I’ve not just edited the file contents, but I’ve added/removed files in these directories. In order to make the repo up-to-date, I’m currently doing:

git add --update
git add src1 src2
git commit -m "something"

Please note I’m updating the edited files, and removing the deleted files with git add --update and then re-adding the two directories in order to make git track the new files created into them! Is there a simple way (without re-adding) of doing this? I’ve tried with just:

git add --update
git commit -m "something"

but this won’t add new files that have been created under src1 and src2 directories. That’s because git doesn’t “remember” I’m tracking an entire directory, but just the files within. git doesn’t seem to track directories.

Obviously I’ve created a bash script with the lines you see in the above example, but it is a bit cumbersome and I would like to know if there’s an easier method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:58:06+00:00Added an answer on May 22, 2026 at 5:58 pm

    Instead of --update, use --all. See man git-add

    git add --all .
    

    That’s because git doesn’t “remember” I’m tracking an entire directory, but just the files within. git doesn’t seem to track directories.

    Thats very easy to explain: Yes, you are right 🙂 Git doesn’t track directories at all, because directories are not objects in the git-world. Directories don’t have any content and there will never be changes to them (because of the missing content), that can git track. If you call git add path/to/directory this will not add the directory, but it will add every containing file recursivly.

    Just a hint: TIG helped me starting with git quite much 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize profusely for the incredibly newbish question I'm about to ask, but for
This is a very simple question, and I apologize for being so noobish :/
It's probably very lame question, but I found no references in C# specification about
I'm new to SSRS, so I apologize if this question is too simple: I
I apologize for asking such a generalized question, but it's something that can prove
I apologize for the subjectiveness of this question, but I am a little stuck
I apologize if this is a duplicate question, I searched a bit and couldn't
I must apologize if this is a duplicate question, but I can't seem to
I apologize if this question was asked already before but I could not find
I apologize if this has already been asked a different way but I couldn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.