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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2798822 | How to git log in reverse order? | 276 | 2010-05-09 19:13:45 | <p>I recently learned that I can get hg log to print the history in reverse order with:</p>
<pre><code>hg log -r :
</code></pre>
<p>So of course I tried:</p>
<pre><code>git log -r :
</code></pre>
<p>Well, it didn't work. So what is the command to do the same thing in git?</p>
| 99,149 | 310,121 | 2025-03-12 11:15:12 | 2,798,833 | 502 | 2010-05-09 19:16:40 | 94,895 | 2025-03-12 11:15:12 | https://stackoverflow.com/q/2798822 | https://stackoverflow.com/a/2798833 | <p>Use the <code>--reverse</code> option:</p>
<pre><code>git log --reverse
</code></pre>
<p><a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---reverse" rel="noreferrer">https://git-scm.com/docs/git-log#Documentation/git-log.txt---reverse</a></p>
| <p>Use the <code>--reverse</code> option:</p> <pre><code>git log --reverse </code></pre> <p><a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---reverse" rel="noreferrer">https://git-scm.com/docs/git-log#Documentation/git-log.txt---reverse</a></p> | 119, 47913 | git, git-log | <h1>How to git log in reverse order?</h1>
<p>I recently learned that I can get hg log to print the history in reverse order with:</p>
<pre><code>hg log -r :
</code></pre>
<p>So of course I tried:</p>
<pre><code>git log -r :
</code></pre>
<p>Well, it didn't work. So what is the command to do the same thing in git?</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,325 | git | # How to git log in reverse order?
I recently learned that I can get hg log to print the history in reverse order with:
```
hg log -r :
```
So of course I tried:
```
git log -r :
```
Well, it didn't work. So what is the command to do the same thing in git? | Use the `--reverse` option:
```
git log --reverse
```
<https://git-scm.com/docs/git-log#Documentation/git-log.txt---reverse> |
28983842 | Remote rejected (shallow update not allowed) after changing Git remote URL | 277 | 2015-03-11 10:16:23 | <p>I have a project under Git version control that I worked on both a server and my local computer. I originally had the remote origin set as my local computer but I would now like to change that to BitBucket.</p>
<p>On the server I used the command</p>
<pre><code>git remote set-url origin bitbucket_address
</code></... | 137,599 | 2,186,160 | 2024-11-26 14:15:10 | 28,985,327 | 501 | 2015-03-11 11:23:04 | 2,274,224 | 2022-10-20 14:25:54 | https://stackoverflow.com/q/28983842 | https://stackoverflow.com/a/28985327 | <p>As it seems you have used <code>git clone --depth <number></code> to clone your local version. This results in a <em>shallow clone</em>. One limitation of such a clone is that you can't push from it into a <strong>new</strong> repository.</p>
<p>You now have two options:</p>
<ol>
<li>if you don't care about yo... | <p>As it seems you have used <code>git clone --depth <number></code> to clone your local version. This results in a <em>shallow clone</em>. One limitation of such a clone is that you can't push from it into a <strong>new</strong> repository.</p> <p>You now have two options:</p> <ol> <li>if you don't care about yo... | 119, 74346 | git, shallow-clone | <h1>Remote rejected (shallow update not allowed) after changing Git remote URL</h1>
<p>I have a project under Git version control that I worked on both a server and my local computer. I originally had the remote origin set as my local computer but I would now like to change that to BitBucket.</p>
<p>On the server I us... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,326 | git | # Remote rejected (shallow update not allowed) after changing Git remote URL
I have a project under Git version control that I worked on both a server and my local computer. I originally had the remote origin set as my local computer but I would now like to change that to BitBucket.
On the server I used the command
... | As it seems you have used `git clone --depth <number>` to clone your local version. This results in a *shallow clone*. One limitation of such a clone is that you can't push from it into a **new** repository.
You now have two options:
1. if you don't care about your missing history, take a look at [this question](http... |
17582685 | Install gitk on Mac | 358 | 2013-07-10 23:31:55 | <p>How can I install gitk on a Mac?</p>
<p>From their official website, it seems gitk comes with Git, but the version of my Git (<em>git version 1.7.12.4 (Apple Git-37)</em>) does not come with gitk.</p>
<p><code>brew install gitk</code> does not work for gitk.</p>
<p>Version information (copied from comments):</p>
<ul... | 272,458 | 1,246,262 | 2023-09-07 18:18:12 | 17,814,988 | 499 | 2013-07-23 15:48:34 | 867,727 | 2022-04-18 15:45:29 | https://stackoverflow.com/q/17582685 | https://stackoverflow.com/a/17814988 | <p>Correct, the 1.7.12.4 (Apple Git-37) does not come with gitk. You can install a more recent version of Git + git-ui as a separate formula by using <a href="https://en.wikipedia.org/wiki/Homebrew_(package_manager)" rel="noreferrer">Homebrew</a> (executable <em>brew</em>). More thorough instructions are located on <e... | <p>Correct, the 1.7.12.4 (Apple Git-37) does not come with gitk. You can install a more recent version of Git + git-ui as a separate formula by using <a href="https://en.wikipedia.org/wiki/Homebrew_(package_manager)" rel="noreferrer">Homebrew</a> (executable <em>brew</em>). More thorough instructions are located on <e... | 119, 369, 30785, 77491 | git, gitk, macos, osx-mountain-lion | <h1>Install gitk on Mac</h1>
<p>How can I install gitk on a Mac?</p>
<p>From their official website, it seems gitk comes with Git, but the version of my Git (<em>git version 1.7.12.4 (Apple Git-37)</em>) does not come with gitk.</p>
<p><code>brew install gitk</code> does not work for gitk.</p>
<p>Version information (c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,327 | git | # Install gitk on Mac
How can I install gitk on a Mac?
From their official website, it seems gitk comes with Git, but the version of my Git (*git version 1.7.12.4 (Apple Git-37)*) does not come with gitk.
`brew install gitk` does not work for gitk.
Version information (copied from comments):
- [OS X v10.8.2](https... | Correct, the 1.7.12.4 (Apple Git-37) does not come with gitk. You can install a more recent version of Git + git-ui as a separate formula by using [Homebrew](https://en.wikipedia.org/wiki/Homebrew_(package_manager)) (executable *brew*). More thorough instructions are located on *[The fastest and easiest way to install ... |
3321492 | Git alias with positional parameters | 367 | 2010-07-23 19:03:23 | <p>Basically I'm trying to alias:</p>
<pre><code>git files 9fa3
</code></pre>
<p>...to execute the command:</p>
<pre><code>git diff --name-status 9fa3^ 9fa3
</code></pre>
<p>but git doesn't appear to pass positional parameters to the alias command. I have tried:</p>
<pre><code>[alias]
files = "!git diff --name... | 104,978 | 400,575 | 2025-04-16 09:12:08 | 3,322,412 | 496 | 2010-07-23 21:13:56 | 119,963 | 2020-12-04 16:02:45 | https://stackoverflow.com/q/3321492 | https://stackoverflow.com/a/3322412 | <p>A shell function could help on this:</p>
<pre><code>[alias]
files = "!f() { git diff --name-status \"$1^\" \"$1\"; }; f"
</code></pre>
<p>An alias without <code>!</code> is treated as a Git command; e.g. <code>commit-all = commit -a</code>.</p>
<p>With the <code>!</code>, it's run a... | <p>A shell function could help on this:</p> <pre><code>[alias] files = "!f() { git diff --name-status \"$1^\" \"$1\"; }; f" </code></pre> <p>An alias without <code>!</code> is treated as a Git command; e.g. <code>commit-all = commit -a</code>.</p> <p>With the <code>!</code>, it's run a... | 119, 360, 1448, 1796, 3326 | alias, command, git, parameters, position | <h1>Git alias with positional parameters</h1>
<p>Basically I'm trying to alias:</p>
<pre><code>git files 9fa3
</code></pre>
<p>...to execute the command:</p>
<pre><code>git diff --name-status 9fa3^ 9fa3
</code></pre>
<p>but git doesn't appear to pass positional parameters to the alias command. I have tried:</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,328 | git | # Git alias with positional parameters
Basically I'm trying to alias:
```
git files 9fa3
```
...to execute the command:
```
git diff --name-status 9fa3^ 9fa3
```
but git doesn't appear to pass positional parameters to the alias command. I have tried:
```
[alias]
files = "!git diff --name-status $1^ $1"
fi... | A shell function could help on this:
```
[alias]
files = "!f() { git diff --name-status \"$1^\" \"$1\"; }; f"
```
An alias without `!` is treated as a Git command; e.g. `commit-all = commit -a`.
With the `!`, it's run as its own command in the shell, letting you use stronger magic like this.
**UPD**
Because c... |
11722533 | Rollback a Git merge | 357 | 2012-07-30 13:24:45 | <pre><code>develop branch
--> dashboard (working branch)
</code></pre>
<p>I use <code>git merge --no-ff develop</code> to merge any upstream changes into dashboard</p>
<p>git log:</p>
<pre><code>commit 88113a64a21bf8a51409ee2a1321442fd08db705
Merge: 981bc20 888a557
Author: XXXX <>
Date: Mon Jul 30 08:16:4... | 782,634 | 604,683 | 2024-11-12 21:17:45 | 11,722,640 | 496 | 2012-07-30 13:32:27 | 877,115 | 2012-07-30 13:32:27 | https://stackoverflow.com/q/11722533 | https://stackoverflow.com/a/11722640 | <p>Reverting a merge commit has been exhaustively covered in <a href="https://stackoverflow.com/questions/2389361/git-undo-a-merge">other questions.</a> When you do a fast-forward merge, the second one you describe, you can use <code>git reset</code> to get back to the previous state:</p>
<pre><code>git reset --hard &... | <p>Reverting a merge commit has been exhaustively covered in <a href="https://stackoverflow.com/questions/2389361/git-undo-a-merge">other questions.</a> When you do a fast-forward merge, the second one you describe, you can use <code>git reset</code> to get back to the previous state:</p> <pre><code>git reset --hard &... | 119 | git | <h1>Rollback a Git merge</h1>
<pre><code>develop branch
--> dashboard (working branch)
</code></pre>
<p>I use <code>git merge --no-ff develop</code> to merge any upstream changes into dashboard</p>
<p>git log:</p>
<pre><code>commit 88113a64a21bf8a51409ee2a1321442fd08db705
Merge: 981bc20 888a557
Author: XXXX <&... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,329 | git | # Rollback a Git merge
```
develop branch
--> dashboard (working branch)
```
I use `git merge --no-ff develop` to merge any upstream changes into dashboard
git log:
```
commit 88113a64a21bf8a51409ee2a1321442fd08db705
Merge: 981bc20 888a557
Author: XXXX <>
Date: Mon Jul 30 08:16:46 2012 -0500
Merge branch 'de... | Reverting a merge commit has been exhaustively covered in [other questions.](https://stackoverflow.com/questions/2389361/git-undo-a-merge) When you do a fast-forward merge, the second one you describe, you can use `git reset` to get back to the previous state:
```
git reset --hard <commit_before_merge>
```
You can fi... |
3080509 | List Git commits not pushed to the origin yet | 386 | 2010-06-20 18:50:06 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2016901/viewing-unpushed-git-commits">Viewing Unpushed Git Commits</a> </p>
</blockquote>
<p>How do I list all commits which have not been pushed to the origin yet?</p>
<p>Alternatively, how to determine if a ... | 405,985 | 234,780 | 2017-06-30 13:58:45 | 3,080,554 | 495 | 2010-06-20 19:02:51 | 95,706 | 2010-06-20 19:09:19 | https://stackoverflow.com/q/3080509 | https://stackoverflow.com/a/3080554 | <p><code>git log origin/master..master</code></p>
<p>or, more generally:</p>
<p><code>git log <since>..<until></code></p>
<p>You can use this with grep to check for a specific, known commit:</p>
<p><code>git log <since>..<until> | grep <commit-hash></code></p>
<p>Or you can also use g... | <p><code>git log origin/master..master</code></p> <p>or, more generally:</p> <p><code>git log <since>..<until></code></p> <p>You can use this with grep to check for a specific, known commit:</p> <p><code>git log <since>..<until> | grep <commit-hash></code></p> <p>Or you can also use g... | 119 | git | <h1>List Git commits not pushed to the origin yet</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2016901/viewing-unpushed-git-commits">Viewing Unpushed Git Commits</a> </p>
</blockquote>
<p>How do I list all commits which have not been pushed to the or... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,330 | git | # List Git commits not pushed to the origin yet
> **Possible Duplicate:**
> [Viewing Unpushed Git Commits](https://stackoverflow.com/questions/2016901/viewing-unpushed-git-commits)
How do I list all commits which have not been pushed to the origin yet?
Alternatively, how to determine if a commit with particular ha... | `git log origin/master..master`
or, more generally:
`git log <since>..<until>`
You can use this with grep to check for a specific, known commit:
`git log <since>..<until> | grep <commit-hash>`
Or you can also use git-rev-list to search for a specific commit:
`git rev-list origin/master | grep <commit-hash>` |
11533199 | How can I find the commit in which a given file was added? | 341 | 2012-07-18 01:44:41 | <p>Say I have a file <code>foo.js</code> that was committed some time ago. I would like to simply find the commit where this file was first added.</p>
<p>After reading the answers and my own tinkering, this works for me:</p>
<pre class="lang-none prettyprint-override"><code>git log --follow --diff-filter=A --find-renam... | 91,553 | 1,002,260 | 2025-05-13 13:42:58 | 13,598,028 | 495 | 2012-11-28 04:52:11 | 1,858,656 | 2025-05-13 13:17:16 | https://stackoverflow.com/q/11533199 | https://stackoverflow.com/a/13598028 | <p>Here's a simpler, "pure Git" way to do it, without any pipeline needed:</p>
<pre class="lang-none prettyprint-override"><code>git log --diff-filter=A -- foo.js
</code></pre>
<p>Check the documentation. You can do the same thing for Deleted, Modified, etc.</p>
<p><em><a href="https://git-scm.com/docs/git-lo... | <p>Here's a simpler, "pure Git" way to do it, without any pipeline needed:</p> <pre class="lang-none prettyprint-override"><code>git log --diff-filter=A -- foo.js </code></pre> <p>Check the documentation. You can do the same thing for Deleted, Modified, etc.</p> <p><em><a href="https://git-scm.com/docs/git-lo... | 119, 5597, 47913, 53850 | commit, git, git-commit, git-log | <h1>How can I find the commit in which a given file was added?</h1>
<p>Say I have a file <code>foo.js</code> that was committed some time ago. I would like to simply find the commit where this file was first added.</p>
<p>After reading the answers and my own tinkering, this works for me:</p>
<pre class="lang-none prett... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,331 | git | # How can I find the commit in which a given file was added?
Say I have a file `foo.js` that was committed some time ago. I would like to simply find the commit where this file was first added.
After reading the answers and my own tinkering, this works for me:
```
git log --follow --diff-filter=A --find-renames=40% ... | Here's a simpler, "pure Git" way to do it, without any pipeline needed:
```
git log --diff-filter=A -- foo.js
```
Check the documentation. You can do the same thing for Deleted, Modified, etc.
*[git-log - Show commit logs](https://git-scm.com/docs/git-log#Documentation/git-log.txt---diff-filterACDMRTUXB82308203)*
I... |
3011625 | git mv and only change case of directory | 320 | 2010-06-10 04:26:41 | <p>While I found similar <a href="https://stackoverflow.com/questions/1596653/how-to-change-case-of-a-file-in-git-under-cygwin">question</a> I didn't find an answer to my problem</p>
<p>When I try to rename the directory from FOO to foo via <code>git mv FOO foo</code> I get </p>
<pre><code>fatal: renaming 'FOO' fail... | 119,450 | 256,853 | 2024-01-19 06:18:03 | 3,011,723 | 495 | 2010-06-10 04:52:19 | 1,864,976 | 2021-08-27 14:00:19 | https://stackoverflow.com/q/3011625 | https://stackoverflow.com/a/3011723 | <p>You are in a case insensitive environment. Further, adding without the <code>-A</code> will not take care of the remove side of the <code>mv</code> as Git understands it. <strong>Warning! Ensure that no other changes or untracked files are around when you do this or they will get committed as part of this change!</s... | <p>You are in a case insensitive environment. Further, adding without the <code>-A</code> will not take care of the remove side of the <code>mv</code> as Git understands it. <strong>Warning! Ensure that no other changes or untracked files are around when you do this or they will get committed as part of this change!</s... | 119, 369, 456, 9708 | case-sensitive, git, macos, version-control | <h1>git mv and only change case of directory</h1>
<p>While I found similar <a href="https://stackoverflow.com/questions/1596653/how-to-change-case-of-a-file-in-git-under-cygwin">question</a> I didn't find an answer to my problem</p>
<p>When I try to rename the directory from FOO to foo via <code>git mv FOO foo</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,332 | git | # git mv and only change case of directory
While I found similar [question](https://stackoverflow.com/questions/1596653/how-to-change-case-of-a-file-in-git-under-cygwin) I didn't find an answer to my problem
When I try to rename the directory from FOO to foo via `git mv FOO foo` I get
```
fatal: renaming 'FOO' faile... | You are in a case insensitive environment. Further, adding without the `-A` will not take care of the remove side of the `mv` as Git understands it. **Warning! Ensure that no other changes or untracked files are around when you do this or they will get committed as part of this change!** `git stash -u` first, do this a... |
2116778 | Reduce Git repository size | 423 | 2010-01-22 11:09:07 | <p>I tried looking for a good tutorial on reducing Git repository sizes, but I didn't find any.</p>
<p>How do I reduce my repository size?</p>
<p>It's about 10 MB, but <a href="https://en.wikipedia.org/wiki/Heroku" rel="noreferrer">Heroku</a> only allows 50 MB
and I'm nowhere near finished developing my application.</p... | 268,042 | 236,655 | 2025-12-15 07:28:54 | 2,116,892 | 494 | 2010-01-22 11:32:18 | 6,309 | 2025-12-14 16:26:36 | https://stackoverflow.com/q/2116778 | https://stackoverflow.com/a/2116892 | <p>Update Feb. 2021, eleven years later: the new <a href="https://stackoverflow.com/a/64077241/6309"><code>git maintenance</code> command</a> (<a href="https://git-scm.com/docs/git-maintenance" rel="nofollow noreferrer">man page</a>) should supersede <code>git gc</code>, and <a href="https://stackoverflow.com/a/6629807... | <p>Update Feb. 2021, eleven years later: the new <a href="https://stackoverflow.com/a/64077241/6309"><code>git maintenance</code> command</a> (<a href="https://git-scm.com/docs/git-maintenance" rel="nofollow noreferrer">man page</a>) should supersede <code>git gc</code>, and <a href="https://stackoverflow.com/a/6629807... | 119, 44929, 68596, 163989 | git, git-clean, git-gc, git-maintenance | <h1>Reduce Git repository size</h1>
<p>I tried looking for a good tutorial on reducing Git repository sizes, but I didn't find any.</p>
<p>How do I reduce my repository size?</p>
<p>It's about 10 MB, but <a href="https://en.wikipedia.org/wiki/Heroku" rel="noreferrer">Heroku</a> only allows 50 MB
and I'm nowhere near fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,334 | git | # Reduce Git repository size
I tried looking for a good tutorial on reducing Git repository sizes, but I didn't find any.
How do I reduce my repository size?
It's about 10 MB, but [Heroku](https://en.wikipedia.org/wiki/Heroku) only allows 50 MB
and I'm nowhere near finished developing my application.
I added the us... | Update Feb. 2021, eleven years later: the new [`git maintenance` command](https://stackoverflow.com/a/64077241/6309) ([man page](https://git-scm.com/docs/git-maintenance)) should supersede `git gc`, and [can be scheduled](https://stackoverflow.com/a/66298072/6309).
---
Original: [`git gc --aggressive`](http://www.ker... |
3404936 | Show which git tag you are on? | 309 | 2010-08-04 11:10:49 | <p>I'm having trouble finding out which tag is currently checked out.</p>
<p>When I do: </p>
<pre><code>git checkout tag1
git branch
</code></pre>
<p>I can't seem to find out which tag I'm on. It only logs:</p>
<pre><code>* (no branch)
master
</code></pre>
<p>Is it possible to find out which tags are checked out?... | 284,343 | 188,923 | 2024-07-13 20:03:08 | 3,405,221 | 491 | 2010-08-04 11:54:22 | 67,022 | 2024-07-13 20:03:08 | https://stackoverflow.com/q/3404936 | https://stackoverflow.com/a/3405221 | <p><a href="https://stackoverflow.com/users/46058/jakub-nar%c4%99bski">Jakub Narębski</a> has more git-fu. The following much simpler command works perfectly:</p>
<pre><code>git describe --exact-match --tags
</code></pre>
<p>Or without the <code>--tags</code> if you have checked out an annotated tag. My tag is lightwei... | <p><a href="https://stackoverflow.com/users/46058/jakub-nar%c4%99bski">Jakub Narębski</a> has more git-fu. The following much simpler command works perfectly:</p> <pre><code>git describe --exact-match --tags </code></pre> <p>Or without the <code>--tags</code> if you have checked out an annotated tag. My tag is lightwei... | 119, 37230, 60718 | git, git-checkout, git-tag | <h1>Show which git tag you are on?</h1>
<p>I'm having trouble finding out which tag is currently checked out.</p>
<p>When I do: </p>
<pre><code>git checkout tag1
git branch
</code></pre>
<p>I can't seem to find out which tag I'm on. It only logs:</p>
<pre><code>* (no branch)
master
</code></pre>
<p>Is it possible... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,336 | git | # Show which git tag you are on?
I'm having trouble finding out which tag is currently checked out.
When I do:
```
git checkout tag1
git branch
```
I can't seem to find out which tag I'm on. It only logs:
```
* (no branch)
master
```
Is it possible to find out which tags are checked out? In the above example, thi... | [Jakub Narębski](https://stackoverflow.com/users/46058/jakub-nar%c4%99bski) has more git-fu. The following much simpler command works perfectly:
```
git describe --exact-match --tags
```
Or without the `--tags` if you have checked out an annotated tag. My tag is lightweight, so I need the `--tags`. |
10605405 | What does each of the [y,n,q,a,d,/,K,j,J,g,e,?] stand for in context of git -p | 418 | 2012-05-15 16:52:31 | <p>When using -p mode of <code>git add -p</code> or <code>git stash -p</code> what does each of the letters stand for?</p>
<p>I'm guessing <code>y</code> is yes and <code>n</code> is no. What are the rest?</p>
<blockquote>
<p>[y,n,q,a,d,/,K,j,J,g,e,?]</p>
</blockquote>
| 84,585 | 171,217 | 2014-06-11 10:51:08 | 10,605,465 | 489 | 2012-05-15 16:57:34 | 761,202 | 2012-05-15 16:57:34 | https://stackoverflow.com/q/10605405 | https://stackoverflow.com/a/10605465 | <p>The <code>-p</code> mode means patch, the help for which is hard-ish to find, but if you check <code>git add --help</code> you'll find the following</p>
<pre><code> patch
This lets you choose one path out of a status like selection. After choosing the path, it presents the diff between the index and the wo... | <p>The <code>-p</code> mode means patch, the help for which is hard-ish to find, but if you check <code>git add --help</code> you'll find the following</p> <pre><code> patch This lets you choose one path out of a status like selection. After choosing the path, it presents the diff between the index and the wo... | 119 | git | <h1>What does each of the [y,n,q,a,d,/,K,j,J,g,e,?] stand for in context of git -p</h1>
<p>When using -p mode of <code>git add -p</code> or <code>git stash -p</code> what does each of the letters stand for?</p>
<p>I'm guessing <code>y</code> is yes and <code>n</code> is no. What are the rest?</p>
<blockquote>
<p>[y... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,337 | git | # What does each of the [y,n,q,a,d,/,K,j,J,g,e,?] stand for in context of git -p
When using -p mode of `git add -p` or `git stash -p` what does each of the letters stand for?
I'm guessing `y` is yes and `n` is no. What are the rest?
> [y,n,q,a,d,/,K,j,J,g,e,?] | The `-p` mode means patch, the help for which is hard-ish to find, but if you check `git add --help` you'll find the following
```
patch
This lets you choose one path out of a status like selection. After choosing the path, it presents the diff between the index and the working tree file and asks you if you ... |
17371150 | Moving Git repository content to another repository preserving history | 324 | 2013-06-28 18:15:01 | <p>I am trying to move only the contents of one repository (<code>repo1</code>) to another existing repository (<code>repo2</code>) using the following commands:</p>
<pre><code>git clone repo1
git clone repo2
cd repo1
git remote rm origin
git remote add repo1
git push
</code></pre>
<p>But it's not working. I reviewed... | 400,421 | 1,877,518 | 2024-06-28 14:44:03 | 17,373,088 | 488 | 2013-06-28 20:25:22 | 758,345 | 2017-10-29 10:41:55 | https://stackoverflow.com/q/17371150 | https://stackoverflow.com/a/17373088 | <p>I think the commands you are looking for are:</p>
<pre><code>cd repo2
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master --allow-unrelated-histories
git remote rm r1remote
</code></pre>
<p>After that <code>repo2/master</code> will contain everything from <code... | <p>I think the commands you are looking for are:</p> <pre><code>cd repo2 git checkout master git remote add r1remote **url-of-repo1** git fetch r1remote git merge r1remote/master --allow-unrelated-histories git remote rm r1remote </code></pre> <p>After that <code>repo2/master</code> will contain everything from <code... | 119, 717, 6538, 7330 | git, merge, migrate, repository | <h1>Moving Git repository content to another repository preserving history</h1>
<p>I am trying to move only the contents of one repository (<code>repo1</code>) to another existing repository (<code>repo2</code>) using the following commands:</p>
<pre><code>git clone repo1
git clone repo2
cd repo1
git remote rm origin
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,338 | git | # Moving Git repository content to another repository preserving history
I am trying to move only the contents of one repository (`repo1`) to another existing repository (`repo2`) using the following commands:
```
git clone repo1
git clone repo2
cd repo1
git remote rm origin
git remote add repo1
git push
```
But it'... | I think the commands you are looking for are:
```
cd repo2
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master --allow-unrelated-histories
git remote rm r1remote
```
After that `repo2/master` will contain everything from `repo2/master` and `repo1/master`, and will... |
6157730 | Why can't I push to this bare repository? | 288 | 2011-05-27 21:12:09 | <p>Can you explain what is wrong with this workflow?</p>
<pre><code>$ git init --bare bare
Initialized empty Git repository in /work/fun/git_experiments/bare/
$ git clone bare alice
Cloning into alice...
done.
warning: You appear to have cloned an empty repository.
$ cd alice/
$ touch a
$ git add a
$ git commit -m "Ad... | 194,949 | 11,236 | 2019-05-28 05:46:08 | 6,157,755 | 488 | 2011-05-27 21:14:05 | 719,673 | 2016-03-22 19:09:51 | https://stackoverflow.com/q/6157730 | https://stackoverflow.com/a/6157755 | <p>Yes, the problem is that there are no commits in "bare". This is a problem with the first commit only, if you create the repos in the order (bare,alice). Try doing:</p>
<pre><code>git push --set-upstream origin master
</code></pre>
<p>This would only be required the first time. Afterwards it should work normall... | <p>Yes, the problem is that there are no commits in "bare". This is a problem with the first commit only, if you create the repos in the order (bare,alice). Try doing:</p> <pre><code>git push --set-upstream origin master </code></pre> <p>This would only be required the first time. Afterwards it should work normall... | 119 | git | <h1>Why can't I push to this bare repository?</h1>
<p>Can you explain what is wrong with this workflow?</p>
<pre><code>$ git init --bare bare
Initialized empty Git repository in /work/fun/git_experiments/bare/
$ git clone bare alice
Cloning into alice...
done.
warning: You appear to have cloned an empty repository.
$ ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,339 | git | # Why can't I push to this bare repository?
Can you explain what is wrong with this workflow?
```
$ git init --bare bare
Initialized empty Git repository in /work/fun/git_experiments/bare/
$ git clone bare alice
Cloning into alice...
done.
warning: You appear to have cloned an empty repository.
$ cd alice/
$ touch a
... | Yes, the problem is that there are no commits in "bare". This is a problem with the first commit only, if you create the repos in the order (bare,alice). Try doing:
```
git push --set-upstream origin master
```
This would only be required the first time. Afterwards it should work normally.
As Chris Johnsen pointed o... |
47630950 | How can I switch to another branch in Git? | 472 | 2017-12-04 10:11:49 | <p>Which one of these lines is correct?</p>
<pre><code>git checkout 'another_branch'
</code></pre>
<p>or</p>
<pre><code>git checkout origin 'another_branch'
</code></pre>
<p>or</p>
<pre><code>git checkout origin/'another_branch'
</code></pre>
<p>And what is the difference between them?</p>
| 1,315,279 | 3,702,377 | 2023-12-10 01:17:53 | 47,631,215 | 486 | 2017-12-04 10:26:02 | 6,330,106 | 2019-08-21 06:08:39 | https://stackoverflow.com/q/47630950 | https://stackoverflow.com/a/47631215 | <p>If <code>another_branch</code> already exists locally and you are not on this branch, then <code>git checkout another_branch</code> switches to the branch.</p>
<p>If <code>another_branch</code> does not exist but <code>origin/another_branch</code> does, then <code>git checkout another_branch</code> is equivalent to... | <p>If <code>another_branch</code> already exists locally and you are not on this branch, then <code>git checkout another_branch</code> switches to the branch.</p> <p>If <code>another_branch</code> does not exist but <code>origin/another_branch</code> does, then <code>git checkout another_branch</code> is equivalent to... | 119, 456, 37230 | git, git-checkout, version-control | <h1>How can I switch to another branch in Git?</h1>
<p>Which one of these lines is correct?</p>
<pre><code>git checkout 'another_branch'
</code></pre>
<p>or</p>
<pre><code>git checkout origin 'another_branch'
</code></pre>
<p>or</p>
<pre><code>git checkout origin/'another_branch'
</code></pre>
<p>And what is the differ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,340 | git | # How can I switch to another branch in Git?
Which one of these lines is correct?
```
git checkout 'another_branch'
```
or
```
git checkout origin 'another_branch'
```
or
```
git checkout origin/'another_branch'
```
And what is the difference between them? | If `another_branch` already exists locally and you are not on this branch, then `git checkout another_branch` switches to the branch.
If `another_branch` does not exist but `origin/another_branch` does, then `git checkout another_branch` is equivalent to `git checkout -b another_branch origin/another_branch; git branc... |
4845505 | How do I get my 'Detached HEAD' commits back into master | 254 | 2011-01-30 21:02:00 | <p>Looks like a few days ago I created a branch called <code>detached HEAD</code> and have been committing to it. My normal process is to commit to <code>master</code> and then push that to <code>origin</code>. But I can't push <code>detached HEAD</code>.</p>
<p>My next stop screwed me. I selected <code>git checkout ... | 121,821 | 227,403 | 2022-07-14 18:49:54 | 4,845,543 | 486 | 2011-01-30 21:07:35 | 19,750 | 2022-07-14 18:49:54 | https://stackoverflow.com/q/4845505 | https://stackoverflow.com/a/4845543 | <p>If <code>checkout master</code> was the last thing you did, then the <a href="http://man.github.com/git/git-reflog.html" rel="nofollow noreferrer">reflog</a> entry <code>HEAD@{1}</code> will contain your commits (otherwise use <code>git reflog</code> or <code>git log -p</code> to find them). Use <code>git merge HEAD... | <p>If <code>checkout master</code> was the last thing you did, then the <a href="http://man.github.com/git/git-reflog.html" rel="nofollow noreferrer">reflog</a> entry <code>HEAD@{1}</code> will contain your commits (otherwise use <code>git reflog</code> or <code>git log -p</code> to find them). Use <code>git merge HEAD... | 119, 456 | git, version-control | <h1>How do I get my 'Detached HEAD' commits back into master</h1>
<p>Looks like a few days ago I created a branch called <code>detached HEAD</code> and have been committing to it. My normal process is to commit to <code>master</code> and then push that to <code>origin</code>. But I can't push <code>detached HEAD</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,341 | git | # How do I get my 'Detached HEAD' commits back into master
Looks like a few days ago I created a branch called `detached HEAD` and have been committing to it. My normal process is to commit to `master` and then push that to `origin`. But I can't push `detached HEAD`.
My next stop screwed me. I selected `git checkout ... | If `checkout master` was the last thing you did, then the [reflog](http://man.github.com/git/git-reflog.html) entry `HEAD@{1}` will contain your commits (otherwise use `git reflog` or `git log -p` to find them). Use `git merge HEAD@{1}` to fast forward them into master.
As noted in the comments, [Git Ready has a great... |
44780221 | Git push failing HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error | 160 | 2017-06-27 12:23:07 | <p>I have just setup git with bit bucket for my windows machine.</p>
<p>Git pull works properly, where as git push fails with below error.</p>
<pre><code>$ git push
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 174.03 KiB |... | 202,359 | 2,369,813 | 2025-06-10 10:33:59 | 52,487,332 | 486 | 2018-09-24 21:01:58 | 1,544,977 | 2023-09-17 13:18:28 | https://stackoverflow.com/q/44780221 | https://stackoverflow.com/a/52487332 | <p>Increase the global Git buffer size to the largest individual file size:</p>
<pre><code>git config --global http.postBuffer 157286400
</code></pre>
<p>Or just for your repo:</p>
<pre><code>cd your_repo
git config http.postBuffer 157286400
</code></pre>
| <p>Increase the global Git buffer size to the largest individual file size:</p> <pre><code>git config --global http.postBuffer 157286400 </code></pre> <p>Or just for your repo:</p> <pre><code>cd your_repo git config http.postBuffer 157286400 </code></pre> | 64, 119, 8337, 28898 | bitbucket, git, git-push, windows | <h1>Git push failing HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error</h1>
<p>I have just setup git with bit bucket for my windows machine.</p>
<p>Git pull works properly, where as git push fails with below error.</p>
<pre><code>$ git push
Counting objects: 10, done.
Delta compression usin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,342 | git | # Git push failing HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error
I have just setup git with bit bucket for my windows machine.
Git pull works properly, where as git push fails with below error.
```
$ git push
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compress... | Increase the global Git buffer size to the largest individual file size:
```
git config --global http.postBuffer 157286400
```
Or just for your repo:
```
cd your_repo
git config http.postBuffer 157286400
``` |
29902967 | rebase in progress. Cannot commit. How to proceed or stop (abort)? | 291 | 2015-04-27 18:08:27 | <p>When I run: </p>
<pre><code>git status
</code></pre>
<p>I see this:</p>
<pre><code>rebase in progress; onto 9c168a5
You are currently rebasing branch 'master' on '9c168a5'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working directory clean
</code></pre>
<p>When I do: </p>
<pre><code>... | 478,220 | 1,230,013 | 2025-05-20 03:34:55 | 29,903,238 | 482 | 2015-04-27 18:24:03 | 4,830,165 | 2016-02-23 16:48:40 | https://stackoverflow.com/q/29902967 | https://stackoverflow.com/a/29903238 | <p>Rebase doesn't happen in the background. "rebase in progress" means that you started a rebase, and the rebase got interrupted because of conflict. You have to resume the rebase
(<code>git rebase --continue</code>) or abort it (<code>git rebase --abort</code>).</p>
<p>As the error message from <code>git rebase --co... | <p>Rebase doesn't happen in the background. "rebase in progress" means that you started a rebase, and the rebase got interrupted because of conflict. You have to resume the rebase (<code>git rebase --continue</code>) or abort it (<code>git rebase --abort</code>).</p> <p>As the error message from <code>git rebase --co... | 119, 29934 | git, git-rebase | <h1>rebase in progress. Cannot commit. How to proceed or stop (abort)?</h1>
<p>When I run: </p>
<pre><code>git status
</code></pre>
<p>I see this:</p>
<pre><code>rebase in progress; onto 9c168a5
You are currently rebasing branch 'master' on '9c168a5'.
(all conflicts fixed: run "git rebase --continue")
nothing to co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,344 | git | # rebase in progress. Cannot commit. How to proceed or stop (abort)?
When I run:
```
git status
```
I see this:
```
rebase in progress; onto 9c168a5
You are currently rebasing branch 'master' on '9c168a5'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working directory clean
```
When I do:
... | Rebase doesn't happen in the background. "rebase in progress" means that you started a rebase, and the rebase got interrupted because of conflict. You have to resume the rebase
(`git rebase --continue`) or abort it (`git rebase --abort`).
As the error message from `git rebase --continue` suggests, you asked git to app... |
10230469 | Temporarily switch working copy to a specific Git commit | 350 | 2012-04-19 14:37:24 | <p>How to switch to specific Git commit <strong>without losing all the commits made after it</strong>?</p>
<p>I want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently selected commit.</p>
<p>I want to change files' state to specific commi... | 161,928 | 999,355 | 2021-11-25 05:07:27 | 10,230,489 | 481 | 2012-04-19 14:38:44 | 1,037,767 | 2021-03-05 18:10:06 | https://stackoverflow.com/q/10230469 | https://stackoverflow.com/a/10230489 | <p>If you are at a certain branch <code>mybranch</code>, just go ahead and <code>git checkout commit_hash</code>. Then you can return to your branch by <code>git checkout mybranch</code>. I had the same game bisecting a bug today :) Also, you should know about <a href="https://git-scm.com/book/en/v2/Git-Tools-Debugging... | <p>If you are at a certain branch <code>mybranch</code>, just go ahead and <code>git checkout commit_hash</code>. Then you can return to your branch by <code>git checkout mybranch</code>. I had the same game bisecting a bug today :) Also, you should know about <a href="https://git-scm.com/book/en/v2/Git-Tools-Debugging... | 119, 5597, 6710 | commit, git, temporary | <h1>Temporarily switch working copy to a specific Git commit</h1>
<p>How to switch to specific Git commit <strong>without losing all the commits made after it</strong>?</p>
<p>I want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently select... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,345 | git | # Temporarily switch working copy to a specific Git commit
How to switch to specific Git commit **without losing all the commits made after it**?
I want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently selected commit.
I want to change ... | If you are at a certain branch `mybranch`, just go ahead and `git checkout commit_hash`. Then you can return to your branch by `git checkout mybranch`. I had the same game bisecting a bug today :) Also, you should know about [git bisect](https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git#_binary_search). |
7251477 | What are the differences between double-dot ".." and triple-dot "..." in Git diff commit ranges? | 299 | 2011-08-31 00:53:25 | <p>What are the differences between the following commands?:</p>
<pre class="lang-bash prettyprint-override"><code>git diff foo master # a
git diff foo..master # b
git diff foo...master # c
</code></pre>
<p><a href="http://jk.gs/git-diff.html#_examples" rel="noreferrer">The diff manual</a> talks about it:</p>
<b... | 57,001 | 171,217 | 2023-01-30 17:17:45 | 7,256,391 | 481 | 2011-08-31 11:39:27 | 223,092 | 2020-12-27 12:13:22 | https://stackoverflow.com/q/7251477 | https://stackoverflow.com/a/7256391 | <p><em>Since I'd already created these images, I thought it might be worth using them in another answer, although the description of the difference between <code>..</code> (dot-dot) and <code>...</code> (dot-dot-dot) is essentially the same as in <a href="https://stackoverflow.com/questions/7251477/git-diff-whats-the-d... | <p><em>Since I'd already created these images, I thought it might be worth using them in another answer, although the description of the difference between <code>..</code> (dot-dot) and <code>...</code> (dot-dot-dot) is essentially the same as in <a href="https://stackoverflow.com/questions/7251477/git-diff-whats-the-d... | 119, 606, 9033 | diff, git, git-diff | <h1>What are the differences between double-dot ".." and triple-dot "..." in Git diff commit ranges?</h1>
<p>What are the differences between the following commands?:</p>
<pre class="lang-bash prettyprint-override"><code>git diff foo master # a
git diff foo..master # b
git diff foo...master # c
</code></pre>
<p><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,346 | git | # What are the differences between double-dot ".." and triple-dot "..." in Git diff commit ranges?
What are the differences between the following commands?:
```
git diff foo master # a
git diff foo..master # b
git diff foo...master # c
```
[The diff manual](http://jk.gs/git-diff.html#_examples) talks about it:
... | *Since I'd already created these images, I thought it might be worth using them in another answer, although the description of the difference between `..` (dot-dot) and `...` (dot-dot-dot) is essentially the same as in [manojlds's answer](https://stackoverflow.com/questions/7251477/git-diff-whats-the-difference-between... |
34344034 | git pull on a different branch | 294 | 2015-12-17 20:54:41 | <p>If I'm working on a branch and then realize I need to merge another branch into mine here is my current workflow (for this example lets say that I'm working on my-branch and want to merge in master):</p>
<pre><code>git stash
git checkout master
git pull
git checkout my-branch
git merge master
git stash pop
</code><... | 571,314 | 2,577,920 | 2025-03-12 16:07:11 | 45,697,574 | 481 | 2017-08-15 16:49:22 | 746,000 | 2023-03-07 17:58:18 | https://stackoverflow.com/q/34344034 | https://stackoverflow.com/a/45697574 | <p>I found a git command that worked for me:</p>
<h3>Fetch</h3>
<pre><code>git fetch origin master:master
</code></pre>
<p>The syntax for the above is as follows (thanks @Adam)</p>
<pre><code>git fetch <remote> <src>:<dst>
</code></pre>
<h3>Merge</h3>
<p>Then (if you want to merge right away):</p>
<pr... | <p>I found a git command that worked for me:</p> <h3>Fetch</h3> <pre><code>git fetch origin master:master </code></pre> <p>The syntax for the above is as follows (thanks @Adam)</p> <pre><code>git fetch <remote> <src>:<dst> </code></pre> <h3>Merge</h3> <p>Then (if you want to merge right away):</p> <pr... | 119 | git | <h1>git pull on a different branch</h1>
<p>If I'm working on a branch and then realize I need to merge another branch into mine here is my current workflow (for this example lets say that I'm working on my-branch and want to merge in master):</p>
<pre><code>git stash
git checkout master
git pull
git checkout my-branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,347 | git | # git pull on a different branch
If I'm working on a branch and then realize I need to merge another branch into mine here is my current workflow (for this example lets say that I'm working on my-branch and want to merge in master):
```
git stash
git checkout master
git pull
git checkout my-branch
git merge master
gi... | I found a git command that worked for me:
### Fetch
```
git fetch origin master:master
```
The syntax for the above is as follows (thanks @Adam)
```
git fetch <remote> <src>:<dst>
```
### Merge
Then (if you want to merge right away):
```
git merge master
``` |
5582208 | Checking out Git tag leads to "detached HEAD state" | 195 | 2011-04-07 13:51:17 | <p>I'm developing a deployment script for my git project and I just started using tags. I've added a new tag called <code>v2.0</code>:</p>
<pre><code>git tag -a v2.0 -m "Launching version 2.0"
</code></pre>
<p>And I've pushed this tag to the remote repository</p>
<pre><code>git push --tags
</code></pre>
<p>When I t... | 140,819 | 122,019 | 2017-04-22 22:30:52 | 5,582,368 | 480 | 2011-04-07 14:01:55 | 229,602 | 2016-06-03 02:54:41 | https://stackoverflow.com/q/5582208 | https://stackoverflow.com/a/5582368 | <p>Okay, first a few terms slightly oversimplified. </p>
<p>In <code>git</code>, a <code>tag</code> (like many other things) is what's called a <a href="https://www.kernel.org/pub/software/scm/git/docs/#_identifier_terminology">treeish</a>. It's a way of referring to a point in in the history of the project. Treeishes... | <p>Okay, first a few terms slightly oversimplified. </p> <p>In <code>git</code>, a <code>tag</code> (like many other things) is what's called a <a href="https://www.kernel.org/pub/software/scm/git/docs/#_identifier_terminology">treeish</a>. It's a way of referring to a point in in the history of the project. Treeishes... | 119, 190, 60718 | deployment, git, git-tag | <h1>Checking out Git tag leads to "detached HEAD state"</h1>
<p>I'm developing a deployment script for my git project and I just started using tags. I've added a new tag called <code>v2.0</code>:</p>
<pre><code>git tag -a v2.0 -m "Launching version 2.0"
</code></pre>
<p>And I've pushed this tag to the remote reposito... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,348 | git | # Checking out Git tag leads to "detached HEAD state"
I'm developing a deployment script for my git project and I just started using tags. I've added a new tag called `v2.0`:
```
git tag -a v2.0 -m "Launching version 2.0"
```
And I've pushed this tag to the remote repository
```
git push --tags
```
When I try to e... | Okay, first a few terms slightly oversimplified.
In `git`, a `tag` (like many other things) is what's called a [treeish](https://www.kernel.org/pub/software/scm/git/docs/#_identifier_terminology). It's a way of referring to a point in in the history of the project. Treeishes can be a tag, a commit, a date specifier, a... |
2427238 | What is the difference between merge --squash and rebase? | 641 | 2010-03-11 17:33:18 | <p>I am trying to understand the differences between <code>git merge --squash <branch></code> and <code>git rebase [--interactive] <base></code>.</p>
<p>Depending on the command, I am not sure what new commits appear on the current branch, if the original commits in <code><branch></code> are rewritten... | 380,510 | 173,909 | 2025-07-28 12:22:16 | 2,427,520 | 479 | 2010-03-11 18:17:12 | 6,309 | 2024-04-03 09:08:21 | https://stackoverflow.com/q/2427238 | https://stackoverflow.com/a/2427520 | <p>Both <code>git merge --squash</code> and <code>git rebase --interactive</code> can produce a "squashed" commit. But they serve different purposes.</p>
<ul>
<li><a href="http://linux.die.net/man/1/git-merge" rel="noreferrer"><code>git merge --squash abranch</code></a></li>
</ul>
<p>will produce a squashed c... | <p>Both <code>git merge --squash</code> and <code>git rebase --interactive</code> can produce a "squashed" commit. But they serve different purposes.</p> <ul> <li><a href="http://linux.die.net/man/1/git-merge" rel="noreferrer"><code>git merge --squash abranch</code></a></li> </ul> <p>will produce a squashed c... | 119, 717, 8974, 29934, 42532 | git, git-rebase, merge, rebase, squash | <h1>What is the difference between merge --squash and rebase?</h1>
<p>I am trying to understand the differences between <code>git merge --squash <branch></code> and <code>git rebase [--interactive] <base></code>.</p>
<p>Depending on the command, I am not sure what new commits appear on the current branch, i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,349 | git | # What is the difference between merge --squash and rebase?
I am trying to understand the differences between `git merge --squash <branch>` and `git rebase [--interactive] <base>`.
Depending on the command, I am not sure what new commits appear on the current branch, if the original commits in `<branch>` are rewritte... | Both `git merge --squash` and `git rebase --interactive` can produce a "squashed" commit. But they serve different purposes.
- [`git merge --squash abranch`](http://linux.die.net/man/1/git-merge)
will produce a squashed commit on the destination branch, without marking any merge relationship.
(Note: it does not produ... |
9110310 | Update git commit author date when amending | 455 | 2012-02-02 09:59:27 | <p>I found myself amending my commits quite often. I don't <code>stash</code> so much because I tend to forget I did so, especially when I want to save what I did before I leave or before a weekend, so I do a "draft" commit. Only thing is, when I amend the commit, it is still set to the original author date. Is there a... | 174,359 | 669,020 | 2025-11-06 17:24:06 | 9,110,424 | 479 | 2012-02-02 10:07:48 | 223,092 | 2018-10-15 09:37:28 | https://stackoverflow.com/q/9110310 | https://stackoverflow.com/a/9110424 | <p>You can change the author date with the <code>--date</code> parameter to <code>git commit</code>. So, if you want to amend the last commit, and update its author date to the current date and time, you can do:</p>
<pre><code>git commit --amend --date="$(date -R)"
</code></pre>
<p>(The <code>-R</code> parameter to ... | <p>You can change the author date with the <code>--date</code> parameter to <code>git commit</code>. So, if you want to amend the last commit, and update its author date to the current date and time, you can do:</p> <pre><code>git commit --amend --date="$(date -R)" </code></pre> <p>(The <code>-R</code> parameter to ... | 119 | git | <h1>Update git commit author date when amending</h1>
<p>I found myself amending my commits quite often. I don't <code>stash</code> so much because I tend to forget I did so, especially when I want to save what I did before I leave or before a weekend, so I do a "draft" commit. Only thing is, when I amend the commit, it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,350 | git | # Update git commit author date when amending
I found myself amending my commits quite often. I don't `stash` so much because I tend to forget I did so, especially when I want to save what I did before I leave or before a weekend, so I do a "draft" commit. Only thing is, when I amend the commit, it is still set to the... | You can change the author date with the `--date` parameter to `git commit`. So, if you want to amend the last commit, and update its author date to the current date and time, you can do:
```
git commit --amend --date="$(date -R)"
```
(The `-R` parameter to `date` tells it to output the date in RFC 2822 format. This i... |
16773642 | Pull git submodules after cloning project from GitHub | 306 | 2013-05-27 12:52:05 | <p>I have a project that has specified submodules in it. Everything works well on the dev machine. I have commited <code>.gitmodules</code> file and pulled on the production. However it does not pulled submodules.</p>
<p>If I go into submodule directories and call <code>git pull</code>, nothing happens.</p>
<p>What i... | 221,476 | 223,386 | 2025-07-01 15:10:43 | 16,773,779 | 479 | 2013-05-27 12:59:25 | 1,588,845 | 2013-05-27 12:59:25 | https://stackoverflow.com/q/16773642 | https://stackoverflow.com/a/16773779 | <p>From the root of the repo just run:</p>
<pre><code>git submodule update --init
</code></pre>
| <p>From the root of the repo just run:</p> <pre><code>git submodule update --init </code></pre> | 119, 41612 | git, git-submodules | <h1>Pull git submodules after cloning project from GitHub</h1>
<p>I have a project that has specified submodules in it. Everything works well on the dev machine. I have commited <code>.gitmodules</code> file and pulled on the production. However it does not pulled submodules.</p>
<p>If I go into submodule directories ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,351 | git | # Pull git submodules after cloning project from GitHub
I have a project that has specified submodules in it. Everything works well on the dev machine. I have commited `.gitmodules` file and pulled on the production. However it does not pulled submodules.
If I go into submodule directories and call `git pull`, nothin... | From the root of the repo just run:
```
git submodule update --init
``` |
33308482 | How can I configure KDiff3 as a merge tool and diff tool for git? | 293 | 2015-10-23 17:46:32 | <p>Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available of <a href="https://git-scm.com/downloads" rel="noreferrer">Git</a> and <a href="http://kdiff3.sourceforge.net" rel="... | 264,901 | 2,548,937 | 2022-07-21 21:42:23 | 33,348,841 | 476 | 2015-10-26 14:56:01 | 2,548,937 | 2021-01-27 10:48:13 | https://stackoverflow.com/q/33308482 | https://stackoverflow.com/a/33348841 | <p>These sites were very helpful, almost, <a href="https://git-scm.com/docs/git-mergetool" rel="noreferrer">mergetool</a> and <a href="https://git-scm.com/docs/git-difftool#git-difftool---no-trust-exit-code" rel="noreferrer">difftool</a>. I used the global configuration, but can be used by repository without problems. ... | <p>These sites were very helpful, almost, <a href="https://git-scm.com/docs/git-mergetool" rel="noreferrer">mergetool</a> and <a href="https://git-scm.com/docs/git-difftool#git-difftool---no-trust-exit-code" rel="noreferrer">difftool</a>. I used the global configuration, but can be used by repository without problems. ... | 119, 25165, 28897, 39542 | git, git-merge, kdiff3, mergetool | <h1>How can I configure KDiff3 as a merge tool and diff tool for git?</h1>
<p>Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available of <a href="https://git-scm.com/downloads"... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,353 | git | # How can I configure KDiff3 as a merge tool and diff tool for git?
Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available of [Git](https://git-scm.com/downloads) and [KDiff3... | These sites were very helpful, almost, [mergetool](https://git-scm.com/docs/git-mergetool) and [difftool](https://git-scm.com/docs/git-difftool#git-difftool---no-trust-exit-code). I used the global configuration, but can be used by repository without problems. You just need to execute the following commands:
```
git c... |
4621072 | git ignore all files of a certain type, except those in a specific subfolder | 298 | 2011-01-06 23:22:12 | <p>I have a directory structure like this:</p>
<ul>
<li>root
<ul>
<li>folder1
<ul>
<li>abc.json</li>
<li>def.json</li>
<li>somedir
<ul>
<li>more.json</li>
</ul>
</li>
</ul>
</li>
<li>folder2
<ul>
<li>qwe.json</li>
<li>rty.json</li>
</ul>
</li>
<li>spec
<ul>
<li>mock1.json</li>
<li>mock2.json</li>
<li>somedir
<ul>
<li>m... | 279,415 | 62,076 | 2025-05-23 02:37:15 | 4,621,090 | 475 | 2011-01-06 23:24:57 | 148,870 | 2021-11-18 13:54:08 | https://stackoverflow.com/q/4621072 | https://stackoverflow.com/a/4621090 | <blockquote>
<p>An optional prefix <code>!</code> which negates the
pattern; any matching file excluded by
a previous pattern will become
included again. If a negated pattern
matches, this will override lower
precedence patterns sources.</p>
</blockquote>
<p><a href="https://git-scm.com/docs/gitignore" rel="noreferrer"... | <blockquote> <p>An optional prefix <code>!</code> which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.</p> </blockquote> <p><a href="https://git-scm.com/docs/gitignore" rel="noreferrer"... | 119, 25056 | git, gitignore | <h1>git ignore all files of a certain type, except those in a specific subfolder</h1>
<p>I have a directory structure like this:</p>
<ul>
<li>root
<ul>
<li>folder1
<ul>
<li>abc.json</li>
<li>def.json</li>
<li>somedir
<ul>
<li>more.json</li>
</ul>
</li>
</ul>
</li>
<li>folder2
<ul>
<li>qwe.json</li>
<li>rty.json</li>
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,354 | git | # git ignore all files of a certain type, except those in a specific subfolder
I have a directory structure like this:
- root
- folder1
- abc.json
- def.json
- somedir
- more.json
- folder2
- qwe.json
- rty.json
- spec
- mock1.json
- mock2.json
- somedir
- more_mocks.... | > An optional prefix `!` which negates the
> pattern; any matching file excluded by
> a previous pattern will become
> included again. If a negated pattern
> matches, this will override lower
> precedence patterns sources.
<https://git-scm.com/docs/gitignore>
```
*.json
!spec/*.json
``` |
7075923 | Resync git repo with new .gitignore file | 254 | 2011-08-16 09:10:20 | <p>Is it possible to "refresh" a git repository after updating the gitignore file?</p>
<p>I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new file.</p>
| 148,838 | 217,157 | 2024-02-01 11:27:29 | 7,076,075 | 474 | 2011-08-16 09:24:25 | 6,309 | 2017-02-21 07:16:15 | https://stackoverflow.com/q/7075923 | https://stackoverflow.com/a/7076075 | <p>The solution mentioned in "<a href="https://stackoverflow.com/questions/1139762/gitignore-file-not-ignoring">.gitignore file not ignoring</a>" is a bit extreme, but should work:</p>
<pre><code># rm all files
git rm -r --cached .
# add all files as per new .gitignore
git add .
# now, commit for new .gitigno... | <p>The solution mentioned in "<a href="https://stackoverflow.com/questions/1139762/gitignore-file-not-ignoring">.gitignore file not ignoring</a>" is a bit extreme, but should work:</p> <pre><code># rm all files git rm -r --cached . # add all files as per new .gitignore git add . # now, commit for new .gitigno... | 119 | git | <h1>Resync git repo with new .gitignore file</h1>
<p>Is it possible to "refresh" a git repository after updating the gitignore file?</p>
<p>I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new file.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,355 | git | # Resync git repo with new .gitignore file
Is it possible to "refresh" a git repository after updating the gitignore file?
I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new file. | The solution mentioned in "[.gitignore file not ignoring](https://stackoverflow.com/questions/1139762/gitignore-file-not-ignoring)" is a bit extreme, but should work:
```
# rm all files
git rm -r --cached .
# add all files as per new .gitignore
git add .
# now, commit for new .gitignore to apply
git commit -m ".gitign... |
4824188 | git ignore vim temporary files | 303 | 2011-01-28 02:13:57 | <p>What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?</p>
| 151,819 | 318,760 | 2025-11-07 08:08:58 | 4,824,199 | 473 | 2011-01-28 02:16:39 | 196,234 | 2023-01-09 16:36:52 | https://stackoverflow.com/q/4824188 | https://stackoverflow.com/a/4824199 | <p>Vim temporary files end with ~ so you can add to the file <code>.gitignore</code> the line</p>
<pre><code>*~
</code></pre>
<p>Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:</p>
<pre><code>*.swp
*.swo
</code></pre>
<p>This will ignore all the vim temporary files in a ... | <p>Vim temporary files end with ~ so you can add to the file <code>.gitignore</code> the line</p> <pre><code>*~ </code></pre> <p>Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:</p> <pre><code>*.swp *.swo </code></pre> <p>This will ignore all the vim temporary files in a ... | 119, 370, 4333, 17512 | git, ignore, temporary-files, vim | <h1>git ignore vim temporary files</h1>
<p>What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,357 | git | # git ignore vim temporary files
What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)? | Vim temporary files end with ~ so you can add to the file `.gitignore` the line
```
*~
```
Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:
```
*.swp
*.swo
```
This will ignore all the vim temporary files in a single project
If you want to do it globally, you can cre... |
7632454 | How do you use "git --bare init" repository? | 395 | 2011-10-03 08:05:28 | <p>I need to create a central Git repository but I'm a little confused...</p>
<p>I have created a bare repository (in my git server, machine 2) with:</p>
<pre><code>$ mkdir test_repo
$ git --bare init
</code></pre>
<p>Now I need to push files from my local repository (machine 1) to the bare repository (machine 2). I... | 404,996 | 488,735 | 2023-05-11 06:41:59 | 7,632,497 | 472 | 2011-10-03 08:10:03 | 223,092 | 2018-04-16 10:55:41 | https://stackoverflow.com/q/7632454 | https://stackoverflow.com/a/7632497 | <p>Firstly, just to check, you need to change into the directory you've created before running <code>git init --bare</code>. Also, it's conventional to give bare repositories the extension <code>.git</code>. So you can do</p>
<pre><code>git init --bare test_repo.git
</code></pre>
<p>For Git versions < 1.8 you wo... | <p>Firstly, just to check, you need to change into the directory you've created before running <code>git init --bare</code>. Also, it's conventional to give bare repositories the extension <code>.git</code>. So you can do</p> <pre><code>git init --bare test_repo.git </code></pre> <p>For Git versions < 1.8 you wo... | 119, 64465 | git, git-bare | <h1>How do you use "git --bare init" repository?</h1>
<p>I need to create a central Git repository but I'm a little confused...</p>
<p>I have created a bare repository (in my git server, machine 2) with:</p>
<pre><code>$ mkdir test_repo
$ git --bare init
</code></pre>
<p>Now I need to push files from my local reposi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,360 | git | # How do you use "git --bare init" repository?
I need to create a central Git repository but I'm a little confused...
I have created a bare repository (in my git server, machine 2) with:
```
$ mkdir test_repo
$ git --bare init
```
Now I need to push files from my local repository (machine 1) to the bare repository ... | Firstly, just to check, you need to change into the directory you've created before running `git init --bare`. Also, it's conventional to give bare repositories the extension `.git`. So you can do
```
git init --bare test_repo.git
```
For Git versions < 1.8 you would do
```
mkdir test_repo.git
cd test_repo.git
git -... |
5767850 | Git on custom SSH port | 241 | 2011-04-24 00:21:47 | <p>My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git clone. I am using <a href="https://wiki.archlinux.org/title/Gitolite"... | 301,887 | 384,016 | 2025-01-16 00:56:18 | 5,767,880 | 471 | 2011-04-24 00:31:55 | 398,618 | 2022-06-22 17:19:29 | https://stackoverflow.com/q/5767850 | https://stackoverflow.com/a/5767880 | <pre><code>git clone ssh://git@mydomain.example:[port]/gitolite-admin
</code></pre>
<p>Note that the port number should be there without the square brackets: <code>[]</code></p>
| <pre><code>git clone ssh://git@mydomain.example:[port]/gitolite-admin </code></pre> <p>Note that the port number should be there without the square brackets: <code>[]</code></p> | 119, 386, 456, 1731 | cygwin, git, ssh, version-control | <h1>Git on custom SSH port</h1>
<p>My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git clone. I am using <a href="https://wi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,361 | git | # Git on custom SSH port
My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git clone. I am using [gitolite](https://wiki.arch... | ```
git clone ssh://git@mydomain.example:[port]/gitolite-admin
```
Note that the port number should be there without the square brackets: `[]` |
28008139 | Git Stash vs Shelve in IntelliJ IDEA | 540 | 2015-01-18 07:47:48 | <p>I am very unfamiliar with the <code>shelve</code> aspect of Git (EDIT: not an aspect of Git, but rather IntelliJ IDEA feature of <code>shelve</code>).</p>
<p>If <code>stash</code> is used to put aside unfinished work what is <code>shelve</code> then? What would you use it for?</p>
<p>For example on Update Project (f... | 268,590 | 1,914,652 | 2025-08-14 17:07:06 | 28,008,816 | 470 | 2015-01-18 10:46:34 | 6,309 | 2018-05-11 22:22:35 | https://stackoverflow.com/q/28008139 | https://stackoverflow.com/a/28008816 | <p><code>git shelve</code> doesn't exist in Git. </p>
<p>Only <a href="http://git-scm.com/docs/git-stash" rel="noreferrer"><code>git stash</code></a>:</p>
<ul>
<li>when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. </li>
<li>which saves... | <p><code>git shelve</code> doesn't exist in Git. </p> <p>Only <a href="http://git-scm.com/docs/git-stash" rel="noreferrer"><code>git stash</code></a>:</p> <ul> <li>when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. </li> <li>which saves... | 119, 5794, 8945, 13091, 31422 | git, git-stash, intellij-idea, jetbrains-ide, shelving | <h1>Git Stash vs Shelve in IntelliJ IDEA</h1>
<p>I am very unfamiliar with the <code>shelve</code> aspect of Git (EDIT: not an aspect of Git, but rather IntelliJ IDEA feature of <code>shelve</code>).</p>
<p>If <code>stash</code> is used to put aside unfinished work what is <code>shelve</code> then? What would you use i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,362 | git | # Git Stash vs Shelve in IntelliJ IDEA
I am very unfamiliar with the `shelve` aspect of Git (EDIT: not an aspect of Git, but rather IntelliJ IDEA feature of `shelve`).
If `stash` is used to put aside unfinished work what is `shelve` then? What would you use it for?
For example on Update Project (from VCS menu):
[:
- when you want to record the current state of the working directory and the index, but want to go back to a clean working directory.
- which saves your local modifications away and reverts the working directory to match the HEA... |
5586383 | How to diff one file to an arbitrary version in Git? | 444 | 2011-04-07 19:18:41 | <p>How can I diff a file, say <code>pom.xml</code>, from the master branch to an arbitrary older version in Git?</p>
| 373,979 | 51,789 | 2024-11-29 11:05:16 | 5,586,435 | 470 | 2011-04-07 19:23:33 | 223,092 | 2014-07-05 19:01:22 | https://stackoverflow.com/q/5586383 | https://stackoverflow.com/a/5586435 | <p>You can do:</p>
<pre><code>git diff master~20:pom.xml pom.xml
</code></pre>
<p>... to compare your current <code>pom.xml</code> to the one from <code>master</code> 20 revisions ago through the first parent. You can replace <code>master~20</code>, of course, with the object name (SHA1sum) of a commit or any of the... | <p>You can do:</p> <pre><code>git diff master~20:pom.xml pom.xml </code></pre> <p>... to compare your current <code>pom.xml</code> to the one from <code>master</code> 20 revisions ago through the first parent. You can replace <code>master~20</code>, of course, with the object name (SHA1sum) of a commit or any of the... | 119, 606, 9033 | diff, git, git-diff | <h1>How to diff one file to an arbitrary version in Git?</h1>
<p>How can I diff a file, say <code>pom.xml</code>, from the master branch to an arbitrary older version in Git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,363 | git | # How to diff one file to an arbitrary version in Git?
How can I diff a file, say `pom.xml`, from the master branch to an arbitrary older version in Git? | You can do:
```
git diff master~20:pom.xml pom.xml
```
... to compare your current `pom.xml` to the one from `master` 20 revisions ago through the first parent. You can replace `master~20`, of course, with the object name (SHA1sum) of a commit or any of the [many other ways of specifying a revision](http://www.kernel... |
3515597 | Add only non-whitespace changes | 407 | 2010-08-18 18:51:50 | <p>I have my text editor to automatically trim trailing whitespace upon saving a file, and I am contributing to an open source project that has severe problems with trailing whitespace.</p>
<p>Every time I try to submit a patch I must first ignore all whitespace-only changes by hand, to choose only the relevant inform... | 134,431 | 21,648 | 2024-07-16 08:04:07 | 7,149,602 | 469 | 2011-08-22 15:14:27 | 422,597 | 2023-03-05 20:32:20 | https://stackoverflow.com/q/3515597 | https://stackoverflow.com/a/7149602 | <p>@Frew solution wasn't quite what I needed, so this is the alias I made for the exact same problem:</p>
<pre><code>alias.addnw=!sh -c 'git diff -U0 -w --no-color --src-prefix=a/ --dst-prefix=b/ "$@" | git apply --cached --ignore-whitespace --unidiff-zero -'
</code></pre>
<p>Or you can simply run:</p>
<pre><... | <p>@Frew solution wasn't quite what I needed, so this is the alias I made for the exact same problem:</p> <pre><code>alias.addnw=!sh -c 'git diff -U0 -w --no-color --src-prefix=a/ --dst-prefix=b/ "$@" | git apply --cached --ignore-whitespace --unidiff-zero -' </code></pre> <p>Or you can simply run:</p> <pre><... | 119, 1084 | git, whitespace | <h1>Add only non-whitespace changes</h1>
<p>I have my text editor to automatically trim trailing whitespace upon saving a file, and I am contributing to an open source project that has severe problems with trailing whitespace.</p>
<p>Every time I try to submit a patch I must first ignore all whitespace-only changes by... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,364 | git | # Add only non-whitespace changes
I have my text editor to automatically trim trailing whitespace upon saving a file, and I am contributing to an open source project that has severe problems with trailing whitespace.
Every time I try to submit a patch I must first ignore all whitespace-only changes by hand, to choose... | @Frew solution wasn't quite what I needed, so this is the alias I made for the exact same problem:
```
alias.addnw=!sh -c 'git diff -U0 -w --no-color --src-prefix=a/ --dst-prefix=b/ "$@" | git apply --cached --ignore-whitespace --unidiff-zero -'
```
Or you can simply run:
```
git diff -U0 -w --no-color --src-prefix=... |
13321458 | Meaning of Git checkout double dashes | 337 | 2012-11-10 11:04:14 | <p>What is the meaning of the double dashes before the file name in this git command?</p>
<pre><code>git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
</code></pre>
<p>Are they mandatory? Is it equivalent to</p>
<pre><code>git checkout --ours path/to/file.txt
git checkout --theirs pat... | 53,191 | 1,455,176 | 2020-02-13 17:07:39 | 13,321,491 | 469 | 2012-11-10 11:09:27 | 82,294 | 2017-03-24 16:28:41 | https://stackoverflow.com/q/13321458 | https://stackoverflow.com/a/13321491 | <p>Suppose I have a file named <code>path/to/file.txt</code> in my Git repository, and I want to revert changes on it.</p>
<pre><code>git checkout path/to/file.txt
</code></pre>
<p>Now suppose that the file is named <code>master</code>...</p>
<pre><code>git checkout master
</code></pre>
<p>Whoops! That changed bra... | <p>Suppose I have a file named <code>path/to/file.txt</code> in my Git repository, and I want to revert changes on it.</p> <pre><code>git checkout path/to/file.txt </code></pre> <p>Now suppose that the file is named <code>master</code>...</p> <pre><code>git checkout master </code></pre> <p>Whoops! That changed bra... | 119, 37230 | git, git-checkout | <h1>Meaning of Git checkout double dashes</h1>
<p>What is the meaning of the double dashes before the file name in this git command?</p>
<pre><code>git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
</code></pre>
<p>Are they mandatory? Is it equivalent to</p>
<pre><code>git checkout --... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,365 | git | # Meaning of Git checkout double dashes
What is the meaning of the double dashes before the file name in this git command?
```
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
```
Are they mandatory? Is it equivalent to
```
git checkout --ours path/to/file.txt
git checkout --theirs ... | Suppose I have a file named `path/to/file.txt` in my Git repository, and I want to revert changes on it.
```
git checkout path/to/file.txt
```
Now suppose that the file is named `master`...
```
git checkout master
```
Whoops! That changed branches instead. The `--` separates the tree you want to check out from the ... |
3921708 | How do I squash two non-consecutive commits? | 316 | 2010-10-13 07:52:54 | <p>I'm a bit new to the whole rebasing feature within git. Let's say that I made the following commits:</p>
<pre><code>A -> B -> C -> D
</code></pre>
<p>Afterwards, I realize that <code>D</code> contains a fix which depends on some new code added in <code>A</code>, and that these commits belong together. H... | 70,512 | 14,302 | 2020-04-28 06:05:19 | 3,921,724 | 468 | 2010-10-13 07:55:49 | 311,635 | 2020-04-28 06:05:19 | https://stackoverflow.com/q/3921708 | https://stackoverflow.com/a/3921724 | <p>You can run <code>git rebase --interactive</code> and reorder D before B and squash D into A.</p>
<p>Git will open an editor, and you see a file like this, ex: <code>git rebase --interactive HEAD~4</code></p>
<pre><code>pick aaaaaaa Commit A
pick bbbbbbb Commit B
pick ccccccc Commit C
pick ddddddd Commit D
# Reba... | <p>You can run <code>git rebase --interactive</code> and reorder D before B and squash D into A.</p> <p>Git will open an editor, and you see a file like this, ex: <code>git rebase --interactive HEAD~4</code></p> <pre><code>pick aaaaaaa Commit A pick bbbbbbb Commit B pick ccccccc Commit C pick ddddddd Commit D # Reba... | 119, 29934 | git, git-rebase | <h1>How do I squash two non-consecutive commits?</h1>
<p>I'm a bit new to the whole rebasing feature within git. Let's say that I made the following commits:</p>
<pre><code>A -> B -> C -> D
</code></pre>
<p>Afterwards, I realize that <code>D</code> contains a fix which depends on some new code added in <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,366 | git | # How do I squash two non-consecutive commits?
I'm a bit new to the whole rebasing feature within git. Let's say that I made the following commits:
```
A -> B -> C -> D
```
Afterwards, I realize that `D` contains a fix which depends on some new code added in `A`, and that these commits belong together. How do I squa... | You can run `git rebase --interactive` and reorder D before B and squash D into A.
Git will open an editor, and you see a file like this, ex: `git rebase --interactive HEAD~4`
```
pick aaaaaaa Commit A
pick bbbbbbb Commit B
pick ccccccc Commit C
pick ddddddd Commit D
# Rebase aaaaaaa..ddddddd onto 1234567 (4 command... |
3418277 | How to apply `git diff` patch without Git installed? | 306 | 2010-08-05 19:10:36 | <p>How can my client apply patch created by <code>git diff</code> without git installed?
I have tried to use <code>patch</code> command but it always asks file name to patch.</p>
| 156,333 | 222,380 | 2016-02-12 01:09:56 | 3,418,499 | 467 | 2010-08-05 19:37:14 | 222,380 | 2015-12-09 16:17:19 | https://stackoverflow.com/q/3418277 | https://stackoverflow.com/a/3418499 | <pre><code>git diff > patchfile
</code></pre>
<p>and</p>
<pre><code>patch -p1 < patchfile
</code></pre>
<p>work but as many people noticed in comments and other answers patch does not understand adds, deletes and renames. There is no option but <code>git apply patchfile</code> if you need handle file adds, del... | <pre><code>git diff > patchfile </code></pre> <p>and</p> <pre><code>patch -p1 < patchfile </code></pre> <p>work but as many people noticed in comments and other answers patch does not understand adds, deletes and renames. There is no option but <code>git apply patchfile</code> if you need handle file adds, del... | 119, 606, 2132 | diff, git, patch | <h1>How to apply `git diff` patch without Git installed?</h1>
<p>How can my client apply patch created by <code>git diff</code> without git installed?
I have tried to use <code>patch</code> command but it always asks file name to patch.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,368 | git | # How to apply `git diff` patch without Git installed?
How can my client apply patch created by `git diff` without git installed?
I have tried to use `patch` command but it always asks file name to patch. | ```
git diff > patchfile
```
and
```
patch -p1 < patchfile
```
work but as many people noticed in comments and other answers patch does not understand adds, deletes and renames. There is no option but `git apply patchfile` if you need handle file adds, deletes and renames.
---
**EDIT** December 2015
Latest versio... |
1793735 | Change case of a file on Windows? | 292 | 2009-11-24 23:38:53 | <p>There are a couple of files in our git-controlled codebase that I'd like to rename. Specifically, I just want to change the case of the file, so that <code>sourceCode.java</code> becomes <code>SourceCode.java</code>, for example. The catch: I'm on a Windows box, and the filesystem thinks those are the same file na... | 79,594 | 19,074 | 2024-07-31 14:26:29 | 1,793,757 | 467 | 2009-11-24 23:43:07 | 129,404 | 2022-05-05 13:32:35 | https://stackoverflow.com/q/1793735 | https://stackoverflow.com/a/1793757 | <p>To rename the file you can use the standard <code>git mv</code> command.
Since Windows treats files with only changes in case as identical, you have to pass the <code>-f</code> option to force a rename:</p>
<pre><code>git mv -f name.java Name.java
</code></pre>
<p>If instead you want to ignore case changes, have a l... | <p>To rename the file you can use the standard <code>git mv</code> command. Since Windows treats files with only changes in case as identical, you have to pass the <code>-f</code> option to force a rename:</p> <pre><code>git mv -f name.java Name.java </code></pre> <p>If instead you want to ignore case changes, have a l... | 64, 119, 1062 | filenames, git, windows | <h1>Change case of a file on Windows?</h1>
<p>There are a couple of files in our git-controlled codebase that I'd like to rename. Specifically, I just want to change the case of the file, so that <code>sourceCode.java</code> becomes <code>SourceCode.java</code>, for example. The catch: I'm on a Windows box, and the f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,369 | git | # Change case of a file on Windows?
There are a couple of files in our git-controlled codebase that I'd like to rename. Specifically, I just want to change the case of the file, so that `sourceCode.java` becomes `SourceCode.java`, for example. The catch: I'm on a Windows box, and the filesystem thinks those are the sa... | To rename the file you can use the standard `git mv` command.
Since Windows treats files with only changes in case as identical, you have to pass the `-f` option to force a rename:
```
git mv -f name.java Name.java
```
If instead you want to ignore case changes, have a look at the question
[How to make git ignore cha... |
4924002 | git - pulling from specific branch | 354 | 2011-02-07 16:56:27 | <p>I have cloned a git repository to my dev server and then switched to the dev branch but now I can't do a git pull to update the branch.</p>
<p>How do I update the code on the server ?</p>
| 1,275,458 | 370,925 | 2021-11-10 17:16:23 | 4,924,044 | 466 | 2011-02-07 16:59:24 | 119,963 | 2021-11-10 17:16:23 | https://stackoverflow.com/q/4924002 | https://stackoverflow.com/a/4924044 | <p>See the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html" rel="noreferrer">git-pull man page</a>:</p>
<blockquote>
<p><code>git pull [options] [<repository> [<refspec>...]]</code></p>
</blockquote>
<p>and in the examples section:</p>
<blockquote>
<p>Merge into the current branch the... | <p>See the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html" rel="noreferrer">git-pull man page</a>:</p> <blockquote> <p><code>git pull [options] [<repository> [<refspec>...]]</code></p> </blockquote> <p>and in the examples section:</p> <blockquote> <p>Merge into the current branch the... | 119 | git | <h1>git - pulling from specific branch</h1>
<p>I have cloned a git repository to my dev server and then switched to the dev branch but now I can't do a git pull to update the branch.</p>
<p>How do I update the code on the server ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,371 | git | # git - pulling from specific branch
I have cloned a git repository to my dev server and then switched to the dev branch but now I can't do a git pull to update the branch.
How do I update the code on the server ? | See the [git-pull man page](http://www.kernel.org/pub/software/scm/git/docs/git-pull.html):
> `git pull [options] [<repository> [<refspec>...]]`
and in the examples section:
> Merge into the current branch the remote branch next:
>
> `$ git pull origin next`
So I imagine you want to do something like:
```
git pull... |
2668886 | Git: copy all files in a directory from another branch | 302 | 2010-04-19 15:55:02 | <p>How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing </p>
<pre><code>git ls-tree master:dirname
</code></pre>
<p>I can then copy all of the files individually by doing</p>
<pre><code>git checkout master -- dirname/filename
</code></pre>
<p>However, us... | 205,633 | 320,503 | 2024-10-10 07:56:17 | 2,668,947 | 463 | 2010-04-19 16:04:50 | 19,563 | 2010-04-19 16:04:50 | https://stackoverflow.com/q/2668886 | https://stackoverflow.com/a/2668947 | <p>As you are not trying to move the files around in the tree, you should be able to just checkout the directory:</p>
<pre><code>git checkout master -- dirname
</code></pre>
| <p>As you are not trying to move the files around in the tree, you should be able to just checkout the directory:</p> <pre><code>git checkout master -- dirname </code></pre> | 119, 1879, 4330, 5310 | branch, copy, file, git | <h1>Git: copy all files in a directory from another branch</h1>
<p>How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing </p>
<pre><code>git ls-tree master:dirname
</code></pre>
<p>I can then copy all of the files individually by doing</p>
<pre><code>git c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,372 | git | # Git: copy all files in a directory from another branch
How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing
```
git ls-tree master:dirname
```
I can then copy all of the files individually by doing
```
git checkout master -- dirname/filename
```
Howev... | As you are not trying to move the files around in the tree, you should be able to just checkout the directory:
```
git checkout master -- dirname
``` |
4307095 | How can I split up a Git commit buried in history? | 304 | 2010-11-29 19:06:12 | <p>I flubbed up my history and want to do some changes to it. Problem is, I have a commit with two unrelated changes, and this commit is surrounded by some other changes in my local (non-pushed) history.</p>
<p>I want to split up this commit before I push it out, but most of the guides I'm seeing have to do with split... | 55,681 | 158,876 | 2020-09-22 04:42:07 | 4,307,158 | 460 | 2010-11-29 19:14:53 | 119,963 | 2014-04-24 08:49:56 | https://stackoverflow.com/q/4307095 | https://stackoverflow.com/a/4307158 | <p>There is a guide to splitting commits <a href="http://git-scm.com/docs/git-rebase.html#_splitting_commits" rel="noreferrer">in the rebase manpage</a>. The quick summary is:</p>
<ul>
<li><p>Perform an interactive rebase including the target commit (e.g. <code>git rebase -i <commit-to-split>^ branch</code>) and... | <p>There is a guide to splitting commits <a href="http://git-scm.com/docs/git-rebase.html#_splitting_commits" rel="noreferrer">in the rebase manpage</a>. The quick summary is:</p> <ul> <li><p>Perform an interactive rebase including the target commit (e.g. <code>git rebase -i <commit-to-split>^ branch</code>) and... | 119, 2193, 5597, 69559 | commit, git, revision-history, split | <h1>How can I split up a Git commit buried in history?</h1>
<p>I flubbed up my history and want to do some changes to it. Problem is, I have a commit with two unrelated changes, and this commit is surrounded by some other changes in my local (non-pushed) history.</p>
<p>I want to split up this commit before I push it ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,374 | git | # How can I split up a Git commit buried in history?
I flubbed up my history and want to do some changes to it. Problem is, I have a commit with two unrelated changes, and this commit is surrounded by some other changes in my local (non-pushed) history.
I want to split up this commit before I push it out, but most of... | There is a guide to splitting commits [in the rebase manpage](http://git-scm.com/docs/git-rebase.html#_splitting_commits). The quick summary is:
- Perform an interactive rebase including the target commit (e.g. `git rebase -i <commit-to-split>^ branch`) and mark it to be edited.
- When the rebase reaches that commit, ... |
1598759 | Git and Mercurial - Compare and Contrast | 526 | 2009-10-21 04:46:35 | <p>For a while now I've been using subversion for my personal projects.</p>
<p>More and more I keep hearing great things about Git and Mercurial, and DVCS in general.</p>
<p>I'd like to give the whole DVCS thing a whirl, but I'm not too familiar with either option.</p>
<p>What are some of the differences between Mer... | 42,627 | 12,983 | 2018-11-15 13:40:46 | 1,599,930 | 457 | 2009-10-21 10:23:42 | 46,058 | 2018-02-22 09:31:22 | https://stackoverflow.com/q/1598759 | https://stackoverflow.com/a/1599930 | <p><strong>Disclaimer:</strong> <em>I use Git, follow Git development on git mailing list, and even contribute a bit to Git (gitweb mainly). I know Mercurial from documentation and some from discussion on #revctrl IRC channel on FreeNode.</em></p>
<p><em>Thanks to all people on on #mercurial IRC channel who provided he... | <p><strong>Disclaimer:</strong> <em>I use Git, follow Git development on git mailing list, and even contribute a bit to Git (gitweb mainly). I know Mercurial from documentation and some from discussion on #revctrl IRC channel on FreeNode.</em></p> <p><em>Thanks to all people on on #mercurial IRC channel who provided he... | 119, 456, 802, 3346 | dvcs, git, mercurial, version-control | <h1>Git and Mercurial - Compare and Contrast</h1>
<p>For a while now I've been using subversion for my personal projects.</p>
<p>More and more I keep hearing great things about Git and Mercurial, and DVCS in general.</p>
<p>I'd like to give the whole DVCS thing a whirl, but I'm not too familiar with either option.</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,375 | git | # Git and Mercurial - Compare and Contrast
For a while now I've been using subversion for my personal projects.
More and more I keep hearing great things about Git and Mercurial, and DVCS in general.
I'd like to give the whole DVCS thing a whirl, but I'm not too familiar with either option.
What are some of the dif... | **Disclaimer:** *I use Git, follow Git development on git mailing list, and even contribute a bit to Git (gitweb mainly). I know Mercurial from documentation and some from discussion on #revctrl IRC channel on FreeNode.*
*Thanks to all people on on #mercurial IRC channel who provided help about Mercurial for this writ... |
6701292 | Git fast-forward VS no fast-forward merge | 402 | 2011-07-14 23:50:53 | <p>Git merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas when to use fast-forward merge and when to use no fast-forward merge?</p>
| 267,328 | 186,849 | 2024-07-26 14:56:33 | 6,701,322 | 456 | 2011-07-14 23:55:17 | 104,344 | 2017-12-05 09:52:48 | https://stackoverflow.com/q/6701292 | https://stackoverflow.com/a/6701322 | <p>The <code>--no-ff</code> option is useful when you want to have a clear notion of your feature branch. So even if in the meantime no commits were made, FF is possible - you still want sometimes to have each commit in the mainline correspond to one feature. So you treat a feature branch with a bunch of commits as a s... | <p>The <code>--no-ff</code> option is useful when you want to have a clear notion of your feature branch. So even if in the meantime no commits were made, FF is possible - you still want sometimes to have each commit in the mainline correspond to one feature. So you treat a feature branch with a bunch of commits as a s... | 119 | git | <h1>Git fast-forward VS no fast-forward merge</h1>
<p>Git merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas when to use fast-forward merge and when to use no fast-forward merge?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,377 | git | # Git fast-forward VS no fast-forward merge
Git merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas when to use fast-forward merge and when to use no fast-forward merge? | The `--no-ff` option is useful when you want to have a clear notion of your feature branch. So even if in the meantime no commits were made, FF is possible - you still want sometimes to have each commit in the mainline correspond to one feature. So you treat a feature branch with a bunch of commits as a single unit, an... |
17628305 | Windows git "warning: LF will be replaced by CRLF", is that warning tail backward? | 346 | 2013-07-13 08:12:57 | <p>env:</p>
<ul>
<li>Windows 7 </li>
<li>msysgit </li>
</ul>
<p>Wheng I <code>git commit</code>, it says: </p>
<pre><code>warning: LF will be replaced by CRLF.
</code></pre>
<p>Is this warning tail backward?<br>
I edit file in Windows, the end of line is <code>CRLF</code>, just like this pic:<br>
<img src="https... | 826,247 | 974,526 | 2025-10-14 03:16:03 | 17,628,353 | 455 | 2013-07-13 08:18:42 | 6,309 | 2022-05-21 18:42:09 | https://stackoverflow.com/q/17628305 | https://stackoverflow.com/a/17628353 | <blockquote>
<p>warning: LF will be replaced by CRLF.</p>
</blockquote>
<p>Depending on the editor you are using, a text file with LF wouldn't necessary be saved with CRLF: recent editors can <em>preserve</em> eol style. But that git config setting insists on changing those...</p>
<p>Simply make sure that (as <a href="... | <blockquote> <p>warning: LF will be replaced by CRLF.</p> </blockquote> <p>Depending on the editor you are using, a text file with LF wouldn't necessary be saved with CRLF: recent editors can <em>preserve</em> eol style. But that git config setting insists on changing those...</p> <p>Simply make sure that (as <a href="... | 64, 119, 47852 | git, linefeed, windows | <h1>Windows git "warning: LF will be replaced by CRLF", is that warning tail backward?</h1>
<p>env:</p>
<ul>
<li>Windows 7 </li>
<li>msysgit </li>
</ul>
<p>Wheng I <code>git commit</code>, it says: </p>
<pre><code>warning: LF will be replaced by CRLF.
</code></pre>
<p>Is this warning tail backward?<br>
I edit fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,378 | git | # Windows git "warning: LF will be replaced by CRLF", is that warning tail backward?
env:
- Windows 7
- msysgit
Wheng I `git commit`, it says:
```
warning: LF will be replaced by CRLF.
```
Is this warning tail backward?
I edit file in Windows, the end of line is `CRLF`, just like this pic:
 | 390 | 2013-05-30 00:00:59 | <p>I am in the middle of rebasing after a <code>git pull --rebase</code>. I have a few files that have merge conflicts. How can I accept "their" changes or "my" changes for specific files?</p>
<pre><code>$ git status
# Not currently on any branch.
# You are currently rebasing.
# (fix conflicts and then run "git re... | 311,975 | 471,321 | 2025-02-05 08:00:11 | 16,826,016 | 449 | 2013-05-30 00:21:47 | null | 2013-05-30 00:21:47 | https://stackoverflow.com/q/16825849 | https://stackoverflow.com/a/16826016 | <p>For each conflicted file you get, you can specify</p>
<pre><code>git checkout --ours -- <paths>
# or
git checkout --theirs -- <paths>
</code></pre>
<p>From the <a href="http://git-scm.com/docs/git-checkout"><code>git checkout</code> docs</a></p>
<blockquote>
<p><code>git checkout [-f|--ours|--theirs... | <p>For each conflicted file you get, you can specify</p> <pre><code>git checkout --ours -- <paths> # or git checkout --theirs -- <paths> </code></pre> <p>From the <a href="http://git-scm.com/docs/git-checkout"><code>git checkout</code> docs</a></p> <blockquote> <p><code>git checkout [-f|--ours|--theirs... | 119, 29934, 106113 | git, git-merge-conflict, git-rebase | <h1>Choose Git merge strategy for specific files ("ours", "mine", "theirs")</h1>
<p>I am in the middle of rebasing after a <code>git pull --rebase</code>. I have a few files that have merge conflicts. How can I accept "their" changes or "my" changes for specific files?</p>
<pre><code>$ git status
# Not currently on ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,383 | git | # Choose Git merge strategy for specific files ("ours", "mine", "theirs")
I am in the middle of rebasing after a `git pull --rebase`. I have a few files that have merge conflicts. How can I accept "their" changes or "my" changes for specific files?
```
$ git status
# Not currently on any branch.
# You are currently r... | For each conflicted file you get, you can specify
```
git checkout --ours -- <paths>
# or
git checkout --theirs -- <paths>
```
From the [`git checkout` docs](http://git-scm.com/docs/git-checkout)
> `git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...`
>
> **`--ours`**
> **`--theirs... |
11675841 | Merge stashed change with current changes | 295 | 2012-07-26 18:35:50 | <p>I made some changes to my branch and realized I forgot I had stashed some other necessary changes to the said branch. What I want is a way to merge my stashed changes with the current changes.</p>
<p>Is there a way to do this?</p>
<p>It’s more for convenience, I eventually gave up and committed my current changes f... | 240,768 | 1,467,365 | 2023-12-21 10:26:40 | 16,613,814 | 449 | 2013-05-17 16:25:02 | 150,762 | 2020-09-18 05:04:29 | https://stackoverflow.com/q/11675841 | https://stackoverflow.com/a/16613814 | <h3>tl;dr</h3>
<p>Run <code>git add</code> first.</p>
<hr />
<p>I just discovered that if your uncommitted changes are added to the index (i.e. "staged", using <code>git add ...</code>), then <code>git stash apply</code> (and, presumably, <code>git stash pop</code>) will actually do a proper merge. If there a... | <h3>tl;dr</h3> <p>Run <code>git add</code> first.</p> <hr /> <p>I just discovered that if your uncommitted changes are added to the index (i.e. "staged", using <code>git add ...</code>), then <code>git stash apply</code> (and, presumably, <code>git stash pop</code>) will actually do a proper merge. If there a... | 119, 13091, 28897 | git, git-merge, git-stash | <h1>Merge stashed change with current changes</h1>
<p>I made some changes to my branch and realized I forgot I had stashed some other necessary changes to the said branch. What I want is a way to merge my stashed changes with the current changes.</p>
<p>Is there a way to do this?</p>
<p>It’s more for convenience, I ev... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,384 | git | # Merge stashed change with current changes
I made some changes to my branch and realized I forgot I had stashed some other necessary changes to the said branch. What I want is a way to merge my stashed changes with the current changes.
Is there a way to do this?
It’s more for convenience, I eventually gave up and c... | ### tl;dr
Run `git add` first.
---
I just discovered that if your uncommitted changes are added to the index (i.e. "staged", using `git add ...`), then `git stash apply` (and, presumably, `git stash pop`) will actually do a proper merge. If there are no conflicts, you're golden. If not, resolve them as usual with `g... |
33610682 | Git list of staged files | 281 | 2015-11-09 13:52:46 | <p>I staged a lot of files using <code>git add</code>, and now I want to see all the files I have staged, without <em>untracked</em> files or <em>changed, but unstaged</em> files.</p>
<p>How do I do that? When using <code>git diff --cached</code> I can see the changes of what I just staged. So then I tried using <code>... | 335,709 | 2,117,444 | 2023-03-11 15:01:51 | 33,610,683 | 449 | 2015-11-09 13:52:46 | 2,117,444 | 2022-10-19 10:03:56 | https://stackoverflow.com/q/33610682 | https://stackoverflow.com/a/33610683 | <p>The best way to do this is by running the command:</p>
<pre><code>git diff --name-only --cached
</code></pre>
<p>When you check the manual you will likely find the following:</p>
<pre><code>--name-only
Show only names of changed files.
</code></pre>
<p>And on <a href="https://git-scm.com/docs/git-diff#_examples"... | <p>The best way to do this is by running the command:</p> <pre><code>git diff --name-only --cached </code></pre> <p>When you check the manual you will likely find the following:</p> <pre><code>--name-only Show only names of changed files. </code></pre> <p>And on <a href="https://git-scm.com/docs/git-diff#_examples"... | 119, 9033, 54839, 74978 | git, git-diff, git-stage, git-status | <h1>Git list of staged files</h1>
<p>I staged a lot of files using <code>git add</code>, and now I want to see all the files I have staged, without <em>untracked</em> files or <em>changed, but unstaged</em> files.</p>
<p>How do I do that? When using <code>git diff --cached</code> I can see the changes of what I just st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,385 | git | # Git list of staged files
I staged a lot of files using `git add`, and now I want to see all the files I have staged, without *untracked* files or *changed, but unstaged* files.
How do I do that? When using `git diff --cached` I can see the changes of what I just staged. So then I tried using `git status --cached`, ... | The best way to do this is by running the command:
```
git diff --name-only --cached
```
When you check the manual you will likely find the following:
```
--name-only
Show only names of changed files.
```
And on [the example](https://git-scm.com/docs/git-diff#_examples) part of the manual:
```
git diff --cache... |
7548926 | Git "error: The branch 'x' is not fully merged" | 430 | 2011-09-25 22:01:22 | <p>Here are the commands I used from the master branch</p>
<pre><code>git branch experiment
git checkout experiment
</code></pre>
<p>Then I made some changes to my files, committed the changes, and pushed the new branch to GitHub.</p>
<pre><code>git commit . -m 'changed files'
git push -u origin experiment
</code></pre... | 251,042 | 401,019 | 2025-12-07 10:08:22 | 7,549,118 | 448 | 2011-09-25 22:42:17 | 85,371 | 2022-11-25 08:57:49 | https://stackoverflow.com/q/7548926 | https://stackoverflow.com/a/7549118 | <p><sup><strong>Note</strong> Wording changed in response to the commments. Thanks @slekse<br/></sup>
That is not an error, it is a warning. It means the branch you are about to delete contains commits that are not reachable from any of: its upstream branch, or HEAD (currently checked out revision). <em>In other words,... | <p><sup><strong>Note</strong> Wording changed in response to the commments. Thanks @slekse<br/></sup> That is not an error, it is a warning. It means the branch you are about to delete contains commits that are not reachable from any of: its upstream branch, or HEAD (currently checked out revision). <em>In other words,... | 119, 76220 | git, git-branch | <h1>Git "error: The branch 'x' is not fully merged"</h1>
<p>Here are the commands I used from the master branch</p>
<pre><code>git branch experiment
git checkout experiment
</code></pre>
<p>Then I made some changes to my files, committed the changes, and pushed the new branch to GitHub.</p>
<pre><code>git commit . -m '... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,386 | git | # Git "error: The branch 'x' is not fully merged"
Here are the commands I used from the master branch
```
git branch experiment
git checkout experiment
```
Then I made some changes to my files, committed the changes, and pushed the new branch to GitHub.
```
git commit . -m 'changed files'
git push -u origin experim... | **Note** Wording changed in response to the commments. Thanks @slekse
That is not an error, it is a warning. It means the branch you are about to delete contains commits that are not reachable from any of: its upstream branch, or HEAD (currently checked out revision). *In other words, when you might lose commits¹.*
In... |
9162271 | fatal: Not a valid object name: 'master' | 322 | 2012-02-06 15:15:02 | <p>I have a private server running git 1.7
When I </p>
<pre><code>git init
</code></pre>
<p>a folder it doesn't create a master branch.
Cause when i do: </p>
<pre><code>git branch
</code></pre>
<p>it doesn't list anything.
When I do:</p>
<pre><code>git --bare init
</code></pre>
<p>it creates the files.
When I ... | 505,219 | 1,192,134 | 2023-11-09 14:33:41 | 9,162,347 | 447 | 2012-02-06 15:19:20 | 229,044 | 2012-02-06 15:19:20 | https://stackoverflow.com/q/9162271 | https://stackoverflow.com/a/9162347 | <blockquote>
<p>When I <code>git init</code> a folder it doesn't create a master branch</p>
</blockquote>
<p>This is true, and expected behaviour. Git will not create a <code>master</code> branch until you commit something.</p>
<blockquote>
<p>When I do <code>git --bare init</code> it creates the files.</p>
</blo... | <blockquote> <p>When I <code>git init</code> a folder it doesn't create a master branch</p> </blockquote> <p>This is true, and expected behaviour. Git will not create a <code>master</code> branch until you commit something.</p> <blockquote> <p>When I do <code>git --bare init</code> it creates the files.</p> </blo... | 119 | git | <h1>fatal: Not a valid object name: 'master'</h1>
<p>I have a private server running git 1.7
When I </p>
<pre><code>git init
</code></pre>
<p>a folder it doesn't create a master branch.
Cause when i do: </p>
<pre><code>git branch
</code></pre>
<p>it doesn't list anything.
When I do:</p>
<pre><code>git --bare in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,388 | git | # fatal: Not a valid object name: 'master'
I have a private server running git 1.7
When I
```
git init
```
a folder it doesn't create a master branch.
Cause when i do:
```
git branch
```
it doesn't list anything.
When I do:
```
git --bare init
```
it creates the files.
When I type
```
git branch master
```
it ... | > When I `git init` a folder it doesn't create a master branch
This is true, and expected behaviour. Git will not create a `master` branch until you commit something.
> When I do `git --bare init` it creates the files.
A non-bare `git init` will also create the same files, in a hidden `.git` directory in the root of... |
4647301 | Rolling back local and remote git repository by 1 commit | 279 | 2011-01-10 13:25:16 | <p>I've read the similar posts on this topic, and can't for the life of me figure out how to do this properly.</p>
<p>I checked in about 1000 files that I don't want, and I'd rather not have to go through 1by1 and remove them all from the repo.</p>
<ul>
<li>I have a remote <strong><code>master</code></strong> Branch.... | 226,143 | 95,175 | 2022-12-09 11:29:58 | 4,647,362 | 447 | 2011-01-10 13:32:54 | 6,309 | 2021-10-14 14:21:39 | https://stackoverflow.com/q/4647301 | https://stackoverflow.com/a/4647362 | <p>If nobody has pulled your remote repo yet, you can change your branch HEAD and force push it to said remote repo:</p>
<pre><code>git reset --hard HEAD^
git push -f
</code></pre>
<p>(or, if you have direct access to the remote repo, you can change its <a href="https://stackoverflow.com/questions/4624881/how-can-i-u... | <p>If nobody has pulled your remote repo yet, you can change your branch HEAD and force push it to said remote repo:</p> <pre><code>git reset --hard HEAD^ git push -f </code></pre> <p>(or, if you have direct access to the remote repo, you can change its <a href="https://stackoverflow.com/questions/4624881/how-can-i-u... | 119 | git | <h1>Rolling back local and remote git repository by 1 commit</h1>
<p>I've read the similar posts on this topic, and can't for the life of me figure out how to do this properly.</p>
<p>I checked in about 1000 files that I don't want, and I'd rather not have to go through 1by1 and remove them all from the repo.</p>
<ul... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,390 | git | # Rolling back local and remote git repository by 1 commit
I've read the similar posts on this topic, and can't for the life of me figure out how to do this properly.
I checked in about 1000 files that I don't want, and I'd rather not have to go through 1by1 and remove them all from the repo.
- I have a remote **`ma... | If nobody has pulled your remote repo yet, you can change your branch HEAD and force push it to said remote repo:
```
git reset --hard HEAD^
git push -f
```
(or, if you have direct access to the remote repo, you can change its [HEAD reference even though it is a bare repo](https://stackoverflow.com/questions/4624881... |
6188780 | git + LaTeX workflow | 312 | 2011-05-31 14:03:57 | <p>I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my server. I'm also using Kile + Oku... | 108,244 | 307,283 | 2020-06-23 16:51:39 | 6,190,412 | 446 | 2011-05-31 16:09:29 | 3,730,911 | 2020-06-23 16:51:39 | https://stackoverflow.com/q/6188780 | https://stackoverflow.com/a/6190412 | <h3>Changes to your LaTeX workflow:</h3>
<p>The first step in efficiently managing a Git+LaTeX workflow is to make a few changes to your LaTeX habits.</p>
<ul>
<li><p>For starters, <strong>write each sentence on a separate line</strong>. Git was written to version control source code, where each line is distinct and ha... | <h3>Changes to your LaTeX workflow:</h3> <p>The first step in efficiently managing a Git+LaTeX workflow is to make a few changes to your LaTeX habits.</p> <ul> <li><p>For starters, <strong>write each sentence on a separate line</strong>. Git was written to version control source code, where each line is distinct and ha... | 119, 1704, 55606 | git, git-workflow, latex | <h1>git + LaTeX workflow</h1>
<p>I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my ser... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,391 | git | # git + LaTeX workflow
I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my server. I'm ... | ### Changes to your LaTeX workflow:
The first step in efficiently managing a Git+LaTeX workflow is to make a few changes to your LaTeX habits.
- For starters, **write each sentence on a separate line**. Git was written to version control source code, where each line is distinct and has a specific purpose. When you wr... |
12765344 | oh-my-zsh slow, but only for certain Git repo | 209 | 2012-10-07 01:21:57 | <p>I recently started using Zsh and it's awesome. Unfortunately, for the project I consider my "main" project, everything is slow. What I mean is that every time I run a command - <code>ls</code>, for example - there's about a five-second delay between the time the command is executed and the time I can use the termina... | 109,259 | 199,712 | 2024-04-13 08:36:30 | 25,864,063 | 446 | 2014-09-16 08:32:23 | 505,248 | 2018-05-02 20:03:35 | https://stackoverflow.com/q/12765344 | https://stackoverflow.com/a/25864063 | <p>You can add this to your git config and zsh won't check the status anymore </p>
<pre class="lang-bash prettyprint-override"><code>git config --add oh-my-zsh.hide-status 1
git config --add oh-my-zsh.hide-dirty 1
</code></pre>
<hr>
<h3>Explanation</h3>
<p>There are two central git functions in in <a href="https:/... | <p>You can add this to your git config and zsh won't check the status anymore </p> <pre class="lang-bash prettyprint-override"><code>git config --add oh-my-zsh.hide-status 1 git config --add oh-my-zsh.hide-dirty 1 </code></pre> <hr> <h3>Explanation</h3> <p>There are two central git functions in in <a href="https:/... | 119, 3791 | git, zsh | <h1>oh-my-zsh slow, but only for certain Git repo</h1>
<p>I recently started using Zsh and it's awesome. Unfortunately, for the project I consider my "main" project, everything is slow. What I mean is that every time I run a command - <code>ls</code>, for example - there's about a five-second delay between the time the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,393 | git | # oh-my-zsh slow, but only for certain Git repo
I recently started using Zsh and it's awesome. Unfortunately, for the project I consider my "main" project, everything is slow. What I mean is that every time I run a command - `ls`, for example - there's about a five-second delay between the time the command is executed... | You can add this to your git config and zsh won't check the status anymore
```
git config --add oh-my-zsh.hide-status 1
git config --add oh-my-zsh.hide-dirty 1
```
---
### Explanation
There are two central git functions in in [lib/git.zsh](https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh):
- `git_... |
5188914 | How to show the first commit by 'git log'? | 529 | 2011-03-04 02:07:57 | <p>I have a Git project which has a long history. I want to show the first commit.</p>
<p>How do I do this?</p>
| 220,938 | 400,275 | 2024-09-17 20:41:42 | 5,189,296 | 445 | 2011-03-04 03:23:34 | 193,688 | 2024-09-17 20:41:42 | https://stackoverflow.com/q/5188914 | https://stackoverflow.com/a/5189296 | <h2>Short answer</h2>
<pre class="lang-bash prettyprint-override"><code>git rev-list --max-parents=0 HEAD
</code></pre>
<p><sub>(from <a href="https://stackoverflow.com/questions/5188914/how-to-show-first-commit-by-git-log#comment19763574_5189296" title="tiho's comment">tiho's comment</a>. As <a href="https://stackove... | <h2>Short answer</h2> <pre class="lang-bash prettyprint-override"><code>git rev-list --max-parents=0 HEAD </code></pre> <p><sub>(from <a href="https://stackoverflow.com/questions/5188914/how-to-show-first-commit-by-git-log#comment19763574_5189296" title="tiho's comment">tiho's comment</a>. As <a href="https://stackove... | 119 | git | <h1>How to show the first commit by 'git log'?</h1>
<p>I have a Git project which has a long history. I want to show the first commit.</p>
<p>How do I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,394 | git | # How to show the first commit by 'git log'?
I have a Git project which has a long history. I want to show the first commit.
How do I do this? | ## Short answer
```
git rev-list --max-parents=0 HEAD
```
(from [tiho's comment](https://stackoverflow.com/questions/5188914/how-to-show-first-commit-by-git-log#comment19763574_5189296 "tiho's comment"). As [Chris Johnsen notices](https://stackoverflow.com/questions/5188914/how-to-show-first-commit-by-git-log#comment... |
25931026 | How can I rename a git stash? | 361 | 2014-09-19 09:46:31 | <p>I have a stash with an incorrect name. I would like to fix the name so it's accurate. </p>
<p><strong>How can I rename a stash?</strong></p>
| 71,111 | 123,671 | 2025-07-15 05:23:54 | 35,549,615 | 445 | 2016-02-22 09:09:53 | 5,508,756 | 2016-06-27 13:59:25 | https://stackoverflow.com/q/25931026 | https://stackoverflow.com/a/35549615 | <p>Let's assume your stash list looks like this:</p>
<pre><code>$ git stash list
stash@{0}: WIP on master: Add some very important feature
stash@{1}: WIP on master: Fix some silly bug
</code></pre>
<p>First, you must remove stash entry which you want to rename:</p>
<pre><code>$ git stash drop stash@{1}
Dropped stas... | <p>Let's assume your stash list looks like this:</p> <pre><code>$ git stash list stash@{0}: WIP on master: Add some very important feature stash@{1}: WIP on master: Fix some silly bug </code></pre> <p>First, you must remove stash entry which you want to rename:</p> <pre><code>$ git stash drop stash@{1} Dropped stas... | 119, 13091 | git, git-stash | <h1>How can I rename a git stash?</h1>
<p>I have a stash with an incorrect name. I would like to fix the name so it's accurate. </p>
<p><strong>How can I rename a stash?</strong></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,395 | git | # How can I rename a git stash?
I have a stash with an incorrect name. I would like to fix the name so it's accurate.
**How can I rename a stash?** | Let's assume your stash list looks like this:
```
$ git stash list
stash@{0}: WIP on master: Add some very important feature
stash@{1}: WIP on master: Fix some silly bug
```
First, you must remove stash entry which you want to rename:
```
$ git stash drop stash@{1}
Dropped stash@{1} (af8fdeee49a03d1b4609f294635e7f0... |
40818354 | Visual Studio Code: .git folder/file hidden | 292 | 2016-11-26 12:31:57 | <p>I am trying Visual Studio Code at this moment. Everything about Visual Studio Code look really cool to me except one thing: <strong>.git folder/file is hidden in Visual Studio Code.</strong></p>
<p>I often change Git setting by modifying the <code>.git</code> configuration file. It is really annoying for me not able... | 169,114 | 4,661,625 | 2024-09-16 17:29:39 | 40,828,248 | 445 | 2016-11-27 11:10:37 | 2,717,959 | 2024-09-16 17:29:39 | https://stackoverflow.com/q/40818354 | https://stackoverflow.com/a/40828248 | <p>By default Visual Studio Code excludes files in a folder using the following settings:</p>
<pre><code>"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true
}
</code></pre>
<p>You can change your user settings or wor... | <p>By default Visual Studio Code excludes files in a folder using the following settings:</p> <pre><code>"files.exclude": { "**/.git": true, "**/.svn": true, "**/.hg": true, "**/.DS_Store": true } </code></pre> <p>You can change your user settings or wor... | 119, 111608 | git, visual-studio-code | <h1>Visual Studio Code: .git folder/file hidden</h1>
<p>I am trying Visual Studio Code at this moment. Everything about Visual Studio Code look really cool to me except one thing: <strong>.git folder/file is hidden in Visual Studio Code.</strong></p>
<p>I often change Git setting by modifying the <code>.git</code> conf... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,396 | git | # Visual Studio Code: .git folder/file hidden
I am trying Visual Studio Code at this moment. Everything about Visual Studio Code look really cool to me except one thing: **.git folder/file is hidden in Visual Studio Code.**
I often change Git setting by modifying the `.git` configuration file. It is really annoying f... | By default Visual Studio Code excludes files in a folder using the following settings:
```
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true
}
```
You can change your user settings or workspace settings to show the .git folder by adding these lines:
```
"files.... |
57265785 | What's the difference between 'git switch' and 'git checkout' <branch>? | 1,111 | 2019-07-30 06:46:30 | <p>Git 2.23 <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt#L61-L65" rel="noreferrer">introduces</a> a new command <code>git switch</code>. After reading the documentation, it seems pretty much the same as <code>git checkout <branchname></code>. What is the difference or use case... | 508,667 | 2,881,414 | 2025-07-06 06:45:26 | 70,454,786 | 444 | 2021-12-22 20:32:39 | 1,108,305 | 2025-04-03 13:55:41 | https://stackoverflow.com/q/57265785 | https://stackoverflow.com/a/70454786 | <p>The <code>switch</code> command indeed does the same thing as <code>checkout</code>, but only for those usages that switch branches. It cannot restore working tree files — that is done using <code>restore</code>, the other command split off from <code>checkout</code>.</p>
<p>The two commands which <code>checkout</... | <p>The <code>switch</code> command indeed does the same thing as <code>checkout</code>, but only for those usages that switch branches. It cannot restore working tree files — that is done using <code>restore</code>, the other command split off from <code>checkout</code>.</p> <p>The two commands which <code>checkout</... | 119, 37230, 147522 | git, git-checkout, git-switch | <h1>What's the difference between 'git switch' and 'git checkout' <branch>?</h1>
<p>Git 2.23 <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt#L61-L65" rel="noreferrer">introduces</a> a new command <code>git switch</code>. After reading the documentation, it seems pretty much the same as... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,398 | git | # What's the difference between 'git switch' and 'git checkout' ?
Git 2.23 [introduces](https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt#L61-L65) a new command `git switch`. After reading the documentation, it seems pretty much the same as `git checkout <branchname>`. What is the difference or ... | The `switch` command indeed does the same thing as `checkout`, but only for those usages that switch branches. It cannot restore working tree files — that is done using `restore`, the other command split off from `checkout`.
The two commands which `checkout` has been split into, in summary:
- `switch` — Switch to a s... |
10755655 | Git: Ignore tracked files | 297 | 2012-05-25 13:54:57 | <p>I have some tracked files in a repository which are automatically modified when building the code. I don't want to untrack them, I just don't want them to appear as modified and I don't want them to be staged when I git add.</p>
<p>Is this possible? </p>
| 93,204 | 236,733 | 2022-09-14 16:50:49 | 10,755,704 | 442 | 2012-05-25 13:57:52 | 78,613 | 2019-08-28 17:45:23 | https://stackoverflow.com/q/10755655 | https://stackoverflow.com/a/10755704 | <p>Sure.</p>
<pre><code>git update-index --assume-unchanged [<file> ...]
</code></pre>
<p>To undo and start tracking again:</p>
<pre><code>git update-index --no-assume-unchanged [<file> ...]
</code></pre>
| <p>Sure.</p> <pre><code>git update-index --assume-unchanged [<file> ...] </code></pre> <p>To undo and start tracking again:</p> <pre><code>git update-index --no-assume-unchanged [<file> ...] </code></pre> | 119 | git | <h1>Git: Ignore tracked files</h1>
<p>I have some tracked files in a repository which are automatically modified when building the code. I don't want to untrack them, I just don't want them to appear as modified and I don't want them to be staged when I git add.</p>
<p>Is this possible? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,400 | git | # Git: Ignore tracked files
I have some tracked files in a repository which are automatically modified when building the code. I don't want to untrack them, I just don't want them to appear as modified and I don't want them to be staged when I git add.
Is this possible? | Sure.
```
git update-index --assume-unchanged [<file> ...]
```
To undo and start tracking again:
```
git update-index --no-assume-unchanged [<file> ...]
``` |
2006172 | Git: How to reset a remote Git repository to remove all commits? | 216 | 2010-01-05 13:09:08 | <p>How can I reset a remote and local Git repository to remove all commits?</p>
<p>I would like to start fresh with the current Head as the initial commit.</p>
| 208,511 | 61,821 | 2024-12-07 20:55:30 | 2,006,252 | 442 | 2010-01-05 13:23:55 | 166,893 | 2015-05-06 17:00:54 | https://stackoverflow.com/q/2006172 | https://stackoverflow.com/a/2006252 | <p>Completely reset?</p>
<ol>
<li><p>Delete the <code>.git</code> directory locally.</p></li>
<li><p>Recreate the git repostory:</p>
<pre><code>$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
</code></pre></li>
<li><p>Push to remote server, overwriting. Remember you... | <p>Completely reset?</p> <ol> <li><p>Delete the <code>.git</code> directory locally.</p></li> <li><p>Recreate the git repostory:</p> <pre><code>$ cd (project-directory) $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit' </code></pre></li> <li><p>Push to remote server, overwriting. Remember you... | 119, 456 | git, version-control | <h1>Git: How to reset a remote Git repository to remove all commits?</h1>
<p>How can I reset a remote and local Git repository to remove all commits?</p>
<p>I would like to start fresh with the current Head as the initial commit.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,401 | git | # Git: How to reset a remote Git repository to remove all commits?
How can I reset a remote and local Git repository to remove all commits?
I would like to start fresh with the current Head as the initial commit. | Completely reset?
1. Delete the `.git` directory locally.
2. Recreate the git repostory:
```
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
```
3. Push to remote server, overwriting. Remember you're going to mess everyone else up doing this … y... |
7200614 | How to merge remote master to local branch | 296 | 2011-08-26 06:06:50 | <p>I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch.</p>
<p>I've tried </p>
<pre><code>git pull --rebase origin configUpdate
</code></pre>
<p>but it hasn't gra... | 522,840 | 264,276 | 2021-05-03 21:28:52 | 7,200,641 | 440 | 2011-08-26 06:09:45 | 149,391 | 2020-04-02 19:21:58 | https://stackoverflow.com/q/7200614 | https://stackoverflow.com/a/7200641 | <p><strong>From your feature branch</strong> (e.g <code>configUpdate</code>) run:</p>
<pre><code>git fetch
git rebase origin/master
</code></pre>
<p>Or the shorter form:</p>
<pre><code>git pull --rebase
</code></pre>
<hr>
<p><strong>Why this works:</strong></p>
<ul>
<li><p><code>git merge branchname</code> takes ... | <p><strong>From your feature branch</strong> (e.g <code>configUpdate</code>) run:</p> <pre><code>git fetch git rebase origin/master </code></pre> <p>Or the shorter form:</p> <pre><code>git pull --rebase </code></pre> <hr> <p><strong>Why this works:</strong></p> <ul> <li><p><code>git merge branchname</code> takes ... | 119, 1879, 4860 | branch, git, pull | <h1>How to merge remote master to local branch</h1>
<p>I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch.</p>
<p>I've tried </p>
<pre><code>git pull --rebase ori... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,402 | git | # How to merge remote master to local branch
I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch.
I've tried
```
git pull --rebase origin configUpdate
```
but it... | **From your feature branch** (e.g `configUpdate`) run:
```
git fetch
git rebase origin/master
```
Or the shorter form:
```
git pull --rebase
```
---
**Why this works:**
- `git merge branchname` takes new commits from the branch `branchname`, and adds them to the current branch. If necessary, it automatically adds... |
14318234 | How do I ignore an error on 'git pull' about my local changes would be overwritten by merge? | 922 | 2013-01-14 12:14:43 | <p>How do I ignore the following error message on Git pull?</p>
<blockquote>
<p>Your local changes to the following files would be overwritten by merge</p>
</blockquote>
<p>What if I <strong>want</strong> to overwrite them?</p>
<p>I've tried things like <code>git pull -f</code>, but nothing works.</p>
<p>To be cl... | 1,668,112 | 1,132,363 | 2025-10-03 05:22:51 | 14,319,943 | 439 | 2013-01-14 14:04:31 | 1,132,363 | 2013-01-14 14:04:31 | https://stackoverflow.com/q/14318234 | https://stackoverflow.com/a/14319943 | <p>Alright with the help of the other two answers I've come up with a direct solution:</p>
<pre><code>git checkout HEAD^ file/to/overwrite
git pull
</code></pre>
| <p>Alright with the help of the other two answers I've come up with a direct solution:</p> <pre><code>git checkout HEAD^ file/to/overwrite git pull </code></pre> | 119, 13091, 28896 | git, git-pull, git-stash | <h1>How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?</h1>
<p>How do I ignore the following error message on Git pull?</p>
<blockquote>
<p>Your local changes to the following files would be overwritten by merge</p>
</blockquote>
<p>What if I <strong>want</strong> to overwr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,403 | git | # How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?
How do I ignore the following error message on Git pull?
> Your local changes to the following files would be overwritten by merge
What if I **want** to overwrite them?
I've tried things like `git pull -f`, but nothing wo... | Alright with the help of the other two answers I've come up with a direct solution:
```
git checkout HEAD^ file/to/overwrite
git pull
``` |
5697750 | What exactly does the "u" do? "git push -u origin master" vs "git push origin master" | 474 | 2011-04-18 01:42:48 | <p>I'm apparently terrible at using git, despite my best attempts to understand it. </p>
<p>From <a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html">kernel.org</a> for <code>git push</code>:</p>
<blockquote>
<p>-u</p>
<p>--set-upstream</p>
<p>For every branch that is up to date or succ... | 342,488 | 527,623 | 2021-07-21 05:31:54 | 5,697,856 | 439 | 2011-04-18 02:02:04 | 54,249 | 2016-07-12 14:33:27 | https://stackoverflow.com/q/5697750 | https://stackoverflow.com/a/5697856 | <p>The key is "argument-less git-pull". When you do a <code>git pull</code> from a branch, without specifying a source remote or branch, git looks at the <code>branch.<name>.merge</code> setting to know where to pull from. <code>git push -u</code> sets this information for the branch you're pushing.</p>
<p>To se... | <p>The key is "argument-less git-pull". When you do a <code>git pull</code> from a branch, without specifying a source remote or branch, git looks at the <code>branch.<name>.merge</code> setting to know where to pull from. <code>git push -u</code> sets this information for the branch you're pushing.</p> <p>To se... | 119 | git | <h1>What exactly does the "u" do? "git push -u origin master" vs "git push origin master"</h1>
<p>I'm apparently terrible at using git, despite my best attempts to understand it. </p>
<p>From <a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html">kernel.org</a> for <code>git push</code>:</p>
<blockqu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,404 | git | # What exactly does the "u" do? "git push -u origin master" vs "git push origin master"
I'm apparently terrible at using git, despite my best attempts to understand it.
From [kernel.org](http://www.kernel.org/pub/software/scm/git/docs/git-push.html) for `git push`:
> -u
>
> --set-upstream
>
> For every branch that i... | The key is "argument-less git-pull". When you do a `git pull` from a branch, without specifying a source remote or branch, git looks at the `branch.<name>.merge` setting to know where to pull from. `git push -u` sets this information for the branch you're pushing.
To see the difference, let's use a new empty branch:
... |
10002239 | Difference between git checkout --track origin/branch and git checkout -b branch origin/branch | 330 | 2012-04-03 22:15:53 | <p>Does anybody know the difference between these two commands to switch and track a remote branch?</p>
<pre><code>git checkout -b branch origin/branch
git checkout --track origin/branch
</code></pre>
<p>I think both keep track of the remote branch so I can push my changes to the branch on origin, right?</p>
<p>Are the... | 286,659 | 443,600 | 2021-08-13 13:54:56 | 10,002,469 | 439 | 2012-04-03 22:39:05 | 6,309 | 2019-07-27 07:09:24 | https://stackoverflow.com/q/10002239 | https://stackoverflow.com/a/10002469 | <p>The two commands have the same effect (<a href="https://stackoverflow.com/a/29784240/825924">thanks to Robert Siemer’s answer for pointing it out</a>). </p>
<p>The practical difference comes when using a local branch named <em>differently</em>:</p>
<ul>
<li><code>git checkout -b mybranch origin/abranch</code> wil... | <p>The two commands have the same effect (<a href="https://stackoverflow.com/a/29784240/825924">thanks to Robert Siemer’s answer for pointing it out</a>). </p> <p>The practical difference comes when using a local branch named <em>differently</em>:</p> <ul> <li><code>git checkout -b mybranch origin/abranch</code> wil... | 119, 1879, 37230, 76220 | branch, git, git-branch, git-checkout | <h1>Difference between git checkout --track origin/branch and git checkout -b branch origin/branch</h1>
<p>Does anybody know the difference between these two commands to switch and track a remote branch?</p>
<pre><code>git checkout -b branch origin/branch
git checkout --track origin/branch
</code></pre>
<p>I think both... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,405 | git | # Difference between git checkout --track origin/branch and git checkout -b branch origin/branch
Does anybody know the difference between these two commands to switch and track a remote branch?
```
git checkout -b branch origin/branch
git checkout --track origin/branch
```
I think both keep track of the remote branc... | The two commands have the same effect ([thanks to Robert Siemer’s answer for pointing it out](https://stackoverflow.com/a/29784240/825924)).
The practical difference comes when using a local branch named *differently*:
- `git checkout -b mybranch origin/abranch` will create `mybranch` and track `origin/abranch`
- `gi... |
10846875 | Move (or "Undo") last git commit to unstaged area | 241 | 2012-06-01 08:27:38 | <p>What's the best way to move your last git commit back into the "Changes not staged" + "Untracked files" areas (with the commit in question being not-pushed / only in your local repo, effectively removing it from HEAD)?</p>
<p>In other words, how do you roll back a commit, but automatically apply that diff to your u... | 134,999 | 222,438 | 2019-06-09 13:11:34 | 10,846,940 | 439 | 2012-06-01 08:33:15 | 477,037 | 2019-06-09 13:11:34 | https://stackoverflow.com/q/10846875 | https://stackoverflow.com/a/10846940 | <p>You can use <a href="https://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code></a> to set the current branch to the preceding commit, i.e. <a href="https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrevgtltngtemegemHEADv1510em" rel="noreferrer"><code>HEAD^</code></a></p>
<pre... | <p>You can use <a href="https://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code></a> to set the current branch to the preceding commit, i.e. <a href="https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrevgtltngtemegemHEADv1510em" rel="noreferrer"><code>HEAD^</code></a></p> <pre... | 119 | git | <h1>Move (or "Undo") last git commit to unstaged area</h1>
<p>What's the best way to move your last git commit back into the "Changes not staged" + "Untracked files" areas (with the commit in question being not-pushed / only in your local repo, effectively removing it from HEAD)?</p>
<p>In other words, how do you roll... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,406 | git | # Move (or "Undo") last git commit to unstaged area
What's the best way to move your last git commit back into the "Changes not staged" + "Untracked files" areas (with the commit in question being not-pushed / only in your local repo, effectively removing it from HEAD)?
In other words, how do you roll back a commit, ... | You can use [`git reset`](https://git-scm.com/docs/git-reset) to set the current branch to the preceding commit, i.e. [`HEAD^`](https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrevgtltngtemegemHEADv1510em)
```
git reset HEAD^
```
Adding `--soft` will keep those files in the *index*: (ready to ... |
6284809 | How can I pull from remote Git repository and override the changes in my local repository? | 215 | 2011-06-08 20:24:56 | <p>I need to throw away all the changes in my local repository and pull all the code from the remote repository. What is the Git command to do this?</p>
| 185,165 | 277,498 | 2017-09-29 14:12:43 | 6,284,819 | 439 | 2011-06-08 20:26:10 | 11,343 | 2017-05-09 08:32:29 | https://stackoverflow.com/q/6284809 | https://stackoverflow.com/a/6284819 | <p>Provided that the remote repository is origin, and that you're interested in master:</p>
<pre><code>git fetch origin
git reset --hard origin/master
</code></pre>
<p>This tells it to fetch the commits from the remote repository, and position your working copy to the tip of its master branch. </p>
<p>All your local... | <p>Provided that the remote repository is origin, and that you're interested in master:</p> <pre><code>git fetch origin git reset --hard origin/master </code></pre> <p>This tells it to fetch the commits from the remote repository, and position your working copy to the tip of its master branch. </p> <p>All your local... | 119 | git | <h1>How can I pull from remote Git repository and override the changes in my local repository?</h1>
<p>I need to throw away all the changes in my local repository and pull all the code from the remote repository. What is the Git command to do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,407 | git | # How can I pull from remote Git repository and override the changes in my local repository?
I need to throw away all the changes in my local repository and pull all the code from the remote repository. What is the Git command to do this? | Provided that the remote repository is origin, and that you're interested in master:
```
git fetch origin
git reset --hard origin/master
```
This tells it to fetch the commits from the remote repository, and position your working copy to the tip of its master branch.
All your local commits not common to the remote w... |
9072376 | configure Git to accept a particular self-signed server certificate for a particular https remote | 241 | 2012-01-30 23:31:55 | <p>The sysadmin for a project I'm on has decided that SSH is "too much trouble"; instead, he has set up Git to be accessible via an <code>https://</code> URL (and username/password authentication). The server for this URL presents a self-signed certificate, so he advised everyone to turn off certificate validation. Thi... | 445,577 | 388,520 | 2025-01-31 18:40:18 | 16,543,283 | 438 | 2013-05-14 12:34:17 | 346,478 | 2025-01-31 18:40:18 | https://stackoverflow.com/q/9072376 | https://stackoverflow.com/a/16543283 | <p>Briefly:</p>
<ol>
<li>Get the self signed certificate</li>
<li>Put it into some (e.g. <code>~/git-certs/cert.pem</code>) file</li>
<li>Set <code>git</code> to trust this certificate using <code>http.sslCAInfo</code> parameter</li>
</ol>
<p>In more details:</p>
<h1>Get self signed certificate of remote server</h1>
<p... | <p>Briefly:</p> <ol> <li>Get the self signed certificate</li> <li>Put it into some (e.g. <code>~/git-certs/cert.pem</code>) file</li> <li>Set <code>git</code> to trust this certificate using <code>http.sslCAInfo</code> parameter</li> </ol> <p>In more details:</p> <h1>Get self signed certificate of remote server</h1> <p... | 119, 14423 | git, ssl-certificate | <h1>configure Git to accept a particular self-signed server certificate for a particular https remote</h1>
<p>The sysadmin for a project I'm on has decided that SSH is "too much trouble"; instead, he has set up Git to be accessible via an <code>https://</code> URL (and username/password authentication). The server for ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,408 | git | # configure Git to accept a particular self-signed server certificate for a particular https remote
The sysadmin for a project I'm on has decided that SSH is "too much trouble"; instead, he has set up Git to be accessible via an `https://` URL (and username/password authentication). The server for this URL presents a ... | Briefly:
1. Get the self signed certificate
2. Put it into some (e.g. `~/git-certs/cert.pem`) file
3. Set `git` to trust this certificate using `http.sslCAInfo` parameter
In more details:
# Get self signed certificate of remote server
Assuming, the server URL is `repos.sample.com` and you want to access it over por... |
26944762 | When to use "chore" as type of commit message? | 403 | 2014-11-15 10:16:44 | <p>What is the use of <code>chore</code> in <a href="http://seesparkbox.com/foundry/semantic_commit_messages" rel="noreferrer">semantic version control commit messages</a>? Other types like <strong>feat</strong> or <strong>fix</strong> are clear, but I don't know when to use "chore".</p>
<p>Can anyone provide... | 464,016 | 1,493,081 | 2025-07-21 19:39:34 | 26,944,812 | 436 | 2014-11-15 10:23:03 | 6,309 | 2025-07-21 19:39:34 | https://stackoverflow.com/q/26944762 | https://stackoverflow.com/a/26944812 | <p>You can see a short definition in "<a href="http://karma-runner.github.io/6.3/dev/git-commit-msg.html" rel="noreferrer">Git Commit Msg</a>":</p>
<blockquote>
<p><strong><code>chore</code></strong>: updating grunt tasks etc; no production code change</p>
</blockquote>
<p>It is used in:</p>
<ul>
<li><p>"... | <p>You can see a short definition in "<a href="http://karma-runner.github.io/6.3/dev/git-commit-msg.html" rel="noreferrer">Git Commit Msg</a>":</p> <blockquote> <p><strong><code>chore</code></strong>: updating grunt tasks etc; no production code change</p> </blockquote> <p>It is used in:</p> <ul> <li><p>"... | 119, 456, 3809, 90096, 143939 | commit-message, conventional-commits, git, karma-runner, version-control | <h1>When to use "chore" as type of commit message?</h1>
<p>What is the use of <code>chore</code> in <a href="http://seesparkbox.com/foundry/semantic_commit_messages" rel="noreferrer">semantic version control commit messages</a>? Other types like <strong>feat</strong> or <strong>fix</strong> are clear, but I don't know ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,409 | git | # When to use "chore" as type of commit message?
What is the use of `chore` in [semantic version control commit messages](http://seesparkbox.com/foundry/semantic_commit_messages)? Other types like **feat** or **fix** are clear, but I don't know when to use "chore".
Can anyone provide a couple of examples of its use?
... | You can see a short definition in "[Git Commit Msg](http://karma-runner.github.io/6.3/dev/git-commit-msg.html)":
> **`chore`**: updating grunt tasks etc; no production code change
It is used in:
- "[Semantic Commit Messages](http://seesparkbox.com/foundry/semantic_commit_messages)" and in
- the project "[`fteem/git-... |
888414 | git-checkout older revision of a file under a new name | 358 | 2009-05-20 14:52:07 | <p>I have the file "<code>main.cpp</code>" open in my editor.</p>
<p>I want to see the previous revision of "<code>main.cpp</code>" in the editor too.</p>
<p>The way I do it now is like this.</p>
<pre><code>close "main.cpp" in the editor
prompt> mv main.cpp tmp
prompt> git checkout HEAD^ main.cpp
prompt> m... | 82,777 | 78,336 | 2022-12-21 21:36:52 | 888,623 | 436 | 2009-05-20 15:27:10 | 46,058 | 2021-02-12 04:34:12 | https://stackoverflow.com/q/888414 | https://stackoverflow.com/a/888623 |
<p>You can use <code>git show</code> for that:</p>
<pre class="lang-bash prettyprint-override"><code>git show HEAD^:main.cpp > old_main.cpp
</code></pre>
<p>(Note that there is colon [<code>:</code>] character between <code>HEAD^</code> and <code>main.cpp</code>.) The <code><revision>:<path></code> syn... | <p>You can use <code>git show</code> for that:</p> <pre class="lang-bash prettyprint-override"><code>git show HEAD^:main.cpp > old_main.cpp </code></pre> <p>(Note that there is colon [<code>:</code>] character between <code>HEAD^</code> and <code>main.cpp</code>.) The <code><revision>:<path></code> syn... | 119 | git | <h1>git-checkout older revision of a file under a new name</h1>
<p>I have the file "<code>main.cpp</code>" open in my editor.</p>
<p>I want to see the previous revision of "<code>main.cpp</code>" in the editor too.</p>
<p>The way I do it now is like this.</p>
<pre><code>close "main.cpp" in the editor
prompt> mv ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,410 | git | # git-checkout older revision of a file under a new name
I have the file "`main.cpp`" open in my editor.
I want to see the previous revision of "`main.cpp`" in the editor too.
The way I do it now is like this.
```
close "main.cpp" in the editor
prompt> mv main.cpp tmp
prompt> git checkout HEAD^ main.cpp
prompt> mv... | You can use `git show` for that:
```
git show HEAD^:main.cpp > old_main.cpp
```
(Note that there is colon [`:`] character between `HEAD^` and `main.cpp`.) The `<revision>:<path>` syntax is described in [git rev-parse](http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html "git-rev-parse(1) Manual Page") m... |
10603671 | How to add a local repo and treat it as a remote repo | 375 | 2012-05-15 15:08:36 | <p>I'm trying to make a local repo act as a remote with the name <code>bak</code> for another local repo on my PC, using the following:</p>
<pre><code>git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak
</code></pre>
<p>which gives this error:</p>
<pre><code>fatal: '/home/sas/dev/apps/smx/repo/bak/o... | 301,967 | 47,633 | 2024-05-05 15:26:48 | 10,603,750 | 435 | 2012-05-15 15:13:54 | 147,356 | 2014-11-26 22:20:45 | https://stackoverflow.com/q/10603671 | https://stackoverflow.com/a/10603750 | <p>You have your arguments to the <code>remote add</code> command reversed:</p>
<pre><code>git remote add <NAME> <PATH>
</code></pre>
<p>So:</p>
<pre><code>git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git
</code></pre>
<p>See <code>git remote --help</code> for more information.</p... | <p>You have your arguments to the <code>remote add</code> command reversed:</p> <pre><code>git remote add <NAME> <PATH> </code></pre> <p>So:</p> <pre><code>git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git </code></pre> <p>See <code>git remote --help</code> for more information.</p... | 119, 41346 | git, git-remote | <h1>How to add a local repo and treat it as a remote repo</h1>
<p>I'm trying to make a local repo act as a remote with the name <code>bak</code> for another local repo on my PC, using the following:</p>
<pre><code>git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak
</code></pre>
<p>which gives this ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,412 | git | # How to add a local repo and treat it as a remote repo
I'm trying to make a local repo act as a remote with the name `bak` for another local repo on my PC, using the following:
```
git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak
```
which gives this error:
```
fatal: '/home/sas/dev/apps/smx... | You have your arguments to the `remote add` command reversed:
```
git remote add <NAME> <PATH>
```
So:
```
git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git
```
See `git remote --help` for more information. |
4940054 | How can I switch my git repository to a particular commit | 376 | 2011-02-09 00:12:47 | <p>In my git repository, I made 5 commits, like below in my git log:</p>
<pre><code>commit 4f8b120cdafecc5144d7cdae472c36ec80315fdc
Author: Michael
Date: Fri Feb 4 15:26:38 2011 -0800
commit b688d46f55db1bc304f7f689a065331fc1715079
Author: Michael
Date: Mon Jan 31 10:37:42 2011 -0800
commit b364f9dcec3b0d52666c... | 669,230 | 286,802 | 2022-06-12 03:24:53 | 4,940,090 | 434 | 2011-02-09 00:17:12 | 127,724 | 2016-02-12 06:04:40 | https://stackoverflow.com/q/4940054 | https://stackoverflow.com/a/4940090 | <p>To create a new branch (locally):</p>
<ul>
<li><p>With the commit hash (or part of it)</p>
<pre><code>git checkout -b new_branch 6e559cb
</code></pre></li>
<li><p>or to go back 4 commits from HEAD</p>
<pre><code>git checkout -b new_branch HEAD~4
</code></pre></li>
</ul>
<p>Once your new branch is created (locall... | <p>To create a new branch (locally):</p> <ul> <li><p>With the commit hash (or part of it)</p> <pre><code>git checkout -b new_branch 6e559cb </code></pre></li> <li><p>or to go back 4 commits from HEAD</p> <pre><code>git checkout -b new_branch HEAD~4 </code></pre></li> </ul> <p>Once your new branch is created (locall... | 119 | git | <h1>How can I switch my git repository to a particular commit</h1>
<p>In my git repository, I made 5 commits, like below in my git log:</p>
<pre><code>commit 4f8b120cdafecc5144d7cdae472c36ec80315fdc
Author: Michael
Date: Fri Feb 4 15:26:38 2011 -0800
commit b688d46f55db1bc304f7f689a065331fc1715079
Author: Michael
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,413 | git | # How can I switch my git repository to a particular commit
In my git repository, I made 5 commits, like below in my git log:
```
commit 4f8b120cdafecc5144d7cdae472c36ec80315fdc
Author: Michael
Date: Fri Feb 4 15:26:38 2011 -0800
commit b688d46f55db1bc304f7f689a065331fc1715079
Author: Michael
Date: Mon Jan 31 1... | To create a new branch (locally):
- With the commit hash (or part of it)
```
git checkout -b new_branch 6e559cb
```
- or to go back 4 commits from HEAD
```
git checkout -b new_branch HEAD~4
```
Once your new branch is created (locally), you might want to replicate this change on a remote of the same nam... |
4611512 | Is there a way to make git pull automatically update submodules? | 350 | 2011-01-06 03:39:54 | <p>Is there a way to automatically have <code>git submodule update</code> (or preferably <code>git submodule update --init</code> called whenever <code>git pull</code> is done?</p>
<p>Looking for a git config setting, or a git alias to help with this.</p>
| 151,405 | 137,067 | 2022-05-22 16:11:41 | 49,427,199 | 434 | 2018-03-22 11:12:28 | 2,508,253 | 2020-05-13 08:13:46 | https://stackoverflow.com/q/4611512 | https://stackoverflow.com/a/49427199 | <p>As of <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt#L117" rel="noreferrer">Git 2.14</a>, you can use <code>git pull --recurse-submodules</code> (and alias it to whatever you like).</p>
<p>As of <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.15.0.txt#L358... | <p>As of <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt#L117" rel="noreferrer">Git 2.14</a>, you can use <code>git pull --recurse-submodules</code> (and alias it to whatever you like).</p> <p>As of <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.15.0.txt#L358... | 119, 41612 | git, git-submodules | <h1>Is there a way to make git pull automatically update submodules?</h1>
<p>Is there a way to automatically have <code>git submodule update</code> (or preferably <code>git submodule update --init</code> called whenever <code>git pull</code> is done?</p>
<p>Looking for a git config setting, or a git alias to help with... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,414 | git | # Is there a way to make git pull automatically update submodules?
Is there a way to automatically have `git submodule update` (or preferably `git submodule update --init` called whenever `git pull` is done?
Looking for a git config setting, or a git alias to help with this. | As of [Git 2.14](https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt#L117), you can use `git pull --recurse-submodules` (and alias it to whatever you like).
As of [Git 2.15](https://github.com/git/git/blob/master/Documentation/RelNotes/2.15.0.txt#L358), you could set [`submodule.recurse`](https://... |
8795097 | How to 'git commit' a single file/directory | 278 | 2012-01-09 20:56:27 | <p>I tried the following command:</p>
<pre><code>git commit path/to/my/file.ext -m 'my notes'
</code></pre>
<p>And received an error in Git version 1.5.2.1:</p>
<pre><code>error: pathspec '-m' did not match any file(s) known to git.
error: pathspec 'MY MESSAGE' did not match any file(s) known to git.
</code></pre>
<p>I... | 484,582 | 286,973 | 2022-05-28 10:23:15 | 8,795,129 | 434 | 2012-01-09 20:58:43 | 582 | 2021-04-13 06:00:56 | https://stackoverflow.com/q/8795097 | https://stackoverflow.com/a/8795129 | <p>Your arguments are in the wrong order. Try <code>git commit -m 'my notes' path/to/my/file.ext</code>, or if you want to be more explicit, <code>git commit -m 'my notes' -- path/to/my/file.ext</code>.</p>
<p>Incidentally, Git v1.5.2.1 is 4.5 years old. You may want to update to a newer version (1.7.8.3 is the current... | <p>Your arguments are in the wrong order. Try <code>git commit -m 'my notes' path/to/my/file.ext</code>, or if you want to be more explicit, <code>git commit -m 'my notes' -- path/to/my/file.ext</code>.</p> <p>Incidentally, Git v1.5.2.1 is 4.5 years old. You may want to update to a newer version (1.7.8.3 is the current... | 119, 53850 | git, git-commit | <h1>How to 'git commit' a single file/directory</h1>
<p>I tried the following command:</p>
<pre><code>git commit path/to/my/file.ext -m 'my notes'
</code></pre>
<p>And received an error in Git version 1.5.2.1:</p>
<pre><code>error: pathspec '-m' did not match any file(s) known to git.
error: pathspec 'MY MESSAGE' did n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,416 | git | # How to 'git commit' a single file/directory
I tried the following command:
```
git commit path/to/my/file.ext -m 'my notes'
```
And received an error in Git version 1.5.2.1:
```
error: pathspec '-m' did not match any file(s) known to git.
error: pathspec 'MY MESSAGE' did not match any file(s) known to git.
```
I... | Your arguments are in the wrong order. Try `git commit -m 'my notes' path/to/my/file.ext`, or if you want to be more explicit, `git commit -m 'my notes' -- path/to/my/file.ext`.
Incidentally, Git v1.5.2.1 is 4.5 years old. You may want to update to a newer version (1.7.8.3 is the current release). |
3814926 | How to see the date of a commit? | 297 | 2010-09-28 16:24:47 | <p>Other than parsing git log for the date string, is there a Git native way to report the date of a certain commit?</p>
| 205,295 | 171,428 | 2025-09-11 08:44:56 | 3,815,007 | 433 | 2010-09-28 16:36:13 | 63,147 | 2023-09-28 09:56:20 | https://stackoverflow.com/q/3814926 | https://stackoverflow.com/a/3815007 | <p>The
show
command may be what you want. Try</p>
<pre><code>git show --no-patch --format=%ci <commit>
</code></pre>
<p>Other formats for the date string are available as well. Check the <a href="http://schacon.github.io/git/git-show" rel="noreferrer">manual page</a> for
details.</p>
| <p>The show command may be what you want. Try</p> <pre><code>git show --no-patch --format=%ci <commit> </code></pre> <p>Other formats for the date string are available as well. Check the <a href="http://schacon.github.io/git/git-show" rel="noreferrer">manual page</a> for details.</p> | 119 | git | <h1>How to see the date of a commit?</h1>
<p>Other than parsing git log for the date string, is there a Git native way to report the date of a certain commit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,418 | git | # How to see the date of a commit?
Other than parsing git log for the date string, is there a Git native way to report the date of a certain commit? | The
show
command may be what you want. Try
```
git show --no-patch --format=%ci <commit>
```
Other formats for the date string are available as well. Check the [manual page](http://schacon.github.io/git/git-show) for
details. |
1519006 | How do I create a remote Git branch? | 3,745 | 2009-10-05 09:21:04 | <p>I created a local branch. How do I push it to the remote server?</p>
| 3,095,059 | 109,305 | 2025-10-12 17:23:23 | 27,185,855 | 430 | 2014-11-28 09:46:01 | 109,305 | 2020-10-08 13:43:31 | https://stackoverflow.com/q/1519006 | https://stackoverflow.com/a/27185855 | <h2>Simple Git 2.0+ solution:</h2>
<p>As of <strong>Git 2.0, the behavior has become simpler</strong>:</p>
<p>You can configure git with <strong><code>push.default = current</code></strong> to make life easier:</p>
<p>I added this so now I can just push a new branch upstream with</p>
<pre><code>$ git push -u
</code></p... | <h2>Simple Git 2.0+ solution:</h2> <p>As of <strong>Git 2.0, the behavior has become simpler</strong>:</p> <p>You can configure git with <strong><code>push.default = current</code></strong> to make life easier:</p> <p>I added this so now I can just push a new branch upstream with</p> <pre><code>$ git push -u </code></p... | 119, 1879, 76220 | branch, git, git-branch | <h1>How do I create a remote Git branch?</h1>
<p>I created a local branch. How do I push it to the remote server?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,419 | git | # How do I create a remote Git branch?
I created a local branch. How do I push it to the remote server? | ## Simple Git 2.0+ solution:
As of **Git 2.0, the behavior has become simpler**:
You can configure git with **`push.default = current`** to make life easier:
I added this so now I can just push a new branch upstream with
```
$ git push -u
```
`-u` will track remote branch of the same name. Now with this configurat... |
4323440 | How do I stop a Git commit when VI is on the screen waiting for a commit message? | 274 | 2010-12-01 10:38:01 | <p>I have asked Git to perform a commit from within git bash, It has brought up VI as it always does.</p>
<p>I now wish to cancel the commit, how do I prevent proceeding with the commit from this point?</p>
| 92,170 | 38,522 | 2022-09-02 07:39:48 | 4,323,790 | 430 | 2010-12-01 11:21:33 | 244,297 | 2015-05-11 13:15:15 | https://stackoverflow.com/q/4323440 | https://stackoverflow.com/a/4323790 | <p>You have two options:</p>
<ul>
<li><p>Provide an empty commit message. If it's a new commit and you haven't yet saved the message, you can simply use <code>:q!</code> (quit without saving). If you’ve already saved (or you're amending a previous commit), just delete the entire log message and save again. This can be... | <p>You have two options:</p> <ul> <li><p>Provide an empty commit message. If it's a new commit and you haven't yet saved the message, you can simply use <code>:q!</code> (quit without saving). If you’ve already saved (or you're amending a previous commit), just delete the entire log message and save again. This can be... | 119 | git | <h1>How do I stop a Git commit when VI is on the screen waiting for a commit message?</h1>
<p>I have asked Git to perform a commit from within git bash, It has brought up VI as it always does.</p>
<p>I now wish to cancel the commit, how do I prevent proceeding with the commit from this point?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,421 | git | # How do I stop a Git commit when VI is on the screen waiting for a commit message?
I have asked Git to perform a commit from within git bash, It has brought up VI as it always does.
I now wish to cancel the commit, how do I prevent proceeding with the commit from this point? | You have two options:
- Provide an empty commit message. If it's a new commit and you haven't yet saved the message, you can simply use `:q!` (quit without saving). If you’ve already saved (or you're amending a previous commit), just delete the entire log message and save again. This can be done with `ggdG` + `:wq` in... |
10260311 | git how to disable push | 209 | 2012-04-21 15:27:26 | <p>I am using git and I am doing my development work, which I don't want to push, even by mistake. Is there a method to disable push in certain local repository. One method is to rename the branch, another is to <a href="https://stackoverflow.com/questions/1270514/undoing-a-git-push">undo push</a> if one does it by mis... | 109,201 | 984,260 | 2015-08-10 13:32:57 | 10,260,389 | 430 | 2012-04-21 15:35:21 | 477,878 | 2015-08-10 13:32:57 | https://stackoverflow.com/q/10260311 | https://stackoverflow.com/a/10260389 | <p>The following command will let pulls work, but pushes will try to use the URL <code>no_push</code> and fail:</p>
<pre><code>git remote set-url --push origin no_push
</code></pre>
| <p>The following command will let pulls work, but pushes will try to use the URL <code>no_push</code> and fail:</p> <pre><code>git remote set-url --push origin no_push </code></pre> | 119, 4236 | git, push | <h1>git how to disable push</h1>
<p>I am using git and I am doing my development work, which I don't want to push, even by mistake. Is there a method to disable push in certain local repository. One method is to rename the branch, another is to <a href="https://stackoverflow.com/questions/1270514/undoing-a-git-push">un... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,422 | git | # git how to disable push
I am using git and I am doing my development work, which I don't want to push, even by mistake. Is there a method to disable push in certain local repository. One method is to rename the branch, another is to [undo push](https://stackoverflow.com/questions/1270514/undoing-a-git-push) if one d... | The following command will let pulls work, but pushes will try to use the URL `no_push` and fail:
```
git remote set-url --push origin no_push
``` |
2919878 | Git, rewrite previous commit usernames and emails | 378 | 2010-05-27 09:22:53 | <p>I've committed a bunch of commits to a project on Github, however I realized I hadn't set up the proper email and committer full name on the computer I'm currently using to make my commits and therefore the users avatar and email address are not there.</p>
<p>How can I rewrite all past commit email and usernames?</... | 166,754 | 103,739 | 2024-09-30 21:28:12 | 11,768,843 | 429 | 2012-08-01 23:06:00 | 670,229 | 2020-07-25 11:37:25 | https://stackoverflow.com/q/2919878 | https://stackoverflow.com/a/11768843 | <p>You can add this alias:</p>
<pre><code>git config --global alias.change-commits '!'"f() { VAR=\$1; OLD=\$2; NEW=\$3; shift 3; git filter-branch --env-filter \"if [[ \\\"\$\`echo \$VAR\`\\\" = '\$OLD' ]]; then export \$VAR='\$NEW'; fi\" \$@; }; f"
</code></pre>
<p>To change the author na... | <p>You can add this alias:</p> <pre><code>git config --global alias.change-commits '!'"f() { VAR=\$1; OLD=\$2; NEW=\$3; shift 3; git filter-branch --env-filter \"if [[ \\\"\$\`echo \$VAR\`\\\" = '\$OLD' ]]; then export \$VAR='\$NEW'; fi\" \$@; }; f" </code></pre> <p>To change the author na... | 119 | git | <h1>Git, rewrite previous commit usernames and emails</h1>
<p>I've committed a bunch of commits to a project on Github, however I realized I hadn't set up the proper email and committer full name on the computer I'm currently using to make my commits and therefore the users avatar and email address are not there.</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,424 | git | # Git, rewrite previous commit usernames and emails
I've committed a bunch of commits to a project on Github, however I realized I hadn't set up the proper email and committer full name on the computer I'm currently using to make my commits and therefore the users avatar and email address are not there.
How can I rew... | You can add this alias:
```
git config --global alias.change-commits '!'"f() { VAR=\$1; OLD=\$2; NEW=\$3; shift 3; git filter-branch --env-filter \"if [[ \\\"\$\`echo \$VAR\`\\\" = '\$OLD' ]]; then export \$VAR='\$NEW'; fi\" \$@; }; f"
```
To change the author name:
```
git change-commits GIT_AUTHOR_NAME "old name" ... |
3965676 | Why did my Git repo enter a detached HEAD state? | 504 | 2010-10-19 05:54:02 | <p>I ended up with a detached head today, the same problem as described in: <a href="https://stackoverflow.com/questions/999907/git-push-says-everything-up-to-date-even-though-i-have-local-changes">git push says everything up-to-date even though I have local changes</a></p>
<p>As far as I know I didn't do anything out... | 413,009 | 182,603 | 2025-05-13 15:47:52 | 3,965,714 | 426 | 2010-10-19 06:04:46 | 6,309 | 2025-05-13 15:47:52 | https://stackoverflow.com/q/3965676 | https://stackoverflow.com/a/3965714 | <p>Any checkout of a commit that is not the name of one of <em>your</em> branches will get you a detached HEAD. A SHA1 which represents the tip of a branch still gives a detached HEAD. Only a checkout of a local branch <em>name</em> avoids that mode.</p>
<p>See <a href="http://marklodato.github.com/visual-git-guide/ind... | <p>Any checkout of a commit that is not the name of one of <em>your</em> branches will get you a detached HEAD. A SHA1 which represents the tip of a branch still gives a detached HEAD. Only a checkout of a local branch <em>name</em> avoids that mode.</p> <p>See <a href="http://marklodato.github.com/visual-git-guide/ind... | 119 | git | <h1>Why did my Git repo enter a detached HEAD state?</h1>
<p>I ended up with a detached head today, the same problem as described in: <a href="https://stackoverflow.com/questions/999907/git-push-says-everything-up-to-date-even-though-i-have-local-changes">git push says everything up-to-date even though I have local cha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,426 | git | # Why did my Git repo enter a detached HEAD state?
I ended up with a detached head today, the same problem as described in: [git push says everything up-to-date even though I have local changes](https://stackoverflow.com/questions/999907/git-push-says-everything-up-to-date-even-though-i-have-local-changes)
As far as ... | Any checkout of a commit that is not the name of one of *your* branches will get you a detached HEAD. A SHA1 which represents the tip of a branch still gives a detached HEAD. Only a checkout of a local branch *name* avoids that mode.
See [committing with a detached HEAD](http://marklodato.github.com/visual-git-guide/i... |
21839651 | What is the difference between push.default "matching" and "simple" | 343 | 2014-02-17 21:30:50 | <p>I have been using Git for a while now, but I have never had to set up a new remote repo myself, and I have been curious to do so. I have been reading tutorials and I am confused on how to get <code>git push</code> to work.</p>
<p>If I simply use <code>git push</code>, it asks me to see up a "default branch"... | 150,985 | 2,697,957 | 2024-09-03 17:06:47 | 21,865,319 | 425 | 2014-02-18 21:06:32 | 3,036,415 | 2023-03-26 13:04:20 | https://stackoverflow.com/q/21839651 | https://stackoverflow.com/a/21865319 | <p><code>git push</code> can push all branches or a single one dependent on this configuration:</p>
<p><strong>Push all branches</strong></p>
<pre><code>git config --global push.default matching
</code></pre>
<p>It will push all the branches to the remote branch and would merge them.
If you don't want to push all branc... | <p><code>git push</code> can push all branches or a single one dependent on this configuration:</p> <p><strong>Push all branches</strong></p> <pre><code>git config --global push.default matching </code></pre> <p>It will push all the branches to the remote branch and would merge them. If you don't want to push all branc... | 119, 28898, 32868, 41346 | git, git-config, git-push, git-remote | <h1>What is the difference between push.default "matching" and "simple"</h1>
<p>I have been using Git for a while now, but I have never had to set up a new remote repo myself, and I have been curious to do so. I have been reading tutorials and I am confused on how to get <code>git push</code> to work.</p>
<p>If I simpl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,427 | git | # What is the difference between push.default "matching" and "simple"
I have been using Git for a while now, but I have never had to set up a new remote repo myself, and I have been curious to do so. I have been reading tutorials and I am confused on how to get `git push` to work.
If I simply use `git push`, it asks ... | `git push` can push all branches or a single one dependent on this configuration:
**Push all branches**
```
git config --global push.default matching
```
It will push all the branches to the remote branch and would merge them.
If you don't want to push all branches, you can push the current branch if you fully speci... |
820178 | How do you push just a single Git branch (and no other branches)? | 290 | 2009-05-04 13:49:33 | <p>I am working on a local git repository. There are two branches, <code>master</code> and <code>feature_x</code>.</p>
<p>I want to push <code>feature_x</code> to the remote repo, but I do not want to push the changes on the <code>master</code> branch.</p>
<p>Will a <code>git push origin feature_x</code> from my <cod... | 365,061 | 50,227 | 2024-02-07 10:12:51 | 820,217 | 425 | 2009-05-04 13:57:28 | 96,740 | 2009-05-04 13:57:28 | https://stackoverflow.com/q/820178 | https://stackoverflow.com/a/820217 | <p>yes, just do the following</p>
<pre><code>git checkout feature_x
git push origin feature_x
</code></pre>
| <p>yes, just do the following</p> <pre><code>git checkout feature_x git push origin feature_x </code></pre> | 119, 28898 | git, git-push | <h1>How do you push just a single Git branch (and no other branches)?</h1>
<p>I am working on a local git repository. There are two branches, <code>master</code> and <code>feature_x</code>.</p>
<p>I want to push <code>feature_x</code> to the remote repo, but I do not want to push the changes on the <code>master</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,428 | git | # How do you push just a single Git branch (and no other branches)?
I am working on a local git repository. There are two branches, `master` and `feature_x`.
I want to push `feature_x` to the remote repo, but I do not want to push the changes on the `master` branch.
Will a `git push origin feature_x` from my `featur... | yes, just do the following
```
git checkout feature_x
git push origin feature_x
``` |
69875520 | Git error no matching host key type found. Their offer: ssh-rsa | 239 | 2021-11-07 18:45:12 | <p>I get the following error when using <code>git</code>:</p>
<pre class="lang-none prettyprint-override"><code>$ git pull
Unable to negotiate with 172.16.42.42 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access righ... | 490,242 | 7,122,272 | 2024-09-04 02:10:33 | 69,875,803 | 425 | 2021-11-07 19:21:13 | 8,705,432 | 2021-11-07 19:21:13 | https://stackoverflow.com/q/69875520 | https://stackoverflow.com/a/69875803 | <p>With SSH, there are several different types of keys and RSA keys (the <code>ssh-rsa</code>) kind can support multiple kinds of signatures. The signature type <code>ssh-rsa</code> refers to RSA with SHA-1, whereas the signature type <code>rsa-sha2-256</code> is RSA with SHA-256 and <code>rsa-sha2-512</code> is RSA w... | <p>With SSH, there are several different types of keys and RSA keys (the <code>ssh-rsa</code>) kind can support multiple kinds of signatures. The signature type <code>ssh-rsa</code> refers to RSA with SHA-1, whereas the signature type <code>rsa-sha2-256</code> is RSA with SHA-256 and <code>rsa-sha2-512</code> is RSA w... | 119, 386, 4065, 25308 | git, rsa, ssh, ssh-keys | <h1>Git error no matching host key type found. Their offer: ssh-rsa</h1>
<p>I get the following error when using <code>git</code>:</p>
<pre class="lang-none prettyprint-override"><code>$ git pull
Unable to negotiate with 172.16.42.42 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,429 | git | # Git error no matching host key type found. Their offer: ssh-rsa
I get the following error when using `git`:
```
$ git pull
Unable to negotiate with 172.16.42.42 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access ... | With SSH, there are several different types of keys and RSA keys (the `ssh-rsa`) kind can support multiple kinds of signatures. The signature type `ssh-rsa` refers to RSA with SHA-1, whereas the signature type `rsa-sha2-256` is RSA with SHA-256 and `rsa-sha2-512` is RSA with SHA-512.
In the case of Azure DevOps, it on... |
21680573 | Cocoapods setup stuck on pod setup command on terminal | 136 | 2014-02-10 15:02:26 | <pre><code>MacBook-Pro:~ skbc$ pod setup --verbose
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Setting up CocoaPods master repo
Cloning spec repo `master` from `https://github.com... | 96,605 | 871,340 | 2022-12-26 02:24:10 | 21,916,507 | 424 | 2014-02-20 18:30:13 | 1,523,444 | 2022-12-26 02:24:10 | https://stackoverflow.com/q/21680573 | https://stackoverflow.com/a/21916507 | <p>It is not stuck. I thought the same until I went to the "Activity Monitor" of the system and checked the "Network" tab.</p>
<p>Then you will see that something is being downloaded. A process called <code>git-remote-http</code> is in charge of this.</p>
<p><a href="https://i.sstatic.net/KY7up.png"... | <p>It is not stuck. I thought the same until I went to the "Activity Monitor" of the system and checked the "Network" tab.</p> <p>Then you will see that something is being downloaded. A process called <code>git-remote-http</code> is in charge of this.</p> <p><a href="https://i.sstatic.net/KY7up.png"... | 119, 58338, 77741, 92815 | cocoapods, git, ios, xcode5 | <h1>Cocoapods setup stuck on pod setup command on terminal</h1>
<pre><code>MacBook-Pro:~ skbc$ pod setup --verbose
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Setting up CocoaPods ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,430 | git | # Cocoapods setup stuck on pod setup command on terminal
```
MacBook-Pro:~ skbc$ pod setup --verbose
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Setting up CocoaPods master repo
... | It is not stuck. I thought the same until I went to the "Activity Monitor" of the system and checked the "Network" tab.
Then you will see that something is being downloaded. A process called `git-remote-http` is in charge of this.
[](https://i.sstatic.net/KY7up.png)
Ju... |
3651860 | Which characters are illegal within a branch name? | 372 | 2010-09-06 13:33:16 | <p>Which characters are illegal within a branch name?</p>
| 161,473 | 76,413 | 2022-11-23 17:25:45 | 3,651,867 | 423 | 2010-09-06 13:34:13 | 140,185 | 2021-02-28 02:22:19 | https://stackoverflow.com/q/3651860 | https://stackoverflow.com/a/3651867 | <p>Naming rules for refname:</p>
<blockquote>
<p>Git imposes the following rules on how references are named:</p>
<ol>
<li><p>They can include slash <code>/</code> for hierarchical (directory) grouping, but no slash-separated component can begin with a dot <code>.</code> or end with the sequence <code>.lock</code>.</p>... | <p>Naming rules for refname:</p> <blockquote> <p>Git imposes the following rules on how references are named:</p> <ol> <li><p>They can include slash <code>/</code> for hierarchical (directory) grouping, but no slash-separated component can begin with a dot <code>.</code> or end with the sequence <code>.lock</code>.</p>... | 119, 1879, 2062 | branch, git, naming | <h1>Which characters are illegal within a branch name?</h1>
<p>Which characters are illegal within a branch name?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,431 | git | # Which characters are illegal within a branch name?
Which characters are illegal within a branch name? | Naming rules for refname:
> Git imposes the following rules on how references are named:
>
> 1. They can include slash `/` for hierarchical (directory) grouping, but no slash-separated component can begin with a dot `.` or end with the sequence `.lock`.
> 2. They must contain at least one `/`. This enforces the presen... |
4770177 | git apply fails with "patch does not apply" error | 573 | 2011-01-22 19:54:26 | <p>I have a certain patch called my_pcc_branch.patch.</p>
<p>When I try to apply it, I get following message:</p>
<pre><code>$ git apply --check my_pcc_branch.patch
warning: src/main/java/.../AbstractedPanel.java has type 100644, expected 100755
error: patch failed: src/main/java/.../AbstractedPanel.java:13
error: sr... | 568,206 | 399,457 | 2024-07-02 10:20:42 | 4,832,785 | 422 | 2011-01-28 20:32:49 | 399,457 | 2011-01-28 20:32:49 | https://stackoverflow.com/q/4770177 | https://stackoverflow.com/a/4832785 | <p>Johannes Sixt from the msysgit@googlegroups.com mailing list suggested using following command line arguments:</p>
<pre><code>git apply --ignore-space-change --ignore-whitespace mychanges.patch
</code></pre>
<p>This solved my problem.</p>
| <p>Johannes Sixt from the msysgit@googlegroups.com mailing list suggested using following command line arguments:</p> <pre><code>git apply --ignore-space-change --ignore-whitespace mychanges.patch </code></pre> <p>This solved my problem.</p> | 119, 2132, 62078 | git, git-patch, patch | <h1>git apply fails with "patch does not apply" error</h1>
<p>I have a certain patch called my_pcc_branch.patch.</p>
<p>When I try to apply it, I get following message:</p>
<pre><code>$ git apply --check my_pcc_branch.patch
warning: src/main/java/.../AbstractedPanel.java has type 100644, expected 100755
error: patch ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,432 | git | # git apply fails with "patch does not apply" error
I have a certain patch called my_pcc_branch.patch.
When I try to apply it, I get following message:
```
$ git apply --check my_pcc_branch.patch
warning: src/main/java/.../AbstractedPanel.java has type 100644, expected 100755
error: patch failed: src/main/java/.../A... | Johannes Sixt from the msysgit@googlegroups.com mailing list suggested using following command line arguments:
```
git apply --ignore-space-change --ignore-whitespace mychanges.patch
```
This solved my problem. |
16668508 | How do I configure Git to trust certificates from the Windows Certificate Store? | 148 | 2013-05-21 11:07:38 | <p>Currently I have the following entry in my <code>.gitconfig</code> in my user directory.</p>
<pre><code>...
[http]
sslCAInfo=C:\\Users\\julian.lettner\\.ssh\\git-test.pem
...
</code></pre>
<p>This sets the certificate to use when interacting with the git server (required by my company's git server).</p>
<p>Bu... | 304,822 | 271,968 | 2022-08-15 16:04:24 | 48,212,753 | 422 | 2018-01-11 17:26:07 | 729,881 | 2018-11-29 00:23:51 | https://stackoverflow.com/q/16668508 | https://stackoverflow.com/a/48212753 | <p>Beginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer. This means that it will use the Windows certificate storage mechanism and you <em>do not</em> need to explicitly configure the curl CA storage mechanism.</p>
<p>From the Git for Windows 2.14 <a hr... | <p>Beginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer. This means that it will use the Windows certificate storage mechanism and you <em>do not</em> need to explicitly configure the curl CA storage mechanism.</p> <p>From the Git for Windows 2.14 <a hr... | 64, 119, 14423, 17223 | certificate-store, git, ssl-certificate, windows | <h1>How do I configure Git to trust certificates from the Windows Certificate Store?</h1>
<p>Currently I have the following entry in my <code>.gitconfig</code> in my user directory.</p>
<pre><code>...
[http]
sslCAInfo=C:\\Users\\julian.lettner\\.ssh\\git-test.pem
...
</code></pre>
<p>This sets the certificate to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,433 | git | # How do I configure Git to trust certificates from the Windows Certificate Store?
Currently I have the following entry in my `.gitconfig` in my user directory.
```
...
[http]
sslCAInfo=C:\\Users\\julian.lettner\\.ssh\\git-test.pem
...
```
This sets the certificate to use when interacting with the git server (re... | Beginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer. This means that it will use the Windows certificate storage mechanism and you *do not* need to explicitly configure the curl CA storage mechanism.
From the Git for Windows 2.14 [release notes](https:/... |
13965391 | How do I see the commit differences between branches in git? | 544 | 2012-12-20 04:36:25 | <p>I'm on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could just do a </p>
<pre><code>git checkout master
git log
</code></pre>
<p>and then a </p>
<pre><code>git checkout branch-X
git log
</code></pre>... | 396,656 | 155,823 | 2023-02-27 14:02:21 | 13,965,459 | 421 | 2012-12-20 04:43:48 | 665,575 | 2012-12-20 04:46:11 | https://stackoverflow.com/q/13965391 | https://stackoverflow.com/a/13965459 | <p>You can get a really nice, visual output of how your branches differ with this</p>
<pre><code>git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..branch-X
</code></pre>
| <p>You can get a really nice, visual output of how your branches differ with this</p> <pre><code>git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..branch-X </code></pre> | 119, 1879, 47913 | branch, git, git-log | <h1>How do I see the commit differences between branches in git?</h1>
<p>I'm on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could just do a </p>
<pre><code>git checkout master
git log
</code></pre>
<p>a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,434 | git | # How do I see the commit differences between branches in git?
I'm on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could just do a
```
git checkout master
git log
```
and then a
```
git checkout branch... | You can get a really nice, visual output of how your branches differ with this
```
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..branch-X
``` |
255202 | How do I view 'git diff' output with my preferred diff tool/ viewer? | 841 | 2008-10-31 22:55:12 | <p>When I type <code>git diff</code>, I want to view the output with my visual diff tool of choice (SourceGear "diffmerge" on Windows). How do I configure git to do this?</p>
| 555,211 | 3,891 | 2021-07-05 08:03:30 | 255,212 | 420 | 2008-10-31 23:03:43 | 6,309 | 2019-02-17 19:37:13 | https://stackoverflow.com/q/255202 | https://stackoverflow.com/a/255212 | <p>Since Git1.6.3, you can use the <strong>git difftool script</strong>: see <a href="https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-visual-diff-program/949242#949242">my answer below</a>.</p>
<hr>
<p>May be this <a href="https://web.archive.org/web/20170508180316/http://git.net:80/ml/v... | <p>Since Git1.6.3, you can use the <strong>git difftool script</strong>: see <a href="https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-visual-diff-program/949242#949242">my answer below</a>.</p> <hr> <p>May be this <a href="https://web.archive.org/web/20170508180316/http://git.net:80/ml/v... | 119, 606, 14797, 33608, 105625 | diff, diffmerge, difftool, git, git-difftool | <h1>How do I view 'git diff' output with my preferred diff tool/ viewer?</h1>
<p>When I type <code>git diff</code>, I want to view the output with my visual diff tool of choice (SourceGear "diffmerge" on Windows). How do I configure git to do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,435 | git | # How do I view 'git diff' output with my preferred diff tool/ viewer?
When I type `git diff`, I want to view the output with my visual diff tool of choice (SourceGear "diffmerge" on Windows). How do I configure git to do this? | Since Git1.6.3, you can use the **git difftool script**: see [my answer below](https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-visual-diff-program/949242#949242).
---
May be this [article](https://web.archive.org/web/20170508180316/http://git.net:80/ml/version-control.msysgit/2008-06/msg... |
2369426 | How to move certain commits to be based on another branch in git? | 447 | 2010-03-03 07:27:22 | <p>The situation:</p>
<ul>
<li>master is at X</li>
<li>quickfix1 is at X + 2 commits</li>
</ul>
<p>Such that:</p>
<pre><code>o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
</code></pre>
<p>Then I started working on quickfix2, but by accident took quickfix1 as the source branch to copy, not the master. N... | 266,333 | 196,068 | 2019-09-25 02:46:16 | 2,369,516 | 420 | 2010-03-03 07:50:04 | 6,309 | 2018-01-11 16:44:03 | https://stackoverflow.com/q/2369426 | https://stackoverflow.com/a/2369516 | <p>This is a classic case of <strong><a href="https://stackoverflow.com/questions/1994463/how-to-cherry-pick-a-range-of-commits-and-merge-into-another-branch/1994491#1994491"><code>rebase --onto</code></a></strong>:</p>
<pre class="lang-sh prettyprint-override"><code> # let's go to current master (X, where quickfix2 s... | <p>This is a classic case of <strong><a href="https://stackoverflow.com/questions/1994463/how-to-cherry-pick-a-range-of-commits-and-merge-into-another-branch/1994491#1994491"><code>rebase --onto</code></a></strong>:</p> <pre class="lang-sh prettyprint-override"><code> # let's go to current master (X, where quickfix2 s... | 119, 2132, 5597 | commit, git, patch | <h1>How to move certain commits to be based on another branch in git?</h1>
<p>The situation:</p>
<ul>
<li>master is at X</li>
<li>quickfix1 is at X + 2 commits</li>
</ul>
<p>Such that:</p>
<pre><code>o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
</code></pre>
<p>Then I started working on quickfix2, but... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,436 | git | # How to move certain commits to be based on another branch in git?
The situation:
- master is at X
- quickfix1 is at X + 2 commits
Such that:
```
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
```
Then I started working on quickfix2, but by accident took quickfix1 as the source branch to copy, not the... | This is a classic case of **[`rebase --onto`](https://stackoverflow.com/questions/1994463/how-to-cherry-pick-a-range-of-commits-and-merge-into-another-branch/1994491#1994491)**:
```
# let's go to current master (X, where quickfix2 should begin)
git checkout master
# replay every commit *after* quickfix1 up to quic... |
15111420 | How to check if a string contains only digits in Java? | 182 | 2013-02-27 11:51:42 | <p>In Java for String class there is a method called <code>matches</code>. How to use this method to check if my string has only digits using regular expression? I tried with below examples, but both of them returned me false as result:</p>
<pre class="lang-java prettyprint-override"><code>String regex = "[0-9]&qu... | 675,841 | 2,065,083 | 2025-09-08 09:31:22 | 15,111,450 | 420 | 2013-02-27 11:53:19 | 1,993,366 | 2019-08-16 12:48:56 | https://stackoverflow.com/q/15111420 | https://stackoverflow.com/a/15111450 | <p>Try</p>
<pre><code>String regex = "[0-9]+";
</code></pre>
<p>or</p>
<pre><code>String regex = "\\d+";
</code></pre>
<p>As per Java <em>regular expressions</em>, the <code>+</code> means "one or more times" and <code>\d</code> means "a digit".</p>
<p>Note: the "double backslash" is an <em>escape sequence</em> t... | <p>Try</p> <pre><code>String regex = "[0-9]+"; </code></pre> <p>or</p> <pre><code>String regex = "\\d+"; </code></pre> <p>As per Java <em>regular expressions</em>, the <code>+</code> means "one or more times" and <code>\d</code> means "a digit".</p> <p>Note: the "double backslash" is an <em>escape sequence</em> t... | 17, 139, 6067, 9914, 17150 | character, digits, java, string, string-matching | <h1>How to check if a string contains only digits in Java?</h1>
<p>In Java for String class there is a method called <code>matches</code>. How to use this method to check if my string has only digits using regular expression? I tried with below examples, but both of them returned me false as result:</p>
<pre class="lan... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,437 | git | # How to check if a string contains only digits in Java?
In Java for String class there is a method called `matches`. How to use this method to check if my string has only digits using regular expression? I tried with below examples, but both of them returned me false as result:
```
String regex = "[0-9]";
String dat... | Try
```
String regex = "[0-9]+";
```
or
```
String regex = "\\d+";
```
As per Java *regular expressions*, the `+` means "one or more times" and `\d` means "a digit".
Note: the "double backslash" is an *escape sequence* to get a single backslash - therefore, `\\d` in a java String gives you the actual result: `\d`
... |
645450 | Insert a commit before the root commit in Git? | 295 | 2009-03-14 05:31:11 | <p>I've asked before about how to <a href="https://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits">squash the first two commits</a> in a git repository.</p>
<p>While the solutions are rather interesting and not really as mind-warping as some other things in git, they're still a bit of the p... | 78,397 | 13,989 | 2024-09-05 13:59:10 | 647,451 | 419 | 2009-03-15 07:45:24 | 9,410 | 2024-09-05 13:59:10 | https://stackoverflow.com/q/645450 | https://stackoverflow.com/a/647451 | <p>There are 2 steps to achieving this:</p>
<ol>
<li>Create a new empty commit</li>
<li>Rewrite history to start from this empty commit</li>
</ol>
<p>We’ll put the new empty commit on a temporary branch <code>newroot</code> for convenience.</p>
<h1>1. Create a new empty commit</h1>
<p>There is a number of ways you can ... | <p>There are 2 steps to achieving this:</p> <ol> <li>Create a new empty commit</li> <li>Rewrite history to start from this empty commit</li> </ol> <p>We’ll put the new empty commit on a temporary branch <code>newroot</code> for convenience.</p> <h1>1. Create a new empty commit</h1> <p>There is a number of ways you can ... | 119, 456, 8974, 29934 | git, git-rebase, rebase, version-control | <h1>Insert a commit before the root commit in Git?</h1>
<p>I've asked before about how to <a href="https://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits">squash the first two commits</a> in a git repository.</p>
<p>While the solutions are rather interesting and not really as mind-warping a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,438 | git | # Insert a commit before the root commit in Git?
I've asked before about how to [squash the first two commits](https://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits) in a git repository.
While the solutions are rather interesting and not really as mind-warping as some other things in git,... | There are 2 steps to achieving this:
1. Create a new empty commit
2. Rewrite history to start from this empty commit
We’ll put the new empty commit on a temporary branch `newroot` for convenience.
# 1. Create a new empty commit
There is a number of ways you can do this.
### Using just plumbing
The cleanest approa... |
34751837 | Git - Can we recover deleted commits? | 156 | 2016-01-12 19:06:00 | <p>I am surprised, I couldn't find the answer to this on SO.</p>
<blockquote>
<p>Can we recover/restore deleted commits in git?</p>
</blockquote>
<p>For example, this is what I did:</p>
<pre><code># Remove the last commit from my local branch
$ git reset --hard HEAD~1
# Force push the delete
$ git push --force
</... | 153,395 | 1,043,569 | 2016-01-12 19:30:38 | 34,751,908 | 418 | 2016-01-12 19:10:41 | 2,295,034 | 2016-01-12 19:10:41 | https://stackoverflow.com/q/34751837 | https://stackoverflow.com/a/34751908 | <p>To get back to that commit you can use the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a> to look up it's ref.</p>
<blockquote>
<p>Reference logs, or "reflogs", record when the tips of branches and
other references were updated in the local repository.</p>
</blockquote>
<p>Run this c... | <p>To get back to that commit you can use the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a> to look up it's ref.</p> <blockquote> <p>Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository.</p> </blockquote> <p>Run this c... | 119, 5377, 53850 | git, git-commit, restore | <h1>Git - Can we recover deleted commits?</h1>
<p>I am surprised, I couldn't find the answer to this on SO.</p>
<blockquote>
<p>Can we recover/restore deleted commits in git?</p>
</blockquote>
<p>For example, this is what I did:</p>
<pre><code># Remove the last commit from my local branch
$ git reset --hard HEAD~1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,440 | git | # Git - Can we recover deleted commits?
I am surprised, I couldn't find the answer to this on SO.
> Can we recover/restore deleted commits in git?
For example, this is what I did:
```
# Remove the last commit from my local branch
$ git reset --hard HEAD~1
# Force push the delete
$ git push --force
```
Now, is the... | To get back to that commit you can use the [reflog](https://git-scm.com/docs/git-reflog) to look up it's ref.
> Reference logs, or "reflogs", record when the tips of branches and
> other references were updated in the local repository.
Run this command:
```
git reflog
```
Scan the first few entries, and find the co... |
13040958 | Merge two Git repositories without breaking file history | 382 | 2012-10-23 23:41:43 | <p>I need to merge two Git repositories into a brand new, third repository. I've found many descriptions of how to do this using a subtree merge (for example <a href="https://stackoverflow.com/a/1426163">Jakub Narębski's answer</a> on <a href="https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-reposi... | 170,919 | 1,174,561 | 2024-12-19 16:41:20 | 14,470,212 | 416 | 2013-01-22 23:57:18 | 1,174,561 | 2023-11-28 05:01:34 | https://stackoverflow.com/q/13040958 | https://stackoverflow.com/a/14470212 | <p>It turns out that the answer is much simpler if you're simply trying to glue two repositories together and make it look like it was that way all along rather than manage an external dependency. You simply need to add remotes to your old repos, merge them to your new master, move the files and folders to a subdirect... | <p>It turns out that the answer is much simpler if you're simply trying to glue two repositories together and make it look like it was that way all along rather than manage an external dependency. You simply need to add remotes to your old repos, merge them to your new master, move the files and folders to a subdirect... | 119, 68200 | git, git-subtree | <h1>Merge two Git repositories without breaking file history</h1>
<p>I need to merge two Git repositories into a brand new, third repository. I've found many descriptions of how to do this using a subtree merge (for example <a href="https://stackoverflow.com/a/1426163">Jakub Narębski's answer</a> on <a href="https://s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,442 | git | # Merge two Git repositories without breaking file history
I need to merge two Git repositories into a brand new, third repository. I've found many descriptions of how to do this using a subtree merge (for example [Jakub Narębski's answer](https://stackoverflow.com/a/1426163) on [How do you merge two Git repositories?... | It turns out that the answer is much simpler if you're simply trying to glue two repositories together and make it look like it was that way all along rather than manage an external dependency. You simply need to add remotes to your old repos, merge them to your new master, move the files and folders to a subdirectory,... |
17051504 | How do I merge a git tag onto a branch | 269 | 2013-06-11 18:47:02 | <p>I'm trying to find the syntax for merging a tagged commit onto another branch. I guess it's straightforward but my feeble search attempts aren't finding it.</p>
| 308,513 | 2,475,794 | 2023-04-27 19:59:56 | 17,052,417 | 416 | 2013-06-11 19:44:29 | 1,253,222 | 2013-06-11 20:08:17 | https://stackoverflow.com/q/17051504 | https://stackoverflow.com/a/17052417 | <p>You mean this?</p>
<pre><code>git checkout destination_branch
git merge tag_name
</code></pre>
| <p>You mean this?</p> <pre><code>git checkout destination_branch git merge tag_name </code></pre> | 28897, 60718 | git-merge, git-tag | <h1>How do I merge a git tag onto a branch</h1>
<p>I'm trying to find the syntax for merging a tagged commit onto another branch. I guess it's straightforward but my feeble search attempts aren't finding it.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,444 | git | # How do I merge a git tag onto a branch
I'm trying to find the syntax for merging a tagged commit onto another branch. I guess it's straightforward but my feeble search attempts aren't finding it. | You mean this?
```
git checkout destination_branch
git merge tag_name
``` |
27828404 | Why does git status show branch is up-to-date when changes exist upstream? | 368 | 2015-01-07 20:50:10 | <p>Changes exist upstream in a tracked branch, but when I type <code>git status</code> it indicates that my local branch is up-to-date. Is this new behavior, did I change a config setting, or is something wrong?</p>
<pre><code>ubuntu@host:/my/repo# git status
On branch master
Your branch is up-to-date with 'origin/mas... | 273,916 | 592,965 | 2024-09-03 09:46:57 | 27,828,516 | 415 | 2015-01-07 20:57:38 | 981,959 | 2024-07-03 10:19:17 | https://stackoverflow.com/q/27828404 | https://stackoverflow.com/a/27828516 | <p>What the status is telling you is that you're behind the ref called <code>origin/master</code> <em>which is a local ref in your local repo</em>. In this case that ref happens to track a branch in some remote, called <code>origin</code>, but the status is not telling you anything about the branch on the remote. It's ... | <p>What the status is telling you is that you're behind the ref called <code>origin/master</code> <em>which is a local ref in your local repo</em>. In this case that ref happens to track a branch in some remote, called <code>origin</code>, but the status is not telling you anything about the branch on the remote. It's ... | 119 | git | <h1>Why does git status show branch is up-to-date when changes exist upstream?</h1>
<p>Changes exist upstream in a tracked branch, but when I type <code>git status</code> it indicates that my local branch is up-to-date. Is this new behavior, did I change a config setting, or is something wrong?</p>
<pre><code>ubuntu@h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,445 | git | # Why does git status show branch is up-to-date when changes exist upstream?
Changes exist upstream in a tracked branch, but when I type `git status` it indicates that my local branch is up-to-date. Is this new behavior, did I change a config setting, or is something wrong?
```
ubuntu@host:/my/repo# git status
On bra... | What the status is telling you is that you're behind the ref called `origin/master` *which is a local ref in your local repo*. In this case that ref happens to track a branch in some remote, called `origin`, but the status is not telling you anything about the branch on the remote. It's telling you about the ref, which... |
6224626 | Clone contents of a GitHub repository (without the folder itself) | 308 | 2011-06-03 08:16:25 | <p>I'd like to <code>git clone</code> the contents of a repository I have on <a href="http://en.wikipedia.org/wiki/GitHub">GitHub</a>. When I <code>git clone</code> (git@github:me/name.git...) I get a folder called <code>name/</code> and inside name I have my contents... How do I get JUST the contents?</p>
| 194,562 | 763,116 | 2024-05-21 06:05:28 | 6,224,645 | 415 | 2011-06-03 08:18:28 | 223,092 | 2021-04-12 10:24:06 | https://stackoverflow.com/q/6224626 | https://stackoverflow.com/a/6224645 | <p>If the current directory is empty, you can do that with:</p>
<pre><code>git clone git@github.com:me/name.git .
</code></pre>
<p>(Note the <code>.</code> at the end to specify the current directory.) Of course, this also creates the <code>.git</code> directory in your current folder, not just the source code from yo... | <p>If the current directory is empty, you can do that with:</p> <pre><code>git clone git@github.com:me/name.git . </code></pre> <p>(Note the <code>.</code> at the end to specify the current directory.) Of course, this also creates the <code>.git</code> directory in your current folder, not just the source code from yo... | 119 | git | <h1>Clone contents of a GitHub repository (without the folder itself)</h1>
<p>I'd like to <code>git clone</code> the contents of a repository I have on <a href="http://en.wikipedia.org/wiki/GitHub">GitHub</a>. When I <code>git clone</code> (git@github:me/name.git...) I get a folder called <code>name/</code> and inside ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,446 | git | # Clone contents of a GitHub repository (without the folder itself)
I'd like to `git clone` the contents of a repository I have on [GitHub](http://en.wikipedia.org/wiki/GitHub). When I `git clone` (git@github:me/name.git...) I get a folder called `name/` and inside name I have my contents... How do I get JUST the cont... | If the current directory is empty, you can do that with:
```
git clone git@github.com:me/name.git .
```
(Note the `.` at the end to specify the current directory.) Of course, this also creates the `.git` directory in your current folder, not just the source code from your project.
This optional `[directory]` paramet... |
5561295 | What does git push -u mean? | 360 | 2011-04-06 04:01:01 | <p>I have two different versions of git.
In the 1.6.2 version, <code>git push</code> does not have the <code>-u</code> option. It only appears in the 1.7.x version.</p>
<p>From the docs, the <code>-u</code> is related to the variable</p>
<pre><code>branch.<name>.merge
</code></pre>
<p>in <code>git config</code... | 154,723 | 450,278 | 2023-04-26 07:41:43 | 5,561,327 | 414 | 2011-04-06 04:06:12 | 399,815 | 2023-04-26 07:41:43 | https://stackoverflow.com/q/5561295 | https://stackoverflow.com/a/5561327 | <p>"Upstream" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The -u option automatically sets that upstream for you, linking your repo to a central one. That way, in the future, Git "knows" where you want to push to and where you want to pull from, so you... | <p>"Upstream" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The -u option automatically sets that upstream for you, linking your repo to a central one. That way, in the future, Git "knows" where you want to push to and where you want to pull from, so you... | 119 | git | <h1>What does git push -u mean?</h1>
<p>I have two different versions of git.
In the 1.6.2 version, <code>git push</code> does not have the <code>-u</code> option. It only appears in the 1.7.x version.</p>
<p>From the docs, the <code>-u</code> is related to the variable</p>
<pre><code>branch.<name>.merge
</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,447 | git | # What does git push -u mean?
I have two different versions of git.
In the 1.6.2 version, `git push` does not have the `-u` option. It only appears in the 1.7.x version.
From the docs, the `-u` is related to the variable
```
branch.<name>.merge
```
in `git config`. This variable is described below:
```
Defines, to... | "Upstream" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The -u option automatically sets that upstream for you, linking your repo to a central one. That way, in the future, Git "knows" where you want to push to and where you want to pull from, so you can use `git pull` or ... |
3713765 | Viewing all `git diffs` with vimdiff | 259 | 2010-09-14 23:54:53 | <p>I setup <code>git diff</code> to wrap into vimdiff, using "<a href="http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/" rel="noreferrer">Git Diff with Vimdiff</a>" as a guide, and it's working as expected unless there are many files with changes. </p>
<p>When there are multiple files with changes an... | 176,006 | 63,193 | 2021-06-28 16:59:42 | 3,713,865 | 414 | 2010-09-15 00:27:18 | 63,193 | 2020-12-17 20:42:05 | https://stackoverflow.com/q/3713765 | https://stackoverflow.com/a/3713865 | <pre><code>git config --global diff.tool vimdiff
git config --global difftool.prompt false
</code></pre>
<p>Typing <code>git difftool</code> yields the expected behavior.</p>
<h3>Navigation commands,</h3>
<ul>
<li><code>:qa</code> in vim cycles to the next file in the changeset without saving anything.</li>
</ul>
<h3>A... | <pre><code>git config --global diff.tool vimdiff git config --global difftool.prompt false </code></pre> <p>Typing <code>git difftool</code> yields the expected behavior.</p> <h3>Navigation commands,</h3> <ul> <li><code>:qa</code> in vim cycles to the next file in the changeset without saving anything.</li> </ul> <h3>A... | 119, 370, 606, 2605 | diff, git, vim, vimdiff | <h1>Viewing all `git diffs` with vimdiff</h1>
<p>I setup <code>git diff</code> to wrap into vimdiff, using "<a href="http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/" rel="noreferrer">Git Diff with Vimdiff</a>" as a guide, and it's working as expected unless there are many files with changes. </p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,448 | git | # Viewing all `git diffs` with vimdiff
I setup `git diff` to wrap into vimdiff, using "[Git Diff with Vimdiff](http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/)" as a guide, and it's working as expected unless there are many files with changes.
When there are multiple files with changes and I run `g... | ```
git config --global diff.tool vimdiff
git config --global difftool.prompt false
```
Typing `git difftool` yields the expected behavior.
### Navigation commands,
- `:qa` in vim cycles to the next file in the changeset without saving anything.
### Aliasing (example)
```
git config --global alias.d difftool
```
... |
661018 | Pushing an existing Git repository to SVN | 400 | 2009-03-19 04:01:39 | <p>I've been doing all my work in Git and pushing to GitHub. I've been very happy with both the software and the site, and I have no wish to change my working practices at this point.</p>
<p>My PhD adviser is asking all students to keep their work in an SVN repository that's hosted at the university. I've found tons o... | 121,162 | 79,849 | 2022-05-18 17:20:31 | 772,881 | 412 | 2009-04-21 14:36:06 | 18,180 | 2018-10-25 20:43:50 | https://stackoverflow.com/q/661018 | https://stackoverflow.com/a/772881 | <p>I needed this as well, and with the help of Bombe's answer + some fiddling around, I got it working. Here's the recipe:</p>
<h2>Import Git -> Subversion</h2>
<pre><code>1. cd /path/to/git/localrepo
2. svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo"
3. git svn init protocol:///pat... | <p>I needed this as well, and with the help of Bombe's answer + some fiddling around, I got it working. Here's the recipe:</p> <h2>Import Git -> Subversion</h2> <pre><code>1. cd /path/to/git/localrepo 2. svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo" 3. git svn init protocol:///pat... | 63, 119, 6452 | git, git-svn, svn | <h1>Pushing an existing Git repository to SVN</h1>
<p>I've been doing all my work in Git and pushing to GitHub. I've been very happy with both the software and the site, and I have no wish to change my working practices at this point.</p>
<p>My PhD adviser is asking all students to keep their work in an SVN repository... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,449 | git | # Pushing an existing Git repository to SVN
I've been doing all my work in Git and pushing to GitHub. I've been very happy with both the software and the site, and I have no wish to change my working practices at this point.
My PhD adviser is asking all students to keep their work in an SVN repository that's hosted a... | I needed this as well, and with the help of Bombe's answer + some fiddling around, I got it working. Here's the recipe:
## Import Git -> Subversion
```
1. cd /path/to/git/localrepo
2. svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo"
3. git svn init protocol:///path/to/repo/PROJECT -s... |
1811730 | How do I work with a git repository within another repository? | 344 | 2009-11-28 05:57:47 | <p>I have a Git media repository where I'm keeping all of my JavaScript and CSS master files and scripts that I'll use on various projects. </p>
<p>If I create a new project that's in its own Git repository, how do I use JavaScript files from my media repository in my new project in a way that makes it so I don't have... | 179,525 | 176,611 | 2023-08-01 17:25:12 | 1,811,738 | 412 | 2009-11-28 06:04:29 | 64,004 | 2018-05-16 09:39:05 | https://stackoverflow.com/q/1811730 | https://stackoverflow.com/a/1811738 | <p>The key is <strong>git submodules</strong>. </p>
<p>Start reading the Submodules chapter of the <a href="http://git-scm.com/book/en/Git-Tools-Submodules" rel="noreferrer">Git Community Book</a> or of the <a href="http://schacon.github.com/git/user-manual.html#submodules" rel="noreferrer">Users Manual</a></p>
<p>... | <p>The key is <strong>git submodules</strong>. </p> <p>Start reading the Submodules chapter of the <a href="http://git-scm.com/book/en/Git-Tools-Submodules" rel="noreferrer">Git Community Book</a> or of the <a href="http://schacon.github.com/git/user-manual.html#submodules" rel="noreferrer">Users Manual</a></p> <p>... | 119, 29014, 41612 | git, git-submodules, multiple-repositories | <h1>How do I work with a git repository within another repository?</h1>
<p>I have a Git media repository where I'm keeping all of my JavaScript and CSS master files and scripts that I'll use on various projects. </p>
<p>If I create a new project that's in its own Git repository, how do I use JavaScript files from my m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,450 | git | # How do I work with a git repository within another repository?
I have a Git media repository where I'm keeping all of my JavaScript and CSS master files and scripts that I'll use on various projects.
If I create a new project that's in its own Git repository, how do I use JavaScript files from my media repository i... | The key is **git submodules**.
Start reading the Submodules chapter of the [Git Community Book](http://git-scm.com/book/en/Git-Tools-Submodules) or of the [Users Manual](http://schacon.github.com/git/user-manual.html#submodules)
Say you have repository PROJECT1, PROJECT2, and MEDIA...
```
cd /path/to/PROJECT1
git su... |
14593538 | Make Heroku run non-master Git branch | 204 | 2013-01-29 22:51:45 | <p>I have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).</p>
<p>I have already set up my main Heroku remote running my trunk and a Heroku-dev remote on which I wish to run an alternate branch.</p>
<p>M... | 43,296 | 902,907 | 2020-10-26 17:03:40 | 14,593,582 | 411 | 2013-01-29 22:54:52 | 120,615 | 2020-10-26 17:03:40 | https://stackoverflow.com/q/14593538 | https://stackoverflow.com/a/14593582 | <p>You can push an alternative branch to Heroku using Git.</p>
<pre><code>git push heroku-dev test:master
</code></pre>
<p>This pushes your local test branch to the remote's master branch (on Heroku).</p>
<hr />
<p>Comment from @Brian Armstrong:</p>
<p>Worth noting also, when you're ready to go back to master you need ... | <p>You can push an alternative branch to Heroku using Git.</p> <pre><code>git push heroku-dev test:master </code></pre> <p>This pushes your local test branch to the remote's master branch (on Heroku).</p> <hr /> <p>Comment from @Brian Armstrong:</p> <p>Worth noting also, when you're ready to go back to master you need ... | 119, 8279 | git, heroku | <h1>Make Heroku run non-master Git branch</h1>
<p>I have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).</p>
<p>I have already set up my main Heroku remote running my trunk and a Heroku-dev remote on whi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,451 | git | # Make Heroku run non-master Git branch
I have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).
I have already set up my main Heroku remote running my trunk and a Heroku-dev remote on which I wish to run... | You can push an alternative branch to Heroku using Git.
```
git push heroku-dev test:master
```
This pushes your local test branch to the remote's master branch (on Heroku).
---
Comment from @Brian Armstrong:
Worth noting also, when you're ready to go back to master you need to do
```
git push -f heroku master:ma... |
28140434 | Is there a difference between git rebase and git merge --ff-only | 195 | 2015-01-25 19:20:15 | <p>From what I read, both of them help us get a linear history. </p>
<p>From what I experimented, rebase works all the time. But merge --ff-only works only in scenarios where it can be fast forwarded.</p>
<p>I also noticed, git merge creates a merge commit, but if we use --ff-only, it gives a linear history which ess... | 181,664 | 974,680 | 2025-01-02 00:52:28 | 28,142,831 | 411 | 2015-01-25 23:28:45 | 1,256,452 | 2020-10-18 02:58:18 | https://stackoverflow.com/q/28140434 | https://stackoverflow.com/a/28142831 | <p>Note that <code>git rebase</code> has a different <em>job</em> than <code>git merge</code> (with or without <code>--ff-only</code>). What <code>rebase</code> does is to take existing commits and <em>copy</em> them. Suppose, for instance, that you're on <code>branch1</code> and have made two commits <code>A</code> ... | <p>Note that <code>git rebase</code> has a different <em>job</em> than <code>git merge</code> (with or without <code>--ff-only</code>). What <code>rebase</code> does is to take existing commits and <em>copy</em> them. Suppose, for instance, that you're on <code>branch1</code> and have made two commits <code>A</code> ... | 119, 28897, 29934 | git, git-merge, git-rebase | <h1>Is there a difference between git rebase and git merge --ff-only</h1>
<p>From what I read, both of them help us get a linear history. </p>
<p>From what I experimented, rebase works all the time. But merge --ff-only works only in scenarios where it can be fast forwarded.</p>
<p>I also noticed, git merge creates a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 14,452 | git | # Is there a difference between git rebase and git merge --ff-only
From what I read, both of them help us get a linear history.
From what I experimented, rebase works all the time. But merge --ff-only works only in scenarios where it can be fast forwarded.
I also noticed, git merge creates a merge commit, but if we ... | Note that `git rebase` has a different *job* than `git merge` (with or without `--ff-only`). What `rebase` does is to take existing commits and *copy* them. Suppose, for instance, that you're on `branch1` and have made two commits `A` and `B`:
```
...-o--o--A--B <-- HEAD=branch1
\
o--C <-- branch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.