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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
48430710 | How to add multiple lines to git commit messages | 10 | 2018-01-24 20:01:26 | <p>How do I add multi-line messages using</p>
<pre><code>git commit -a -m "..."
</code></pre>
<p>The answer from this similar <a href="https://stackoverflow.com/questions/15075783/add-line-break-to-git-commit-m-from-command-line-on-windows">question</a> appears to work (judging by the upvotes and acceptance), but it ... | 16,709 | 6,073,774 | 2021-10-29 10:28:05 | 48,430,804 | 22 | 2018-01-24 20:09:45 | 7,050,130 | 2018-01-24 20:09:45 | https://stackoverflow.com/q/48430710 | https://stackoverflow.com/a/48430804 | <p>The answer may depend on what shell you use to run git. For example with bash (just tested this on windows using the bash shell installed with git):</p>
<pre><code>git commit -m "this is
a multi-line
message"
</code></pre>
<p>because quite simply bash will not assume that hitting return ends the command if it's i... | <p>The answer may depend on what shell you use to run git. For example with bash (just tested this on windows using the bash shell installed with git):</p> <pre><code>git commit -m "this is a multi-line message" </code></pre> <p>because quite simply bash will not assume that hitting return ends the command if it's i... | 119 | git | <h1>How to add multiple lines to git commit messages</h1>
<p>How do I add multi-line messages using</p>
<pre><code>git commit -a -m "..."
</code></pre>
<p>The answer from this similar <a href="https://stackoverflow.com/questions/15075783/add-line-break-to-git-commit-m-from-command-line-on-windows">question</a> appear... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,231 | git | # How to add multiple lines to git commit messages
How do I add multi-line messages using
```
git commit -a -m "..."
```
The answer from this similar [question](https://stackoverflow.com/questions/15075783/add-line-break-to-git-commit-m-from-command-line-on-windows) appears to work (judging by the upvotes and accept... | The answer may depend on what shell you use to run git. For example with bash (just tested this on windows using the bash shell installed with git):
```
git commit -m "this is
a multi-line
message"
```
because quite simply bash will not assume that hitting return ends the command if it's in the middle of a quoted str... |
44397519 | How to git cherry-pick a commit with binary files | 10 | 2017-06-06 18:40:31 | <p>I am trying to cherry-pick a commit from a different branch that is mostly binary files. It seems it is mostly successful, except for one file where I get the message:</p>
<pre><code>warning: Cannot merge binary files: XXXX.so (HEAD vs. d8ef550... Add support for 32-bit apk)
error: could not apply d8ef550... Add s... | 7,653 | 3,838,233 | 2017-06-06 18:46:07 | 44,397,613 | 22 | 2017-06-06 18:46:07 | 2,876,504 | 2017-06-06 18:46:07 | https://stackoverflow.com/q/44397519 | https://stackoverflow.com/a/44397613 | <p>You can do this with <code>git cherry-pick --strategy=recursive -X theirs {Imported_Commit}</code></p>
<p>(You may need to abort the current cherry-pick first; <code>git cherry-pick --abort</code>)</p>
| <p>You can do this with <code>git cherry-pick --strategy=recursive -X theirs {Imported_Commit}</code></p> <p>(You may need to abort the current cherry-pick first; <code>git cherry-pick --abort</code>)</p> | 119, 36489, 78810 | cherry-pick, git, git-cherry-pick | <h1>How to git cherry-pick a commit with binary files</h1>
<p>I am trying to cherry-pick a commit from a different branch that is mostly binary files. It seems it is mostly successful, except for one file where I get the message:</p>
<pre><code>warning: Cannot merge binary files: XXXX.so (HEAD vs. d8ef550... Add supp... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,232 | git | # How to git cherry-pick a commit with binary files
I am trying to cherry-pick a commit from a different branch that is mostly binary files. It seems it is mostly successful, except for one file where I get the message:
```
warning: Cannot merge binary files: XXXX.so (HEAD vs. d8ef550... Add support for 32-bit apk)
e... | You can do this with `git cherry-pick --strategy=recursive -X theirs {Imported_Commit}`
(You may need to abort the current cherry-pick first; `git cherry-pick --abort`) |
39477305 | How to re-add added files (update staged files only) in git? | 10 | 2016-09-13 19:07:56 | <p>We have modified files in <code>path/to/another/</code> and <code>path/to/main/</code>.<br>
Files in <code>path/to/main/</code> already added into git cache but we have updated <code>path/to/main/Bar.php</code> file <strong>AGAIN</strong>. We now have the following situation:</p>
<pre><code>$ git status
[...]
Chang... | 12,237 | 213,759 | 2022-01-26 14:29:56 | 39,477,454 | 22 | 2016-09-13 19:17:01 | 6,483,847 | 2021-03-17 14:06:27 | https://stackoverflow.com/q/39477305 | https://stackoverflow.com/a/39477454 | <p>This shows list of files that are only staged:</p>
<pre><code>git diff --name-only --cached
</code></pre>
<p>Now stage these files with their new changes(It will work in bash)</p>
<pre><code>git add $(git diff --name-only --cached)
</code></pre>
<p>PS: (precondition) You need to be at the root of your git repo while... | <p>This shows list of files that are only staged:</p> <pre><code>git diff --name-only --cached </code></pre> <p>Now stage these files with their new changes(It will work in bash)</p> <pre><code>git add $(git diff --name-only --cached) </code></pre> <p>PS: (precondition) You need to be at the root of your git repo while... | 119, 34792 | git, git-add | <h1>How to re-add added files (update staged files only) in git?</h1>
<p>We have modified files in <code>path/to/another/</code> and <code>path/to/main/</code>.<br>
Files in <code>path/to/main/</code> already added into git cache but we have updated <code>path/to/main/Bar.php</code> file <strong>AGAIN</strong>. We now ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,233 | git | # How to re-add added files (update staged files only) in git?
We have modified files in `path/to/another/` and `path/to/main/`.
Files in `path/to/main/` already added into git cache but we have updated `path/to/main/Bar.php` file **AGAIN**. We now have the following situation:
```
$ git status
[...]
Changes to be ... | This shows list of files that are only staged:
```
git diff --name-only --cached
```
Now stage these files with their new changes(It will work in bash)
```
git add $(git diff --name-only --cached)
```
PS: (precondition) You need to be at the root of your git repo while running these commands. Running in any subfold... |
35022822 | How can I push a shallow update? Set receive.shallowUpdate on remote? | 10 | 2016-01-26 20:01:49 | <p>I have a project for which I don't have access to the git repository any more. I want to put it in a new repository (on Bitbucket), but when I try to <code>git push -u origin --all</code> I get <code>! [remote rejected] master -> master (shallow update not allowed)</code> for all branches.</p>
<p>Apparently ther... | 5,451 | 2,512,135 | 2016-01-27 06:14:39 | 35,030,063 | 22 | 2016-01-27 06:14:39 | 6,309 | 2016-01-27 06:14:39 | https://stackoverflow.com/q/35022822 | https://stackoverflow.com/a/35030063 | <p>This error message was introduced in git 1.9.0 with <a href="https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd" rel="noreferrer">commit 5dbd767</a>, and its test shows that message when <a href="https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd#diff-72c8ff10e949c0f16... | <p>This error message was introduced in git 1.9.0 with <a href="https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd" rel="noreferrer">commit 5dbd767</a>, and its test shows that message when <a href="https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd#diff-72c8ff10e949c0f16... | 119, 8337 | bitbucket, git | <h1>How can I push a shallow update? Set receive.shallowUpdate on remote?</h1>
<p>I have a project for which I don't have access to the git repository any more. I want to put it in a new repository (on Bitbucket), but when I try to <code>git push -u origin --all</code> I get <code>! [remote rejected] master -> maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,234 | git | # How can I push a shallow update? Set receive.shallowUpdate on remote?
I have a project for which I don't have access to the git repository any more. I want to put it in a new repository (on Bitbucket), but when I try to `git push -u origin --all` I get `! [remote rejected] master -> master (shallow update not allowe... | This error message was introduced in git 1.9.0 with [commit 5dbd767](https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd), and its test shows that message when [pushing commits with grafted root](https://github.com/git/git/commit/5dbd767601812209273ae007a97b7c9305dc6cfd#diff-72c8ff10e949c0f160b72... |
24664486 | 'git difftool' with only modified files | 10 | 2014-07-09 22:03:30 | <p>I have many new files as well as some modified files that I added to my branch, and when I do <code>git difftool master</code> it diffs all modified files as well as opening up for all new files. I see things like </p>
<blockquote>
<p>Launching WinMergeU.exe: /dev/null src/example1.cpp</p>
</blockquote>
<p>It is... | 3,914 | 972,281 | 2018-07-21 10:57:41 | 24,664,546 | 22 | 2014-07-09 22:10:18 | 391,161 | 2014-07-09 22:10:18 | https://stackoverflow.com/q/24664486 | https://stackoverflow.com/a/24664546 | <p>I just tested <a href="https://stackoverflow.com/a/6944973/391161">this answer</a>, and it appears to work equally well with <code>difftool</code>.</p>
<pre><code>git difftool --diff-filter=M
</code></pre>
| <p>I just tested <a href="https://stackoverflow.com/a/6944973/391161">this answer</a>, and it appears to work equally well with <code>difftool</code>.</p> <pre><code>git difftool --diff-filter=M </code></pre> | 119 | git | <h1>'git difftool' with only modified files</h1>
<p>I have many new files as well as some modified files that I added to my branch, and when I do <code>git difftool master</code> it diffs all modified files as well as opening up for all new files. I see things like </p>
<blockquote>
<p>Launching WinMergeU.exe: /dev/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,237 | git | # 'git difftool' with only modified files
I have many new files as well as some modified files that I added to my branch, and when I do `git difftool master` it diffs all modified files as well as opening up for all new files. I see things like
> Launching WinMergeU.exe: /dev/null src/example1.cpp
It is rather annoy... | I just tested [this answer](https://stackoverflow.com/a/6944973/391161), and it appears to work equally well with `difftool`.
```
git difftool --diff-filter=M
``` |
21317574 | git fetch prune is not working | 10 | 2014-01-23 19:27:47 | <p>I have a bunch of remote branches that were deleted and now I want to remove the branches locally. I've tried:</p>
<p><code>git fetch -p</code></p>
<p>but it does not work.</p>
<p>If I do:</p>
<p><code>git branch -r</code></p>
<p>and</p>
<p><code>git branch</code></p>
<p>the lists are not the same because <code>git ... | 13,148 | 413,414 | 2014-01-24 07:25:39 | 21,319,735 | 22 | 2014-01-23 21:30:49 | 1,256,452 | 2014-01-23 22:13:43 | https://stackoverflow.com/q/21317574 | https://stackoverflow.com/a/21319735 | <p>To expand on <a href="https://stackoverflow.com/questions/21317574/git-fetch-prune-is-not-working#comment32133981_21317574">hobbs' comment</a>, <code>git fetch -p</code> (or <code>git remote prune</code> or any similar command) only deletes, from your repository, each "remote branch" that is no longer present on the... | <p>To expand on <a href="https://stackoverflow.com/questions/21317574/git-fetch-prune-is-not-working#comment32133981_21317574">hobbs' comment</a>, <code>git fetch -p</code> (or <code>git remote prune</code> or any similar command) only deletes, from your repository, each "remote branch" that is no longer present on the... | 119, 18283, 41346 | fetch, git, git-remote | <h1>git fetch prune is not working</h1>
<p>I have a bunch of remote branches that were deleted and now I want to remove the branches locally. I've tried:</p>
<p><code>git fetch -p</code></p>
<p>but it does not work.</p>
<p>If I do:</p>
<p><code>git branch -r</code></p>
<p>and</p>
<p><code>git branch</code></p>
<p>the l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,239 | git | # git fetch prune is not working
I have a bunch of remote branches that were deleted and now I want to remove the branches locally. I've tried:
`git fetch -p`
but it does not work.
If I do:
`git branch -r`
and
`git branch`
the lists are not the same because `git branch` still lists deleted remote branches, even... | To expand on [hobbs' comment](https://stackoverflow.com/questions/21317574/git-fetch-prune-is-not-working#comment32133981_21317574), `git fetch -p` (or `git remote prune` or any similar command) only deletes, from your repository, each "remote branch" that is no longer present on the remote.
If you've made a *local* b... |
14614511 | Adding all "error_log" files to .gitignore | 10 | 2013-01-30 21:51:55 | <p>I am getting frustrated with all my PHP error_log files causing merge conflicts with my production & dev servers with git. The solution is easy enough--adding all files that are called "error_log" to .gitignore--but I don't know how to do it. This is what I'm trying in my .gitignore:</p>
<pre><code>error_log
<... | 4,592 | 1,288,611 | 2013-01-31 01:06:30 | 14,616,812 | 22 | 2013-01-31 01:06:30 | 758,345 | 2013-01-31 01:06:30 | https://stackoverflow.com/q/14614511 | https://stackoverflow.com/a/14616812 | <p>Your <code>.gitignore</code> is absolutely correct, but <code>.gitignore</code> will only stop files from being <strong>added</strong> to the repository – already tracked files are not concerned by this. So, first you need to remove all the <code>error_log</code> files from the index by running:</p>
<pre><code>git ... | <p>Your <code>.gitignore</code> is absolutely correct, but <code>.gitignore</code> will only stop files from being <strong>added</strong> to the repository – already tracked files are not concerned by this. So, first you need to remove all the <code>error_log</code> files from the index by running:</p> <pre><code>git ... | 5, 119, 10252, 25056 | error-log, git, gitignore, php | <h1>Adding all "error_log" files to .gitignore</h1>
<p>I am getting frustrated with all my PHP error_log files causing merge conflicts with my production & dev servers with git. The solution is easy enough--adding all files that are called "error_log" to .gitignore--but I don't know how to do it. This is what I'm ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,240 | git | # Adding all "error_log" files to .gitignore
I am getting frustrated with all my PHP error_log files causing merge conflicts with my production & dev servers with git. The solution is easy enough--adding all files that are called "error_log" to .gitignore--but I don't know how to do it. This is what I'm trying in my .... | Your `.gitignore` is absolutely correct, but `.gitignore` will only stop files from being **added** to the repository – already tracked files are not concerned by this. So, first you need to remove all the `error_log` files from the index by running:
```
git rm --cached '*/error_log' error_log
```
Now when you run `g... |
10303665 | How to clone a specific version of a git repository? | 10 | 2012-04-24 18:15:11 | <p>I'm working with symfony2 and I want to backup my vendors in case github is not reachable.</p>
<p>How do I clone a specific Version of a repository?</p>
<p>I want to backup the repositories with help of the vendors-file.</p>
<p>the syntax is something like this:</p>
<pre><code>[symfony]
git=http://github.com... | 29,066 | 1,139,383 | 2017-09-16 00:28:37 | 10,304,054 | 22 | 2012-04-24 18:41:45 | 697,930 | 2017-09-16 00:28:37 | https://stackoverflow.com/q/10303665 | https://stackoverflow.com/a/10304054 | <p>What I would do to tell git to use this exact version is:</p>
<pre><code>git clone http://github.com/symfony/symfony.git
cd symfony
git checkout v2.0.9
</code></pre>
<p>One liner:</p>
<pre><code>git clone http://github.com/symfony/symfony.git -b v2.0.9
</code></pre>
| <p>What I would do to tell git to use this exact version is:</p> <pre><code>git clone http://github.com/symfony/symfony.git cd symfony git checkout v2.0.9 </code></pre> <p>One liner:</p> <pre><code>git clone http://github.com/symfony/symfony.git -b v2.0.9 </code></pre> | 119, 57799 | git, symfony | <h1>How to clone a specific version of a git repository?</h1>
<p>I'm working with symfony2 and I want to backup my vendors in case github is not reachable.</p>
<p>How do I clone a specific Version of a repository?</p>
<p>I want to backup the repositories with help of the vendors-file.</p>
<p>the syntax is something ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,242 | git | # How to clone a specific version of a git repository?
I'm working with symfony2 and I want to backup my vendors in case github is not reachable.
How do I clone a specific Version of a repository?
I want to backup the repositories with help of the vendors-file.
the syntax is something like this:
```
[symfony]
... | What I would do to tell git to use this exact version is:
```
git clone http://github.com/symfony/symfony.git
cd symfony
git checkout v2.0.9
```
One liner:
```
git clone http://github.com/symfony/symfony.git -b v2.0.9
``` |
41439747 | How to bypass the http.proxy that I have set using git config? | 9 | 2017-01-03 08:58:44 | <p><strong>Background</strong></p>
<p>The work computer that I have, I occasionally carry it at home. Now, we have a proxy server at work, and I have configured <code>git</code> to use it by doing <code>git config --global http.proxy http://proxy.company.com</code>. So when I get back at home, I do not require a proxy... | 12,120 | 3,810,038 | 2017-01-03 09:51:26 | 41,440,395 | 22 | 2017-01-03 09:37:10 | 589,329 | 2017-01-03 09:37:10 | https://stackoverflow.com/q/41439747 | https://stackoverflow.com/a/41440395 | <p>You can either do exactly what you asked by using</p>
<pre><code>git -c http.proxy= clone https://github.com/foo/bar.git
</code></pre>
<p>This will set the proxy to an empty value for this command and thus not use a proxy.</p>
<hr>
<p>If it is not about cloning, but about fetching, pushing, pulling and so on, yo... | <p>You can either do exactly what you asked by using</p> <pre><code>git -c http.proxy= clone https://github.com/foo/bar.git </code></pre> <p>This will set the proxy to an empty value for this command and thus not use a proxy.</p> <hr> <p>If it is not about cloning, but about fetching, pushing, pulling and so on, yo... | 119, 760 | git, proxy | <h1>How to bypass the http.proxy that I have set using git config?</h1>
<p><strong>Background</strong></p>
<p>The work computer that I have, I occasionally carry it at home. Now, we have a proxy server at work, and I have configured <code>git</code> to use it by doing <code>git config --global http.proxy http://proxy.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,245 | git | # How to bypass the http.proxy that I have set using git config?
**Background**
The work computer that I have, I occasionally carry it at home. Now, we have a proxy server at work, and I have configured `git` to use it by doing `git config --global http.proxy http://proxy.company.com`. So when I get back at home, I d... | You can either do exactly what you asked by using
```
git -c http.proxy= clone https://github.com/foo/bar.git
```
This will set the proxy to an empty value for this command and thus not use a proxy.
---
If it is not about cloning, but about fetching, pushing, pulling and so on, you can also add two remotes to your ... |
37352976 | How to make --squash default on a merge? | 9 | 2016-05-20 17:54:26 | <p>We use separate branches for non-trivial bug fixes and features. The branchhes are kept in-sync with master by performing frequent <code>git checkout <x>; git merge master</code>.</p>
<p>I noticed when merging, git pollutes the log files with multiple, non-relevant messages. For example, rather than a single ... | 8,423 | 608,639 | 2021-11-30 15:43:55 | 37,828,622 | 22 | 2016-06-15 07:20:21 | 1,256,452 | 2021-11-30 15:43:55 | https://stackoverflow.com/q/37352976 | https://stackoverflow.com/a/37828622 | <p>To make Git always do a squash "merge" for the <code>master</code> branch:</p>
<pre><code>$ git config branch.master.mergeOptions "--squash"
</code></pre>
<h2>Explanation</h2>
<p>You can't make Git do a squash "merge" by default for <em>all</em> branches, but you <em>can</em> make it do... | <p>To make Git always do a squash "merge" for the <code>master</code> branch:</p> <pre><code>$ git config branch.master.mergeOptions "--squash" </code></pre> <h2>Explanation</h2> <p>You can't make Git do a squash "merge" by default for <em>all</em> branches, but you <em>can</em> make it do... | 119, 717 | git, merge | <h1>How to make --squash default on a merge?</h1>
<p>We use separate branches for non-trivial bug fixes and features. The branchhes are kept in-sync with master by performing frequent <code>git checkout <x>; git merge master</code>.</p>
<p>I noticed when merging, git pollutes the log files with multiple, non-rel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,246 | git | # How to make --squash default on a merge?
We use separate branches for non-trivial bug fixes and features. The branchhes are kept in-sync with master by performing frequent `git checkout <x>; git merge master`.
I noticed when merging, git pollutes the log files with multiple, non-relevant messages. For example, rath... | To make Git always do a squash "merge" for the `master` branch:
```
$ git config branch.master.mergeOptions "--squash"
```
## Explanation
You can't make Git do a squash "merge" by default for *all* branches, but you *can* make it do a squash "merge" by default for *some* branches. Since you are particularly interest... |
27089095 | How to override unmerged git checkout with upstream version | 9 | 2014-11-23 12:45:07 | <p>I’m attempting to revert a file modified locally to the version that is most recent upstream, effectively undoing my changes.</p>
<pre><code>$ git checkout -- Jovie/Jovie-Info.plist
error: path ‘Jovie/Jovie-Info.plist' is unmerged
</code></pre>
<p>Using -f alters the error to warn, but still won’t make the change... | 15,439 | 48,062 | 2020-09-17 13:53:15 | 27,089,213 | 22 | 2014-11-23 12:57:49 | 6,309 | 2014-11-23 12:57:49 | https://stackoverflow.com/q/27089095 | https://stackoverflow.com/a/27089213 | <p>You might need to reset the file first, before doing the checkout:</p>
<pre><code>git reset -- Jovie/Jovie-Info.plist
git checkout -- Jovie/Jovie-Info.plist
</code></pre>
<p>The reset un-stage the changes in progress (here the merge, with the conflict markers in the file).<br>
Then the checkout can restore the ind... | <p>You might need to reset the file first, before doing the checkout:</p> <pre><code>git reset -- Jovie/Jovie-Info.plist git checkout -- Jovie/Jovie-Info.plist </code></pre> <p>The reset un-stage the changes in progress (here the merge, with the conflict markers in the file).<br> Then the checkout can restore the ind... | 119, 717, 37230 | git, git-checkout, merge | <h1>How to override unmerged git checkout with upstream version</h1>
<p>I’m attempting to revert a file modified locally to the version that is most recent upstream, effectively undoing my changes.</p>
<pre><code>$ git checkout -- Jovie/Jovie-Info.plist
error: path ‘Jovie/Jovie-Info.plist' is unmerged
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,247 | git | # How to override unmerged git checkout with upstream version
I’m attempting to revert a file modified locally to the version that is most recent upstream, effectively undoing my changes.
```
$ git checkout -- Jovie/Jovie-Info.plist
error: path ‘Jovie/Jovie-Info.plist' is unmerged
```
Using -f alters the error to w... | You might need to reset the file first, before doing the checkout:
```
git reset -- Jovie/Jovie-Info.plist
git checkout -- Jovie/Jovie-Info.plist
```
The reset un-stage the changes in progress (here the merge, with the conflict markers in the file).
Then the checkout can restore the index with the last commit conte... |
25899469 | .gitignore not working for xcuserdata directory in Xcode project | 9 | 2014-09-17 20:08:50 | <p>This is my gitignore file:</p>
<pre class="lang-none prettyprint-override"><code># Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
</code></pre>
<p>However, it still detects changes here:</p>
<pre><code>BW.xcodeproj/project.xcworkspace/xcuserdata/cooluser.xcuserdata... | 8,777 | 903,643 | 2024-01-30 05:02:07 | 25,899,569 | 22 | 2014-09-17 20:16:12 | 1,100,417 | 2014-09-17 22:25:34 | https://stackoverflow.com/q/25899469 | https://stackoverflow.com/a/25899569 | <p>The file <code>BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstate</code> must already be tracked by git.</p>
<p>When you add an entry to <code>.gitignore</code> it only affects untracked files. If they are already tracked, they are not automatically removed from the repository.</p>
<p>You can re... | <p>The file <code>BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstate</code> must already be tracked by git.</p> <p>When you add an entry to <code>.gitignore</code> it only affects untracked files. If they are already tracked, they are not automatically removed from the repository.</p> <p>You can re... | 119, 908 | git, xcode | <h1>.gitignore not working for xcuserdata directory in Xcode project</h1>
<p>This is my gitignore file:</p>
<pre class="lang-none prettyprint-override"><code># Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
</code></pre>
<p>However, it still detects changes here:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,248 | git | # .gitignore not working for xcuserdata directory in Xcode project
This is my gitignore file:
```
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
```
However, it still detects changes here:
```
BW.xcodeproj/project.xcworkspace/xcuserdata/cooluser.xcuserdatad/User... | The file `BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstate` must already be tracked by git.
When you add an entry to `.gitignore` it only affects untracked files. If they are already tracked, they are not automatically removed from the repository.
You can remove this file manually with: `git rm -... |
25138770 | git Connection abandoned, fatal: Could not read from remote repository | 9 | 2014-08-05 12:24:30 | <p>I'm trying to clone a repo in either cygwin or GitBash (msysgit) using Pageant for ssh keys. I get the following error:</p>
<pre><code>$ git clone git@github.com:username/your-project.git
Cloning into 'your-project'...
The server's host key is not cached in the registry. You
have no guarantee that the server is th... | 4,707 | 312,072 | 2015-11-04 20:15:19 | 25,138,771 | 22 | 2014-08-05 12:24:30 | 312,072 | 2014-08-05 12:24:30 | https://stackoverflow.com/q/25138770 | https://stackoverflow.com/a/25138771 | <p>I found the solution on this page <a href="http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/" rel="noreferrer">http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/</a> but re-creating here in hopes it saves someone else time in the future as th... | <p>I found the solution on this page <a href="http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/" rel="noreferrer">http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/</a> but re-creating here in hopes it saves someone else time in the future as th... | 119, 1768, 2306, 58078 | git, pageant, plink, putty | <h1>git Connection abandoned, fatal: Could not read from remote repository</h1>
<p>I'm trying to clone a repo in either cygwin or GitBash (msysgit) using Pageant for ssh keys. I get the following error:</p>
<pre><code>$ git clone git@github.com:username/your-project.git
Cloning into 'your-project'...
The server's hos... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,249 | git | # git Connection abandoned, fatal: Could not read from remote repository
I'm trying to clone a repo in either cygwin or GitBash (msysgit) using Pageant for ssh keys. I get the following error:
```
$ git clone git@github.com:username/your-project.git
Cloning into 'your-project'...
The server's host key is not cached i... | I found the solution on this page <http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/> but re-creating here in hopes it saves someone else time in the future as that page did not show up in google for me easily.
It turns out in order to fully use pageant with cygwin/msysgit you fir... |
21328687 | git init - bad numeric config value 'auto' for 'core.autocrlf' in | 9 | 2014-01-24 09:14:50 | <p>Just started working with git 15 minutes ago and already trouble ... damn.</p>
<p>Well, just as i wrote in the headline, im currently working with the git-scm book here: <a href="http://git-scm.com/book" rel="noreferrer">http://git-scm.com/book</a></p>
<p><strong>In 2.1 - Getting a Git repository</strong>, it says... | 30,945 | 2,914,589 | 2022-03-12 14:06:01 | 21,328,799 | 22 | 2014-01-24 09:20:58 | 6,309 | 2018-06-19 16:25:08 | https://stackoverflow.com/q/21328687 | https://stackoverflow.com/a/21328799 | <p>Try a</p>
<pre><code>git config --system --unset core.autocrlf
</code></pre>
<p>I would then advise for a:</p>
<pre><code>git config --global core.autocrlf false
</code></pre>
<p>(see "<a href="https://stackoverflow.com/a/2825829/6309">Why should I use core.autocrlf=true in Git?</a>"; using <strong><a href="http... | <p>Try a</p> <pre><code>git config --system --unset core.autocrlf </code></pre> <p>I would then advise for a:</p> <pre><code>git config --global core.autocrlf false </code></pre> <p>(see "<a href="https://stackoverflow.com/a/2825829/6309">Why should I use core.autocrlf=true in Git?</a>"; using <strong><a href="http... | 119 | git | <h1>git init - bad numeric config value 'auto' for 'core.autocrlf' in</h1>
<p>Just started working with git 15 minutes ago and already trouble ... damn.</p>
<p>Well, just as i wrote in the headline, im currently working with the git-scm book here: <a href="http://git-scm.com/book" rel="noreferrer">http://git-scm.com/b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,250 | git | # git init - bad numeric config value 'auto' for 'core.autocrlf' in
Just started working with git 15 minutes ago and already trouble ... damn.
Well, just as i wrote in the headline, im currently working with the git-scm book here: <http://git-scm.com/book>
**In 2.1 - Getting a Git repository**, it says:
> If you’re... | Try a
```
git config --system --unset core.autocrlf
```
I would then advise for a:
```
git config --global core.autocrlf false
```
(see "[Why should I use core.autocrlf=true in Git?](https://stackoverflow.com/a/2825829/6309)"; using **[`core.eol` settings](https://stackoverflow.com/a/3209806/6309)** per files is mo... |
8748773 | How do I rename the .git directory? | 8 | 2012-01-05 19:49:02 | <p>How do I rename the <strong>.git directory</strong>?</p>
<p>Say for instance I have a repo that I have been working with for some time but now I decide to rename the .git directory. I tried the bash mv command but after I did that git status said the my working directory is not a git repository.</p>
| 4,571 | 505,062 | 2022-01-24 11:38:55 | 8,748,816 | 22 | 2012-01-05 19:53:27 | 1,093,528 | 2012-01-06 12:55:57 | https://stackoverflow.com/q/8748773 | https://stackoverflow.com/a/8748816 | <p>No idea why you would ever want to rename that, but anyway...</p>
<p>Git expects :</p>
<ul>
<li>either a <code>.git</code> directory to exist under the current directory, or one of its parents,</li>
<li>or the <code>GIT_DIR</code> environment variable to be set.</li>
</ul>
<p>Generally, unless very special circum... | <p>No idea why you would ever want to rename that, but anyway...</p> <p>Git expects :</p> <ul> <li>either a <code>.git</code> directory to exist under the current directory, or one of its parents,</li> <li>or the <code>GIT_DIR</code> environment variable to be set.</li> </ul> <p>Generally, unless very special circum... | 119, 4510 | git, rename | <h1>How do I rename the .git directory?</h1>
<p>How do I rename the <strong>.git directory</strong>?</p>
<p>Say for instance I have a repo that I have been working with for some time but now I decide to rename the .git directory. I tried the bash mv command but after I did that git status said the my working director... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,253 | git | # How do I rename the .git directory?
How do I rename the **.git directory**?
Say for instance I have a repo that I have been working with for some time but now I decide to rename the .git directory. I tried the bash mv command but after I did that git status said the my working directory is not a git repository. | No idea why you would ever want to rename that, but anyway...
Git expects :
- either a `.git` directory to exist under the current directory, or one of its parents,
- or the `GIT_DIR` environment variable to be set.
Generally, unless very special circumstances are in effect, you should never tread apart from `.git`.... |
7705499 | Git status shows untracked file on a higher level? | 8 | 2011-10-09 18:13:43 | <p>I just cloned a git repository from my server to my local machine. I wanted to see if everything was ok so I made a git status and my suprise is that folders in a level higher than my git repository appear as untracked, "../joomla/", does this make any sense to you?</p>
| 3,577 | 628,244 | 2013-06-10 11:53:45 | 7,706,284 | 22 | 2011-10-09 20:14:47 | 526,535 | 2011-10-09 20:14:47 | https://stackoverflow.com/q/7705499 | https://stackoverflow.com/a/7706284 | <p>( This is a guess since you haven't given a lot of detail. But this is a possible scenario):</p>
<p>You had a repo and you cloned it. You ran <code>git clone url/to/repo.git</code> from your directory say <code>/home/repos/my</code></p>
<p>Now after the clone, you try <code>git status</code> and shows untracked fi... | <p>( This is a guess since you haven't given a lot of detail. But this is a possible scenario):</p> <p>You had a repo and you cloned it. You ran <code>git clone url/to/repo.git</code> from your directory say <code>/home/repos/my</code></p> <p>Now after the clone, you try <code>git status</code> and shows untracked fi... | 119 | git | <h1>Git status shows untracked file on a higher level?</h1>
<p>I just cloned a git repository from my server to my local machine. I wanted to see if everything was ok so I made a git status and my suprise is that folders in a level higher than my git repository appear as untracked, "../joomla/", does this make any sens... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,254 | git | # Git status shows untracked file on a higher level?
I just cloned a git repository from my server to my local machine. I wanted to see if everything was ok so I made a git status and my suprise is that folders in a level higher than my git repository appear as untracked, "../joomla/", does this make any sense to you? | ( This is a guess since you haven't given a lot of detail. But this is a possible scenario):
You had a repo and you cloned it. You ran `git clone url/to/repo.git` from your directory say `/home/repos/my`
Now after the clone, you try `git status` and shows untracked files from `/home/repos`.
So how is this possible?
... |
56977939 | how to pull from a branch ignoring all the conflicts from the master | 7 | 2019-07-10 20:10:04 | <p>After <code>git pull origin branch-name</code> on local master branch, I got an error which says 'Automatic merge failed; fix conflicts and then commit the result.' as the branch is several commits ahead and several behind the master. If I want to takes all changes from the remote branch and ignore conflicts, where ... | 16,385 | 3,983,454 | 2025-02-26 16:03:39 | 56,978,113 | 22 | 2019-07-10 20:23:08 | 406,906 | 2019-07-10 20:23:08 | https://stackoverflow.com/q/56977939 | https://stackoverflow.com/a/56978113 | <p>Generally, if you want to blow away any local changes and just update to the remote master branch, this would work:</p>
<pre><code>git fetch
git reset --hard origin/master
</code></pre>
<p>If you have local changes that you want to clean, you might have to do the following first:</p>
<pre><code>git reset --hard
g... | <p>Generally, if you want to blow away any local changes and just update to the remote master branch, this would work:</p> <pre><code>git fetch git reset --hard origin/master </code></pre> <p>If you have local changes that you want to clean, you might have to do the following first:</p> <pre><code>git reset --hard g... | 119, 28896 | git, git-pull | <h1>how to pull from a branch ignoring all the conflicts from the master</h1>
<p>After <code>git pull origin branch-name</code> on local master branch, I got an error which says 'Automatic merge failed; fix conflicts and then commit the result.' as the branch is several commits ahead and several behind the master. If I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,255 | git | # how to pull from a branch ignoring all the conflicts from the master
After `git pull origin branch-name` on local master branch, I got an error which says 'Automatic merge failed; fix conflicts and then commit the result.' as the branch is several commits ahead and several behind the master. If I want to takes all c... | Generally, if you want to blow away any local changes and just update to the remote master branch, this would work:
```
git fetch
git reset --hard origin/master
```
If you have local changes that you want to clean, you might have to do the following first:
```
git reset --hard
git clean -df
``` |
45391201 | Change unpushed previous git commit message | 7 | 2017-07-29 15:54:05 | <p>How to change a <em>previous</em> unpushed git commit message?</p>
<p><strong>UPDATE:</strong> <em>question dramatically reduced to suit for the answer. To see the full content. see the history.</em></p>
<p>So what's the correct way of doing it? Thx. </p>
| 4,257 | 2,125,837 | 2017-07-30 12:55:36 | 45,391,353 | 22 | 2017-07-29 16:09:53 | 492,317 | 2017-07-29 17:14:30 | https://stackoverflow.com/q/45391201 | https://stackoverflow.com/a/45391353 | <p>To change the most recent commit's message, running:</p>
<p><code>git commit -m "corrected message" --amend</code></p>
<p>would be sufficient.</p>
<p>However, if you need to change the message of commit prior to the most recent, you would instead use an interactive rebase. This example would allow you to change t... | <p>To change the most recent commit's message, running:</p> <p><code>git commit -m "corrected message" --amend</code></p> <p>would be sufficient.</p> <p>However, if you need to change the message of commit prior to the most recent, you would instead use an interactive rebase. This example would allow you to change t... | 119 | git | <h1>Change unpushed previous git commit message</h1>
<p>How to change a <em>previous</em> unpushed git commit message?</p>
<p><strong>UPDATE:</strong> <em>question dramatically reduced to suit for the answer. To see the full content. see the history.</em></p>
<p>So what's the correct way of doing it? Thx. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,256 | git | # Change unpushed previous git commit message
How to change a *previous* unpushed git commit message?
**UPDATE:** *question dramatically reduced to suit for the answer. To see the full content. see the history.*
So what's the correct way of doing it? Thx. | To change the most recent commit's message, running:
`git commit -m "corrected message" --amend`
would be sufficient.
However, if you need to change the message of commit prior to the most recent, you would instead use an interactive rebase. This example would allow you to change the message of the commit just prior... |
44388889 | Error not found: git when install npm package on windows | 7 | 2017-06-06 11:31:18 | <p>I'm trying to install this package through npm <code>npm install bigwheel</code> on windows using webstorm IDE.</p>
<p>I'm getting </p>
<blockquote>
<p>"Error: not found: git" "This is most likely not a problme with npm itself. Please check if you have git installed and in yout Path"</p>
</blockquote>
<p>I have... | 33,594 | 429,604 | 2021-10-19 10:48:14 | 44,389,219 | 22 | 2017-06-06 11:47:45 | 5,111,870 | 2017-06-06 12:08:12 | https://stackoverflow.com/q/44388889 | https://stackoverflow.com/a/44389219 | <p>Please find at which location on your machine git is installed. e.g. <code>C:\Program Files\Git\cmd</code> and append this to your <code>PATH</code> variable in environment variables.</p>
<p>To append to path please follow below steps:</p>
<ol>
<li>Right click on <strong>This PC</strong> or <strong>My Computer</st... | <p>Please find at which location on your machine git is installed. e.g. <code>C:\Program Files\Git\cmd</code> and append this to your <code>PATH</code> variable in environment variables.</p> <p>To append to path please follow below steps:</p> <ol> <li>Right click on <strong>This PC</strong> or <strong>My Computer</st... | 119, 4963, 61387 | git, npm, window | <h1>Error not found: git when install npm package on windows</h1>
<p>I'm trying to install this package through npm <code>npm install bigwheel</code> on windows using webstorm IDE.</p>
<p>I'm getting </p>
<blockquote>
<p>"Error: not found: git" "This is most likely not a problme with npm itself. Please check if you... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,257 | git | # Error not found: git when install npm package on windows
I'm trying to install this package through npm `npm install bigwheel` on windows using webstorm IDE.
I'm getting
> "Error: not found: git" "This is most likely not a problme with npm itself. Please check if you have git installed and in yout Path"
I have <h... | Please find at which location on your machine git is installed. e.g. `C:\Program Files\Git\cmd` and append this to your `PATH` variable in environment variables.
To append to path please follow below steps:
1. Right click on **This PC** or **My Computer** & select **Properties**
2. Select **Advanced System Settings**... |
9166356 | How do I do a pristine checkout with git? | 6 | 2012-02-06 19:55:45 | <p>How do I return my working directory to the state it would be in if I made a new clone and checked out the current version?</p>
<p>For subversion I'd do:</p>
<pre><code>$ svn status --no-ignore | awk '$1 == "?" { print $2 }' | xargs rm -r
</code></pre>
<p>and for mercurial:</p>
<pre><code>$ hg status --ignored -... | 4,893 | 254,837 | 2018-08-30 10:06:23 | 9,166,473 | 22 | 2012-02-06 20:03:18 | 85,371 | 2012-02-06 20:03:18 | https://stackoverflow.com/q/9166356 | https://stackoverflow.com/a/9166473 | <p>(prepare to loose all local, uncommited changes:)</p>
<pre><code>git reset --hard
git clean -dfx .
</code></pre>
<p>As mentioned, you can use <code>git stash</code> to temporarily save a reference to your local pending changes on a 'pseudo branch' (i.e. a stash). </p>
| <p>(prepare to loose all local, uncommited changes:)</p> <pre><code>git reset --hard git clean -dfx . </code></pre> <p>As mentioned, you can use <code>git stash</code> to temporarily save a reference to your local pending changes on a 'pseudo branch' (i.e. a stash). </p> | 119, 37230 | git, git-checkout | <h1>How do I do a pristine checkout with git?</h1>
<p>How do I return my working directory to the state it would be in if I made a new clone and checked out the current version?</p>
<p>For subversion I'd do:</p>
<pre><code>$ svn status --no-ignore | awk '$1 == "?" { print $2 }' | xargs rm -r
</code></pre>
<p>and for... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,258 | git | # How do I do a pristine checkout with git?
How do I return my working directory to the state it would be in if I made a new clone and checked out the current version?
For subversion I'd do:
```
$ svn status --no-ignore | awk '$1 == "?" { print $2 }' | xargs rm -r
```
and for mercurial:
```
$ hg status --ignored -... | (prepare to loose all local, uncommited changes:)
```
git reset --hard
git clean -dfx .
```
As mentioned, you can use `git stash` to temporarily save a reference to your local pending changes on a 'pseudo branch' (i.e. a stash). |
2982055 | Detach many subdirectories into a new, separate Git repository | 166 | 2010-06-05 20:51:53 | <p>This question is based on <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">Detach subdirectory into separate Git repository</a> </p>
<p>Instead of detaching a single subdirectory, I want to detach a couple. For example, my current directory tree looks like this:<... | 56,997 | 318,077 | 2023-12-16 14:28:21 | 2,989,613 | 21 | 2010-06-07 12:51:32 | 318,077 | 2023-12-16 14:28:21 | https://stackoverflow.com/q/2982055 | https://stackoverflow.com/a/2989613 | <p>Answering my own question here... after a lot of trial and error.</p>
<p>I managed to do this using a combination of <code>git subtree</code> and <a href="http://search.cpan.org/%7Ebook/Git-FastExport-0.07/script/git-stitch-repo" rel="nofollow noreferrer"><code>git-stitch-repo</code></a>. These instructions are base... | <p>Answering my own question here... after a lot of trial and error.</p> <p>I managed to do this using a combination of <code>git subtree</code> and <a href="http://search.cpan.org/%7Ebook/Git-FastExport-0.07/script/git-stitch-repo" rel="nofollow noreferrer"><code>git-stitch-repo</code></a>. These instructions are base... | 119, 46509 | git, git-filter-branch | <h1>Detach many subdirectories into a new, separate Git repository</h1>
<p>This question is based on <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">Detach subdirectory into separate Git repository</a> </p>
<p>Instead of detaching a single subdirectory, I want to d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,261 | git | # Detach many subdirectories into a new, separate Git repository
This question is based on [Detach subdirectory into separate Git repository](https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository)
Instead of detaching a single subdirectory, I want to detach a couple. For example,... | Answering my own question here... after a lot of trial and error.
I managed to do this using a combination of `git subtree` and [`git-stitch-repo`](http://search.cpan.org/%7Ebook/Git-FastExport-0.07/script/git-stitch-repo). These instructions are based on:
- Sharing code between projects with git subtree – <http://ps... |
47241098 | Accept Incoming Change not appearing in VS Code | 114 | 2017-11-11 17:58:26 | <p>I am trying to resolve merge conflicts into a branch using vs code. However the command palette to accept incoming changes is not appearing</p>
<p><a href="https://i.sstatic.net/NSs53.png" rel="noreferrer"><img src="https://i.sstatic.net/NSs53.png" alt="enter image description here" /></a></p>
<p>Unlike <a href="htt... | 128,403 | 4,901,556 | 2022-09-25 10:32:07 | 47,248,481 | 21 | 2017-11-12 11:53:14 | 3,861,083 | 2017-11-12 11:53:14 | https://stackoverflow.com/q/47241098 | https://stackoverflow.com/a/47248481 | <p>I suppose you're looking for <a href="https://github.com/Microsoft/vscode-tips-and-tricks#resolve-merge-conflicts" rel="noreferrer">this toolbar</a>:</p>
<p><a href="https://i.sstatic.net/5QGkf.gif" rel="noreferrer"><img src="https://i.sstatic.net/5QGkf.gif" alt="VS Code merge conflict toolbar"></a></p>
<p>(Image ... | <p>I suppose you're looking for <a href="https://github.com/Microsoft/vscode-tips-and-tricks#resolve-merge-conflicts" rel="noreferrer">this toolbar</a>:</p> <p><a href="https://i.sstatic.net/5QGkf.gif" rel="noreferrer"><img src="https://i.sstatic.net/5QGkf.gif" alt="VS Code merge conflict toolbar"></a></p> <p>(Image ... | 119, 111608 | git, visual-studio-code | <h1>Accept Incoming Change not appearing in VS Code</h1>
<p>I am trying to resolve merge conflicts into a branch using vs code. However the command palette to accept incoming changes is not appearing</p>
<p><a href="https://i.sstatic.net/NSs53.png" rel="noreferrer"><img src="https://i.sstatic.net/NSs53.png" alt="enter ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,262 | git | # Accept Incoming Change not appearing in VS Code
I am trying to resolve merge conflicts into a branch using vs code. However the command palette to accept incoming changes is not appearing
[](https://i.sstatic.net/NSs53.png)
Unlike [here where the comm... | I suppose you're looking for [this toolbar](https://github.com/Microsoft/vscode-tips-and-tricks#resolve-merge-conflicts):
[](https://i.sstatic.net/5QGkf.gif)
(Image from this [Microsoft Repo](https://github.com/Microsoft/vscode-tips-and-tricks))
This ... |
4393527 | Why might git log not show history for a moved file, and what can I do about it? | 114 | 2010-12-08 23:50:48 | <p>I've renamed a couple of files using <code>git mv</code>, used <code>git stash</code>, had a quick look at HEAD (without changing it) then did <code>git stash pop</code> to get the whole lot back again. My moves had disappeared from the commit list, so I redid them with <code>git rm</code> and the commit message cla... | 53,486 | null | 2023-01-12 22:56:08 | 4,434,056 | 21 | 2010-12-13 22:19:20 | null | 2010-12-13 22:19:20 | https://stackoverflow.com/q/4393527 | https://stackoverflow.com/a/4434056 | <p>Answering my own question, since I have managed to assuage my concerns, even if I haven't solved my problem exactly. (<code>git log --follow</code> still doesn't work for me, though.)</p>
<p>Firstly, the <code>--summary</code> log for the renaming commit includes the <code>delete</code> line with the file's old nam... | <p>Answering my own question, since I have managed to assuage my concerns, even if I haven't solved my problem exactly. (<code>git log --follow</code> still doesn't work for me, though.)</p> <p>Firstly, the <code>--summary</code> log for the renaming commit includes the <code>delete</code> line with the file's old nam... | 119, 1318, 3346, 4510, 47913 | dvcs, git, git-log, history, rename | <h1>Why might git log not show history for a moved file, and what can I do about it?</h1>
<p>I've renamed a couple of files using <code>git mv</code>, used <code>git stash</code>, had a quick look at HEAD (without changing it) then did <code>git stash pop</code> to get the whole lot back again. My moves had disappeared... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,263 | git | # Why might git log not show history for a moved file, and what can I do about it?
I've renamed a couple of files using `git mv`, used `git stash`, had a quick look at HEAD (without changing it) then did `git stash pop` to get the whole lot back again. My moves had disappeared from the commit list, so I redid them wit... | Answering my own question, since I have managed to assuage my concerns, even if I haven't solved my problem exactly. (`git log --follow` still doesn't work for me, though.)
Firstly, the `--summary` log for the renaming commit includes the `delete` line with the file's old name. So if it's easy to spot, you can find it... |
2458042 | Restore a file's modification time in Git | 85 | 2010-03-16 20:51:31 | <p>I understand the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Why_isn.27t_Git_preserving_modification_time_on_files.3F" rel="noreferrer">default Git behaviour of updating the modification time every time it changes a file</a>, but there are times when I want to restore a file's original modification time.</... | 43,775 | 9,859 | 2025-12-28 14:49:24 | 2,458,146 | 21 | 2010-03-16 21:07:45 | 193,688 | 2021-10-24 19:21:46 | https://stackoverflow.com/q/2458042 | https://stackoverflow.com/a/2458146 | <p>Git does not do this. Like your linked FAQ says, it would break using timestamp-based dependency analysis tools like <em>make</em>.</p>
<p>Think about what would happen if old timestamps were applied to files checked out from ‘old’ commits:</p>
<ul>
<li><em>make</em> from a clean directory works fine</li>
<li>checko... | <p>Git does not do this. Like your linked FAQ says, it would break using timestamp-based dependency analysis tools like <em>make</em>.</p> <p>Think about what would happen if old timestamps were applied to files checked out from ‘old’ commits:</p> <ul> <li><em>make</em> from a clean directory works fine</li> <li>checko... | 119 | git | <h1>Restore a file's modification time in Git</h1>
<p>I understand the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Why_isn.27t_Git_preserving_modification_time_on_files.3F" rel="noreferrer">default Git behaviour of updating the modification time every time it changes a file</a>, but there are times when I wan... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,264 | git | # Restore a file's modification time in Git
I understand the [default Git behaviour of updating the modification time every time it changes a file](https://git.wiki.kernel.org/index.php/GitFaq#Why_isn.27t_Git_preserving_modification_time_on_files.3F), but there are times when I want to restore a file's original modifi... | Git does not do this. Like your linked FAQ says, it would break using timestamp-based dependency analysis tools like *make*.
Think about what would happen if old timestamps were applied to files checked out from ‘old’ commits:
- *make* from a clean directory works fine
- checkout an older branch/tag/commit (the files... |
12355904 | How to split a git branch into two branches? | 73 | 2012-09-10 16:35:40 | <p>I'm trying to help out a coworker who accidentally created one feature branch from another feature branch, rather than creating the second one from master. Here is essentially what we have now…</p>
<pre><code>Master ---A---B---C
\
Foo E---F---F---H
... | 50,224 | 147,937 | 2021-08-12 09:57:39 | 12,355,951 | 21 | 2012-09-10 16:38:22 | 56,076 | 2012-09-10 17:05:02 | https://stackoverflow.com/q/12355904 | https://stackoverflow.com/a/12355951 | <p>It looks to me like you could:</p>
<pre><code>git checkout J
git rebase master
</code></pre>
<p>Edit:</p>
<p>I tried what I suggested and it doesn't work. knittl's suggestion doesn't work (on my box). Here's what did work for me:</p>
<pre><code>git rebase --onto master foo bar
</code></pre>
| <p>It looks to me like you could:</p> <pre><code>git checkout J git rebase master </code></pre> <p>Edit:</p> <p>I tried what I suggested and it doesn't work. knittl's suggestion doesn't work (on my box). Here's what did work for me:</p> <pre><code>git rebase --onto master foo bar </code></pre> | 119, 1879, 2193 | branch, git, split | <h1>How to split a git branch into two branches?</h1>
<p>I'm trying to help out a coworker who accidentally created one feature branch from another feature branch, rather than creating the second one from master. Here is essentially what we have now…</p>
<pre><code>Master ---A---B---C
\
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,266 | git | # How to split a git branch into two branches?
I'm trying to help out a coworker who accidentally created one feature branch from another feature branch, rather than creating the second one from master. Here is essentially what we have now…
```
Master ---A---B---C
\
Foo E---F---F---... | It looks to me like you could:
```
git checkout J
git rebase master
```
Edit:
I tried what I suggested and it doesn't work. knittl's suggestion doesn't work (on my box). Here's what did work for me:
```
git rebase --onto master foo bar
``` |
10873882 | How to use --color-words with git add --patch? | 67 | 2012-06-03 20:54:17 | <p>When diffing files, I prefer to use <code>git diff --color-words</code>. Is there a way to make this the default format for diffs when using <code>git add --patch</code> or <code>git add --interactive</code>?</p>
| 6,717 | 480,993 | 2021-10-01 04:22:51 | 37,817,331 | 21 | 2016-06-14 16:19:40 | 2,471,983 | 2016-06-14 16:19:40 | https://stackoverflow.com/q/10873882 | https://stackoverflow.com/a/37817331 | <p>Building off of what VonC said:</p>
<p>Starting with Git 2.9, you can use this command to color words during <code>add --patch</code>:</p>
<pre><code>git -c interactive.diffFilter="git diff --color-words" add -p
</code></pre>
<p>This sets the <code>interactive.diffFilter</code> variable for the call to <code>add ... | <p>Building off of what VonC said:</p> <p>Starting with Git 2.9, you can use this command to color words during <code>add --patch</code>:</p> <pre><code>git -c interactive.diffFilter="git diff --color-words" add -p </code></pre> <p>This sets the <code>interactive.diffFilter</code> variable for the call to <code>add ... | 119 | git | <h1>How to use --color-words with git add --patch?</h1>
<p>When diffing files, I prefer to use <code>git diff --color-words</code>. Is there a way to make this the default format for diffs when using <code>git add --patch</code> or <code>git add --interactive</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,267 | git | # How to use --color-words with git add --patch?
When diffing files, I prefer to use `git diff --color-words`. Is there a way to make this the default format for diffs when using `git add --patch` or `git add --interactive`? | Building off of what VonC said:
Starting with Git 2.9, you can use this command to color words during `add --patch`:
```
git -c interactive.diffFilter="git diff --color-words" add -p
```
This sets the `interactive.diffFilter` variable for the call to `add -p` without affecting further calls. For me this is ideal bec... |
22355612 | How to undo the last commit in git, but keep my changes as unstaged? | 57 | 2014-03-12 15:05:22 | <p>I've made a commit, but now it is kind of difficult to see what I all changed. I can off course do a git diff, but I'd rather undo the last commit and keep all my changes in tact so that my IDE (PyCharm) simply shows me which files have been changed.</p>
<p>So is there a way to undo the last commit (really remove i... | 49,495 | 1,650,012 | 2023-11-10 15:33:12 | 22,355,728 | 21 | 2014-03-12 15:10:05 | 122,150 | 2014-03-12 15:10:05 | https://stackoverflow.com/q/22355612 | https://stackoverflow.com/a/22355728 | <p>This sounds like a job for <code>git reset --soft</code>, whose help (<code>git help reset</code>) says this:</p>
<pre><code>--soft
Does not touch the index file nor the working tree at all
(but resets the head to <commit>, just like all modes do).
This leaves all your changed files "Changes to be... | <p>This sounds like a job for <code>git reset --soft</code>, whose help (<code>git help reset</code>) says this:</p> <pre><code>--soft Does not touch the index file nor the working tree at all (but resets the head to <commit>, just like all modes do). This leaves all your changed files "Changes to be... | 119, 34403, 74978 | git, git-revert, git-stage | <h1>How to undo the last commit in git, but keep my changes as unstaged?</h1>
<p>I've made a commit, but now it is kind of difficult to see what I all changed. I can off course do a git diff, but I'd rather undo the last commit and keep all my changes in tact so that my IDE (PyCharm) simply shows me which files have be... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,268 | git | # How to undo the last commit in git, but keep my changes as unstaged?
I've made a commit, but now it is kind of difficult to see what I all changed. I can off course do a git diff, but I'd rather undo the last commit and keep all my changes in tact so that my IDE (PyCharm) simply shows me which files have been change... | This sounds like a job for `git reset --soft`, whose help (`git help reset`) says this:
```
--soft
Does not touch the index file nor the working tree at all
(but resets the head to <commit>, just like all modes do).
This leaves all your changed files "Changes to be
committed", as git status would put i... |
7642273 | What's the difference "origin master" vs "origin/master" | 51 | 2011-10-04 00:54:55 | <p>What is the difference between a space and a slash when running git commands?</p>
<p>I sometimes see</p>
<p><code>git push origin master</code> (which is a space)</p>
<p>and other times I see</p>
<p><code>git rebase origin/master</code> (which uses a slash)</p>
<p>What is the difference in this convention? Is ... | 7,590 | 793,454 | 2017-11-13 12:02:28 | 7,642,280 | 21 | 2011-10-04 00:56:38 | 582 | 2011-10-04 00:56:38 | https://stackoverflow.com/q/7642273 | https://stackoverflow.com/a/7642280 | <p>This is not a "convention". The former is two separate arguments in different positions with different meanings to <code>git push</code>, and the latter is a single argument which identifies the remote-tracking branch <code>origin/master</code>.</p>
| <p>This is not a "convention". The former is two separate arguments in different positions with different meanings to <code>git push</code>, and the latter is a single argument which identifies the remote-tracking branch <code>origin/master</code>.</p> | 119 | git | <h1>What's the difference "origin master" vs "origin/master"</h1>
<p>What is the difference between a space and a slash when running git commands?</p>
<p>I sometimes see</p>
<p><code>git push origin master</code> (which is a space)</p>
<p>and other times I see</p>
<p><code>git rebase origin/master</code> (which use... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,269 | git | # What's the difference "origin master" vs "origin/master"
What is the difference between a space and a slash when running git commands?
I sometimes see
`git push origin master` (which is a space)
and other times I see
`git rebase origin/master` (which uses a slash)
What is the difference in this convention? Is i... | This is not a "convention". The former is two separate arguments in different positions with different meanings to `git push`, and the latter is a single argument which identifies the remote-tracking branch `origin/master`. |
30746035 | git merge "deleted by us" | 40 | 2015-06-10 02:22:17 | <p>I am doing a big merge.
A lot of files have been removed from the repo in my branch, and in doing the merge I want to keep this change for all of those files.
There are also some files that will need explicit merging and I'm intending to use <code>git mergetool</code> to merge them.</p>
<p>I wish to keep the "delet... | 46,422 | 1,290,746 | 2021-10-05 21:21:50 | 35,889,666 | 21 | 2016-03-09 10:59:20 | 2,670,370 | 2021-10-05 21:21:50 | https://stackoverflow.com/q/30746035 | https://stackoverflow.com/a/35889666 | <p><strong>One line</strong> fix:</p>
<pre><code>git diff --name-only --diff-filter=U | xargs git rm
</code></pre>
<p>Explanation:</p>
<p>Resolve the conflicting modified files first and add them to the staging area, then use the <code>diff-filter</code> to delete remaining unmerged files. Here the documentation (<code... | <p><strong>One line</strong> fix:</p> <pre><code>git diff --name-only --diff-filter=U | xargs git rm </code></pre> <p>Explanation:</p> <p>Resolve the conflicting modified files first and add them to the staging area, then use the <code>diff-filter</code> to delete remaining unmerged files. Here the documentation (<code... | 119, 717 | git, merge | <h1>git merge "deleted by us"</h1>
<p>I am doing a big merge.
A lot of files have been removed from the repo in my branch, and in doing the merge I want to keep this change for all of those files.
There are also some files that will need explicit merging and I'm intending to use <code>git mergetool</code> to merge them... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,274 | git | # git merge "deleted by us"
I am doing a big merge.
A lot of files have been removed from the repo in my branch, and in doing the merge I want to keep this change for all of those files.
There are also some files that will need explicit merging and I'm intending to use `git mergetool` to merge them.
I wish to keep th... | **One line** fix:
```
git diff --name-only --diff-filter=U | xargs git rm
```
Explanation:
Resolve the conflicting modified files first and add them to the staging area, then use the `diff-filter` to delete remaining unmerged files. Here the documentation (`man git-diff`):
> ```
> --diff-filter=[(A|C|D|M|R|T|U|X... |
5133641 | Mercurial error *** failed to import extension hggit: No module named hggit | 40 | 2011-02-27 14:06:28 | <p>I installed Mercurial on my Mac, and it's wonderful. For me it's easier to grasp than Git so I wanted to use it to manage git-repositories. Therefore I installed hg-git with the following instructions:</p>
<p><a href="http://hg-git.github.com/" rel="nofollow noreferrer">http://hg-git.github.com/</a></p>
<p>However... | 23,501 | 584,634 | 2022-08-05 12:19:29 | 5,133,779 | 21 | 2011-02-27 14:37:29 | 265,261 | 2011-02-28 13:19:21 | https://stackoverflow.com/q/5133641 | https://stackoverflow.com/a/5133779 | <p>After installing hg-git with the following command:</p>
<pre><code>easy_install hg-git
</code></pre>
<p>Does the following work?</p>
<pre><code>python -c "import hggit"
</code></pre>
<p>What does this say for you:</p>
<pre><code>head -n1 `which hg`
</code></pre>
<p>The point of the latter command is to verify ... | <p>After installing hg-git with the following command:</p> <pre><code>easy_install hg-git </code></pre> <p>Does the following work?</p> <pre><code>python -c "import hggit" </code></pre> <p>What does this say for you:</p> <pre><code>head -n1 `which hg` </code></pre> <p>The point of the latter command is to verify ... | 16, 369, 802, 51230 | hg-git, macos, mercurial, python | <h1>Mercurial error *** failed to import extension hggit: No module named hggit</h1>
<p>I installed Mercurial on my Mac, and it's wonderful. For me it's easier to grasp than Git so I wanted to use it to manage git-repositories. Therefore I installed hg-git with the following instructions:</p>
<p><a href="http://hg-gi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,275 | git | # Mercurial error *** failed to import extension hggit: No module named hggit
I installed Mercurial on my Mac, and it's wonderful. For me it's easier to grasp than Git so I wanted to use it to manage git-repositories. Therefore I installed hg-git with the following instructions:
<http://hg-git.github.com/>
However, ... | After installing hg-git with the following command:
```
easy_install hg-git
```
Does the following work?
```
python -c "import hggit"
```
What does this say for you:
```
head -n1 `which hg`
```
The point of the latter command is to verify that the Python hg runs under has hggit installed. In my case it says '#!/u... |
62969425 | git interactive rebase - edit vs break | 39 | 2020-07-18 13:59:05 | <p>I'd like to know what the difference is between <code>edit</code> and <code>break</code> in the interactive mode of <code>git rebase -i</code>.</p>
<p>According to the comments, <code>edit</code> uses the commit, but stops for amending, while <code>break</code> stops at the specified location. But then what is the d... | 9,358 | 7,772,088 | 2024-07-02 05:36:37 | 62,969,493 | 21 | 2020-07-18 14:06:09 | 6,309 | 2023-10-11 14:44:13 | https://stackoverflow.com/q/62969425 | https://stackoverflow.com/a/62969493 | <p>The <a href="https://git-scm.com/docs/git-rebase#_interactive_mode" rel="noreferrer">documentation</a> mentions:</p>
<blockquote>
<p>To interrupt the rebase (just like an "<code>edit</code>" command would do, but without cherry-picking any commit first), use the "<code>break</code>" command.</p>
... | <p>The <a href="https://git-scm.com/docs/git-rebase#_interactive_mode" rel="noreferrer">documentation</a> mentions:</p> <blockquote> <p>To interrupt the rebase (just like an "<code>edit</code>" command would do, but without cherry-picking any commit first), use the "<code>break</code>" command.</p> ... | 119, 8974, 29934 | git, git-rebase, rebase | <h1>git interactive rebase - edit vs break</h1>
<p>I'd like to know what the difference is between <code>edit</code> and <code>break</code> in the interactive mode of <code>git rebase -i</code>.</p>
<p>According to the comments, <code>edit</code> uses the commit, but stops for amending, while <code>break</code> stops a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,276 | git | # git interactive rebase - edit vs break
I'd like to know what the difference is between `edit` and `break` in the interactive mode of `git rebase -i`.
According to the comments, `edit` uses the commit, but stops for amending, while `break` stops at the specified location. But then what is the difference between:
``... | The [documentation](https://git-scm.com/docs/git-rebase#_interactive_mode) mentions:
> To interrupt the rebase (just like an "`edit`" command would do, but without cherry-picking any commit first), use the "`break`" command.
In your case, the differences are:
- with `edit` on commit 3, you can still amend the files ... |
20242880 | How do I discard changes for a file in Git Gui? | 39 | 2013-11-27 12:44:30 | <p>Often when using Git Gui I would like to reset/checkout a single file or just dismiss a hunk.</p>
<p>Is there a way to do this easily in Git Gui? If not, is there any particular reason that this feature is not available in Git Gui?</p>
| 47,857 | 400,384 | 2020-01-09 21:49:29 | 20,243,103 | 21 | 2013-11-27 12:54:35 | 982,542 | 2019-04-03 10:28:48 | https://stackoverflow.com/q/20242880 | https://stackoverflow.com/a/20243103 | <p>I know this way:</p>
<ol>
<li>The changes must be unstaged</li>
<li>Go to <strong>Tools</strong> -> <strong>Add</strong></li>
<li>Choose whatever name you'd like for your command, then in <strong>Command</strong> write<br>
<code>git checkout $REVISION -- $FILENAME</code></li>
<li>Select (left-click) the file you wa... | <p>I know this way:</p> <ol> <li>The changes must be unstaged</li> <li>Go to <strong>Tools</strong> -> <strong>Add</strong></li> <li>Choose whatever name you'd like for your command, then in <strong>Command</strong> write<br> <code>git checkout $REVISION -- $FILENAME</code></li> <li>Select (left-click) the file you wa... | 119, 33729 | git, git-gui | <h1>How do I discard changes for a file in Git Gui?</h1>
<p>Often when using Git Gui I would like to reset/checkout a single file or just dismiss a hunk.</p>
<p>Is there a way to do this easily in Git Gui? If not, is there any particular reason that this feature is not available in Git Gui?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,277 | git | # How do I discard changes for a file in Git Gui?
Often when using Git Gui I would like to reset/checkout a single file or just dismiss a hunk.
Is there a way to do this easily in Git Gui? If not, is there any particular reason that this feature is not available in Git Gui? | I know this way:
1. The changes must be unstaged
2. Go to **Tools** -> **Add**
3. Choose whatever name you'd like for your command, then in **Command** write
`git checkout $REVISION -- $FILENAME`
4. Select (left-click) the file you want to checkout, without staging
5. Choose from **Tools** the command you just cr... |
8060289 | How do I add further changes to a stash in Git | 39 | 2011-11-09 04:17:52 | <p>Suppose that I have stashed some changes and I want to add further changes into the same stash (such as <code>stash@{0}</code>). Is there an easy way to do this? What about combining two stashes into a single one?</p>
| 19,805 | 165,495 | 2024-03-01 17:00:54 | 8,060,523 | 21 | 2011-11-09 04:59:24 | 6,309 | 2016-10-21 11:52:38 | https://stackoverflow.com/q/8060289 | https://stackoverflow.com/a/8060523 | <p>I don't see any "<code>git stash</code>" option allowing to modify an existing git stash.</p>
<p>A possible way to achieve this would be:</p>
<ul>
<li>stash your additional changes (<code>stash@{1}</code>)</li>
<li>stash everything else (<code>stash@{2}</code>)</li>
<li>create a <code>tmp</code> branch from the co... | <p>I don't see any "<code>git stash</code>" option allowing to modify an existing git stash.</p> <p>A possible way to achieve this would be:</p> <ul> <li>stash your additional changes (<code>stash@{1}</code>)</li> <li>stash everything else (<code>stash@{2}</code>)</li> <li>create a <code>tmp</code> branch from the co... | 119, 13091 | git, git-stash | <h1>How do I add further changes to a stash in Git</h1>
<p>Suppose that I have stashed some changes and I want to add further changes into the same stash (such as <code>stash@{0}</code>). Is there an easy way to do this? What about combining two stashes into a single one?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,278 | git | # How do I add further changes to a stash in Git
Suppose that I have stashed some changes and I want to add further changes into the same stash (such as `stash@{0}`). Is there an easy way to do this? What about combining two stashes into a single one? | I don't see any "`git stash`" option allowing to modify an existing git stash.
A possible way to achieve this would be:
- stash your additional changes (`stash@{1}`)
- stash everything else (`stash@{2}`)
- create a `tmp` branch from the commit (`HEAD`) your are currently modifying
- `git stash pop` twice
- `git stash... |
39707402 | Why does git worktree add create a branch, and can I delete it? | 36 | 2016-09-26 16:01:16 | <p>I used <code>git worktree add</code> to create a new worktree. I noticed that is has created a new branch in the repo with the same name as the worktree. What is this branch for?</p>
<p>I have checked out an other, pre-existing branch in the second worktree. Am I free to delete the branch that <code>git worktree ad... | 45,028 | 746,346 | 2025-11-30 07:52:52 | 39,709,826 | 21 | 2016-09-26 18:25:14 | 865,874 | 2016-09-26 18:25:14 | https://stackoverflow.com/q/39707402 | https://stackoverflow.com/a/39709826 | <p>The branch is necessary because you cannot have the same branch checked out in different worktrees at the same time.</p>
<p>So if you do not specify a branch when adding the worktree, then git will add one automatically, based on your current branch and with the name of the worktree directory.</p>
<p>You may ask, ... | <p>The branch is necessary because you cannot have the same branch checked out in different worktrees at the same time.</p> <p>So if you do not specify a branch when adding the worktree, then git will add one automatically, based on your current branch and with the name of the worktree directory.</p> <p>You may ask, ... | 119, 117020 | git, git-worktree | <h1>Why does git worktree add create a branch, and can I delete it?</h1>
<p>I used <code>git worktree add</code> to create a new worktree. I noticed that is has created a new branch in the repo with the same name as the worktree. What is this branch for?</p>
<p>I have checked out an other, pre-existing branch in the s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,279 | git | # Why does git worktree add create a branch, and can I delete it?
I used `git worktree add` to create a new worktree. I noticed that is has created a new branch in the repo with the same name as the worktree. What is this branch for?
I have checked out an other, pre-existing branch in the second worktree. Am I free t... | The branch is necessary because you cannot have the same branch checked out in different worktrees at the same time.
So if you do not specify a branch when adding the worktree, then git will add one automatically, based on your current branch and with the name of the worktree directory.
You may ask, why cannot I have... |
4898837 | How to find last merge in git? | 36 | 2011-02-04 14:05:17 | <p>For a web site, I have master and staging, I have worked on staging for about 10 days. How do I tell for sure what has changed since my last merge, or when that merge was? Most of the merges I have done end up being FFs so I can't log them like <code>git merge branch -m 'merging staging'</code> (git reports it ignor... | 36,973 | 289,004 | 2023-10-10 09:43:50 | 4,898,869 | 21 | 2011-02-04 14:08:08 | 114,930 | 2023-10-10 09:43:50 | https://stackoverflow.com/q/4898837 | https://stackoverflow.com/a/4898869 | <p>Try this, it will select the last branch where the commit message starts with "Merge":</p>
<pre><code>git show :/^Merge
</code></pre>
<p><a href="https://web.archive.org/web/20111122032830/http://mislav.uniqpath.com/2010/07/git-tips/" rel="nofollow noreferrer">Here</a>'s a website with a few git tips that ... | <p>Try this, it will select the last branch where the commit message starts with "Merge":</p> <pre><code>git show :/^Merge </code></pre> <p><a href="https://web.archive.org/web/20111122032830/http://mislav.uniqpath.com/2010/07/git-tips/" rel="nofollow noreferrer">Here</a>'s a website with a few git tips that ... | 119 | git | <h1>How to find last merge in git?</h1>
<p>For a web site, I have master and staging, I have worked on staging for about 10 days. How do I tell for sure what has changed since my last merge, or when that merge was? Most of the merges I have done end up being FFs so I can't log them like <code>git merge branch -m 'mergi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,280 | git | # How to find last merge in git?
For a web site, I have master and staging, I have worked on staging for about 10 days. How do I tell for sure what has changed since my last merge, or when that merge was? Most of the merges I have done end up being FFs so I can't log them like `git merge branch -m 'merging staging'` (... | Try this, it will select the last branch where the commit message starts with "Merge":
```
git show :/^Merge
```
[Here](https://web.archive.org/web/20111122032830/http://mislav.uniqpath.com/2010/07/git-tips/)'s a website with a few git tips that might help you out. |
6063944 | Can you interact with the index/staging area with TortoiseGit? | 33 | 2011-05-19 19:35:33 | <p>I've been tasked with giving a presentation on Git to my colleagues, who are almost entirely Windows users who are used to using TortoiseCVS. I've been using Git for about a year, but I almost exclusively used the Unix command line interface.</p>
<p>So I've been trying to get familiar with the Windows GUI Git tools... | 6,730 | 352,061 | 2016-12-20 04:39:48 | 6,064,336 | 21 | 2011-05-19 20:13:31 | 520,162 | 2013-06-18 21:14:22 | https://stackoverflow.com/q/6063944 | https://stackoverflow.com/a/6064336 | <p>The answer is: <strong>no, you can't</strong>.</p>
<p>For me, TortoiseGit is a tool that you can use to make the transition from – in your case – CVS to Git easier (like I wrote in my answer to <a href="https://stackoverflow.com/questions/5645732/does-tortoisegit-actually-make-git-a-lot-easier... | <p>The answer is: <strong>no, you can't</strong>.</p> <p>For me, TortoiseGit is a tool that you can use to make the transition from – in your case – CVS to Git easier (like I wrote in my answer to <a href="https://stackoverflow.com/questions/5645732/does-tortoisegit-actually-make-git-a-lot-easier... | 119, 31409 | git, tortoisegit | <h1>Can you interact with the index/staging area with TortoiseGit?</h1>
<p>I've been tasked with giving a presentation on Git to my colleagues, who are almost entirely Windows users who are used to using TortoiseCVS. I've been using Git for about a year, but I almost exclusively used the Unix command line interface.</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,281 | git | # Can you interact with the index/staging area with TortoiseGit?
I've been tasked with giving a presentation on Git to my colleagues, who are almost entirely Windows users who are used to using TortoiseCVS. I've been using Git for about a year, but I almost exclusively used the Unix command line interface.
So I've be... | The answer is: **no, you can't**.
For me, TortoiseGit is a tool that you can use to make the transition from – in your case – CVS to Git easier (like I wrote in my answer to [Does TortoiseGit actually make Git a lot easier to use like TortoiseSVN?](https://stackoverflow.com/questions/5645732/does-tortoisegit-actually-... |
28355016 | git - squash before rebasing | 30 | 2015-02-05 22:08:54 | <p>I have two branches: <code>master</code> and <code>test-branch</code> (which is branched off of <code>master</code>). My work has looked something like the following:</p>
<ol>
<li><code>git checkout master</code></li>
<li><code>git checkout -b test-branch</code></li>
<li>make a bunch of changes and commit them</li>... | 20,483 | 1,489,726 | 2015-02-05 23:09:02 | 28,355,804 | 21 | 2015-02-05 23:09:02 | 1,256,452 | 2015-02-05 23:09:02 | https://stackoverflow.com/q/28355016 | https://stackoverflow.com/a/28355804 | <p>It is possible, even easy. Git being what it is, there are many different ways to do it.</p>
<p>To literally do what you suggested originally:</p>
<blockquote>
<p>... squash all of the commits on test-branch before rebasing</p>
</blockquote>
<p>is easiest if you do it <em>before</em> running <code>git merge</c... | <p>It is possible, even easy. Git being what it is, there are many different ways to do it.</p> <p>To literally do what you suggested originally:</p> <blockquote> <p>... squash all of the commits on test-branch before rebasing</p> </blockquote> <p>is easiest if you do it <em>before</em> running <code>git merge</c... | 119, 8974, 29934 | git, git-rebase, rebase | <h1>git - squash before rebasing</h1>
<p>I have two branches: <code>master</code> and <code>test-branch</code> (which is branched off of <code>master</code>). My work has looked something like the following:</p>
<ol>
<li><code>git checkout master</code></li>
<li><code>git checkout -b test-branch</code></li>
<li>make a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,283 | git | # git - squash before rebasing
I have two branches: `master` and `test-branch` (which is branched off of `master`). My work has looked something like the following:
1. `git checkout master`
2. `git checkout -b test-branch`
3. make a bunch of changes and commit them
4. make more changes and do another commit
5. `git c... | It is possible, even easy. Git being what it is, there are many different ways to do it.
To literally do what you suggested originally:
> ... squash all of the commits on test-branch before rebasing
is easiest if you do it *before* running `git merge` while on branch `master`. (I know you didn't list `git merge` as ... |
24197606 | What's the difference between git diff and gif diff-index | 30 | 2014-06-13 04:15:27 | <p>When I want to get git diff files, I found someone use </p>
<pre><code>git diff-index --cached --diff-filter=AM --name-only HEAD
</code></pre>
<p>and if I use </p>
<pre><code>git diff --cached --diff-filter=AM --name-only HEAD
</code></pre>
<p>can get the same result.
So what's the difference between <code>g... | 21,400 | 3,064,124 | 2023-09-21 20:12:09 | 24,198,534 | 21 | 2014-06-13 05:48:56 | 6,309 | 2023-09-21 20:12:09 | https://stackoverflow.com/q/24197606 | https://stackoverflow.com/a/24198534 | <p><a href="http://git-scm.com/docs/git-diff-index" rel="nofollow noreferrer"><code>git diff-index</code></a> is a diff against the index or working tree:</p>
<blockquote>
<p>Compares the content and mode of the blobs found in a tree object with the corresponding tracked files in the working tree, or with the correspon... | <p><a href="http://git-scm.com/docs/git-diff-index" rel="nofollow noreferrer"><code>git diff-index</code></a> is a diff against the index or working tree:</p> <blockquote> <p>Compares the content and mode of the blobs found in a tree object with the corresponding tracked files in the working tree, or with the correspon... | 119 | git | <h1>What's the difference between git diff and gif diff-index</h1>
<p>When I want to get git diff files, I found someone use </p>
<pre><code>git diff-index --cached --diff-filter=AM --name-only HEAD
</code></pre>
<p>and if I use </p>
<pre><code>git diff --cached --diff-filter=AM --name-only HEAD
</code></pre>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,284 | git | # What's the difference between git diff and gif diff-index
When I want to get git diff files, I found someone use
```
git diff-index --cached --diff-filter=AM --name-only HEAD
```
and if I use
```
git diff --cached --diff-filter=AM --name-only HEAD
```
can get the same result.
So what's the difference between ... | [`git diff-index`](http://git-scm.com/docs/git-diff-index) is a diff against the index or working tree:
> Compares the content and mode of the blobs found in a tree object with the corresponding tracked files in the working tree, or with the corresponding paths in the index
[`git diff`](http://git-scm.com/docs/git-di... |
22289849 | Why is visual studio committing files in my .gitignore file? | 29 | 2014-03-09 23:50:11 | <p>I'm using Visual Studio 2013 Express using Git on a project.</p>
<p>I created my repository and copied the project files into it from another directory. I then checked my <code>.gitignore</code> and <code>.gitattributes</code> files. <code>.gitignore</code> was pre-configured and looked to cover everything I need... | 13,738 | 939,634 | 2015-05-22 13:08:28 | 28,802,025 | 21 | 2015-03-02 02:57:32 | 316,857 | 2015-03-02 03:03:04 | https://stackoverflow.com/q/22289849 | https://stackoverflow.com/a/28802025 | <p>@dustinmoris is right in <a href="https://stackoverflow.com/a/28637437/316857">his answer</a>, but the fix is not as immediately obvious as the procedure would lead you to believe. So let me explicitly walk you through the process to make sure the files in your <code>.gitignore</code> file are obeyed by Visual Stud... | <p>@dustinmoris is right in <a href="https://stackoverflow.com/a/28637437/316857">his answer</a>, but the fix is not as immediately obvious as the procedure would lead you to believe. So let me explicitly walk you through the process to make sure the files in your <code>.gitignore</code> file are obeyed by Visual Stud... | 119, 25056, 93364 | git, gitignore, visual-studio-2013 | <h1>Why is visual studio committing files in my .gitignore file?</h1>
<p>I'm using Visual Studio 2013 Express using Git on a project.</p>
<p>I created my repository and copied the project files into it from another directory. I then checked my <code>.gitignore</code> and <code>.gitattributes</code> files. <code>.git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,285 | git | # Why is visual studio committing files in my .gitignore file?
I'm using Visual Studio 2013 Express using Git on a project.
I created my repository and copied the project files into it from another directory. I then checked my `.gitignore` and `.gitattributes` files. `.gitignore` was pre-configured and looked to cove... | @dustinmoris is right in [his answer](https://stackoverflow.com/a/28637437/316857), but the fix is not as immediately obvious as the procedure would lead you to believe. So let me explicitly walk you through the process to make sure the files in your `.gitignore` file are obeyed by Visual Studio.
**1. Create Your Solu... |
7932222 | How to revert two commits back and commit only good stuff? | 29 | 2011-10-28 16:43:14 | <p>I commited something wrong twice. How to revert two commits back and commit only good stuff ?</p>
| 54,709 | 486,578 | 2019-12-27 23:24:43 | 7,932,330 | 21 | 2011-10-28 16:52:54 | 229,602 | 2011-10-28 16:52:54 | https://stackoverflow.com/q/7932222 | https://stackoverflow.com/a/7932330 | <p>You can do a <code>git rebase -i HEAD~2</code> and then use the interface to discard the "bad commits" that are there since then and clean up your history. This however alters the project history and if you've already pushed (and others pulled) your changes, there are some social issues to work out. </p>
<p>The oth... | <p>You can do a <code>git rebase -i HEAD~2</code> and then use the interface to discard the "bad commits" that are there since then and clean up your history. This however alters the project history and if you've already pushed (and others pulled) your changes, there are some social issues to work out. </p> <p>The oth... | 119 | git | <h1>How to revert two commits back and commit only good stuff?</h1>
<p>I commited something wrong twice. How to revert two commits back and commit only good stuff ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,286 | git | # How to revert two commits back and commit only good stuff?
I commited something wrong twice. How to revert two commits back and commit only good stuff ? | You can do a `git rebase -i HEAD~2` and then use the interface to discard the "bad commits" that are there since then and clean up your history. This however alters the project history and if you've already pushed (and others pulled) your changes, there are some social issues to work out.
The other option is to `git r... |
2626964 | What user runs the git hook? | 29 | 2010-04-13 04:26:53 | <p>I have a post-update hook on my server, such that when I </p>
<pre><code>git push
</code></pre>
<p>it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.</p>
<p>The hook is pretty simple:</p>
<pre><code>#!/bin/sh
#
# An example hook script to prep... | 14,686 | 100,208 | 2014-09-15 21:43:45 | 2,626,988 | 21 | 2010-04-13 04:31:44 | 119,963 | 2010-04-13 04:31:44 | https://stackoverflow.com/q/2626964 | https://stackoverflow.com/a/2626988 | <p>The hooks are run as the user doing the push. If you have some kind of pre-made setup, that may be a user like <code>git</code> or <code>gitosis</code>, or it may be you. Just look at how you have the remote configured. (<code>git remote show <remote-name></code> or just examine .git/config if you don't know) ... | <p>The hooks are run as the user doing the push. If you have some kind of pre-made setup, that may be a user like <code>git</code> or <code>gitosis</code>, or it may be you. Just look at how you have the remote configured. (<code>git remote show <remote-name></code> or just examine .git/config if you don't know) ... | 119, 853 | git, hook | <h1>What user runs the git hook?</h1>
<p>I have a post-update hook on my server, such that when I </p>
<pre><code>git push
</code></pre>
<p>it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.</p>
<p>The hook is pretty simple:</p>
<pre><code>#!/bin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,287 | git | # What user runs the git hook?
I have a post-update hook on my server, such that when I
```
git push
```
it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.
The hook is pretty simple:
```
#!/bin/sh
#
# An example hook script to prepare a packed r... | The hooks are run as the user doing the push. If you have some kind of pre-made setup, that may be a user like `git` or `gitosis`, or it may be you. Just look at how you have the remote configured. (`git remote show <remote-name>` or just examine .git/config if you don't know) Presumably you're pushing via SSH, and the... |
33534411 | How to "rebase tags" in git? | 28 | 2015-11-05 00:02:15 | <p>Suppose I have the following simple git repository: a single branch, some commits one after another, a couple of them having been tagged (with <em>annotated</em> tags) after committing each of them, and then one day I decide I want to change the first commit (which, by the way, is not tagged, if that changes anythin... | 23,056 | null | 2023-04-30 06:05:34 | 33,537,739 | 21 | 2015-11-05 06:07:01 | 1,256,452 | 2015-11-06 05:03:40 | https://stackoverflow.com/q/33534411 | https://stackoverflow.com/a/33537739 | <p>In one sense, it's too late (but hang on, there's good news). The <code>filter-branch</code> code is able to adjust the tags because it keeps, during its filtering, a mapping of old-sha1 to new-sha1.</p>
<p>In fact, both <code>filter-branch</code> and <code>rebase</code> use the same basic idea, which is that each... | <p>In one sense, it's too late (but hang on, there's good news). The <code>filter-branch</code> code is able to adjust the tags because it keeps, during its filtering, a mapping of old-sha1 to new-sha1.</p> <p>In fact, both <code>filter-branch</code> and <code>rebase</code> use the same basic idea, which is that each... | 119, 8974, 29934, 60718 | git, git-rebase, git-tag, rebase | <h1>How to "rebase tags" in git?</h1>
<p>Suppose I have the following simple git repository: a single branch, some commits one after another, a couple of them having been tagged (with <em>annotated</em> tags) after committing each of them, and then one day I decide I want to change the first commit (which, by the way, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,288 | git | # How to "rebase tags" in git?
Suppose I have the following simple git repository: a single branch, some commits one after another, a couple of them having been tagged (with *annotated* tags) after committing each of them, and then one day I decide I want to change the first commit (which, by the way, is not tagged, i... | In one sense, it's too late (but hang on, there's good news). The `filter-branch` code is able to adjust the tags because it keeps, during its filtering, a mapping of old-sha1 to new-sha1.
In fact, both `filter-branch` and `rebase` use the same basic idea, which is that each commit is *copied*, by expanding the origin... |
9446689 | Rename file for all commits in a Git repository | 28 | 2012-02-25 18:18:03 | <p>I want to rename a file for all the commits in Git repository. Here's what I have tried:</p>
<pre><code>git filter-branch --index-filter 'git mv -k <old name> <new name>' HEAD
</code></pre>
<p>This command went through all the commits in the repository, but it ended up with the message:</p>
<blockquote>
... | 7,856 | 671,728 | 2024-11-21 20:09:14 | 9,458,637 | 21 | 2012-02-27 00:20:41 | 671,728 | 2016-01-26 03:32:35 | https://stackoverflow.com/q/9446689 | https://stackoverflow.com/a/9458637 | <p>I finally solved my original problem by using:</p>
<pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter '
if [ -f <old name> ]; then
mv <old name> <new name>
fi' --force HEAD
</code></pre>
| <p>I finally solved my original problem by using:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter ' if [ -f <old name> ]; then mv <old name> <new name> fi' --force HEAD </code></pre> | 119 | git | <h1>Rename file for all commits in a Git repository</h1>
<p>I want to rename a file for all the commits in Git repository. Here's what I have tried:</p>
<pre><code>git filter-branch --index-filter 'git mv -k <old name> <new name>' HEAD
</code></pre>
<p>This command went through all the commits in the reposi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,289 | git | # Rename file for all commits in a Git repository
I want to rename a file for all the commits in Git repository. Here's what I have tried:
```
git filter-branch --index-filter 'git mv -k <old name> <new name>' HEAD
```
This command went through all the commits in the repository, but it ended up with the message:
> ... | I finally solved my original problem by using:
```
git filter-branch --tree-filter '
if [ -f <old name> ]; then
mv <old name> <new name>
fi' --force HEAD
``` |
204461 | git: squash/fixup earlier commit | 28 | 2008-10-15 12:05:07 | <p>Suppose you have:</p>
<pre><code>A-B-C
</code></pre>
<p>Now your build/test fails. The fix should be merged in A.
My current work-flow is like this:</p>
<pre><code>$ git commit -m "fixA"
A-B-C-fixA
$ git rebase -i A~1
</code></pre>
<p>And squash fixA in A, result in: </p>
<pre><code>A'-B-C
</code></pre>
<p>... | 32,106 | 1,277,510 | 2016-03-30 18:56:32 | 4,607,280 | 21 | 2011-01-05 17:39:31 | 525,872 | 2015-05-17 16:56:08 | https://stackoverflow.com/q/204461 | https://stackoverflow.com/a/4607280 | <p><em>If you're just looking for the easy solution for fixing up earlier commits, read the question! It explains it all. But since Elmarco was asking for a slick way, here we go:</em></p>
<p>As of Git 1.7.0, there is an <code>--autosquash</code> option for <a href="https://www.kernel.org/pub/software/scm/git/docs/git... | <p><em>If you're just looking for the easy solution for fixing up earlier commits, read the question! It explains it all. But since Elmarco was asking for a slick way, here we go:</em></p> <p>As of Git 1.7.0, there is an <code>--autosquash</code> option for <a href="https://www.kernel.org/pub/software/scm/git/docs/git... | 119 | git | <h1>git: squash/fixup earlier commit</h1>
<p>Suppose you have:</p>
<pre><code>A-B-C
</code></pre>
<p>Now your build/test fails. The fix should be merged in A.
My current work-flow is like this:</p>
<pre><code>$ git commit -m "fixA"
A-B-C-fixA
$ git rebase -i A~1
</code></pre>
<p>And squash fixA in A, result in: ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,290 | git | # git: squash/fixup earlier commit
Suppose you have:
```
A-B-C
```
Now your build/test fails. The fix should be merged in A.
My current work-flow is like this:
```
$ git commit -m "fixA"
A-B-C-fixA
$ git rebase -i A~1
```
And squash fixA in A, result in:
```
A'-B-C
```
Is there a command to do something like:
... | *If you're just looking for the easy solution for fixing up earlier commits, read the question! It explains it all. But since Elmarco was asking for a slick way, here we go:*
As of Git 1.7.0, there is an `--autosquash` option for [`rebase`](https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html), which does ... |
37075486 | VS Code: What is the difference between push and publish | 27 | 2016-05-06 14:54:12 | <p>On the GIT tab in Visual Studio Code there is an context menu with these items:</p>
<ul>
<li>Sync</li>
<li>Pull</li>
<li>Pull (release)</li>
<li>Push</li>
</ul>
<p>==================</p>
<ul>
<li>Publish</li>
</ul>
<p>==================</p>
<p>...</p>
<p>What does the publish button do?</p>
| 55,521 | 475,727 | 2025-01-16 19:48:40 | 38,996,663 | 21 | 2016-08-17 12:27:34 | 1,104,402 | 2016-11-06 07:04:07 | https://stackoverflow.com/q/37075486 | https://stackoverflow.com/a/38996663 | <p>After checking the source code of Visual Studio Code.</p>
<h1>Push</h1>
<p>Push the <strong>current</strong> branch to the <strong>default</strong> remote <strong>upstream</strong></p>
<pre><code>public run(context?: any):Promise {
return this.gitService.push() // ... removed for brevity
}
</code></pr... | <p>After checking the source code of Visual Studio Code.</p> <h1>Push</h1> <p>Push the <strong>current</strong> branch to the <strong>default</strong> remote <strong>upstream</strong></p> <pre><code>public run(context?: any):Promise { return this.gitService.push() // ... removed for brevity } </code></pr... | 119, 111608 | git, visual-studio-code | <h1>VS Code: What is the difference between push and publish</h1>
<p>On the GIT tab in Visual Studio Code there is an context menu with these items:</p>
<ul>
<li>Sync</li>
<li>Pull</li>
<li>Pull (release)</li>
<li>Push</li>
</ul>
<p>==================</p>
<ul>
<li>Publish</li>
</ul>
<p>==================</p>
<p>...</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,291 | git | # VS Code: What is the difference between push and publish
On the GIT tab in Visual Studio Code there is an context menu with these items:
- Sync
- Pull
- Pull (release)
- Push
==================
- Publish
==================
...
What does the publish button do? | After checking the source code of Visual Studio Code.
# Push
Push the **current** branch to the **default** remote **upstream**
```
public run(context?: any):Promise {
return this.gitService.push() // ... removed for brevity
}
```
### Active when:
There is **UPSTREAM** and recent push/pulls (ahead)
``... |
69120613 | Exception of type 'Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException' was thrown | 26 | 2021-09-09 15:06:15 | <p>While trying to checkout to a new branch in Visual Studio 2019, I'm getting the below error:
<a href="https://i.sstatic.net/2me3e.png" rel="noreferrer"><img src="https://i.sstatic.net/2me3e.png" alt="enter image description here" /></a></p>
<p>I tried to do the same from <code>GitBash cmd</code> using the command <c... | 76,947 | 10,204,642 | 2024-05-15 14:54:41 | 70,278,604 | 21 | 2021-12-08 16:39:50 | 918,079 | 2021-12-08 16:39:50 | https://stackoverflow.com/q/69120613 | https://stackoverflow.com/a/70278604 | <p>I had this same error and solved it the following way, note I am calling my branch as myBranchName...
Within visual studio in the git-manage branches screen, it just shows that error over and over. But, I navigated to the folder in windows, right-mouse context menu and chose 'git bash here' to open bash (which you c... | <p>I had this same error and solved it the following way, note I am calling my branch as myBranchName... Within visual studio in the git-manage branches screen, it just shows that error over and over. But, I navigated to the folder in windows, right-mouse context menu and chose 'git bash here' to open bash (which you c... | 119, 33953 | git, visual-studio | <h1>Exception of type 'Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException' was thrown</h1>
<p>While trying to checkout to a new branch in Visual Studio 2019, I'm getting the below error:
<a href="https://i.sstatic.net/2me3e.png" rel="noreferrer"><img src="https://i.sstatic.net/2me3e.png" alt="enter ima... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,293 | git | # Exception of type 'Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException' was thrown
While trying to checkout to a new branch in Visual Studio 2019, I'm getting the below error:
[](https://i.sstatic.net/2me3e.png)
I tried to do the same f... | I had this same error and solved it the following way, note I am calling my branch as myBranchName...
Within visual studio in the git-manage branches screen, it just shows that error over and over. But, I navigated to the folder in windows, right-mouse context menu and chose 'git bash here' to open bash (which you can ... |
41685791 | How can I save a git "rebase in progress"? | 26 | 2017-01-16 22:07:43 | <p>I'm in the middle of a large "rebase in progress" with numerous <em>conflicts</em>.</p>
<p>I would like to set this progress aside and attempt to resolve this issue using another approach.</p>
<p>Is there a way I can save an <em>in-progress</em> rebase such that I can finish it later?</p>
| 12,100 | 363,701 | 2022-01-10 15:04:35 | 41,687,681 | 21 | 2017-01-17 01:27:40 | 1,256,452 | 2018-01-18 15:53:29 | https://stackoverflow.com/q/41685791 | https://stackoverflow.com/a/41687681 | <p>If you're sitting at a conflicted merge as part of a rebase, you are kind of stuck. Here is why, how, and what you <em>can</em> do.</p>
<h3>Rebase = repeated cherry-pick</h3>
<p>Fundamentally, a rebase operation in Git is just a series of cherry-pick operations. We start with something like this:</p>
<pre><code... | <p>If you're sitting at a conflicted merge as part of a rebase, you are kind of stuck. Here is why, how, and what you <em>can</em> do.</p> <h3>Rebase = repeated cherry-pick</h3> <p>Fundamentally, a rebase operation in Git is just a series of cherry-pick operations. We start with something like this:</p> <pre><code... | 119, 8974 | git, rebase | <h1>How can I save a git "rebase in progress"?</h1>
<p>I'm in the middle of a large "rebase in progress" with numerous <em>conflicts</em>.</p>
<p>I would like to set this progress aside and attempt to resolve this issue using another approach.</p>
<p>Is there a way I can save an <em>in-progress</em> rebase such that ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,294 | git | # How can I save a git "rebase in progress"?
I'm in the middle of a large "rebase in progress" with numerous *conflicts*.
I would like to set this progress aside and attempt to resolve this issue using another approach.
Is there a way I can save an *in-progress* rebase such that I can finish it later? | If you're sitting at a conflicted merge as part of a rebase, you are kind of stuck. Here is why, how, and what you *can* do.
### Rebase = repeated cherry-pick
Fundamentally, a rebase operation in Git is just a series of cherry-pick operations. We start with something like this:
```
...--A1--A2--A3--A4--A5 <-- bran... |
21693295 | What's the svn revert equivalent in git? | 26 | 2014-02-11 04:42:45 | <p>I'm trying to find the equivalent of <code>svn Revert</code> in Git. In <code>svn</code>, when I rigth-click a file then click <code>revert</code>, that will undo all the local edits. the file goes back to the last <code>commit</code>. I can't find the exact same command in Git. Since I'm new, I don't want to mess-u... | 18,748 | 202,382 | 2019-06-05 16:22:34 | 21,697,484 | 21 | 2014-02-11 09:13:23 | 683,080 | 2019-06-05 16:22:34 | https://stackoverflow.com/q/21693295 | https://stackoverflow.com/a/21697484 | <p>Because of the staging area, it's not quite as simple as an <code>svn revert</code>. Depending on what you've done, and what your goal is, you need to use either <code>git checkout</code> or <code>git reset</code>. You need to be careful with <code>git reset</code> though, as you can re-write history and lose work... | <p>Because of the staging area, it's not quite as simple as an <code>svn revert</code>. Depending on what you've done, and what your goal is, you need to use either <code>git checkout</code> or <code>git reset</code>. You need to be careful with <code>git reset</code> though, as you can re-write history and lose work... | 63, 119 | git, svn | <h1>What's the svn revert equivalent in git?</h1>
<p>I'm trying to find the equivalent of <code>svn Revert</code> in Git. In <code>svn</code>, when I rigth-click a file then click <code>revert</code>, that will undo all the local edits. the file goes back to the last <code>commit</code>. I can't find the exact same com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,295 | git | # What's the svn revert equivalent in git?
I'm trying to find the equivalent of `svn Revert` in Git. In `svn`, when I rigth-click a file then click `revert`, that will undo all the local edits. the file goes back to the last `commit`. I can't find the exact same command in Git. Since I'm new, I don't want to mess-up m... | Because of the staging area, it's not quite as simple as an `svn revert`. Depending on what you've done, and what your goal is, you need to use either `git checkout` or `git reset`. You need to be careful with `git reset` though, as you can re-write history and lose work.
Let's say you have the commit graph:
```
A <-... |
10398225 | What is the .git/branches folder used for? | 26 | 2012-05-01 13:19:02 | <p>I have always assumed that the <code>.git/branches</code> directory is for legacy purposes and that git used to use that directory, but now uses the <code>.git/refs</code> directory instead. Is this true? If not, then what is the purpose of that directory since I have never seen it used or referenced.</p>
<p>EDIT<... | 5,094 | 10,608 | 2012-05-01 14:13:02 | 10,398,507 | 21 | 2012-05-01 13:39:23 | 223,092 | 2012-05-01 13:47:31 | https://stackoverflow.com/q/10398225 | https://stackoverflow.com/a/10398507 | <p>The now "slightly deprecated" use of <code>.git/branches</code> is described in the useful <a href="http://schacon.github.com/git/gitrepository-layout.html" rel="noreferrer"><code>gitrepository-layout</code> documentation</a>:</p>
<blockquote>
<p><strong>branches</strong>: A slightly deprecated way to store short... | <p>The now "slightly deprecated" use of <code>.git/branches</code> is described in the useful <a href="http://schacon.github.com/git/gitrepository-layout.html" rel="noreferrer"><code>gitrepository-layout</code> documentation</a>:</p> <blockquote> <p><strong>branches</strong>: A slightly deprecated way to store short... | 119 | git | <h1>What is the .git/branches folder used for?</h1>
<p>I have always assumed that the <code>.git/branches</code> directory is for legacy purposes and that git used to use that directory, but now uses the <code>.git/refs</code> directory instead. Is this true? If not, then what is the purpose of that directory since I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,296 | git | # What is the .git/branches folder used for?
I have always assumed that the `.git/branches` directory is for legacy purposes and that git used to use that directory, but now uses the `.git/refs` directory instead. Is this true? If not, then what is the purpose of that directory since I have never seen it used or refer... | The now "slightly deprecated" use of `.git/branches` is described in the useful [`gitrepository-layout` documentation](http://schacon.github.com/git/gitrepository-layout.html):
> **branches**: A slightly deprecated way to store shorthands to be used to specify URL to *git fetch*, *git pull* and *git push* commands is ... |
4193277 | Looking for decent Git libraries for Java | 26 | 2010-11-16 10:41:27 | <p>I am looking for a decent Git library for Java for stand-alone applications.</p>
<p>Can anyone recommend any?</p>
| 16,283 | 80,389 | 2014-07-07 18:02:47 | 4,193,615 | 21 | 2010-11-16 11:24:37 | 6,309 | 2014-07-07 18:02:47 | https://stackoverflow.com/q/4193277 | https://stackoverflow.com/a/4193615 | <p>I believe you can use <strong><a href="http://www.eclipse.org/jgit/" rel="noreferrer">JGit</a></strong> in your Java application.</p>
<p>The main page includes:</p>
<blockquote>
<p>JGit has very few dependencies, making it suitable for embedding in any Java application, whether or not the application is taking a... | <p>I believe you can use <strong><a href="http://www.eclipse.org/jgit/" rel="noreferrer">JGit</a></strong> in your Java application.</p> <p>The main page includes:</p> <blockquote> <p>JGit has very few dependencies, making it suitable for embedding in any Java application, whether or not the application is taking a... | 17, 119 | git, java | <h1>Looking for decent Git libraries for Java</h1>
<p>I am looking for a decent Git library for Java for stand-alone applications.</p>
<p>Can anyone recommend any?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,297 | git | # Looking for decent Git libraries for Java
I am looking for a decent Git library for Java for stand-alone applications.
Can anyone recommend any? | I believe you can use **[JGit](http://www.eclipse.org/jgit/)** in your Java application.
The main page includes:
> JGit has very few dependencies, making it suitable for embedding in any Java application, whether or not the application is taking advantage of other Eclipse or OSGi technologies.
The [download page](ht... |
28827831 | How to setup Git on local network? | 25 | 2015-03-03 09:08:39 | <p>I downloaded Git setup and trying to setup for computers in my network. I searched for the process but I found it for to host code on line on github.com. I found a few links but there is not the whole process.</p>
<p>I am aware for how to push and pull.</p>
| 63,105 | 3,349,666 | 2021-11-12 20:20:39 | 28,828,988 | 21 | 2015-03-03 10:07:32 | 3,603,336 | 2015-12-08 10:15:31 | https://stackoverflow.com/q/28827831 | https://stackoverflow.com/a/28828988 | <p><strong>To create a new repository</strong></p>
<ol>
<li>Create directory using git bash or create manually</li>
<li><p>User following commands to create repository</p>
<pre><code>cd /repo/path/projectname.git
git init --bare
</code></pre></li>
<li><p>After initialize directory share the directory and grant all pe... | <p><strong>To create a new repository</strong></p> <ol> <li>Create directory using git bash or create manually</li> <li><p>User following commands to create repository</p> <pre><code>cd /repo/path/projectname.git git init --bare </code></pre></li> <li><p>After initialize directory share the directory and grant all pe... | 119, 2090, 6936 | git, lan, offline-mode | <h1>How to setup Git on local network?</h1>
<p>I downloaded Git setup and trying to setup for computers in my network. I searched for the process but I found it for to host code on line on github.com. I found a few links but there is not the whole process.</p>
<p>I am aware for how to push and pull.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,298 | git | # How to setup Git on local network?
I downloaded Git setup and trying to setup for computers in my network. I searched for the process but I found it for to host code on line on github.com. I found a few links but there is not the whole process.
I am aware for how to push and pull. | **To create a new repository**
1. Create directory using git bash or create manually
2. User following commands to create repository
```
cd /repo/path/projectname.git
git init --bare
```
3. After initialize directory share the directory and grant all permission to local group
**To create a local workspac... |
25347534 | Can I sign a git tag after it was created? | 25 | 2014-08-17 08:29:17 | <p>I created a tag and forgot to sign it, then pushed the tag to GitHub. Is it possible to just sign that tag retroactively, or do I have to create a new tag?</p>
<p>I have read the man page for <code>git tag</code> and googled a bit, but have come up with no clues that adding a signature to an already existing tag is... | 2,805 | 1,054,378 | 2024-05-24 09:59:35 | 25,347,576 | 21 | 2014-08-17 08:35:45 | 6,309 | 2023-07-14 21:32:47 | https://stackoverflow.com/q/25347534 | https://stackoverflow.com/a/25347576 | <p>No you would need to::</p>
<ul>
<li><p><a href="https://stackoverflow.com/a/7813236/6309">replace it with a tag using the same name</a>:</p>
<pre><code> git tag <tag name> <tag name> -f -s
</code></pre>
</li>
<li><p>but first set the committer date, in order to not change the date</p>
<pre><code> set G... | <p>No you would need to::</p> <ul> <li><p><a href="https://stackoverflow.com/a/7813236/6309">replace it with a tag using the same name</a>:</p> <pre><code> git tag <tag name> <tag name> -f -s </code></pre> </li> <li><p>but first set the committer date, in order to not change the date</p> <pre><code> set G... | 119, 5254 | git, sign | <h1>Can I sign a git tag after it was created?</h1>
<p>I created a tag and forgot to sign it, then pushed the tag to GitHub. Is it possible to just sign that tag retroactively, or do I have to create a new tag?</p>
<p>I have read the man page for <code>git tag</code> and googled a bit, but have come up with no clues t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,299 | git | # Can I sign a git tag after it was created?
I created a tag and forgot to sign it, then pushed the tag to GitHub. Is it possible to just sign that tag retroactively, or do I have to create a new tag?
I have read the man page for `git tag` and googled a bit, but have come up with no clues that adding a signature to a... | No you would need to::
- [replace it with a tag using the same name](https://stackoverflow.com/a/7813236/6309):
```
git tag <tag name> <tag name> -f -s
```
- but first set the committer date, in order to not change the date
```
set GIT_COMMITTER_DATE="$(git log -1 --format=%aD <tag_name>)"
```
As [m... |
8837980 | Pulling code from remote git branch, when it does not exist locally | 25 | 2012-01-12 15:51:20 | <p>When branch <code>B</code> does not exist locally, but is on the remote repo, </p>
<pre><code>git branch
* A
git branch -a
* A
remotes/origin/B
</code></pre>
<p>How can i pull <code>B</code> to my local repo? Should i <code>git checkout B</code> first? Should i <code>pull</code>, while on branch <code>A</code... | 36,997 | 359,862 | 2021-05-11 20:16:55 | 8,838,019 | 21 | 2012-01-12 15:53:17 | 329,407 | 2012-01-12 15:53:17 | https://stackoverflow.com/q/8837980 | https://stackoverflow.com/a/8838019 | <p>If the local branch <code>b</code> does not exist, then <code>git pull</code> and then simply <code>git checkout b</code> and the branch will be created automatically.
Other options would include a <code>git fetch origin/b</code> </p>
| <p>If the local branch <code>b</code> does not exist, then <code>git pull</code> and then simply <code>git checkout b</code> and the branch will be created automatically. Other options would include a <code>git fetch origin/b</code> </p> | 119 | git | <h1>Pulling code from remote git branch, when it does not exist locally</h1>
<p>When branch <code>B</code> does not exist locally, but is on the remote repo, </p>
<pre><code>git branch
* A
git branch -a
* A
remotes/origin/B
</code></pre>
<p>How can i pull <code>B</code> to my local repo? Should i <code>git check... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,301 | git | # Pulling code from remote git branch, when it does not exist locally
When branch `B` does not exist locally, but is on the remote repo,
```
git branch
* A
git branch -a
* A
remotes/origin/B
```
How can i pull `B` to my local repo? Should i `git checkout B` first? Should i `pull`, while on branch `A`?
Please h... | If the local branch `b` does not exist, then `git pull` and then simply `git checkout b` and the branch will be created automatically.
Other options would include a `git fetch origin/b` |
12643615 | How do I prettily print out a git-diff output? | 24 | 2012-09-28 16:12:44 | <p>I am required to print out the <code>git diff</code> output for the appendix of a thesis paper. I really like the output of <code>git diff --color-words</code>, but I have absolutely no idea how to bring this formatting, with the colors and with line numbers included, to a piece of paper on my Mac. I know there are ... | 34,848 | 861,184 | 2025-01-22 13:56:34 | 20,861,333 | 21 | 2013-12-31 17:50:47 | 1,049,112 | 2013-12-31 17:50:47 | https://stackoverflow.com/q/12643615 | https://stackoverflow.com/a/20861333 | <p>Use <code>aha</code>. You can install it in ubuntu with <code>sudo apt-get install aha</code>. Also see <a href="https://github.com/theZiz/aha">https://github.com/theZiz/aha</a>.</p>
<pre><code>$ git diff --color-words | aha > index.html
$ firefox index.html
</code></pre>
<p>Firefox should then be able to pr... | <p>Use <code>aha</code>. You can install it in ubuntu with <code>sudo apt-get install aha</code>. Also see <a href="https://github.com/theZiz/aha">https://github.com/theZiz/aha</a>.</p> <pre><code>$ git diff --color-words | aha > index.html $ firefox index.html </code></pre> <p>Firefox should then be able to pr... | 87, 119, 606, 9033 | diff, git, git-diff, printing | <h1>How do I prettily print out a git-diff output?</h1>
<p>I am required to print out the <code>git diff</code> output for the appendix of a thesis paper. I really like the output of <code>git diff --color-words</code>, but I have absolutely no idea how to bring this formatting, with the colors and with line numbers in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,303 | git | # How do I prettily print out a git-diff output?
I am required to print out the `git diff` output for the appendix of a thesis paper. I really like the output of `git diff --color-words`, but I have absolutely no idea how to bring this formatting, with the colors and with line numbers included, to a piece of paper on ... | Use `aha`. You can install it in ubuntu with `sudo apt-get install aha`. Also see <https://github.com/theZiz/aha>.
```
$ git diff --color-words | aha > index.html
$ firefox index.html
```
Firefox should then be able to print it in color. Check out `aha --help` for some other cool options. |
10601541 | Smarter rebase avoiding redundant work (conflict resolution)? | 24 | 2012-05-15 13:16:48 | <p>One issue I run into with long rebases is having to resolve redundant conflicts. Say I have a branch with a sequence of commits that keeps modifying a function, and the final commit removes the function entirely.</p>
<p>When I do <code>rebase master</code>, Git naively applies each of the commits in turn. That mean... | 7,668 | 263,268 | 2024-12-12 20:34:36 | 12,086,598 | 21 | 2012-08-23 07:18:50 | 334,451 | 2023-08-14 16:32:04 | https://stackoverflow.com/q/10601541 | https://stackoverflow.com/a/12086598 | <p>You want to use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html" rel="nofollow noreferrer"><code>git rerere</code></a> combined with teaching the <code>rerere</code> database from historical commits using <a href="https://github.com/gitster/git/blob/master/contrib/rerere-train.sh" rel="nofol... | <p>You want to use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html" rel="nofollow noreferrer"><code>git rerere</code></a> combined with teaching the <code>rerere</code> database from historical commits using <a href="https://github.com/gitster/git/blob/master/contrib/rerere-train.sh" rel="nofol... | 119, 9033, 29934, 106113 | git, git-diff, git-merge-conflict, git-rebase | <h1>Smarter rebase avoiding redundant work (conflict resolution)?</h1>
<p>One issue I run into with long rebases is having to resolve redundant conflicts. Say I have a branch with a sequence of commits that keeps modifying a function, and the final commit removes the function entirely.</p>
<p>When I do <code>rebase ma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,304 | git | # Smarter rebase avoiding redundant work (conflict resolution)?
One issue I run into with long rebases is having to resolve redundant conflicts. Say I have a branch with a sequence of commits that keeps modifying a function, and the final commit removes the function entirely.
When I do `rebase master`, Git naively ap... | You want to use [`git rerere`](http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html) combined with teaching the `rerere` database from historical commits using [`rerere-train.sh`](https://github.com/gitster/git/blob/master/contrib/rerere-train.sh) (you may already have it at `/usr/share/doc/git/contrib/rerer... |
5494576 | Git: How to ignore/specify files for *checkout* | 24 | 2011-03-31 02:03:18 | <p>If I don't want .html files tracked I can add the pattern to .gitignore and they'll be ignored. I'd like to know how I can do the converse - at checkout, how could I ask git to only checkout certain types of files or not checkout certain types of files?</p>
<p>For example, if I didn't want html files I could write:<... | 32,130 | 335,847 | 2023-04-27 19:10:17 | 5,495,048 | 21 | 2011-03-31 03:32:37 | 119,963 | 2012-05-11 09:38:30 | https://stackoverflow.com/q/5494576 | https://stackoverflow.com/a/5495048 | <p>If you want to package up files for deployment, you probably don't need - or want - the repo itself. This is exactly what <a href="http://schacon.github.com/git/git-archive.html" rel="noreferrer"><code>git archive</code></a> is for. A couple examples from the manpage (linked):</p>
<blockquote>
<p><code>git archiv... | <p>If you want to package up files for deployment, you probably don't need - or want - the repo itself. This is exactly what <a href="http://schacon.github.com/git/git-archive.html" rel="noreferrer"><code>git archive</code></a> is for. A couple examples from the manpage (linked):</p> <blockquote> <p><code>git archiv... | 119 | git | <h1>Git: How to ignore/specify files for *checkout*</h1>
<p>If I don't want .html files tracked I can add the pattern to .gitignore and they'll be ignored. I'd like to know how I can do the converse - at checkout, how could I ask git to only checkout certain types of files or not checkout certain types of files?</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,305 | git | # Git: How to ignore/specify files for *checkout*
If I don't want .html files tracked I can add the pattern to .gitignore and they'll be ignored. I'd like to know how I can do the converse - at checkout, how could I ask git to only checkout certain types of files or not checkout certain types of files?
For example, i... | If you want to package up files for deployment, you probably don't need - or want - the repo itself. This is exactly what [`git archive`](http://schacon.github.com/git/git-archive.html) is for. A couple examples from the manpage (linked):
> `git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)`
>
... |
32504123 | Unignore specific Files in Subdirectory with .gitignore | 23 | 2015-09-10 14:06:42 | <p>I have a problem to get .gitignore to do what I want. My folder structure looks like so:</p>
<pre><code>assets
├── img
| ├── thousands
| ├── of
| ├── folders
| ├── KEEP_SOMETHING_IN_THIS_FOLDER
| | ├── another
| | ├── thousands
| | ├── of
| | ├── folders
| | ├── KEEP_THIS_FILE_1.jpg
| ... | 15,484 | 1,841,828 | 2019-04-25 10:25:08 | 32,504,462 | 21 | 2015-09-10 14:19:55 | 2,809,617 | 2019-04-25 10:25:08 | https://stackoverflow.com/q/32504123 | https://stackoverflow.com/a/32504462 | <p>You need to create .gitignore file in specified folder. In "KEEP_SOMETHING_IN_THIS_FOLDER" in your case. And write this lines:</p>
<pre><code>/**
/*.jpg
!not_ignore.jpg
</code></pre>
<p>At first commit this <code>.gitignore</code> file and then try commit your files.<br>
But if your files already has been staged (... | <p>You need to create .gitignore file in specified folder. In "KEEP_SOMETHING_IN_THIS_FOLDER" in your case. And write this lines:</p> <pre><code>/** /*.jpg !not_ignore.jpg </code></pre> <p>At first commit this <code>.gitignore</code> file and then try commit your files.<br> But if your files already has been staged (... | 119, 25056 | git, gitignore | <h1>Unignore specific Files in Subdirectory with .gitignore</h1>
<p>I have a problem to get .gitignore to do what I want. My folder structure looks like so:</p>
<pre><code>assets
├── img
| ├── thousands
| ├── of
| ├── folders
| ├── KEEP_SOMETHING_IN_THIS_FOLDER
| | ├── another
| | ├── thousands
| | ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,308 | git | # Unignore specific Files in Subdirectory with .gitignore
I have a problem to get .gitignore to do what I want. My folder structure looks like so:
```
assets
├── img
| ├── thousands
| ├── of
| ├── folders
| ├── KEEP_SOMETHING_IN_THIS_FOLDER
| | ├── another
| | ├── thousands
| | ├── of
| | ├── ... | You need to create .gitignore file in specified folder. In "KEEP_SOMETHING_IN_THIS_FOLDER" in your case. And write this lines:
```
/**
/*.jpg
!not_ignore.jpg
```
At first commit this `.gitignore` file and then try commit your files.
But if your files already has been staged (tracked), try `git rm --cached <filePath... |
21642694 | Fail to use git pull "Couldn't find remote ref xxx" | 23 | 2014-02-08 06:15:37 | <p>I come up with a problem about git pull.</p>
<p>Firstly, I am in "test_http_1204" branch,</p>
<pre><code>root@inception-server-Quantal:~/bosh# git branch
master
* test_http_1204
ubuntu1204
</code></pre>
<p>Then I use git pull, and got an error message,</p>
<pre><code> root... | 61,055 | 2,886,717 | 2014-07-10 15:50:01 | 21,642,824 | 21 | 2014-02-08 06:29:52 | 1,256,452 | 2014-02-08 06:39:45 | https://stackoverflow.com/q/21642694 | https://stackoverflow.com/a/21642824 | <p>Based on <code>git ls-remote</code> output (was in comment, now gone - it doesn't fit very well in comments) it looks like the remote <em>used to</em> have a branch named <code>test_http_1024</code>, but no longer does.</p>
<p>In other words, whoever controls the remote did a <code>git branch -d</code> (or somethin... | <p>Based on <code>git ls-remote</code> output (was in comment, now gone - it doesn't fit very well in comments) it looks like the remote <em>used to</em> have a branch named <code>test_http_1024</code>, but no longer does.</p> <p>In other words, whoever controls the remote did a <code>git branch -d</code> (or somethin... | 119 | git | <h1>Fail to use git pull "Couldn't find remote ref xxx"</h1>
<p>I come up with a problem about git pull.</p>
<p>Firstly, I am in "test_http_1204" branch,</p>
<pre><code>root@inception-server-Quantal:~/bosh# git branch
master
* test_http_1204
ubuntu1204
</code></pre>
<p>Then I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,309 | git | # Fail to use git pull "Couldn't find remote ref xxx"
I come up with a problem about git pull.
Firstly, I am in "test_http_1204" branch,
```
root@inception-server-Quantal:~/bosh# git branch
master
* test_http_1204
ubuntu1204
```
Then I use git pull, and got an error message,
... | Based on `git ls-remote` output (was in comment, now gone - it doesn't fit very well in comments) it looks like the remote *used to* have a branch named `test_http_1024`, but no longer does.
In other words, whoever controls the remote did a `git branch -d` (or something equivalent) to delete their branch `test_http_10... |
27901717 | What's the difference between vimdiff and vimdiff2 in git? | 22 | 2015-01-12 12:11:08 | <p>What's the difference between them? My search engine results talk only about vimdiff, yet the command</p>
<pre><code>git mergetool
</code></pre>
<p>offers me both.</p>
| 12,315 | 4,428,368 | 2015-01-12 12:44:10 | 27,902,329 | 21 | 2015-01-12 12:44:10 | 6,309 | 2015-01-12 12:44:10 | https://stackoverflow.com/q/27901717 | https://stackoverflow.com/a/27902329 | <p><code>vimdiff2</code> was introduced in <a href="https://github.com/git/git/commit/000866909a5d9233c89d8fcc33a8125cc84f24d6" rel="noreferrer">commit 0008669</a> (Sept 2010, for git 1.7.4)</p>
<p>It is <a href="https://github.com/git/git/blob/master/mergetools/vimdiff2" rel="noreferrer">like vimdiff</a>, but with di... | <p><code>vimdiff2</code> was introduced in <a href="https://github.com/git/git/commit/000866909a5d9233c89d8fcc33a8125cc84f24d6" rel="noreferrer">commit 0008669</a> (Sept 2010, for git 1.7.4)</p> <p>It is <a href="https://github.com/git/git/blob/master/mergetools/vimdiff2" rel="noreferrer">like vimdiff</a>, but with di... | 119, 370, 2605 | git, vim, vimdiff | <h1>What's the difference between vimdiff and vimdiff2 in git?</h1>
<p>What's the difference between them? My search engine results talk only about vimdiff, yet the command</p>
<pre><code>git mergetool
</code></pre>
<p>offers me both.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,311 | git | # What's the difference between vimdiff and vimdiff2 in git?
What's the difference between them? My search engine results talk only about vimdiff, yet the command
```
git mergetool
```
offers me both. | `vimdiff2` was introduced in [commit 0008669](https://github.com/git/git/commit/000866909a5d9233c89d8fcc33a8125cc84f24d6) (Sept 2010, for git 1.7.4)
It is [like vimdiff](https://github.com/git/git/blob/master/mergetools/vimdiff2), but with different merge options (as commented in [commit b2a6b71](https://github.com/gi... |
19636750 | git filter-branch --msg-filter to reword a pushed commit message | 22 | 2013-10-28 13:59:43 | <p>How can I reword the message of an old commit that is already pushed to a private remote?
I want to keep the time stamps and tags.</p>
<p>I found this command <a href="https://stackoverflow.com/questions/5032374/accidently-pushed-commit-change-git-commit-message">here</a>:</p>
<pre class="lang-bash prettyprint-ove... | 9,947 | 1,938,220 | 2016-01-13 08:16:44 | 19,681,379 | 21 | 2013-10-30 11:47:37 | 1,938,220 | 2014-07-29 01:39:38 | https://stackoverflow.com/q/19636750 | https://stackoverflow.com/a/19681379 | <p>The solution was to escape the slash in "release/..." using a backslash. So the command I used was:</p>
<pre class="lang-bash prettyprint-override"><code>git filter-branch -f --msg-filter \
'sed "s/release\/Version-[0-9].[0-9].[0-9]/develop/g"' \
--tag-name-filter cat -- --all
</code></pre>
| <p>The solution was to escape the slash in "release/..." using a backslash. So the command I used was:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch -f --msg-filter \ 'sed "s/release\/Version-[0-9].[0-9].[0-9]/develop/g"' \ --tag-name-filter cat -- --all </code></pre> | 119, 1863, 5597, 46509, 69559 | commit, git, git-filter-branch, message, revision-history | <h1>git filter-branch --msg-filter to reword a pushed commit message</h1>
<p>How can I reword the message of an old commit that is already pushed to a private remote?
I want to keep the time stamps and tags.</p>
<p>I found this command <a href="https://stackoverflow.com/questions/5032374/accidently-pushed-commit-chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,312 | git | # git filter-branch --msg-filter to reword a pushed commit message
How can I reword the message of an old commit that is already pushed to a private remote?
I want to keep the time stamps and tags.
I found this command [here](https://stackoverflow.com/questions/5032374/accidently-pushed-commit-change-git-commit-messa... | The solution was to escape the slash in "release/..." using a backslash. So the command I used was:
```
git filter-branch -f --msg-filter \
'sed "s/release\/Version-[0-9].[0-9].[0-9]/develop/g"' \
--tag-name-filter cat -- --all
``` |
804601 | Git: post-receive email hook, including diff patches? | 22 | 2009-04-29 22:42:45 | <p>I found a post-receive hook for Git after some googling that I use to e-mail all commits to a remote/shared repo. </p>
<p>The problem with this <a href="http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email;h=41368950d6b29121089ee9239b8e07ece209a31e" rel="noreferrer">post-receive hook... | 16,246 | null | 2012-09-27 21:31:35 | 806,853 | 21 | 2009-04-30 13:18:40 | 43,582 | 2009-04-30 13:18:40 | https://stackoverflow.com/q/804601 | https://stackoverflow.com/a/806853 | <p>Recent Git version should install a <code>post-receive-email</code> script. In it, it says:</p>
<blockquote>
<p>hooks.showrev</p>
<p>The shell command used to format each revision in the email, with
"%s" replaced with the commit id. Defaults to "git rev-list -1
--pretty %s", displaying the commit id... | <p>Recent Git version should install a <code>post-receive-email</code> script. In it, it says:</p> <blockquote> <p>hooks.showrev</p> <p>The shell command used to format each revision in the email, with "%s" replaced with the commit id. Defaults to "git rev-list -1 --pretty %s", displaying the commit id... | 119 | git | <h1>Git: post-receive email hook, including diff patches?</h1>
<p>I found a post-receive hook for Git after some googling that I use to e-mail all commits to a remote/shared repo. </p>
<p>The problem with this <a href="http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email;h=41368950d6b29... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,313 | git | # Git: post-receive email hook, including diff patches?
I found a post-receive hook for Git after some googling that I use to e-mail all commits to a remote/shared repo.
The problem with this [post-receive hook](http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email;h=41368950d6b29121089... | Recent Git version should install a `post-receive-email` script. In it, it says:
> hooks.showrev
>
> The shell command used to format each revision in the email, with
> "%s" replaced with the commit id. Defaults to "git rev-list -1
> --pretty %s", displaying the commit id, author, date and log
> message. To list full ... |
4111844 | what does reachable/unreachable mean in git? | 21 | 2010-11-06 04:07:41 | <p>Little bit confused..</p>
<p>In the <a href="http://book.git-scm.com/3_reviewing_history_-_git_log.html">git community manual</a>, it says </p>
<blockquote>
<p>The git log command can show lists of
commits. On its own, it shows all
commits reachable from the parent
commit; but you can also make more
spec... | 6,507 | 499,030 | 2010-11-06 06:00:44 | 4,111,873 | 21 | 2010-11-06 04:21:00 | 203,114 | 2010-11-06 05:43:09 | https://stackoverflow.com/q/4111844 | https://stackoverflow.com/a/4111873 | <p>in Git, every commit you make (except for the very first) will have a parent commit. It follows that any given commit (except the first) is a child of one (or possibly more than one) other commit. You can also have several branches of development in Git, that begin or deviate at a particular ancestral commit. Nothin... | <p>in Git, every commit you make (except for the very first) will have a parent commit. It follows that any given commit (except the first) is a child of one (or possibly more than one) other commit. You can also have several branches of development in Git, that begin or deviate at a particular ancestral commit. Nothin... | 119 | git | <h1>what does reachable/unreachable mean in git?</h1>
<p>Little bit confused..</p>
<p>In the <a href="http://book.git-scm.com/3_reviewing_history_-_git_log.html">git community manual</a>, it says </p>
<blockquote>
<p>The git log command can show lists of
commits. On its own, it shows all
commits reachable from ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,315 | git | # what does reachable/unreachable mean in git?
Little bit confused..
In the [git community manual](http://book.git-scm.com/3_reviewing_history_-_git_log.html), it says
> The git log command can show lists of
> commits. On its own, it shows all
> commits reachable from the parent
> commit; but you can also make more
... | in Git, every commit you make (except for the very first) will have a parent commit. It follows that any given commit (except the first) is a child of one (or possibly more than one) other commit. You can also have several branches of development in Git, that begin or deviate at a particular ancestral commit. Nothing i... |
2797191 | How to split a git repository while preserving subdirectories? | 21 | 2010-05-09 09:30:47 | <p>What I want is similar to <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">this question</a>. However, I want the directory that is split into a separate repo to remain a subdirectory in that repo:</p>
<p>I have this:</p>
<pre><code>foo/
.git/
bar/
baz/
... | 6,753 | 14,637 | 2020-07-06 16:16:30 | 2,805,084 | 21 | 2010-05-10 17:57:09 | 119,963 | 2014-07-04 18:33:28 | https://stackoverflow.com/q/2797191 | https://stackoverflow.com/a/2805084 | <p>You could indeed use the subdirectory filter followed by an index filter to put the contents back into a subdirectory, but why bother, when you could just use the index filter by itself?</p>
<p>Here's an example from the man page:</p>
<pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch fi... | <p>You could indeed use the subdirectory filter followed by an index filter to put the contents back into a subdirectory, but why bother, when you could just use the index filter by itself?</p> <p>Here's an example from the man page:</p> <pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch fi... | 119, 2193, 46509 | git, git-filter-branch, split | <h1>How to split a git repository while preserving subdirectories?</h1>
<p>What I want is similar to <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">this question</a>. However, I want the directory that is split into a separate repo to remain a subdirectory in that ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,316 | git | # How to split a git repository while preserving subdirectories?
What I want is similar to [this question](https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository). However, I want the directory that is split into a separate repo to remain a subdirectory in that repo:
I have this:
... | You could indeed use the subdirectory filter followed by an index filter to put the contents back into a subdirectory, but why bother, when you could just use the index filter by itself?
Here's an example from the man page:
```
git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
```
Thi... |
42263022 | Accidentally merged in wrong branch to mine. Is there a way to remove these unwanted files? | 20 | 2017-02-16 01:06:33 | <p>I accidentally merged a co-workers branch into the branch I was working on. I've made several commits since then so ideally I don't want to revert to the state the branch was before the merge. However, I haven't done anything that has altered his files.</p>
<p>Is there a way I can remove his branch's files from min... | 18,015 | 1,433,268 | 2018-09-24 22:55:21 | 42,263,096 | 21 | 2017-02-16 01:14:07 | 1,863,229 | 2017-02-16 01:14:07 | https://stackoverflow.com/q/42263022 | https://stackoverflow.com/a/42263096 | <p>Perhaps the easiest and safest option here would be to revert the merge commit which you made a few commits ago. To do this, find the merge commit in your history using <code>git log</code>, and record the SHA-1 hash of that commit. Then, do the following:</p>
<pre><code>git revert -m 1 <SHA-1>
</code></pre... | <p>Perhaps the easiest and safest option here would be to revert the merge commit which you made a few commits ago. To do this, find the merge commit in your history using <code>git log</code>, and record the SHA-1 hash of that commit. Then, do the following:</p> <pre><code>git revert -m 1 <SHA-1> </code></pre... | 119, 717 | git, merge | <h1>Accidentally merged in wrong branch to mine. Is there a way to remove these unwanted files?</h1>
<p>I accidentally merged a co-workers branch into the branch I was working on. I've made several commits since then so ideally I don't want to revert to the state the branch was before the merge. However, I haven't done... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,319 | git | # Accidentally merged in wrong branch to mine. Is there a way to remove these unwanted files?
I accidentally merged a co-workers branch into the branch I was working on. I've made several commits since then so ideally I don't want to revert to the state the branch was before the merge. However, I haven't done anything... | Perhaps the easiest and safest option here would be to revert the merge commit which you made a few commits ago. To do this, find the merge commit in your history using `git log`, and record the SHA-1 hash of that commit. Then, do the following:
```
git revert -m 1 <SHA-1>
```
Here `<SHA-1>` is the hash of the merge ... |
25900897 | Git merge conflicts when no changes done | 20 | 2014-09-17 21:47:56 | <p>I've cloned a repo and then, after a few hours, I've made 'git pull'. However merge conflicts appeared and I don't understand why because I haven't made any change into cloned repo.</p>
<pre><code>git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean... | 21,125 | 1,544,336 | 2019-04-25 14:30:28 | 25,922,144 | 21 | 2014-09-18 20:55:29 | 2,876,370 | 2017-05-08 13:42:41 | https://stackoverflow.com/q/25900897 | https://stackoverflow.com/a/25922144 | <p>First of all a bit of pre-caution I'm using on a daily basis...</p>
<p>I learned to use <code>git merge --ff-only</code> when I don't expect any actual merge. I see it's also possible to use <code>git pull --ff-only</code> but more often I use <code>git pull --rebase</code> so it doesn't create any merge commits bu... | <p>First of all a bit of pre-caution I'm using on a daily basis...</p> <p>I learned to use <code>git merge --ff-only</code> when I don't expect any actual merge. I see it's also possible to use <code>git pull --ff-only</code> but more often I use <code>git pull --rebase</code> so it doesn't create any merge commits bu... | 119, 28897 | git, git-merge | <h1>Git merge conflicts when no changes done</h1>
<p>I've cloned a repo and then, after a few hours, I've made 'git pull'. However merge conflicts appeared and I don't understand why because I haven't made any change into cloned repo.</p>
<pre><code>git status
On branch master
Your branch is up-to-date with 'origin/ma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,321 | git | # Git merge conflicts when no changes done
I've cloned a repo and then, after a few hours, I've made 'git pull'. However merge conflicts appeared and I don't understand why because I haven't made any change into cloned repo.
```
git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to c... | First of all a bit of pre-caution I'm using on a daily basis...
I learned to use `git merge --ff-only` when I don't expect any actual merge. I see it's also possible to use `git pull --ff-only` but more often I use `git pull --rebase` so it doesn't create any merge commits but instead replays my local changes (if any)... |
22600382 | Heroku is not updating my code? | 20 | 2014-03-24 03:02:38 | <p>So I did some CSS changes on my local, ran <code>git add .</code>, <code>git commit -am "Hello"</code>, <code>git push heroku master</code>, and for some reason two commmits ago, things stopped getting updated. </p>
<p>It commits fine, and doesn't show any input out of the ordinary.</p>
<p>I tried making a new bra... | 33,112 | 765,409 | 2021-06-01 18:54:43 | 22,617,294 | 21 | 2014-03-24 18:09:37 | 194,175 | 2014-03-24 18:09:37 | https://stackoverflow.com/q/22600382 | https://stackoverflow.com/a/22617294 | <p>Try running 'heroku releases' and 'heroku ps' on the command line.</p>
<p><code>heroku releases</code> should show you which git version Heroku currently has running -- this will let you compare your local git revision to the one Heroku has, to ensure it actually <em>received</em> your updates.</p>
<p>Next, you mi... | <p>Try running 'heroku releases' and 'heroku ps' on the command line.</p> <p><code>heroku releases</code> should show you which git version Heroku currently has running -- this will let you compare your local git revision to the one Heroku has, to ensure it actually <em>received</em> your updates.</p> <p>Next, you mi... | 119, 8279 | git, heroku | <h1>Heroku is not updating my code?</h1>
<p>So I did some CSS changes on my local, ran <code>git add .</code>, <code>git commit -am "Hello"</code>, <code>git push heroku master</code>, and for some reason two commmits ago, things stopped getting updated. </p>
<p>It commits fine, and doesn't show any input out of the o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,322 | git | # Heroku is not updating my code?
So I did some CSS changes on my local, ran `git add .`, `git commit -am "Hello"`, `git push heroku master`, and for some reason two commmits ago, things stopped getting updated.
It commits fine, and doesn't show any input out of the ordinary.
I tried making a new branch and pushing ... | Try running 'heroku releases' and 'heroku ps' on the command line.
`heroku releases` should show you which git version Heroku currently has running -- this will let you compare your local git revision to the one Heroku has, to ensure it actually *received* your updates.
Next, you might want to check `heroku ps`, and ... |
9767381 | Importing one git repo as a branch into another git repo | 20 | 2012-03-19 09:04:09 | <p>For historic reason we have source code for different version in different git repositories. So while Project A holds the version X of the source Project B holds version Y of the source.</p>
<p>Do you guys know a way to import Project B as a branch of Project A?</p>
<p>Thanks</p>
| 15,376 | 234,922 | 2017-09-22 09:23:50 | 9,767,417 | 21 | 2012-03-19 09:08:07 | 112,968 | 2012-03-19 09:08:07 | https://stackoverflow.com/q/9767381 | https://stackoverflow.com/a/9767417 | <p>This is simple with Git. You have to add project B as remote, then fetch:</p>
<pre><code>git remote add projectB git://url.to/projectB.git
git fetch projectB
</code></pre>
| <p>This is simple with Git. You have to add project B as remote, then fetch:</p> <pre><code>git remote add projectB git://url.to/projectB.git git fetch projectB </code></pre> | 119 | git | <h1>Importing one git repo as a branch into another git repo</h1>
<p>For historic reason we have source code for different version in different git repositories. So while Project A holds the version X of the source Project B holds version Y of the source.</p>
<p>Do you guys know a way to import Project B as a branch o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,323 | git | # Importing one git repo as a branch into another git repo
For historic reason we have source code for different version in different git repositories. So while Project A holds the version X of the source Project B holds version Y of the source.
Do you guys know a way to import Project B as a branch of Project A?
Th... | This is simple with Git. You have to add project B as remote, then fetch:
```
git remote add projectB git://url.to/projectB.git
git fetch projectB
``` |
9253046 | git reword without resolving merge conflicts again | 20 | 2012-02-12 21:51:00 | <p>Is it possible to change commit messages using git rebase, but without having to re-resolve merge conflicts? </p>
<p>I need to bowdlerize an older repo and I don't want to change any of the actual code, just the messages. </p>
<p>I've tried <code>--preserve-merges</code>.</p>
| 4,793 | 377,124 | 2019-08-16 19:44:11 | 9,254,245 | 21 | 2012-02-13 00:46:59 | 73,632 | 2019-08-16 19:44:11 | https://stackoverflow.com/q/9253046 | https://stackoverflow.com/a/9254245 | <p>There's a little-known feature of git called "Reuse Recorded Resolutions", or <code>rerere</code>.</p>
<p>You can enable it globally by running <code>git config --global rerere.enabled true</code>.</p>
<p>If <code>rerere</code> is enabled, <code>git</code> will automatically save conflict resolutions, and will reu... | <p>There's a little-known feature of git called "Reuse Recorded Resolutions", or <code>rerere</code>.</p> <p>You can enable it globally by running <code>git config --global rerere.enabled true</code>.</p> <p>If <code>rerere</code> is enabled, <code>git</code> will automatically save conflict resolutions, and will reu... | 119, 8974, 29934 | git, git-rebase, rebase | <h1>git reword without resolving merge conflicts again</h1>
<p>Is it possible to change commit messages using git rebase, but without having to re-resolve merge conflicts? </p>
<p>I need to bowdlerize an older repo and I don't want to change any of the actual code, just the messages. </p>
<p>I've tried <code>--preser... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,324 | git | # git reword without resolving merge conflicts again
Is it possible to change commit messages using git rebase, but without having to re-resolve merge conflicts?
I need to bowdlerize an older repo and I don't want to change any of the actual code, just the messages.
I've tried `--preserve-merges`. | There's a little-known feature of git called "Reuse Recorded Resolutions", or `rerere`.
You can enable it globally by running `git config --global rerere.enabled true`.
If `rerere` is enabled, `git` will automatically save conflict resolutions, and will reuse those resolutions later if it encounters the same conflict... |
5149872 | How to 'git remote add' and track a branch in the same filesystem | 20 | 2011-03-01 02:21:18 | <p>I have 2 local git archives in /a and in /b which were cloned from remotes/origin.</p>
<p>There is a new branch z on /b</p>
<p>How can I track and fetch branch z from archive /a ?</p>
<p>I tried this:</p>
<pre><code>cd /a
git remote add b /b
</code></pre>
<p>This creates 2 config entries, but I did not manage t... | 19,878 | 362,951 | 2011-03-01 18:50:06 | 5,149,946 | 21 | 2011-03-01 02:38:13 | 79,125 | 2011-03-01 18:50:06 | https://stackoverflow.com/q/5149872 | https://stackoverflow.com/a/5149946 | <p>So far you've only added b as a remote. You can try <code>git branch -a</code> to list your remote branches after you've fetched them.</p>
<p>Here's the commands to checkout the z branch from b:</p>
<pre><code>git remote add b /b # you've already done
git fetch b # get it so we ca... | <p>So far you've only added b as a remote. You can try <code>git branch -a</code> to list your remote branches after you've fetched them.</p> <p>Here's the commands to checkout the z branch from b:</p> <pre><code>git remote add b /b # you've already done git fetch b # get it so we ca... | 119 | git | <h1>How to 'git remote add' and track a branch in the same filesystem</h1>
<p>I have 2 local git archives in /a and in /b which were cloned from remotes/origin.</p>
<p>There is a new branch z on /b</p>
<p>How can I track and fetch branch z from archive /a ?</p>
<p>I tried this:</p>
<pre><code>cd /a
git remote add b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,325 | git | # How to 'git remote add' and track a branch in the same filesystem
I have 2 local git archives in /a and in /b which were cloned from remotes/origin.
There is a new branch z on /b
How can I track and fetch branch z from archive /a ?
I tried this:
```
cd /a
git remote add b /b
```
This creates 2 config entries, b... | So far you've only added b as a remote. You can try `git branch -a` to list your remote branches after you've fetched them.
Here's the commands to checkout the z branch from b:
```
git remote add b /b # you've already done
git fetch b # get it so we can see it
git checkout -t b/z ... |
5073258 | Locking a branch, so that it cannot be staged/committed into? (Only merged/etc) | 20 | 2011-02-22 01:52:12 | <p>I have a <code>master</code>/<code>develop</code> branching system that i have come to love, but it comes with a basic rule. No commits are done on <code>develop</code> or <code>master</code>, only merges. This is great, but recently i accidentally made some changes/commits on my develop branch and it annoys the tar... | 10,916 | 80,943 | 2017-04-16 03:33:13 | 5,073,641 | 21 | 2011-02-22 03:15:30 | 208,997 | 2011-02-23 04:24:21 | https://stackoverflow.com/q/5073258 | https://stackoverflow.com/a/5073641 | <p>Copy this:</p>
<pre><code>#!/bin/bash
if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]]
then
echo "You cannot commit in master!"
exit 1
fi
</code></pre>
<p>into a file named <code>pre-commit</code> in <code>.git/hooks/</code></p>
<p>It will prevent you from commiting into the branch <code>master</c... | <p>Copy this:</p> <pre><code>#!/bin/bash if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]] then echo "You cannot commit in master!" exit 1 fi </code></pre> <p>into a file named <code>pre-commit</code> in <code>.git/hooks/</code></p> <p>It will prevent you from commiting into the branch <code>master</c... | 119 | git | <h1>Locking a branch, so that it cannot be staged/committed into? (Only merged/etc)</h1>
<p>I have a <code>master</code>/<code>develop</code> branching system that i have come to love, but it comes with a basic rule. No commits are done on <code>develop</code> or <code>master</code>, only merges. This is great, but rec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,326 | git | # Locking a branch, so that it cannot be staged/committed into? (Only merged/etc)
I have a `master`/`develop` branching system that i have come to love, but it comes with a basic rule. No commits are done on `develop` or `master`, only merges. This is great, but recently i accidentally made some changes/commits on my ... | Copy this:
```
#!/bin/bash
if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]]
then
echo "You cannot commit in master!"
exit 1
fi
```
into a file named `pre-commit` in `.git/hooks/`
It will prevent you from commiting into the branch `master`. You can easily customize it to add more branches or to person... |
39064520 | List all files that are not ignored by .gitignore | 19 | 2016-08-21 13:06:10 | <p>I would like to list all files that are not ignored by .gitignore, ie all source files of my repository. </p>
<p><code>ag</code> does it well by default, but I'm not aware of an approach that works without installing additional software. </p>
<p><code>git ls-files</code> without options works almost well but doesn... | 7,334 | 1,993,501 | 2024-04-15 03:23:05 | 39,064,584 | 21 | 2016-08-21 13:13:23 | 1,084,774 | 2016-08-22 07:57:12 | https://stackoverflow.com/q/39064520 | https://stackoverflow.com/a/39064584 | <pre><code>git status --short| grep '^?' | cut -d\ -f2-
</code></pre>
<p>will give you untracked files.</p>
<p>If you union it with <code>git ls-files</code>, you've got all unignored files:</p>
<pre><code>( git status --short| grep '^?' | cut -d\ -f2- && git ls-files ) | sort -u
</code></pre>
<p>you ca... | <pre><code>git status --short| grep '^?' | cut -d\ -f2- </code></pre> <p>will give you untracked files.</p> <p>If you union it with <code>git ls-files</code>, you've got all unignored files:</p> <pre><code>( git status --short| grep '^?' | cut -d\ -f2- && git ls-files ) | sort -u </code></pre> <p>you ca... | 119, 5310, 5608 | file, git, list | <h1>List all files that are not ignored by .gitignore</h1>
<p>I would like to list all files that are not ignored by .gitignore, ie all source files of my repository. </p>
<p><code>ag</code> does it well by default, but I'm not aware of an approach that works without installing additional software. </p>
<p><code>git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,328 | git | # List all files that are not ignored by .gitignore
I would like to list all files that are not ignored by .gitignore, ie all source files of my repository.
`ag` does it well by default, but I'm not aware of an approach that works without installing additional software.
`git ls-files` without options works almost we... | ```
git status --short| grep '^?' | cut -d\ -f2-
```
will give you untracked files.
If you union it with `git ls-files`, you've got all unignored files:
```
( git status --short| grep '^?' | cut -d\ -f2- && git ls-files ) | sort -u
```
you can then filter by
```
( xargs -d '\n' -- stat -c%n 2>/dev/null ||: )
`... |
38034151 | Git stash two branches | 19 | 2016-06-26 00:26:56 | <p><strong>This is the situation:</strong></p>
<ol>
<li>I made changes on branch A</li>
<li><code>git stash</code> on branch A</li>
<li><code>git checkout B</code></li>
<li>Made changes on branch B</li>
<li><code>git stash</code> on branch B</li>
<li><code>git checkout A</code></li>
<li><code>git stash pop</code> on b... | 6,038 | 3,354,501 | 2021-04-15 01:53:30 | 38,034,877 | 21 | 2016-06-26 03:10:52 | 1,256,452 | 2016-06-26 03:10:52 | https://stackoverflow.com/q/38034151 | https://stackoverflow.com/a/38034877 | <p>What <code>git stash</code> does is make a commit.<sup>1</sup></p>
<p>Of course, what <code>git commit</code> does is make a commit. So why do we have <code>git stash</code> at all?</p>
<p>A significant difference between these commands is that the commits <code>git stash</code> makes are <em>not on any branches<... | <p>What <code>git stash</code> does is make a commit.<sup>1</sup></p> <p>Of course, what <code>git commit</code> does is make a commit. So why do we have <code>git stash</code> at all?</p> <p>A significant difference between these commands is that the commits <code>git stash</code> makes are <em>not on any branches<... | 119, 13091, 76220 | git, git-branch, git-stash | <h1>Git stash two branches</h1>
<p><strong>This is the situation:</strong></p>
<ol>
<li>I made changes on branch A</li>
<li><code>git stash</code> on branch A</li>
<li><code>git checkout B</code></li>
<li>Made changes on branch B</li>
<li><code>git stash</code> on branch B</li>
<li><code>git checkout A</code></li>
<li... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,329 | git | # Git stash two branches
**This is the situation:**
1. I made changes on branch A
2. `git stash` on branch A
3. `git checkout B`
4. Made changes on branch B
5. `git stash` on branch B
6. `git checkout A`
7. `git stash pop` on branch A
After step 7 of the list above, the changes I had made on branch A before stashing... | What `git stash` does is make a commit.1
Of course, what `git commit` does is make a commit. So why do we have `git stash` at all?
A significant difference between these commands is that the commits `git stash` makes are *not on any branches*. This allows you to `stash` when on one branch, then move to another branch... |
24837841 | Can a file be both staged and unstaged in Git? | 19 | 2014-07-19 07:21:56 | <p>While working on another file, I edited <code>README.md</code> and then ran <code>git add README.md</code>. When doing a git commit, I see that <code>README.md</code> is both in the "Changes to be committed" and "Changes not staged for commit".</p>
<p>Does this make sense? Where in <code>.git</code> could I look ... | 8,974 | 116 | 2021-01-25 15:55:23 | 24,837,856 | 21 | 2014-07-19 07:23:32 | 1,900,483 | 2020-11-08 14:47:56 | https://stackoverflow.com/q/24837841 | https://stackoverflow.com/a/24837856 | <p>This means part of the changes you made are staged for commit and parts are not.</p>
<p>You can check what is staged if you run</p>
<pre><code>git diff --staged -- README.md
</code></pre>
<p>and check for what is unstaged by running</p>
<pre><code>git diff -- README.md
</code></pre>
<p>Most version control systems g... | <p>This means part of the changes you made are staged for commit and parts are not.</p> <p>You can check what is staged if you run</p> <pre><code>git diff --staged -- README.md </code></pre> <p>and check for what is unstaged by running</p> <pre><code>git diff -- README.md </code></pre> <p>Most version control systems g... | 119, 456 | git, version-control | <h1>Can a file be both staged and unstaged in Git?</h1>
<p>While working on another file, I edited <code>README.md</code> and then ran <code>git add README.md</code>. When doing a git commit, I see that <code>README.md</code> is both in the "Changes to be committed" and "Changes not staged for commit".</p>
<p>Does th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,330 | git | # Can a file be both staged and unstaged in Git?
While working on another file, I edited `README.md` and then ran `git add README.md`. When doing a git commit, I see that `README.md` is both in the "Changes to be committed" and "Changes not staged for commit".
Does this make sense? Where in `.git` could I look to see... | This means part of the changes you made are staged for commit and parts are not.
You can check what is staged if you run
```
git diff --staged -- README.md
```
and check for what is unstaged by running
```
git diff -- README.md
```
Most version control systems generally only store the changes between two states. T... |
2330471 | .gitignore does not understand my folder wildcard on windows | 19 | 2010-02-24 23:24:34 | <p>I'm encountering a weird issue with <code>.gitignore</code> on Windows. </p>
<p>I want git to ignore all <code>.exe</code> files, except those in the <code>Dependencies</code> folder (and all subfolders).</p>
<p>So I have:</p>
<p><code>.gitignore</code>: </p>
<pre><code>*.exe
!/Dependencies/**/*.exe
</code></p... | 16,318 | 141,229 | 2013-04-23 09:17:56 | 16,165,533 | 21 | 2013-04-23 09:17:56 | 6,309 | 2013-04-23 09:17:56 | https://stackoverflow.com/q/2330471 | https://stackoverflow.com/a/16165533 | <p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L85-L88" rel="noreferrer">git 1.8.2 (March, 8th 2013)</a>, the <code>**</code> is now supported:</p>
<blockquote>
<p>The patterns in <code>.gitignore</code> and <code>.gitattributes</code> files <strong>can have <code>**/</code>, ... | <p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L85-L88" rel="noreferrer">git 1.8.2 (March, 8th 2013)</a>, the <code>**</code> is now supported:</p> <blockquote> <p>The patterns in <code>.gitignore</code> and <code>.gitattributes</code> files <strong>can have <code>**/</code>, ... | 64, 119, 21628, 25056 | git, gitignore, msysgit, windows | <h1>.gitignore does not understand my folder wildcard on windows</h1>
<p>I'm encountering a weird issue with <code>.gitignore</code> on Windows. </p>
<p>I want git to ignore all <code>.exe</code> files, except those in the <code>Dependencies</code> folder (and all subfolders).</p>
<p>So I have:</p>
<p><code>.gitign... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,332 | git | # .gitignore does not understand my folder wildcard on windows
I'm encountering a weird issue with `.gitignore` on Windows.
I want git to ignore all `.exe` files, except those in the `Dependencies` folder (and all subfolders).
So I have:
`.gitignore`:
```
*.exe
!/Dependencies/**/*.exe
```
This, unfortunately, doe... | Since [git 1.8.2 (March, 8th 2013)](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L85-L88), the `**` is now supported:
> The patterns in `.gitignore` and `.gitattributes` files **can have `**/`, as a pattern that matches 0 or more levels of subdirectory**.
>
> E.g. "`foo/**/bar`" matches "`ba... |
12487791 | How to amend review issues in Gerrit when there is a second newer review also | 19 | 2012-09-19 02:32:10 | <p>Still trying to learn how to use Gerrit and its process. Steps I did where</p>
<ol>
<li>Push first <code>change1</code> to gerrit for review to HEAD:refs/for/develop</li>
<li>Work on something else on same branch and push <code>change2</code> to gerrit for review to HEAD:refs/for/develop</li>
</ol>
<p>Both commits... | 30,460 | 990,524 | 2020-01-27 07:55:55 | 12,487,934 | 21 | 2012-09-19 02:55:22 | 777,318 | 2012-09-19 02:55:22 | https://stackoverflow.com/q/12487791 | https://stackoverflow.com/a/12487934 | <p>When you have dependent reviews in Gerrit (that is, one change in review which is dependent on an earlier change which is simultaneously in review), and you need to make modifications to the earlier change, you effectively have to resubmit both changes (since the second change becomes dependent on a different "paren... | <p>When you have dependent reviews in Gerrit (that is, one change in review which is dependent on an earlier change which is simultaneously in review), and you need to make modifications to the earlier change, you effectively have to resubmit both changes (since the second change becomes dependent on a different "paren... | 119, 52272 | gerrit, git | <h1>How to amend review issues in Gerrit when there is a second newer review also</h1>
<p>Still trying to learn how to use Gerrit and its process. Steps I did where</p>
<ol>
<li>Push first <code>change1</code> to gerrit for review to HEAD:refs/for/develop</li>
<li>Work on something else on same branch and push <code>c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,334 | git | # How to amend review issues in Gerrit when there is a second newer review also
Still trying to learn how to use Gerrit and its process. Steps I did where
1. Push first `change1` to gerrit for review to HEAD:refs/for/develop
2. Work on something else on same branch and push `change2` to gerrit for review to HEAD:refs... | When you have dependent reviews in Gerrit (that is, one change in review which is dependent on an earlier change which is simultaneously in review), and you need to make modifications to the earlier change, you effectively have to resubmit both changes (since the second change becomes dependent on a different "parent" ... |
6058879 | What do the Git “pairing broken” and “unknown” statuses mean, and when do they occur? | 19 | 2011-05-19 12:51:17 | <p>Some options in <code>git diff</code>, for instance <code>--name-status</code>, cause the output of a status letter next to a file name. They are:</p>
<blockquote>
<p>A, C, D, M, R, T, U, X, B</p>
</blockquote>
<p>… and they mean</p>
<blockquote>
<p>Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R... | 2,704 | 390,581 | 2011-05-20 07:19:19 | 6,068,691 | 21 | 2011-05-20 07:19:19 | 193,688 | 2011-05-20 07:19:19 | https://stackoverflow.com/q/6058879 | https://stackoverflow.com/a/6068691 | <p>The <code>B</code> “broken pair” status never appears directly in <code>--name-status</code> output, it is only useful as an argument to the option <code>--diff-filter</code> when also using the option <code>-B</code> (<code>--break-rewrites</code>). Using it as a filter selects files that have had at least a certai... | <p>The <code>B</code> “broken pair” status never appears directly in <code>--name-status</code> output, it is only useful as an argument to the option <code>--diff-filter</code> when also using the option <code>-B</code> (<code>--break-rewrites</code>). Using it as a filter selects files that have had at least a certai... | 119, 9033 | git, git-diff | <h1>What do the Git “pairing broken” and “unknown” statuses mean, and when do they occur?</h1>
<p>Some options in <code>git diff</code>, for instance <code>--name-status</code>, cause the output of a status letter next to a file name. They are:</p>
<blockquote>
<p>A, C, D, M, R, T, U, X, B</p>
</blockquote>
<p>… an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,335 | git | # What do the Git “pairing broken” and “unknown” statuses mean, and when do they occur?
Some options in `git diff`, for instance `--name-status`, cause the output of a status letter next to a file name. They are:
> A, C, D, M, R, T, U, X, B
… and they mean
> Added (A), Copied (C), Deleted (D), Modified (M), Renamed... | The `B` “broken pair” status never appears directly in `--name-status` output, it is only useful as an argument to the option `--diff-filter` when also using the option `-B` (`--break-rewrites`). Using it as a filter selects files that have had at least a certain percentage of their content deleted or changed.
This “b... |
1594477 | Can git format patch so it can be used with patch program? | 19 | 2009-10-20 13:04:26 | <p>I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility.</p>
<p>Can it be done? </p>
| 4,181 | 175,575 | 2014-07-16 18:09:15 | 1,594,489 | 21 | 2009-10-20 13:06:10 | 158,676 | 2009-10-20 15:27:15 | https://stackoverflow.com/q/1594477 | https://stackoverflow.com/a/1594489 | <p>Patches, that <code>git diff</code> yields, are correctly processed by <code>patch</code> tool.</p>
<p><code>patch</code> skips all the additional info git appends to the patch file. To apply the patch you most likely will need <code>-p1</code> option.</p>
| <p>Patches, that <code>git diff</code> yields, are correctly processed by <code>patch</code> tool.</p> <p><code>patch</code> skips all the additional info git appends to the patch file. To apply the patch you most likely will need <code>-p1</code> option.</p> | 119, 2132 | git, patch | <h1>Can git format patch so it can be used with patch program?</h1>
<p>I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility.</p>
<p>Can it be done? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,336 | git | # Can git format patch so it can be used with patch program?
I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility.
Can it be done? | Patches, that `git diff` yields, are correctly processed by `patch` tool.
`patch` skips all the additional info git appends to the patch file. To apply the patch you most likely will need `-p1` option. |
327249 | Seeking examples of workflow using git-format-patch and git am | 19 | 2008-11-29 06:16:01 | <p>I'm thinking of asking my students to use git for pair programming. Because student work has to be secret, a public repo is out of the question. Instead, each student will have a private repo they maintain themselves, and they will need to exchange patches using git-format-patch. I've read the man page but I'm a ... | 14,364 | 41,661 | 2016-01-26 23:11:30 | 327,258 | 21 | 2008-11-29 06:25:04 | 39,975 | 2008-11-29 06:25:04 | https://stackoverflow.com/q/327249 | https://stackoverflow.com/a/327258 | <p>It works best if they can see each other's git repos. git itself is managed this way (there's a public repo people can reference, and then they format-patch from there). If people <em>never</em> see each other's repos, things are a bit more difficult...</p>
<p>One thing they may do is maintain a reference to the ... | <p>It works best if they can see each other's git repos. git itself is managed this way (there's a public repo people can reference, and then they format-patch from there). If people <em>never</em> see each other's repos, things are a bit more difficult...</p> <p>One thing they may do is maintain a reference to the ... | 119, 456, 758 | git, version-control, workflow | <h1>Seeking examples of workflow using git-format-patch and git am</h1>
<p>I'm thinking of asking my students to use git for pair programming. Because student work has to be secret, a public repo is out of the question. Instead, each student will have a private repo they maintain themselves, and they will need to exc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,337 | git | # Seeking examples of workflow using git-format-patch and git am
I'm thinking of asking my students to use git for pair programming. Because student work has to be secret, a public repo is out of the question. Instead, each student will have a private repo they maintain themselves, and they will need to exchange patch... | It works best if they can see each other's git repos. git itself is managed this way (there's a public repo people can reference, and then they format-patch from there). If people *never* see each other's repos, things are a bit more difficult...
One thing they may do is maintain a reference to the last time they did ... |
35704958 | Git log excluding branch | 18 | 2016-02-29 16:48:56 | <p>Consider the following commit history:</p>
<pre><code>1---R---3---5---P-> # patch-v1.1
\ \
2---4---+---8---+---10---R-> # release-v2.0
\ /
6---7---9 # feature-foo
--> time
# 1 - 10 are commits
# P is a patch release commit
... | 7,306 | 4,138,801 | 2016-02-29 17:33:36 | 35,705,784 | 21 | 2016-02-29 17:33:36 | 1,127,485 | 2016-02-29 17:33:36 | https://stackoverflow.com/q/35704958 | https://stackoverflow.com/a/35705784 | <p>Use <code>git log R --not P</code>. That's the same as <code>git log P..R</code> from @micha-wiedenmann's comment, but I find the former syntax more speaking. And yes, it will include <code>2, 4, 6, 7, 9</code> as it does not matter when they chronologically happened (in terms of time authored), but where they are i... | <p>Use <code>git log R --not P</code>. That's the same as <code>git log P..R</code> from @micha-wiedenmann's comment, but I find the former syntax more speaking. And yes, it will include <code>2, 4, 6, 7, 9</code> as it does not matter when they chronologically happened (in terms of time authored), but where they are i... | 119, 47913, 76220 | git, git-branch, git-log | <h1>Git log excluding branch</h1>
<p>Consider the following commit history:</p>
<pre><code>1---R---3---5---P-> # patch-v1.1
\ \
2---4---+---8---+---10---R-> # release-v2.0
\ /
6---7---9 # feature-foo
--> time
# 1 - 10 are comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,341 | git | # Git log excluding branch
Consider the following commit history:
```
1---R---3---5---P-> # patch-v1.1
\ \
2---4---+---8---+---10---R-> # release-v2.0
\ /
6---7---9 # feature-foo
--> time
# 1 - 10 are commits
# P is a patch release co... | Use `git log R --not P`. That's the same as `git log P..R` from @micha-wiedenmann's comment, but I find the former syntax more speaking. And yes, it will include `2, 4, 6, 7, 9` as it does not matter when they chronologically happened (in terms of time authored), but where they are in the DAG. With `R --not P` you basi... |
17042093 | git track branch with different name | 18 | 2013-06-11 10:38:52 | <p>I have a repo which tracks non-default branches. So, there is a local branch named "master" which should track "origin/master-13.07". I've done "push -u", and I believe it should be enough, the branch is tracked. Output of the <code>git branch -vv</code>:</p>
<pre><code>C:\work\repo>git branch -vv
stuff 68... | 6,284 | 438,742 | 2018-12-02 02:14:23 | 17,045,911 | 21 | 2013-06-11 13:54:21 | 894,194 | 2013-06-11 13:54:21 | https://stackoverflow.com/q/17042093 | https://stackoverflow.com/a/17045911 | <p>Ok. With the informations you added, I think you simply have to change <code>push.default</code> to value <code>upstream</code>.</p>
<p>You probably configured the actual value after upgrading Git and seeing this message :</p>
<pre><code>warning: push.default is unset; its implicit value is changing in
Git 2.0 fr... | <p>Ok. With the informations you added, I think you simply have to change <code>push.default</code> to value <code>upstream</code>.</p> <p>You probably configured the actual value after upgrading Git and seeing this message :</p> <pre><code>warning: push.default is unset; its implicit value is changing in Git 2.0 fr... | 119, 76220 | git, git-branch | <h1>git track branch with different name</h1>
<p>I have a repo which tracks non-default branches. So, there is a local branch named "master" which should track "origin/master-13.07". I've done "push -u", and I believe it should be enough, the branch is tracked. Output of the <code>git branch -vv</code>:</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,342 | git | # git track branch with different name
I have a repo which tracks non-default branches. So, there is a local branch named "master" which should track "origin/master-13.07". I've done "push -u", and I believe it should be enough, the branch is tracked. Output of the `git branch -vv`:
```
C:\work\repo>git branch -vv
... | Ok. With the informations you added, I think you simply have to change `push.default` to value `upstream`.
You probably configured the actual value after upgrading Git and seeing this message :
```
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this ... |
15684197 | Git files modified after checkout, reset --hard, etc. even though autocrlf is set to false | 18 | 2013-03-28 14:17:16 | <p>Here is my system dialogue:</p>
<pre><code>unrollme-dev-dan:views Dan$ git reset --hard HEAD
HEAD is now at 3f225e9 Fix scan titles
unrollme-dev-dan:views Dan$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -... | 6,373 | 1,339,987 | 2015-10-22 00:07:08 | 15,687,693 | 21 | 2013-03-28 16:52:23 | 845,424 | 2015-10-22 00:07:08 | https://stackoverflow.com/q/15684197 | https://stackoverflow.com/a/15687693 | <p>This problem can be caused by gitattributes' text option
<a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html">https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html</a></p>
<p>This problem can be fixed by temporarily editing your <code>.gitattributes</code> file within your pro... | <p>This problem can be caused by gitattributes' text option <a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html">https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html</a></p> <p>This problem can be fixed by temporarily editing your <code>.gitattributes</code> file within your pro... | 119, 3705, 59139 | core.autocrlf, git, newline | <h1>Git files modified after checkout, reset --hard, etc. even though autocrlf is set to false</h1>
<p>Here is my system dialogue:</p>
<pre><code>unrollme-dev-dan:views Dan$ git reset --hard HEAD
HEAD is now at 3f225e9 Fix scan titles
unrollme-dev-dan:views Dan$ git status
# On branch master
# Changes not staged for c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,343 | git | # Git files modified after checkout, reset --hard, etc. even though autocrlf is set to false
Here is my system dialogue:
```
unrollme-dev-dan:views Dan$ git reset --hard HEAD
HEAD is now at 3f225e9 Fix scan titles
unrollme-dev-dan:views Dan$ git status
# On branch master
# Changes not staged for commit:
# (use "git... | This problem can be caused by gitattributes' text option
<https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html>
This problem can be fixed by temporarily editing your `.gitattributes` file within your project folder.
change `* text=auto` to `#* text=auto` make the necessary changes to files line endings... |
13571849 | How do I remove git's MERGE_MSG? | 18 | 2012-11-26 19:37:03 | <p>I've tried a few things suggested, but nothing seems to remove it. This started occurring when I upgraded to Mountain Lion OS X. Anytime I do a <code>git pull</code>, it displays this annoying as heck empty editor with the title MERGE_MSG.</p>
<p>How do I prevent that from popping up <em>globally</em> across all my... | 24,816 | 93,311 | 2021-09-05 04:46:57 | 13,572,465 | 21 | 2012-11-26 20:18:22 | 69,755 | 2012-11-26 20:18:22 | https://stackoverflow.com/q/13571849 | https://stackoverflow.com/a/13572465 | <p>You can either pass <code>--no-edit</code> to <code>git pull</code>, or you can set the environment variable <code>GIT_MERGE_AUTOEDIT</code> to <code>no</code>.</p>
<p>From the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html"><code>git pull</code></a> documentation:</p>
<pre><code> --edit,... | <p>You can either pass <code>--no-edit</code> to <code>git pull</code>, or you can set the environment variable <code>GIT_MERGE_AUTOEDIT</code> to <code>no</code>.</p> <p>From the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html"><code>git pull</code></a> documentation:</p> <pre><code> --edit,... | 119, 717, 28896 | git, git-pull, merge | <h1>How do I remove git's MERGE_MSG?</h1>
<p>I've tried a few things suggested, but nothing seems to remove it. This started occurring when I upgraded to Mountain Lion OS X. Anytime I do a <code>git pull</code>, it displays this annoying as heck empty editor with the title MERGE_MSG.</p>
<p>How do I prevent that from ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,344 | git | # How do I remove git's MERGE_MSG?
I've tried a few things suggested, but nothing seems to remove it. This started occurring when I upgraded to Mountain Lion OS X. Anytime I do a `git pull`, it displays this annoying as heck empty editor with the title MERGE_MSG.
How do I prevent that from popping up *globally* acros... | You can either pass `--no-edit` to `git pull`, or you can set the environment variable `GIT_MERGE_AUTOEDIT` to `no`.
From the [`git pull`](http://www.kernel.org/pub/software/scm/git/docs/git-pull.html) documentation:
```
--edit, --no-edit
Invoke an editor before committing successful mechanical merge to
... |
9093597 | How do I safely delete a remote git branch? | 18 | 2012-02-01 09:40:13 | <p>To delete a local branch in git I use <code>git branch -d</code>, but how do I safely remove a remote branch? </p>
<p>I would like to delete it <strong>only when the remote branch is merged to my current branch</strong>.</p>
| 4,603 | 190,446 | 2015-05-06 09:34:11 | 9,094,465 | 21 | 2012-02-01 10:44:35 | 520,162 | 2015-05-06 09:34:11 | https://stackoverflow.com/q/9093597 | https://stackoverflow.com/a/9094465 | <p>The answer is partly covered here: <a href="https://stackoverflow.com/questions/226976/how-can-i-know-in-git-if-a-branch-has-been-already-merged-into-master">How can I know in git if a branch has been already merged into master?</a></p>
<p>While that post copes with local branches, you could find remote branches th... | <p>The answer is partly covered here: <a href="https://stackoverflow.com/questions/226976/how-can-i-know-in-git-if-a-branch-has-been-already-merged-into-master">How can I know in git if a branch has been already merged into master?</a></p> <p>While that post copes with local branches, you could find remote branches th... | 119, 1879, 76220 | branch, git, git-branch | <h1>How do I safely delete a remote git branch?</h1>
<p>To delete a local branch in git I use <code>git branch -d</code>, but how do I safely remove a remote branch? </p>
<p>I would like to delete it <strong>only when the remote branch is merged to my current branch</strong>.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,345 | git | # How do I safely delete a remote git branch?
To delete a local branch in git I use `git branch -d`, but how do I safely remove a remote branch?
I would like to delete it **only when the remote branch is merged to my current branch**. | The answer is partly covered here: [How can I know in git if a branch has been already merged into master?](https://stackoverflow.com/questions/226976/how-can-i-know-in-git-if-a-branch-has-been-already-merged-into-master)
While that post copes with local branches, you could find remote branches that are merged or not ... |
45853613 | Is it possible to 'git diff' 2 strings? | 17 | 2017-08-24 05:30:52 | <p>I have 2 strings and I want the git diff between them. I could create file1 and add string1 as its contents.</p>
<p>Then I could create file2 and add string2 as its contents. Then I could git diff file1 and file2.</p>
<p>However, given that I have the strings as strings (and not as file contents) can I avoid these... | 8,844 | 1,205,871 | 2019-01-25 07:20:33 | 45,854,020 | 21 | 2017-08-24 06:01:48 | 6,330,106 | 2017-08-24 06:01:48 | https://stackoverflow.com/q/45853613 | https://stackoverflow.com/a/45854020 | <p>If you insist on the git way,</p>
<pre><code>git diff $(echo "my first string" | git hash-object -w --stdin) $(echo "my second string" | git hash-object -w --stdin) --word-diff
</code></pre>
| <p>If you insist on the git way,</p> <pre><code>git diff $(echo "my first string" | git hash-object -w --stdin) $(echo "my second string" | git hash-object -w --stdin) --word-diff </code></pre> | 119, 606, 9033 | diff, git, git-diff | <h1>Is it possible to 'git diff' 2 strings?</h1>
<p>I have 2 strings and I want the git diff between them. I could create file1 and add string1 as its contents.</p>
<p>Then I could create file2 and add string2 as its contents. Then I could git diff file1 and file2.</p>
<p>However, given that I have the strings as str... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,346 | git | # Is it possible to 'git diff' 2 strings?
I have 2 strings and I want the git diff between them. I could create file1 and add string1 as its contents.
Then I could create file2 and add string2 as its contents. Then I could git diff file1 and file2.
However, given that I have the strings as strings (and not as file c... | If you insist on the git way,
```
git diff $(echo "my first string" | git hash-object -w --stdin) $(echo "my second string" | git hash-object -w --stdin) --word-diff
``` |
36282085 | git merge origin/branch vs. merge branch locally | 17 | 2016-03-29 10:45:01 | <p>What is the different between when I merge the <code>origin/branchX</code> into <code>branchY</code> and merge <code>branchX</code> into <code>branchY</code>?</p>
| 17,251 | 1,167,753 | 2016-03-29 10:55:47 | 36,282,313 | 21 | 2016-03-29 10:55:47 | 1,863,229 | 2016-03-29 10:55:47 | https://stackoverflow.com/q/36282085 | https://stackoverflow.com/a/36282313 | <p><code>origin/branchX</code> is a remote tracking branch, and gets updated with changes from the remote repository every time you do a <code>git fetch</code>. On the other hand, <code>branchX</code> is your local version of this branch. <code>branchX</code> may be out of sync with <code>origin/branchX</code> which ... | <p><code>origin/branchX</code> is a remote tracking branch, and gets updated with changes from the remote repository every time you do a <code>git fetch</code>. On the other hand, <code>branchX</code> is your local version of this branch. <code>branchX</code> may be out of sync with <code>origin/branchX</code> which ... | 119 | git | <h1>git merge origin/branch vs. merge branch locally</h1>
<p>What is the different between when I merge the <code>origin/branchX</code> into <code>branchY</code> and merge <code>branchX</code> into <code>branchY</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,347 | git | # git merge origin/branch vs. merge branch locally
What is the different between when I merge the `origin/branchX` into `branchY` and merge `branchX` into `branchY`? | `origin/branchX` is a remote tracking branch, and gets updated with changes from the remote repository every time you do a `git fetch`. On the other hand, `branchX` is your local version of this branch. `branchX` may be out of sync with `origin/branchX` which in turn may be out of sync with what is actually on the remo... |
12527964 | GIT: How to checkout a file from a previous commit without overwriting the current one? | 17 | 2012-09-21 09:37:54 | <p>Several commits previously I had some javascript working one way. Over the course of several commits I now have it working another way. I would like to look at the file as it was several commits ago because I might want to use aspects of it in the new javascript. However I don't want to revert my current file to exa... | 1,311 | 467,859 | 2012-09-21 10:17:29 | 12,528,611 | 21 | 2012-09-21 10:17:29 | 390,522 | 2012-09-21 10:17:29 | https://stackoverflow.com/q/12527964 | https://stackoverflow.com/a/12528611 | <p>Simply redirect the output of <code>git show</code> to a file.</p>
<pre><code>git show *SHA-of-old-commit*:*filename* > newfilename
</code></pre>
<p>eg:</p>
<pre><code>git show 7c4eacc:main.cpp > main.cpp.old
</code></pre>
| <p>Simply redirect the output of <code>git show</code> to a file.</p> <pre><code>git show *SHA-of-old-commit*:*filename* > newfilename </code></pre> <p>eg:</p> <pre><code>git show 7c4eacc:main.cpp > main.cpp.old </code></pre> | 119, 456 | git, version-control | <h1>GIT: How to checkout a file from a previous commit without overwriting the current one?</h1>
<p>Several commits previously I had some javascript working one way. Over the course of several commits I now have it working another way. I would like to look at the file as it was several commits ago because I might want ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,348 | git | # GIT: How to checkout a file from a previous commit without overwriting the current one?
Several commits previously I had some javascript working one way. Over the course of several commits I now have it working another way. I would like to look at the file as it was several commits ago because I might want to use as... | Simply redirect the output of `git show` to a file.
```
git show *SHA-of-old-commit*:*filename* > newfilename
```
eg:
```
git show 7c4eacc:main.cpp > main.cpp.old
``` |
10320234 | git log foo..bar -- how to see *merge dates* for changesets? | 17 | 2012-04-25 16:51:58 | <p>Is it possible to get 'git log' to give the date <em>when a changeset landed on a branch</em> rather than the date when the changeset was created? 'git log --graph' (example truncated output below) gives me much of what I want, but it still prints the dates when the individual changesets were created rather than whe... | 19,890 | 5,950 | 2012-04-25 17:07:45 | 10,320,472 | 21 | 2012-04-25 17:07:45 | 157,336 | 2012-04-25 17:07:45 | https://stackoverflow.com/q/10320234 | https://stackoverflow.com/a/10320472 | <p>You can see part of the answer: When branch <code>foo</code> was merged into <code>master</code>, it created a new commit (7e8d68) with two parents.</p>
<p>But when <code>bar</code> was merged into <code>master</code>, it was a <em>fast-forward</em> merge. That is, all of the commits on <code>bar</code> were newer ... | <p>You can see part of the answer: When branch <code>foo</code> was merged into <code>master</code>, it created a new commit (7e8d68) with two parents.</p> <p>But when <code>bar</code> was merged into <code>master</code>, it was a <em>fast-forward</em> merge. That is, all of the commits on <code>bar</code> were newer ... | 119 | git | <h1>git log foo..bar -- how to see *merge dates* for changesets?</h1>
<p>Is it possible to get 'git log' to give the date <em>when a changeset landed on a branch</em> rather than the date when the changeset was created? 'git log --graph' (example truncated output below) gives me much of what I want, but it still prints... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,349 | git | # git log foo..bar -- how to see *merge dates* for changesets?
Is it possible to get 'git log' to give the date *when a changeset landed on a branch* rather than the date when the changeset was created? 'git log --graph' (example truncated output below) gives me much of what I want, but it still prints the dates when ... | You can see part of the answer: When branch `foo` was merged into `master`, it created a new commit (7e8d68) with two parents.
But when `bar` was merged into `master`, it was a *fast-forward* merge. That is, all of the commits on `bar` were newer than the newest work on `master`, so they could just be tacked onto the ... |
8803069 | Change branch-off point | 17 | 2012-01-10 12:10:44 | <p>I have a branch called <code>feature</code> and it has a few commits. The branch and its commits are still local to my machine (haven't been <code>push</code>ed to a public repository). The graph looks like</p>
<pre><code>A---B---C---D---E---F---G master
\
P---Q---R featur... | 2,322 | 51,782 | 2012-01-10 12:27:25 | 8,803,179 | 21 | 2012-01-10 12:21:15 | 1,061,656 | 2012-01-10 12:21:15 | https://stackoverflow.com/q/8803069 | https://stackoverflow.com/a/8803179 | <p>What you want to do is a <em>rebase</em>. To pick up the commits <code>P</code>, <code>Q</code> and <code>R</code> and apply them on top of <code>C</code>, you execute:</p>
<pre><code>git rebase --onto C F feature
</code></pre>
<p>See the man-page of <code>git-rebase</code> for more information.</p>
| <p>What you want to do is a <em>rebase</em>. To pick up the commits <code>P</code>, <code>Q</code> and <code>R</code> and apply them on top of <code>C</code>, you execute:</p> <pre><code>git rebase --onto C F feature </code></pre> <p>See the man-page of <code>git-rebase</code> for more information.</p> | 119 | git | <h1>Change branch-off point</h1>
<p>I have a branch called <code>feature</code> and it has a few commits. The branch and its commits are still local to my machine (haven't been <code>push</code>ed to a public repository). The graph looks like</p>
<pre><code>A---B---C---D---E---F---G master
\
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,350 | git | # Change branch-off point
I have a branch called `feature` and it has a few commits. The branch and its commits are still local to my machine (haven't been `push`ed to a public repository). The graph looks like
```
A---B---C---D---E---F---G master
\
P---Q---R feature
```
Now ... | What you want to do is a *rebase*. To pick up the commits `P`, `Q` and `R` and apply them on top of `C`, you execute:
```
git rebase --onto C F feature
```
See the man-page of `git-rebase` for more information. |
7947071 | git ignore multiple matching files | 17 | 2011-10-30 19:02:31 | <p>I try to ignore file in a directory by relative path. E.g. I have several directories in working tree <code>lib/file.f</code> and I want all occurrences of this file to be ignored. I tried</p>
<pre><code>lib/file.f
</code></pre>
<p>but this does not work.</p>
| 20,043 | 471,149 | 2015-09-01 02:28:27 | 7,947,136 | 21 | 2011-10-30 19:12:53 | 190,597 | 2015-01-20 13:11:45 | https://stackoverflow.com/q/7947071 | https://stackoverflow.com/a/7947136 | <p>Place </p>
<pre><code>*/lib/file.f
</code></pre>
<p>in your <code>.gitignore</code>. This will cause git to ignore any file of the form <code>project/<DIR>/lib/file.f</code>, assuming <code>.gitignore</code> is in the <code>project</code> directory.
To make git ignore <code>lib/file.f</code> two directories ... | <p>Place </p> <pre><code>*/lib/file.f </code></pre> <p>in your <code>.gitignore</code>. This will cause git to ignore any file of the form <code>project/<DIR>/lib/file.f</code>, assuming <code>.gitignore</code> is in the <code>project</code> directory. To make git ignore <code>lib/file.f</code> two directories ... | 119 | git | <h1>git ignore multiple matching files</h1>
<p>I try to ignore file in a directory by relative path. E.g. I have several directories in working tree <code>lib/file.f</code> and I want all occurrences of this file to be ignored. I tried</p>
<pre><code>lib/file.f
</code></pre>
<p>but this does not work.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,351 | git | # git ignore multiple matching files
I try to ignore file in a directory by relative path. E.g. I have several directories in working tree `lib/file.f` and I want all occurrences of this file to be ignored. I tried
```
lib/file.f
```
but this does not work. | Place
```
*/lib/file.f
```
in your `.gitignore`. This will cause git to ignore any file of the form `project/<DIR>/lib/file.f`, assuming `.gitignore` is in the `project` directory.
To make git ignore `lib/file.f` two directories down, you'd also have to add
```
*/*/lib/file.f
```
to the `.gitignore`, and so on.
Va... |
1743876 | How are git branches imported into mercurial with hg convert? | 17 | 2009-11-16 18:09:25 | <p>I have a number of branches in a git repository:</p>
<pre><code>david@Panama ~/app: git branch -r
origin/HEAD -> origin/master
origin/master
origin/newButtons
origin/newFonts
origin/serverView
</code></pre>
<p>If I try and import this git repo into mercurial:</p>
<pre><code>david@Panama ~/: hg convert app
...
d... | 1,829 | 2,183 | 2022-03-20 15:57:48 | 1,745,074 | 21 | 2009-11-16 21:48:38 | 6,309 | 2011-02-05 22:42:20 | https://stackoverflow.com/q/1743876 | https://stackoverflow.com/a/1745074 | <p>This is by design. Imported Git branches are only labeled in Mercurial, and <code>hg heads</code> should give you the correct number of imported "branches".</p>
<p>As mentioned in <a href="http://www.selenic.com/pipermail/mercurial/2007-December/016061.html" rel="nofollow noreferrer">this thread</a>:</p>
<p>Consid... | <p>This is by design. Imported Git branches are only labeled in Mercurial, and <code>hg heads</code> should give you the correct number of imported "branches".</p> <p>As mentioned in <a href="http://www.selenic.com/pipermail/mercurial/2007-December/016061.html" rel="nofollow noreferrer">this thread</a>:</p> <p>Consid... | 119, 802, 1879 | branch, git, mercurial | <h1>How are git branches imported into mercurial with hg convert?</h1>
<p>I have a number of branches in a git repository:</p>
<pre><code>david@Panama ~/app: git branch -r
origin/HEAD -> origin/master
origin/master
origin/newButtons
origin/newFonts
origin/serverView
</code></pre>
<p>If I try and import this git re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,352 | git | # How are git branches imported into mercurial with hg convert?
I have a number of branches in a git repository:
```
david@Panama ~/app: git branch -r
origin/HEAD -> origin/master
origin/master
origin/newButtons
origin/newFonts
origin/serverView
```
If I try and import this git repo into mercurial:
```
david@Pana... | This is by design. Imported Git branches are only labeled in Mercurial, and `hg heads` should give you the correct number of imported "branches".
As mentioned in [this thread](http://www.selenic.com/pipermail/mercurial/2007-December/016061.html):
Consider a tree that looks like this:
```
o-o-o-o-o-o-b <- bra... |
1680582 | git-svn password change | 17 | 2009-11-05 13:27:07 | <p>I'm using TortoiseGit on Windows XP.</p>
<p>My team all use a central svn server as our central "canonical" code repository. It's all run on a windows network.</p>
<p>I work locally with git, then use git-svn dcommit to commit regularly to the svn server.</p>
<p>Our network enforces a regular password change - wh... | 8,862 | 156,572 | 2015-03-02 07:20:04 | 1,680,859 | 21 | 2009-11-05 14:18:42 | 43,582 | 2009-11-05 14:18:42 | https://stackoverflow.com/q/1680582 | https://stackoverflow.com/a/1680859 | <p><code>git-svn</code> uses Subversion’s perl modules which in turn uses “normal” Subversion authentication. That means that your authentication data is stored somewhere in <code>$HOME/.subversion</code>, e.g. in one of the files in <code>$HOME/.subversion/svn.simple/</code> when you are using a simple username-passwo... | <p><code>git-svn</code> uses Subversion’s perl modules which in turn uses “normal” Subversion authentication. That means that your authentication data is stored somewhere in <code>$HOME/.subversion</code>, e.g. in one of the files in <code>$HOME/.subversion/svn.simple/</code> when you are using a simple username-passwo... | 119, 220, 6452 | git, git-svn, passwords | <h1>git-svn password change</h1>
<p>I'm using TortoiseGit on Windows XP.</p>
<p>My team all use a central svn server as our central "canonical" code repository. It's all run on a windows network.</p>
<p>I work locally with git, then use git-svn dcommit to commit regularly to the svn server.</p>
<p>Our network enforc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,353 | git | # git-svn password change
I'm using TortoiseGit on Windows XP.
My team all use a central svn server as our central "canonical" code repository. It's all run on a windows network.
I work locally with git, then use git-svn dcommit to commit regularly to the svn server.
Our network enforces a regular password change -... | `git-svn` uses Subversion’s perl modules which in turn uses “normal” Subversion authentication. That means that your authentication data is stored somewhere in `$HOME/.subversion`, e.g. in one of the files in `$HOME/.subversion/svn.simple/` when you are using a simple username-password combination to authenticate. |
52789519 | How does `git rebase` skip the commit which its change already has in upstream? | 16 | 2018-10-13 04:27:44 | <p><a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">git-rebase document</a> says:</p>
<blockquote>
<p>If the upstream branch already contains a change you have made (e.g., because you mailed a patch which was applied upstream), then that commit will be skipped.</p>
</blockquote>
<p>But how does Git do... | 36,775 | 5,617,850 | 2021-09-19 13:58:29 | 52,789,919 | 21 | 2018-10-13 05:44:52 | 6,309 | 2021-09-19 13:58:29 | https://stackoverflow.com/q/52789519 | https://stackoverflow.com/a/52789919 | <p>The <a href="https://github.com/git/git/commit/a420585f3896c86a8641a0d46483acd2036cb5a3#diff-e76985cd790d625e51082908f0752b45R299" rel="noreferrer">first versions of <code>git rebase</code></a> (1.4.4, Oct. 2006) were using <a href="https://git-scm.com/docs/git-format-patch#git-format-patch---ignore-if-in-upstream" ... | <p>The <a href="https://github.com/git/git/commit/a420585f3896c86a8641a0d46483acd2036cb5a3#diff-e76985cd790d625e51082908f0752b45R299" rel="noreferrer">first versions of <code>git rebase</code></a> (1.4.4, Oct. 2006) were using <a href="https://git-scm.com/docs/git-format-patch#git-format-patch---ignore-if-in-upstream" ... | 119, 29934 | git, git-rebase | <h1>How does `git rebase` skip the commit which its change already has in upstream?</h1>
<p><a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">git-rebase document</a> says:</p>
<blockquote>
<p>If the upstream branch already contains a change you have made (e.g., because you mailed a patch which was appli... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,356 | git | # How does `git rebase` skip the commit which its change already has in upstream?
[git-rebase document](https://git-scm.com/docs/git-rebase) says:
> If the upstream branch already contains a change you have made (e.g., because you mailed a patch which was applied upstream), then that commit will be skipped.
But how ... | The [first versions of `git rebase`](https://github.com/git/git/commit/a420585f3896c86a8641a0d46483acd2036cb5a3#diff-e76985cd790d625e51082908f0752b45R299) (1.4.4, Oct. 2006) were using [`git format --ignore-if-in-upstream`](https://git-scm.com/docs/git-format-patch#git-format-patch---ignore-if-in-upstream)
> This will... |
26590439 | How to add an enterprise certificate authority (CA) to git on cygwin (and some linux distros) | 16 | 2014-10-27 14:58:33 | <p>When fetching with git on Cygwin you get:</p>
<pre><code>Fetching origin
fatal: unable to access 'https://.../...git': SSL certificate problem: self signed certificate in certificate chain
error: Could not fetch origin
</code></pre>
<p>The certificate was added to <code>/etc/ssl/certs/ca-bundle.crt</code> and <a h... | 33,256 | 58,794 | 2019-11-13 14:13:55 | 26,590,440 | 21 | 2014-10-27 14:58:33 | 58,794 | 2014-10-27 14:58:33 | https://stackoverflow.com/q/26590439 | https://stackoverflow.com/a/26590440 | <p><code>git-remote-https</code> will read the following files for ca certificates:</p>
<pre><code>/etc/ssl/certs/ca-bundle.crt
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
</code></pre>
<p>If you edit these files, they will be overwritten each time the Cygwin setup is run and there is an update for the <a... | <p><code>git-remote-https</code> will read the following files for ca certificates:</p> <pre><code>/etc/ssl/certs/ca-bundle.crt /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt </code></pre> <p>If you edit these files, they will be overwritten each time the Cygwin setup is run and there is an update for the <a... | 119, 641, 1731, 5954, 6011 | ca, certificate, cygwin, git, ssl | <h1>How to add an enterprise certificate authority (CA) to git on cygwin (and some linux distros)</h1>
<p>When fetching with git on Cygwin you get:</p>
<pre><code>Fetching origin
fatal: unable to access 'https://.../...git': SSL certificate problem: self signed certificate in certificate chain
error: Could not fetch o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,357 | git | # How to add an enterprise certificate authority (CA) to git on cygwin (and some linux distros)
When fetching with git on Cygwin you get:
```
Fetching origin
fatal: unable to access 'https://.../...git': SSL certificate problem: self signed certificate in certificate chain
error: Could not fetch origin
```
The certi... | `git-remote-https` will read the following files for ca certificates:
```
/etc/ssl/certs/ca-bundle.crt
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
```
If you edit these files, they will be overwritten each time the Cygwin setup is run and there is an update for the [ca-certificates](http://cygwin.com/cgi-... |
14527257 | Git doesn't recognize renamed and modified package file | 16 | 2013-01-25 17:33:42 | <p>I had a java file called <code>package/old/myfile.java</code>. I had committed this file through git. I then renamed my package to <code>new</code> so my file was in <code>package/new/myfile.java</code>. </p>
<p>I now want to commit this file rename (and content changes) to git. </p>
<p>When I do <code>git status<... | 14,337 | 438,154 | 2015-07-24 22:08:10 | 14,527,379 | 21 | 2013-01-25 17:42:00 | 166,732 | 2013-01-25 17:42:00 | https://stackoverflow.com/q/14527257 | https://stackoverflow.com/a/14527379 | <p>The <a href="http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Moving-Files">relevant section</a> from the <a href="http://git-scm.com/book">git book</a> explains this.</p>
<blockquote>
<p>Unlike many other VCS systems, Git doesn’t explicitly track file movement. If you rename a file in Gi... | <p>The <a href="http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Moving-Files">relevant section</a> from the <a href="http://git-scm.com/book">git book</a> explains this.</p> <blockquote> <p>Unlike many other VCS systems, Git doesn’t explicitly track file movement. If you rename a file in Gi... | 17, 119 | git, java | <h1>Git doesn't recognize renamed and modified package file</h1>
<p>I had a java file called <code>package/old/myfile.java</code>. I had committed this file through git. I then renamed my package to <code>new</code> so my file was in <code>package/new/myfile.java</code>. </p>
<p>I now want to commit this file rename (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,359 | git | # Git doesn't recognize renamed and modified package file
I had a java file called `package/old/myfile.java`. I had committed this file through git. I then renamed my package to `new` so my file was in `package/new/myfile.java`.
I now want to commit this file rename (and content changes) to git.
When I do `git statu... | The [relevant section](http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Moving-Files) from the [git book](http://git-scm.com/book) explains this.
> Unlike many other VCS systems, Git doesn’t explicitly track file movement. If you rename a file in Git, no metadata is stored in Git that tells it... |
7437261 | How is it possible to use raw_input() in a Python Git hook? | 16 | 2011-09-15 20:48:22 | <p>I am writing a pre-commit hook for Git that runs pyflakes and checks for tabs and trailing spaces in the modified files (<a href="https://github.com/badzil/miscellaneous/blob/master/pre-commit">code on Github</a>). I would like to make it possible to override the hook by asking for user confirmation as follows:</p>
... | 2,514 | 787,802 | 2013-03-22 17:16:49 | 7,437,724 | 21 | 2011-09-15 21:36:10 | 190,597 | 2011-09-15 23:39:09 | https://stackoverflow.com/q/7437261 | https://stackoverflow.com/a/7437724 | <p>You could use:</p>
<pre><code>sys.stdin = open('/dev/tty')
answer = raw_input('Commit anyway? [N/y] ')
if answer.strip().lower().startswith('y'):
...
</code></pre>
<hr>
<p><code>git commit</code> calls <code>python .git/hooks/pre-commit</code>:</p>
<pre><code>% ps axu
...
unutbu 21801 0.0 0.1 6348 152... | <p>You could use:</p> <pre><code>sys.stdin = open('/dev/tty') answer = raw_input('Commit anyway? [N/y] ') if answer.strip().lower().startswith('y'): ... </code></pre> <hr> <p><code>git commit</code> calls <code>python .git/hooks/pre-commit</code>:</p> <pre><code>% ps axu ... unutbu 21801 0.0 0.1 6348 152... | 16, 119, 43087 | git, githooks, python | <h1>How is it possible to use raw_input() in a Python Git hook?</h1>
<p>I am writing a pre-commit hook for Git that runs pyflakes and checks for tabs and trailing spaces in the modified files (<a href="https://github.com/badzil/miscellaneous/blob/master/pre-commit">code on Github</a>). I would like to make it possible ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,361 | git | # How is it possible to use raw_input() in a Python Git hook?
I am writing a pre-commit hook for Git that runs pyflakes and checks for tabs and trailing spaces in the modified files ([code on Github](https://github.com/badzil/miscellaneous/blob/master/pre-commit)). I would like to make it possible to override the hook... | You could use:
```
sys.stdin = open('/dev/tty')
answer = raw_input('Commit anyway? [N/y] ')
if answer.strip().lower().startswith('y'):
...
```
---
`git commit` calls `python .git/hooks/pre-commit`:
```
% ps axu
...
unutbu 21801 0.0 0.1 6348 1520 pts/1 S+ 17:44 0:00 git commit -am line 5a
unutbu ... |
2245082 | Can I get a list of changed files in a git sub-folder between two commits? | 16 | 2010-02-11 14:32:40 | <p>I have a git repo containing many folders.
I need to find out what files have changed in one of those folders between two commits.</p>
<p>Is there a nice way of doing this?</p>
| 6,509 | 4,787 | 2010-02-11 15:43:04 | 2,245,096 | 21 | 2010-02-11 14:35:22 | 107,415 | 2010-02-11 15:43:04 | https://stackoverflow.com/q/2245082 | https://stackoverflow.com/a/2245096 | <p>I think you can just stick the path at the end of <code>git diff</code>.</p>
<pre><code>git diff HEAD^ HEAD special_folder/
</code></pre>
| <p>I think you can just stick the path at the end of <code>git diff</code>.</p> <pre><code>git diff HEAD^ HEAD special_folder/ </code></pre> | 119 | git | <h1>Can I get a list of changed files in a git sub-folder between two commits?</h1>
<p>I have a git repo containing many folders.
I need to find out what files have changed in one of those folders between two commits.</p>
<p>Is there a nice way of doing this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,362 | git | # Can I get a list of changed files in a git sub-folder between two commits?
I have a git repo containing many folders.
I need to find out what files have changed in one of those folders between two commits.
Is there a nice way of doing this? | I think you can just stick the path at the end of `git diff`.
```
git diff HEAD^ HEAD special_folder/
``` |
55054213 | Filter remote branches in git | 15 | 2019-03-07 23:03:54 | <p>I’d like <code>git branch -a</code> to only show a subset of remote branches, e.g. branches that begin with prefix like 'origin/iliaskarim'</p>
<p>What is the nicest way to accomplish this?</p>
| 11,072 | 414,415 | 2022-05-12 12:44:38 | 55,078,144 | 21 | 2019-03-09 14:04:09 | 414,415 | 2022-05-12 12:44:38 | https://stackoverflow.com/q/55054213 | https://stackoverflow.com/a/55078144 | <pre><code>git branch -r --list origin/iliaskarim\*
</code></pre>
| <pre><code>git branch -r --list origin/iliaskarim\* </code></pre> | 119, 76220 | git, git-branch | <h1>Filter remote branches in git</h1>
<p>I’d like <code>git branch -a</code> to only show a subset of remote branches, e.g. branches that begin with prefix like 'origin/iliaskarim'</p>
<p>What is the nicest way to accomplish this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,364 | git | # Filter remote branches in git
I’d like `git branch -a` to only show a subset of remote branches, e.g. branches that begin with prefix like 'origin/iliaskarim'
What is the nicest way to accomplish this? | ```
git branch -r --list origin/iliaskarim\*
``` |
46943708 | What is a Ref in Git? | 15 | 2017-10-25 23:47:44 | <p>The error I received in attempting to push suggests that I consult the ‘Note about fast-forwards’ in ‘git push --help’ </p>
<p>This note contains the paragraph </p>
<blockquote>
<p>When an update changes a branch (or more in general, a ref) that used to point at commit A to point at another commit B, it is call... | 8,284 | 1,592,821 | 2023-03-23 18:47:40 | 46,944,359 | 21 | 2017-10-26 01:18:00 | 1,256,452 | 2017-10-26 01:23:13 | https://stackoverflow.com/q/46943708 | https://stackoverflow.com/a/46944359 | <p>Use <a href="https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_ref" rel="noreferrer">the actual Git glossary</a> instead:</p>
<blockquote>
<p>A name that begins with <code>refs/</code> (e.g. <code>refs/heads/master</code>) that points to an <a href="https://www.kernel.org/pub/software/scm/git/... | <p>Use <a href="https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_ref" rel="noreferrer">the actual Git glossary</a> instead:</p> <blockquote> <p>A name that begins with <code>refs/</code> (e.g. <code>refs/heads/master</code>) that points to an <a href="https://www.kernel.org/pub/software/scm/git/... | 119 | git | <h1>What is a Ref in Git?</h1>
<p>The error I received in attempting to push suggests that I consult the ‘Note about fast-forwards’ in ‘git push --help’ </p>
<p>This note contains the paragraph </p>
<blockquote>
<p>When an update changes a branch (or more in general, a ref) that used to point at commit A to point ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,365 | git | # What is a Ref in Git?
The error I received in attempting to push suggests that I consult the ‘Note about fast-forwards’ in ‘git push --help’
This note contains the paragraph
> When an update changes a branch (or more in general, a ref) that used to point at commit A to point at another commit B, it is called a fas... | Use [the actual Git glossary](https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_ref) instead:
> A name that begins with `refs/` (e.g. `refs/heads/master`) that points to an [object name](https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_object_name) or another ref ...
Note that... |
45688121 | How to do submodule sparse-checkout with Git? | 15 | 2017-08-15 07:19:12 | <p>There are a lot of articles and SO questions about sparse-checkout. Unfortunately I did not find concrete examples. I would like to get this following example work:</p>
<h3>Create a submodule</h3>
<pre><code>cd ~
mkdir sub && cd $_
git init
mkdir foo && touch $_/foo
mkdir bar && touch $_/b... | 13,322 | 2,612,235 | 2024-05-09 20:56:34 | 45,689,692 | 21 | 2017-08-15 09:01:53 | 2,303,202 | 2022-07-22 15:35:22 | https://stackoverflow.com/q/45688121 | https://stackoverflow.com/a/45689692 | <p><code>git submodule add</code> itself checks out the submodule.</p>
<p>What succeeded for me was:</p>
<pre class="lang-sh prettyprint-override"><code>git init
# I did not find a way to add submodule in 1 step without checking out
git clone --depth=1 --no-checkout ../sub sub
git submodule add ../sub sub
git submodul... | <p><code>git submodule add</code> itself checks out the submodule.</p> <p>What succeeded for me was:</p> <pre class="lang-sh prettyprint-override"><code>git init # I did not find a way to add submodule in 1 step without checking out git clone --depth=1 --no-checkout ../sub sub git submodule add ../sub sub git submodul... | 119, 41612, 118645 | git, git-sparse-checkout, git-submodules | <h1>How to do submodule sparse-checkout with Git?</h1>
<p>There are a lot of articles and SO questions about sparse-checkout. Unfortunately I did not find concrete examples. I would like to get this following example work:</p>
<h3>Create a submodule</h3>
<pre><code>cd ~
mkdir sub && cd $_
git init
mkdir foo ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,366 | git | # How to do submodule sparse-checkout with Git?
There are a lot of articles and SO questions about sparse-checkout. Unfortunately I did not find concrete examples. I would like to get this following example work:
### Create a submodule
```
cd ~
mkdir sub && cd $_
git init
mkdir foo && touch $_/foo
mkdir bar && touc... | `git submodule add` itself checks out the submodule.
What succeeded for me was:
```
git init
# I did not find a way to add submodule in 1 step without checking out
git clone --depth=1 --no-checkout ../sub sub
git submodule add ../sub sub
git submodule absorbgitdirs
# note there is no "submodule.sub.sparsecheckout" ke... |
28246216 | Git: When does Git perform garbage collection? | 15 | 2015-01-30 23:18:03 | <p>I was wondering: when does Git perform its garbage collection? I know that in the past one had to invoke <code>git gc</code> to manually start the garbage collection, but now it is done automatically, when?</p>
<p>Also, is there a need to invoke it manually in the latest Git versions?</p>
| 4,134 | 267,416 | 2018-03-11 03:59:08 | 28,246,989 | 21 | 2015-01-31 00:54:19 | 1,256,452 | 2018-03-11 03:59:08 | https://stackoverflow.com/q/28246216 | https://stackoverflow.com/a/28246989 | <p>Much of the answer is in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer"><code>git gc</code> documentation</a>:</p>
<blockquote>
<p><code>--auto</code></p>
<p>With this option, <em>git gc</em> checks whether any housekeeping is required; if not, it exits without performing... | <p>Much of the answer is in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer"><code>git gc</code> documentation</a>:</p> <blockquote> <p><code>--auto</code></p> <p>With this option, <em>git gc</em> checks whether any housekeeping is required; if not, it exits without performing... | 119, 456, 1850, 44929 | garbage-collection, git, git-gc, version-control | <h1>Git: When does Git perform garbage collection?</h1>
<p>I was wondering: when does Git perform its garbage collection? I know that in the past one had to invoke <code>git gc</code> to manually start the garbage collection, but now it is done automatically, when?</p>
<p>Also, is there a need to invoke it manually in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,370 | git | # Git: When does Git perform garbage collection?
I was wondering: when does Git perform its garbage collection? I know that in the past one had to invoke `git gc` to manually start the garbage collection, but now it is done automatically, when?
Also, is there a need to invoke it manually in the latest Git versions? | Much of the answer is in the [`git gc` documentation](https://www.kernel.org/pub/software/scm/git/docs/git-gc.html):
> `--auto`
>
> With this option, *git gc* checks whether any housekeeping is required; if not, it exits without performing any work. Some git commands run `git gc --auto` after performing operations tha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.