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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:02:13+00:00 2026-05-26T17:02:13+00:00

I really need this command in git hg addremove So now look at scenario

  • 0

I really need this command in git

hg addremove

So now look at scenario and see how mercurial would save me in here:

I had some kind of dir in here var/htdocs/static/static. I accidentally moved files to wrong location (with git-mv). anyway… now I moved some folders around by hand:

mv static static2
mv static2/static ./

Maybe I’ve changed some files in here too… and now everything is great… so now git doesn’t know what happend? How he could trace a movement of files without notifying it like mercurial does with addremove.

For example now with mercurial I could do:

hg addremove --similarity 80%

that’s it – mercurial traced where files was moved by recognizing files content, and I saved my files history.

one lad in here have some trick for this:

git add .
git ls-files --deleted | xargs git rm

but it’s like in CVS back then. you deleting files, you adding files. what about saving history of files??

  • 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-26T17:02:14+00:00Added an answer on May 26, 2026 at 5:02 pm

    Basically, git always automatically does something sort of like “addremove” when it applies a commit to update the working tree: it looks at added and removed files in the commit and detects pairs of added and removed files that are probably renames (using a “amount of change” heuristic). So you don’t have to use a special command; just do the adds and the removes, and git will later figure things out on its own.

    In your example scenario, just tell git about the new files: git add static and about the deleted files: git add -u static, and you’re ready to commit. If you do a git status before committing, you can see that it’s already detected the rename.

    [As another answer mentioned, git add -A is a nice shortcut that just adds everything in the working tree, including new and deleted files; the only reason to use the narrower commands above is if you want to avoid adding some other changes that happen to be in the working tree.]

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

Sidebar

Related Questions

I really need some quick tips here. I've got this VBScript script which sends
I really need help on this one. I am having a simple login form
Sorry to bother again, but I really need help transforming this Python2 code into
I really need an answer to this question. I am working on a project
I really need your help for this. I am relatively new to programming and
I really need some help with this as I have been trying to fix
Its when I try to do stuff like this I realise I really need
EDIT: This question was initially too general, I think. So What I really need
I'm in a need to optimize this really tiny, but pesky function. unsigned umod(int
Sorry if this sounds like a really stupid question, but I need to make

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.