<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>github commands on Tutes Club</title><link>https://tutes.in/tag/github-commands/</link><description>Recent content in github commands on Tutes Club</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 25 Apr 2022 13:29:10 +0000</lastBuildDate><atom:link href="https://tutes.in/tag/github-commands/index.xml" rel="self" type="application/rss+xml"/><item><title>How to generate a patch with edited files? How to zip latest committed changes only</title><link>https://tutes.in/how-to-generate-a-patch-with-edited-files-how-to-zip-latest-committed-changes-only/</link><pubDate>Mon, 06 Sep 2021 11:34:34 +0000</pubDate><guid>https://tutes.in/how-to-generate-a-patch-with-edited-files-how-to-zip-latest-committed-changes-only/</guid><description>&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zip archive.zip $(git diff-tree --no-commit-id --name-only -r latest-commit-id)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/a/42971972/2229148"&gt;https://stackoverflow.com/a/42971972/2229148&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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&lt;/p&gt;
&lt;p&gt;There is a &lt;strong&gt;smarter way&lt;/strong&gt; also, if you want all the changes from last 5 commits, use the command like this:&lt;/p&gt;</description></item><item><title>How to push into master or any other branch after removing last n commits in git?</title><link>https://tutes.in/how-to-push-into-master-after-removing-last-two-commits-in-git/</link><pubDate>Mon, 21 Jan 2019 19:23:45 +0000</pubDate><guid>https://tutes.in/how-to-push-into-master-after-removing-last-two-commits-in-git/</guid><description>&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git log&lt;/code&gt; to find out the commit you want to revert&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push origin +daee17:master&lt;/code&gt; while daee17 is the commit before the wrongly pushed commit.&lt;code&gt;+&lt;/code&gt; was for &lt;code&gt;force push&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Finally use &lt;code&gt;git push origin master&lt;/code&gt; to sync your local with your git repo&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And that’s it.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;</description></item><item><title>How to learn Git in 15 minutes? List of most basic git commands</title><link>https://tutes.in/important-useful-git-commands/</link><pubDate>Wed, 02 Jan 2019 04:55:22 +0000</pubDate><guid>https://tutes.in/important-useful-git-commands/</guid><description>These most important Git commands are surely going to help you. Learn basics of git in a few minutes of reading</description></item></channel></rss>