简体   繁体   中英

Git- Filter Branch Command Deletion of Commits After Certain Date

I've been asked to remove commits after a certain date on of our projects at my company.

I've read the git filter-branch man pages and I am puzzled on how I could run a command in a repository that would delete all commit history after a certain date. I have cloned a copy of the repository on my local machine W7 (64bit) Running Cygwin I would like to test the command before I make a copy of the project on the remote server itself.

-Thanks

Sulman

You don't need to use filter-branch . You can simply reset the references to the latest commit in history that satisfies the criteria. For each reference do

git push . -f <someearlier commit>:branch-name

Then update the central repo with

git push -f

or if you are not tracking the branches, specify each one:

git push -f origin branch-name

or automate with

git branch -r | sed ... # etc, etc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM