git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Can we stage all files using "git add" command, except some specific files ?

From
Arup Rakshit <aruprakshit@rocketmail.com>
Date
May 26, 2014, 18:03 UTC
Message-ID
<8392138.j8Dle5WGbS@linux-wzza.site>
Hi,
Look below :

arup@linux-wzza:~/Rails/app> git status # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .gitignore # Gemfile # Gemfile.lock # README.rdoc # Rakefile # app/ # bin/ # config.ru # config/ # db/ # lib/ # log/ # public/ # test/ # vendor/ arup@linux-wzza:~/Rails/app> git add -A arup@linux-wzza:~/Rails/app> git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: .gitignore # new file: Gemfile # new file: Gemfile.lock # new file: README.rdoc # new file: Rakefile # new file: app/assets/images/.keep # new file: app/assets/javascripts/application.js # new file: app/assets/javascripts/upload.js.coffee # new file: app/assets/stylesheets/application.css # new file: app/assets/stylesheets/upload.css.scss # new file: app/controllers/application_controller.rb # new file: app/controllers/concerns/.keep # new file: app/controllers/upload_controller.rb # new file: app/helpers/application_helper.rb # new file: app/helpers/upload_helper.rb # new file: app/mailers/.keep # new file: app/models/.keep # new file: app/models/concerns/.keep # new file: app/models/picture.rb # new file: app/views/layouts/application.html.erb # new file: app/views/upload/get.html.erb # new file: app/views/upload/show.html.erb # new file: bin/bundle # new file: bin/rails # new file: bin/rake # new file: bin/spring # new file: config.ru # new file: config/application.rb #....................... #........................... arup@linux-wzza:~/Rails/app> git rm --cached .gitignore rm '.gitignore' arup@linux-wzza:~/Rails/app> git rm --cached bin/bundle rm 'bin/bundle'

Now, you can see, I have staged all the files first using *git add -A*, then _unstaging_ those I don't want to _stage_ right now. Now can this be done, in the *staging* time ? I mean any way to tell `git add` command, that add all the files from the current directory, except some specific files. What I want this is, some times I have at least 30 files, whereas I want to _stage_ say, 20 files, not the rest 10. During _staging_ can I tell *git add* the same. I used *git add -h*, which didn't show me any such hints about my need.

-- 
===============
Regards,
Arup Rakshit
Next: Dennis Kaarsemaker
Message 1 of 7 in “Can we stage all files using "git add" command, except some specific files ?”
  1. Arup RakshitMay 26, 2014
  2. Dennis KaarsemakerMay 26, 2014
  3. Arup RakshitMay 26, 2014
  4. Javier Domingo CansinoMay 26, 2014
  5. Duy NguyenMay 26, 2014
  6. Arup RakshitMay 27, 2014
  7. Duy NguyenMay 26, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.