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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:37:28+00:00 2026-06-18T11:37:28+00:00

After running git filter-branch , how do I get a list of old commit

  • 0

After running git filter-branch, how do I get a list of old commit SHAs as rewritten by filter-branch to their new corresponding commit SHAs?

For example, something similar to:

b19fd985746c1f060f761d42d353e387bec243fb -> c8ab40ef9bae3b58642a8d1e5b90720d093a60b5
c5ebba1eeb92ca76c0effa32de14178ec7f07db6 -> 4d5a9958b98dbcfa47ce1354bb2af4cc77904639
705f71543235b872ca3e1067538e36d14044429d -> d2aafbd6e5b91955b62dee34f4a0abf0171ba016

Where the left column is the list of original SHAs, and the right column are the new SHAs after being rewritten by filter-branch.

I see that the man page for filter-branch mentions a map function, but I don’t understand whether that’s useful here, or if it is, how to use it.

Thanks for your help!

  • 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-18T11:37:29+00:00Added an answer on June 18, 2026 at 11:37 am

    I had to go poking around the source for git-filter-branch to work this one out. It’s not documented (as far as I can tell), but the old commit ID is explicitly exported as $GIT_COMMIT. This worked for me:

    $ git filter-branch --your-filters-here --commit-filter 'echo -n "${GIT_COMMIT}," >>/tmp/log; git commit-tree "$@" | tee -a /tmp/log' your-branch-here
    [...]
    $ cat /tmp/log
    70d609ba7bc58bb196a2351ba26afc5db0964ca6,d9071b49743701c7be971f76ddc84e76554516c7
    0d1146dcabc00c45fb9be7fe923c955f7b6deb50,cb6813f9aca5e5f26fcc85007c5bb71552b91017
    [...]
    

    (That file, of course, has the format <original commit hash>,<new commit hash>.)

    I’m kind of curious what your intentions are with using this though. It doesn’t seem like information you’d need to typically know if you’re using filter-branch the “right” way (i.e., not manipulating existing published history).

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

Sidebar

Related Questions

I have a local branch tracking the remote/master branch. After running git-pull and git-log
My post commit hook is not running after git. I have verified that the
I am getting the following error after running git svn rebase: 'update-index --refresh: command
After running code from my previous question , I get a result set from
After running a new Play-framework 2.0 based project, i failed to clean it -
I lost some code after running git reset --hard HEAD and I never committed
Is it pssobile to run a git hook after adding a file? For example,
after running git fetch I can see some branches which are not (anymore) on
I am experimenting with branching on git and running into nightmare after nightmare. Anyway,
I did a fresh git cvsimport into a new folder, after about 30 minutes

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.