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

  • Home
  • SEARCH
  • 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 8045729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:37:52+00:00 2026-06-05T05:37:52+00:00

Often I move files in a git repository using my IDE or via the

  • 0

Often I move files in a git repository using my IDE or via the command line (not via git mv).

As a result I and end up with several unstaged files to be deleted on my next commit as below:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   test.html
#
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    css/bootstrap.css
#   deleted:    css/bootstrap.min.css
#   deleted:    img/glyphicons-halflings-white.png
#   deleted:    img/glyphicons-halflings.png
#   deleted:    js/bootstrap.js
#   deleted:    js/bootstrap.min.js

I typically will select all the deleted files and edit them in a text editor to produce like:

git rm  css/bootstrap.css
git rm  css/bootstrap.min.css
git rm  img/glyphicons-halflings-white.png
git rm  img/glyphicons-halflings.png
git rm  js/bootstrap.js
git rm  js/bootstrap.min.js

Which I then throw back into the console.

Is there a way to do this without having to copy/paste?

  • 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-05T05:37:53+00:00Added an answer on June 5, 2026 at 5:37 am

    If I understand your question correctly, you want to commit your deletes…that is, you want to perform the equivalent of git rm for all of the files that show up as deleted. git clean won’t do this.

    You can run git add -u:

    Only match against already tracked files in the index
    rather than the working tree. That means that it will never stage new
    files, but that it will stage modified new contents of tracked files
    and that it will remove files from the index if the corresponding
    files in the working tree have been removed.

    This will pick up all changes to tracked files, including deletes. So if you start with this:

    # Changes not staged for commit:
    #   (use "git add/rm <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   deleted:    file2
    #   deleted:    file3
    #   deleted:    file4
    #   deleted:    file5
    

    Running git add -u will get you to this:

    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   deleted:    file2
    #   deleted:    file3
    #   deleted:    file4
    #   deleted:    file5
    

    And a commit at this point will do the right thing.

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

Sidebar

Related Questions

Often I would move files locally say from one folder to another. When committing
Every so often, I accidentally move the panels at the top of my IDE.
When using Visual Studio I often encounter situations when the IDE freezes while performing
I often use Excel with pivot tables based on .cub files for OLAP-type analysis.
When using the programmers text editor vi, I'll often use a wildcard search to
When implementing move constructors and move assignment operators, one often writes code like this:
I am very disappointed in Java for not allowing the following code to move
I have a git repository (and working directory) that is stored in my Dropbox
I often code in such way that I put several classes in one cs
I use emacs for development and very often need to move to the start

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.