Home > Software engineering >  Couldn't I just pick out the git commit history and delete it?
Couldn't I just pick out the git commit history and delete it?

Time:12-10

I followed what I saw on the Internet to fill a field of grass on GitHub, but all the commits I've done have been doubled.

enter image description here

I want to get rid of the new cloned commits, what should I do?

As the number of commits in a repository doubled, the grass faded as a whole.

Can't I go back on this? I don't know the Git Terminal well, so I'd appreciate it if you could explain it in detail.

git filter-branch --env-filter \
    'if [ $GIT_COMMIT = {MY_HASH}]
     then
         export GIT_AUTHOR_DATE="Tue Aug 4 11:00:00 2020  0900"
         export GIT_COMMITTER_DATE="Tue Aug 4 11:00:00 2020  0900"
     fi'
git pull origin main --allow-unrelated-histories
 
git push origin main

I did it in the above way when I changed the date of the commit.

I've looked up a lot of blogs, but I can't get enough help on this.

CodePudding user response:

Find the commit ID of the last blue commit called solve make_1. Have you tried git reset --head thecommitid. Then do git push --force. If needed delete and recreate the repo and push just the blue branch.

CodePudding user response:

You can squash the commit for double the commits to a single... or in case you want to specifically remove the by commit id, look for the below another StackOverflow answer that might help you

Link to the thread

just don't want to give the same, so shared the same

  • Related