How to generate a patch with edited files? How to zip latest committed changes only

zip archive.zip $(git diff-tree --no-commit-id --name-only -r latest-commit-id) Reference: https://stackoverflow.com/a/42971972/2229148 sometimes you need all the files that were updated so you can patch an external app which doesnt uses same git project or many other scenarios in which we need a zip or tar of those files. Use the above command to do so There is a smarter way also, if you want all the changes from last 5 commits, use the command like this: ...

September 6, 2021 · 1 min · Harshvardhan Malpani

How to remove files with “No Content Changes Found” in Git Desktop

There are 3 possible ways git can find a file changed (even if you didn’t change it) Line Endings have changed File permissions have changed Bonus: if modification time has changed for first case try these settings in bash shell. One of these will fix it for you $ git config core.eol $ git config core.autocrlf $ git config core.safecrlf For second case, here is the flag git config core.filemode false Bonus One: If Modification time was changed If your working tree has files with updated “last modification time” and you see a huge list of files with “no content changes found”, try this: ...

May 8, 2019 · 1 min · Harshvardhan Malpani

How to push into master or any other branch after removing last n commits in git?

git log to find out the commit you want to revert git push origin +daee17:master while daee17 is the commit before the wrongly pushed commit.+ was for force push Finally use git push origin master to sync your local with your git repo And that’s it. Below is my log aka example. One of the teammates had committed to the repo (he was not supposed to) after which I committed on server and when I tried to push it on github.com, I received REJECTED error because the remote contained 2 commits which the server did not have. ...

January 21, 2019 · 2 min · Harshvardhan Malpani

How to learn Git in 15 minutes? List of most basic git commands

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. Every dev has a working copy of the code and full change history on their local machine Here are some most important and useful GIT commands that will surely help you. ...

January 2, 2019 · 3 min · Harshvardhan Malpani