Reputation: 93
From past few days i had kept on adding and committing files in my local. My branch is now 16 commits ahead of 'origin/master'.
I wanted to push them to my git repo but one of the file being very large my push command fails. Is there any way to remove that commit from the stash or will i have to do a hard reset on the head.
Upvotes: 1
Views: 3965
Reputation: 990
If you just want to remove the file then why not just do that by deleting the file and then committing the change?
Now, in your latest commit the file doesn't exist.
You should now be able to push your branch to the remote without any problem.
Upvotes: 0
Reputation: 141946
squash
# edit all the commits up to the given sha-1
git rebase -i <sha-1>
but one of the file being very large my push command fails...
How to remove big files from the repository
You can use git filter-branch
or BFG.
https://rtyley.github.io/bfg-repo-cleaner/
BFG Repo-Cleaner
an alternative to git-filter-branch.
The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
* Removing Crazy Big Files*
* Removing Passwords, Credentials & other Private data
In all these examples bfg is an alias for java -jar bfg.jar.
# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa} my-repo.git
Upvotes: 2
Reputation: 241748
If you just want to skip a commit, do git rebase -i master
and select drop
for the commit to be skipped. If you just want to remove a single file from it, select edit
and amend the commit to remove the file.
Upvotes: 3
Reputation: 356
what you can do is you can use git rebase option and squash all the commits.
Upvotes: -1