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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:45:55+00:00 2026-06-14T21:45:55+00:00

Possible Duplicate: Is it possible to move/rename files in git and maintain their history?

  • 0

Possible Duplicate:
Is it possible to move/rename files in git and maintain their history?

I am a previous subversion user, not sure how git could help me in following situation.

I have a git repository where my project was contained having multiple dirs, I’ve been making several commits over this structure

Now I need to make structure changes, so that I move all folders/files at root to a new folder, and I still want to keep commit history of files.

so for example in my repo I currently have a structure like this

src
res
xml
file.txt
.gitignore

I want all of them to be moved in a folder called common, so that I have following structure at the root of repo

common
.gitignore

Is it possible , if so how ?

Thank you

  • 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-14T21:45:57+00:00Added an answer on June 14, 2026 at 9:45 pm

    You could use commands like this

    mkdir common
    git mv src res xml file.txt common
    

    This moves the files and you can still see the history with git log --follow common/file.txt. If you’d rather rewrite history, check out How can I rewrite history so that all files, except the ones I already moved, are in a subdirectory?

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

Sidebar

Related Questions

Possible Duplicate: Remove sensitive files and their commits from Git history I noticed that
Possible Duplicate: rename multiple files at once in unix I would like to rename
Possible Duplicate: Maintain/Save/Restore scroll position when returning to a ListView The user views a
Possible Duplicate: Move existing, uncommited work to a new branch in Git I have
Possible Duplicate: How to get notified of UITableViewCell move start and end I have
Possible Duplicate: Any ideas on how I could implement a grid-view in CSS? -
Possible Duplicate: JavaScript move delay and multiple keystrokes I'm new and learning HTML5 canvas
Possible Duplicate: Is array name a pointer in C? char arr[1024]; arr++ //move arr
Possible Duplicate: Emacs, switch to previous window other-window advances me to the next window
Possible Duplicate: Get script of SQL Server data I want to move some rows

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.