QuestionId stringlengths 3 8 | QuestionTitle stringlengths 15 149 | QuestionScore int64 1 27.2k | QuestionCreatedUtc stringdate 2008-08-01 18:33:08 2025-06-16 04:59:48 | QuestionBodyHtml stringlengths 40 28.2k | QuestionViewCount int64 78 16.5M | QuestionOwnerUserId float64 4 25.2M ⌀ | QuestionLastActivityUtc stringdate 2008-09-08 19:26:01 2026-01-24 22:40:25 | AcceptedAnswerId int64 266 79.7M | AnswerScore int64 2 30.1k | AnswerCreatedUtc stringdate 2008-08-01 23:40:28 2025-06-16 05:23:39 | AnswerOwnerUserId float64 1 29.5M ⌀ | AnswerLastActivityUtc stringdate 2008-08-01 23:40:28 2026-01-23 17:46:09 | QuestionLink stringlengths 31 36 | AnswerLink stringlengths 31 36 | AnswerBodyHtml stringlengths 35 33k | AnswerBodyPreview stringlengths 35 400 | AllTagIdsCsv stringlengths 2 37 | AllTagNamesCsv stringlengths 2 106 | MergedQuestion stringlengths 74 28.4k | quality_filter stringclasses 10
values | unique_id int64 0 29k | tag_major_lang stringclasses 10
values | MergedQuestion_md stringlengths 60 28.1k | AnswerBodyHtml_md stringlengths 14 29.2k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21833300 | Git rebase gets stuck after resolving merge conflict | 10 | 2014-02-17 15:43:25 | <p>I'm running a rebase that hits a conflict:</p>
<pre><code>$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Better `SelectMotifsView.js`
Using index info to reconstruct a base tree...
M browser/AddLinkView.js
M browser/SelectMotifsView.js
M browser/index.html
... | 15,508 | 741,970 | 2016-04-16 00:29:32 | 21,834,680 | 16 | 2014-02-17 16:46:42 | 1,242,778 | 2014-02-17 16:46:42 | https://stackoverflow.com/q/21833300 | https://stackoverflow.com/a/21834680 | <p>Looks like the patch is empty, so you can safely skip it as git suggests:</p>
<pre><code>$ git rebase --skip
</code></pre>
| <p>Looks like the patch is empty, so you can safely skip it as git suggests:</p> <pre><code>$ git rebase --skip </code></pre> | 119 | git | <h1>Git rebase gets stuck after resolving merge conflict</h1>
<p>I'm running a rebase that hits a conflict:</p>
<pre><code>$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Better `SelectMotifsView.js`
Using index info to reconstruct a base tree...
M browser/AddLinkView.js
M... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,656 | git | # Git rebase gets stuck after resolving merge conflict
I'm running a rebase that hits a conflict:
```
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Better `SelectMotifsView.js`
Using index info to reconstruct a base tree...
M browser/AddLinkView.js
M browser/Selec... | Looks like the patch is empty, so you can safely skip it as git suggests:
```
$ git rebase --skip
``` |
19298154 | Git listing non-existent remotes | 10 | 2013-10-10 14:10:34 | <p>I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin.</p>
<p>For example, I had this previously:</p>
<pre><code>[remote "origin"]
url = blah blah
[remote "future"]
url = blah blah
</code... | 2,182 | 306,999 | 2013-10-10 14:41:59 | 19,298,897 | 16 | 2013-10-10 14:41:59 | 1,256,452 | 2013-10-10 14:41:59 | https://stackoverflow.com/q/19298154 | https://stackoverflow.com/a/19298897 | <p>You used to have a remote named <code>future</code>, and you don't now.</p>
<p>Hence, <code>git remote <em>whatever</em> future</code> can't help, because there is no remote named <code>future</code>. (Normally <code>git remote update -p</code> or <code>git remote prune</code>, as in the comments above, would let ... | <p>You used to have a remote named <code>future</code>, and you don't now.</p> <p>Hence, <code>git remote <em>whatever</em> future</code> can't help, because there is no remote named <code>future</code>. (Normally <code>git remote update -p</code> or <code>git remote prune</code>, as in the comments above, would let ... | 119, 32868, 41346, 76220 | git, git-branch, git-config, git-remote | <h1>Git listing non-existent remotes</h1>
<p>I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin.</p>
<p>For example, I had this previously:</p>
<pre><code>[remote "origin"]
url = blah blah
[... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,657 | git | # Git listing non-existent remotes
I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin.
For example, I had this previously:
```
[remote "origin"]
url = blah blah
[remote "future"]
url = bl... | You used to have a remote named `future`, and you don't now.
Hence, `git remote whatever future` can't help, because there is no remote named `future`. (Normally `git remote update -p` or `git remote prune`, as in the comments above, would let you get rid of these.)
The simplest option would seem to be to delete them... |
18128473 | Git alias appending parameters to end | 10 | 2013-08-08 14:19:32 | <p>I'm using Git Bash v1.8.1, with a few aliases (for testing):</p>
<pre><code>[alias]
ekko = !echo $1 && echo $1
ekko2 = !sh -c 'echo $1 && echo $1'
</code></pre>
<p>But when I run them, I see:</p>
<pre><code>> git ekko master
master
master master
</code></pre>
<p>And:</p>
<pre><code>&g... | 1,137 | 88,111 | 2019-05-29 08:28:28 | 18,128,834 | 16 | 2013-08-08 14:36:09 | 1,157,054 | 2013-08-08 14:36:09 | https://stackoverflow.com/q/18128473 | https://stackoverflow.com/a/18128834 | <p>Your <code>ekko2</code> alias is really close... What you really want is this:</p>
<pre><code>[alias]
ekko2 = !sh -c 'echo $1 && echo $1' -
</code></pre>
<p>Git aliases that execute shell commands do substitute the <code>$n</code> variables, but they also append any arguments you pass them to the end o... | <p>Your <code>ekko2</code> alias is really close... What you really want is this:</p> <pre><code>[alias] ekko2 = !sh -c 'echo $1 && echo $1' - </code></pre> <p>Git aliases that execute shell commands do substitute the <code>$n</code> variables, but they also append any arguments you pass them to the end o... | 119 | git | <h1>Git alias appending parameters to end</h1>
<p>I'm using Git Bash v1.8.1, with a few aliases (for testing):</p>
<pre><code>[alias]
ekko = !echo $1 && echo $1
ekko2 = !sh -c 'echo $1 && echo $1'
</code></pre>
<p>But when I run them, I see:</p>
<pre><code>> git ekko master
master
master m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,658 | git | # Git alias appending parameters to end
I'm using Git Bash v1.8.1, with a few aliases (for testing):
```
[alias]
ekko = !echo $1 && echo $1
ekko2 = !sh -c 'echo $1 && echo $1'
```
But when I run them, I see:
```
> git ekko master
master
master master
```
And:
```
> git ekko2 master
(blank line)
(blank li... | Your `ekko2` alias is really close... What you really want is this:
```
[alias]
ekko2 = !sh -c 'echo $1 && echo $1' -
```
Git aliases that execute shell commands do substitute the `$n` variables, but they also append any arguments you pass them to the end of the command. So in your first example `git ekko master`... |
17903629 | Cloning a previous version on Heroku | 10 | 2013-07-27 23:52:40 | <p>I'm new to Heroku. After pushing bad code to the server, I used <code>heroku rollback</code> to revert to a previous version. I then tried to clone this rollback to my computer with:</p>
<pre><code>git clone git@heroku.com:<project>.git <dir>
</code></pre>
<p>Unfortunately, this clones the corrupted he... | 6,511 | 1,255,372 | 2013-07-28 20:14:19 | 17,904,547 | 16 | 2013-07-28 02:55:05 | 2,942 | 2013-07-28 02:55:05 | https://stackoverflow.com/q/17903629 | https://stackoverflow.com/a/17904547 | <p>When you do rollbacks, the head of your Heroku Git repo will no longer reflect the running state of you app. Check your releases:</p>
<pre><code>$ heroku releases
Rel Change By When
---- ---------------------- ------------------- -------------
v52 Config add AWS_S3_KEY ... | <p>When you do rollbacks, the head of your Heroku Git repo will no longer reflect the running state of you app. Check your releases:</p> <pre><code>$ heroku releases Rel Change By When ---- ---------------------- ------------------- ------------- v52 Config add AWS_S3_KEY ... | 119, 3050, 8279, 12196 | clone, git, heroku, rollback | <h1>Cloning a previous version on Heroku</h1>
<p>I'm new to Heroku. After pushing bad code to the server, I used <code>heroku rollback</code> to revert to a previous version. I then tried to clone this rollback to my computer with:</p>
<pre><code>git clone git@heroku.com:<project>.git <dir>
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,659 | git | # Cloning a previous version on Heroku
I'm new to Heroku. After pushing bad code to the server, I used `heroku rollback` to revert to a previous version. I then tried to clone this rollback to my computer with:
```
git clone git@heroku.com:<project>.git <dir>
```
Unfortunately, this clones the corrupted head, not th... | When you do rollbacks, the head of your Heroku Git repo will no longer reflect the running state of you app. Check your releases:
```
$ heroku releases
Rel Change By When
---- ---------------------- ------------------- -------------
v52 Config add AWS_S3_KEY shanley@her... |
13919413 | How to update topic branch with upstream changes on master? | 10 | 2012-12-17 17:54:01 | <p>I start some work on a topic branch</p>
<pre><code> •-•-• < topic
/
•-• < master
</code></pre>
<p>I push the topic branch</p>
<pre><code>$ git push origin topic
</code></pre>
<p>Someone else pushes changes to master</p>
<pre><code> •-•-• < origin/topic
/
•-•-•—• < origin/master
<... | 6,729 | 633,183 | 2012-12-18 02:16:51 | 13,925,352 | 16 | 2012-12-18 02:16:51 | 300,238 | 2012-12-18 02:16:51 | https://stackoverflow.com/q/13919413 | https://stackoverflow.com/a/13925352 | <p>Let me rework your example for clarity.</p>
<pre><code> C-D-E < topic, origin/topic
/
A-B < master, origin/master
</code></pre>
<p>Then someone does work.</p>
<pre><code> C-D-E < topic, origin/topic
/
A-B-F-G < origin/master
^
master
</code></pre>
<p>You fetched F & G from origin, and t... | <p>Let me rework your example for clarity.</p> <pre><code> C-D-E < topic, origin/topic / A-B < master, origin/master </code></pre> <p>Then someone does work.</p> <pre><code> C-D-E < topic, origin/topic / A-B-F-G < origin/master ^ master </code></pre> <p>You fetched F & G from origin, and t... | 119, 29934 | git, git-rebase | <h1>How to update topic branch with upstream changes on master?</h1>
<p>I start some work on a topic branch</p>
<pre><code> •-•-• < topic
/
•-• < master
</code></pre>
<p>I push the topic branch</p>
<pre><code>$ git push origin topic
</code></pre>
<p>Someone else pushes changes to master</p>
<pre>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,660 | git | # How to update topic branch with upstream changes on master?
I start some work on a topic branch
```
•-•-• < topic
/
•-• < master
```
I push the topic branch
```
$ git push origin topic
```
Someone else pushes changes to master
```
•-•-• < origin/topic
/
•-•-•—• < origin/master
```
### How... | Let me rework your example for clarity.
```
C-D-E < topic, origin/topic
/
A-B < master, origin/master
```
Then someone does work.
```
C-D-E < topic, origin/topic
/
A-B-F-G < origin/master
^
master
```
You fetched F & G from origin, and then rebased topic onto master. So now your repository looks lik... |
8709383 | Installing Git HTML Help on OSX | 10 | 2012-01-03 07:59:35 | <p>I've tried to install the Git HTML help pages on OSX according to the instructions provided by the following links:</p>
<ul>
<li><a href="http://help.github.com/install-git-html-help/">http://help.github.com/install-git-html-help/</a></li>
<li><a href="http://www.railsatwork.com/2010/12/installing-git-html-document... | 1,803 | 500,270 | 2013-05-17 15:40:40 | 8,957,498 | 16 | 2012-01-21 23:05:39 | 409,317 | 2013-05-17 15:40:40 | https://stackoverflow.com/q/8709383 | https://stackoverflow.com/a/8957498 | <p>Change clone command address from </p>
<pre><code>$ sudo git clone git://git.kernel.org/pub/scm/git/git.git git-doc --branch html
</code></pre>
<p>to </p>
<pre><code>$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc
</code></pre>
<p>Hope this will be changed in Github tutorial soon.</p>
... | <p>Change clone command address from </p> <pre><code>$ sudo git clone git://git.kernel.org/pub/scm/git/git.git git-doc --branch html </code></pre> <p>to </p> <pre><code>$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc </code></pre> <p>Hope this will be changed in Github tutorial soon.</p> ... | 119, 369 | git, macos | <h1>Installing Git HTML Help on OSX</h1>
<p>I've tried to install the Git HTML help pages on OSX according to the instructions provided by the following links:</p>
<ul>
<li><a href="http://help.github.com/install-git-html-help/">http://help.github.com/install-git-html-help/</a></li>
<li><a href="http://www.railsatwork... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,664 | git | # Installing Git HTML Help on OSX
I've tried to install the Git HTML help pages on OSX according to the instructions provided by the following links:
- <http://help.github.com/install-git-html-help/>
- <http://www.railsatwork.com/2010/12/installing-git-html-documentation-on.html>
But when I get to the final verifica... | Change clone command address from
```
$ sudo git clone git://git.kernel.org/pub/scm/git/git.git git-doc --branch html
```
to
```
$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc
```
Hope this will be changed in Github tutorial soon.
UPDATE:
If you are one of those who thinks it’s enough ... |
51629509 | How to show git log with commit numbers? | 9 | 2018-08-01 09:13:59 | <p>I found an <a href="https://www.clock.co.uk/insight/deleting-a-git-commit" rel="noreferrer">example on how to delete a commit</a> but it includes git log in the following format</p>
<pre><code>Number Hash Commit Message Author
1 2c6a45b (HEAD) Adding public method to access protected method Tom
2 ae45fab ... | 5,365 | 258,483 | 2024-10-17 21:18:24 | 51,629,982 | 16 | 2018-08-01 09:37:00 | 1,602,555 | 2018-08-01 09:37:00 | https://stackoverflow.com/q/51629509 | https://stackoverflow.com/a/51629982 | <p>You could combine the <a href="https://linux.die.net/man/1/nl" rel="noreferrer"><code>nl</code></a> command with <code>git log --oneline</code> to enumerate output lines. It's far from ideal but if you are just looking for the line numbers:</p>
<pre><code>$ git log --oneline | nl
1 91236f3 Message
2 a611069 Mes... | <p>You could combine the <a href="https://linux.die.net/man/1/nl" rel="noreferrer"><code>nl</code></a> command with <code>git log --oneline</code> to enumerate output lines. It's far from ideal but if you are just looking for the line numbers:</p> <pre><code>$ git log --oneline | nl 1 91236f3 Message 2 a611069 Mes... | 119, 47913 | git, git-log | <h1>How to show git log with commit numbers?</h1>
<p>I found an <a href="https://www.clock.co.uk/insight/deleting-a-git-commit" rel="noreferrer">example on how to delete a commit</a> but it includes git log in the following format</p>
<pre><code>Number Hash Commit Message Author
1 2c6a45b (HEAD) Adding public m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,670 | git | # How to show git log with commit numbers?
I found an [example on how to delete a commit](https://www.clock.co.uk/insight/deleting-a-git-commit) but it includes git log in the following format
```
Number Hash Commit Message Author
1 2c6a45b (HEAD) Adding public method to access protected method Tom
2 ae45fa... | You could combine the [`nl`](https://linux.die.net/man/1/nl) command with `git log --oneline` to enumerate output lines. It's far from ideal but if you are just looking for the line numbers:
```
$ git log --oneline | nl
1 91236f3 Message
2 a611069 Message
3 f2813e7 Message
4 01b59e4 Message
5 2343455 Message... |
40291034 | How to find the last branch checked out in git | 9 | 2016-10-27 17:41:49 | <p>We can checkout the last branch using <code>git checkout -</code>, but is there a way to just find out what was last branch and not check it out?</p>
<p>EDIT:
I already found that I could use: </p>
<pre><code>git reflog | grep -i "checkout: moving"|head -1|cut -d' ' -f6
</code></pre>
<p>But I wanted to know if th... | 4,695 | 153,911 | 2019-06-04 20:54:16 | 40,291,733 | 16 | 2016-10-27 18:26:49 | 1,256,452 | 2016-10-27 18:26:49 | https://stackoverflow.com/q/40291034 | https://stackoverflow.com/a/40291733 | <p>Your sample output (as produced by <code>git reflog | ...</code>) makes it sufficiently clear.</p>
<p>The <code>git rev-parse</code> command can be combined with the reference lookup syntax to do this in one go:</p>
<pre><code>$ git rev-parse --symbolic-full-name @{-1}
refs/heads/stash-exp
$ git rev-parse --abbrev... | <p>Your sample output (as produced by <code>git reflog | ...</code>) makes it sufficiently clear.</p> <p>The <code>git rev-parse</code> command can be combined with the reference lookup syntax to do this in one go:</p> <pre><code>$ git rev-parse --symbolic-full-name @{-1} refs/heads/stash-exp $ git rev-parse --abbrev... | 119, 37230 | git, git-checkout | <h1>How to find the last branch checked out in git</h1>
<p>We can checkout the last branch using <code>git checkout -</code>, but is there a way to just find out what was last branch and not check it out?</p>
<p>EDIT:
I already found that I could use: </p>
<pre><code>git reflog | grep -i "checkout: moving"|head -1|cu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,671 | git | # How to find the last branch checked out in git
We can checkout the last branch using `git checkout -`, but is there a way to just find out what was last branch and not check it out?
EDIT:
I already found that I could use:
```
git reflog | grep -i "checkout: moving"|head -1|cut -d' ' -f6
```
But I wanted to know i... | Your sample output (as produced by `git reflog | ...`) makes it sufficiently clear.
The `git rev-parse` command can be combined with the reference lookup syntax to do this in one go:
```
$ git rev-parse --symbolic-full-name @{-1}
refs/heads/stash-exp
$ git rev-parse --abbrev-ref @{-1}
stash-exp
```
Note that [the `g... |
39460740 | Git shortcut for checkout, pull, checkout, merge/rebase | 9 | 2016-09-13 00:56:41 | <p>Let's say I've got 2 branches, master and codyDev. Before I begin making changes on codyDev, I do the following in order to make sure I'm starting from the latest master commit on codyDev:</p>
<p><code>git checkout master</code><br>
<code>git pull</code><br>
<code>git checkout codyDev</code><br>
if changes, <code>g... | 11,363 | 1,263,343 | 2016-09-13 18:49:32 | 39,460,845 | 16 | 2016-09-13 01:12:18 | 1,863,229 | 2016-09-13 16:08:08 | https://stackoverflow.com/q/39460740 | https://stackoverflow.com/a/39460845 | <p>You can update your <code>codyDev</code> branch with the latest changes from <code>master</code> without actually changing branches:</p>
<pre><code>git checkout codyDev # ignore if already on codyDev
git fetch origin # updates tracking branches, including origin/master
git merge origin/master # merg... | <p>You can update your <code>codyDev</code> branch with the latest changes from <code>master</code> without actually changing branches:</p> <pre><code>git checkout codyDev # ignore if already on codyDev git fetch origin # updates tracking branches, including origin/master git merge origin/master # merg... | 119, 7201, 28897, 37230, 76220 | git, git-branch, git-checkout, git-merge, shortcut | <h1>Git shortcut for checkout, pull, checkout, merge/rebase</h1>
<p>Let's say I've got 2 branches, master and codyDev. Before I begin making changes on codyDev, I do the following in order to make sure I'm starting from the latest master commit on codyDev:</p>
<p><code>git checkout master</code><br>
<code>git pull</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,672 | git | # Git shortcut for checkout, pull, checkout, merge/rebase
Let's say I've got 2 branches, master and codyDev. Before I begin making changes on codyDev, I do the following in order to make sure I'm starting from the latest master commit on codyDev:
`git checkout master`
`git pull`
`git checkout codyDev`
if change... | You can update your `codyDev` branch with the latest changes from `master` without actually changing branches:
```
git checkout codyDev # ignore if already on codyDev
git fetch origin # updates tracking branches, including origin/master
git merge origin/master # merge latest master into codyDev
```
Th... |
37576604 | Find and remove too large of files to push in git lfs | 9 | 2016-06-01 18:51:06 | <p>I have a commit, and I am trying to push it. I get this response</p>
<pre><code>Git LFS: (0 of 9 files, 9 skipped) 0 B / 3.24 GB, 3.24 GB skipped
[422] Size must be less than 2147483648
[0ee4f2bc4d42d98ea0e7b5aeba2762c7482f3bcf00739d40b922babe8061820b] Size must be less than 2147483648
error: failed to push some r... | 7,160 | 943,332 | 2024-06-06 22:02:09 | 37,576,727 | 16 | 2016-06-01 18:57:59 | 4,433,386 | 2016-06-01 18:57:59 | https://stackoverflow.com/q/37576604 | https://stackoverflow.com/a/37576727 | <p>A simple </p>
<pre><code>git ls-files
</code></pre>
<p>will give you a listing of files currently managed by git.</p>
<p>With a bit of pipe magic, the file over size limit get's pretty easy to spot</p>
<pre><code>git ls-files -z | xargs -0 stat -c '%s %n' | sort -n
</code></pre>
<p>will give you an ascendingly... | <p>A simple </p> <pre><code>git ls-files </code></pre> <p>will give you a listing of files currently managed by git.</p> <p>With a bit of pipe magic, the file over size limit get's pretty easy to spot</p> <pre><code>git ls-files -z | xargs -0 stat -c '%s %n' | sort -n </code></pre> <p>will give you an ascendingly... | 119, 115244 | git, git-lfs | <h1>Find and remove too large of files to push in git lfs</h1>
<p>I have a commit, and I am trying to push it. I get this response</p>
<pre><code>Git LFS: (0 of 9 files, 9 skipped) 0 B / 3.24 GB, 3.24 GB skipped
[422] Size must be less than 2147483648
[0ee4f2bc4d42d98ea0e7b5aeba2762c7482f3bcf00739d40b922babe8061820b]... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,673 | git | # Find and remove too large of files to push in git lfs
I have a commit, and I am trying to push it. I get this response
```
Git LFS: (0 of 9 files, 9 skipped) 0 B / 3.24 GB, 3.24 GB skipped
[422] Size must be less than 2147483648
[0ee4f2bc4d42d98ea0e7b5aeba2762c7482f3bcf00739d40b922babe8061820b] Size must be less th... | A simple
```
git ls-files
```
will give you a listing of files currently managed by git.
With a bit of pipe magic, the file over size limit get's pretty easy to spot
```
git ls-files -z | xargs -0 stat -c '%s %n' | sort -n
```
will give you an ascendingly sorted list of file sizes and corresponding files. |
37418392 | How to capitalize Xcode, Git, git, and HEAD | 9 | 2016-05-24 15:51:19 | <p>Sorry if this is not directly related to the programming.</p>
<p>What is the proper (official spelling of the words "GIT HEAD" and "XCODE"?</p>
<p>I know the latter used to be spelled "XCode", but now it seems "Xcode" is used.</p>
<p>The reason for question is: I am doing a lot of postings on forums and I want to... | 3,953 | 945,871 | 2025-03-05 18:54:04 | 37,418,911 | 16 | 2016-05-24 16:17:54 | 77,567 | 2025-03-05 18:54:04 | https://stackoverflow.com/q/37418392 | https://stackoverflow.com/a/37418911 | <p>Xcode has always been “Xcode” with a capital “X” and a lower-case “c”. Here's <a href="https://www.apple.com/newsroom/2003/06/23Apple-Introduces-Xcode-the-Fastest-Way-to-Create-Mac-OS-X-Applications/" rel="nofollow noreferrer">the press release</a> dated June 23, 2003 announcing the first release of Xcode. Here's <a... | <p>Xcode has always been “Xcode” with a capital “X” and a lower-case “c”. Here's <a href="https://www.apple.com/newsroom/2003/06/23Apple-Introduces-Xcode-the-Fastest-Way-to-Create-Mac-OS-X-Applications/" rel="nofollow noreferrer">the press release</a> dated June 23, 2003 announcing the first release of Xcode. Here's <a... | 119, 908 | git, xcode | <h1>How to capitalize Xcode, Git, git, and HEAD</h1>
<p>Sorry if this is not directly related to the programming.</p>
<p>What is the proper (official spelling of the words "GIT HEAD" and "XCODE"?</p>
<p>I know the latter used to be spelled "XCode", but now it seems "Xcode" is used.</p>
<p>The reason for question is:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,674 | git | # How to capitalize Xcode, Git, git, and HEAD
Sorry if this is not directly related to the programming.
What is the proper (official spelling of the words "GIT HEAD" and "XCODE"?
I know the latter used to be spelled "XCode", but now it seems "Xcode" is used.
The reason for question is: I am doing a lot of postings ... | Xcode has always been “Xcode” with a capital “X” and a lower-case “c”. Here's [the press release](https://www.apple.com/newsroom/2003/06/23Apple-Introduces-Xcode-the-Fastest-Way-to-Create-Mac-OS-X-Applications/) dated June 23, 2003 announcing the first release of Xcode. Here's [a video of Steve Jobs introducing Xcode 1... |
36351799 | If I push an amended commit will it create a new commit? | 9 | 2016-04-01 08:43:53 | <p>I have already pushed a commit on the remote branch and now I want to change its content, so I tried <code>git amend</code>.</p>
<p>If do <code>git status</code> it says that the two branches have 1 and 1 different commits each, respectively. </p>
<p>Now if I push the amended commit with the same commit message, w... | 7,122 | 4,397,707 | 2019-09-03 14:35:10 | 36,351,995 | 16 | 2016-04-01 08:54:37 | 216,074 | 2016-04-01 08:54:37 | https://stackoverflow.com/q/36351799 | https://stackoverflow.com/a/36351995 | <p><code>git commit --amend</code>, just like <code>git rebase</code>, will create <em>a new</em> commit object. That object is based on a previously existing commit but it is still a new commit and replaces the old one completely.</p>
<p>Looking at the history, this could look like this:</p>
<pre><code> ... | <p><code>git commit --amend</code>, just like <code>git rebase</code>, will create <em>a new</em> commit object. That object is based on a previously existing commit but it is still a new commit and replaces the old one completely.</p> <p>Looking at the history, this could look like this:</p> <pre><code> ... | 119, 4236, 30968 | git, git-amend, push | <h1>If I push an amended commit will it create a new commit?</h1>
<p>I have already pushed a commit on the remote branch and now I want to change its content, so I tried <code>git amend</code>.</p>
<p>If do <code>git status</code> it says that the two branches have 1 and 1 different commits each, respectively. </p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,675 | git | # If I push an amended commit will it create a new commit?
I have already pushed a commit on the remote branch and now I want to change its content, so I tried `git amend`.
If do `git status` it says that the two branches have 1 and 1 different commits each, respectively.
Now if I push the amended commit with the sa... | `git commit --amend`, just like `git rebase`, will create *a new* commit object. That object is based on a previously existing commit but it is still a new commit and replaces the old one completely.
Looking at the history, this could look like this:
```
master
↓
* --- * --- * --- A
... |
34449222 | Why isn't .gitignore ignoring .sass-cache? | 9 | 2015-12-24 07:51:25 | <p>My project looks like this:</p>
<p><a href="https://i.sstatic.net/NaGSC.png" rel="noreferrer"><img src="https://i.sstatic.net/NaGSC.png" alt="enter image description here"></a></p>
<p><strong>.gitignore:</strong></p>
<pre><code>/node_modules
/dist
/.tmp
/.sass-cache
.sass-cache
/bower_component
</code></pre>
<p>... | 9,002 | 122,536 | 2016-11-26 22:33:54 | 34,449,268 | 16 | 2015-12-24 07:55:06 | 1,079,354 | 2015-12-24 08:07:50 | https://stackoverflow.com/q/34449222 | https://stackoverflow.com/a/34449268 | <p>The <code>.gitignore</code> file was likely updated after that particular folder's contents were staged. To complete the circle, perform <code>git rm -r --cached .sass-cache/</code>.</p>
<p>Also, you only need one entry for it in <code>.gitignore</code>; preferably, one with a slash at either the front or the end ... | <p>The <code>.gitignore</code> file was likely updated after that particular folder's contents were staged. To complete the circle, perform <code>git rm -r --cached .sass-cache/</code>.</p> <p>Also, you only need one entry for it in <code>.gitignore</code>; preferably, one with a slash at either the front or the end ... | 119 | git | <h1>Why isn't .gitignore ignoring .sass-cache?</h1>
<p>My project looks like this:</p>
<p><a href="https://i.sstatic.net/NaGSC.png" rel="noreferrer"><img src="https://i.sstatic.net/NaGSC.png" alt="enter image description here"></a></p>
<p><strong>.gitignore:</strong></p>
<pre><code>/node_modules
/dist
/.tmp
/.sass-c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,676 | git | # Why isn't .gitignore ignoring .sass-cache?
My project looks like this:
[](https://i.sstatic.net/NaGSC.png)
**.gitignore:**
```
/node_modules
/dist
/.tmp
/.sass-cache
.sass-cache
/bower_component
```
No idea why, but `.sass-cache` is still being stag... | The `.gitignore` file was likely updated after that particular folder's contents were staged. To complete the circle, perform `git rm -r --cached .sass-cache/`.
Also, you only need one entry for it in `.gitignore`; preferably, one with a slash at either the front or the end to denote it as a directory. |
34356401 | Diff between Simulink models .slx | 9 | 2015-12-18 13:05:36 | <p>I am using Git and I am using MATLAB/Simulink. </p>
<p>I know that there is some kind of integration in the new versions of MATLAB/Simulink with Git but I was wondering if there is an easy way to read a <code>git diff</code> between 2 Simulink models which are of the format <code>.slx</code></p>
<p>This can be u... | 14,365 | 2,761,849 | 2020-04-28 17:21:05 | 34,356,491 | 16 | 2015-12-18 13:10:32 | 2,761,849 | 2017-09-27 17:19:04 | https://stackoverflow.com/q/34356401 | https://stackoverflow.com/a/34356491 | <p>I found a solution to my problem.</p>
<ol>
<li>If you are in your repository you MUST have a <code>.git</code> folder.</li>
<li>Go to this folder and open the file <code>config</code> (create it if it is not available, but it should be there normally). </li>
<li><p>Add the following code to the file:</p>
<pre><co... | <p>I found a solution to my problem.</p> <ol> <li>If you are in your repository you MUST have a <code>.git</code> folder.</li> <li>Go to this folder and open the file <code>config</code> (create it if it is not available, but it should be there normally). </li> <li><p>Add the following code to the file:</p> <pre><co... | 119, 606, 854, 3788 | diff, git, matlab, simulink | <h1>Diff between Simulink models .slx</h1>
<p>I am using Git and I am using MATLAB/Simulink. </p>
<p>I know that there is some kind of integration in the new versions of MATLAB/Simulink with Git but I was wondering if there is an easy way to read a <code>git diff</code> between 2 Simulink models which are of the for... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,677 | git | # Diff between Simulink models .slx
I am using Git and I am using MATLAB/Simulink.
I know that there is some kind of integration in the new versions of MATLAB/Simulink with Git but I was wondering if there is an easy way to read a `git diff` between 2 Simulink models which are of the format `.slx`
This can be useful... | I found a solution to my problem.
1. If you are in your repository you MUST have a `.git` folder.
2. Go to this folder and open the file `config` (create it if it is not available, but it should be there normally).
3. Add the following code to the file:
```
[diff "slx"]
textconv = unzip -c -a
```
4. Then ... |
32128072 | What are the differences between arc feature [branch-name] and git branch [branch-name]? | 9 | 2015-08-20 20:46:38 | <p>What are the differences between <code>arc feature [branch-name]</code> and <code>git branch [branch-name]</code>?</p>
<p>They both seem to create a new branch.</p>
| 9,506 | 4,975,679 | 2015-08-21 13:58:05 | 32,142,207 | 16 | 2015-08-21 13:58:05 | 1,396,322 | 2015-08-21 13:58:05 | https://stackoverflow.com/q/32128072 | https://stackoverflow.com/a/32142207 | <p><code>arc feature [branch-name]</code> will:</p>
<ul>
<li>Create a branch based from the commit you currently have checked out,</li>
<li>Set the tracking to the branch you have checked out (this will be to track the local branch, not the branch on your remote),</li>
<li>Check out that branch.</li>
</ul>
<p><code>g... | <p><code>arc feature [branch-name]</code> will:</p> <ul> <li>Create a branch based from the commit you currently have checked out,</li> <li>Set the tracking to the branch you have checked out (this will be to track the local branch, not the branch on your remote),</li> <li>Check out that branch.</li> </ul> <p><code>g... | 119, 80205 | git, phabricator | <h1>What are the differences between arc feature [branch-name] and git branch [branch-name]?</h1>
<p>What are the differences between <code>arc feature [branch-name]</code> and <code>git branch [branch-name]</code>?</p>
<p>They both seem to create a new branch.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,678 | git | # What are the differences between arc feature [branch-name] and git branch [branch-name]?
What are the differences between `arc feature [branch-name]` and `git branch [branch-name]`?
They both seem to create a new branch. | `arc feature [branch-name]` will:
- Create a branch based from the commit you currently have checked out,
- Set the tracking to the branch you have checked out (this will be to track the local branch, not the branch on your remote),
- Check out that branch.
`git branch [branch-name]` will only create a branch based f... |
30464995 | Move remote branch tip from one branch to another | 9 | 2015-05-26 17:19:41 | <p>I did a <code>rebase --onto</code> to move a previous commit (c4) from master to a feature branch. But I had already pushed master to the remote origin.</p>
<p>So currently now I have</p>
<pre><code>c1 - c2 - c3 - c5(master HEAD)
\
c4(feature HEAD) - c5(origin/master HEAD)
</code></pre>
<p>... | 9,356 | 1,046,297 | 2015-05-26 17:28:54 | 30,465,128 | 16 | 2015-05-26 17:28:54 | 782,822 | 2015-05-26 17:28:54 | https://stackoverflow.com/q/30464995 | https://stackoverflow.com/a/30465128 | <p>Use a forced push from master to origin/master:</p>
<pre><code>git push origin master:master --force
</code></pre>
<p>The other developer will need to <code>reset</code> his master to the remote master afterwards (preferably a hard reset after saving his work):</p>
<pre><code>git fetch origin
git checkout master
... | <p>Use a forced push from master to origin/master:</p> <pre><code>git push origin master:master --force </code></pre> <p>The other developer will need to <code>reset</code> his master to the remote master afterwards (preferably a hard reset after saving his work):</p> <pre><code>git fetch origin git checkout master ... | 119, 5597, 8974 | commit, git, rebase | <h1>Move remote branch tip from one branch to another</h1>
<p>I did a <code>rebase --onto</code> to move a previous commit (c4) from master to a feature branch. But I had already pushed master to the remote origin.</p>
<p>So currently now I have</p>
<pre><code>c1 - c2 - c3 - c5(master HEAD)
\
c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,679 | git | # Move remote branch tip from one branch to another
I did a `rebase --onto` to move a previous commit (c4) from master to a feature branch. But I had already pushed master to the remote origin.
So currently now I have
```
c1 - c2 - c3 - c5(master HEAD)
\
c4(feature HEAD) - c5(origin/master HEA... | Use a forced push from master to origin/master:
```
git push origin master:master --force
```
The other developer will need to `reset` his master to the remote master afterwards (preferably a hard reset after saving his work):
```
git fetch origin
git checkout master
git reset --hard origin/master
``` |
20925119 | Git: commit before merge? | 9 | 2014-01-04 18:43:14 | <p>I was advised to commit all my changes before running <code>git pull</code> and merge. Does it make sense ? What if I run <code>pull</code> and <code>merge</code> <em>before</em> committing my changes and commit them <em>after</em> the merge?</p>
| 17,726 | 521,070 | 2015-12-12 03:26:42 | 20,926,048 | 16 | 2014-01-04 20:01:36 | 3,033,674 | 2015-12-12 03:26:42 | https://stackoverflow.com/q/20925119 | https://stackoverflow.com/a/20926048 | <p>Committing before pulling is <strong>not</strong> always advisable -- you should consider stashing your work instead.</p>
<p>A better way to think about this is in terms of your staging area. Ideally, you'd like it to be clean before you attempt to merge in remote changes (remember, <code>git pull</code> = <code>gi... | <p>Committing before pulling is <strong>not</strong> always advisable -- you should consider stashing your work instead.</p> <p>A better way to think about this is in terms of your staging area. Ideally, you'd like it to be clean before you attempt to merge in remote changes (remember, <code>git pull</code> = <code>gi... | 119, 28897, 53850 | git, git-commit, git-merge | <h1>Git: commit before merge?</h1>
<p>I was advised to commit all my changes before running <code>git pull</code> and merge. Does it make sense ? What if I run <code>pull</code> and <code>merge</code> <em>before</em> committing my changes and commit them <em>after</em> the merge?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,682 | git | # Git: commit before merge?
I was advised to commit all my changes before running `git pull` and merge. Does it make sense ? What if I run `pull` and `merge` *before* committing my changes and commit them *after* the merge? | Committing before pulling is **not** always advisable -- you should consider stashing your work instead.
A better way to think about this is in terms of your staging area. Ideally, you'd like it to be clean before you attempt to merge in remote changes (remember, `git pull` = `git fetch` + `git merge`).
`git commit` ... |
18551294 | Git commit -am does not work on initial commit. Why? | 9 | 2013-08-31 18:08:12 | <p>Why does <code>git commit -am</code> not work on my initial commit, but works thereafter?</p>
<pre><code>$ touch test.txt
$ ls -a
. .. .git test.txt
$ git commit -am "Initial commit"
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed... | 8,908 | 225,998 | 2013-08-31 18:09:51 | 18,551,304 | 16 | 2013-08-31 18:09:51 | 1,082,851 | 2013-08-31 18:09:51 | https://stackoverflow.com/q/18551294 | https://stackoverflow.com/a/18551304 | <p>You have to first <code>git add</code> your file to the repo. <code>git commit</code> only commits changes to tracked files, <code>git commit -a</code> will commit all changes to tracked files. But untracked files will not be committed at any point.</p>
<p>You'll find that even on commits after the initial, if you ... | <p>You have to first <code>git add</code> your file to the repo. <code>git commit</code> only commits changes to tracked files, <code>git commit -a</code> will commit all changes to tracked files. But untracked files will not be committed at any point.</p> <p>You'll find that even on commits after the initial, if you ... | 119 | git | <h1>Git commit -am does not work on initial commit. Why?</h1>
<p>Why does <code>git commit -am</code> not work on my initial commit, but works thereafter?</p>
<pre><code>$ touch test.txt
$ ls -a
. .. .git test.txt
$ git commit -am "Initial commit"
# On branch master
#
# Initial commit
#
# Untracked files:
# (use ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,684 | git | # Git commit -am does not work on initial commit. Why?
Why does `git commit -am` not work on my initial commit, but works thereafter?
```
$ touch test.txt
$ ls -a
. .. .git test.txt
$ git commit -am "Initial commit"
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include ... | You have to first `git add` your file to the repo. `git commit` only commits changes to tracked files, `git commit -a` will commit all changes to tracked files. But untracked files will not be committed at any point.
You'll find that even on commits after the initial, if you create a new file it will not be committed ... |
13893763 | How to ask git if the repository is in a conflict stage? | 9 | 2012-12-15 16:01:58 | <p>There are a lot of ways to see, as a human, whether the repository has conflicts that need to be resolved or not.</p>
<p>However, I am looking for a way to check this in a script. That is, to check whether the repository is at a good shape to start doing something to it, or it is at a stage where the user has to fi... | 4,084 | 912,144 | 2024-03-07 05:35:25 | 13,919,728 | 16 | 2012-12-17 18:16:59 | 220,155 | 2012-12-17 18:16:59 | https://stackoverflow.com/q/13893763 | https://stackoverflow.com/a/13919728 | <p>Using <code>git status</code> or similar will be slow on a large repository, as it needs to check the entire working copy's status, as well as the index. We're only interested in the index, so we can use much quicker commands that will just check the index state.</p>
<p>Specifically, we can use <code>git ls-files ... | <p>Using <code>git status</code> or similar will be slow on a large repository, as it needs to check the entire working copy's status, as well as the index. We're only interested in the index, so we can use much quicker commands that will just check the index state.</p> <p>Specifically, we can use <code>git ls-files ... | 119, 1733, 6951 | git, state, status | <h1>How to ask git if the repository is in a conflict stage?</h1>
<p>There are a lot of ways to see, as a human, whether the repository has conflicts that need to be resolved or not.</p>
<p>However, I am looking for a way to check this in a script. That is, to check whether the repository is at a good shape to start d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,686 | git | # How to ask git if the repository is in a conflict stage?
There are a lot of ways to see, as a human, whether the repository has conflicts that need to be resolved or not.
However, I am looking for a way to check this in a script. That is, to check whether the repository is at a good shape to start doing something t... | Using `git status` or similar will be slow on a large repository, as it needs to check the entire working copy's status, as well as the index. We're only interested in the index, so we can use much quicker commands that will just check the index state.
Specifically, we can use `git ls-files --unmerged`. That command w... |
13000247 | Redmine + Gitolite - Issue with repository permissions and more | 9 | 2012-10-21 17:23:53 | <p>I have a Redmine installation on the same server as my gitolite repositories.</p>
<p>In order to link my repository to my Redmine instance, I locally cloned the repo with the following command:</p>
<pre><code>git clone --bare --local /home/git/repositories/my-repo.git
</code></pre>
<p>Just as I successfully clone... | 4,863 | 807,239 | 2012-10-26 15:33:42 | 13,086,803 | 16 | 2012-10-26 12:18:07 | 807,239 | 2012-10-26 13:07:33 | https://stackoverflow.com/q/13000247 | https://stackoverflow.com/a/13086803 | <p>I managed to get it working pointing the original repo to Redmine, since both sit on the same machine, by following some simple steps:</p>
<ol>
<li><p>Add a repository on Redmine with the original repo of gitolite's repository. The path would be something like <code>/home/git/repositories/my-repo.git</code>. </p></... | <p>I managed to get it working pointing the original repo to Redmine, since both sit on the same machine, by following some simple steps:</p> <ol> <li><p>Add a repository on Redmine with the original repo of gitolite's repository. The path would be something like <code>/home/git/repositories/my-repo.git</code>. </p></... | 119, 12495, 39151 | git, gitolite, redmine | <h1>Redmine + Gitolite - Issue with repository permissions and more</h1>
<p>I have a Redmine installation on the same server as my gitolite repositories.</p>
<p>In order to link my repository to my Redmine instance, I locally cloned the repo with the following command:</p>
<pre><code>git clone --bare --local /home/gi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,687 | git | # Redmine + Gitolite - Issue with repository permissions and more
I have a Redmine installation on the same server as my gitolite repositories.
In order to link my repository to my Redmine instance, I locally cloned the repo with the following command:
```
git clone --bare --local /home/git/repositories/my-repo.git
... | I managed to get it working pointing the original repo to Redmine, since both sit on the same machine, by following some simple steps:
1. Add a repository on Redmine with the original repo of gitolite's repository. The path would be something like `/home/git/repositories/my-repo.git`.
2. Initially, Redmine doesn't hav... |
12799872 | Apply a commit chunk by chunk | 9 | 2012-10-09 12:17:24 | <p>When I add a file to staging, I can</p>
<pre><code>$ git add my_file -p
</code></pre>
<p>And select the chunks I want to stage.</p>
<p>Is there a way to merge/cherry-pick a commit and apply its diff chunk by chunk?</p>
<p>Thanks</p>
| 7,851 | 597,465 | 2012-10-09 12:26:59 | 12,800,030 | 16 | 2012-10-09 12:26:59 | 166,732 | 2012-10-09 12:26:59 | https://stackoverflow.com/q/12799872 | https://stackoverflow.com/a/12800030 | <p>I'm not aware of a direct way to do this but here's an indirect way.</p>
<p><code>git cherry-pick -n <commit></code></p>
<p>Cherry pick the commit but tell git not to commit it (<code>-n</code>). The changes should now be in your working copy so you can do</p>
<p><code>git checkout -p</code></p>
<p>This w... | <p>I'm not aware of a direct way to do this but here's an indirect way.</p> <p><code>git cherry-pick -n <commit></code></p> <p>Cherry pick the commit but tell git not to commit it (<code>-n</code>). The changes should now be in your working copy so you can do</p> <p><code>git checkout -p</code></p> <p>This w... | 119, 606, 5597, 9033, 53850 | commit, diff, git, git-commit, git-diff | <h1>Apply a commit chunk by chunk</h1>
<p>When I add a file to staging, I can</p>
<pre><code>$ git add my_file -p
</code></pre>
<p>And select the chunks I want to stage.</p>
<p>Is there a way to merge/cherry-pick a commit and apply its diff chunk by chunk?</p>
<p>Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,688 | git | # Apply a commit chunk by chunk
When I add a file to staging, I can
```
$ git add my_file -p
```
And select the chunks I want to stage.
Is there a way to merge/cherry-pick a commit and apply its diff chunk by chunk?
Thanks | I'm not aware of a direct way to do this but here's an indirect way.
`git cherry-pick -n <commit>`
Cherry pick the commit but tell git not to commit it (`-n`). The changes should now be in your working copy so you can do
`git checkout -p`
This will iterate over each chunk and ask if you want to discard it, say yes ... |
7908381 | Struggling with git, cannot push to new remote repository | 9 | 2011-10-26 20:18:59 | <p>Ok, hopefully this should be easy for you. I'm new to git, BitBucket and somewhat new to version control too, I'm going to be missing something obvious to you.</p>
<p>So here's what I've done: I've installed git on my machine and set my globals. Set up a new repo on BitBucket. Then:</p>
<pre class="lang-sh prettypri... | 6,736 | 465,388 | 2021-01-04 16:26:27 | 7,908,476 | 16 | 2011-10-26 20:26:39 | 526,535 | 2011-10-26 20:26:39 | https://stackoverflow.com/q/7908381 | https://stackoverflow.com/a/7908476 | <p>You will have to do:</p>
<pre><code>git push origin master
</code></pre>
<p>Change origin if you have a different remote.</p>
<p>Change master if you have different branch.</p>
| <p>You will have to do:</p> <pre><code>git push origin master </code></pre> <p>Change origin if you have a different remote.</p> <p>Change master if you have different branch.</p> | 119, 456 | git, version-control | <h1>Struggling with git, cannot push to new remote repository</h1>
<p>Ok, hopefully this should be easy for you. I'm new to git, BitBucket and somewhat new to version control too, I'm going to be missing something obvious to you.</p>
<p>So here's what I've done: I've installed git on my machine and set my globals. Set ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,690 | git | # Struggling with git, cannot push to new remote repository
Ok, hopefully this should be easy for you. I'm new to git, BitBucket and somewhat new to version control too, I'm going to be missing something obvious to you.
So here's what I've done: I've installed git on my machine and set my globals. Set up a new repo o... | You will have to do:
```
git push origin master
```
Change origin if you have a different remote.
Change master if you have different branch. |
6922590 | How to replace current branch's head with specific commit in git? | 9 | 2011-08-03 06:41:27 | <p>If I simply do "checkout some_commit" it will switch me to this commit. But what I need is to stay on the current branch (master to be specific) and totally replace all files in it with files from some_commit. How can I do that?</p>
| 5,464 | 499,439 | 2011-08-03 09:26:37 | 6,922,605 | 16 | 2011-08-03 06:43:31 | 119,963 | 2011-08-03 06:43:31 | https://stackoverflow.com/q/6922590 | https://stackoverflow.com/a/6922605 | <p><code>git reset --hard <commit></code></p>
<p>(I'm sure this is a duplicate, but don't have time to search.)</p>
| <p><code>git reset --hard <commit></code></p> <p>(I'm sure this is a duplicate, but don't have time to search.)</p> | 119 | git | <h1>How to replace current branch's head with specific commit in git?</h1>
<p>If I simply do "checkout some_commit" it will switch me to this commit. But what I need is to stay on the current branch (master to be specific) and totally replace all files in it with files from some_commit. How can I do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,691 | git | # How to replace current branch's head with specific commit in git?
If I simply do "checkout some_commit" it will switch me to this commit. But what I need is to stay on the current branch (master to be specific) and totally replace all files in it with files from some_commit. How can I do that? | `git reset --hard <commit>`
(I'm sure this is a duplicate, but don't have time to search.) |
2404628 | How do I join two git repos without a common root, where all modified files are the same? | 9 | 2010-03-08 20:49:51 | <p>I have a <code>git-cpan-init</code> of a repo which yielded a different root node from another already established git repo I found on github <a href="http://github.com/EvanCarroll/Catalyst-Authentication-Store-DBI" rel="noreferrer">C:A:S:DBI</a>. I've developed quite a bit on my repo, and I'd like to merge or repl... | 4,814 | 124,486 | 2010-03-08 22:20:37 | 2,404,716 | 16 | 2010-03-08 21:04:07 | 19,563 | 2010-03-08 21:04:07 | https://stackoverflow.com/q/2404628 | https://stackoverflow.com/a/2404716 | <p>You should be able to add a remote to your existing repository (using <code>git remote add</code>) so that you can fetch the contents of the github repository into your existing repository.</p>
<p>Assuming that you have a commit in your history (call it O) and a commit in the remote branch (call it R) that correspo... | <p>You should be able to add a remote to your existing repository (using <code>git remote add</code>) so that you can fetch the contents of the github repository into your existing repository.</p> <p>Assuming that you have a commit in your history (call it O) and a commit in the remote branch (call it R) that correspo... | 119 | git | <h1>How do I join two git repos without a common root, where all modified files are the same?</h1>
<p>I have a <code>git-cpan-init</code> of a repo which yielded a different root node from another already established git repo I found on github <a href="http://github.com/EvanCarroll/Catalyst-Authentication-Store-DBI" re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,692 | git | # How do I join two git repos without a common root, where all modified files are the same?
I have a `git-cpan-init` of a repo which yielded a different root node from another already established git repo I found on github [C:A:S:DBI](http://github.com/EvanCarroll/Catalyst-Authentication-Store-DBI). I've developed qui... | You should be able to add a remote to your existing repository (using `git remote add`) so that you can fetch the contents of the github repository into your existing repository.
Assuming that you have a commit in your history (call it O) and a commit in the remote branch (call it R) that correspond to the same set of... |
1717278 | git hooks and how they work | 9 | 2009-11-11 18:47:24 | <p>So I'm trying to get hudson to build with a post-receive hook. In my local git repo I set post-receive.sample to just post-receive, chmod 755 and added in the line:</p>
<pre><code>/usr/bin/curl -u user:secret http://localhost:8080/hudson/job/MyJob/build?token=secondsecret
</code></pre>
<p>If I force a build, huds... | 11,270 | 74,389 | 2009-11-11 19:57:35 | 1,717,671 | 16 | 2009-11-11 19:57:35 | 182,675 | 2009-11-11 19:57:35 | https://stackoverflow.com/q/1717278 | https://stackoverflow.com/a/1717671 | <p>You basically have two options:</p>
<ol>
<li>Place the <code>post-receive</code> hook on the <em>server</em> and let the server run curl.</li>
<li>Place a <code>post-commit</code> hook on your local repo and let your local box run curl.</li>
</ol>
<p>As your build job will probably fetch the code to build from the... | <p>You basically have two options:</p> <ol> <li>Place the <code>post-receive</code> hook on the <em>server</em> and let the server run curl.</li> <li>Place a <code>post-commit</code> hook on your local repo and let your local box run curl.</li> </ol> <p>As your build job will probably fetch the code to build from the... | 119, 853 | git, hook | <h1>git hooks and how they work</h1>
<p>So I'm trying to get hudson to build with a post-receive hook. In my local git repo I set post-receive.sample to just post-receive, chmod 755 and added in the line:</p>
<pre><code>/usr/bin/curl -u user:secret http://localhost:8080/hudson/job/MyJob/build?token=secondsecret
</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,693 | git | # git hooks and how they work
So I'm trying to get hudson to build with a post-receive hook. In my local git repo I set post-receive.sample to just post-receive, chmod 755 and added in the line:
```
/usr/bin/curl -u user:secret http://localhost:8080/hudson/job/MyJob/build?token=secondsecret
```
If I force a build, h... | You basically have two options:
1. Place the `post-receive` hook on the *server* and let the server run curl.
2. Place a `post-commit` hook on your local repo and let your local box run curl.
As your build job will probably fetch the code to build from the repo on the *server*, only option 1. makes sense. In case 2.,... |
1456275 | deploying with capistrano with remote git repo but without git running on production server | 9 | 2009-09-21 19:11:50 | <p>I have a remote git repository setup for centralized development within my team. However, the production server that we deploy our applications currently does not have git running on it. We want to use capistrano to deploy our applications how can we set up our deploy recipes to 'pull' from the remote git repositori... | 5,908 | 114,305 | 2012-11-30 00:12:04 | 1,562,497 | 16 | 2009-10-13 19:41:24 | 105,938 | 2012-11-30 00:12:04 | https://stackoverflow.com/q/1456275 | https://stackoverflow.com/a/1562497 | <p>The solution in your question is close to correct. You'll need to specify your git repository a little differently, though. What you need is:</p>
<pre><code>set :repository, "someuser@somehost:/home/myproject"
set :scm, "git"
set :deploy_via, :copy
</code></pre>
<p>There's more examples of how to set up git deploy... | <p>The solution in your question is close to correct. You'll need to specify your git repository a little differently, though. What you need is:</p> <pre><code>set :repository, "someuser@somehost:/home/myproject" set :scm, "git" set :deploy_via, :copy </code></pre> <p>There's more examples of how to set up git deploy... | 119, 2831, 4984 | capistrano, git, ruby-on-rails | <h1>deploying with capistrano with remote git repo but without git running on production server</h1>
<p>I have a remote git repository setup for centralized development within my team. However, the production server that we deploy our applications currently does not have git running on it. We want to use capistrano to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,694 | git | # deploying with capistrano with remote git repo but without git running on production server
I have a remote git repository setup for centralized development within my team. However, the production server that we deploy our applications currently does not have git running on it. We want to use capistrano to deploy ou... | The solution in your question is close to correct. You'll need to specify your git repository a little differently, though. What you need is:
```
set :repository, "someuser@somehost:/home/myproject"
set :scm, "git"
set :deploy_via, :copy
```
There's more examples of how to set up git deployment in your Capistrano gem... |
75407638 | How can I Git bisect where a bad commit is an ancestor of a good commit / find the fix commit? | 8 | 2023-02-10 06:32:33 | <p>I have the following situation:</p>
<ol>
<li>A bug was reported long ago at commit <code>0badcommit</code> in the project, and it went unnoticed.</li>
<li>When cleaning up tickets recently, this ticket was found, but the issue no longer exists on the latest <code>main</code> branch.</li>
</ol>
<p>I want to find whic... | 1,357 | 3,715,736 | 2025-05-13 14:05:57 | 75,408,085 | 16 | 2023-02-10 07:30:14 | 3,715,736 | 2025-05-13 11:01:46 | https://stackoverflow.com/q/75407638 | https://stackoverflow.com/a/75408085 | <p>In addition to the great suggestion in <a href="https://stackoverflow.com/questions/75407638/how-can-i-git-bisect-where-a-bad-commit-is-an-ancestor-of-a-good-commit-find-t/75407777#75407777">1615903's answer</a>, we can define our own good and bad "terms" with <code>git bisect</code> which makes it easier ... | <p>In addition to the great suggestion in <a href="https://stackoverflow.com/questions/75407638/how-can-i-git-bisect-where-a-bad-commit-is-an-ancestor-of-a-good-commit-find-t/75407777#75407777">1615903's answer</a>, we can define our own good and bad "terms" with <code>git bisect</code> which makes it easier ... | 119, 47326 | git, git-bisect | <h1>How can I Git bisect where a bad commit is an ancestor of a good commit / find the fix commit?</h1>
<p>I have the following situation:</p>
<ol>
<li>A bug was reported long ago at commit <code>0badcommit</code> in the project, and it went unnoticed.</li>
<li>When cleaning up tickets recently, this ticket was found, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,695 | git | # How can I Git bisect where a bad commit is an ancestor of a good commit / find the fix commit?
I have the following situation:
1. A bug was reported long ago at commit `0badcommit` in the project, and it went unnoticed.
2. When cleaning up tickets recently, this ticket was found, but the issue no longer exists on t... | In addition to the great suggestion in [1615903's answer](https://stackoverflow.com/questions/75407638/how-can-i-git-bisect-where-a-bad-commit-is-an-ancestor-of-a-good-commit-find-t/75407777#75407777), we can define our own good and bad "terms" with `git bisect` which makes it easier to retain the correct context.
For... |
61735166 | Git: Revert a single file to its last commit | 8 | 2020-05-11 17:01:25 | <p>I want to revert a file to its state on its last commit.</p>
<p>I have modified, added and committed other files.
But there is that one file that I didn't stage. </p>
<p>I want to revert it's state (only the state of that file) to the last commit that that file was committed.</p>
<p>In other words, I just want t... | 30,394 | 10,386,434 | 2020-05-11 17:34:32 | 61,735,720 | 16 | 2020-05-11 17:34:32 | 8,250,693 | 2020-05-11 17:34:32 | https://stackoverflow.com/q/61735166 | https://stackoverflow.com/a/61735720 | <p>You can use:</p>
<pre><code> git checkout <file-with-path>
</code></pre>
<p>Or</p>
<pre><code> git restore <file-with-path>
</code></pre>
<p>Git checkout would work if you had already committed the file. If the file was already staged you could add --staged flag to git restore to restore it as ... | <p>You can use:</p> <pre><code> git checkout <file-with-path> </code></pre> <p>Or</p> <pre><code> git restore <file-with-path> </code></pre> <p>Git checkout would work if you had already committed the file. If the file was already staged you could add --staged flag to git restore to restore it as ... | 119 | git | <h1>Git: Revert a single file to its last commit</h1>
<p>I want to revert a file to its state on its last commit.</p>
<p>I have modified, added and committed other files.
But there is that one file that I didn't stage. </p>
<p>I want to revert it's state (only the state of that file) to the last commit that that fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,704 | git | # Git: Revert a single file to its last commit
I want to revert a file to its state on its last commit.
I have modified, added and committed other files.
But there is that one file that I didn't stage.
I want to revert it's state (only the state of that file) to the last commit that that file was committed.
In othe... | You can use:
```
git checkout <file-with-path>
```
Or
```
git restore <file-with-path>
```
Git checkout would work if you had already committed the file. If the file was already staged you could add --staged flag to git restore to restore it as well.
<https://git-scm.com/docs/git-restore> |
52463238 | How to abort merging when conflicts occur in IntelliJ Idea | 8 | 2018-09-23 05:21:46 | <p>I use IntelliJ Idea with Git. When I pull from repository, I get Merge Conflict error.
On the bottom right of IDEA shows <code>merging feature/branch-XXX</code> after the conflicts.
Now I want to <strong>abort</strong> this pull(merge). </p>
<p>I could <strong>reset</strong> the current branch to <strong>clean stat... | 15,830 | 4,983,501 | 2020-01-09 09:19:02 | 52,463,546 | 16 | 2018-09-23 06:20:29 | 6,309 | 2020-01-09 09:19:02 | https://stackoverflow.com/q/52463238 | https://stackoverflow.com/a/52463546 | <p>conveniently? Not yet (Sept. 2018), not before 2019.2 (see below)</p>
<p>This is what <a href="https://youtrack.jetbrains.com/issue/IDEA-119995" rel="noreferrer">issue IDEA-119995</a> is for.</p>
<blockquote>
<p>Git: provide possibility to abort merge process</p>
</blockquote>
<p>Before 2019.2, you had to switch to ... | <p>conveniently? Not yet (Sept. 2018), not before 2019.2 (see below)</p> <p>This is what <a href="https://youtrack.jetbrains.com/issue/IDEA-119995" rel="noreferrer">issue IDEA-119995</a> is for.</p> <blockquote> <p>Git: provide possibility to abort merge process</p> </blockquote> <p>Before 2019.2, you had to switch to ... | 119, 8945 | git, intellij-idea | <h1>How to abort merging when conflicts occur in IntelliJ Idea</h1>
<p>I use IntelliJ Idea with Git. When I pull from repository, I get Merge Conflict error.
On the bottom right of IDEA shows <code>merging feature/branch-XXX</code> after the conflicts.
Now I want to <strong>abort</strong> this pull(merge). </p>
<p>I c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,707 | git | # How to abort merging when conflicts occur in IntelliJ Idea
I use IntelliJ Idea with Git. When I pull from repository, I get Merge Conflict error.
On the bottom right of IDEA shows `merging feature/branch-XXX` after the conflicts.
Now I want to **abort** this pull(merge).
I could **reset** the current branch to **cl... | conveniently? Not yet (Sept. 2018), not before 2019.2 (see below)
This is what [issue IDEA-119995](https://youtrack.jetbrains.com/issue/IDEA-119995) is for.
> Git: provide possibility to abort merge process
Before 2019.2, you had to switch to the terminal [and type `git merge --abort`](https://stackoverflow.com/a/25... |
45193055 | Is it possible to sign-off a Merge Commit in Git? | 8 | 2017-07-19 14:07:00 | <p>I have to sign off my every commit to push to the origin. However, merge commits are not signed off, I use sourcetree and also the git console, could not sign-off a merge commit. Is there a way that could be done?</p>
| 11,096 | 1,478,315 | 2017-09-03 21:48:37 | 45,193,125 | 16 | 2017-07-19 14:09:36 | 2,437,508 | 2017-07-31 08:14:12 | https://stackoverflow.com/q/45193055 | https://stackoverflow.com/a/45193125 | <p>You can run <code>git commit --amend --no-edit -s</code> after merge is done.</p>
| <p>You can run <code>git commit --amend --no-edit -s</code> after merge is done.</p> | 119, 28897, 90056 | atlassian-sourcetree, git, git-merge | <h1>Is it possible to sign-off a Merge Commit in Git?</h1>
<p>I have to sign off my every commit to push to the origin. However, merge commits are not signed off, I use sourcetree and also the git console, could not sign-off a merge commit. Is there a way that could be done?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,708 | git | # Is it possible to sign-off a Merge Commit in Git?
I have to sign off my every commit to push to the origin. However, merge commits are not signed off, I use sourcetree and also the git console, could not sign-off a merge commit. Is there a way that could be done? | You can run `git commit --amend --no-edit -s` after merge is done. |
42756448 | What text editor is git using? | 8 | 2017-03-13 04:00:37 | <p>I am new to git.</p>
<p>When I enter <code>git commit</code> into command prompt, it changes to some kind of text editor in that same command prompt window. What is this text editor? Is it Vim? Emacs? I have downloaded neither of these.</p>
<p>I want to know what it's called so that I can look up how to use it. I ... | 27,590 | 2,122,672 | 2023-02-06 17:40:13 | 42,756,469 | 16 | 2017-03-13 04:04:16 | 2,564,920 | 2021-08-22 11:40:50 | https://stackoverflow.com/q/42756448 | https://stackoverflow.com/a/42756469 | <p>It should be default to your default text editor, and if not found, default to <a href="https://en.wikipedia.org/wiki/Vi" rel="noreferrer">vi</a> (which is like a lightweight Vim. For more information, check out other site, like <em><a href="https://www.cs.colostate.edu/helpdocs/vi.html" rel="noreferrer">What is vi?... | <p>It should be default to your default text editor, and if not found, default to <a href="https://en.wikipedia.org/wiki/Vi" rel="noreferrer">vi</a> (which is like a lightweight Vim. For more information, check out other site, like <em><a href="https://www.cs.colostate.edu/helpdocs/vi.html" rel="noreferrer">What is vi?... | 119 | git | <h1>What text editor is git using?</h1>
<p>I am new to git.</p>
<p>When I enter <code>git commit</code> into command prompt, it changes to some kind of text editor in that same command prompt window. What is this text editor? Is it Vim? Emacs? I have downloaded neither of these.</p>
<p>I want to know what it's called... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,709 | git | # What text editor is git using?
I am new to git.
When I enter `git commit` into command prompt, it changes to some kind of text editor in that same command prompt window. What is this text editor? Is it Vim? Emacs? I have downloaded neither of these.
I want to know what it's called so that I can look up how to use ... | It should be default to your default text editor, and if not found, default to [vi](https://en.wikipedia.org/wiki/Vi) (which is like a lightweight Vim. For more information, check out other site, like *[What is vi?](https://www.cs.colostate.edu/helpdocs/vi.html)*)
If you want to change to your favorite editor, use
``... |
42022972 | Keeping multiple .gitignore files (local and remote) in the same repository | 8 | 2017-02-03 11:17:11 | <p>I have a repository with a .gitignore file, which excludes build paths (eg. <code>vendor/</code> from Composer).</p>
<p>I also have some local IDE paths (eg. <code>.idea</code> from PhpStorm) that I want to ignore, but that aren't in the repository's .gitignore file.</p>
<p>I'm not sure how to do this. If git look... | 2,169 | 2,832,011 | 2017-02-03 11:24:11 | 42,023,134 | 16 | 2017-02-03 11:24:11 | 7,179,161 | 2017-02-03 11:24:11 | https://stackoverflow.com/q/42022972 | https://stackoverflow.com/a/42023134 | <p>For local ignores, you can add them to the <code>.git/info/exclude</code> file. This is not shared to remote repositories.</p>
<p>So add to <code>.gitignore</code> all the files that should be ignored by anyone working with the repository. Add to <code>.git/info/exclude</code> files you use personnally but other pe... | <p>For local ignores, you can add them to the <code>.git/info/exclude</code> file. This is not shared to remote repositories.</p> <p>So add to <code>.gitignore</code> all the files that should be ignored by anyone working with the repository. Add to <code>.git/info/exclude</code> files you use personnally but other pe... | 119, 25056 | git, gitignore | <h1>Keeping multiple .gitignore files (local and remote) in the same repository</h1>
<p>I have a repository with a .gitignore file, which excludes build paths (eg. <code>vendor/</code> from Composer).</p>
<p>I also have some local IDE paths (eg. <code>.idea</code> from PhpStorm) that I want to ignore, but that aren't ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,710 | git | # Keeping multiple .gitignore files (local and remote) in the same repository
I have a repository with a .gitignore file, which excludes build paths (eg. `vendor/` from Composer).
I also have some local IDE paths (eg. `.idea` from PhpStorm) that I want to ignore, but that aren't in the repository's .gitignore file.
... | For local ignores, you can add them to the `.git/info/exclude` file. This is not shared to remote repositories.
So add to `.gitignore` all the files that should be ignored by anyone working with the repository. Add to `.git/info/exclude` files you use personnally but other people have no reason to have them, therefore... |
30912024 | Is `pull` needed after checking out a new branch? | 8 | 2015-06-18 09:49:26 | <p>In case of a git-project with several branches, the question is when you checkout a new branch (first time), is a <code>git pull</code> needed ?</p>
<pre><code>$master> git checkout branchA
$branchA> git pull
</code></pre>
<p>Note that the idea here is that both commands are executed right after each other (... | 14,820 | 419,425 | 2015-06-18 10:22:51 | 30,912,740 | 16 | 2015-06-18 10:22:51 | 2,371,600 | 2015-06-18 10:22:51 | https://stackoverflow.com/q/30912024 | https://stackoverflow.com/a/30912740 | <p>If the branch is already on origin and you do not have a local copy and you check it out, then it will contain all commits anyway so you do not need the pull after.
If you already have a local copy of the branch it will checkout that one, and in that case you use <code>git fetch origin</code> to see if there have be... | <p>If the branch is already on origin and you do not have a local copy and you check it out, then it will contain all commits anyway so you do not need the pull after. If you already have a local copy of the branch it will checkout that one, and in that case you use <code>git fetch origin</code> to see if there have be... | 119, 28896, 37230 | git, git-checkout, git-pull | <h1>Is `pull` needed after checking out a new branch?</h1>
<p>In case of a git-project with several branches, the question is when you checkout a new branch (first time), is a <code>git pull</code> needed ?</p>
<pre><code>$master> git checkout branchA
$branchA> git pull
</code></pre>
<p>Note that the idea here ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,714 | git | # Is `pull` needed after checking out a new branch?
In case of a git-project with several branches, the question is when you checkout a new branch (first time), is a `git pull` needed ?
```
$master> git checkout branchA
$branchA> git pull
```
Note that the idea here is that both commands are executed right after eac... | If the branch is already on origin and you do not have a local copy and you check it out, then it will contain all commits anyway so you do not need the pull after.
If you already have a local copy of the branch it will checkout that one, and in that case you use `git fetch origin` to see if there have been any changes... |
28791955 | If you use the git diff command, how do you get out of that mess? | 8 | 2015-03-01 09:26:44 | <p>I'm trying to use Git, within a Git Bash terminal-window on MS Windows 8.1</p>
<p>When I enter: <code>$git diff file1</code>
to see the changes in a given file, it then presents me with a <code>:</code> prompt. </p>
<p>How does one get out of that mode, short of closing the whole terminal-window and starting over ... | 4,667 | 3,424,794 | 2017-02-18 03:53:38 | 28,792,175 | 16 | 2015-03-01 09:54:53 | 827,263 | 2017-02-18 03:53:38 | https://stackoverflow.com/q/28791955 | https://stackoverflow.com/a/28792175 | <p>To get away from the <code>:</code> prompt, type <code>q</code>.</p>
<p><code>git diff</code>, like many git commands, pipes its output through a pager by default. The default pager is typically <code>less</code>, and the <code>less</code> command uses <code>:</code> as its default prompt.</p>
<p>You should see th... | <p>To get away from the <code>:</code> prompt, type <code>q</code>.</p> <p><code>git diff</code>, like many git commands, pipes its output through a pager by default. The default pager is typically <code>less</code>, and the <code>less</code> command uses <code>:</code> as its default prompt.</p> <p>You should see th... | 119 | git | <h1>If you use the git diff command, how do you get out of that mess?</h1>
<p>I'm trying to use Git, within a Git Bash terminal-window on MS Windows 8.1</p>
<p>When I enter: <code>$git diff file1</code>
to see the changes in a given file, it then presents me with a <code>:</code> prompt. </p>
<p>How does one get out ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,715 | git | # If you use the git diff command, how do you get out of that mess?
I'm trying to use Git, within a Git Bash terminal-window on MS Windows 8.1
When I enter: `$git diff file1`
to see the changes in a given file, it then presents me with a `:` prompt.
How does one get out of that mode, short of closing the whole termi... | To get away from the `:` prompt, type `q`.
`git diff`, like many git commands, pipes its output through a pager by default. The default pager is typically `less`, and the `less` command uses `:` as its default prompt.
You should see the same thing for `git log` and so forth.
Type `man less` at your shell prompt to l... |
26335258 | How to revert multiple files (but not all) to a past commit? | 8 | 2014-10-13 07:54:58 | <p>I need to revert a bunch of files (about 40-50) to a specific commit. However, I don't want to revert all the files. How do I do that without doing a per-file checkout for each of the files I need to revert? All the files I need to revert are located under a single folder.</p>
| 7,382 | 1,755,847 | 2018-01-13 04:04:31 | 26,335,507 | 16 | 2014-10-13 08:14:35 | 1,755,847 | 2018-01-13 04:04:31 | https://stackoverflow.com/q/26335258 | https://stackoverflow.com/a/26335507 | <p>I already found out the solution.</p>
<pre><code>git checkout master~1 ./FolderIWantToRevert ./AnotherFolderToRevert
</code></pre>
<p>Do note that I wanted to revert to the previous commit, that's why there's the <code>~1</code> after <code>master</code>.</p>
| <p>I already found out the solution.</p> <pre><code>git checkout master~1 ./FolderIWantToRevert ./AnotherFolderToRevert </code></pre> <p>Do note that I wanted to revert to the previous commit, that's why there's the <code>~1</code> after <code>master</code>.</p> | 119, 12309 | git, revert | <h1>How to revert multiple files (but not all) to a past commit?</h1>
<p>I need to revert a bunch of files (about 40-50) to a specific commit. However, I don't want to revert all the files. How do I do that without doing a per-file checkout for each of the files I need to revert? All the files I need to revert are loca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,716 | git | # How to revert multiple files (but not all) to a past commit?
I need to revert a bunch of files (about 40-50) to a specific commit. However, I don't want to revert all the files. How do I do that without doing a per-file checkout for each of the files I need to revert? All the files I need to revert are located under... | I already found out the solution.
```
git checkout master~1 ./FolderIWantToRevert ./AnotherFolderToRevert
```
Do note that I wanted to revert to the previous commit, that's why there's the `~1` after `master`. |
24060863 | Differences between MinGW from msysgit (aka Git on Windows) and MinGW from MinGW.org | 8 | 2014-06-05 12:58:02 | <p>I have installed msysgit via the net installer. I ended up with almost 2 giga of material, where I have among the other things git sources and MinGW.</p>
<p>I have three questions</p>
<ul>
<li><p>I already had MinGW from MinGW.org. Now I think I can remove the latter and stay with msysgit distribution. Anyway Mi... | 4,506 | 1,851,270 | 2018-02-09 08:21:44 | 24,061,134 | 16 | 2014-06-05 13:09:13 | 256,138 | 2018-02-09 08:21:44 | https://stackoverflow.com/q/24060863 | https://stackoverflow.com/a/24061134 | <p>Well, there a few misconceptions at play here. Let's first get them out of the way:</p>
<ol>
<li><p>The Unix-like shell environment you are talking about is called MSYS. It was originally developed by MinGW.org as a fork of Cygwin. This was in turn forked to be improved slightly so that git could run with it, which... | <p>Well, there a few misconceptions at play here. Let's first get them out of the way:</p> <ol> <li><p>The Unix-like shell environment you are talking about is called MSYS. It was originally developed by MinGW.org as a fork of Cygwin. This was in turn forked to be improved slightly so that git could run with it, which... | 119, 4086, 13232, 21628 | git, mingw, msys, msysgit | <h1>Differences between MinGW from msysgit (aka Git on Windows) and MinGW from MinGW.org</h1>
<p>I have installed msysgit via the net installer. I ended up with almost 2 giga of material, where I have among the other things git sources and MinGW.</p>
<p>I have three questions</p>
<ul>
<li><p>I already had MinGW from... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,717 | git | # Differences between MinGW from msysgit (aka Git on Windows) and MinGW from MinGW.org
I have installed msysgit via the net installer. I ended up with almost 2 giga of material, where I have among the other things git sources and MinGW.
I have three questions
- I already had MinGW from MinGW.org. Now I think I can r... | Well, there a few misconceptions at play here. Let's first get them out of the way:
1. The Unix-like shell environment you are talking about is called MSYS. It was originally developed by MinGW.org as a fork of Cygwin. This was in turn forked to be improved slightly so that git could run with it, which became msysgit.... |
15284109 | command to determine the upstream ref of the current HEAD? | 8 | 2013-03-07 23:44:52 | <p>I'm looking for what I hope is the <em>simple one line command</em> to determine the the correct upstream ref for the currently checked out branch?</p>
<p>Essentially <em>something like</em> </p>
<p><code>git branch --remote HEAD</code> </p>
<p>which (if it worked) would convert the symbolic pattern HEAD to the c... | 1,525 | 717,355 | 2014-08-01 20:59:01 | 15,284,176 | 16 | 2013-03-07 23:50:24 | 981,959 | 2013-03-07 23:50:24 | https://stackoverflow.com/q/15284109 | https://stackoverflow.com/a/15284176 | <p>I think you want</p>
<pre><code>git rev-parse --symbolic-full-name @{u}
</code></pre>
<p><code>@{u}</code> is the abbreviation for the upstream tracking branch of <code>HEAD</code> and the option tells <code>rev-parse</code> to print it in the format you want, rather than printing an SHA commit ID.</p>
<p>From <c... | <p>I think you want</p> <pre><code>git rev-parse --symbolic-full-name @{u} </code></pre> <p><code>@{u}</code> is the abbreviation for the upstream tracking branch of <code>HEAD</code> and the option tells <code>rev-parse</code> to print it in the format you want, rather than printing an SHA commit ID.</p> <p>From <c... | 119, 76220 | git, git-branch | <h1>command to determine the upstream ref of the current HEAD?</h1>
<p>I'm looking for what I hope is the <em>simple one line command</em> to determine the the correct upstream ref for the currently checked out branch?</p>
<p>Essentially <em>something like</em> </p>
<p><code>git branch --remote HEAD</code> </p>
<p>w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,718 | git | # command to determine the upstream ref of the current HEAD?
I'm looking for what I hope is the *simple one line command* to determine the the correct upstream ref for the currently checked out branch?
Essentially *something like*
`git branch --remote HEAD`
which (if it worked) would convert the symbolic pattern HE... | I think you want
```
git rev-parse --symbolic-full-name @{u}
```
`@{u}` is the abbreviation for the upstream tracking branch of `HEAD` and the option tells `rev-parse` to print it in the format you want, rather than printing an SHA commit ID.
From `git help rev-parse`
```
--symbolic
Usually the object nam... |
4247577 | How to find 'lost' code with a constant in Git | 8 | 2010-11-22 16:18:32 | <p>Once upon a time, one bad guy had deleted a constant from the source code managed through our Git repository.</p>
<p>Nobody has noticed this for a loooong time.... until now.</p>
<p>Yet I want to figure out in which commit this constant is gone, and who the bad guy is.</p>
<p>I only know the constant's name was <... | 2,113 | 130,024 | 2020-05-13 23:11:41 | 4,247,614 | 16 | 2010-11-22 16:21:52 | 501,250 | 2010-11-22 16:29:35 | https://stackoverflow.com/q/4247577 | https://stackoverflow.com/a/4247614 | <p>This will list all commits that added or removed the string FOOBAR from any file:</p>
<pre><code>git log --all -p -SFOOBAR
</code></pre>
| <p>This will list all commits that added or removed the string FOOBAR from any file:</p> <pre><code>git log --all -p -SFOOBAR </code></pre> | 119, 456 | git, version-control | <h1>How to find 'lost' code with a constant in Git</h1>
<p>Once upon a time, one bad guy had deleted a constant from the source code managed through our Git repository.</p>
<p>Nobody has noticed this for a loooong time.... until now.</p>
<p>Yet I want to figure out in which commit this constant is gone, and who the b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,719 | git | # How to find 'lost' code with a constant in Git
Once upon a time, one bad guy had deleted a constant from the source code managed through our Git repository.
Nobody has noticed this for a loooong time.... until now.
Yet I want to figure out in which commit this constant is gone, and who the bad guy is.
I only know... | This will list all commits that added or removed the string FOOBAR from any file:
```
git log --all -p -SFOOBAR
``` |
2006422 | How to join two different git repositories into one with two branches? | 8 | 2010-01-05 13:56:56 | <p>I want to join two different git repositories into one repository with two branches. Is it possible? How?</p>
| 901 | 179,804 | 2013-01-09 11:39:06 | 2,006,494 | 16 | 2010-01-05 14:11:34 | 189,179 | 2013-01-09 11:39:06 | https://stackoverflow.com/q/2006422 | https://stackoverflow.com/a/2006494 | <p>Create a new repository, then add both of these repositories as remotes:</p>
<pre><code>git remote add origin1 ...
git remote add origin2 ...
</code></pre>
<p>Fetch from both:</p>
<pre><code>git fetch origin1
git fetch origin2
</code></pre>
<p>Create a local branch to track a branch of each remote (assuming the ... | <p>Create a new repository, then add both of these repositories as remotes:</p> <pre><code>git remote add origin1 ... git remote add origin2 ... </code></pre> <p>Fetch from both:</p> <pre><code>git fetch origin1 git fetch origin2 </code></pre> <p>Create a local branch to track a branch of each remote (assuming the ... | 119 | git | <h1>How to join two different git repositories into one with two branches?</h1>
<p>I want to join two different git repositories into one repository with two branches. Is it possible? How?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,720 | git | # How to join two different git repositories into one with two branches?
I want to join two different git repositories into one repository with two branches. Is it possible? How? | Create a new repository, then add both of these repositories as remotes:
```
git remote add origin1 ...
git remote add origin2 ...
```
Fetch from both:
```
git fetch origin1
git fetch origin2
```
Create a local branch to track a branch of each remote (assuming the master):
```
git branch branch1 origin1/master
git... |
1939313 | How to get a remote URI | 8 | 2009-12-21 10:22:01 | <p>I'd like to get an address of my remote repository, ideally one line only. Ideal would be something like</p>
<pre><code>$ git remote show origin fetch_url --some-params-im-not-aware-of
git://github.com/ask/celery.git
</code></pre>
| 12,284 | 123,558 | 2023-08-30 13:36:20 | 1,939,321 | 16 | 2009-12-21 10:24:11 | 229,753 | 2009-12-21 11:10:52 | https://stackoverflow.com/q/1939313 | https://stackoverflow.com/a/1939321 | <p>Simple: <code>git config remote.origin.url</code></p>
| <p>Simple: <code>git config remote.origin.url</code></p> | 119 | git | <h1>How to get a remote URI</h1>
<p>I'd like to get an address of my remote repository, ideally one line only. Ideal would be something like</p>
<pre><code>$ git remote show origin fetch_url --some-params-im-not-aware-of
git://github.com/ask/celery.git
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,721 | git | # How to get a remote URI
I'd like to get an address of my remote repository, ideally one line only. Ideal would be something like
```
$ git remote show origin fetch_url --some-params-im-not-aware-of
git://github.com/ask/celery.git
``` | Simple: `git config remote.origin.url` |
73785436 | Azure DevOps pipeline task `task: gitversion/execute@0` fails with unexpected error "##[error]SyntaxError: Unexpected end of JSON input" | 7 | 2022-09-20 10:45:30 | <p>I was running the pipeline with a simple task to install the git and check the version by the following <code>tasks</code>.</p>
<p>Everything was running well till the time I created another temporary pipeline with the same yaml file for some additional tests and development.</p>
<p>I did not change anything from th... | 13,968 | 13,550,201 | 2025-04-07 16:52:09 | 73,801,475 | 16 | 2022-09-21 13:21:08 | 13,464,420 | 2022-09-21 13:21:08 | https://stackoverflow.com/q/73785436 | https://stackoverflow.com/a/73801475 | <p>The cause of the issue could be related to the fetch depth of the Pipeline repo.</p>
<p>By default, the Shallow fetch of the pipeline repo is 1 by default.</p>
<p>You can try to set the <strong>fetchDepth</strong> to <strong>0</strong> in YAML Pipeline.</p>
<p>For example:</p>
<pre><code>steps:
- checkout: self... | <p>The cause of the issue could be related to the fetch depth of the Pipeline repo.</p> <p>By default, the Shallow fetch of the pipeline repo is 1 by default.</p> <p>You can try to set the <strong>fetchDepth</strong> to <strong>0</strong> in YAML Pipeline.</p> <p>For example:</p> <pre><code>steps: - checkout: self... | 2844, 110771, 116537, 139136 | azure-devops, azure-pipelines-yaml, gitversion, pipeline | <h1>Azure DevOps pipeline task `task: gitversion/execute@0` fails with unexpected error "##[error]SyntaxError: Unexpected end of JSON input"</h1>
<p>I was running the pipeline with a simple task to install the git and check the version by the following <code>tasks</code>.</p>
<p>Everything was running well till the tim... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,722 | git | # Azure DevOps pipeline task `task: gitversion/execute@0` fails with unexpected error "##[error]SyntaxError: Unexpected end of JSON input"
I was running the pipeline with a simple task to install the git and check the version by the following `tasks`.
Everything was running well till the time I created another tempor... | The cause of the issue could be related to the fetch depth of the Pipeline repo.
By default, the Shallow fetch of the pipeline repo is 1 by default.
You can try to set the **fetchDepth** to **0** in YAML Pipeline.
For example:
```
steps:
- checkout: self
fetchDepth: 0
- task: gitversion/setup@0
... |
33470898 | Rails: .gitignore still tracking my database.yml file | 7 | 2015-11-02 04:42:32 | <p>I have like 4 guys in my team and they constantly have to change the socket of the database because they have different paths for it, well it is becoming annoying, I tried to add database.yml to the .gitignore:</p>
<pre><code>/config/database.yml
</code></pre>
<p>But for some weird reason when I edit the file and ... | 6,334 | 3,700,798 | 2020-05-21 22:23:42 | 33,484,222 | 16 | 2015-11-02 18:15:32 | 2,421,215 | 2015-11-02 18:28:38 | https://stackoverflow.com/q/33470898 | https://stackoverflow.com/a/33484222 | <p>Try this:</p>
<pre><code>$ echo config/database.yml >> .gitignore
$ mv config/database.yml config/database.yml.example
$ git add .
$ git commit -am "put database.yml to .gitignore and and rename"
$ cp config/database.yml.example config/database.yml
</code></pre>
| <p>Try this:</p> <pre><code>$ echo config/database.yml >> .gitignore $ mv config/database.yml config/database.yml.example $ git add . $ git commit -am "put database.yml to .gitignore and and rename" $ cp config/database.yml.example config/database.yml </code></pre> | 119, 4984 | git, ruby-on-rails | <h1>Rails: .gitignore still tracking my database.yml file</h1>
<p>I have like 4 guys in my team and they constantly have to change the socket of the database because they have different paths for it, well it is becoming annoying, I tried to add database.yml to the .gitignore:</p>
<pre><code>/config/database.yml
</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,725 | git | # Rails: .gitignore still tracking my database.yml file
I have like 4 guys in my team and they constantly have to change the socket of the database because they have different paths for it, well it is becoming annoying, I tried to add database.yml to the .gitignore:
```
/config/database.yml
```
But for some weird re... | Try this:
```
$ echo config/database.yml >> .gitignore
$ mv config/database.yml config/database.yml.example
$ git add .
$ git commit -am "put database.yml to .gitignore and and rename"
$ cp config/database.yml.example config/database.yml
``` |
23036405 | Visual Studio 2013 Tools for GIT - cannot publish an unpublished branch | 7 | 2014-04-12 21:35:54 | <p>I am attempting to use an existing GIT setup within VS2013 using Tools for Git extension. </p>
<p>I believe the repositories and remotes are setup correctly because I can do what I need to using GitShell -- this has not presented any difficulties.</p>
<p>I have a local repository and inside of Team Explorer the <... | 6,059 | 1,760,479 | 2014-04-12 22:48:30 | 23,037,060 | 16 | 2014-04-12 22:48:30 | 1,760,479 | 2014-04-12 22:48:30 | https://stackoverflow.com/q/23036405 | https://stackoverflow.com/a/23037060 | <p>This problem was the result of a incorrect / partial Git configuration.</p>
<p>In my Git configuration file, the <code>remote</code> definition for <code>origin</code> did not have any <code>fetch</code> entry.</p>
<pre><code>[remote "origin"]
url = http://DM-BUILD/git/StarSchemaMetadata.git
[branch "master"]... | <p>This problem was the result of a incorrect / partial Git configuration.</p> <p>In my Git configuration file, the <code>remote</code> definition for <code>origin</code> did not have any <code>fetch</code> entry.</p> <pre><code>[remote "origin"] url = http://DM-BUILD/git/StarSchemaMetadata.git [branch "master"]... | 119, 93364 | git, visual-studio-2013 | <h1>Visual Studio 2013 Tools for GIT - cannot publish an unpublished branch</h1>
<p>I am attempting to use an existing GIT setup within VS2013 using Tools for Git extension. </p>
<p>I believe the repositories and remotes are setup correctly because I can do what I need to using GitShell -- this has not presented any ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,730 | git | # Visual Studio 2013 Tools for GIT - cannot publish an unpublished branch
I am attempting to use an existing GIT setup within VS2013 using Tools for Git extension.
I believe the repositories and remotes are setup correctly because I can do what I need to using GitShell -- this has not presented any difficulties.
I h... | This problem was the result of a incorrect / partial Git configuration.
In my Git configuration file, the `remote` definition for `origin` did not have any `fetch` entry.
```
[remote "origin"]
url = http://DM-BUILD/git/StarSchemaMetadata.git
[branch "master"]
remote = origin
merge = refs/heads/master
```... |
22720844 | Failed patch changed my Git Bash prompt, how do I revert it? | 7 | 2014-03-28 18:46:09 | <p>I tried to apply a patch using <code>git am <my.patch</code>, but it failed.</p>
<p>Now I'm getting this in Git Bash:</p>
<pre><code>sashoalm@SASHOALM-PC /c/Workspace/MyProject (master|AM 1/1)
</code></pre>
<p>My prompt used to show:</p>
<pre><code>sashoalm@SASHOALM-PC /c/Workspace/MyProject (master)
</code><... | 1,771 | 492,336 | 2017-07-12 07:22:14 | 22,720,872 | 16 | 2014-03-28 18:48:21 | 2,422,776 | 2014-03-28 18:48:21 | https://stackoverflow.com/q/22720844 | https://stackoverflow.com/a/22720872 | <p>You can abort the process:</p>
<pre><code>git am --abort
</code></pre>
| <p>You can abort the process:</p> <pre><code>git am --abort </code></pre> | 119, 84451 | git, git-am | <h1>Failed patch changed my Git Bash prompt, how do I revert it?</h1>
<p>I tried to apply a patch using <code>git am <my.patch</code>, but it failed.</p>
<p>Now I'm getting this in Git Bash:</p>
<pre><code>sashoalm@SASHOALM-PC /c/Workspace/MyProject (master|AM 1/1)
</code></pre>
<p>My prompt used to show:</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,731 | git | # Failed patch changed my Git Bash prompt, how do I revert it?
I tried to apply a patch using `git am <my.patch`, but it failed.
Now I'm getting this in Git Bash:
```
sashoalm@SASHOALM-PC /c/Workspace/MyProject (master|AM 1/1)
```
My prompt used to show:
```
sashoalm@SASHOALM-PC /c/Workspace/MyProject (master)
```... | You can abort the process:
```
git am --abort
``` |
22534877 | a basic example of the read-tree command usage | 7 | 2014-03-20 13:43:48 | <p>I was having an <a href="https://stackoverflow.com/questions/22501916/renaming-is-not-reflected-when-changes-pulled/22506372?noredirect=1#comment34276996_22506372">issue with renaming</a> a file and was given a solution which included two git commands - <code>git read-tree -i HEAD</code> and <code>git checkout-index... | 13,210 | 2,545,680 | 2021-11-07 22:38:19 | 22,536,180 | 16 | 2014-03-20 14:34:31 | 720,999 | 2014-03-20 14:43:00 | https://stackoverflow.com/q/22534877 | https://stackoverflow.com/a/22536180 | <p><code>git read-tree</code> goes like this:</p>
<ol>
<li><p>Parses a "tree-ish" passed to it to find an object existing in the Git repository describing a tree.</p>
<p>A tree is what represents a directory in Git: this kind of object lists the SHA-1 and filesystem names of blobs (files) and nested trees (of nested ... | <p><code>git read-tree</code> goes like this:</p> <ol> <li><p>Parses a "tree-ish" passed to it to find an object existing in the Git repository describing a tree.</p> <p>A tree is what represents a directory in Git: this kind of object lists the SHA-1 and filesystem names of blobs (files) and nested trees (of nested ... | 119 | git | <h1>a basic example of the read-tree command usage</h1>
<p>I was having an <a href="https://stackoverflow.com/questions/22501916/renaming-is-not-reflected-when-changes-pulled/22506372?noredirect=1#comment34276996_22506372">issue with renaming</a> a file and was given a solution which included two git commands - <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,732 | git | # a basic example of the read-tree command usage
I was having an [issue with renaming](https://stackoverflow.com/questions/22501916/renaming-is-not-reflected-when-changes-pulled/22506372?noredirect=1#comment34276996_22506372) a file and was given a solution which included two git commands - `git read-tree -i HEAD` and... | `git read-tree` goes like this:
1. Parses a "tree-ish" passed to it to find an object existing in the Git repository describing a tree.
A tree is what represents a directory in Git: this kind of object lists the SHA-1 and filesystem names of blobs (files) and nested trees (of nested directories) comprising the tre... |
22039238 | ignore all _notes directories with GIT | 7 | 2014-02-26 10:58:12 | <p>I need your help: I'm currently working on a web project with another person. I'm using NetBeans to develop the code, while he's using Dreamweaver. We would like to ignore all Dreamweaver _notes directories (these directories contain files produced by Dreamweaver itself). We don't know the exact path of these direct... | 2,546 | 1,291,872 | 2014-02-26 11:00:02 | 22,039,284 | 16 | 2014-02-26 11:00:02 | 592,540 | 2014-02-26 11:00:02 | https://stackoverflow.com/q/22039238 | https://stackoverflow.com/a/22039284 | <p>The correct answer is</p>
<pre><code>_notes/
</code></pre>
<p>That is, ignore all things named <code>_notes</code> that are directories (hence the trailing slash).</p>
<p>edit: I have just seen that you say that directories are still tracked. You cannot ignore something that is already tracked, so what you must d... | <p>The correct answer is</p> <pre><code>_notes/ </code></pre> <p>That is, ignore all things named <code>_notes</code> that are directories (hence the trailing slash).</p> <p>edit: I have just seen that you say that directories are still tracked. You cannot ignore something that is already tracked, so what you must d... | 119, 5748, 25056 | dreamweaver, git, gitignore | <h1>ignore all _notes directories with GIT</h1>
<p>I need your help: I'm currently working on a web project with another person. I'm using NetBeans to develop the code, while he's using Dreamweaver. We would like to ignore all Dreamweaver _notes directories (these directories contain files produced by Dreamweaver itsel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,733 | git | # ignore all _notes directories with GIT
I need your help: I'm currently working on a web project with another person. I'm using NetBeans to develop the code, while he's using Dreamweaver. We would like to ignore all Dreamweaver _notes directories (these directories contain files produced by Dreamweaver itself). We do... | The correct answer is
```
_notes/
```
That is, ignore all things named `_notes` that are directories (hence the trailing slash).
edit: I have just seen that you say that directories are still tracked. You cannot ignore something that is already tracked, so what you must do is remove those directories from the index ... |
19628382 | Git accidentally deleted all of my changes | 7 | 2013-10-28 06:29:25 | <p>In git I did <code>git rm -r .</code> </p>
<p><strong>This was stupid</strong>, because apparently it deleted all of my files in my working directory. Many of these files had changes that had not been commited. I was being stupid and didn't commit anything for the past week. </p>
<p>How can I undo this? I want to... | 8,537 | 1,001,938 | 2013-10-28 06:45:53 | 19,628,406 | 16 | 2013-10-28 06:32:13 | 17,875 | 2013-10-28 06:45:53 | https://stackoverflow.com/q/19628382 | https://stackoverflow.com/a/19628406 | <p>You can't. Git deleted the files. They are gone. You can maybe undelete them with some file recovery tool, but that's well beyond the scope of git.</p>
<p>Not committing frequently sorta defeats the purpose of using a VCS.</p>
<hr>
<p>edit: I take it back! Git is amazing and might have made a blob for your fi... | <p>You can't. Git deleted the files. They are gone. You can maybe undelete them with some file recovery tool, but that's well beyond the scope of git.</p> <p>Not committing frequently sorta defeats the purpose of using a VCS.</p> <hr> <p>edit: I take it back! Git is amazing and might have made a blob for your fi... | 119 | git | <h1>Git accidentally deleted all of my changes</h1>
<p>In git I did <code>git rm -r .</code> </p>
<p><strong>This was stupid</strong>, because apparently it deleted all of my files in my working directory. Many of these files had changes that had not been commited. I was being stupid and didn't commit anything for the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,734 | git | # Git accidentally deleted all of my changes
In git I did `git rm -r .`
**This was stupid**, because apparently it deleted all of my files in my working directory. Many of these files had changes that had not been commited. I was being stupid and didn't commit anything for the past week.
How can I undo this? I want ... | You can't. Git deleted the files. They are gone. You can maybe undelete them with some file recovery tool, but that's well beyond the scope of git.
Not committing frequently sorta defeats the purpose of using a VCS.
---
edit: I take it back! Git is amazing and might have made a blob for your files (I assume for the ... |
16974382 | Create char array of integer using digits as size | 7 | 2013-06-07 00:25:35 | <p>I am trying to create a char array in C, to fill it with the digits of an int, but the int can be of any number of digits.</p>
<p>I'm using a created function called <code>getDigits(int num)</code>, that returns a number of digits the int has.</p>
<pre><code>char buffer[getDigits(number)] = "";
snprintf(buffer, si... | 2,435 | 1,848,566 | 2018-01-03 09:45:08 | 16,975,453 | 16 | 2013-06-07 02:45:29 | 1,989,425 | 2018-01-03 09:45:08 | https://stackoverflow.com/q/16974382 | https://stackoverflow.com/a/16975453 | <p>The problem is exactly as your compiler is telling you; you're not allowed to initialise VLAs. Zack gave an obvious solution in the comments: Remove the initialisation. You'll find working examples in this answer, some of which do permit an initialisation, and others which don't. You'll find more information about t... | <p>The problem is exactly as your compiler is telling you; you're not allowed to initialise VLAs. Zack gave an obvious solution in the comments: Remove the initialisation. You'll find working examples in this answer, some of which do permit an initialisation, and others which don't. You'll find more information about t... | 8, 114, 1156, 9914, 13569 | arrays, c, digits, itoa, printf | <h1>Create char array of integer using digits as size</h1>
<p>I am trying to create a char array in C, to fill it with the digits of an int, but the int can be of any number of digits.</p>
<p>I'm using a created function called <code>getDigits(int num)</code>, that returns a number of digits the int has.</p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,735 | git | # Create char array of integer using digits as size
I am trying to create a char array in C, to fill it with the digits of an int, but the int can be of any number of digits.
I'm using a created function called `getDigits(int num)`, that returns a number of digits the int has.
```
char buffer[getDigits(number)] = ""... | The problem is exactly as your compiler is telling you; you're not allowed to initialise VLAs. Zack gave an obvious solution in the comments: Remove the initialisation. You'll find working examples in this answer, some of which do permit an initialisation, and others which don't. You'll find more information about that... |
16525659 | Is there something similar to diff --show-c-function in git-diff? | 7 | 2013-05-13 15:23:47 | <p>I've been working on a file in my git repository. If I have a copy of the original git version of the file, I can run diff --show-c-function to get a comparison of the 2, files, where (in theory) it shows the whole of any function which has been changed. This is really useful for working out what I did specificall... | 7,991 | 1,817,841 | 2015-12-11 12:00:07 | 16,528,858 | 16 | 2013-05-13 18:38:53 | 1,253,222 | 2013-05-13 18:38:53 | https://stackoverflow.com/q/16525659 | https://stackoverflow.com/a/16528858 | <p><code>git help diff</code> shows this option:</p>
<pre><code>-W, --function-context
Show whole surrounding functions of changes.
</code></pre>
<p>So, it looks like <code>git diff -W</code> should do what you want.</p>
| <p><code>git help diff</code> shows this option:</p> <pre><code>-W, --function-context Show whole surrounding functions of changes. </code></pre> <p>So, it looks like <code>git diff -W</code> should do what you want.</p> | 606, 9033 | diff, git-diff | <h1>Is there something similar to diff --show-c-function in git-diff?</h1>
<p>I've been working on a file in my git repository. If I have a copy of the original git version of the file, I can run diff --show-c-function to get a comparison of the 2, files, where (in theory) it shows the whole of any function which has ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,736 | git | # Is there something similar to diff --show-c-function in git-diff?
I've been working on a file in my git repository. If I have a copy of the original git version of the file, I can run diff --show-c-function to get a comparison of the 2, files, where (in theory) it shows the whole of any function which has been chang... | `git help diff` shows this option:
```
-W, --function-context
Show whole surrounding functions of changes.
```
So, it looks like `git diff -W` should do what you want. |
11286362 | changing the last commit message without committing newest changes | 7 | 2012-07-01 23:19:38 | <p>My ideal workflow would consist of the following steps</p>
<ol>
<li>edit the code</li>
<li>compile</li>
<li>git commit -a -m "commit message"</li>
<li>start running the new binaries, tests, etc. (may take 10+ minutes)</li>
<li>start new changes, while the binaries are still running</li>
<li>when step # 4 is finishe... | 3,504 | 1,487,836 | 2014-03-05 17:34:04 | 11,287,424 | 16 | 2012-07-02 03:13:16 | 2,726 | 2012-07-02 03:13:16 | https://stackoverflow.com/q/11286362 | https://stackoverflow.com/a/11287424 | <p>There's no need to stash or do anything else here.</p>
<p><code>git commit --amend -m 'Your new message.'</code></p>
<p>will not commit any new changes (note the lack of <code>-a</code> flag), provided that you haven't explicitly added them to the index (using <code>git add</code>, for example).</p>
| <p>There's no need to stash or do anything else here.</p> <p><code>git commit --amend -m 'Your new message.'</code></p> <p>will not commit any new changes (note the lack of <code>-a</code> flag), provided that you haven't explicitly added them to the index (using <code>git add</code>, for example).</p> | 119 | git | <h1>changing the last commit message without committing newest changes</h1>
<p>My ideal workflow would consist of the following steps</p>
<ol>
<li>edit the code</li>
<li>compile</li>
<li>git commit -a -m "commit message"</li>
<li>start running the new binaries, tests, etc. (may take 10+ minutes)</li>
<li>start new cha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,738 | git | # changing the last commit message without committing newest changes
My ideal workflow would consist of the following steps
1. edit the code
2. compile
3. git commit -a -m "commit message"
4. start running the new binaries, tests, etc. (may take 10+ minutes)
5. start new changes, while the binaries are still running
... | There's no need to stash or do anything else here.
`git commit --amend -m 'Your new message.'`
will not commit any new changes (note the lack of `-a` flag), provided that you haven't explicitly added them to the index (using `git add`, for example). |
9617233 | git wildcard - remove all instances of a subdirectory | 7 | 2012-03-08 11:52:32 | <p>I am trying to execute <code>git rm --cached -r <folder></code> to remove all instances of a folder named .svn recursively. I have tried this:</p>
<pre><code>.svn
/.svn
/*/.svn
/*/*/.svn
etc
</code></pre>
<p>And it works, but I'm sure there is a more dynamic way.</p>
<p>Thanks</p>
| 6,092 | 401,375 | 2017-12-29 00:36:26 | 9,617,513 | 16 | 2012-03-08 12:15:06 | 1,125,963 | 2012-03-08 12:15:06 | https://stackoverflow.com/q/9617233 | https://stackoverflow.com/a/9617513 | <p>The right solution would be:</p>
<pre><code>find . -type d -name '.svn' -print0 | xargs -0 git rm --cached -r --
</code></pre>
<p>@gregor's will fail on the directories with spaces.</p>
| <p>The right solution would be:</p> <pre><code>find . -type d -name '.svn' -print0 | xargs -0 git rm --cached -r -- </code></pre> <p>@gregor's will fail on the directories with spaces.</p> | 119, 456, 10193 | find, git, version-control | <h1>git wildcard - remove all instances of a subdirectory</h1>
<p>I am trying to execute <code>git rm --cached -r <folder></code> to remove all instances of a folder named .svn recursively. I have tried this:</p>
<pre><code>.svn
/.svn
/*/.svn
/*/*/.svn
etc
</code></pre>
<p>And it works, but I'm sure there is ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,739 | git | # git wildcard - remove all instances of a subdirectory
I am trying to execute `git rm --cached -r <folder>` to remove all instances of a folder named .svn recursively. I have tried this:
```
.svn
/.svn
/*/.svn
/*/*/.svn
etc
```
And it works, but I'm sure there is a more dynamic way.
Thanks | The right solution would be:
```
find . -type d -name '.svn' -print0 | xargs -0 git rm --cached -r --
```
@gregor's will fail on the directories with spaces. |
9030517 | git see entire merge diff | 7 | 2012-01-27 08:11:03 | <p>I want to be able to see the entire patch applied by a merge as a single diff output. In bzr this is the standard (such that if you view the diff at a merge point you get the entire diff resulting from that merge). In git I don't see how to get this unified view of the merge. Using gitk I have to click on each indiv... | 5,304 | 229,686 | 2012-01-27 08:14:49 | 9,030,550 | 16 | 2012-01-27 08:14:49 | 116,932 | 2012-01-27 08:14:49 | https://stackoverflow.com/q/9030517 | https://stackoverflow.com/a/9030550 | <p>Lets say your merge has the hash "1234abc". What you can do is to run:</p>
<pre><code>git diff 1234abc^1 1234abc
</code></pre>
<p>Pretty much displays a "before" "after" comparison.</p>
| <p>Lets say your merge has the hash "1234abc". What you can do is to run:</p> <pre><code>git diff 1234abc^1 1234abc </code></pre> <p>Pretty much displays a "before" "after" comparison.</p> | 119 | git | <h1>git see entire merge diff</h1>
<p>I want to be able to see the entire patch applied by a merge as a single diff output. In bzr this is the standard (such that if you view the diff at a merge point you get the entire diff resulting from that merge). In git I don't see how to get this unified view of the merge. Using... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,740 | git | # git see entire merge diff
I want to be able to see the entire patch applied by a merge as a single diff output. In bzr this is the standard (such that if you view the diff at a merge point you get the entire diff resulting from that merge). In git I don't see how to get this unified view of the merge. Using gitk I h... | Lets say your merge has the hash "1234abc". What you can do is to run:
```
git diff 1234abc^1 1234abc
```
Pretty much displays a "before" "after" comparison. |
7268945 | git unable to rm --cached files | 7 | 2011-09-01 10:18:35 | <p>I want to remove all my *.pyc files from version control. I've tried <code>git rm -r cached ./*.pyc</code> but I got the error <code>fatal: pathspec 'widgets.pyc' did not match any files</code>. I thought <code>widgets.pyc</code> is not in version control but <code>git status widgets.pyc</code> says that my file is ... | 1,202 | 357,236 | 2011-09-06 08:09:58 | 7,269,128 | 16 | 2011-09-01 10:38:26 | 49,489 | 2011-09-06 08:09:58 | https://stackoverflow.com/q/7268945 | https://stackoverflow.com/a/7269128 | <p>Try <code>git rm -r --cached ./\*.pyc</code> (note the backslash character before the asterisk) to ensure your command shell passes the wildcard character to git instead of expanding it itself.</p>
| <p>Try <code>git rm -r --cached ./\*.pyc</code> (note the backslash character before the asterisk) to ensure your command shell passes the wildcard character to git instead of expanding it itself.</p> | 119 | git | <h1>git unable to rm --cached files</h1>
<p>I want to remove all my *.pyc files from version control. I've tried <code>git rm -r cached ./*.pyc</code> but I got the error <code>fatal: pathspec 'widgets.pyc' did not match any files</code>. I thought <code>widgets.pyc</code> is not in version control but <code>git status... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,741 | git | # git unable to rm --cached files
I want to remove all my *.pyc files from version control. I've tried `git rm -r cached ./*.pyc` but I got the error `fatal: pathspec 'widgets.pyc' did not match any files`. I thought `widgets.pyc` is not in version control but `git status widgets.pyc` says that my file is on `branch m... | Try `git rm -r --cached ./\*.pyc` (note the backslash character before the asterisk) to ensure your command shell passes the wildcard character to git instead of expanding it itself. |
2524388 | Find all the commits there are in lab branch but in master branch | 7 | 2010-03-26 15:24:20 | <p><a href="http://linux.die.net/man/1/git-cherry" rel="noreferrer">git-cherry</a> lets me find all the commits missing from upstream. How do I find all the commits that are there in local lab branch but not in local master branch.</p>
<pre><code>git branch -d lab
</code></pre>
<p>Above operation fails because I hav... | 1,716 | 253,470 | 2010-03-26 15:26:26 | 2,524,404 | 16 | 2010-03-26 15:26:26 | 28,804 | 2010-03-26 15:26:26 | https://stackoverflow.com/q/2524388 | https://stackoverflow.com/a/2524404 | <p><code>git log master..lab</code> will show all commits in <code>lab</code> that aren't in <code>master</code>.</p>
| <p><code>git log master..lab</code> will show all commits in <code>lab</code> that aren't in <code>master</code>.</p> | 119 | git | <h1>Find all the commits there are in lab branch but in master branch</h1>
<p><a href="http://linux.die.net/man/1/git-cherry" rel="noreferrer">git-cherry</a> lets me find all the commits missing from upstream. How do I find all the commits that are there in local lab branch but not in local master branch.</p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,742 | git | # Find all the commits there are in lab branch but in master branch
[git-cherry](http://linux.die.net/man/1/git-cherry) lets me find all the commits missing from upstream. How do I find all the commits that are there in local lab branch but not in local master branch.
```
git branch -d lab
```
Above operation fails ... | `git log master..lab` will show all commits in `lab` that aren't in `master`. |
69542076 | How to `Disable or modify the sparsity rules`? | 6 | 2021-10-12 14:09:58 | <pre><code>kes@work ~/t/etc $ git rm local.conf
The following pathspecs didn't match any eligible path, but they do match index
entries outside the current sparse checkout:
local.conf
hint: Disable or modify the sparsity rules if you intend to update such entries.
hint: Disable this message with "git config advic... | 6,481 | 4,632,019 | 2024-01-20 06:05:36 | 69,542,344 | 16 | 2021-10-12 14:29:17 | 1,290,731 | 2022-03-25 00:50:33 | https://stackoverflow.com/q/69542076 | https://stackoverflow.com/a/69542344 | <p><code>skip-worktree</code> is the internal flag used to mark a path that's in the commit but not part of the checkout. Git's got a convenience facility, "sparse checkout", say <code>git help sparse-checkout</code> if you're curious, that allows you to ... well, do sparse checkouts, of only the paths you wa... | <p><code>skip-worktree</code> is the internal flag used to mark a path that's in the commit but not part of the checkout. Git's got a convenience facility, "sparse checkout", say <code>git help sparse-checkout</code> if you're curious, that allows you to ... well, do sparse checkouts, of only the paths you wa... | 119, 37230 | git, git-checkout | <h1>How to `Disable or modify the sparsity rules`?</h1>
<pre><code>kes@work ~/t/etc $ git rm local.conf
The following pathspecs didn't match any eligible path, but they do match index
entries outside the current sparse checkout:
local.conf
hint: Disable or modify the sparsity rules if you intend to update such entries... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,743 | git | # How to `Disable or modify the sparsity rules`?
```
kes@work ~/t/etc $ git rm local.conf
The following pathspecs didn't match any eligible path, but they do match index
entries outside the current sparse checkout:
local.conf
hint: Disable or modify the sparsity rules if you intend to update such entries.
hint: Disab... | `skip-worktree` is the internal flag used to mark a path that's in the commit but not part of the checkout. Git's got a convenience facility, "sparse checkout", say `git help sparse-checkout` if you're curious, that allows you to ... well, do sparse checkouts, of only the paths you want to work with, and completely ign... |
67774342 | How do I revert to the previous commit without deleting the latest commit? | 6 | 2021-05-31 13:06:04 | <p>Say I have 2 commits which I have already pushed to my remote branch.</p>
<ul>
<li>Commit A (31-May-2021)</li>
<li>Commit B (30-May-2021)</li>
</ul>
<p>How do I revert to Commit B without deleting Commit A? I just want to compare the result between these 2 commits.</p>
<p>Note: Code comparison is not needed. I just ... | 4,976 | 4,971,859 | 2021-06-01 05:00:53 | 67,774,601 | 16 | 2021-05-31 13:22:49 | 5,024,726 | 2021-05-31 13:30:24 | https://stackoverflow.com/q/67774342 | https://stackoverflow.com/a/67774601 | <p>I strongly disagree with the other answers advising you to use <code>git revert</code>. This would actually really revert the changes introduced by <em>Commit A</em> and produce a commit on its own.</p>
<p>Since you want to have a look at the state at a point back in time, you could just checkout <em>Commit B</em> d... | <p>I strongly disagree with the other answers advising you to use <code>git revert</code>. This would actually really revert the changes introduced by <em>Commit A</em> and produce a commit on its own.</p> <p>Since you want to have a look at the state at a point back in time, you could just checkout <em>Commit B</em> d... | 119, 34403 | git, git-revert | <h1>How do I revert to the previous commit without deleting the latest commit?</h1>
<p>Say I have 2 commits which I have already pushed to my remote branch.</p>
<ul>
<li>Commit A (31-May-2021)</li>
<li>Commit B (30-May-2021)</li>
</ul>
<p>How do I revert to Commit B without deleting Commit A? I just want to compare the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,744 | git | # How do I revert to the previous commit without deleting the latest commit?
Say I have 2 commits which I have already pushed to my remote branch.
- Commit A (31-May-2021)
- Commit B (30-May-2021)
How do I revert to Commit B without deleting Commit A? I just want to compare the result between these 2 commits.
Note:... | I strongly disagree with the other answers advising you to use `git revert`. This would actually really revert the changes introduced by *Commit A* and produce a commit on its own.
Since you want to have a look at the state at a point back in time, you could just checkout *Commit B* directly so you can inspect the con... |
58301658 | Deactivate Git pre-commit hook via command line | 6 | 2019-10-09 10:00:59 | <p>I'm using Git pre-commit/pre-push hook to build my software before every commit. This is, of course, useful when I change source code files. The hook also runs if I change non-source code files (e.g. <code>ReadMe.md</code>). For those commits, I don't want to run the hook. </p>
<p>Is there a way to deactivate the h... | 5,546 | 6,270,170 | 2019-10-09 10:37:31 | 58,301,951 | 16 | 2019-10-09 10:18:28 | 11,101,213 | 2019-10-09 10:18:28 | https://stackoverflow.com/q/58301658 | https://stackoverflow.com/a/58301951 | <p>There is a flag <code>-n</code> which stands for <code>--no-verify</code>, is very handy to bypass hooks on git commits</p>
<pre><code>git commit -n
</code></pre>
| <p>There is a flag <code>-n</code> which stands for <code>--no-verify</code>, is very handy to bypass hooks on git commits</p> <pre><code>git commit -n </code></pre> | 119 | git | <h1>Deactivate Git pre-commit hook via command line</h1>
<p>I'm using Git pre-commit/pre-push hook to build my software before every commit. This is, of course, useful when I change source code files. The hook also runs if I change non-source code files (e.g. <code>ReadMe.md</code>). For those commits, I don't want to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,746 | git | # Deactivate Git pre-commit hook via command line
I'm using Git pre-commit/pre-push hook to build my software before every commit. This is, of course, useful when I change source code files. The hook also runs if I change non-source code files (e.g. `ReadMe.md`). For those commits, I don't want to run the hook.
Is th... | There is a flag `-n` which stands for `--no-verify`, is very handy to bypass hooks on git commits
```
git commit -n
``` |
54632745 | git: 'remote-ttps' is not a git command | 6 | 2019-02-11 14:28:16 | <p>I am getting an error when I try to push my changes to remote branch, the complete error that I get is shown below -</p>
<pre><code>$ git push origin master
git: 'remote-ttps' is not a git command. See 'git --help'.
The most similar command is
remote-https
</code></pre>
<p>I don't remember what changes I d... | 16,855 | 7,254,394 | 2022-05-04 04:24:32 | 54,635,748 | 16 | 2019-02-11 17:14:04 | 729,881 | 2019-02-11 17:14:04 | https://stackoverflow.com/q/54632745 | https://stackoverflow.com/a/54635748 | <p>This unfortunate error message is an illustration of Git's modularity: when it wants to connect to a remote server, it will invoke a helper command, named <code>git-remote-<protocol></code>. So you'll often see the HTTP-based transfer mechanism invoking <code>git-remote-https</code>.</p>
<p>You <em>could</e... | <p>This unfortunate error message is an illustration of Git's modularity: when it wants to connect to a remote server, it will invoke a helper command, named <code>git-remote-<protocol></code>. So you'll often see the HTTP-based transfer mechanism invoking <code>git-remote-https</code>.</p> <p>You <em>could</e... | 119, 107329 | git, windows-10 | <h1>git: 'remote-ttps' is not a git command</h1>
<p>I am getting an error when I try to push my changes to remote branch, the complete error that I get is shown below -</p>
<pre><code>$ git push origin master
git: 'remote-ttps' is not a git command. See 'git --help'.
The most similar command is
remote-https
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,747 | git | # git: 'remote-ttps' is not a git command
I am getting an error when I try to push my changes to remote branch, the complete error that I get is shown below -
```
$ git push origin master
git: 'remote-ttps' is not a git command. See 'git --help'.
The most similar command is
remote-https
```
I don't remember ... | This unfortunate error message is an illustration of Git's modularity: when it wants to connect to a remote server, it will invoke a helper command, named `git-remote-<protocol>`. So you'll often see the HTTP-based transfer mechanism invoking `git-remote-https`.
You *could* even add your own remote transfer mechanism.... |
52076096 | Why does git log show my password? | 6 | 2018-08-29 11:13:13 | <p>When I type <code>git log</code> the resulting list of commits show my password in brackets <> after my username, like this:</p>
<pre><code>commit 5ff14f929e2244f388a41b6f711e7b9b58c57cb2
Author: herman <MyPassw0rd>
Date: Wed Aug 29 10:00:39 2018 +0200
initial commit
</code></pre>
<p>Why does it do th... | 3,015 | 2,030,941 | 2018-08-29 11:17:01 | 52,076,175 | 16 | 2018-08-29 11:17:01 | 240,443 | 2018-08-29 11:17:01 | https://stackoverflow.com/q/52076096 | https://stackoverflow.com/a/52076175 | <p>That's not supposed to be your password, it should be your email. While I have no idea how you entered your password into the email setting, you can set your email in the current project using</p>
<pre><code>git config user.email "email@example.com"
</code></pre>
<p>or globally using</p>
<pre><code>git config --g... | <p>That's not supposed to be your password, it should be your email. While I have no idea how you entered your password into the email setting, you can set your email in the current project using</p> <pre><code>git config user.email "email@example.com" </code></pre> <p>or globally using</p> <pre><code>git config --g... | 119, 15034 | git, password-protection | <h1>Why does git log show my password?</h1>
<p>When I type <code>git log</code> the resulting list of commits show my password in brackets <> after my username, like this:</p>
<pre><code>commit 5ff14f929e2244f388a41b6f711e7b9b58c57cb2
Author: herman <MyPassw0rd>
Date: Wed Aug 29 10:00:39 2018 +0200
initial... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,748 | git | # Why does git log show my password?
When I type `git log` the resulting list of commits show my password in brackets <> after my username, like this:
```
commit 5ff14f929e2244f388a41b6f711e7b9b58c57cb2
Author: herman <MyPassw0rd>
Date: Wed Aug 29 10:00:39 2018 +0200
initial commit
```
Why does it do this, and ho... | That's not supposed to be your password, it should be your email. While I have no idea how you entered your password into the email setting, you can set your email in the current project using
```
git config user.email "email@example.com"
```
or globally using
```
git config --global user.email "email@example.com"
`... |
43716649 | How do I merge changes in Git in files that I moved? | 6 | 2017-05-01 09:00:57 | <p>I moved some directories. </p>
<p>When I merge, there are many conflicting files, since other developers have committed their changes. Both egit Merge Tool and <code>git mergetool</code> say that the file was deleted locally or remotely. See image. </p>
<p>How do I merge these changes?</p>
<p><a href="https://i.... | 6,447 | 39,242 | 2017-05-03 06:48:40 | 43,723,863 | 16 | 2017-05-01 17:54:44 | 1,256,452 | 2017-05-01 22:30:26 | https://stackoverflow.com/q/43716649 | https://stackoverflow.com/a/43723863 | <h3>File history and rename detection</h3>
<p>You never really need to worry about "preserving history" in Git. Git does not have <em>file</em> history at all, it has only <em>commit</em> history. That is, each commit "points to" (contains the hash ID of) its parent—or, for a merge, <em>both</em> its parents—and thi... | <h3>File history and rename detection</h3> <p>You never really need to worry about "preserving history" in Git. Git does not have <em>file</em> history at all, it has only <em>commit</em> history. That is, each commit "points to" (contains the hash ID of) its parent—or, for a merge, <em>both</em> its parents—and thi... | 119, 717, 43702 | egit, git, merge | <h1>How do I merge changes in Git in files that I moved?</h1>
<p>I moved some directories. </p>
<p>When I merge, there are many conflicting files, since other developers have committed their changes. Both egit Merge Tool and <code>git mergetool</code> say that the file was deleted locally or remotely. See image. </p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,751 | git | # How do I merge changes in Git in files that I moved?
I moved some directories.
When I merge, there are many conflicting files, since other developers have committed their changes. Both egit Merge Tool and `git mergetool` say that the file was deleted locally or remotely. See image.
How do I merge these changes?
[... | ### File history and rename detection
You never really need to worry about "preserving history" in Git. Git does not have *file* history at all, it has only *commit* history. That is, each commit "points to" (contains the hash ID of) its parent—or, for a merge, *both* its parents—and this *is* the history: commit `E` ... |
41768916 | What to do with a .git directory? | 6 | 2017-01-20 17:07:05 | <p>I got a .git directory for me to work on, supposedly containing files and data to run.</p>
<p>I only a see a bunch of directories (branches, hooks, info, objects, refs) and some files (config, description, HEAD), but can't figure out what to do with them. </p>
<p>I'm assuming I should somehow link it with GitHub, ... | 8,804 | 639,973 | 2020-02-24 17:48:46 | 41,769,132 | 16 | 2017-01-20 17:21:20 | 4,621,513 | 2017-01-20 17:21:20 | https://stackoverflow.com/q/41768916 | https://stackoverflow.com/a/41769132 | <p>I suppose what you got is a <em>bare repository</em>.
In order get the files out of it, you must create a non-bare clone.</p>
<p>Assuming that the directory you have mentioned is located at <code>/path/to/my/repository.git</code>, then by running the following command in a terminal:</p>
<pre><code>git clone /path/... | <p>I suppose what you got is a <em>bare repository</em>. In order get the files out of it, you must create a non-bare clone.</p> <p>Assuming that the directory you have mentioned is located at <code>/path/to/my/repository.git</code>, then by running the following command in a terminal:</p> <pre><code>git clone /path/... | 119 | git | <h1>What to do with a .git directory?</h1>
<p>I got a .git directory for me to work on, supposedly containing files and data to run.</p>
<p>I only a see a bunch of directories (branches, hooks, info, objects, refs) and some files (config, description, HEAD), but can't figure out what to do with them. </p>
<p>I'm assu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,752 | git | # What to do with a .git directory?
I got a .git directory for me to work on, supposedly containing files and data to run.
I only a see a bunch of directories (branches, hooks, info, objects, refs) and some files (config, description, HEAD), but can't figure out what to do with them.
I'm assuming I should somehow li... | I suppose what you got is a *bare repository*.
In order get the files out of it, you must create a non-bare clone.
Assuming that the directory you have mentioned is located at `/path/to/my/repository.git`, then by running the following command in a terminal:
```
git clone /path/to/my/repository.git /output/directory
... |
37486438 | Why can't I pull from my remote branch? | 6 | 2016-05-27 14:47:11 | <pre><code>[console]: git remote -v
origin git@testServer.com:myProj/myProj.git(fetch)
origin git@testServer.com:myProj/myProj.git(push)
[console]: git branch -a
*myBranch
development
remotes/origin/myBranch
remotes/origin/development
[console]: git pull origin/myBranch myBranch
fatal: 'origin/myBranch' does not appe... | 46,945 | 410,824 | 2016-05-27 14:58:15 | 37,486,634 | 16 | 2016-05-27 14:58:15 | 1,256,452 | 2016-05-27 14:58:15 | https://stackoverflow.com/q/37486438 | https://stackoverflow.com/a/37486634 | <p>You have the syntax wrong: it's <code>git pull [ <em>remote</em> [ <em>branch-name</em> ] ]</code>, not <code>git pull <em>remote</em>/<em>branch-name</em> <em>branch-name</em></code>. In this case you would need <code>git pull origin myBranch</code>.</p>
<p>That said, I recommend <em>not</em> using <code>git pull... | <p>You have the syntax wrong: it's <code>git pull [ <em>remote</em> [ <em>branch-name</em> ] ]</code>, not <code>git pull <em>remote</em>/<em>branch-name</em> <em>branch-name</em></code>. In this case you would need <code>git pull origin myBranch</code>.</p> <p>That said, I recommend <em>not</em> using <code>git pull... | 119, 1879, 28896, 29934 | branch, git, git-pull, git-rebase | <h1>Why can't I pull from my remote branch?</h1>
<pre><code>[console]: git remote -v
origin git@testServer.com:myProj/myProj.git(fetch)
origin git@testServer.com:myProj/myProj.git(push)
[console]: git branch -a
*myBranch
development
remotes/origin/myBranch
remotes/origin/development
[console]: git pull origin/myBranc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,753 | git | # Why can't I pull from my remote branch?
```
[console]: git remote -v
origin git@testServer.com:myProj/myProj.git(fetch)
origin git@testServer.com:myProj/myProj.git(push)
[console]: git branch -a
*myBranch
development
remotes/origin/myBranch
remotes/origin/development
[console]: git pull origin/myBranch myBranch
fa... | You have the syntax wrong: it's `git pull [ remote [ branch-name ] ]`, not `git pull remote/branch-name branch-name`. In this case you would need `git pull origin myBranch`.
That said, I recommend *not* using `git pull` at all, at least not until you are very familiar with Git. The reason is that `git pull` does two t... |
35942193 | Kubernetes simple authentication | 6 | 2016-03-11 14:00:43 | <p>I am using Kubernetes on a coreOS cluster hosted on DigitalOcean.
And using <a href="https://github.com/cescoferraro/kubernetes-do" rel="nofollow noreferrer">this</a> repo to set it up. I started the apiserver with the following line:</p>
<pre><code> /opt/bin/kube-apiserver --runtime-config=api/v1 --allow-privile... | 10,259 | 3,074,508 | 2021-12-27 19:18:59 | 35,947,152 | 16 | 2016-03-11 18:15:14 | 805,800 | 2016-03-11 18:15:14 | https://stackoverflow.com/q/35942193 | https://stackoverflow.com/a/35947152 | <p>If you want your users to authenticate using HTTP Basic Auth (user:password), you can add:</p>
<pre><code>--basic-auth-file=/basic_auth.csv
</code></pre>
<p>to your kube-apiserver command line, where each line of the file should be <code>password, user-name, user-id</code>. E.g.:</p>
<pre><code>@dm1nP@ss,admin,ad... | <p>If you want your users to authenticate using HTTP Basic Auth (user:password), you can add:</p> <pre><code>--basic-auth-file=/basic_auth.csv </code></pre> <p>to your kube-apiserver command line, where each line of the file should be <code>password, user-name, user-id</code>. E.g.:</p> <pre><code>@dm1nP@ss,admin,ad... | 97102, 99535, 106338 | coreos, digital-ocean, kubernetes | <h1>Kubernetes simple authentication</h1>
<p>I am using Kubernetes on a coreOS cluster hosted on DigitalOcean.
And using <a href="https://github.com/cescoferraro/kubernetes-do" rel="nofollow noreferrer">this</a> repo to set it up. I started the apiserver with the following line:</p>
<pre><code> /opt/bin/kube-apiserv... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,754 | git | # Kubernetes simple authentication
I am using Kubernetes on a coreOS cluster hosted on DigitalOcean.
And using [this](https://github.com/cescoferraro/kubernetes-do) repo to set it up. I started the apiserver with the following line:
```
/opt/bin/kube-apiserver --runtime-config=api/v1 --allow-privileged=true \
... | If you want your users to authenticate using HTTP Basic Auth (user:password), you can add:
```
--basic-auth-file=/basic_auth.csv
```
to your kube-apiserver command line, where each line of the file should be `password, user-name, user-id`. E.g.:
```
@dm1nP@ss,admin,admin
w3rck3rP@ss,wercker,wercker
etc...
```
If yo... |
28369034 | Can git archive include the directory that the .git project lives in? | 6 | 2015-02-06 15:22:27 | <p>Can git archive include the directory that the .git project lives in?</p>
<p>For example, let's say my directory structure is like this:</p>
<pre><code>-- /my-project-dir
----- /.git
----- /css
----- index.html
----- scripts.js
</code></pre>
<p>By default, when I do a git archive, I end up with a ZIP file like so... | 1,752 | 1,809,762 | 2015-02-06 15:30:49 | 28,369,176 | 16 | 2015-02-06 15:30:49 | 14,637 | 2015-02-06 15:30:49 | https://stackoverflow.com/q/28369034 | https://stackoverflow.com/a/28369176 | <p>Use the <code>--prefix</code> option:</p>
<pre><code>$ pwd
/tmp/foo
$ ls -A
bar .git
$ git archive --prefix foo/ -o foo.tar master
$ tar tf foo.tar
foo/
foo/bar
</code></pre>
<p>Be careful to include the trailing slash in <code>foo/</code>, otherwise you end up with the prefix prepended to each filename!</p>
| <p>Use the <code>--prefix</code> option:</p> <pre><code>$ pwd /tmp/foo $ ls -A bar .git $ git archive --prefix foo/ -o foo.tar master $ tar tf foo.tar foo/ foo/bar </code></pre> <p>Be careful to include the trailing slash in <code>foo/</code>, otherwise you end up with the prefix prepended to each filename!</p> | 119, 81662 | git, git-archive | <h1>Can git archive include the directory that the .git project lives in?</h1>
<p>Can git archive include the directory that the .git project lives in?</p>
<p>For example, let's say my directory structure is like this:</p>
<pre><code>-- /my-project-dir
----- /.git
----- /css
----- index.html
----- scripts.js
</code><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,757 | git | # Can git archive include the directory that the .git project lives in?
Can git archive include the directory that the .git project lives in?
For example, let's say my directory structure is like this:
```
-- /my-project-dir
----- /.git
----- /css
----- index.html
----- scripts.js
```
By default, when I do a git ar... | Use the `--prefix` option:
```
$ pwd
/tmp/foo
$ ls -A
bar .git
$ git archive --prefix foo/ -o foo.tar master
$ tar tf foo.tar
foo/
foo/bar
```
Be careful to include the trailing slash in `foo/`, otherwise you end up with the prefix prepended to each filename! |
28082942 | "git checkout -- *" returns "error: pathspec did not match any files known to git" | 6 | 2015-01-22 06:59:01 | <p>As in question, if I want to discard changes in working directory I run command <code>git checkout -- *</code> but git returns information <code>error: pathspec 'databaseName.tmp' did not match any file(s) known to git.</code>. I'm not git master and I don't know how to solve it. Any idea?</p>
| 13,451 | 2,069,368 | 2015-01-22 07:25:53 | 28,083,193 | 16 | 2015-01-22 07:18:17 | 1,256,452 | 2015-01-22 07:25:53 | https://stackoverflow.com/q/28082942 | https://stackoverflow.com/a/28083193 | <p>As <a href="https://stackoverflow.com/users/3681109/genisage">genisage</a> <a href="https://stackoverflow.com/questions/28082942/git-checkout-returns-error-pathspec-did-not-match-any-files-known-to-gi#comment44543943_28082942">noted in a comment</a>, you're asking git explicitly to check out the file <code>databaseN... | <p>As <a href="https://stackoverflow.com/users/3681109/genisage">genisage</a> <a href="https://stackoverflow.com/questions/28082942/git-checkout-returns-error-pathspec-did-not-match-any-files-known-to-gi#comment44543943_28082942">noted in a comment</a>, you're asking git explicitly to check out the file <code>databaseN... | 119 | git | <h1>"git checkout -- *" returns "error: pathspec did not match any files known to git"</h1>
<p>As in question, if I want to discard changes in working directory I run command <code>git checkout -- *</code> but git returns information <code>error: pathspec 'databaseName.tmp' did not match any file(s) known to git.</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,758 | git | # "git checkout -- *" returns "error: pathspec did not match any files known to git"
As in question, if I want to discard changes in working directory I run command `git checkout -- *` but git returns information `error: pathspec 'databaseName.tmp' did not match any file(s) known to git.`. I'm not git master and I don... | As [genisage](https://stackoverflow.com/users/3681109/genisage) [noted in a comment](https://stackoverflow.com/questions/28082942/git-checkout-returns-error-pathspec-did-not-match-any-files-known-to-gi#comment44543943_28082942), you're asking git explicitly to check out the file `databaseName.tmp`, as if you'd typed in... |
20310723 | Change local reference for remote branch | 6 | 2013-12-01 09:30:19 | <p>I've got two repositories binded to my working directory.</p>
<pre><code>git remote show origin
* remote origin
Fetch URL: ssh://project.git/
Push URL: ssh://project.git/
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
L... | 5,509 | 2,069,368 | 2013-12-04 04:00:55 | 20,312,780 | 16 | 2013-12-01 13:45:44 | 1,256,452 | 2013-12-04 04:00:55 | https://stackoverflow.com/q/20310723 | https://stackoverflow.com/a/20312780 | <p>Before I answer, I want to change the terms here, as the way you are using some words do not match the words and ways used in most git documentation.</p>
<p>First, let's talk about the graph generated by commits in a git repository.</p>
<p>Any time you create a commit in a repository, you must specify the followin... | <p>Before I answer, I want to change the terms here, as the way you are using some words do not match the words and ways used in most git documentation.</p> <p>First, let's talk about the graph generated by commits in a git repository.</p> <p>Any time you create a commit in a repository, you must specify the followin... | 119 | git | <h1>Change local reference for remote branch</h1>
<p>I've got two repositories binded to my working directory.</p>
<pre><code>git remote show origin
* remote origin
Fetch URL: ssh://project.git/
Push URL: ssh://project.git/
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,759 | git | # Change local reference for remote branch
I've got two repositories binded to my working directory.
```
git remote show origin
* remote origin
Fetch URL: ssh://project.git/
Push URL: ssh://project.git/
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master... | Before I answer, I want to change the terms here, as the way you are using some words do not match the words and ways used in most git documentation.
First, let's talk about the graph generated by commits in a git repository.
Any time you create a commit in a repository, you must specify the following items. Many of ... |
16792558 | Git-Flow undo a finished feature branch | 6 | 2013-05-28 12:50:37 | <p>What options do you have if you want to "undo" a feature branch? Let's say you add a new feature <code>supercool-feature</code> which you finish (merge into development and delete the feature branch) and then it goes into a release. But then your users really dislike this <code>supercool-feature</code>. How can I un... | 7,065 | 294,661 | 2017-12-04 21:53:13 | 17,658,818 | 16 | 2013-07-15 16:11:34 | 636,626 | 2017-12-04 21:53:13 | https://stackoverflow.com/q/16792558 | https://stackoverflow.com/a/17658818 | <p><strong>Run this command</strong></p>
<pre><code>git revert -m 1 <sha1 of M>
</code></pre>
<p><strong>Explanation</strong></p>
<p>Your situation is about as follows:</p>
<blockquote>
<pre><code>A-B-----C---D-M # master
\ /
X-Y---Z- # supercool-feature
</code></pre>
</blockquote>
... | <p><strong>Run this command</strong></p> <pre><code>git revert -m 1 <sha1 of M> </code></pre> <p><strong>Explanation</strong></p> <p>Your situation is about as follows:</p> <blockquote> <pre><code>A-B-----C---D-M # master \ / X-Y---Z- # supercool-feature </code></pre> </blockquote> ... | 119, 64339 | git, git-flow | <h1>Git-Flow undo a finished feature branch</h1>
<p>What options do you have if you want to "undo" a feature branch? Let's say you add a new feature <code>supercool-feature</code> which you finish (merge into development and delete the feature branch) and then it goes into a release. But then your users really dislike ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,762 | git | # Git-Flow undo a finished feature branch
What options do you have if you want to "undo" a feature branch? Let's say you add a new feature `supercool-feature` which you finish (merge into development and delete the feature branch) and then it goes into a release. But then your users really dislike this `supercool-feat... | **Run this command**
```
git revert -m 1 <sha1 of M>
```
**Explanation**
Your situation is about as follows:
> ```
> A-B-----C---D-M # master
> \ /
> X-Y---Z- # supercool-feature
> ```
A, B, C and D were in your master branch, X, Y and Z in your feature branch. When you did `git merge sup... |
16081260 | Revert merge Git-Flow | 6 | 2013-04-18 10:41:17 | <p>I'm using SourceTree and Git-Flow pattern. Now I have prepared a release for my beta-testers to test so I created a new <code>release/v1.0.1</code> branch. But my mind slipped and I decided to finish (merge into <code>develop</code> and <code>master</code> and tag) the release even though I haven't even sent out the... | 11,937 | 294,661 | 2013-04-19 12:01:23 | 16,081,571 | 16 | 2013-04-18 11:21:43 | 1,615,903 | 2013-04-19 12:01:23 | https://stackoverflow.com/q/16081260 | https://stackoverflow.com/a/16081571 | <p>This is quite easy. Things you will need to do are:</p>
<ul>
<li><p>Reset develop branch to the commit it was before merge</p></li>
<li><p>Reset master branch to the commit it was before merge</p></li>
<li><p>Have the release branch point to the correct commit again</p></li>
<li><p>Remove the tag</p></li>
<li><p>Pu... | <p>This is quite easy. Things you will need to do are:</p> <ul> <li><p>Reset develop branch to the commit it was before merge</p></li> <li><p>Reset master branch to the commit it was before merge</p></li> <li><p>Have the release branch point to the correct commit again</p></li> <li><p>Remove the tag</p></li> <li><p>Pu... | 119, 64339 | git, git-flow | <h1>Revert merge Git-Flow</h1>
<p>I'm using SourceTree and Git-Flow pattern. Now I have prepared a release for my beta-testers to test so I created a new <code>release/v1.0.1</code> branch. But my mind slipped and I decided to finish (merge into <code>develop</code> and <code>master</code> and tag) the release even tho... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,763 | git | # Revert merge Git-Flow
I'm using SourceTree and Git-Flow pattern. Now I have prepared a release for my beta-testers to test so I created a new `release/v1.0.1` branch. But my mind slipped and I decided to finish (merge into `develop` and `master` and tag) the release even though I haven't even sent out the release to... | This is quite easy. Things you will need to do are:
- Reset develop branch to the commit it was before merge
- Reset master branch to the commit it was before merge
- Have the release branch point to the correct commit again
- Remove the tag
- Push the fixed commits to remote
So to do steps 1 and 2:
```
git checkout... |
15712266 | Completely replace remote branch with another in github leaving no traces of the old one | 6 | 2013-03-29 22:16:50 | <p>I pushed a branch to an empty github repo :</p>
<pre><code>MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
$ git remote add github https://github.com/Utumno/ted2012.git
MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
$ git push -u github GitHubSquash
Username for 'https://... | 13,916 | 281,545 | 2015-05-22 02:56:54 | 15,713,613 | 16 | 2013-03-30 00:44:08 | 758,345 | 2013-03-30 00:44:08 | https://stackoverflow.com/q/15712266 | https://stackoverflow.com/a/15713613 | <p>Your syntax is wrong. The correct command is:</p>
<pre><code>git push -f github GitHubSquash
</code></pre>
<p>This will replace the remote GitHubSquash branch with your local version. If you just want to delete the remote branch:</p>
<pre><code>git push -f github :GitHubSquash
</code></pre>
<p>I guess you got yo... | <p>Your syntax is wrong. The correct command is:</p> <pre><code>git push -f github GitHubSquash </code></pre> <p>This will replace the remote GitHubSquash branch with your local version. If you just want to delete the remote branch:</p> <pre><code>git push -f github :GitHubSquash </code></pre> <p>I guess you got yo... | 119, 386, 4236 | git, push, ssh | <h1>Completely replace remote branch with another in github leaving no traces of the old one</h1>
<p>I pushed a branch to an empty github repo :</p>
<pre><code>MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
$ git remote add github https://github.com/Utumno/ted2012.git
MrD@MRSD /c/Dropbox/eclipse... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,764 | git | # Completely replace remote branch with another in github leaving no traces of the old one
I pushed a branch to an empty github repo :
```
MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/ted2012 (GitHubSquash)
$ git remote add github https://github.com/Utumno/ted2012.git
MrD@MRSD /c/Dropbox/eclipse_workspaces/javaEE/t... | Your syntax is wrong. The correct command is:
```
git push -f github GitHubSquash
```
This will replace the remote GitHubSquash branch with your local version. If you just want to delete the remote branch:
```
git push -f github :GitHubSquash
```
I guess you got your error, because git is trying to interpret `:gith... |
13008170 | I'm not able to revert a file while it's conflicting. git | 6 | 2012-10-22 09:13:20 | <p>Here is what I've done:</p>
<ul>
<li>Create folder testA</li>
<li>Create a file "a.txt" with it's contents "a"</li>
<li>Git init into the folder testA</li>
<li>git add .</li>
<li>git commit -a -m "first"</li>
<li>change the file's "a.txt" contents to "b"</li>
<li>git add .</li>
<li>git commit -a -m "changed to b"</... | 7,690 | 305,270 | 2018-12-25 17:46:24 | 13,008,576 | 16 | 2012-10-22 09:37:33 | 683,080 | 2012-10-22 10:17:20 | https://stackoverflow.com/q/13008170 | https://stackoverflow.com/a/13008576 | <p>First, get back to a good state with:</p>
<pre><code>git revert --abort
</code></pre>
<p>Next, look at what you're asking. <code>git revert</code> takes the commit id of the commit you want to undo. The first commit sets <code>a.txt</code> to be:</p>
<pre><code>a
</code></pre>
<p>The second commit makes it hav... | <p>First, get back to a good state with:</p> <pre><code>git revert --abort </code></pre> <p>Next, look at what you're asking. <code>git revert</code> takes the commit id of the commit you want to undo. The first commit sets <code>a.txt</code> to be:</p> <pre><code>a </code></pre> <p>The second commit makes it hav... | 119, 12309 | git, revert | <h1>I'm not able to revert a file while it's conflicting. git</h1>
<p>Here is what I've done:</p>
<ul>
<li>Create folder testA</li>
<li>Create a file "a.txt" with it's contents "a"</li>
<li>Git init into the folder testA</li>
<li>git add .</li>
<li>git commit -a -m "first"</li>
<li>change the file's "a.txt" contents t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,765 | git | # I'm not able to revert a file while it's conflicting. git
Here is what I've done:
- Create folder testA
- Create a file "a.txt" with it's contents "a"
- Git init into the folder testA
- git add .
- git commit -a -m "first"
- change the file's "a.txt" contents to "b"
- git add .
- git commit -a -m "changed to b"
- g... | First, get back to a good state with:
```
git revert --abort
```
Next, look at what you're asking. `git revert` takes the commit id of the commit you want to undo. The first commit sets `a.txt` to be:
```
a
```
The second commit makes it have:
```
b
```
And you want to revert the first commit. So what that is say... |
7549030 | Trying to get jenkins and gitolite to work successfully - Permission denied (publickey,password) | 6 | 2011-09-25 22:20:13 | <p>I have been trying for days to get my gitolite work with jenkins so I can have repos hosted from server and working with Jenkins (they are on the same sever).</p>
<p>I have gitolite working but I guess I have problems with ssh.
I got some help on a chat and added private key to jenkins/.ssh.</p>
<p>I have a user "... | 8,034 | 964,102 | 2011-12-12 14:50:38 | 8,476,126 | 16 | 2011-12-12 14:50:38 | 15,770 | 2011-12-12 14:50:38 | https://stackoverflow.com/q/7549030 | https://stackoverflow.com/a/8476126 | <p>SSH into the Jenkins box and create an SSH key pair for the Jenkins user (assuming <code>jenkins</code> here):</p>
<pre><code>local$ ssh jenkins-box
you@jenkins-box$ sudo su jenkins
jenkins@jenkins-box$ ssh-keygen
jenkins@jenkins-box$ cat $HOME/.ssh/id_rsa.pub
</code></pre>
<p>Copy the SSH public key you see on th... | <p>SSH into the Jenkins box and create an SSH key pair for the Jenkins user (assuming <code>jenkins</code> here):</p> <pre><code>local$ ssh jenkins-box you@jenkins-box$ sudo su jenkins jenkins@jenkins-box$ ssh-keygen jenkins@jenkins-box$ cat $HOME/.ssh/id_rsa.pub </code></pre> <p>Copy the SSH public key you see on th... | 386, 39151, 64999 | gitolite, jenkins, ssh | <h1>Trying to get jenkins and gitolite to work successfully - Permission denied (publickey,password)</h1>
<p>I have been trying for days to get my gitolite work with jenkins so I can have repos hosted from server and working with Jenkins (they are on the same sever).</p>
<p>I have gitolite working but I guess I have p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,766 | git | # Trying to get jenkins and gitolite to work successfully - Permission denied (publickey,password)
I have been trying for days to get my gitolite work with jenkins so I can have repos hosted from server and working with Jenkins (they are on the same sever).
I have gitolite working but I guess I have problems with ssh... | SSH into the Jenkins box and create an SSH key pair for the Jenkins user (assuming `jenkins` here):
```
local$ ssh jenkins-box
you@jenkins-box$ sudo su jenkins
jenkins@jenkins-box$ ssh-keygen
jenkins@jenkins-box$ cat $HOME/.ssh/id_rsa.pub
```
Copy the SSH public key you see on the screen and paste it into the new fil... |
7559985 | Git: How do I remove files listed in git status -s with "??", these are files I added to local repo? | 6 | 2011-09-26 19:06:21 | <p>I have a few files in my git status -s listed as,</p>
<blockquote>
<p>?? file1</p>
<p>?? filepath/file2</p>
<p>?? file3</p>
<p>?? filepath/file4</p>
</blockquote>
<p>I have been ignoring these and going along committing, pushing, pulling, and I am at the point where there are too many of these in my status report.</... | 40,163 | 625,740 | 2021-03-12 09:42:01 | 7,560,040 | 16 | 2011-09-26 19:11:08 | 273,075 | 2011-09-26 19:11:08 | https://stackoverflow.com/q/7559985 | https://stackoverflow.com/a/7560040 | <p>These are untracked files, i.e. the files which are present in your file system, but you've never added them to your repository by <code>git add</code>.</p>
<p>If you don't need them, you can just <code>rm</code> them. Or simply <code>git clean -fd</code> if you want to delete them all. If you want to do some filte... | <p>These are untracked files, i.e. the files which are present in your file system, but you've never added them to your repository by <code>git add</code>.</p> <p>If you don't need them, you can just <code>rm</code> them. Or simply <code>git clean -fd</code> if you want to delete them all. If you want to do some filte... | 119 | git | <h1>Git: How do I remove files listed in git status -s with "??", these are files I added to local repo?</h1>
<p>I have a few files in my git status -s listed as,</p>
<blockquote>
<p>?? file1</p>
<p>?? filepath/file2</p>
<p>?? file3</p>
<p>?? filepath/file4</p>
</blockquote>
<p>I have been ignoring these and going alon... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,767 | git | # Git: How do I remove files listed in git status -s with "??", these are files I added to local repo?
I have a few files in my git status -s listed as,
> ?? file1
>
> ?? filepath/file2
>
> ?? file3
>
> ?? filepath/file4
I have been ignoring these and going along committing, pushing, pulling, and I am at the point w... | These are untracked files, i.e. the files which are present in your file system, but you've never added them to your repository by `git add`.
If you don't need them, you can just `rm` them. Or simply `git clean -fd` if you want to delete them all. If you want to do some filtering before removing them, you can do:
```... |
5510113 | How can I fix a local out of date error with git? | 6 | 2011-04-01 07:01:11 | <p>I am trying to push to a remote repo but keep getting the error below.</p>
<pre><code>$ git push
To user@remote.net:/home/user/repos/remoterepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'user@remote:/home/user/repos/remoterepo.git'
To prevent you from losing ... | 27,684 | 172,406 | 2017-04-22 19:32:48 | 5,510,208 | 16 | 2011-04-01 07:11:41 | 520,162 | 2017-04-22 19:32:48 | https://stackoverflow.com/q/5510113 | https://stackoverflow.com/a/5510208 | <ol>
<li>(<strong>see update below</strong>) yes, it is possible: <code>git push --force</code>. But do that only if you are absolutely sure that nobody has read the repo since the last <code>push</code> (see <a href="https://stackoverflow.com/questions/253055/how-do-i-push-amended-commit-to-the-remote-git-repo">How do... | <ol> <li>(<strong>see update below</strong>) yes, it is possible: <code>git push --force</code>. But do that only if you are absolutely sure that nobody has read the repo since the last <code>push</code> (see <a href="https://stackoverflow.com/questions/253055/how-do-i-push-amended-commit-to-the-remote-git-repo">How do... | 119, 3146, 28898 | conflict, git, git-push | <h1>How can I fix a local out of date error with git?</h1>
<p>I am trying to push to a remote repo but keep getting the error below.</p>
<pre><code>$ git push
To user@remote.net:/home/user/repos/remoterepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'user@remote:/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,768 | git | # How can I fix a local out of date error with git?
I am trying to push to a remote repo but keep getting the error below.
```
$ git push
To user@remote.net:/home/user/repos/remoterepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'user@remote:/home/user/repos/remoter... | 1. (**see update below**) yes, it is possible: `git push --force`. But do that only if you are absolutely sure that nobody has read the repo since the last `push` (see [How do I push amended commit to the remote Git repository?](https://stackoverflow.com/questions/253055/how-do-i-push-amended-commit-to-the-remote-git-r... |
3483958 | Capistrano uploads the .git directory | 6 | 2010-08-14 15:19:22 | <p>I am using git with capistrano.</p>
<p>I initialized my project inside my folder on my local machine as such:</p>
<pre><code>git init
</code></pre>
<p>I then pushed the project the server directory
I then called <code>cap deploy</code>
The deploy works, except that it uploads the local .git folder structure, as w... | 5,375 | 118,175 | 2010-08-18 11:44:07 | 3,484,080 | 16 | 2010-08-14 15:59:58 | 159,376 | 2010-08-14 15:59:58 | https://stackoverflow.com/q/3483958 | https://stackoverflow.com/a/3484080 | <p>What is your deploy strategy?</p>
<p>Do you have Capistrano setup to exclude the .git file?
if you are using <code>set :deploy_via, :copy</code> then make sure to add the following:</p>
<p><code>set :copy_exclude, [".git/*", ".svn/*", ".DS_Store"]</code></p>
<p>Otherwise use <code>set :deploy_via, :export</code> ... | <p>What is your deploy strategy?</p> <p>Do you have Capistrano setup to exclude the .git file? if you are using <code>set :deploy_via, :copy</code> then make sure to add the following:</p> <p><code>set :copy_exclude, [".git/*", ".svn/*", ".DS_Store"]</code></p> <p>Otherwise use <code>set :deploy_via, :export</code> ... | 5, 119, 190, 456, 2831 | capistrano, deployment, git, php, version-control | <h1>Capistrano uploads the .git directory</h1>
<p>I am using git with capistrano.</p>
<p>I initialized my project inside my folder on my local machine as such:</p>
<pre><code>git init
</code></pre>
<p>I then pushed the project the server directory
I then called <code>cap deploy</code>
The deploy works, except that i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,769 | git | # Capistrano uploads the .git directory
I am using git with capistrano.
I initialized my project inside my folder on my local machine as such:
```
git init
```
I then pushed the project the server directory
I then called `cap deploy`
The deploy works, except that it uploads the local .git folder structure, as well ... | What is your deploy strategy?
Do you have Capistrano setup to exclude the .git file?
if you are using `set :deploy_via, :copy` then make sure to add the following:
`set :copy_exclude, [".git/*", ".svn/*", ".DS_Store"]`
Otherwise use `set :deploy_via, :export` which should ignore your source control folders
<http://... |
5047366 | Why does `git stash -p` sometimes fail? | 81 | 2011-02-18 22:46:51 | <p>I ♥ <code>git stash -p</code>. But sometimes, after a satisfying session of <code>y</code>, <code>n</code>, and <code>s</code>, I get this:</p>
<pre><code>Saved working directory and index state WIP on foo: 9794c1a lorum ipsum
error: patch failed: spec/models/thing_spec.rb:65
error: spec/models/thing_spec.rb: patch... | 9,787 | 168,143 | 2021-01-31 10:39:33 | 49,331,025 | 15 | 2018-03-16 23:54:54 | 6,309 | 2021-01-31 10:39:33 | https://stackoverflow.com/q/5047366 | https://stackoverflow.com/a/49331025 | <p><code>git stash -p</code> should fail less with Git 2.17 (Q2 2018).<br />
Before that, "<code>git add -p</code>" (which shares logic with <code>git stash</code>) has been lazy in coalescing split patches before passing the result to underlying "<code>git apply</code>", leading to corner case bugs... | <p><code>git stash -p</code> should fail less with Git 2.17 (Q2 2018).<br /> Before that, "<code>git add -p</code>" (which shares logic with <code>git stash</code>) has been lazy in coalescing split patches before passing the result to underlying "<code>git apply</code>", leading to corner case bugs... | 119, 13091 | git, git-stash | <h1>Why does `git stash -p` sometimes fail?</h1>
<p>I ♥ <code>git stash -p</code>. But sometimes, after a satisfying session of <code>y</code>, <code>n</code>, and <code>s</code>, I get this:</p>
<pre><code>Saved working directory and index state WIP on foo: 9794c1a lorum ipsum
error: patch failed: spec/models/thing_s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,773 | git | # Why does `git stash -p` sometimes fail?
I ♥ `git stash -p`. But sometimes, after a satisfying session of `y`, `n`, and `s`, I get this:
```
Saved working directory and index state WIP on foo: 9794c1a lorum ipsum
error: patch failed: spec/models/thing_spec.rb:65
error: spec/models/thing_spec.rb: patch does not apply... | `git stash -p` should fail less with Git 2.17 (Q2 2018).
Before that, "`git add -p`" (which shares logic with `git stash`) has been lazy in coalescing split patches before passing the result to underlying "`git apply`", leading to corner case bugs; the logic to prepare the patch to be applied after hunk selections ha... |
1216733 | Remove a directory permanently from git | 50 | 2009-08-01 14:44:31 | <p>In my personal git repo, I have a directory that contains thousands of small images that are no longer needed. Is there a way to delete them from the entire git history? I have tried </p>
<pre><code>git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch imgs" HEAD
</code></pre>
<p>and</p>
<pre><co... | 47,524 | 129,962 | 2021-01-21 23:17:42 | 1,225,302 | 15 | 2009-08-04 00:48:22 | 105,741 | 2009-08-04 00:48:22 | https://stackoverflow.com/q/1216733 | https://stackoverflow.com/a/1225302 | <p>Actually none of these techniques workedfor me.
I found the most reliable was was to simply pull locally into another repo:</p>
<pre><code>git pull file://$(pwd)/myGitRepo
</code></pre>
<p>It also saves you the hassle of deletig old tags. </p>
<p>see the story on my blog:
<a href="http://stubbisms.wordpress.com/... | <p>Actually none of these techniques workedfor me. I found the most reliable was was to simply pull locally into another repo:</p> <pre><code>git pull file://$(pwd)/myGitRepo </code></pre> <p>It also saves you the hassle of deletig old tags. </p> <p>see the story on my blog: <a href="http://stubbisms.wordpress.com/... | 119 | git | <h1>Remove a directory permanently from git</h1>
<p>In my personal git repo, I have a directory that contains thousands of small images that are no longer needed. Is there a way to delete them from the entire git history? I have tried </p>
<pre><code>git filter-branch --index-filter "git rm -rf --cached --ignore-unmat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,777 | git | # Remove a directory permanently from git
In my personal git repo, I have a directory that contains thousands of small images that are no longer needed. Is there a way to delete them from the entire git history? I have tried
```
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch imgs" HEAD
```
an... | Actually none of these techniques workedfor me.
I found the most reliable was was to simply pull locally into another repo:
```
git pull file://$(pwd)/myGitRepo
```
It also saves you the hassle of deletig old tags.
see the story on my blog:
<http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-o... |
14043961 | Git squash history after merge | 48 | 2012-12-26 17:28:47 | <p>I merged an upstream of a large project with my local git repo. Prior to the merge I had a small amount of history that was easy to read through, but after the merge a massive amount of history is now in my repo. I have no need for all the history commits from the upstream repo.</p>
<p>There have been other commits... | 53,562 | 561,624 | 2023-06-20 18:56:48 | 14,070,388 | 15 | 2012-12-28 13:38:24 | 561,624 | 2014-01-07 16:50:02 | https://stackoverflow.com/q/14043961 | https://stackoverflow.com/a/14070388 | <p>The solution I ended up using was to manually recreate the history. I did this mainly because I didn't want to spend too much time looking for an elegant solution and there wasn't that much history (around 30 commits I'd have to manually merge).</p>
<p>So, I created a branch before I merged the huge upstream:</p>
... | <p>The solution I ended up using was to manually recreate the history. I did this mainly because I didn't want to spend too much time looking for an elegant solution and there wasn't that much history (around 30 commits I'd have to manually merge).</p> <p>So, I created a branch before I merged the huge upstream:</p> ... | 119, 28897, 42532 | git, git-merge, squash | <h1>Git squash history after merge</h1>
<p>I merged an upstream of a large project with my local git repo. Prior to the merge I had a small amount of history that was easy to read through, but after the merge a massive amount of history is now in my repo. I have no need for all the history commits from the upstream rep... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,778 | git | # Git squash history after merge
I merged an upstream of a large project with my local git repo. Prior to the merge I had a small amount of history that was easy to read through, but after the merge a massive amount of history is now in my repo. I have no need for all the history commits from the upstream repo.
There... | The solution I ended up using was to manually recreate the history. I did this mainly because I didn't want to spend too much time looking for an elegant solution and there wasn't that much history (around 30 commits I'd have to manually merge).
So, I created a branch before I merged the huge upstream:
```
git checko... |
18726217 | .gitignore file for java eclipse project | 46 | 2013-09-10 18:20:55 | <p>I have java project that uses the Eclipse IDE.</p>
<p>The Eclipse workspace is pointing to this directory:</p>
<pre><code>/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse
</code></pre>
<p>I have placed a <code>.gitignore</code> file in <strong>the workspace directory</strong>... | 126,406 | 2,707,727 | 2015-01-20 15:14:43 | 18,726,816 | 15 | 2013-09-10 18:58:25 | 1,911,306 | 2015-01-20 15:14:43 | https://stackoverflow.com/q/18726217 | https://stackoverflow.com/a/18726816 | <p>put .gitignore in your main catalog</p>
<pre><code>git status (you will see which files you can commit)
git add -A
git commit -m "message"
git push
</code></pre>
| <p>put .gitignore in your main catalog</p> <pre><code>git status (you will see which files you can commit) git add -A git commit -m "message" git push </code></pre> | 53, 119 | eclipse, git | <h1>.gitignore file for java eclipse project</h1>
<p>I have java project that uses the Eclipse IDE.</p>
<p>The Eclipse workspace is pointing to this directory:</p>
<pre><code>/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse
</code></pre>
<p>I have placed a <code>.gitignore</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,779 | git | # .gitignore file for java eclipse project
I have java project that uses the Eclipse IDE.
The Eclipse workspace is pointing to this directory:
```
/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse
```
I have placed a `.gitignore` file in **the workspace directory** "Eclipse". Se... | put .gitignore in your main catalog
```
git status (you will see which files you can commit)
git add -A
git commit -m "message"
git push
``` |
16077691 | How to update a file in remote repo, without cloning that repo first? | 43 | 2013-04-18 08:10:01 | <p>Is there a way to push a commit to a remote git repo, without first making a local clone of that repo?</p>
<p>I have a valid URL for the remote repo, I know the path of the file, and all I want to do is push an updated version of the file onto the master. Ideally I'd like this to work with any valid remote repo URL... | 35,899 | 577,888 | 2023-09-21 14:05:11 | 16,079,059 | 15 | 2013-04-18 09:20:26 | 720,999 | 2013-04-18 09:20:26 | https://stackoverflow.com/q/16077691 | https://stackoverflow.com/a/16079059 | <p>Impossible. But since a prospective commit would just need to have one single commit as its parent it's possible to employ the so-called "shallow cloning" and fetch just the tip commit of the branch you need. This will bring only a minimum amount of objects from the remote. Look for the <code>--depth</code> command-... | <p>Impossible. But since a prospective commit would just need to have one single commit as its parent it's possible to employ the so-called "shallow cloning" and fetch just the tip commit of the branch you need. This will bring only a minimum amount of objects from the remote. Look for the <code>--depth</code> command-... | 119 | git | <h1>How to update a file in remote repo, without cloning that repo first?</h1>
<p>Is there a way to push a commit to a remote git repo, without first making a local clone of that repo?</p>
<p>I have a valid URL for the remote repo, I know the path of the file, and all I want to do is push an updated version of the fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,780 | git | # How to update a file in remote repo, without cloning that repo first?
Is there a way to push a commit to a remote git repo, without first making a local clone of that repo?
I have a valid URL for the remote repo, I know the path of the file, and all I want to do is push an updated version of the file onto the maste... | Impossible. But since a prospective commit would just need to have one single commit as its parent it's possible to employ the so-called "shallow cloning" and fetch just the tip commit of the branch you need. This will bring only a minimum amount of objects from the remote. Look for the `--depth` command-line option of... |
58707272 | Should .dockerignore typically be a superset of .gitignore? | 41 | 2019-11-05 08:30:35 | <p>Let's focus on a scenario where both Docker and Git are used in a project. In this case it's convenient to maintain both <code>.gitignore</code> and <code>.dockerignore</code> files.</p>
<p>I'm trying to understand the relation between the two files. My beginner's suspicion is that <code>.dockerignore</code> should... | 41,614 | 889,779 | 2023-12-08 11:42:16 | 58,709,867 | 15 | 2019-11-05 10:56:18 | 10,008,173 | 2019-11-05 10:56:18 | https://stackoverflow.com/q/58707272 | https://stackoverflow.com/a/58709867 | <p>It is fairly common to build an application outside of Docker and inject the resulting binary. The most common example I see on SO is with Java-based applications. The Java class file format is designed to be portable across environments and so there aren't a lot of differences if a .jar file is built on a develop... | <p>It is fairly common to build an application outside of Docker and inject the resulting binary. The most common example I see on SO is with Java-based applications. The Java class file format is designed to be portable across environments and so there aren't a lot of differences if a .jar file is built on a develop... | 119, 90304 | docker, git | <h1>Should .dockerignore typically be a superset of .gitignore?</h1>
<p>Let's focus on a scenario where both Docker and Git are used in a project. In this case it's convenient to maintain both <code>.gitignore</code> and <code>.dockerignore</code> files.</p>
<p>I'm trying to understand the relation between the two fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,781 | git | # Should .dockerignore typically be a superset of .gitignore?
Let's focus on a scenario where both Docker and Git are used in a project. In this case it's convenient to maintain both `.gitignore` and `.dockerignore` files.
I'm trying to understand the relation between the two files. My beginner's suspicion is that `.... | It is fairly common to build an application outside of Docker and inject the resulting binary. The most common example I see on SO is with Java-based applications. The Java class file format is designed to be portable across environments and so there aren't a lot of differences if a .jar file is built on a developer's ... |
26134026 | How to get the current checked out Git branch name through pygit2? | 37 | 2014-10-01 04:16:58 | <p>This question should be related to:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/6245570/how-to-get-current-branch-name-in-git">How to get the current branch name in Git?</a></li>
<li><a href="https://stackoverflow.com/questions/18659425/get-git-current-branch-tag-name">Get git current branch/tag name<... | 53,111 | 261,718 | 2023-12-19 15:30:04 | 26,134,387 | 15 | 2014-10-01 04:57:02 | 4,021,077 | 2019-09-25 14:27:38 | https://stackoverflow.com/q/26134026 | https://stackoverflow.com/a/26134387 | <p>From
<a href="http://pygit2.org/references.html#the-head" rel="noreferrer">PyGit Documentation</a></p>
<p>Either of these should work</p>
<pre><code>#!/usr/bin/python
from pygit2 import Repository
repo = Repository('/path/to/your/git/repo')
# option 1
head = repo.head
print("Head is " + head.name)
# option 2
h... | <p>From <a href="http://pygit2.org/references.html#the-head" rel="noreferrer">PyGit Documentation</a></p> <p>Either of these should work</p> <pre><code>#!/usr/bin/python from pygit2 import Repository repo = Repository('/path/to/your/git/repo') # option 1 head = repo.head print("Head is " + head.name) # option 2 h... | 16, 119, 91899 | git, pygit2, python | <h1>How to get the current checked out Git branch name through pygit2?</h1>
<p>This question should be related to:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/6245570/how-to-get-current-branch-name-in-git">How to get the current branch name in Git?</a></li>
<li><a href="https://stackoverflow.com/question... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,782 | git | # How to get the current checked out Git branch name through pygit2?
This question should be related to:
- [How to get the current branch name in Git?](https://stackoverflow.com/questions/6245570/how-to-get-current-branch-name-in-git)
- [Get git current branch/tag name](https://stackoverflow.com/questions/18659425/ge... | From
[PyGit Documentation](http://pygit2.org/references.html#the-head)
Either of these should work
```
#!/usr/bin/python
from pygit2 import Repository
repo = Repository('/path/to/your/git/repo')
# option 1
head = repo.head
print("Head is " + head.name)
# option 2
head = repo.lookup_reference('HEAD').resolve()
prin... |
13192594 | Add patch in git, all hunks matching regex in file | 36 | 2012-11-02 09:32:49 | <p>Is there a way to add all hunks in a file matching a regex?</p>
<p>I know I can search for a given hunk with /, but that only finds the first. I want to add all matching.</p>
| 4,385 | 94,394 | 2020-08-26 09:48:09 | 13,193,446 | 15 | 2012-11-02 10:29:46 | 6,309 | 2014-02-19 18:38:18 | https://stackoverflow.com/q/13192594 | https://stackoverflow.com/a/13193446 | <p>Sadly, the <a href="http://git.661346.n2.nabble.com/feature-request-git-add-interactive-patch-on-regex-matched-hunks-only-td6614839.html" rel="noreferrer">patch in July 2011</a> went nowhere for now.<br />
It would have introduced a <code>git add --hunks=magic</code> option.</p>
<p>For now, you will have to do with:... | <p>Sadly, the <a href="http://git.661346.n2.nabble.com/feature-request-git-add-interactive-patch-on-regex-matched-hunks-only-td6614839.html" rel="noreferrer">patch in July 2011</a> went nowhere for now.<br /> It would have introduced a <code>git add --hunks=magic</code> option.</p> <p>For now, you will have to do with:... | 119 | git | <h1>Add patch in git, all hunks matching regex in file</h1>
<p>Is there a way to add all hunks in a file matching a regex?</p>
<p>I know I can search for a given hunk with /, but that only finds the first. I want to add all matching.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,784 | git | # Add patch in git, all hunks matching regex in file
Is there a way to add all hunks in a file matching a regex?
I know I can search for a given hunk with /, but that only finds the first. I want to add all matching. | Sadly, the [patch in July 2011](http://git.661346.n2.nabble.com/feature-request-git-add-interactive-patch-on-regex-matched-hunks-only-td6614839.html) went nowhere for now.
It would have introduced a `git add --hunks=magic` option.
For now, you will have to do with:
- extracting a patch based on your regexp: see "[F... |
1611211 | How do I make git accept mode changes without accepting all text changes? | 36 | 2009-10-23 03:15:58 | <p>I've got the opposite problem from "<a href="http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-mode-changes-chmod">How do I make git ignore mode changes (chmod)?</a>" I've got a file that I've changed executable permission on, but there are also some text changes, and I want to commit the... | 29,470 | 38,765 | 2022-05-22 20:35:36 | 1,611,216 | 15 | 2009-10-23 03:19:44 | 90,723 | 2009-10-23 03:19:44 | https://stackoverflow.com/q/1611211 | https://stackoverflow.com/a/1611216 | <p><code>git add -i</code> will let you selectively add some hunks from a file to the index. I don't know whether or not it's sensitive to permissions, but if you were to add a hunk after the <code>chmod</code> operation, it might end up in the index correctly even without explicitly updating the permission.</p>
| <p><code>git add -i</code> will let you selectively add some hunks from a file to the index. I don't know whether or not it's sensitive to permissions, but if you were to add a hunk after the <code>chmod</code> operation, it might end up in the index correctly even without explicitly updating the permission.</p> | 119, 12380 | chmod, git | <h1>How do I make git accept mode changes without accepting all text changes?</h1>
<p>I've got the opposite problem from "<a href="http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-mode-changes-chmod">How do I make git ignore mode changes (chmod)?</a>" I've got a file that I've changed execu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,785 | git | # How do I make git accept mode changes without accepting all text changes?
I've got the opposite problem from "[How do I make git ignore mode changes (chmod)?](http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-mode-changes-chmod)" I've got a file that I've changed executable permission on, but there... | `git add -i` will let you selectively add some hunks from a file to the index. I don't know whether or not it's sensitive to permissions, but if you were to add a hunk after the `chmod` operation, it might end up in the index correctly even without explicitly updating the permission. |
61849061 | "No secret key" error when signing git commit on Windows | 35 | 2020-05-17 08:34:45 | <p>I'm getting this error when trying to sign a commit:</p>
<pre><code>git commit -S -m "test"
gpg: skipped "EF617ACA9EC3XXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
</code></pre>
<p>This is the output of gpg --list-secret-keys --keyid... | 28,012 | 11,102,663 | 2024-06-10 15:25:45 | 61,849,206 | 15 | 2020-05-17 08:48:49 | 6,309 | 2020-05-17 09:26:13 | https://stackoverflow.com/q/61849061 | https://stackoverflow.com/a/61849206 | <p>Check first the <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgprogram" rel="noreferrer"><code>git config gpg.program</code></a> to see if this is <code>gpg</code> or <code>gpg2</code> (as <a href="https://stackoverflow.com/a/55126589/6309">in here</a>).</p>
<p>And type <code>where gpg... | <p>Check first the <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgprogram" rel="noreferrer"><code>git config gpg.program</code></a> to see if this is <code>gpg</code> or <code>gpg2</code> (as <a href="https://stackoverflow.com/a/55126589/6309">in here</a>).</p> <p>And type <code>where gpg... | 64, 119, 6735 | git, gnupg, windows | <h1>"No secret key" error when signing git commit on Windows</h1>
<p>I'm getting this error when trying to sign a commit:</p>
<pre><code>git commit -S -m "test"
gpg: skipped "EF617ACA9EC3XXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,786 | git | # "No secret key" error when signing git commit on Windows
I'm getting this error when trying to sign a commit:
```
git commit -S -m "test"
gpg: skipped "EF617ACA9EC3XXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
```
This is the output ... | Check first the [`git config gpg.program`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgprogram) to see if this is `gpg` or `gpg2` (as [in here](https://stackoverflow.com/a/55126589/6309)).
And type `where gpg` nd `where gpg2` to check which path is considered for the GPG program.
I suggested t... |
4185888 | How do I read tagger information from a GIT tag? | 35 | 2010-11-15 15:29:12 | <p>So far I have:</p>
<pre><code>git rev-parse <tagname> | xargs git cat-file -p
</code></pre>
<p>but this isn't the easiest thing to parse. I was hoping for something similar to <code>git-log</code>'s <code>--pretty</code> option so I could grab just the info I need.</p>
<p>Any ideas?</p>
| 38,502 | 420,452 | 2024-05-15 15:57:04 | 39,618,451 | 15 | 2016-09-21 13:47:51 | 2,913,137 | 2021-04-29 22:49:25 | https://stackoverflow.com/q/4185888 | https://stackoverflow.com/a/39618451 | <p>This has already been answered a long time ago but still is the top search result even though it's not the best solution anymore, so here it goes:</p>
<p><strong>Command:</strong></p>
<pre><code>git for-each-ref refs/tags/$TAG --shell --format='
TAG=%(refname)
TYPE=%(objecttype)
COMMIT=%(objectname)
TAGGER=%(tagger)... | <p>This has already been answered a long time ago but still is the top search result even though it's not the best solution anymore, so here it goes:</p> <p><strong>Command:</strong></p> <pre><code>git for-each-ref refs/tags/$TAG --shell --format=' TAG=%(refname) TYPE=%(objecttype) COMMIT=%(objectname) TAGGER=%(tagger)... | 119, 60718 | git, git-tag | <h1>How do I read tagger information from a GIT tag?</h1>
<p>So far I have:</p>
<pre><code>git rev-parse <tagname> | xargs git cat-file -p
</code></pre>
<p>but this isn't the easiest thing to parse. I was hoping for something similar to <code>git-log</code>'s <code>--pretty</code> option so I could grab just the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,787 | git | # How do I read tagger information from a GIT tag?
So far I have:
```
git rev-parse <tagname> | xargs git cat-file -p
```
but this isn't the easiest thing to parse. I was hoping for something similar to `git-log`'s `--pretty` option so I could grab just the info I need.
Any ideas? | This has already been answered a long time ago but still is the top search result even though it's not the best solution anymore, so here it goes:
**Command:**
```
git for-each-ref refs/tags/$TAG --shell --format='
TAG=%(refname)
TYPE=%(objecttype)
COMMIT=%(objectname)
TAGGER=%(tagger)
EMAIL=%(taggeremail)
DATE=%(tag... |
18364146 | Show all commits whose diff contain specific string | 34 | 2013-08-21 17:39:13 | <p>As the title says, I want to find every commit whose diff contains specific string.</p>
<p>At the moment, I use </p>
<pre><code>git log -p 'filename'
</code></pre>
<p>Which shows less like interface of every diff, where I search for the string.
Then I backtrace to find the actual commit msg.</p>
<p>Simple alte... | 12,066 | 105,251 | 2018-12-18 23:09:36 | 18,365,134 | 15 | 2013-08-21 18:35:21 | 1,256,452 | 2013-08-21 18:35:21 | https://stackoverflow.com/q/18364146 | https://stackoverflow.com/a/18365134 | <p>Here's a one-liner shell script (split into more than one line for formatting purposes) that extracts the rev-numbers of current-branch-reachable commits affecting <code>path</code> where <code>git show -p</code> contains the given <code>pattern</code>. It's not perfect (it will match commit messages as well as dif... | <p>Here's a one-liner shell script (split into more than one line for formatting purposes) that extracts the rev-numbers of current-branch-reachable commits affecting <code>path</code> where <code>git show -p</code> contains the given <code>pattern</code>. It's not perfect (it will match commit messages as well as dif... | 119, 3346 | dvcs, git | <h1>Show all commits whose diff contain specific string</h1>
<p>As the title says, I want to find every commit whose diff contains specific string.</p>
<p>At the moment, I use </p>
<pre><code>git log -p 'filename'
</code></pre>
<p>Which shows less like interface of every diff, where I search for the string.
Then I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,789 | git | # Show all commits whose diff contain specific string
As the title says, I want to find every commit whose diff contains specific string.
At the moment, I use
```
git log -p 'filename'
```
Which shows less like interface of every diff, where I search for the string.
Then I backtrace to find the actual commit msg.
... | Here's a one-liner shell script (split into more than one line for formatting purposes) that extracts the rev-numbers of current-branch-reachable commits affecting `path` where `git show -p` contains the given `pattern`. It's not perfect (it will match commit messages as well as diffs) but it should be easy to tweak ho... |
17656448 | How does Git decide on conflicts? | 29 | 2013-07-15 14:17:39 | <p>When I pull from GitHub when someone else on the team modified a certain file, Git command shows that there are Unresolved Conflicts that Git couldn't fix. I open Perforce or Visual Studio 2012 to fix the conflicts and the graphical tools shows me there are no conflicts and performs the merge quickly.</p>
<p>Does G... | 15,304 | 1,924,774 | 2020-07-30 07:43:51 | 17,656,908 | 15 | 2013-07-15 14:39:16 | 1,471,829 | 2020-07-30 07:43:51 | https://stackoverflow.com/q/17656448 | https://stackoverflow.com/a/17656908 | <p>Git has an internal merge system that is independent of <code>difftool</code>. Anyway you can specify the <code>merge strategy</code> using the <code>-s</code> option, from the manual:</p>
<pre><code>-s <strategy>
--strategy=<strategy>
</code></pre>
<blockquote>
<p>Use the given merge strategy; can be su... | <p>Git has an internal merge system that is independent of <code>difftool</code>. Anyway you can specify the <code>merge strategy</code> using the <code>-s</code> option, from the manual:</p> <pre><code>-s <strategy> --strategy=<strategy> </code></pre> <blockquote> <p>Use the given merge strategy; can be su... | 119, 62599 | git, merge-conflict-resolution | <h1>How does Git decide on conflicts?</h1>
<p>When I pull from GitHub when someone else on the team modified a certain file, Git command shows that there are Unresolved Conflicts that Git couldn't fix. I open Perforce or Visual Studio 2012 to fix the conflicts and the graphical tools shows me there are no conflicts and... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,794 | git | # How does Git decide on conflicts?
When I pull from GitHub when someone else on the team modified a certain file, Git command shows that there are Unresolved Conflicts that Git couldn't fix. I open Perforce or Visual Studio 2012 to fix the conflicts and the graphical tools shows me there are no conflicts and performs... | Git has an internal merge system that is independent of `difftool`. Anyway you can specify the `merge strategy` using the `-s` option, from the manual:
```
-s <strategy>
--strategy=<strategy>
```
> Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there... |
59537455 | VS Code stage changes shortcut | 28 | 2019-12-30 22:19:29 | <p>What is the VS Code <code>stage changes</code> shortcut?</p>
<p>I mean is it possible to stage a selected file without clicking the plus button in the version control tab?</p>
<p><a href="https://i.sstatic.net/raZSg.png" rel="noreferrer"><img src="https://i.sstatic.net/raZSg.png" alt="enter image description here"... | 10,686 | 9,578,604 | 2024-11-18 09:17:13 | 59,537,666 | 15 | 2019-12-30 22:49:10 | 11,247,175 | 2019-12-30 22:49:10 | https://stackoverflow.com/q/59537455 | https://stackoverflow.com/a/59537666 | <p><code>git.Stage</code> and <code>git.StageAll</code>. They have no keybinding assigned by default. You can assign a custom one in your keyboard shortcut settings. <kbd>CMD</kbd><kbd>K</kbd>+<kbd>CMD</kbd><kbd>S</kbd></p>
| <p><code>git.Stage</code> and <code>git.StageAll</code>. They have no keybinding assigned by default. You can assign a custom one in your keyboard shortcut settings. <kbd>CMD</kbd><kbd>K</kbd>+<kbd>CMD</kbd><kbd>S</kbd></p> | 110, 119, 4198, 74978, 111608 | git, git-stage, ide, keyboard-shortcuts, visual-studio-code | <h1>VS Code stage changes shortcut</h1>
<p>What is the VS Code <code>stage changes</code> shortcut?</p>
<p>I mean is it possible to stage a selected file without clicking the plus button in the version control tab?</p>
<p><a href="https://i.sstatic.net/raZSg.png" rel="noreferrer"><img src="https://i.sstatic.net/raZSg... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,795 | git | # VS Code stage changes shortcut
What is the VS Code `stage changes` shortcut?
I mean is it possible to stage a selected file without clicking the plus button in the version control tab?
[](https://i.sstatic.net/raZSg.png)
Maybe there is no shortcut an... | `git.Stage` and `git.StageAll`. They have no keybinding assigned by default. You can assign a custom one in your keyboard shortcut settings. `CMD``K`+`CMD``S` |
52323008 | Can somebody explain the usage of git range-diff? | 28 | 2018-09-13 23:23:36 | <p>Git version 2.19 introduces <code>git range-diff</code> which is supposed to be used in order to compare two commit ranges. I have been reading the documentation, but I cannot get what is the purpose of this new features.</p>
<p>I checked the official <a href="https://git-scm.com/docs/git-range-diff" rel="noreferre... | 13,543 | 3,705,840 | 2023-09-30 22:15:27 | 52,323,251 | 15 | 2018-09-13 23:59:46 | 1,256,452 | 2020-07-17 19:07:16 | https://stackoverflow.com/q/52323008 | https://stackoverflow.com/a/52323251 | <p>I have not actually used them yet, but they are meant as an improvement over the old <code>git cherry*</code> flow for analysing / comparing some upstream or downstream change-set vs what you have now. To make the range-sets useful we want some set of "here are my commits" and "here are theirs",... | <p>I have not actually used them yet, but they are meant as an improvement over the old <code>git cherry*</code> flow for analysing / comparing some upstream or downstream change-set vs what you have now. To make the range-sets useful we want some set of "here are my commits" and "here are theirs",... | 119 | git | <h1>Can somebody explain the usage of git range-diff?</h1>
<p>Git version 2.19 introduces <code>git range-diff</code> which is supposed to be used in order to compare two commit ranges. I have been reading the documentation, but I cannot get what is the purpose of this new features.</p>
<p>I checked the official <a hr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,796 | git | # Can somebody explain the usage of git range-diff?
Git version 2.19 introduces `git range-diff` which is supposed to be used in order to compare two commit ranges. I have been reading the documentation, but I cannot get what is the purpose of this new features.
I checked the official [Git documentation](https://git-... | I have not actually used them yet, but they are meant as an improvement over the old `git cherry*` flow for analysing / comparing some upstream or downstream change-set vs what you have now. To make the range-sets useful we want some set of "here are my commits" and "here are theirs", expressed as simply as possible.
... |
13291182 | git log without tags | 28 | 2012-11-08 14:41:47 | <p>So I'm doing something like</p>
<pre><code> git log --graph --pretty='%h %d %s' -n10
</code></pre>
<p>to get brief history of my recent commits. </p>
<p>The only issue I have is that most of the time I'm not interested in seeing the tags, only the branches. %d however shows both tags and branches. Is there som... | 14,667 | 1,426,193 | 2023-05-17 07:42:57 | 44,679,666 | 15 | 2017-06-21 14:59:00 | 300,212 | 2017-06-21 14:59:00 | https://stackoverflow.com/q/13291182 | https://stackoverflow.com/a/44679666 | <p><code>git log --format="%C(auto) %h %s"</code></p>
<p><a href="https://i.sstatic.net/ONZW9.png" rel="noreferrer"><img src="https://i.sstatic.net/ONZW9.png" alt="enter image description here"></a></p>
| <p><code>git log --format="%C(auto) %h %s"</code></p> <p><a href="https://i.sstatic.net/ONZW9.png" rel="noreferrer"><img src="https://i.sstatic.net/ONZW9.png" alt="enter image description here"></a></p> | 119, 47913 | git, git-log | <h1>git log without tags</h1>
<p>So I'm doing something like</p>
<pre><code> git log --graph --pretty='%h %d %s' -n10
</code></pre>
<p>to get brief history of my recent commits. </p>
<p>The only issue I have is that most of the time I'm not interested in seeing the tags, only the branches. %d however shows both ta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,797 | git | # git log without tags
So I'm doing something like
```
git log --graph --pretty='%h %d %s' -n10
```
to get brief history of my recent commits.
The only issue I have is that most of the time I'm not interested in seeing the tags, only the branches. %d however shows both tags and branches. Is there some way I can on... | `git log --format="%C(auto) %h %s"`
[](https://i.sstatic.net/ONZW9.png) |
470833 | Suggestions for Grails .gitignore | 28 | 2009-01-22 21:16:45 | <p>So far i've collected the following:</p>
<pre>
*.iws
*.war
.classpath
.DS_Store
.project
.settings
/*.launch
/*.tmproj
/out/**
stacktrace.log
test/reports
</pre>
<p>Any other suggestions?</p>
| 13,104 | 58,061 | 2014-04-09 06:10:10 | 471,171 | 15 | 2009-01-22 22:50:53 | 6,309 | 2014-04-09 06:10:10 | https://stackoverflow.com/q/470833 | https://stackoverflow.com/a/471171 | <p>Update 5 years later (April 2014):</p>
<p>As mentioned in the other answers below, two sites are now able to provide good default .gitignore files, including for a Grails project.</p>
<ul>
<li><p>GitHub, when creating a new repo (based on the <a href="https://github.com/github/gitignore" rel="noreferrer">github/gi... | <p>Update 5 years later (April 2014):</p> <p>As mentioned in the other answers below, two sites are now able to provide good default .gitignore files, including for a Grails project.</p> <ul> <li><p>GitHub, when creating a new repo (based on the <a href="https://github.com/github/gitignore" rel="noreferrer">github/gi... | 119, 848 | git, grails | <h1>Suggestions for Grails .gitignore</h1>
<p>So far i've collected the following:</p>
<pre>
*.iws
*.war
.classpath
.DS_Store
.project
.settings
/*.launch
/*.tmproj
/out/**
stacktrace.log
test/reports
</pre>
<p>Any other suggestions?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,798 | git | # Suggestions for Grails .gitignore
So far i've collected the following:
```
*.iws
*.war
.classpath
.DS_Store
.project
.settings
/*.launch
/*.tmproj
/out/**
stacktrace.log
test/reports
```
Any other suggestions? | Update 5 years later (April 2014):
As mentioned in the other answers below, two sites are now able to provide good default .gitignore files, including for a Grails project.
- GitHub, when creating a new repo (based on the [github/gitignore project](https://github.com/github/gitignore)).
=> [`Grails.gitignore`](ht... |
72844616 | How do I sign git commits using my existing ssh key | 27 | 2022-07-03 07:19:15 | <p>According to GitHub blog you can now sign your commits using your existing ssh key.</p>
<p><a href="https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits" rel="noreferrer">https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits</a></p>
<p>Following that: <a href="https://unix.stackexchange.com/qu... | 46,138 | null | 2024-11-16 15:15:35 | 72,852,713 | 15 | 2022-07-04 06:47:19 | 6,309 | 2024-02-18 18:01:29 | https://stackoverflow.com/q/72844616 | https://stackoverflow.com/a/72852713 | <p>July 2022: I presented that new <a href="https://stackoverflow.com/a/45120525/6309">option here</a>, where I mention:</p>
<blockquote>
<p>The <code>user.signingKey</code> config for ssh signing supports either a path to a file containing the key or for the sake of convenience a literal string with the ssh public key... | <p>July 2022: I presented that new <a href="https://stackoverflow.com/a/45120525/6309">option here</a>, where I mention:</p> <blockquote> <p>The <code>user.signingKey</code> config for ssh signing supports either a path to a file containing the key or for the sake of convenience a literal string with the ssh public key... | 119, 386, 6735 | git, gnupg, ssh | <h1>How do I sign git commits using my existing ssh key</h1>
<p>According to GitHub blog you can now sign your commits using your existing ssh key.</p>
<p><a href="https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits" rel="noreferrer">https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits</a></p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,799 | git | # How do I sign git commits using my existing ssh key
According to GitHub blog you can now sign your commits using your existing ssh key.
<https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits>
Following that: <https://unix.stackexchange.com/questions/269188/use-my-ssh-key-to-sign-git-commits>.
I've also... | July 2022: I presented that new [option here](https://stackoverflow.com/a/45120525/6309), where I mention:
> The `user.signingKey` config for ssh signing supports either a path to a file containing the key or for the sake of convenience a literal string with the ssh public key.
>
> To differentiate between those two c... |
10761348 | Git merging hotfix to multiple branches | 27 | 2012-05-25 21:04:51 | <p>I've been trying to wrap my head around git branching models. I've been looking at <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">http://nvie.com/posts/a-successful-git-branching-model/</a> for some ideas and coming from Subversion one thing I was really looking forward to was ma... | 19,383 | 128,466 | 2019-01-27 06:08:46 | 10,761,469 | 15 | 2012-05-25 21:16:44 | 64,004 | 2012-05-25 21:16:44 | https://stackoverflow.com/q/10761348 | https://stackoverflow.com/a/10761469 | <p>Really, your answer is dependant on if you want your trees to be based on the same history... For example, 4.0 is based on the latest 3.X + all of the changes in 4.0...</p>
<p>Personally, I don't recommend it once you decide to start a new branch(s) for a new version(s). At a give point of time, the software is t... | <p>Really, your answer is dependant on if you want your trees to be based on the same history... For example, 4.0 is based on the latest 3.X + all of the changes in 4.0...</p> <p>Personally, I don't recommend it once you decide to start a new branch(s) for a new version(s). At a give point of time, the software is t... | 119, 53847, 62599 | branching-and-merging, git, merge-conflict-resolution | <h1>Git merging hotfix to multiple branches</h1>
<p>I've been trying to wrap my head around git branching models. I've been looking at <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">http://nvie.com/posts/a-successful-git-branching-model/</a> for some ideas and coming from Subversion... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,800 | git | # Git merging hotfix to multiple branches
I've been trying to wrap my head around git branching models. I've been looking at <http://nvie.com/posts/a-successful-git-branching-model/> for some ideas and coming from Subversion one thing I was really looking forward to was making a change in a single place and merging it... | Really, your answer is dependant on if you want your trees to be based on the same history... For example, 4.0 is based on the latest 3.X + all of the changes in 4.0...
Personally, I don't recommend it once you decide to start a new branch(s) for a new version(s). At a give point of time, the software is taking a diff... |
25392771 | error: The following untracked working tree files would be overwritten by checkout | 26 | 2014-08-19 20:52:36 | <p>When I do <code>git status</code> it says <code>nothing to commit, working directory clean</code></p>
<p>And then I do <code>git pull --rebase</code>, it says: </p>
<pre><code>First, rewinding head to replay your work on top of it...
error: The following untracked working tree files would be overwritten by checkou... | 92,583 | 515,585 | 2020-07-16 21:42:55 | 25,393,898 | 15 | 2014-08-19 22:18:51 | 2,541,573 | 2015-06-03 16:10:19 | https://stackoverflow.com/q/25392771 | https://stackoverflow.com/a/25393898 | <p>Without a complete picture of the repo, what follows is more of a guess than anything else, but it might explain the situation. Let's say your history looks as follows:</p>
<pre><code>A -- C [origin/master]
\
B [HEAD, master]
</code></pre>
<p>You write:</p>
<blockquote>
<p>This file has been coming up con... | <p>Without a complete picture of the repo, what follows is more of a guess than anything else, but it might explain the situation. Let's say your history looks as follows:</p> <pre><code>A -- C [origin/master] \ B [HEAD, master] </code></pre> <p>You write:</p> <blockquote> <p>This file has been coming up con... | 119, 28896, 54839 | git, git-pull, git-status | <h1>error: The following untracked working tree files would be overwritten by checkout</h1>
<p>When I do <code>git status</code> it says <code>nothing to commit, working directory clean</code></p>
<p>And then I do <code>git pull --rebase</code>, it says: </p>
<pre><code>First, rewinding head to replay your work on to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,804 | git | # error: The following untracked working tree files would be overwritten by checkout
When I do `git status` it says `nothing to commit, working directory clean`
And then I do `git pull --rebase`, it says:
```
First, rewinding head to replay your work on top of it...
error: The following untracked working tree files ... | Without a complete picture of the repo, what follows is more of a guess than anything else, but it might explain the situation. Let's say your history looks as follows:
```
A -- C [origin/master]
\
B [HEAD, master]
```
You write:
> This file has been coming up constantly and when I remove it from file system, ... |
16931746 | How to unsquash a commit? | 26 | 2013-06-05 04:46:53 | <p>I have squashed 40 commmits at some point in time, and would like to pick back one commit. Is there some way to do this? I have the commit ref (93ebc467ff512580ae3c5a76790f09dfd5e3e6f2) that I would like to unsquash. </p>
| 31,705 | 596,543 | 2021-05-24 08:39:00 | 16,932,029 | 15 | 2013-06-05 05:15:04 | 1,149,664 | 2013-06-05 05:15:04 | https://stackoverflow.com/q/16931746 | https://stackoverflow.com/a/16932029 | <p>You can add the patch representing that commit onto the top of the branch you are on by doing</p>
<pre><code>git cherry-pick 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
</code></pre>
| <p>You can add the patch representing that commit onto the top of the branch you are on by doing</p> <pre><code>git cherry-pick 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2 </code></pre> | 119 | git | <h1>How to unsquash a commit?</h1>
<p>I have squashed 40 commmits at some point in time, and would like to pick back one commit. Is there some way to do this? I have the commit ref (93ebc467ff512580ae3c5a76790f09dfd5e3e6f2) that I would like to unsquash. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,805 | git | # How to unsquash a commit?
I have squashed 40 commmits at some point in time, and would like to pick back one commit. Is there some way to do this? I have the commit ref (93ebc467ff512580ae3c5a76790f09dfd5e3e6f2) that I would like to unsquash. | You can add the patch representing that commit onto the top of the branch you are on by doing
```
git cherry-pick 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
``` |
17470780 | Is it possible to slim a .git repository without rewriting history? | 25 | 2013-07-04 12:49:23 | <p>We have a number of <code>git</code> repositories which have grown to an unmanageable size due to the historical inclusion of binary test files and java <code>.jar</code> files.</p>
<p>We are just about to go through the exercise of <code>git filter-branch</code>ing these repositories, re-cloning them everywhere the... | 4,372 | 42,473 | 2024-10-03 17:06:05 | 17,622,991 | 15 | 2013-07-12 19:53:45 | 712,605 | 2018-08-20 16:49:26 | https://stackoverflow.com/q/17470780 | https://stackoverflow.com/a/17622991 | <p>Sort of. You can use <a href="https://www.kernel.org/pub/software/scm/git/docs/git-replace.html" rel="noreferrer">Git's replace feature</a> to set aside the big bloated history so that it is only downloaded if needed. It's like a shallow clone, but without a shallow clone's limitations.</p>
<p>The idea is you reb... | <p>Sort of. You can use <a href="https://www.kernel.org/pub/software/scm/git/docs/git-replace.html" rel="noreferrer">Git's replace feature</a> to set aside the big bloated history so that it is only downloaded if needed. It's like a shallow clone, but without a shallow clone's limitations.</p> <p>The idea is you reb... | 119, 25181, 43702, 46509, 61058 | egit, git, git-filter-branch, jgit, large-files | <h1>Is it possible to slim a .git repository without rewriting history?</h1>
<p>We have a number of <code>git</code> repositories which have grown to an unmanageable size due to the historical inclusion of binary test files and java <code>.jar</code> files.</p>
<p>We are just about to go through the exercise of <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,808 | git | # Is it possible to slim a .git repository without rewriting history?
We have a number of `git` repositories which have grown to an unmanageable size due to the historical inclusion of binary test files and java `.jar` files.
We are just about to go through the exercise of `git filter-branch`ing these repositories, r... | Sort of. You can use [Git's replace feature](https://www.kernel.org/pub/software/scm/git/docs/git-replace.html) to set aside the big bloated history so that it is only downloaded if needed. It's like a shallow clone, but without a shallow clone's limitations.
The idea is you reboot a branch by creating a new root comm... |
5572772 | How can I use git for projects templates? | 25 | 2011-04-06 20:50:48 | <p>I have some template/starting point code that I reuse across projects. While working on the new project, I always want to add and change things in the template.
Develop the template alongside the project, I guess.</p>
<p>Some of my additions are project-specific and should no be committed to the template. Others sh... | 8,652 | 498,405 | 2025-04-26 11:25:23 | 5,574,931 | 15 | 2011-04-07 01:31:36 | 260,010 | 2011-04-07 01:31:36 | https://stackoverflow.com/q/5572772 | https://stackoverflow.com/a/5574931 | <p>I would recommend creating a branch specifically for any template changes you want to make. But make sure you start it from one of the earlier commits, so you don't get project-specific changes to your template. Something like <code>git checkout -b template_changes EARLY_COMMIT_SHA</code>.
Then any template changes ... | <p>I would recommend creating a branch specifically for any template changes you want to make. But make sure you start it from one of the earlier commits, so you don't get project-specific changes to your template. Something like <code>git checkout -b template_changes EARLY_COMMIT_SHA</code>. Then any template changes ... | 119, 1478, 53847 | branching-and-merging, git, templates | <h1>How can I use git for projects templates?</h1>
<p>I have some template/starting point code that I reuse across projects. While working on the new project, I always want to add and change things in the template.
Develop the template alongside the project, I guess.</p>
<p>Some of my additions are project-specific an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,809 | git | # How can I use git for projects templates?
I have some template/starting point code that I reuse across projects. While working on the new project, I always want to add and change things in the template.
Develop the template alongside the project, I guess.
Some of my additions are project-specific and should no be c... | I would recommend creating a branch specifically for any template changes you want to make. But make sure you start it from one of the earlier commits, so you don't get project-specific changes to your template. Something like `git checkout -b template_changes EARLY_COMMIT_SHA`.
Then any template changes you have alrea... |
44528357 | git status for a past commit? | 24 | 2017-06-13 17:51:57 | <p>how to do a <code>git status</code> to view changed files in a past commit?</p>
<p>NOTE: this question might have already been asked, but phrased much differently. however, I am astounded to see that searching for the following expression on Google yields no useful results: <code>git status for past commit</code>.<... | 15,070 | 2,476,920 | 2017-06-14 02:46:38 | 44,529,081 | 15 | 2017-06-13 18:36:13 | 2,476,920 | 2017-06-13 18:36:13 | https://stackoverflow.com/q/44528357 | https://stackoverflow.com/a/44529081 | <p>I found: </p>
<p><code>git show --stat --oneline b8351c4</code></p>
<p>Where <code>b8351c4</code> is the regarded commit.</p>
| <p>I found: </p> <p><code>git show --stat --oneline b8351c4</code></p> <p>Where <code>b8351c4</code> is the regarded commit.</p> | 119, 456, 5597, 54839 | commit, git, git-status, version-control | <h1>git status for a past commit?</h1>
<p>how to do a <code>git status</code> to view changed files in a past commit?</p>
<p>NOTE: this question might have already been asked, but phrased much differently. however, I am astounded to see that searching for the following expression on Google yields no useful results: <c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,811 | git | # git status for a past commit?
how to do a `git status` to view changed files in a past commit?
NOTE: this question might have already been asked, but phrased much differently. however, I am astounded to see that searching for the following expression on Google yields no useful results: `git status for past commit`. | I found:
`git show --stat --oneline b8351c4`
Where `b8351c4` is the regarded commit. |
3890678 | git: find largest commit(s) | 24 | 2010-10-08 12:57:53 | <p>What would be a way to find largest commits (i.e. commits introducing most changes, for instance counted as the number of added/removed lines) in a git repo?</p>
<p>Note that I really want <strong>largest commits</strong>, not <strong>largest files</strong>, so <a href="https://stackoverflow.com/questions/1286183/g... | 5,384 | 284,428 | 2024-11-14 01:18:01 | 3,890,929 | 15 | 2010-10-08 13:22:42 | 356,716 | 2010-10-08 13:22:42 | https://stackoverflow.com/q/3890678 | https://stackoverflow.com/a/3890929 | <p>you can use <code>git log --format=format:"%H" --shortstat</code>.
It will output something like</p>
<pre><code>b90c0895b90eb3a6d1528465f3b5d96a575dbda2
2 files changed, 32 insertions(+), 7 deletions(-)
642b5e1910e1c2134c278b97752dd73b601e8ddb
11 files changed, 835 insertions(+), 504 deletions(-)
// other commi... | <p>you can use <code>git log --format=format:"%H" --shortstat</code>. It will output something like</p> <pre><code>b90c0895b90eb3a6d1528465f3b5d96a575dbda2 2 files changed, 32 insertions(+), 7 deletions(-) 642b5e1910e1c2134c278b97752dd73b601e8ddb 11 files changed, 835 insertions(+), 504 deletions(-) // other commi... | 119 | git | <h1>git: find largest commit(s)</h1>
<p>What would be a way to find largest commits (i.e. commits introducing most changes, for instance counted as the number of added/removed lines) in a git repo?</p>
<p>Note that I really want <strong>largest commits</strong>, not <strong>largest files</strong>, so <a href="https://... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,814 | git | # git: find largest commit(s)
What would be a way to find largest commits (i.e. commits introducing most changes, for instance counted as the number of added/removed lines) in a git repo?
Note that I really want **largest commits**, not **largest files**, so [git find fat commit](https://stackoverflow.com/questions/1... | you can use `git log --format=format:"%H" --shortstat`.
It will output something like
```
b90c0895b90eb3a6d1528465f3b5d96a575dbda2
2 files changed, 32 insertions(+), 7 deletions(-)
642b5e1910e1c2134c278b97752dd73b601e8ddb
11 files changed, 835 insertions(+), 504 deletions(-)
// other commits skipped
```
Seems lik... |
7147789 | Handling temporary changes (not to be committed) in Git | 23 | 2011-08-22 12:56:36 | <p>Often while working on a branch I need to introduce some "temporary" changes (such as additional debugging info, or a change which lets me better observe the thing i'm <em>actually</em> working on).</p>
<p>About these "temporary" changes:</p>
<ul>
<li><strong>I want them in my working copy of my branch</strong>, b... | 7,485 | 399,317 | 2024-10-29 09:55:43 | 7,147,929 | 15 | 2011-08-22 13:07:41 | 223,092 | 2011-08-22 13:19:55 | https://stackoverflow.com/q/7147789 | https://stackoverflow.com/a/7147929 | <p>I typically deal with this by using:</p>
<pre><code>git add -p
</code></pre>
<p>... to stage changes hunk-by-hunk. Then you just have to make sure to press <kbd>n</kbd> for your debugging changes.</p>
<hr>
<p>If I have more involved changes of this type, I'll create a branch called something like <code>local-ch... | <p>I typically deal with this by using:</p> <pre><code>git add -p </code></pre> <p>... to stage changes hunk-by-hunk. Then you just have to make sure to press <kbd>n</kbd> for your debugging changes.</p> <hr> <p>If I have more involved changes of this type, I'll create a branch called something like <code>local-ch... | 119, 1879, 76220 | branch, git, git-branch | <h1>Handling temporary changes (not to be committed) in Git</h1>
<p>Often while working on a branch I need to introduce some "temporary" changes (such as additional debugging info, or a change which lets me better observe the thing i'm <em>actually</em> working on).</p>
<p>About these "temporary" changes:</p>
<ul>
<l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,816 | git | # Handling temporary changes (not to be committed) in Git
Often while working on a branch I need to introduce some "temporary" changes (such as additional debugging info, or a change which lets me better observe the thing i'm *actually* working on).
About these "temporary" changes:
- **I want them in my working copy... | I typically deal with this by using:
```
git add -p
```
... to stage changes hunk-by-hunk. Then you just have to make sure to press `n` for your debugging changes.
---
If I have more involved changes of this type, I'll create a branch called something like `local-changes` with a commit at its tip that introduces th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.