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 7883617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:34:49+00:00 2026-06-03T04:34:49+00:00

I’m new to git for source control. I want to make sure I’m understanding

  • 0

I’m new to git for source control. I want to make sure I’m understanding everything as I go though, and very early I hit something that seems strange.

Here’s what I’m doing:

  1. Create a new repository on GitHub. It offers to make a “standard” C# .gitignore file, which sounds great, so I say yes.
  2. I see that there is both a Readme and .gitignore created with the repository.
  3. I clone this repo to my machine using git clone [repo location] [local folder]
  4. I edit the .gitignore file to add some additional ignored files and folders.
  5. I enter git commit, which yields a message that says “Changes not staged for commit” but lists .gitignore as being modified.

So ultimately I add it, commit and push back to the origin, which shows my changes on GitHub. So all is well.

This is sort of confusing to me. If .gitignore wasn’t being tracked, how in the world did it get pulled down using git clone? Why did I have to add it manually before it allowed me to commit the changes?

  • 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-06-03T04:34:50+00:00Added an answer on June 3, 2026 at 4:34 am

    This is how git views your repository:

    repository  ---  staging area  ---  working directory
    

    In the repository, you get all that is committed, in all local branches or fetched remote branches. In the working directory you have all your files, checked out from some commit, which are possibly modified. The staging area is a place where you add files to be committed, but they are not yet committed. This is because in git you can choose what to commit (unlike svn for example that you commit whatever is modified).

    I strongly recommend reading this article that although is focused on git reset, it gives a very good overview of how git works.

    Here is a small picture of it:

    repository  ---  staging area  ---  working directory
        |                  |                    |
        |                  |                    |
        |              Check out                |
        |-------------------------------------->|
        |                  |                    |
        |                  |         add        |
        |                  |<-------------------|
        |                  |                    |
        |      commit      |                    |
        |<-----------------|                    |
    

    The checkout is quite obvious. The second two mean you selectively add files to the staging area and then you commit them. For example:

    $ touch file1 file2 file3 file4  # modify files
    $ git add file1
    $ git add file2
    $ git commit
    

    only commits file1 and file2 even though file3 and file4 are also modified.

    Sometimes, all you want is commit whatever you have. There is a shortcut for it:

    $ touch file1 file2 file3 file4  # modify files
    $ git commit -a
    

    git commit given -a option automatically adds all modified files to commit.

    You could even stage parts of files, which is done by git add -p which basically shows you the pieces of the commit patch and lets you choose what changes get staged and what not. Later, with git commit you can commit whatever was staged.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the
I want to construct a data frame in an Rcpp function, but when I
I have a jquery bug and I've been looking for hours now, I can'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.