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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4159950 | How do I delete a remote branch in Git? | 94 | 2010-11-11 22:35:04 | <p>I created a branch <code>notmaster</code> to commit as well as push some changes. When I was finished with that branch, I merged the changes back into <code>master</code>, pushed them out, and then deleted the local <code>notmaster</code>.</p>
<pre><code>$ git branch -a
* master
remotes/origin/master
remotes/or... | 23,439 | 478,288 | 2017-12-06 07:19:57 | 4,159,972 | 61 | 2010-11-11 22:38:00 | 58,808 | 2016-05-13 08:13:02 | https://stackoverflow.com/q/4159950 | https://stackoverflow.com/a/4159972 | <p><code>git push origin :notmaster</code>, which basically means "push nothing to the notmaster remote".</p>
| <p><code>git push origin :notmaster</code>, which basically means "push nothing to the notmaster remote".</p> | 119 | git | <h1>How do I delete a remote branch in Git?</h1>
<p>I created a branch <code>notmaster</code> to commit as well as push some changes. When I was finished with that branch, I merged the changes back into <code>master</code>, pushed them out, and then deleted the local <code>notmaster</code>.</p>
<pre><code>$ git branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,934 | git | # How do I delete a remote branch in Git?
I created a branch `notmaster` to commit as well as push some changes. When I was finished with that branch, I merged the changes back into `master`, pushed them out, and then deleted the local `notmaster`.
```
$ git branch -a
* master
remotes/origin/master
remotes/origin... | `git push origin :notmaster`, which basically means "push nothing to the notmaster remote". |
5335804 | Confusion in choosing between JavaGit, JGit and EGit | 88 | 2011-03-17 06:52:21 | <p>I am making a Java application that uses Git. I found that there is something called
<a href="http://javagit.sourceforge.net/" rel="noreferrer">JavaGit</a>, <a href="http://eclipse.org/egit/" rel="noreferrer">EGit</a> and <a href="http://www.eclipse.org/jgit/" rel="noreferrer">JGit</a>.</p>
<p>I know that JavaGit a... | 49,583 | 243,233 | 2023-01-11 10:07:56 | 5,335,941 | 61 | 2011-03-17 07:09:52 | 6,309 | 2013-01-07 17:32:59 | https://stackoverflow.com/q/5335804 | https://stackoverflow.com/a/5335941 | <p>You can use JGit as standalone library, but, as mentioned in the <a href="http://www.eclipse.org/jgit/" rel="noreferrer">JGit Homepage</a>:</p>
<blockquote>
<p>JGit can be found within:<br>
* EGit, Eclipse team provider for Git</p>
</blockquote>
<p>In that sense, JGit is connected to Eclipse in that EGit uses ... | <p>You can use JGit as standalone library, but, as mentioned in the <a href="http://www.eclipse.org/jgit/" rel="noreferrer">JGit Homepage</a>:</p> <blockquote> <p>JGit can be found within:<br> * EGit, Eclipse team provider for Git</p> </blockquote> <p>In that sense, JGit is connected to Eclipse in that EGit uses ... | 17, 53, 43702, 61058 | eclipse, egit, java, jgit | <h1>Confusion in choosing between JavaGit, JGit and EGit</h1>
<p>I am making a Java application that uses Git. I found that there is something called
<a href="http://javagit.sourceforge.net/" rel="noreferrer">JavaGit</a>, <a href="http://eclipse.org/egit/" rel="noreferrer">EGit</a> and <a href="http://www.eclipse.org/j... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,935 | git | # Confusion in choosing between JavaGit, JGit and EGit
I am making a Java application that uses Git. I found that there is something called
[JavaGit](http://javagit.sourceforge.net/), [EGit](http://eclipse.org/egit/) and [JGit](http://www.eclipse.org/jgit/).
I know that JavaGit and EGit/JGit are different. What I don... | You can use JGit as standalone library, but, as mentioned in the [JGit Homepage](http://www.eclipse.org/jgit/):
> JGit can be found within:
> * EGit, Eclipse team provider for Git
In that sense, JGit is connected to Eclipse in that EGit uses JGit features to develop the Eclipse Git plugin.
Considering all Eclipse... |
783906 | Git under windows: MSYS or Cygwin? | 80 | 2009-04-23 23:01:44 | <p>I plan to migrate my projects over to git, and I'm currently wondering which is the best and / or most stable option under windows.</p>
<p>From what I gather I basically have 2.5 options:</p>
<ol>
<li><a href="http://code.google.com/p/msysgit/" rel="noreferrer">MSYSgit</a></li>
<li>git under <a href="http://www.cy... | 59,973 | 82,682 | 2015-03-19 12:13:37 | 784,743 | 61 | 2009-04-24 06:29:59 | 6,309 | 2014-10-16 06:34:08 | https://stackoverflow.com/q/783906 | https://stackoverflow.com/a/784743 | <p>Edit (2 more years later: October 2014)</p>
<p><a href="http://episodes.gitminutes.com/2014/04/gitminutes-28-johannes-schindelin-on.html" rel="noreferrer">Johannes Schindelin</a> <a href="http://osdir.com/ml/msysgit/2014-10/msg00071.html" rel="noreferrer">just explained</a> (Oct. 2014) that <strong>msysgit is phased... | <p>Edit (2 more years later: October 2014)</p> <p><a href="http://episodes.gitminutes.com/2014/04/gitminutes-28-johannes-schindelin-on.html" rel="noreferrer">Johannes Schindelin</a> <a href="http://osdir.com/ml/msysgit/2014-10/msg00071.html" rel="noreferrer">just explained</a> (Oct. 2014) that <strong>msysgit is phased... | 119, 1731, 3346, 21628 | cygwin, dvcs, git, msysgit | <h1>Git under windows: MSYS or Cygwin?</h1>
<p>I plan to migrate my projects over to git, and I'm currently wondering which is the best and / or most stable option under windows.</p>
<p>From what I gather I basically have 2.5 options:</p>
<ol>
<li><a href="http://code.google.com/p/msysgit/" rel="noreferrer">MSYSgit</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,937 | git | # Git under windows: MSYS or Cygwin?
I plan to migrate my projects over to git, and I'm currently wondering which is the best and / or most stable option under windows.
From what I gather I basically have 2.5 options:
1. [MSYSgit](http://code.google.com/p/msysgit/)
2. git under [Cygwin](http://www.cygwin.com/)
3. (a... | Edit (2 more years later: October 2014)
[Johannes Schindelin](http://episodes.gitminutes.com/2014/04/gitminutes-28-johannes-schindelin-on.html) [just explained](http://osdir.com/ml/msysgit/2014-10/msg00071.html) (Oct. 2014) that **msysgit is phased out**:
> we now have a **light-weight Git for Windows SDK** – which i... |
11662868 | What happens when I clone a repository with symlinks on Windows? | 69 | 2012-07-26 05:24:16 | <p>There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone <a href="https://github.com/ariofrio/symlink-test" rel="noreferrer">a repository with symlinks</a> on Windows?</p>
| 52,159 | 237,285 | 2025-01-30 10:37:50 | 11,664,406 | 61 | 2012-07-26 07:27:26 | 1,127,485 | 2025-01-30 10:37:50 | https://stackoverflow.com/q/11662868 | https://stackoverflow.com/a/11664406 | <p>Since <a href="https://raw.github.com/git/git/master/Documentation/RelNotes/1.5.3.txt" rel="nofollow noreferrer">version 1.5.3</a> of the native Git client <code>git clone</code> and <code>git init</code> will probe the target file system for symlink support and set the local repository configuration for <code>core.... | <p>Since <a href="https://raw.github.com/git/git/master/Documentation/RelNotes/1.5.3.txt" rel="nofollow noreferrer">version 1.5.3</a> of the native Git client <code>git clone</code> and <code>git init</code> will probe the target file system for symlink support and set the local repository configuration for <code>core.... | 64, 119, 1122, 21628 | git, msysgit, symlink, windows | <h1>What happens when I clone a repository with symlinks on Windows?</h1>
<p>There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone <a href="https://github.com/ariofrio/symlink-test" rel="noreferrer">a repository with symlinks</a> on Windows?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,938 | git | # What happens when I clone a repository with symlinks on Windows?
There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone [a repository with symlinks](https://github.com/ariofrio/symlink-test) on Windows? | Since [version 1.5.3](https://raw.github.com/git/git/master/Documentation/RelNotes/1.5.3.txt) of the native Git client `git clone` and `git init` will probe the target file system for symlink support and set the local repository configuration for `core.symlinks` accordingly, i.e. to `false` for FAT or NTFS. **This make... |
7588268 | Telling git its ok to remove untracked files | 66 | 2011-09-28 19:07:30 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/61212/how-do-you-remove-untracked-files-from-your-git-working-copy">How do you remove untracked files from your git working copy?</a> </p>
</blockquote>
<p>Is it possible to tell git to remove untracked files? ... | 28,570 | 714,202 | 2019-11-27 07:30:46 | 7,588,333 | 61 | 2011-09-28 19:12:51 | 893 | 2011-09-28 19:12:51 | https://stackoverflow.com/q/7588268 | https://stackoverflow.com/a/7588333 | <p>You may be looking for <code>git clean</code>. This will delete all untracked files. By default this ignores (does not delete) patterns in <code>.gitignore</code>, but <code>git clean -x</code> cleans those files too.</p>
<p>From the <code>git clean</code> man page:</p>
<pre><code> -x
Don't use the ignore... | <p>You may be looking for <code>git clean</code>. This will delete all untracked files. By default this ignores (does not delete) patterns in <code>.gitignore</code>, but <code>git clean -x</code> cleans those files too.</p> <p>From the <code>git clean</code> man page:</p> <pre><code> -x Don't use the ignore... | 119, 456 | git, version-control | <h1>Telling git its ok to remove untracked files</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/61212/how-do-you-remove-untracked-files-from-your-git-working-copy">How do you remove untracked files from your git working copy?</a> </p>
</blockquote>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,939 | git | # Telling git its ok to remove untracked files
> **Possible Duplicate:**
> [How do you remove untracked files from your git working copy?](https://stackoverflow.com/questions/61212/how-do-you-remove-untracked-files-from-your-git-working-copy)
Is it possible to tell git to remove untracked files? Mainly something th... | You may be looking for `git clean`. This will delete all untracked files. By default this ignores (does not delete) patterns in `.gitignore`, but `git clean -x` cleans those files too.
From the `git clean` man page:
```
-x
Don't use the ignore rules. This allows removing all untracked
files, includin... |
26460415 | gerrit - git (pull vs checkout vs cherrypick) which is for what? | 63 | 2014-10-20 07:26:10 | <p>In Android's gerrit ex: <a href="https://android-review.googlesource.com/#/c/109934/">link</a>, to download the patch, I see 4 options.</p>
<ol>
<li>repo download</li>
<li>checkout</li>
<li>pull</li>
<li>cherry-pick</li>
</ol>
<p>What is the difference between them?</p>
<p>Here is what I think of them. Please cla... | 105,687 | 840,710 | 2021-08-06 08:03:15 | 26,460,578 | 61 | 2014-10-20 07:37:42 | 1,825,727 | 2021-08-06 08:03:15 | https://stackoverflow.com/q/26460415 | https://stackoverflow.com/a/26460578 | <p>You are right about the first one. Here are the rest of them:</p>
<ol>
<li><p><kbd><strong>Checkout</strong></kbd>: <strong>Fetches</strong> the latest changes. You should already have this repo downloaded. It <strong>does not merge</strong> those new changes but makes your working directory reflect them. And a <str... | <p>You are right about the first one. Here are the rest of them:</p> <ol> <li><p><kbd><strong>Checkout</strong></kbd>: <strong>Fetches</strong> the latest changes. You should already have this repo downloaded. It <strong>does not merge</strong> those new changes but makes your working directory reflect them. And a <str... | 119, 52272 | gerrit, git | <h1>gerrit - git (pull vs checkout vs cherrypick) which is for what?</h1>
<p>In Android's gerrit ex: <a href="https://android-review.googlesource.com/#/c/109934/">link</a>, to download the patch, I see 4 options.</p>
<ol>
<li>repo download</li>
<li>checkout</li>
<li>pull</li>
<li>cherry-pick</li>
</ol>
<p>What is the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,941 | git | # gerrit - git (pull vs checkout vs cherrypick) which is for what?
In Android's gerrit ex: [link](https://android-review.googlesource.com/#/c/109934/), to download the patch, I see 4 options.
1. repo download
2. checkout
3. pull
4. cherry-pick
What is the difference between them?
Here is what I think of them. Pleas... | You are right about the first one. Here are the rest of them:
1. `Checkout`: **Fetches** the latest changes. You should already have this repo downloaded. It **does not merge** those new changes but makes your working directory reflect them. And a **name-less commit** is created to include these changes in your workin... |
21407962 | Error on `git push` to Bitbucket is `! [remote rejected] master -> master (pre-receive hook declined)` | 57 | 2014-01-28 14:15:30 | <p>My <code>git push</code> to my remote Bitbucket server failed with:</p>
<pre><code>! [remote rejected] master -> master (pre-receive hook declined)
</code></pre>
<p>I think it's a different issue than this (<a href="https://stackoverflow.com/questions/9542665/remote-rejected-master-master-pre-receive-hook-decline... | 174,480 | 2,462,759 | 2024-12-05 14:39:00 | 21,410,576 | 61 | 2014-01-28 15:59:10 | 735,336 | 2021-05-27 03:40:17 | https://stackoverflow.com/q/21407962 | https://stackoverflow.com/a/21410576 | <p>It looks like the branch management (one of the admin settings) in bitbucket has been configured to only allow certain people to push directly to master.</p>
<p>Try creating a branch - <code>git checkout -b test</code>, create your test commit and push <code>git push origin test:test</code>. You can always cleanly d... | <p>It looks like the branch management (one of the admin settings) in bitbucket has been configured to only allow certain people to push directly to master.</p> <p>Try creating a branch - <code>git checkout -b test</code>, create your test commit and push <code>git push origin test:test</code>. You can always cleanly d... | 119, 359, 8337, 26154 | bitbucket, git, permission-denied, permissions | <h1>Error on `git push` to Bitbucket is `! [remote rejected] master -> master (pre-receive hook declined)`</h1>
<p>My <code>git push</code> to my remote Bitbucket server failed with:</p>
<pre><code>! [remote rejected] master -> master (pre-receive hook declined)
</code></pre>
<p>I think it's a different issue than t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,944 | git | # Error on `git push` to Bitbucket is `! [remote rejected] master -> master (pre-receive hook declined)`
My `git push` to my remote Bitbucket server failed with:
```
! [remote rejected] master -> master (pre-receive hook declined)
```
I think it's a different issue than this ([remote rejected master -> master (pre-r... | It looks like the branch management (one of the admin settings) in bitbucket has been configured to only allow certain people to push directly to master.
Try creating a branch - `git checkout -b test`, create your test commit and push `git push origin test:test`. You can always cleanly delete this branch once you have... |
17639383 | How to add missing origin/HEAD in git repo | 50 | 2013-07-14 12:28:18 | <p>I have a working git repo. However, I miss the <code>remotes/origin/HEAD -> origin/master</code> when typing <code>git branch -a</code>. Why is the HEAD missing and how can I add the missing HEAD to my repo?</p>
| 24,510 | 2,324,028 | 2022-11-15 08:45:59 | 17,639,471 | 61 | 2013-07-14 12:42:28 | 1,761,499 | 2014-10-31 08:18:02 | https://stackoverflow.com/q/17639383 | https://stackoverflow.com/a/17639471 | <h2>Original Answer:</h2>
<p>The origin's <code>HEAD</code> is only fetched when you clone the repo. If you otherwise add the remote (e.g. by using <code>git remote add</code> or by renaming another existing remote), this ref will not exist, <strong>because there is not reason to have it.</strong></p>
<p>Remote repos s... | <h2>Original Answer:</h2> <p>The origin's <code>HEAD</code> is only fetched when you clone the repo. If you otherwise add the remote (e.g. by using <code>git remote add</code> or by renaming another existing remote), this ref will not exist, <strong>because there is not reason to have it.</strong></p> <p>Remote repos s... | 119 | git | <h1>How to add missing origin/HEAD in git repo</h1>
<p>I have a working git repo. However, I miss the <code>remotes/origin/HEAD -> origin/master</code> when typing <code>git branch -a</code>. Why is the HEAD missing and how can I add the missing HEAD to my repo?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,946 | git | # How to add missing origin/HEAD in git repo
I have a working git repo. However, I miss the `remotes/origin/HEAD -> origin/master` when typing `git branch -a`. Why is the HEAD missing and how can I add the missing HEAD to my repo? | ## Original Answer:
The origin's `HEAD` is only fetched when you clone the repo. If you otherwise add the remote (e.g. by using `git remote add` or by renaming another existing remote), this ref will not exist, **because there is not reason to have it.**
Remote repos should be [bare repos](http://bare-vs-nonbare.gitr... |
7194939 | git: change one line in file for the complete history | 50 | 2011-08-25 17:52:28 | <p>When I started my git repo I commited a few files as initial commit to it. Now, many commits later, I noticed that I included in those files a line with information which I do not want to publish (unlike the rest of the code). So I want to <strong>remove/change this one line</strong> and <strong>keep the rest</stron... | 18,043 | 524,281 | 2023-10-12 22:39:54 | 7,198,036 | 61 | 2011-08-25 22:39:45 | 389,146 | 2011-08-25 22:39:45 | https://stackoverflow.com/q/7194939 | https://stackoverflow.com/a/7198036 | <p>Here's a command that will remove an offending line from a file's history in all your branches:</p>
<pre><code>git filter-branch --tree-filter 'sed -i "/sensitive information/ d" filename' -- --all
</code></pre>
<p>This checks out every revision, runs the <code>sed</code> command on it, then commits that revision ... | <p>Here's a command that will remove an offending line from a file's history in all your branches:</p> <pre><code>git filter-branch --tree-filter 'sed -i "/sensitive information/ d" filename' -- --all </code></pre> <p>This checks out every revision, runs the <code>sed</code> command on it, then commits that revision ... | 119, 5597, 30968 | commit, git, git-amend | <h1>git: change one line in file for the complete history</h1>
<p>When I started my git repo I commited a few files as initial commit to it. Now, many commits later, I noticed that I included in those files a line with information which I do not want to publish (unlike the rest of the code). So I want to <strong>remove... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,947 | git | # git: change one line in file for the complete history
When I started my git repo I commited a few files as initial commit to it. Now, many commits later, I noticed that I included in those files a line with information which I do not want to publish (unlike the rest of the code). So I want to **remove/change this on... | Here's a command that will remove an offending line from a file's history in all your branches:
```
git filter-branch --tree-filter 'sed -i "/sensitive information/ d" filename' -- --all
```
This checks out every revision, runs the `sed` command on it, then commits that revision back.
The `sed` command in this case ... |
8926566 | How to uninstall a git repo using pip? | 48 | 2012-01-19 13:11:52 | <p>I'm using pip in a virtualenv and have installed a package from a git repo by doing this:</p>
<pre><code>pip install -e git://github.com/dwaiter/django-bcrypt.git@475a3bef1e3ff31935a2dc905e244a63a804fce9#egg=django_bcrypt-dev
</code></pre>
<p>But I now want to uninstall that and can't see how, as it doesn't have a... | 31,929 | 250,962 | 2012-01-19 13:17:03 | 8,926,642 | 61 | 2012-01-19 13:17:03 | 285,614 | 2012-01-19 13:17:03 | https://stackoverflow.com/q/8926566 | https://stackoverflow.com/a/8926642 | <p>You uninstall it like you would any other library:</p>
<p><code>pip uninstall django-bcrypt</code></p>
<p>If you want to ultimately upgrade, you could also do </p>
<p><code>pip install --upgrade -e git://github.com/dwaiter/django-bcrypt.git#egg=django_bcrypt</code></p>
| <p>You uninstall it like you would any other library:</p> <p><code>pip uninstall django-bcrypt</code></p> <p>If you want to ultimately upgrade, you could also do </p> <p><code>pip install --upgrade -e git://github.com/dwaiter/django-bcrypt.git#egg=django_bcrypt</code></p> | 119, 5119 | git, pip | <h1>How to uninstall a git repo using pip?</h1>
<p>I'm using pip in a virtualenv and have installed a package from a git repo by doing this:</p>
<pre><code>pip install -e git://github.com/dwaiter/django-bcrypt.git@475a3bef1e3ff31935a2dc905e244a63a804fce9#egg=django_bcrypt-dev
</code></pre>
<p>But I now want to uninst... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,949 | git | # How to uninstall a git repo using pip?
I'm using pip in a virtualenv and have installed a package from a git repo by doing this:
```
pip install -e git://github.com/dwaiter/django-bcrypt.git@475a3bef1e3ff31935a2dc905e244a63a804fce9#egg=django_bcrypt-dev
```
But I now want to uninstall that and can't see how, as it... | You uninstall it like you would any other library:
`pip uninstall django-bcrypt`
If you want to ultimately upgrade, you could also do
`pip install --upgrade -e git://github.com/dwaiter/django-bcrypt.git#egg=django_bcrypt` |
18570926 | Do git update-index --assume-unchanged rules propagate to clients on pull? | 46 | 2013-09-02 10:25:52 | <p>There are instances where I can't use a <code>.gitignore</code> file, otherwise, on <code>git push</code>, critical files are purged from the remote. In these cases, I apply <code>git update-index --assume-unchanged <file></code> to the files that I want to ignore.</p>
<p>After applying the assume-unchanged r... | 15,143 | 568,884 | 2020-11-24 20:38:20 | 18,571,577 | 61 | 2013-09-02 10:58:33 | 49,489 | 2013-09-03 10:58:28 | https://stackoverflow.com/q/18570926 | https://stackoverflow.com/a/18571577 | <p>The index is local to your workstation, any changes you make there do not propagate to other clones of the same remote.</p>
<p>(updated, after question was updated)</p>
<h2>The .gitignore file</h2>
<blockquote>
<p>There are instances where I can't use a .gitignore file, otherwise, on git push, critical files ar... | <p>The index is local to your workstation, any changes you make there do not propagate to other clones of the same remote.</p> <p>(updated, after question was updated)</p> <h2>The .gitignore file</h2> <blockquote> <p>There are instances where I can't use a .gitignore file, otherwise, on git push, critical files ar... | 119, 25056 | git, gitignore | <h1>Do git update-index --assume-unchanged rules propagate to clients on pull?</h1>
<p>There are instances where I can't use a <code>.gitignore</code> file, otherwise, on <code>git push</code>, critical files are purged from the remote. In these cases, I apply <code>git update-index --assume-unchanged <file></cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,951 | git | # Do git update-index --assume-unchanged rules propagate to clients on pull?
There are instances where I can't use a `.gitignore` file, otherwise, on `git push`, critical files are purged from the remote. In these cases, I apply `git update-index --assume-unchanged <file>` to the files that I want to ignore.
After ap... | The index is local to your workstation, any changes you make there do not propagate to other clones of the same remote.
(updated, after question was updated)
## The .gitignore file
> There are instances where I can't use a .gitignore file, otherwise, on git push, critical files are purged from the remote.
This is n... |
33739376 | git submodule sync command - what is it for? | 44 | 2015-11-16 15:51:37 | <p>I don't understand from the <a href="https://git-scm.com/docs/git-submodule">documentation</a> what does <code>git submodule sync</code> do. Please explain.</p>
| 22,023 | 163,394 | 2019-02-08 00:57:26 | 33,739,770 | 61 | 2015-11-16 16:10:42 | 823,846 | 2019-02-08 00:57:26 | https://stackoverflow.com/q/33739376 | https://stackoverflow.com/a/33739770 | <p>Git stores information about submodules in two places. The first is in a file called <code>.gitmodules</code>, which is checked in to the git repository. Changes to this file are what get propagated to other repositories.</p>
<p>The other location is in <code>.git/config</code>, and it's where git actually looks wh... | <p>Git stores information about submodules in two places. The first is in a file called <code>.gitmodules</code>, which is checked in to the git repository. Changes to this file are what get propagated to other repositories.</p> <p>The other location is in <code>.git/config</code>, and it's where git actually looks wh... | 119, 41612 | git, git-submodules | <h1>git submodule sync command - what is it for?</h1>
<p>I don't understand from the <a href="https://git-scm.com/docs/git-submodule">documentation</a> what does <code>git submodule sync</code> do. Please explain.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,952 | git | # git submodule sync command - what is it for?
I don't understand from the [documentation](https://git-scm.com/docs/git-submodule) what does `git submodule sync` do. Please explain. | Git stores information about submodules in two places. The first is in a file called `.gitmodules`, which is checked in to the git repository. Changes to this file are what get propagated to other repositories.
The other location is in `.git/config`, and it's where git actually looks when performing most commands.
So... |
17350939 | git-archive a subdirectory -- | 37 | 2013-06-27 18:46:13 | <p>I'm using git-archive to archive a subdirectory in a git repo, like so:</p>
<pre><code>git archive -o ../subarchive.zip HEAD subdir/*
</code></pre>
<p>However the resulting archive maintains the subdir/ directory structure, i.e. the contents are:</p>
<pre><code>subdir/
whatever.js
morestuff.js
</code></pre>... | 26,727 | 417,681 | 2023-04-28 22:51:19 | 17,351,814 | 61 | 2013-06-27 19:39:07 | 641,955 | 2013-06-27 19:39:07 | https://stackoverflow.com/q/17350939 | https://stackoverflow.com/a/17351814 | <p>You can do that like this:</p>
<pre><code>git archive -o ../subarchive.zip HEAD:subdir
</code></pre>
<p>By the way, an easy way to play with the command and see what it will generate is if you use it in this form:</p>
<pre><code>git archive --format=tar HEAD:subdir | tar t
git archive --format=tar HEAD subdir | t... | <p>You can do that like this:</p> <pre><code>git archive -o ../subarchive.zip HEAD:subdir </code></pre> <p>By the way, an easy way to play with the command and see what it will generate is if you use it in this form:</p> <pre><code>git archive --format=tar HEAD:subdir | tar t git archive --format=tar HEAD subdir | t... | 119, 34708, 81662 | git, git-archive, subdirectory | <h1>git-archive a subdirectory --</h1>
<p>I'm using git-archive to archive a subdirectory in a git repo, like so:</p>
<pre><code>git archive -o ../subarchive.zip HEAD subdir/*
</code></pre>
<p>However the resulting archive maintains the subdir/ directory structure, i.e. the contents are:</p>
<pre><code>subdir/
wh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,955 | git | # git-archive a subdirectory --
I'm using git-archive to archive a subdirectory in a git repo, like so:
```
git archive -o ../subarchive.zip HEAD subdir/*
```
However the resulting archive maintains the subdir/ directory structure, i.e. the contents are:
```
subdir/
whatever.js
morestuff.js
```
When I actual... | You can do that like this:
```
git archive -o ../subarchive.zip HEAD:subdir
```
By the way, an easy way to play with the command and see what it will generate is if you use it in this form:
```
git archive --format=tar HEAD:subdir | tar t
git archive --format=tar HEAD subdir | tar t
# ... and so on ...
```
Once you... |
27451151 | Is there a "git touch" so I can push the same file with a new timestamp? | 35 | 2014-12-12 19:55:07 | <p>I have an automated build tool that uses the modification date of the file in the output. Is there a way to "git touch" the file and save that to Git without having to actually modify the file?</p>
| 38,435 | 1,601,989 | 2024-05-26 07:37:58 | 31,592,230 | 61 | 2015-07-23 15:46:50 | 753,705 | 2015-07-23 15:46:50 | https://stackoverflow.com/q/27451151 | https://stackoverflow.com/a/31592230 | <p>I think what you need is <code>touch</code> command if you are on <code>unix</code> operating system.</p>
<p>Git can however allow you to do a empty commit if you use <code>--allow-empty</code> option.</p>
<p>Eg. <code>$ git commit --allow-empty -m "Trigger notification"</code> would cause an empty commit which yo... | <p>I think what you need is <code>touch</code> command if you are on <code>unix</code> operating system.</p> <p>Git can however allow you to do a empty commit if you use <code>--allow-empty</code> option.</p> <p>Eg. <code>$ git commit --allow-empty -m "Trigger notification"</code> would cause an empty commit which yo... | 119, 2177 | git, timestamp | <h1>Is there a "git touch" so I can push the same file with a new timestamp?</h1>
<p>I have an automated build tool that uses the modification date of the file in the output. Is there a way to "git touch" the file and save that to Git without having to actually modify the file?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,956 | git | # Is there a "git touch" so I can push the same file with a new timestamp?
I have an automated build tool that uses the modification date of the file in the output. Is there a way to "git touch" the file and save that to Git without having to actually modify the file? | I think what you need is `touch` command if you are on `unix` operating system.
Git can however allow you to do a empty commit if you use `--allow-empty` option.
Eg. `$ git commit --allow-empty -m "Trigger notification"` would cause an empty commit which you can then push and do another deploy. |
32486852 | .gitignore_global is not working, even .gitconfig shows the .gitignore_global | 33 | 2015-09-09 18:33:52 | <p>I created the <code>.gitignore_global</code> file and save it to the directory where i have <code>.gitconfig</code> file.</p>
<p>After then, i used this command.</p>
<pre><code>git config --global core.excludesfile .gitignore_global
</code></pre>
<p>then i checked my .gitconfig file by using the command</p>
<pre><co... | 17,584 | 4,979,380 | 2020-09-16 16:47:21 | 32,487,076 | 61 | 2015-09-09 18:46:36 | 216,074 | 2015-09-09 19:05:14 | https://stackoverflow.com/q/32486852 | https://stackoverflow.com/a/32487076 | <p>The path to the global gitignore needs to be absolute, so you could use the shell expansion here and just specify it as <code>~/.gitignore_global</code>:</p>
<pre><code>git config --global core.excludesfile ~/.gitignore_global
</code></pre>
<hr>
<p>In order to understand what’s going on if you don’t use an absolu... | <p>The path to the global gitignore needs to be absolute, so you could use the shell expansion here and just specify it as <code>~/.gitignore_global</code>:</p> <pre><code>git config --global core.excludesfile ~/.gitignore_global </code></pre> <hr> <p>In order to understand what’s going on if you don’t use an absolu... | 119 | git | <h1>.gitignore_global is not working, even .gitconfig shows the .gitignore_global</h1>
<p>I created the <code>.gitignore_global</code> file and save it to the directory where i have <code>.gitconfig</code> file.</p>
<p>After then, i used this command.</p>
<pre><code>git config --global core.excludesfile .gitignore_glob... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,957 | git | # .gitignore_global is not working, even .gitconfig shows the .gitignore_global
I created the `.gitignore_global` file and save it to the directory where i have `.gitconfig` file.
After then, i used this command.
```
git config --global core.excludesfile .gitignore_global
```
then i checked my .gitconfig file by us... | The path to the global gitignore needs to be absolute, so you could use the shell expansion here and just specify it as `~/.gitignore_global`:
```
git config --global core.excludesfile ~/.gitignore_global
```
---
In order to understand what’s going on if you don’t use an absolute path, you have to understand how git... |
14576109 | How to delete a file in remote repository ONLY? | 33 | 2013-01-29 05:15:22 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1143796/git-remove-a-file-from-the-repository-without-deleting-it-from-the-local-filesy">Git: Remove a file from the repository without deleting it from the local filesystem</a> </p>
</blockquote>
<p>I wish to ... | 46,554 | null | 2020-03-01 04:17:02 | 14,576,170 | 61 | 2013-01-29 05:21:05 | 52,273 | 2020-03-01 04:17:02 | https://stackoverflow.com/q/14576109 | https://stackoverflow.com/a/14576170 | <p>Use this command </p>
<pre><code>git rm --cached <filename>
git rm --cached -r <dir_name>
git commit -m "Removed folder from repository"
git push origin master
</code></pre>
<p>This removes the <strong><em>filename</em></strong> from the index, without touching your working tree.</p>
| <p>Use this command </p> <pre><code>git rm --cached <filename> git rm --cached -r <dir_name> git commit -m "Removed folder from repository" git push origin master </code></pre> <p>This removes the <strong><em>filename</em></strong> from the index, without touching your working tree.</p> | 119 | git | <h1>How to delete a file in remote repository ONLY?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1143796/git-remove-a-file-from-the-repository-without-deleting-it-from-the-local-filesy">Git: Remove a file from the repository without deleting it from the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,959 | git | # How to delete a file in remote repository ONLY?
> **Possible Duplicate:**
> [Git: Remove a file from the repository without deleting it from the local filesystem](https://stackoverflow.com/questions/1143796/git-remove-a-file-from-the-repository-without-deleting-it-from-the-local-filesy)
I wish to delete files fro... | Use this command
```
git rm --cached <filename>
git rm --cached -r <dir_name>
git commit -m "Removed folder from repository"
git push origin master
```
This removes the ***filename*** from the index, without touching your working tree. |
7447472 | How could I display the current git branch name at the top of the page, of my development website? | 31 | 2011-09-16 16:01:50 | <p>Here's my situation:</p>
<p>I develop locally on my Mac using MAMP (PHP). My sites are under Git version control, and I point my dev servers to the root of the site under version control on disk.</p>
<pre><code>File structure:
--mysitehere/
---.git/ (.git folder is here versioning everything below)
---src/ (<--... | 30,112 | 5,716 | 2024-03-18 21:13:57 | 7,448,133 | 61 | 2011-09-16 17:07:57 | 5,716 | 2014-10-13 15:29:40 | https://stackoverflow.com/q/7447472 | https://stackoverflow.com/a/7448133 | <p>This worked for me in PHP, including it in the top of my site:</p>
<pre><code>/**
* @filename: currentgitbranch.php
* @usage: Include this file after the '<body>' tag in your project
* @author Kevin Ridgway
*/
$stringfromfile = file('.git/HEAD', FILE_USE_INCLUDE_PATH);
$firstLine = $stringfromfi... | <p>This worked for me in PHP, including it in the top of my site:</p> <pre><code>/** * @filename: currentgitbranch.php * @usage: Include this file after the '<body>' tag in your project * @author Kevin Ridgway */ $stringfromfile = file('.git/HEAD', FILE_USE_INCLUDE_PATH); $firstLine = $stringfromfi... | 5, 119 | git, php | <h1>How could I display the current git branch name at the top of the page, of my development website?</h1>
<p>Here's my situation:</p>
<p>I develop locally on my Mac using MAMP (PHP). My sites are under Git version control, and I point my dev servers to the root of the site under version control on disk.</p>
<pre><c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,960 | git | # How could I display the current git branch name at the top of the page, of my development website?
Here's my situation:
I develop locally on my Mac using MAMP (PHP). My sites are under Git version control, and I point my dev servers to the root of the site under version control on disk.
```
File structure:
--mysit... | This worked for me in PHP, including it in the top of my site:
```
/**
* @filename: currentgitbranch.php
* @usage: Include this file after the '<body>' tag in your project
* @author Kevin Ridgway
*/
$stringfromfile = file('.git/HEAD', FILE_USE_INCLUDE_PATH);
$firstLine = $stringfromfile[0]; //get the str... |
32490288 | Undo Git Rebase | 27 | 2015-09-09 22:41:12 | <p>I performed a <code>git rebase master</code> on my branch and didn't realize it wasn't what I wanted until after I pushed it to the remote. It's only myself and 1 other person working on the project, so I know they've not pulled the latest changes.</p>
<p>Reading other questions on StackOverflow, it said to use <co... | 39,729 | 1,960,364 | 2016-06-28 19:11:08 | 32,491,119 | 61 | 2015-09-10 00:21:53 | 1,256,452 | 2016-06-28 19:11:08 | https://stackoverflow.com/q/32490288 | https://stackoverflow.com/a/32491119 | <p>As <a href="https://stackoverflow.com/a/32490815/1256452">Makoto already noted</a>, you probably shouldn't bother undoing this rebase: it's probably what you wanted. Nonetheless, feel free to read on for how to undo it.</p>
<hr>
<p>Use the reflog <em>for the branch</em>, as it will be easier to read. (The <code>... | <p>As <a href="https://stackoverflow.com/a/32490815/1256452">Makoto already noted</a>, you probably shouldn't bother undoing this rebase: it's probably what you wanted. Nonetheless, feel free to read on for how to undo it.</p> <hr> <p>Use the reflog <em>for the branch</em>, as it will be easier to read. (The <code>... | 119, 12204, 29934 | assembla, git, git-rebase | <h1>Undo Git Rebase</h1>
<p>I performed a <code>git rebase master</code> on my branch and didn't realize it wasn't what I wanted until after I pushed it to the remote. It's only myself and 1 other person working on the project, so I know they've not pulled the latest changes.</p>
<p>Reading other questions on StackOve... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,962 | git | # Undo Git Rebase
I performed a `git rebase master` on my branch and didn't realize it wasn't what I wanted until after I pushed it to the remote. It's only myself and 1 other person working on the project, so I know they've not pulled the latest changes.
Reading other questions on StackOverflow, it said to use `git ... | As [Makoto already noted](https://stackoverflow.com/a/32490815/1256452), you probably shouldn't bother undoing this rebase: it's probably what you wanted. Nonetheless, feel free to read on for how to undo it.
---
Use the reflog *for the branch*, as it will be easier to read. (The `HEAD` reflog has the same informatio... |
30136558 | How to squash commits which have merge-commit in between? | 205 | 2015-05-09 05:53:30 | <p>I am working on a feature branch.</p>
<ol>
<li>Made several commits. Squashed commits.</li>
<li>Pushed changes to remote branch. Got conflicts.</li>
<li>Merged changes from master, resolved conflicts on feature branch.
<ul>
<li><code>git fetch origin master</code></li>
<li><code>git merge FETCH_HEAD</code></li>
<li>... | 180,904 | 473,105 | 2024-03-23 11:21:00 | 30,143,560 | 60 | 2015-05-09 18:28:32 | 802,618 | 2015-05-09 18:28:32 | https://stackoverflow.com/q/30136558 | https://stackoverflow.com/a/30143560 | <p>You can <code>rebase -i</code> starting with <code>commit 2</code>'s parent (that is, the commit on <code>master</code> that you branched from. You'll likely have to re-resolve conflicts when you get to the merge commit.</p>
<p>So if your history looks like</p>
<pre><code> * D commit 3 (HEAD)
* M merge
/|
| * ... | <p>You can <code>rebase -i</code> starting with <code>commit 2</code>'s parent (that is, the commit on <code>master</code> that you branched from. You'll likely have to re-resolve conflicts when you get to the merge commit.</p> <p>So if your history looks like</p> <pre><code> * D commit 3 (HEAD) * M merge /| | * ... | 119, 717, 98455 | git, git-squash, merge | <h1>How to squash commits which have merge-commit in between?</h1>
<p>I am working on a feature branch.</p>
<ol>
<li>Made several commits. Squashed commits.</li>
<li>Pushed changes to remote branch. Got conflicts.</li>
<li>Merged changes from master, resolved conflicts on feature branch.
<ul>
<li><code>git fetch origin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,965 | git | # How to squash commits which have merge-commit in between?
I am working on a feature branch.
1. Made several commits. Squashed commits.
2. Pushed changes to remote branch. Got conflicts.
3. Merged changes from master, resolved conflicts on feature branch.
- `git fetch origin master`
- `git merge FETCH_HEAD`
... | You can `rebase -i` starting with `commit 2`'s parent (that is, the commit on `master` that you branched from. You'll likely have to re-resolve conflicts when you get to the merge commit.
So if your history looks like
```
* D commit 3 (HEAD)
* M merge
/|
| * C commit 2
* | B commit on master
|/
* A (master)
```
... |
17958288 | branch and checkout using a single command | 165 | 2013-07-30 22:05:29 | <p>Creating and using a new branch involves two commands:</p>
<pre><code>$ git branch new_branch_name
$ git checkout new_branch_name
</code></pre>
<p>I tend to forget the latter, which can be annoying. Is there a way to do this using a single command? Perhaps using an alias, or something similar? I know I could write... | 214,352 | 1,468,366 | 2025-03-05 09:29:55 | 66,760,299 | 60 | 2021-03-23 09:18:54 | 1,735,003 | 2021-03-23 09:18:54 | https://stackoverflow.com/q/17958288 | https://stackoverflow.com/a/66760299 | <p>Git introduced <code>switch</code> in version 2.23 to handle changing of branches specifically and avoid the use of <code>checkout</code> which can be confusing by the sheer amount of operations it can do.</p>
<p>Among other possibilites,</p>
<pre><code>git switch <branch> # to switch to an existing branch
gi... | <p>Git introduced <code>switch</code> in version 2.23 to handle changing of branches specifically and avoid the use of <code>checkout</code> which can be confusing by the sheer amount of operations it can do.</p> <p>Among other possibilites,</p> <pre><code>git switch <branch> # to switch to an existing branch gi... | 119, 456, 37230, 76220 | git, git-branch, git-checkout, version-control | <h1>branch and checkout using a single command</h1>
<p>Creating and using a new branch involves two commands:</p>
<pre><code>$ git branch new_branch_name
$ git checkout new_branch_name
</code></pre>
<p>I tend to forget the latter, which can be annoying. Is there a way to do this using a single command? Perhaps using ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,966 | git | # branch and checkout using a single command
Creating and using a new branch involves two commands:
```
$ git branch new_branch_name
$ git checkout new_branch_name
```
I tend to forget the latter, which can be annoying. Is there a way to do this using a single command? Perhaps using an alias, or something similar? I... | Git introduced `switch` in version 2.23 to handle changing of branches specifically and avoid the use of `checkout` which can be confusing by the sheer amount of operations it can do.
Among other possibilites,
```
git switch <branch> # to switch to an existing branch
git switch -c <new_branch> # to create a new bra... |
36386667 | How to make an existing directory within a git repository a git submodule | 102 | 2016-04-03 14:29:00 | <h2>I'm very confused about git-submodules.</h2>
<p>Basically my problem is that I can't make git understand that <code>~/main-project/submodule</code> is a submodule.</p>
<hr>
<p><strong>I have good experience with git submodules:</strong><br>
in my <a href="https://github.com/Doron-Behar/dotfiles" rel="noreferrer"... | 79,221 | 4,935,114 | 2024-04-11 14:13:39 | 36,389,987 | 60 | 2016-04-03 19:18:30 | 4,935,114 | 2023-08-19 12:02:26 | https://stackoverflow.com/q/36386667 | https://stackoverflow.com/a/36389987 | <h3>Use <code>git submodule absorbgitdirs</code></h3>
<p>This is what the <a href="https://github.com/git/git/blob/v2.41.0/Documentation/git-submodule.txt#L253" rel="nofollow noreferrer">docs</a> state this command does:</p>
<blockquote>
<p>If a git directory of a submodule is inside the submodule,
move the git directo... | <h3>Use <code>git submodule absorbgitdirs</code></h3> <p>This is what the <a href="https://github.com/git/git/blob/v2.41.0/Documentation/git-submodule.txt#L253" rel="nofollow noreferrer">docs</a> state this command does:</p> <blockquote> <p>If a git directory of a submodule is inside the submodule, move the git directo... | 119, 456, 41612 | git, git-submodules, version-control | <h1>How to make an existing directory within a git repository a git submodule</h1>
<h2>I'm very confused about git-submodules.</h2>
<p>Basically my problem is that I can't make git understand that <code>~/main-project/submodule</code> is a submodule.</p>
<hr>
<p><strong>I have good experience with git submodules:</s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,968 | git | # How to make an existing directory within a git repository a git submodule
## I'm very confused about git-submodules.
Basically my problem is that I can't make git understand that `~/main-project/submodule` is a submodule.
---
**I have good experience with git submodules:**
in my [dotfiles repository](https://gi... | ### Use `git submodule absorbgitdirs`
This is what the [docs](https://github.com/git/git/blob/v2.41.0/Documentation/git-submodule.txt#L253) state this command does:
> If a git directory of a submodule is inside the submodule,
> move the git directory of the submodule into its superprojects
> `$GIT_DIR/modules` path a... |
2412450 | Git pre-commit hook : changed/added files | 101 | 2010-03-09 20:49:01 | <p>I am writing a pre-commit hook. I want to run <code>php -l</code> against all files with .php extension. However I am stuck.</p>
<p>I need to obtain a list of new/changed files that are staged. deleted files should be excluded.</p>
<p>I have tried using <code>git diff</code> and <code>git ls-files</code>, but I th... | 82,005 | 289,985 | 2025-02-24 11:41:11 | 2,413,151 | 60 | 2010-03-09 22:39:43 | 85,134 | 2017-03-13 00:31:46 | https://stackoverflow.com/q/2412450 | https://stackoverflow.com/a/2413151 | <p><code>git diff --cached --name-status</code> will show a summary of what's staged, so you can easily exclude removed files, e.g.:</p>
<pre><code>M wt-status.c
D wt-status.h
</code></pre>
<p>This indicates that wt-status.c was modified and wt-status.h was removed in the staging area (index). So, to chec... | <p><code>git diff --cached --name-status</code> will show a summary of what's staged, so you can easily exclude removed files, e.g.:</p> <pre><code>M wt-status.c D wt-status.h </code></pre> <p>This indicates that wt-status.c was modified and wt-status.h was removed in the staging area (index). So, to chec... | 119, 853, 14000, 25281 | git, hook, pre-commit, pre-commit-hook | <h1>Git pre-commit hook : changed/added files</h1>
<p>I am writing a pre-commit hook. I want to run <code>php -l</code> against all files with .php extension. However I am stuck.</p>
<p>I need to obtain a list of new/changed files that are staged. deleted files should be excluded.</p>
<p>I have tried using <code>git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,969 | git | # Git pre-commit hook : changed/added files
I am writing a pre-commit hook. I want to run `php -l` against all files with .php extension. However I am stuck.
I need to obtain a list of new/changed files that are staged. deleted files should be excluded.
I have tried using `git diff` and `git ls-files`, but I think I... | `git diff --cached --name-status` will show a summary of what's staged, so you can easily exclude removed files, e.g.:
```
M wt-status.c
D wt-status.h
```
This indicates that wt-status.c was modified and wt-status.h was removed in the staging area (index). So, to check only files that weren't removed:
``... |
13583953 | Deriving maven artifact version from git branch | 79 | 2012-11-27 12:08:57 | <p>We have a workflow requirement that essentially mean that we need to have the artifact version of a module externally defined from the current branch in git.</p>
<p>I.e. if we are on the master branch in git, I need <code><version>master-...</version></code> and if we are on the bugfixX branch, I need <... | 65,348 | 53,897 | 2025-02-24 07:58:21 | 13,972,678 | 60 | 2012-12-20 12:54:28 | 302,343 | 2022-12-18 11:21:23 | https://stackoverflow.com/q/13583953 | https://stackoverflow.com/a/13972678 | <p>Update 2022: Alternative solutions were brought into existence since this answer was written 2012. While the Git-hook-based solution presented here still holds (with its pros and cons), some good answers here present plugin-based or even pure Maven solutions which I recommend to consider.</p>
<hr />
<p>Indeed, [note... | <p>Update 2022: Alternative solutions were brought into existence since this answer was written 2012. While the Git-hook-based solution presented here still holds (with its pros and cons), some good answers here present plugin-based or even pure Maven solutions which I recommend to consider.</p> <hr /> <p>Indeed, [note... | 119, 41127, 86882 | git, mavanagaiata, maven | <h1>Deriving maven artifact version from git branch</h1>
<p>We have a workflow requirement that essentially mean that we need to have the artifact version of a module externally defined from the current branch in git.</p>
<p>I.e. if we are on the master branch in git, I need <code><version>master-...</version... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,970 | git | # Deriving maven artifact version from git branch
We have a workflow requirement that essentially mean that we need to have the artifact version of a module externally defined from the current branch in git.
I.e. if we are on the master branch in git, I need `<version>master-...</version>` and if we are on the bugfix... | Update 2022: Alternative solutions were brought into existence since this answer was written 2012. While the Git-hook-based solution presented here still holds (with its pros and cons), some good answers here present plugin-based or even pure Maven solutions which I recommend to consider.
---
Indeed, [note 2022: unle... |
11829708 | How to keep git from tracking all files that end with a "~"? | 79 | 2012-08-06 13:54:06 | <p>I'm using Gedit, and each time I save a file, Gedit creates a copy of it, and the name of the copy always ends with a ~. The problem is, Git always tries to track these files, and I don't want that! Is there a way to still be able to use <code>git add .</code>, but add just those files that do not end with ~?</p>
| 38,482 | 924,313 | 2019-08-19 18:14:23 | 11,829,763 | 60 | 2012-08-06 13:57:32 | 1,028,230 | 2016-09-05 23:54:08 | https://stackoverflow.com/q/11829708 | https://stackoverflow.com/a/11829763 | <p>You want a <a href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html" rel="noreferrer">gitignore file</a>. </p>
<p>If you want to nuke everything that ends with a tilde (which should be safe; I can't imagine a reasonable use-case where that's bad), make sure the following line is in your <code>.gitign... | <p>You want a <a href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html" rel="noreferrer">gitignore file</a>. </p> <p>If you want to nuke everything that ends with a tilde (which should be safe; I can't imagine a reasonable use-case where that's bad), make sure the following line is in your <code>.gitign... | 119 | git | <h1>How to keep git from tracking all files that end with a "~"?</h1>
<p>I'm using Gedit, and each time I save a file, Gedit creates a copy of it, and the name of the copy always ends with a ~. The problem is, Git always tries to track these files, and I don't want that! Is there a way to still be able to use <code>git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,971 | git | # How to keep git from tracking all files that end with a "~"?
I'm using Gedit, and each time I save a file, Gedit creates a copy of it, and the name of the copy always ends with a ~. The problem is, Git always tries to track these files, and I don't want that! Is there a way to still be able to use `git add .`, but a... | You want a [gitignore file](http://www.kernel.org/pub/software/scm/git/docs/gitignore.html).
If you want to nuke everything that ends with a tilde (which should be safe; I can't imagine a reasonable use-case where that's bad), make sure the following line is in your `.gitignore` file at the top of your repo's folder h... |
21889741 | git rebase --continue won't work | 76 | 2014-02-19 18:55:57 | <p>I did <code>git rebase master</code>, fixed the conflicts reported in a file, and then <code>git add</code> the file to resolve the conflict. Then I did <code>git rebase --continue</code>, and got this:</p>
<blockquote>
<p>Applying: Fixed unit test</p>
<p>No changes - did you forget to use 'git
add'? If t... | 32,908 | 66,814 | 2023-11-16 13:58:44 | 21,891,017 | 60 | 2014-02-19 19:56:46 | 641,955 | 2014-02-19 21:02:18 | https://stackoverflow.com/q/21889741 | https://stackoverflow.com/a/21891017 | <p>If you are in Mac OS X, then first of all you should disable <code>revisiond</code>, as it can mess with files in your work tree in the middle of rebase, causing unpredictable and broken behavior:</p>
<pre><code>git config --global core.trustctime false
</code></pre>
<p>The issue is explained in <a href="http://ww... | <p>If you are in Mac OS X, then first of all you should disable <code>revisiond</code>, as it can mess with files in your work tree in the middle of rebase, causing unpredictable and broken behavior:</p> <pre><code>git config --global core.trustctime false </code></pre> <p>The issue is explained in <a href="http://ww... | 119, 29934 | git, git-rebase | <h1>git rebase --continue won't work</h1>
<p>I did <code>git rebase master</code>, fixed the conflicts reported in a file, and then <code>git add</code> the file to resolve the conflict. Then I did <code>git rebase --continue</code>, and got this:</p>
<blockquote>
<p>Applying: Fixed unit test</p>
<p>No changes... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,972 | git | # git rebase --continue won't work
I did `git rebase master`, fixed the conflicts reported in a file, and then `git add` the file to resolve the conflict. Then I did `git rebase --continue`, and got this:
> Applying: Fixed unit test
>
> No changes - did you forget to use 'git
> add'? If there is nothing left to stage... | If you are in Mac OS X, then first of all you should disable `revisiond`, as it can mess with files in your work tree in the middle of rebase, causing unpredictable and broken behavior:
```
git config --global core.trustctime false
```
The issue is explained in [this article](http://www.git-tower.com/blog/make-git-re... |
16748160 | What does it mean when Git diff shows mode changes? | 75 | 2013-05-25 09:24:52 | <p>I'm trying to view changes for a single file that is unstaged.</p>
<p>First I use <code>git status</code> to view all the unstaged changes then for example: </p>
<pre><code>git diff AndroidManifest.xml
</code></pre>
<p>But I get this output:</p>
<pre><code>diff --git a/AndroidManifest.xml b/AndroidManifest.xml ... | 68,076 | 1,202,206 | 2020-02-01 18:02:50 | 16,748,185 | 60 | 2013-05-25 09:27:19 | 946,850 | 2016-09-19 20:32:35 | https://stackoverflow.com/q/16748160 | https://stackoverflow.com/a/16748185 | <p>Most probably, the contents of this file haven't changed, only the executable bit has been cleared. Try actually changing the file by, say, appending an empty line to it, and see what <code>git diff</code> outputs.</p>
<p>Apart from file contents, Git also records the state of the executable bit for each file. It m... | <p>Most probably, the contents of this file haven't changed, only the executable bit has been cleared. Try actually changing the file by, say, appending an empty line to it, and see what <code>git diff</code> outputs.</p> <p>Apart from file contents, Git also records the state of the executable bit for each file. It m... | 119, 9033 | git, git-diff | <h1>What does it mean when Git diff shows mode changes?</h1>
<p>I'm trying to view changes for a single file that is unstaged.</p>
<p>First I use <code>git status</code> to view all the unstaged changes then for example: </p>
<pre><code>git diff AndroidManifest.xml
</code></pre>
<p>But I get this output:</p>
<pre>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,973 | git | # What does it mean when Git diff shows mode changes?
I'm trying to view changes for a single file that is unstaged.
First I use `git status` to view all the unstaged changes then for example:
```
git diff AndroidManifest.xml
```
But I get this output:
```
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
o... | Most probably, the contents of this file haven't changed, only the executable bit has been cleared. Try actually changing the file by, say, appending an empty line to it, and see what `git diff` outputs.
Apart from file contents, Git also records the state of the executable bit for each file. It makes sense on Linux s... |
3162786 | How can I trigger garbage collection on a Git remote repository? | 75 | 2010-07-02 01:43:41 | <p>As we know, we can periodically run <code>git gc</code> to pack objects under <code>.git/objects</code>.</p>
<p>In the case of a remote central Git repository (bare or not), though, after many pushes, there many files under <code>myproj.git/objects</code>; each commit seems to create a new file there.</p>
<p>How c... | 59,826 | 157,288 | 2024-04-29 16:30:45 | 3,163,451 | 60 | 2010-07-02 05:35:24 | 381,619 | 2024-04-29 16:30:45 | https://stackoverflow.com/q/3162786 | https://stackoverflow.com/a/3163451 | <p>The remote repo should be configured to run gc as needed after a commit is added. See the documentation of <code>gc.auto</code> in <code>git-gc</code> and <code>git-config</code> man pages.</p>
<p><del>However, a remote repo shouldn't need all that much garbage collection, since it will rarely have dangling (unreach... | <p>The remote repo should be configured to run gc as needed after a commit is added. See the documentation of <code>gc.auto</code> in <code>git-gc</code> and <code>git-config</code> man pages.</p> <p><del>However, a remote repo shouldn't need all that much garbage collection, since it will rarely have dangling (unreach... | 119, 7330, 44929 | git, git-gc, repository | <h1>How can I trigger garbage collection on a Git remote repository?</h1>
<p>As we know, we can periodically run <code>git gc</code> to pack objects under <code>.git/objects</code>.</p>
<p>In the case of a remote central Git repository (bare or not), though, after many pushes, there many files under <code>myproj.git/o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,974 | git | # How can I trigger garbage collection on a Git remote repository?
As we know, we can periodically run `git gc` to pack objects under `.git/objects`.
In the case of a remote central Git repository (bare or not), though, after many pushes, there many files under `myproj.git/objects`; each commit seems to create a new ... | The remote repo should be configured to run gc as needed after a commit is added. See the documentation of `gc.auto` in `git-gc` and `git-config` man pages.
~~However, a remote repo shouldn't need all that much garbage collection, since it will rarely have dangling (unreachable) commits. These usually result from thin... |
8016645 | git: list all files added/modified on a day (or week/month...) | 69 | 2011-11-04 22:53:46 | <p>Given a period of time (e.g. a day, a week, a month), is it possible to list all files that were modified or added in this time?</p>
| 44,455 | 972,791 | 2019-08-28 21:23:06 | 8,016,831 | 60 | 2011-11-04 23:19:33 | 174,284 | 2011-11-04 23:38:46 | https://stackoverflow.com/q/8016645 | https://stackoverflow.com/a/8016831 | <p>I'd use diff to yield the file list directly, e.g:</p>
<pre><code>git diff --name-only "@{3 days ago}" "@{2 days ago}"
changelog.txt
newfile.txt
</code></pre>
<p>In case you're curious which file got modified or added, use --name-status instead:</p>
<pre><code>git diff --name-status "@{3 days ago}" "@{2 days ago... | <p>I'd use diff to yield the file list directly, e.g:</p> <pre><code>git diff --name-only "@{3 days ago}" "@{2 days ago}" changelog.txt newfile.txt </code></pre> <p>In case you're curious which file got modified or added, use --name-status instead:</p> <pre><code>git diff --name-status "@{3 days ago}" "@{2 days ago... | 119, 47913 | git, git-log | <h1>git: list all files added/modified on a day (or week/month...)</h1>
<p>Given a period of time (e.g. a day, a week, a month), is it possible to list all files that were modified or added in this time?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,975 | git | # git: list all files added/modified on a day (or week/month...)
Given a period of time (e.g. a day, a week, a month), is it possible to list all files that were modified or added in this time? | I'd use diff to yield the file list directly, e.g:
```
git diff --name-only "@{3 days ago}" "@{2 days ago}"
changelog.txt
newfile.txt
```
In case you're curious which file got modified or added, use --name-status instead:
```
git diff --name-status "@{3 days ago}" "@{2 days ago}"
M changelog.txt
A newf... |
192736 | How do I make git-svn use a particular svn branch as the remote repository? | 61 | 2008-10-10 19:26:44 | <p>A word of warning: I'm a n00b to <code>git</code> in general. My team uses feature branches in <code>svn</code>, and I'd like to use <code>git-svn</code> to track my work on a particular feature branch. I've been (roughly) following <a href="http://andy.delcambre.com/2008/03/04/git-svn-workflow.html" rel="noreferrer... | 31,323 | 4,203 | 2025-11-10 15:21:09 | 197,453 | 60 | 2008-10-13 12:41:16 | 4,203 | 2008-10-13 12:41:16 | https://stackoverflow.com/q/192736 | https://stackoverflow.com/a/197453 | <p>Muchas gracias to Bart's Blog for this handy <a href="http://www.jukie.net/~bart/blog/svn-branches-in-git" rel="noreferrer">reference for svn branches in git</a>. Apparently all I needed was to specify a remote branch when creating the <code>git</code> branch, e.g., </p>
<pre><code>git checkout -b git-topic-branch-... | <p>Muchas gracias to Bart's Blog for this handy <a href="http://www.jukie.net/~bart/blog/svn-branches-in-git" rel="noreferrer">reference for svn branches in git</a>. Apparently all I needed was to specify a remote branch when creating the <code>git</code> branch, e.g., </p> <pre><code>git checkout -b git-topic-branch-... | 63, 119, 1879, 6452, 7330 | branch, git, git-svn, repository, svn | <h1>How do I make git-svn use a particular svn branch as the remote repository?</h1>
<p>A word of warning: I'm a n00b to <code>git</code> in general. My team uses feature branches in <code>svn</code>, and I'd like to use <code>git-svn</code> to track my work on a particular feature branch. I've been (roughly) following... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,976 | git | # How do I make git-svn use a particular svn branch as the remote repository?
A word of warning: I'm a n00b to `git` in general. My team uses feature branches in `svn`, and I'd like to use `git-svn` to track my work on a particular feature branch. I've been (roughly) following [Andy Delcambre's post](http://andy.delca... | Muchas gracias to Bart's Blog for this handy [reference for svn branches in git](http://www.jukie.net/~bart/blog/svn-branches-in-git). Apparently all I needed was to specify a remote branch when creating the `git` branch, e.g.,
```
git checkout -b git-topic-branch-foo foo
```
where `foo` is the name of the remote bra... |
18054057 | "git checkout <commit id>" is changing branch to "no branch" | 52 | 2013-08-05 08:52:30 | <p>I am working on a branch in git. When I do</p>
<pre><code>git checkout <commit id>
</code></pre>
<p>(commit id obtained from <code>git log</code> ), it is getting committed to that particular change but branch is changed to <code><No-branch></code>.</p>
<p>Why is this happening? How do you resolve thi... | 247,283 | 840,710 | 2021-02-13 09:02:36 | 18,054,164 | 60 | 2013-08-05 08:58:24 | null | 2014-05-05 16:38:52 | https://stackoverflow.com/q/18054057 | https://stackoverflow.com/a/18054164 | <p>If you <code>checkout</code> a commit sha directly, it puts you into a "detached head" state, which basically just means that the current sha that your working copy has checked out, doesn't have a branch pointing at it.</p>
<p>If you haven't made any commits yet, you can leave detached head state by simply checking... | <p>If you <code>checkout</code> a commit sha directly, it puts you into a "detached head" state, which basically just means that the current sha that your working copy has checked out, doesn't have a branch pointing at it.</p> <p>If you haven't made any commits yet, you can leave detached head state by simply checking... | 119 | git | <h1>"git checkout <commit id>" is changing branch to "no branch"</h1>
<p>I am working on a branch in git. When I do</p>
<pre><code>git checkout <commit id>
</code></pre>
<p>(commit id obtained from <code>git log</code> ), it is getting committed to that particular change but branch is changed to <code><No-br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,978 | git | # "git checkout " is changing branch to "no branch"
I am working on a branch in git. When I do
```
git checkout <commit id>
```
(commit id obtained from `git log` ), it is getting committed to that particular change but branch is changed to `<No-branch>`.
Why is this happening? How do you resolve this? | If you `checkout` a commit sha directly, it puts you into a "detached head" state, which basically just means that the current sha that your working copy has checked out, doesn't have a branch pointing at it.
If you haven't made any commits yet, you can leave detached head state by simply checking out whichever branch... |
35853986 | Git: Easiest way to reset git config file | 49 | 2016-03-07 21:05:04 | <p>I am finally getting around to learning git. However, I unwisely started messing around with it awhile back (before I really knew what I was doing) via Sourcetree. Now that I'm trying to go through it, I have a pretty large list of settings. When I input: </p>
<pre><code>git config --list
</code></pre>
<p>I get th... | 309,923 | 2,083,857 | 2024-08-18 02:50:44 | 35,860,379 | 60 | 2016-03-08 06:19:03 | 6,309 | 2024-08-18 02:50:44 | https://stackoverflow.com/q/35853986 | https://stackoverflow.com/a/35860379 | <p>Note that <code>git config --list</code> does display both</p>
<ul>
<li>the system (<code><path/to/git/config></code>), meaning where Git has been installed.<br />
(By default, on Windows: <code>C:\Program Files\Git</code>)</li>
<li>global (<code>$HOME/.gitconfig</code>).<br />
On Windows, <code>$HOME</code> ... | <p>Note that <code>git config --list</code> does display both</p> <ul> <li>the system (<code><path/to/git/config></code>), meaning where Git has been installed.<br /> (By default, on Windows: <code>C:\Program Files\Git</code>)</li> <li>global (<code>$HOME/.gitconfig</code>).<br /> On Windows, <code>$HOME</code> ... | 119 | git | <h1>Git: Easiest way to reset git config file</h1>
<p>I am finally getting around to learning git. However, I unwisely started messing around with it awhile back (before I really knew what I was doing) via Sourcetree. Now that I'm trying to go through it, I have a pretty large list of settings. When I input: </p>
<pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,979 | git | # Git: Easiest way to reset git config file
I am finally getting around to learning git. However, I unwisely started messing around with it awhile back (before I really knew what I was doing) via Sourcetree. Now that I'm trying to go through it, I have a pretty large list of settings. When I input:
```
git config --l... | Note that `git config --list` does display both
- the system (`<path/to/git/config>`), meaning where Git has been installed.
(By default, on Windows: `C:\Program Files\Git`)
- global (`$HOME/.gitconfig`).
On Windows, `$HOME` would be `%USERPROFILE%`
- and local (`path/to/repo/.git/config`) settings.
To see th... |
9759423 | git: moving branch head | 49 | 2012-03-18 15:14:21 | <p>I have two git branches, "A" and "B", and commits numbered 1 thru 8. My history looks like this</p>
<pre><code>1 -> 2 -> 3 -> 4[A] -> 5 -> 6 -> 7 -> 8[B]
</code></pre>
<p>I want to change it so my history looks like this:</p>
<pre><code>1 -> 2 -> 3 -> 4 -> 5 -> 6[A] -> 7 -&... | 44,740 | 1,131,467 | 2024-10-03 03:17:49 | 9,759,440 | 60 | 2012-03-18 15:16:51 | 47,773 | 2024-10-03 03:17:49 | https://stackoverflow.com/q/9759423 | https://stackoverflow.com/a/9759440 | <p>While another branch is checked out (not <code>A</code>):</p>
<p>Run:</p>
<pre><code>git branch -f A 6
</code></pre>
| <p>While another branch is checked out (not <code>A</code>):</p> <p>Run:</p> <pre><code>git branch -f A 6 </code></pre> | 119 | git | <h1>git: moving branch head</h1>
<p>I have two git branches, "A" and "B", and commits numbered 1 thru 8. My history looks like this</p>
<pre><code>1 -> 2 -> 3 -> 4[A] -> 5 -> 6 -> 7 -> 8[B]
</code></pre>
<p>I want to change it so my history looks like this:</p>
<pre><code>1 -> 2 -> 3 ->... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,980 | git | # git: moving branch head
I have two git branches, "A" and "B", and commits numbered 1 thru 8. My history looks like this
```
1 -> 2 -> 3 -> 4[A] -> 5 -> 6 -> 7 -> 8[B]
```
I want to change it so my history looks like this:
```
1 -> 2 -> 3 -> 4 -> 5 -> 6[A] -> 7 -> 8[B]
```
That is, I want to move the head of bran... | While another branch is checked out (not `A`):
Run:
```
git branch -f A 6
``` |
5190188 | Why can't I use TortoiseMerge as my git merge tool on Windows? | 47 | 2011-03-04 05:50:44 | <p>I'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on <a href="https://stackoverflow.com/questions/426026/git-on-windows-how-do-you-set-up-a-mergetool/436040#436040">an answer to a ... | 48,070 | 46,387 | 2018-06-28 01:24:50 | 15,984,079 | 60 | 2013-04-13 03:58:22 | 1,610,689 | 2018-06-28 01:24:50 | https://stackoverflow.com/q/5190188 | https://stackoverflow.com/a/15984079 | <p>If you have the latest git, run this command line once:</p>
<p><code>git config merge.tool tortoisemerge</code></p>
<p><strong>Important:</strong> Do not add a <code>.exe</code> extension to the command.</p>
<p>If that fails, or if you want to add a different merge tool that git doesn't know about, do this:</p>
... | <p>If you have the latest git, run this command line once:</p> <p><code>git config merge.tool tortoisemerge</code></p> <p><strong>Important:</strong> Do not add a <code>.exe</code> extension to the command.</p> <p>If that fails, or if you want to add a different merge tool that git doesn't know about, do this:</p> ... | 64, 119, 865, 25165, 41910 | git, mergetool, tortoisemerge, user-interface, windows | <h1>Why can't I use TortoiseMerge as my git merge tool on Windows?</h1>
<p>I'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on <a href="https://stackoverflow.com/questions/426026/git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,981 | git | # Why can't I use TortoiseMerge as my git merge tool on Windows?
I'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on [an answer to a similar question](https://stackoverflow.com/quest... | If you have the latest git, run this command line once:
`git config merge.tool tortoisemerge`
**Important:** Do not add a `.exe` extension to the command.
If that fails, or if you want to add a different merge tool that git doesn't know about, do this:
Open one of the following in an editor:
- 64-bit git: `C:\Prog... |
10449374 | override git from Xcode with homebrew version | 43 | 2012-05-04 13:03:43 | <p>I've installed XCode and therefore git is there as well. Since i want to have a newer version of git I installed using homebrew.</p>
<p>But the homebrew version of git is never called since my PATH looks like this</p>
<pre><code>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
</code></pre>
<p>which mean... | 30,602 | 671,639 | 2014-03-02 00:56:51 | 10,455,668 | 60 | 2012-05-04 20:25:01 | 1,286,639 | 2013-12-30 15:19:25 | https://stackoverflow.com/q/10449374 | https://stackoverflow.com/a/10455668 | <p>Xcode is actually using the GIT that is stored in <code>/Applications/Xcode.app/Contents/Developer/usr/bin</code>. The same version of GIT gets installed in <code>/usr/bin</code> when you installed the command line tools as part of Xcode installation. So, you won't be able to change what Xcode is using (unless you... | <p>Xcode is actually using the GIT that is stored in <code>/Applications/Xcode.app/Contents/Developer/usr/bin</code>. The same version of GIT gets installed in <code>/usr/bin</code> when you installed the command line tools as part of Xcode installation. So, you won't be able to change what Xcode is using (unless you... | 119, 369, 908, 1067, 6268 | git, homebrew, macos, path, xcode | <h1>override git from Xcode with homebrew version</h1>
<p>I've installed XCode and therefore git is there as well. Since i want to have a newer version of git I installed using homebrew.</p>
<p>But the homebrew version of git is never called since my PATH looks like this</p>
<pre><code>/usr/bin:/bin:/usr/sbin:/sbin:/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,983 | git | # override git from Xcode with homebrew version
I've installed XCode and therefore git is there as well. Since i want to have a newer version of git I installed using homebrew.
But the homebrew version of git is never called since my PATH looks like this
```
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
... | Xcode is actually using the GIT that is stored in `/Applications/Xcode.app/Contents/Developer/usr/bin`. The same version of GIT gets installed in `/usr/bin` when you installed the command line tools as part of Xcode installation. So, you won't be able to change what Xcode is using (unless you are willing to muck with t... |
38623616 | Is there any way to check what gulp version you have installed? | 41 | 2016-07-27 21:37:19 | <p>Is there any way to check what gulp version you have installed and also what version of gulp is being offered by the website? I've searched online, and looked at the gulp website, but cannot find the version I need to put in my JSON file. </p>
| 90,969 | 6,407,868 | 2021-07-22 16:38:19 | 38,623,658 | 60 | 2016-07-27 21:40:13 | 2,658,917 | 2016-07-27 21:40:13 | https://stackoverflow.com/q/38623616 | https://stackoverflow.com/a/38623658 | <p>Simply use: <code>gulp -v</code></p>
<p>From the docs:</p>
<p><a href="https://github.com/gulpjs/gulp/blob/master/docs/CLI.md" rel="noreferrer">https://github.com/gulpjs/gulp/blob/master/docs/CLI.md</a></p>
| <p>Simply use: <code>gulp -v</code></p> <p>From the docs:</p> <p><a href="https://github.com/gulpjs/gulp/blob/master/docs/CLI.md" rel="noreferrer">https://github.com/gulpjs/gulp/blob/master/docs/CLI.md</a></p> | 2, 119, 1508, 99715 | git, gulp, html, json | <h1>Is there any way to check what gulp version you have installed?</h1>
<p>Is there any way to check what gulp version you have installed and also what version of gulp is being offered by the website? I've searched online, and looked at the gulp website, but cannot find the version I need to put in my JSON file. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,984 | git | # Is there any way to check what gulp version you have installed?
Is there any way to check what gulp version you have installed and also what version of gulp is being offered by the website? I've searched online, and looked at the gulp website, but cannot find the version I need to put in my JSON file. | Simply use: `gulp -v`
From the docs:
<https://github.com/gulpjs/gulp/blob/master/docs/CLI.md> |
1843577 | how to restore deleted file | 41 | 2009-12-03 22:48:04 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo">Restore a deleted file in a Git repo</a> </p>
</blockquote>
<p>How do I restore a file I accidentally removed from my <code>git</code> repository? I know this is a ... | 50,040 | 204,143 | 2012-03-01 10:47:42 | 1,843,584 | 60 | 2009-12-03 22:49:11 | 60,384 | 2012-02-15 03:11:52 | https://stackoverflow.com/q/1843577 | https://stackoverflow.com/a/1843584 | <p><code>git checkout <commit> <path></code></p>
<p>Commits may be specified directly by SHA1, or via a branch or tag. Make sure that the represents the state of the repository when the deleted file was still present. If the commit argument is omitted, the currently checked out commit (HEAD) will be used.... | <p><code>git checkout <commit> <path></code></p> <p>Commits may be specified directly by SHA1, or via a branch or tag. Make sure that the represents the state of the repository when the deleted file was still present. If the commit argument is omitted, the currently checked out commit (HEAD) will be used.... | 119, 456 | git, version-control | <h1>how to restore deleted file</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo">Restore a deleted file in a Git repo</a> </p>
</blockquote>
<p>How do I restore a file I accidentally removed from my <code>git<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,986 | git | # how to restore deleted file
> **Possible Duplicate:**
> [Restore a deleted file in a Git repo](https://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo)
How do I restore a file I accidentally removed from my `git` repository? I know this is a trivial question, but I haven't found the answer... | `git checkout <commit> <path>`
Commits may be specified directly by SHA1, or via a branch or tag. Make sure that the represents the state of the repository when the deleted file was still present. If the commit argument is omitted, the currently checked out commit (HEAD) will be used. |
7057950 | Commit differences between local and remote | 37 | 2011-08-14 16:03:04 | <p>How can I ask what commits are different between my current local branch and the remote repository that I push to?</p>
<p>Not exactly a <code>git diff origin/master master</code> -- I don't want to see code differences. Just a list of changes like <code>git log</code>.</p>
<p>I want to quickly see how long it's bee... | 26,618 | 32,840 | 2021-09-03 14:50:05 | 7,058,008 | 60 | 2011-08-14 16:12:51 | 54,736 | 2021-06-17 14:58:28 | https://stackoverflow.com/q/7057950 | https://stackoverflow.com/a/7058008 | <p>Git can not send this information remotely.</p>
<p>You would have to do a Git fetch (fetching the changes, without altering your working copy). You will then have a branch called "origin/master" which will enable you to use <code>git log master..origin/master</code> to get the variance between the two.</p>... | <p>Git can not send this information remotely.</p> <p>You would have to do a Git fetch (fetching the changes, without altering your working copy). You will then have a branch called "origin/master" which will enable you to use <code>git log master..origin/master</code> to get the variance between the two.</p>... | 119 | git | <h1>Commit differences between local and remote</h1>
<p>How can I ask what commits are different between my current local branch and the remote repository that I push to?</p>
<p>Not exactly a <code>git diff origin/master master</code> -- I don't want to see code differences. Just a list of changes like <code>git log</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,987 | git | # Commit differences between local and remote
How can I ask what commits are different between my current local branch and the remote repository that I push to?
Not exactly a `git diff origin/master master` -- I don't want to see code differences. Just a list of changes like `git log`.
I want to quickly see how long... | Git can not send this information remotely.
You would have to do a Git fetch (fetching the changes, without altering your working copy). You will then have a branch called "origin/master" which will enable you to use `git log master..origin/master` to get the variance between the two.
```
git fetch
git log master..or... |
37155321 | ERROR: Error cloning remote repo 'origin' | 34 | 2016-05-11 07:02:04 | <p>Tried with the configure option, not able to find the tools
configuration option and the git executable section. Seems like it
occurs after a successful build only. Please help.</p>
<p>Here's the output I receive after building the project on the console output section:</p>
<pre><code> Building in workspace C:\Us... | 193,637 | 6,170,603 | 2024-11-13 08:11:12 | 46,060,381 | 60 | 2017-09-05 17:26:11 | 245,646 | 2017-09-05 17:26:11 | https://stackoverflow.com/q/37155321 | https://stackoverflow.com/a/46060381 | <p>This <strong>wasted so much time</strong> on my Jenkins Windows slave.</p>
<p>I knew git was in the path because I executed "where git" in the build job's batch command.</p>
<pre><code>where git
C:\Program Files (x86)\Git\cmd\git.exe
</code></pre>
<p>Apparently the <strong>Jenkins Git Plugin</strong> executes ** ... | <p>This <strong>wasted so much time</strong> on my Jenkins Windows slave.</p> <p>I knew git was in the path because I executed "where git" in the build job's batch command.</p> <pre><code>where git C:\Program Files (x86)\Git\cmd\git.exe </code></pre> <p>Apparently the <strong>Jenkins Git Plugin</strong> executes ** ... | 119, 39087, 64999, 76768 | git, jenkins, jenkins-plugins, maven-3 | <h1>ERROR: Error cloning remote repo 'origin'</h1>
<p>Tried with the configure option, not able to find the tools
configuration option and the git executable section. Seems like it
occurs after a successful build only. Please help.</p>
<p>Here's the output I receive after building the project on the console output sec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,988 | git | # ERROR: Error cloning remote repo 'origin'
Tried with the configure option, not able to find the tools
configuration option and the git executable section. Seems like it
occurs after a successful build only. Please help.
Here's the output I receive after building the project on the console output section:
```
Bui... | This **wasted so much time** on my Jenkins Windows slave.
I knew git was in the path because I executed "where git" in the build job's batch command.
```
where git
C:\Program Files (x86)\Git\cmd\git.exe
```
Apparently the **Jenkins Git Plugin** executes ** before ** the environment is inherited.
**SET YOUR SLAVE's ... |
5625934 | How do I selectively commit using git? | 33 | 2011-04-11 18:44:12 | <p>When I am in the git command line, it’s rather difficult to commit some files and keep the rest for another commit. How do I make this easy?</p>
| 46,462 | 113,247 | 2022-08-01 15:50:45 | 5,626,014 | 60 | 2011-04-11 18:50:42 | 1,864,976 | 2011-04-11 20:57:00 | https://stackoverflow.com/q/5625934 | https://stackoverflow.com/a/5626014 | <p>It is quite simple. You need to add the changes that you want to <strong>the index</strong> first:</p>
<pre><code>git add file1 file2
</code></pre>
<p>then</p>
<pre><code>git commit
</code></pre>
<p>if you removed a file, the add does that. Add means "<strong>add the change</strong>" even though it is a removal.... | <p>It is quite simple. You need to add the changes that you want to <strong>the index</strong> first:</p> <pre><code>git add file1 file2 </code></pre> <p>then</p> <pre><code>git commit </code></pre> <p>if you removed a file, the add does that. Add means "<strong>add the change</strong>" even though it is a removal.... | 119, 456 | git, version-control | <h1>How do I selectively commit using git?</h1>
<p>When I am in the git command line, it’s rather difficult to commit some files and keep the rest for another commit. How do I make this easy?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,989 | git | # How do I selectively commit using git?
When I am in the git command line, it’s rather difficult to commit some files and keep the rest for another commit. How do I make this easy? | It is quite simple. You need to add the changes that you want to **the index** first:
```
git add file1 file2
```
then
```
git commit
```
if you removed a file, the add does that. Add means "**add the change**" even though it is a removal.
If you want to add all changes:
```
git add -A
```
**The `-a` parameter**... |
51088635 | git clone error: gnutls_handshake() failed: An unexpected TLS packet was received | 32 | 2018-06-28 17:35:28 | <p>I am running Ubuntu 18.04 LTS on armv7l. I am running git clone inside a proxy (I got the proxy variables set properly), but now I get this;</p>
<p><code>fatal: unable to access '<my_git>.git/': gnutls_handshake() failed: An unexpected TLS packet was received.</code></p>
<p>It used to work in Ubuntu 16.04. I... | 86,858 | 6,476,809 | 2022-02-04 10:02:16 | 51,092,100 | 60 | 2018-06-28 22:44:15 | 6,476,809 | 2018-06-28 22:44:15 | https://stackoverflow.com/q/51088635 | https://stackoverflow.com/a/51092100 | <p>Finally found the answer. It seems that I have to do:</p>
<pre><code>git config --global http.proxy http://<my_proxy>:<my_port>
git config --global https.proxy https://<my_proxy>:<my_port>
</code></pre>
<p>Spent quick some time on this but luckily it works in the end. I thought this would b... | <p>Finally found the answer. It seems that I have to do:</p> <pre><code>git config --global http.proxy http://<my_proxy>:<my_port> git config --global https.proxy https://<my_proxy>:<my_port> </code></pre> <p>Spent quick some time on this but luckily it works in the end. I thought this would b... | 119, 132343 | git, ubuntu-18.04 | <h1>git clone error: gnutls_handshake() failed: An unexpected TLS packet was received</h1>
<p>I am running Ubuntu 18.04 LTS on armv7l. I am running git clone inside a proxy (I got the proxy variables set properly), but now I get this;</p>
<p><code>fatal: unable to access '<my_git>.git/': gnutls_handshake() faile... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,991 | git | # git clone error: gnutls_handshake() failed: An unexpected TLS packet was received
I am running Ubuntu 18.04 LTS on armv7l. I am running git clone inside a proxy (I got the proxy variables set properly), but now I get this;
`fatal: unable to access '<my_git>.git/': gnutls_handshake() failed: An unexpected TLS packet... | Finally found the answer. It seems that I have to do:
```
git config --global http.proxy http://<my_proxy>:<my_port>
git config --global https.proxy https://<my_proxy>:<my_port>
```
Spent quick some time on this but luckily it works in the end. I thought this would be hard to fix but it turns out to be some commands ... |
13166595 | How can I pull a remote repository with GitPython? | 32 | 2012-10-31 20:01:32 | <p>I am trying to find the way to pull a git repository using gitPython.
So far this is what I have taken from the official docs <a href="http://gitpython.readthedocs.org/en/latest/tutorial.html#handling-remotes" rel="nofollow noreferrer">here</a>.</p>
<pre><code>test_remote = repo.create_remote('test', 'git@server:rep... | 61,916 | 1,747,721 | 2025-02-28 08:32:28 | 13,166,781 | 60 | 2012-10-31 20:16:23 | 1,747,721 | 2021-10-31 13:22:46 | https://stackoverflow.com/q/13166595 | https://stackoverflow.com/a/13166781 | <p>I managed this by getting the repo name directly:</p>
<pre><code> repo = git.Repo('repo_path')
o = repo.remotes.origin
o.pull()
</code></pre>
| <p>I managed this by getting the repo name directly:</p> <pre><code> repo = git.Repo('repo_path') o = repo.remotes.origin o.pull() </code></pre> | 16, 119, 61013 | git, gitpython, python | <h1>How can I pull a remote repository with GitPython?</h1>
<p>I am trying to find the way to pull a git repository using gitPython.
So far this is what I have taken from the official docs <a href="http://gitpython.readthedocs.org/en/latest/tutorial.html#handling-remotes" rel="nofollow noreferrer">here</a>.</p>
<pre><c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,992 | git | # How can I pull a remote repository with GitPython?
I am trying to find the way to pull a git repository using gitPython.
So far this is what I have taken from the official docs [here](http://gitpython.readthedocs.org/en/latest/tutorial.html#handling-remotes).
```
test_remote = repo.create_remote('test', 'git@server... | I managed this by getting the repo name directly:
```
repo = git.Repo('repo_path')
o = repo.remotes.origin
o.pull()
``` |
39619889 | Homebrew fatal: needed a single revision (MacOs Sierra) | 31 | 2016-09-21 14:50:59 | <p>Not sure if this problem is related to upgrading to MacOs Sierra, but since that moment this error occurs when I run 'brew update' </p>
<pre><code>→ brew update
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
To checkout master in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-... | 9,652 | 2,071,584 | 2022-01-27 21:26:52 | 39,620,103 | 60 | 2016-09-21 14:59:32 | 699,092 | 2016-09-21 15:31:10 | https://stackoverflow.com/q/39619889 | https://stackoverflow.com/a/39620103 | <p>I had the same problem after upgrading to Sierra.</p>
<p>In addition to <code>brew --prefix</code>, which displays Homebrew’s install path, there’s also <code>brew --repository</code>, which displays where it’s <code>.git</code> directory is located.</p>
<p><code>man brew</code> says that claims that “for standar... | <p>I had the same problem after upgrading to Sierra.</p> <p>In addition to <code>brew --prefix</code>, which displays Homebrew’s install path, there’s also <code>brew --repository</code>, which displays where it’s <code>.git</code> directory is located.</p> <p><code>man brew</code> says that claims that “for standar... | 119, 369, 391, 1067, 25122 | git, homebrew, iterm, macos, terminal | <h1>Homebrew fatal: needed a single revision (MacOs Sierra)</h1>
<p>Not sure if this problem is related to upgrading to MacOs Sierra, but since that moment this error occurs when I run 'brew update' </p>
<pre><code>→ brew update
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
To check... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,993 | git | # Homebrew fatal: needed a single revision (MacOs Sierra)
Not sure if this problem is related to upgrading to MacOs Sierra, but since that moment this error occurs when I run 'brew update'
```
→ brew update
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
To checkout master in /usr/lo... | I had the same problem after upgrading to Sierra.
In addition to `brew --prefix`, which displays Homebrew’s install path, there’s also `brew --repository`, which displays where it’s `.git` directory is located.
`man brew` says that claims that “for standard installs, the prefix and repository are the same directory”.... |
16781113 | Git: How can I reset a config parameter after I have accidentally changed it? | 31 | 2013-05-27 22:05:23 | <p>I was exploring the <code>git config</code> options using tab completion in bash, and without really thinking, I did this:</p>
<pre><code>git config --global user.signingkey --help
</code></pre>
<p>and now my global signing key is set to <code>--help</code>. Facepalm. Is there a generic way to find out what these ... | 47,956 | 410,023 | 2014-11-23 20:36:37 | 16,781,650 | 60 | 2013-05-27 23:06:11 | 1,734,130 | 2013-05-27 23:06:11 | https://stackoverflow.com/q/16781113 | https://stackoverflow.com/a/16781650 | <p>Command</p>
<pre><code>git config --global section.key value
</code></pre>
<p>does nothing more than editing file <code>~/.gitconfig</code> with content like this:</p>
<pre><code>[section]
key = value
</code></pre>
<p>So, you can simply edit this file and fix it.</p>
<p>Also, you can use command to remove offen... | <p>Command</p> <pre><code>git config --global section.key value </code></pre> <p>does nothing more than editing file <code>~/.gitconfig</code> with content like this:</p> <pre><code>[section] key = value </code></pre> <p>So, you can simply edit this file and fix it.</p> <p>Also, you can use command to remove offen... | 119 | git | <h1>Git: How can I reset a config parameter after I have accidentally changed it?</h1>
<p>I was exploring the <code>git config</code> options using tab completion in bash, and without really thinking, I did this:</p>
<pre><code>git config --global user.signingkey --help
</code></pre>
<p>and now my global signing key ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,994 | git | # Git: How can I reset a config parameter after I have accidentally changed it?
I was exploring the `git config` options using tab completion in bash, and without really thinking, I did this:
```
git config --global user.signingkey --help
```
and now my global signing key is set to `--help`. Facepalm. Is there a gen... | Command
```
git config --global section.key value
```
does nothing more than editing file `~/.gitconfig` with content like this:
```
[section]
key = value
```
So, you can simply edit this file and fix it.
Also, you can use command to remove offending setting:
```
git config --global --unset section.key
``` |
11910921 | Reset local git repository | 28 | 2012-08-11 00:45:05 | <p>A few days ago I created a repository on Github, then followed the steps to add my existing solution to it. I have no idea what I did wrong, but after a few random 'git add' commands and whatnot, I now get the message in github for windows: </p>
<pre><code>failed to sync this branch.
You might need to open a shell... | 59,388 | 1,339,950 | 2016-11-10 18:54:11 | 11,910,950 | 60 | 2012-08-11 00:50:43 | 194,940 | 2012-08-11 00:50:43 | https://stackoverflow.com/q/11910921 | https://stackoverflow.com/a/11910950 | <p>Git stores everything about a repo at the repo's root in the hidden <code>.git</code> folder. Simply deleting that folder, <code>rm -rf .git</code> makes it as if there never was a repo there.</p>
| <p>Git stores everything about a repo at the repo's root in the hidden <code>.git</code> folder. Simply deleting that folder, <code>rm -rf .git</code> makes it as if there never was a repo there.</p> | 119 | git | <h1>Reset local git repository</h1>
<p>A few days ago I created a repository on Github, then followed the steps to add my existing solution to it. I have no idea what I did wrong, but after a few random 'git add' commands and whatnot, I now get the message in github for windows: </p>
<pre><code>failed to sync this br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,996 | git | # Reset local git repository
A few days ago I created a repository on Github, then followed the steps to add my existing solution to it. I have no idea what I did wrong, but after a few random 'git add' commands and whatnot, I now get the message in github for windows:
```
failed to sync this branch.
You might need t... | Git stores everything about a repo at the repo's root in the hidden `.git` folder. Simply deleting that folder, `rm -rf .git` makes it as if there never was a repo there. |
28763205 | Exclude directories from elastic beanstalk deploy | 18 | 2015-02-27 10:46:26 | <p>I have some directories that I would like to be in my local git repository, but NOT in the remote repository when I deploy to my beanstalk environment.</p>
<p>I have googled a bit, and found a few years old posts like this:</p>
<p><a href="http://blog.beanstalkapp.com/post/38164899272/patterns-for-excluded-deploym... | 14,763 | 3,493,347 | 2015-05-19 06:00:04 | 30,317,823 | 60 | 2015-05-19 06:00:04 | 864,651 | 2015-05-19 06:00:04 | https://stackoverflow.com/q/28763205 | https://stackoverflow.com/a/30317823 | <p>With the current <code>eb cli v3.x</code> elastic beanstalk supports the <code>.ebignore</code> file. It follows the same format as a <code>.gitignore</code> file and it replaces it on deploy.</p>
<p>If you want to use <code>.ebignore</code> then you need to copy your <code>.gitignore</code> into the file and then ... | <p>With the current <code>eb cli v3.x</code> elastic beanstalk supports the <code>.ebignore</code> file. It follows the same format as a <code>.gitignore</code> file and it replaces it on deploy.</p> <p>If you want to use <code>.ebignore</code> then you need to copy your <code>.gitignore</code> into the file and then ... | 119, 33388, 105747 | amazon-elastic-beanstalk, amazon-web-services, git | <h1>Exclude directories from elastic beanstalk deploy</h1>
<p>I have some directories that I would like to be in my local git repository, but NOT in the remote repository when I deploy to my beanstalk environment.</p>
<p>I have googled a bit, and found a few years old posts like this:</p>
<p><a href="http://blog.bean... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,998 | git | # Exclude directories from elastic beanstalk deploy
I have some directories that I would like to be in my local git repository, but NOT in the remote repository when I deploy to my beanstalk environment.
I have googled a bit, and found a few years old posts like this:
<http://blog.beanstalkapp.com/post/38164899272/p... | With the current `eb cli v3.x` elastic beanstalk supports the `.ebignore` file. It follows the same format as a `.gitignore` file and it replaces it on deploy.
If you want to use `.ebignore` then you need to copy your `.gitignore` into the file and then add the extra exclusions to the file. If you edit your `.gitignor... |
77987725 | How to fix an issue with libgit2 after brew upgrade? | 15 | 2024-02-13 11:56:38 | <p>On macOS 13.2, in <code>zsh</code>, <code>ls</code> returns the following error message:</p>
<pre><code>dyld[15164]: Library not loaded: /usr/local/opt/libgit2/lib/libgit2.1.6.dylib
Referenced from: <14346135-E664-31AF-A80B-05A5335ED5D7> /usr/local/Cellar/exa/0.10.1_1/bin/exa
Reason: tried: '/usr/local/opt... | 6,999 | 8,510,347 | 2024-11-06 07:55:15 | 78,737,956 | 60 | 2024-07-11 22:55:40 | 2,330,720 | 2024-10-24 09:59:17 | https://stackoverflow.com/q/77987725 | https://stackoverflow.com/a/78737956 | <p>The problem for me was with the package <code>exa</code>. My <code>.zshrc</code> file had aliases for ls, ll, etc. However, it is not maintained anymore. In fact, brew will yell if you try to upgrade it. My solution was first to uninstall this package, and then switch to <a href="https://github.com/eza-community/eza... | <p>The problem for me was with the package <code>exa</code>. My <code>.zshrc</code> file had aliases for ls, ll, etc. However, it is not maintained anymore. In fact, brew will yell if you try to upgrade it. My solution was first to uninstall this package, and then switch to <a href="https://github.com/eza-community/eza... | 1067, 3589, 66800 | homebrew, libgit2, ls | <h1>How to fix an issue with libgit2 after brew upgrade?</h1>
<p>On macOS 13.2, in <code>zsh</code>, <code>ls</code> returns the following error message:</p>
<pre><code>dyld[15164]: Library not loaded: /usr/local/opt/libgit2/lib/libgit2.1.6.dylib
Referenced from: <14346135-E664-31AF-A80B-05A5335ED5D7> /usr/loca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,999 | git | # How to fix an issue with libgit2 after brew upgrade?
On macOS 13.2, in `zsh`, `ls` returns the following error message:
```
dyld[15164]: Library not loaded: /usr/local/opt/libgit2/lib/libgit2.1.6.dylib
Referenced from: <14346135-E664-31AF-A80B-05A5335ED5D7> /usr/local/Cellar/exa/0.10.1_1/bin/exa
Reason: tried: ... | The problem for me was with the package `exa`. My `.zshrc` file had aliases for ls, ll, etc. However, it is not maintained anymore. In fact, brew will yell if you try to upgrade it. My solution was first to uninstall this package, and then switch to [`eza`](https://github.com/eza-community/eza)
```
brew uninstall exa
... |
10098095 | Can I view the reflog of a remote (not remote ref)? | 96 | 2012-04-10 23:54:59 | <p>Is it possible to view the reflog of a remote? That is, I want to know what the output of <code>git reflog</code> is on another remote machine.</p>
<p>Note that I am not asking for the reflog of remote-tracking branches (such as <code>origin/master</code>); I am asking for what <code>reflog</code> says <em>on the ot... | 53,194 | 10,608 | 2025-07-28 02:04:06 | 10,098,641 | 59 | 2012-04-11 01:17:04 | 1,256,452 | 2012-04-11 01:17:04 | https://stackoverflow.com/q/10098095 | https://stackoverflow.com/a/10098641 | <p>The answer is basically "no" (except on that machine), because the reflog is a log of locally-made re-assignments of some ref-name. Essentially, every time you run <code>git update-ref -m msg <name> <target></code> the update is logged ... locally: <code>.git/logs/<name></code> gets a line appende... | <p>The answer is basically "no" (except on that machine), because the reflog is a log of locally-made re-assignments of some ref-name. Essentially, every time you run <code>git update-ref -m msg <name> <target></code> the update is logged ... locally: <code>.git/logs/<name></code> gets a line appende... | 119, 79719 | git, git-reflog | <h1>Can I view the reflog of a remote (not remote ref)?</h1>
<p>Is it possible to view the reflog of a remote? That is, I want to know what the output of <code>git reflog</code> is on another remote machine.</p>
<p>Note that I am not asking for the reflog of remote-tracking branches (such as <code>origin/master</code>)... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,001 | git | # Can I view the reflog of a remote (not remote ref)?
Is it possible to view the reflog of a remote? That is, I want to know what the output of `git reflog` is on another remote machine.
Note that I am not asking for the reflog of remote-tracking branches (such as `origin/master`); I am asking for what `reflog` says ... | The answer is basically "no" (except on that machine), because the reflog is a log of locally-made re-assignments of some ref-name. Essentially, every time you run `git update-ref -m msg <name> <target>` the update is logged ... locally: `.git/logs/<name>` gets a line appended:
```
$ git update-ref -m foo HEAD HEAD^
$... |
804545 | What is this Git warning message when pushing changes to a remote repository? | 89 | 2009-04-29 22:23:14 | <p>The description is a bit terse. I simply added a file on my local master branch and pushed it back to a remote repo. Any idea why this is coming up?</p>
<pre>
warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not refle... | 49,401 | 40,882 | 2020-07-13 16:48:21 | 805,003 | 59 | 2009-04-30 01:21:00 | 2,988 | 2020-07-13 16:48:21 | https://stackoverflow.com/q/804545 | https://stackoverflow.com/a/805003 | <p>Actually, it means pretty much exactly what it says: somebody is working in the repository that you are pushing to, and that somebody has currently checked out the exact same branch that you are pushing to.</p>
<p>This is very confusing, because now they think that they have checked out the latest version of the bra... | <p>Actually, it means pretty much exactly what it says: somebody is working in the repository that you are pushing to, and that somebody has currently checked out the exact same branch that you are pushing to.</p> <p>This is very confusing, because now they think that they have checked out the latest version of the bra... | 119, 456 | git, version-control | <h1>What is this Git warning message when pushing changes to a remote repository?</h1>
<p>The description is a bit terse. I simply added a file on my local master branch and pushed it back to a remote repo. Any idea why this is coming up?</p>
<pre>
warning: updating the current branch
warning: Updating the currently c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,002 | git | # What is this Git warning message when pushing changes to a remote repository?
The description is a bit terse. I simply added a file on my local master branch and pushed it back to a remote repo. Any idea why this is coming up?
```
warning: updating the current branch
warning: Updating the currently checked out bran... | Actually, it means pretty much exactly what it says: somebody is working in the repository that you are pushing to, and that somebody has currently checked out the exact same branch that you are pushing to.
This is very confusing, because now they think that they have checked out the latest version of the branch, when... |
14988929 | Show all stashes in git log | 87 | 2013-02-20 20:06:53 | <p>I would like to see all stashes in <code>git log</code> output. Does anyone know if there is a way to do that?</p>
<p>Edit: I want to see all commits in the log -- <em>including</em> stash commits. I tried the command:</p>
<pre><code>git log --date-order --all
</code></pre>
<p>But it returns only the top most stash.... | 104,909 | 2,092,726 | 2024-10-04 02:05:00 | 35,993,495 | 59 | 2016-03-14 16:53:31 | 5,492,758 | 2016-03-14 16:53:31 | https://stackoverflow.com/q/14988929 | https://stackoverflow.com/a/35993495 | <p>I came here looking to do the same as @jbialobr, I did some more digging after reading the previous answers and came up with the below.</p>
<p>@msmt's answer gives you a log of the stashes, and you can use this to get the hashes to use in the git log.</p>
<p><code>git reflog show --format="%h" stash</code> gives y... | <p>I came here looking to do the same as @jbialobr, I did some more digging after reading the previous answers and came up with the below.</p> <p>@msmt's answer gives you a log of the stashes, and you can use this to get the hashes to use in the git log.</p> <p><code>git reflog show --format="%h" stash</code> gives y... | 119, 13091, 47913 | git, git-log, git-stash | <h1>Show all stashes in git log</h1>
<p>I would like to see all stashes in <code>git log</code> output. Does anyone know if there is a way to do that?</p>
<p>Edit: I want to see all commits in the log -- <em>including</em> stash commits. I tried the command:</p>
<pre><code>git log --date-order --all
</code></pre>
<p>Bu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,003 | git | # Show all stashes in git log
I would like to see all stashes in `git log` output. Does anyone know if there is a way to do that?
Edit: I want to see all commits in the log -- *including* stash commits. I tried the command:
```
git log --date-order --all
```
But it returns only the top most stash. I would like to s... | I came here looking to do the same as @jbialobr, I did some more digging after reading the previous answers and came up with the below.
@msmt's answer gives you a log of the stashes, and you can use this to get the hashes to use in the git log.
`git reflog show --format="%h" stash` gives you just the hashes of all st... |
13198143 | How do I disable git's credential helper for a single repository? | 77 | 2012-11-02 15:19:17 | <p>If I have a credential helper set in my <code>~/.gitconfig</code>, how can I disable/bypass it in a specific repo and use <em>no</em> credential helper?</p>
<p>I've tried editing the repo's <code>.git/config</code> file to blank out the <code>credential.helper</code> property like this:</p>
<pre><code>[credential]... | 91,207 | 4,160 | 2023-05-13 06:13:17 | 36,435,803 | 59 | 2016-04-05 19:52:39 | 6,309 | 2023-05-13 06:13:17 | https://stackoverflow.com/q/13198143 | https://stackoverflow.com/a/36435803 | <p>With git 2.9 (June 2016), this (<code>helper =</code> ) will actually work!</p>
<p>The <code>credential.helper</code> configuration variable is cumulative and there is no good way to override it from the command line.<br />
As a special case, <strong>giving an empty string as its value now serves as the signal to cl... | <p>With git 2.9 (June 2016), this (<code>helper =</code> ) will actually work!</p> <p>The <code>credential.helper</code> configuration variable is cumulative and there is no good way to override it from the command line.<br /> As a special case, <strong>giving an empty string as its value now serves as the signal to cl... | 119 | git | <h1>How do I disable git's credential helper for a single repository?</h1>
<p>If I have a credential helper set in my <code>~/.gitconfig</code>, how can I disable/bypass it in a specific repo and use <em>no</em> credential helper?</p>
<p>I've tried editing the repo's <code>.git/config</code> file to blank out the <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,004 | git | # How do I disable git's credential helper for a single repository?
If I have a credential helper set in my `~/.gitconfig`, how can I disable/bypass it in a specific repo and use *no* credential helper?
I've tried editing the repo's `.git/config` file to blank out the `credential.helper` property like this:
```
[cre... | With git 2.9 (June 2016), this (`helper =` ) will actually work!
The `credential.helper` configuration variable is cumulative and there is no good way to override it from the command line.
As a special case, **giving an empty string as its value now serves as the signal to clear the values specified in various files... |
10360342 | Git Clone Into Another Existing Git Repo | 75 | 2012-04-28 03:36:23 | <p>Am I going to run into any issues if I git clone a repo into an existing git repo? </p>
<p>For sake of simplification, I am developing a library "lib/" that should be available to all of my projects. This is a separate git repo. I'd like to import this lib/ into all of my projects, and update it only in one place, ... | 74,019 | 683,216 | 2020-05-02 21:28:56 | 10,362,680 | 59 | 2012-04-28 10:27:51 | 6,309 | 2019-03-01 14:18:29 | https://stackoverflow.com/q/10360342 | https://stackoverflow.com/a/10362680 | <p>Just for the record, you can clone a git repo within another one:<br>
Everything under your <code>lib</code> directory will be ignored by the enclosing Git repo, because said lib directory contains a <code>.git</code>.</p>
<p>So it would work, but the enclosing repo would have no idea:</p>
<ul>
<li>it needs a <cod... | <p>Just for the record, you can clone a git repo within another one:<br> Everything under your <code>lib</code> directory will be ignored by the enclosing Git repo, because said lib directory contains a <code>.git</code>.</p> <p>So it would work, but the enclosing repo would have no idea:</p> <ul> <li>it needs a <cod... | 119 | git | <h1>Git Clone Into Another Existing Git Repo</h1>
<p>Am I going to run into any issues if I git clone a repo into an existing git repo? </p>
<p>For sake of simplification, I am developing a library "lib/" that should be available to all of my projects. This is a separate git repo. I'd like to import this lib/ into all... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,005 | git | # Git Clone Into Another Existing Git Repo
Am I going to run into any issues if I git clone a repo into an existing git repo?
For sake of simplification, I am developing a library "lib/" that should be available to all of my projects. This is a separate git repo. I'd like to import this lib/ into all of my projects, ... | Just for the record, you can clone a git repo within another one:
Everything under your `lib` directory will be ignored by the enclosing Git repo, because said lib directory contains a `.git`.
So it would work, but the enclosing repo would have no idea:
- it needs a `lib` directory from another repo
- it needs a *s... |
3538774 | Is it possible to override git command by git alias? | 70 | 2010-08-21 20:10:56 | <p>my ~/.gitconfig is:</p>
<pre><code>[alias]
commit = "!sh commit.sh"
</code></pre>
<p>However, when I type <em>git commit</em>, script is not called.</p>
<p>Is it possible, or I have to use another alias name?</p>
| 16,673 | 338,581 | 2023-04-05 18:58:25 | 3,538,791 | 59 | 2010-08-21 20:16:19 | 205,756 | 2023-04-05 18:58:25 | https://stackoverflow.com/q/3538774 | https://stackoverflow.com/a/3538791 | <p><strong>It is NOT POSSIBLE</strong></p>
<p>This is from my clone of git.git:</p>
<pre class="lang-cpp prettyprint-override"><code>static int run_argv(int *argcp, const char ***argv)
{
int done_alias = 0;
while (1) {
/* See if it's an internal command */
handle_internal_command(*argcp, *argv)... | <p><strong>It is NOT POSSIBLE</strong></p> <p>This is from my clone of git.git:</p> <pre class="lang-cpp prettyprint-override"><code>static int run_argv(int *argcp, const char ***argv) { int done_alias = 0; while (1) { /* See if it's an internal command */ handle_internal_command(*argcp, *argv)... | 119, 1448 | alias, git | <h1>Is it possible to override git command by git alias?</h1>
<p>my ~/.gitconfig is:</p>
<pre><code>[alias]
commit = "!sh commit.sh"
</code></pre>
<p>However, when I type <em>git commit</em>, script is not called.</p>
<p>Is it possible, or I have to use another alias name?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,006 | git | # Is it possible to override git command by git alias?
my ~/.gitconfig is:
```
[alias]
commit = "!sh commit.sh"
```
However, when I type *git commit*, script is not called.
Is it possible, or I have to use another alias name? | **It is NOT POSSIBLE**
This is from my clone of git.git:
```
static int run_argv(int *argcp, const char ***argv)
{
int done_alias = 0;
while (1) {
/* See if it's an internal command */
handle_internal_command(*argcp, *argv);
/* .. then try the external ones */
execv_dashed_ex... |
2888029 | How to push a local Git repository to another computer? | 68 | 2010-05-22 12:16:25 | <p>I have a local Git repository setup on my laptop. I would like to push it to my desktop. </p>
<p>How can I do that?</p>
| 34,540 | 118,644 | 2014-08-01 04:57:06 | 2,888,092 | 59 | 2010-05-22 12:38:21 | 6,309 | 2010-05-22 12:44:58 | https://stackoverflow.com/q/2888029 | https://stackoverflow.com/a/2888092 | <p>If you have access to a shared directory, you can (see <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a> and <a href="http://www.kernel.org/pub/software/scm/git/docs/git-remote.html" rel="noreferrer"><code>git remote</code></a>):</p>
<pre><code>git clone --bare /path/to/your/la... | <p>If you have access to a shared directory, you can (see <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a> and <a href="http://www.kernel.org/pub/software/scm/git/docs/git-remote.html" rel="noreferrer"><code>git remote</code></a>):</p> <pre><code>git clone --bare /path/to/your/la... | 119, 28898 | git, git-push | <h1>How to push a local Git repository to another computer?</h1>
<p>I have a local Git repository setup on my laptop. I would like to push it to my desktop. </p>
<p>How can I do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,007 | git | # How to push a local Git repository to another computer?
I have a local Git repository setup on my laptop. I would like to push it to my desktop.
How can I do that? | If you have access to a shared directory, you can (see [`git clone`](http://git-scm.com/docs/git-clone) and [`git remote`](http://www.kernel.org/pub/software/scm/git/docs/git-remote.html)):
```
git clone --bare /path/to/your/laptop/repo /shared/path/to/desktop/repo.git
git remote add desktop /shared/path/to/desktop/r... |
25550582 | How to show space and tabs with git-diff | 67 | 2014-08-28 13:53:17 | <p>I have the following output with git-diff.</p>
<pre><code>- // sort list based on value
+ // sort list based on value
</code></pre>
<p>How can I easily see the number of removed tabs/spaces at the end of the line ?</p>
| 36,861 | 1,546,701 | 2023-12-20 14:08:03 | 30,803,980 | 59 | 2015-06-12 13:11:45 | 6,309 | 2016-10-27 06:03:39 | https://stackoverflow.com/q/25550582 | https://stackoverflow.com/a/30803980 | <p>Note: Git 2.5+ (Q2 2015) will propose a more specific option for whitespace detection.</p>
<p>See <a href="https://github.com/git/git/commit/0e383e185ae57a8ee6ba015a43749f6d34fe3c9a" rel="noreferrer">commits 0e383e1</a>, <a href="https://github.com/git/git/commit/0ad782f2406fa13f626653a001b5f01a9f3fa40f" rel="noref... | <p>Note: Git 2.5+ (Q2 2015) will propose a more specific option for whitespace detection.</p> <p>See <a href="https://github.com/git/git/commit/0e383e185ae57a8ee6ba015a43749f6d34fe3c9a" rel="noreferrer">commits 0e383e1</a>, <a href="https://github.com/git/git/commit/0ad782f2406fa13f626653a001b5f01a9f3fa40f" rel="noref... | 119, 9033 | git, git-diff | <h1>How to show space and tabs with git-diff</h1>
<p>I have the following output with git-diff.</p>
<pre><code>- // sort list based on value
+ // sort list based on value
</code></pre>
<p>How can I easily see the number of removed tabs/spaces at the end of the line ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,008 | git | # How to show space and tabs with git-diff
I have the following output with git-diff.
```
- // sort list based on value
+ // sort list based on value
```
How can I easily see the number of removed tabs/spaces at the end of the line ? | Note: Git 2.5+ (Q2 2015) will propose a more specific option for whitespace detection.
See [commits 0e383e1](https://github.com/git/git/commit/0e383e185ae57a8ee6ba015a43749f6d34fe3c9a), [0ad782f](https://github.com/git/git/commit/0ad782f2406fa13f626653a001b5f01a9f3fa40f), and [d55ef3e](https://github.com/git/git/commi... |
9955713 | git: dangling blobs | 67 | 2012-03-31 12:07:42 | <p>I recently ran <code>git fsck --lost-found</code> on my repository. </p>
<p>I expected to see a couple dangling commits, where I had reset <code>HEAD</code>.</p>
<p>However, I was surprised to see likely over several thousand dangling blob messages.</p>
<p>I don't believe anything is wrong with my repository, bu... | 23,398 | 136,451 | 2018-06-26 02:55:07 | 9,955,775 | 59 | 2012-03-31 12:17:04 | 703,019 | 2018-06-26 02:55:07 | https://stackoverflow.com/q/9955713 | https://stackoverflow.com/a/9955775 | <p>Last time I looked at this I stumbled across <a href="https://web.archive.org/web/20170211194735/http://git.net:80/ml/git/2009-04/msg01874.html" rel="noreferrer">this thread</a>, specifically this part:</p>
<blockquote>
<p>You can also end up with dangling objects in packs. When that pack is
repacked, those obj... | <p>Last time I looked at this I stumbled across <a href="https://web.archive.org/web/20170211194735/http://git.net:80/ml/git/2009-04/msg01874.html" rel="noreferrer">this thread</a>, specifically this part:</p> <blockquote> <p>You can also end up with dangling objects in packs. When that pack is repacked, those obj... | 119, 116920 | git, git-dangling | <h1>git: dangling blobs</h1>
<p>I recently ran <code>git fsck --lost-found</code> on my repository. </p>
<p>I expected to see a couple dangling commits, where I had reset <code>HEAD</code>.</p>
<p>However, I was surprised to see likely over several thousand dangling blob messages.</p>
<p>I don't believe anything is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,009 | git | # git: dangling blobs
I recently ran `git fsck --lost-found` on my repository.
I expected to see a couple dangling commits, where I had reset `HEAD`.
However, I was surprised to see likely over several thousand dangling blob messages.
I don't believe anything is wrong with my repository, but I'm curious as to what ... | Last time I looked at this I stumbled across [this thread](https://web.archive.org/web/20170211194735/http://git.net:80/ml/git/2009-04/msg01874.html), specifically this part:
> You can also end up with dangling objects in packs. When that pack is
> repacked, those objects will be loosened, and then eventually expired
... |
2780483 | Is there a way to make Git mark a file as conflicted? | 66 | 2010-05-06 10:54:50 | <p>It's possible to commit files that contains conflict data. Is there a way to mark these files as conflicted again, so that running git mergetool will generate the necessary files and run the merge tool?</p>
| 15,580 | 334,862 | 2016-05-18 16:37:15 | 37,305,476 | 59 | 2016-05-18 16:37:15 | 225,386 | 2016-05-18 16:37:15 | https://stackoverflow.com/q/2780483 | https://stackoverflow.com/a/37305476 | <p>If the index is already in a conflict state, simply check out the file with the <code>--conflict=merge</code> flag:</p>
<pre><code>git checkout --conflict=merge file
</code></pre>
<p>If the index is clean because the unresolved file has been [erroneously] added, just reset it before checking it out:</p>
<pre><cod... | <p>If the index is already in a conflict state, simply check out the file with the <code>--conflict=merge</code> flag:</p> <pre><code>git checkout --conflict=merge file </code></pre> <p>If the index is clean because the unresolved file has been [erroneously] added, just reset it before checking it out:</p> <pre><cod... | 119, 717, 25165 | git, merge, mergetool | <h1>Is there a way to make Git mark a file as conflicted?</h1>
<p>It's possible to commit files that contains conflict data. Is there a way to mark these files as conflicted again, so that running git mergetool will generate the necessary files and run the merge tool?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,010 | git | # Is there a way to make Git mark a file as conflicted?
It's possible to commit files that contains conflict data. Is there a way to mark these files as conflicted again, so that running git mergetool will generate the necessary files and run the merge tool? | If the index is already in a conflict state, simply check out the file with the `--conflict=merge` flag:
```
git checkout --conflict=merge file
```
If the index is clean because the unresolved file has been [erroneously] added, just reset it before checking it out:
```
git reset file
git checkout --conflict=merge fi... |
44245286 | git: See changes to a specific file by a commit | 63 | 2017-05-29 14:49:19 | <p>I want to see the what changes were made to <a href="https://github.com/LibreOffice/core/blob/master/include/svl/itemset.hxx" rel="noreferrer">this</a> file's at line 147. So i enquired the file line by line for commits by:</p>
<pre><code>git blame include/svl/itemset.hxx
</code></pre>
<p>Here is the trimmed output ... | 62,680 | 2,830,116 | 2026-01-13 20:18:23 | 44,246,693 | 59 | 2017-05-29 16:12:03 | 1,256,452 | 2018-02-04 19:44:12 | https://stackoverflow.com/q/44245286 | https://stackoverflow.com/a/44246693 | <p><a href="https://stackoverflow.com/a/44245324/1256452">eftshift0's answer</a> is correct (and I've upvoted it). Here's <em>why</em>, though—along with the one other thing that can go wrong here.</p>
<p>In <em>most</em> cases, <code>git show <em>commit</em> -- <em>path</em></code> would be correct and would show yo... | <p><a href="https://stackoverflow.com/a/44245324/1256452">eftshift0's answer</a> is correct (and I've upvoted it). Here's <em>why</em>, though—along with the one other thing that can go wrong here.</p> <p>In <em>most</em> cases, <code>git show <em>commit</em> -- <em>path</em></code> would be correct and would show yo... | 119 | git | <h1>git: See changes to a specific file by a commit</h1>
<p>I want to see the what changes were made to <a href="https://github.com/LibreOffice/core/blob/master/include/svl/itemset.hxx" rel="noreferrer">this</a> file's at line 147. So i enquired the file line by line for commits by:</p>
<pre><code>git blame include/svl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,011 | git | # git: See changes to a specific file by a commit
I want to see the what changes were made to [this](https://github.com/LibreOffice/core/blob/master/include/svl/itemset.hxx) file's at line 147. So i enquired the file line by line for commits by:
```
git blame include/svl/itemset.hxx
```
Here is the trimmed output of... | [eftshift0's answer](https://stackoverflow.com/a/44245324/1256452) is correct (and I've upvoted it). Here's *why*, though—along with the one other thing that can go wrong here.
In *most* cases, `git show commit -- path` would be correct and would show you:
- the log message for the specified commit, and
- a patch for... |
30770505 | hint: after resolving the conflicts, mark the corrected paths | 58 | 2015-06-11 02:23:26 | <p>git sometimes gives me this message on a conflict (during a revert or cherry pick)</p>
<pre><code>hint: after resolving the conflicts, mark the corrected paths
</code></pre>
<p>What does this mean?</p>
| 61,117 | 284,272 | 2024-03-18 21:54:38 | 30,770,796 | 59 | 2015-06-11 02:57:41 | 2,790,048 | 2023-02-26 13:54:51 | https://stackoverflow.com/q/30770505 | https://stackoverflow.com/a/30770796 | <p>This means that you need to explicitly tell Git that you've resolved a conflict at each file or folder (that is path).</p>
<p><strong>1. Look at the list of files with yet unresolved conflicts</strong></p>
<pre><code>git status
</code></pre>
<p><strong>2. Mark each file as resolved</strong></p>
<p>Once you have reso... | <p>This means that you need to explicitly tell Git that you've resolved a conflict at each file or folder (that is path).</p> <p><strong>1. Look at the list of files with yet unresolved conflicts</strong></p> <pre><code>git status </code></pre> <p><strong>2. Mark each file as resolved</strong></p> <p>Once you have reso... | 119, 28897, 34403, 78810, 106113 | git, git-cherry-pick, git-merge, git-merge-conflict, git-revert | <h1>hint: after resolving the conflicts, mark the corrected paths</h1>
<p>git sometimes gives me this message on a conflict (during a revert or cherry pick)</p>
<pre><code>hint: after resolving the conflicts, mark the corrected paths
</code></pre>
<p>What does this mean?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,012 | git | # hint: after resolving the conflicts, mark the corrected paths
git sometimes gives me this message on a conflict (during a revert or cherry pick)
```
hint: after resolving the conflicts, mark the corrected paths
```
What does this mean? | This means that you need to explicitly tell Git that you've resolved a conflict at each file or folder (that is path).
**1. Look at the list of files with yet unresolved conflicts**
```
git status
```
**2. Mark each file as resolved**
Once you have resolved conflicts in a file, add it to mark that conflicts are res... |
10573815 | Why is 'Updating the Git index failed' displayed | 57 | 2012-05-13 17:40:11 | <p>I am using Windows. When staging files I get this error.</p>
<p><code>Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui.</code></p>
<p>followed by a list of files which have been converted from LF to CRLF</p>
<p>After a lot of reading up on the CRLF / LF issue with Git... | 36,657 | 796,496 | 2021-10-28 13:18:14 | 10,574,393 | 59 | 2012-05-13 19:02:36 | 6,309 | 2012-11-12 07:07:36 | https://stackoverflow.com/q/10573815 | https://stackoverflow.com/a/10574393 | <pre><code>git config --global core.autocrlf false
</code></pre>
<p>Has always been my recommendation (see "<a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination</a>").</p>
... | <pre><code>git config --global core.autocrlf false </code></pre> <p>Has always been my recommendation (see "<a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination</a>").</p> ... | 64, 119, 3705, 59139 | core.autocrlf, git, newline, windows | <h1>Why is 'Updating the Git index failed' displayed</h1>
<p>I am using Windows. When staging files I get this error.</p>
<p><code>Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui.</code></p>
<p>followed by a list of files which have been converted from LF to CRLF</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,013 | git | # Why is 'Updating the Git index failed' displayed
I am using Windows. When staging files I get this error.
`Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui.`
followed by a list of files which have been converted from LF to CRLF
After a lot of reading up on the CRLF / ... | ```
git config --global core.autocrlf false
```
Has always been my recommendation (see "[Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination](https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133)").
However, in your case, you can "Co... |
52176834 | How to re-commit a past commit if someone overwrote my commit | 50 | 2018-09-05 03:58:09 | <p>Just faced an issue where someone overwritten my whole commit and there are lot of other commits on top of this, now I have to re-commit that particular commit. Any help would be appreciated.</p>
<p>Someone got merge conflict and while merging he lost my all changes. I don't know what he did, but my changes are not... | 5,331 | 3,230,700 | 2020-06-05 13:41:40 | 52,177,334 | 59 | 2018-09-05 04:56:28 | 7,639,034 | 2018-09-05 15:44:49 | https://stackoverflow.com/q/52176834 | https://stackoverflow.com/a/52177334 | <p>You can do that typing the following commands:</p>
<pre><code>$ git reflog
</code></pre>
<p>then select the ID of the commit that you want to retrieve.</p>
<p>Then type the following command:</p>
<pre><code>$ git cherry-pick <'ID'>
</code></pre>
<p><em>Instead of <code><'ID'></code> enter the ID fro... | <p>You can do that typing the following commands:</p> <pre><code>$ git reflog </code></pre> <p>then select the ID of the commit that you want to retrieve.</p> <p>Then type the following command:</p> <pre><code>$ git cherry-pick <'ID'> </code></pre> <p><em>Instead of <code><'ID'></code> enter the ID fro... | 119 | git | <h1>How to re-commit a past commit if someone overwrote my commit</h1>
<p>Just faced an issue where someone overwritten my whole commit and there are lot of other commits on top of this, now I have to re-commit that particular commit. Any help would be appreciated.</p>
<p>Someone got merge conflict and while merging h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,015 | git | # How to re-commit a past commit if someone overwrote my commit
Just faced an issue where someone overwritten my whole commit and there are lot of other commits on top of this, now I have to re-commit that particular commit. Any help would be appreciated.
Someone got merge conflict and while merging he lost my all ch... | You can do that typing the following commands:
```
$ git reflog
```
then select the ID of the commit that you want to retrieve.
Then type the following command:
```
$ git cherry-pick <'ID'>
```
*Instead of `<'ID'>` enter the ID from the above reflog.*
Then you will have the changes of that commit.
Now check if a... |
13844996 | git submodule init not pulling latest commit | 49 | 2012-12-12 17:10:48 | <p>I have a git repo with a git submodule inside of it. The submodule is hosted on bitbucket. I want to update my local copy of the submodule to its latest commit. I tired "<strong>git submodule update</strong>" however that is not doing anything. So I tried deleting the submodule folder and then doing "<strong>git sub... | 39,429 | 766,548 | 2023-06-23 14:03:58 | 13,845,645 | 59 | 2012-12-12 17:49:17 | 1,864,976 | 2012-12-12 17:57:17 | https://stackoverflow.com/q/13844996 | https://stackoverflow.com/a/13845645 | <p>Git is doing exactly what it's supposed to be doing. <code>git submodule update</code> will set your submodule to what the current commit in the parent repo specifies the submodule should be at. This way you can checkout another branch, older commit or tag, then run <code>git submodule update</code> and the submodul... | <p>Git is doing exactly what it's supposed to be doing. <code>git submodule update</code> will set your submodule to what the current commit in the parent repo specifies the submodule should be at. This way you can checkout another branch, older commit or tag, then run <code>git submodule update</code> and the submodul... | 119, 41612 | git, git-submodules | <h1>git submodule init not pulling latest commit</h1>
<p>I have a git repo with a git submodule inside of it. The submodule is hosted on bitbucket. I want to update my local copy of the submodule to its latest commit. I tired "<strong>git submodule update</strong>" however that is not doing anything. So I tried deletin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,017 | git | # git submodule init not pulling latest commit
I have a git repo with a git submodule inside of it. The submodule is hosted on bitbucket. I want to update my local copy of the submodule to its latest commit. I tired "**git submodule update**" however that is not doing anything. So I tried deleting the submodule folder... | Git is doing exactly what it's supposed to be doing. `git submodule update` will set your submodule to what the current commit in the parent repo specifies the submodule should be at. This way you can checkout another branch, older commit or tag, then run `git submodule update` and the submodule will be set to what tha... |
16499908 | How to roll back Git repo to first commit and delete all history | 47 | 2013-05-11 17:32:00 | <p>I'm learning how to use git these days and I had to do many hit-and-misses. Thus I needed to delete and create anew my remote and local repos. Is there a way to roll back to the first commit of the repo and delete all history after that? Basically a clean slate to experiment on.</p>
| 84,502 | 579,840 | 2024-11-27 11:06:02 | 16,500,248 | 59 | 2013-05-11 18:09:02 | 559,827 | 2023-08-04 22:35:29 | https://stackoverflow.com/q/16499908 | https://stackoverflow.com/a/16500248 | <p>I don't know of any way to do exactly what you're asking (one can roll back to first commit, but not delete <em>all</em> history, since the history will at least contain that initial commit.)</p>
<p>If I were you I'd just delete the remote repo and the <code>.git</code> directory of the local repo, and start over wi... | <p>I don't know of any way to do exactly what you're asking (one can roll back to first commit, but not delete <em>all</em> history, since the history will at least contain that initial commit.)</p> <p>If I were you I'd just delete the remote repo and the <code>.git</code> directory of the local repo, and start over wi... | 119, 7330, 34403 | git, git-revert, repository | <h1>How to roll back Git repo to first commit and delete all history</h1>
<p>I'm learning how to use git these days and I had to do many hit-and-misses. Thus I needed to delete and create anew my remote and local repos. Is there a way to roll back to the first commit of the repo and delete all history after that? Basic... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,018 | git | # How to roll back Git repo to first commit and delete all history
I'm learning how to use git these days and I had to do many hit-and-misses. Thus I needed to delete and create anew my remote and local repos. Is there a way to roll back to the first commit of the repo and delete all history after that? Basically a cl... | I don't know of any way to do exactly what you're asking (one can roll back to first commit, but not delete *all* history, since the history will at least contain that initial commit.)
If I were you I'd just delete the remote repo and the `.git` directory of the local repo, and start over with `git init`.
The closest... |
25403573 | How can one dry run a git push to check whether one has write permissions to a remote? | 44 | 2014-08-20 11:30:38 | <p>Is there a way to dry run a <code>git push</code> to know whether the user has permissions to actually create a new remote branch? I'd like to be able to verify that all is good in regards to permissions for a bunch of repos where the user will attempt to create new branches before they are actually created so that ... | 58,251 | 193,481 | 2024-01-31 15:53:55 | 25,406,647 | 59 | 2014-08-20 13:57:24 | 2,541,573 | 2024-01-31 15:53:55 | https://stackoverflow.com/q/25403573 | https://stackoverflow.com/a/25406647 | <p>Shawn Pierce <a href="https://groups.google.com/g/repo-discuss/c/g5iz84EbSz4/m/jOmAx0F9vVAJ" rel="noreferrer">wrote</a> the following about <code>git push --dry-run</code>:</p>
<blockquote>
<p>A <code>--dry-run</code> doesn't send the commands the client would use from client
to server, so the server can't tell the... | <p>Shawn Pierce <a href="https://groups.google.com/g/repo-discuss/c/g5iz84EbSz4/m/jOmAx0F9vVAJ" rel="noreferrer">wrote</a> the following about <code>git push --dry-run</code>:</p> <blockquote> <p>A <code>--dry-run</code> doesn't send the commands the client would use from client to server, so the server can't tell the... | 119, 51688 | git, user-permissions | <h1>How can one dry run a git push to check whether one has write permissions to a remote?</h1>
<p>Is there a way to dry run a <code>git push</code> to know whether the user has permissions to actually create a new remote branch? I'd like to be able to verify that all is good in regards to permissions for a bunch of re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,020 | git | # How can one dry run a git push to check whether one has write permissions to a remote?
Is there a way to dry run a `git push` to know whether the user has permissions to actually create a new remote branch? I'd like to be able to verify that all is good in regards to permissions for a bunch of repos where the user w... | Shawn Pierce [wrote](https://groups.google.com/g/repo-discuss/c/g5iz84EbSz4/m/jOmAx0F9vVAJ) the following about `git push --dry-run`:
> A `--dry-run` doesn't send the commands the client would use from client
> to server, so the server can't tell the client if it would accept them
> or not. The entire `--dry-run` thin... |
8229737 | How to delete all remote git branches which have already been integrated? | 43 | 2011-11-22 15:57:48 | <p>At work we are using topic branches which are integrated into a few (3) master branches at some point.
Now I'd like to delete all topic branches from my <em>remote</em> repository which have been fully integrated into a master branch. If that's not possible, retrieving a list of local branches which have been integr... | 20,351 | 298,479 | 2020-12-28 14:15:11 | 8,229,823 | 59 | 2011-11-22 16:02:50 | 95,382 | 2019-12-20 07:55:02 | https://stackoverflow.com/q/8229737 | https://stackoverflow.com/a/8229823 | <p><strong>Another answer edited in by someone who thought it's the best (and it looks good)</strong>:</p>
<pre><code>git branch -r --merged origin/master | grep -v master | grep "origin/" | cut -d "/" -f 2- | xargs -n 20 git push --delete origin
</code></pre>
<p>Explanation:</p>
<ul>
<li><code>git branch -r --merge... | <p><strong>Another answer edited in by someone who thought it's the best (and it looks good)</strong>:</p> <pre><code>git branch -r --merged origin/master | grep -v master | grep "origin/" | cut -d "/" -f 2- | xargs -n 20 git push --delete origin </code></pre> <p>Explanation:</p> <ul> <li><code>git branch -r --merge... | 119, 76220 | git, git-branch | <h1>How to delete all remote git branches which have already been integrated?</h1>
<p>At work we are using topic branches which are integrated into a few (3) master branches at some point.
Now I'd like to delete all topic branches from my <em>remote</em> repository which have been fully integrated into a master branch.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,021 | git | # How to delete all remote git branches which have already been integrated?
At work we are using topic branches which are integrated into a few (3) master branches at some point.
Now I'd like to delete all topic branches from my *remote* repository which have been fully integrated into a master branch. If that's not p... | **Another answer edited in by someone who thought it's the best (and it looks good)**:
```
git branch -r --merged origin/master | grep -v master | grep "origin/" | cut -d "/" -f 2- | xargs -n 20 git push --delete origin
```
Explanation:
- `git branch -r --merged origin/master`
- `-r`/`--remotes` list the remote-tr... |
16990657 | Git merge diff3 style need explanation | 40 | 2013-06-07 18:26:56 | <p>I've merged 2 branches and conflicts appeared, I would need some hints where it starts where it ends, etc. I've replaced the code with some faked data to make it easier to read and talk about.</p>
<pre><code><<<<<<< HEAD
aaaaaa
||||||| merged common ancestors
<<<<<<< Te... | 15,191 | 1,425,576 | 2018-01-21 14:08:46 | 33,420,045 | 59 | 2015-10-29 16:43:18 | 87,298 | 2015-10-29 16:43:18 | https://stackoverflow.com/q/16990657 | https://stackoverflow.com/a/33420045 | <p>What you're seeing in this example (with <code>Temporary merge branch</code> markers) is the result of diff3 with a criss-cross merge conflict. I'll explain this with a sequence of definitions.</p>
<h1>Definitions</h1>
<ul>
<li><strong>merge base</strong>: The commit where the two merging branches most recently di... | <p>What you're seeing in this example (with <code>Temporary merge branch</code> markers) is the result of diff3 with a criss-cross merge conflict. I'll explain this with a sequence of definitions.</p> <h1>Definitions</h1> <ul> <li><strong>merge base</strong>: The commit where the two merging branches most recently di... | 119, 717, 53847 | branching-and-merging, git, merge | <h1>Git merge diff3 style need explanation</h1>
<p>I've merged 2 branches and conflicts appeared, I would need some hints where it starts where it ends, etc. I've replaced the code with some faked data to make it easier to read and talk about.</p>
<pre><code><<<<<<< HEAD
aaaaaa
||||||| merged ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,023 | git | # Git merge diff3 style need explanation
I've merged 2 branches and conflicts appeared, I would need some hints where it starts where it ends, etc. I've replaced the code with some faked data to make it easier to read and talk about.
```
<<<<<<< HEAD
aaaaaa
||||||| merged common ancestors
<<<<<<< Temporary merge ... | What you're seeing in this example (with `Temporary merge branch` markers) is the result of diff3 with a criss-cross merge conflict. I'll explain this with a sequence of definitions.
# Definitions
- **merge base**: The commit where the two merging branches most recently diverged from. When a merge conflict occurs, di... |
21364636 | git pull --rebase --preserve-merges | 38 | 2014-01-26 14:32:23 | <p>Short version:
Do you need to preserve-merges only if you explicitly merged after you did a local commit? What exactly happens otherwise? Does it reapply your committed code to the merged branch?</p>
<p>Please explain when it is useful to <code>git pull --rebase --preserve-merges</code> vs. a regular <code>git pull... | 19,881 | 984,975 | 2017-07-31 15:01:22 | 21,365,623 | 59 | 2014-01-26 15:54:22 | 1,256,452 | 2014-01-26 20:03:30 | https://stackoverflow.com/q/21364636 | https://stackoverflow.com/a/21365623 | <p>Technically—and I claim this is a bit stupid of git, the <code>pull</code> script (it's a shell script) should just do this for you—you have to run <code>git pull --rebase=preserve</code> rather than attempting to use <code>git pull --rebase --preserve-merges</code>. (Or, as I noted in <a href="https://stackoverflo... | <p>Technically—and I claim this is a bit stupid of git, the <code>pull</code> script (it's a shell script) should just do this for you—you have to run <code>git pull --rebase=preserve</code> rather than attempting to use <code>git pull --rebase --preserve-merges</code>. (Or, as I noted in <a href="https://stackoverflo... | 119, 29934 | git, git-rebase | <h1>git pull --rebase --preserve-merges</h1>
<p>Short version:
Do you need to preserve-merges only if you explicitly merged after you did a local commit? What exactly happens otherwise? Does it reapply your committed code to the merged branch?</p>
<p>Please explain when it is useful to <code>git pull --rebase --preser... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,025 | git | # git pull --rebase --preserve-merges
Short version:
Do you need to preserve-merges only if you explicitly merged after you did a local commit? What exactly happens otherwise? Does it reapply your committed code to the merged branch?
Please explain when it is useful to `git pull --rebase --preserve-merges` vs. a regu... | Technically—and I claim this is a bit stupid of git, the `pull` script (it's a shell script) should just do this for you—you have to run `git pull --rebase=preserve` rather than attempting to use `git pull --rebase --preserve-merges`. (Or, as I noted in [a comment](https://stackoverflow.com/questions/21364636/git-pull-... |
7602106 | git remove file from repository but leave it on file system | 37 | 2011-09-29 19:00:10 | <p>I try to remove unnecessary files from git repository. That files were initially added and now they are in several branches. What I want is simply stop tracking changes in that files, I don't care what changes should stay there, but I need that files to stay on file system.</p>
<p>I tried following</p>
<pre><code>... | 10,362 | 471,149 | 2019-05-09 02:29:51 | 7,602,142 | 59 | 2011-09-29 19:03:42 | 31,582 | 2011-09-29 19:03:42 | https://stackoverflow.com/q/7602106 | https://stackoverflow.com/a/7602142 | <p>Just:</p>
<pre><code>git rm --cached file [file ...]
</code></pre>
<p>Of course you'll need to make sure the offending files are added to your <code>.gitignore</code> so they don't get recommitted straight away</p>
| <p>Just:</p> <pre><code>git rm --cached file [file ...] </code></pre> <p>Of course you'll need to make sure the offending files are added to your <code>.gitignore</code> so they don't get recommitted straight away</p> | 119 | git | <h1>git remove file from repository but leave it on file system</h1>
<p>I try to remove unnecessary files from git repository. That files were initially added and now they are in several branches. What I want is simply stop tracking changes in that files, I don't care what changes should stay there, but I need that fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,026 | git | # git remove file from repository but leave it on file system
I try to remove unnecessary files from git repository. That files were initially added and now they are in several branches. What I want is simply stop tracking changes in that files, I don't care what changes should stay there, but I need that files to sta... | Just:
```
git rm --cached file [file ...]
```
Of course you'll need to make sure the offending files are added to your `.gitignore` so they don't get recommitted straight away |
26050327 | How does git commit --amend work, exactly? | 36 | 2014-09-26 00:43:05 | <p>I have seen <em><a href="https://stackoverflow.com/questions/25948049/git-commit-amend-in-detached-head-state/25948372#25948372">'git commit --amend' in detached HEAD state</a></em>. The question requires the answer to be more complex than needs be.</p>
<p>I'd like to understand just how <code>git commit --a... | 56,408 | 1,108,891 | 2025-09-30 02:22:25 | 26,050,416 | 59 | 2014-09-26 00:53:12 | 2,541,573 | 2023-04-12 16:27:53 | https://stackoverflow.com/q/26050327 | https://stackoverflow.com/a/26050416 | <p>Assume that you're in a clean working state and that your repository looks as follows:</p>
<p><img src="https://i.sstatic.net/itPXs.png" alt="Enter image description here" /></p>
<p>If you then run</p>
<pre><code>git commit --amend
</code></pre>
<p>write a commit message, save and quit your editor, the following hap... | <p>Assume that you're in a clean working state and that your repository looks as follows:</p> <p><img src="https://i.sstatic.net/itPXs.png" alt="Enter image description here" /></p> <p>If you then run</p> <pre><code>git commit --amend </code></pre> <p>write a commit message, save and quit your editor, the following hap... | 119, 30968, 53850 | git, git-amend, git-commit | <h1>How does git commit --amend work, exactly?</h1>
<p>I have seen <em><a href="https://stackoverflow.com/questions/25948049/git-commit-amend-in-detached-head-state/25948372#25948372">'git commit --amend' in detached HEAD state</a></em>. The question requires the answer to be more complex than needs be.</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,027 | git | # How does git commit --amend work, exactly?
I have seen *['git commit --amend' in detached HEAD state](https://stackoverflow.com/questions/25948049/git-commit-amend-in-detached-head-state/25948372#25948372)*. The question requires the answer to be more complex than needs be.
I'd like to understand just how `git comm... | Assume that you're in a clean working state and that your repository looks as follows:

If you then run
```
git commit --amend
```
write a commit message, save and quit your editor, the following happens:
1. Your staging area—which, if you haven't sta... |
10043888 | Git - move branch to master | 32 | 2012-04-06 13:05:39 | <p>I have a branch with actual sources and I did not make any commits for a long time to master, and at the moment it's completely out of date. I want to just replace master's content with the content of my branch. One way to do it is to checkout both branch and master, delete master's content and copy content from bra... | 12,725 | 706,319 | 2012-04-06 18:24:08 | 10,043,909 | 59 | 2012-04-06 13:07:43 | 275,354 | 2012-04-06 14:05:28 | https://stackoverflow.com/q/10043888 | https://stackoverflow.com/a/10043909 | <p>You can use the following command to have master point to a new location:<br>
<code>git branch -f master branchToMoveMasterTo</code></p>
<p>What this is actually doing is creating a new branch called <code>master</code> that points to <code>branchToMoveMasterTo</code>. Since we already have a branch called master,... | <p>You can use the following command to have master point to a new location:<br> <code>git branch -f master branchToMoveMasterTo</code></p> <p>What this is actually doing is creating a new branch called <code>master</code> that points to <code>branchToMoveMasterTo</code>. Since we already have a branch called master,... | 119, 53847, 76220 | branching-and-merging, git, git-branch | <h1>Git - move branch to master</h1>
<p>I have a branch with actual sources and I did not make any commits for a long time to master, and at the moment it's completely out of date. I want to just replace master's content with the content of my branch. One way to do it is to checkout both branch and master, delete maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,029 | git | # Git - move branch to master
I have a branch with actual sources and I did not make any commits for a long time to master, and at the moment it's completely out of date. I want to just replace master's content with the content of my branch. One way to do it is to checkout both branch and master, delete master's conte... | You can use the following command to have master point to a new location:
`git branch -f master branchToMoveMasterTo`
What this is actually doing is creating a new branch called `master` that points to `branchToMoveMasterTo`. Since we already have a branch called master, we need the `-f` flag to say we want to delet... |
14551256 | Ruby: How to find out if a character is a letter or a digit? | 29 | 2013-01-27 19:25:48 | <p>I just started tinkering with Ruby earlier this week and I've run into something that I don't quite know how to code. I'm converting a scanner that was written in Java into Ruby for a class assignment, and I've gotten down to this section:</p>
<pre><code>if (Character.isLetter(lookAhead))
{
return id();
}... | 59,251 | 2,016,138 | 2021-01-26 20:16:43 | 14,551,970 | 59 | 2013-01-27 20:36:51 | 211,563 | 2020-12-20 15:08:19 | https://stackoverflow.com/q/14551256 | https://stackoverflow.com/a/14551970 | <p>Use a regular expression that matches letters & digits:</p>
<pre><code>def letter?(lookAhead)
lookAhead.match?(/[[:alpha:]]/)
end
def numeric?(lookAhead)
lookAhead.match?(/[[:digit:]]/)
end
</code></pre>
<p>These are called POSIX bracket expressions, and the advantage of them is that unicode characters unde... | <p>Use a regular expression that matches letters & digits:</p> <pre><code>def letter?(lookAhead) lookAhead.match?(/[[:alpha:]]/) end def numeric?(lookAhead) lookAhead.match?(/[[:digit:]]/) end </code></pre> <p>These are called POSIX bracket expressions, and the advantage of them is that unicode characters unde... | 12, 139, 6067, 9914 | character, digits, ruby, string | <h1>Ruby: How to find out if a character is a letter or a digit?</h1>
<p>I just started tinkering with Ruby earlier this week and I've run into something that I don't quite know how to code. I'm converting a scanner that was written in Java into Ruby for a class assignment, and I've gotten down to this section:</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,032 | git | # Ruby: How to find out if a character is a letter or a digit?
I just started tinkering with Ruby earlier this week and I've run into something that I don't quite know how to code. I'm converting a scanner that was written in Java into Ruby for a class assignment, and I've gotten down to this section:
```
if (Charact... | Use a regular expression that matches letters & digits:
```
def letter?(lookAhead)
lookAhead.match?(/[[:alpha:]]/)
end
def numeric?(lookAhead)
lookAhead.match?(/[[:digit:]]/)
end
```
These are called POSIX bracket expressions, and the advantage of them is that unicode characters under the given category will mat... |
40460216 | How do I make Git ignore symlink? | 26 | 2016-11-07 07:51:12 | <p>I have symlinks in my project folder so that large directories of videos and images are accessible when I am running project in local dev server on my windows 10 machine.</p>
<p>The problem with this is that Git wont let me do "add ." because when symlinks are present it gives me this error:</p>
<pre><code>error: ... | 20,241 | 657,477 | 2016-11-07 08:55:37 | 40,461,160 | 59 | 2016-11-07 08:55:37 | 1,615,903 | 2016-11-07 08:55:37 | https://stackoverflow.com/q/40460216 | https://stackoverflow.com/a/40461160 | <p>Git considers symlinks to be files, not directories. You need to remove the <code>/</code> at the end of each .gitignore line:</p>
<pre><code>NameOfSymlink
AnotherSymlink
</code></pre>
| <p>Git considers symlinks to be files, not directories. You need to remove the <code>/</code> at the end of each .gitignore line:</p> <pre><code>NameOfSymlink AnotherSymlink </code></pre> | 119 | git | <h1>How do I make Git ignore symlink?</h1>
<p>I have symlinks in my project folder so that large directories of videos and images are accessible when I am running project in local dev server on my windows 10 machine.</p>
<p>The problem with this is that Git wont let me do "add ." because when symlinks are present it g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,034 | git | # How do I make Git ignore symlink?
I have symlinks in my project folder so that large directories of videos and images are accessible when I am running project in local dev server on my windows 10 machine.
The problem with this is that Git wont let me do "add ." because when symlinks are present it gives me this err... | Git considers symlinks to be files, not directories. You need to remove the `/` at the end of each .gitignore line:
```
NameOfSymlink
AnotherSymlink
``` |
10391522 | Git "does not appear to be a git repository" | 26 | 2012-04-30 22:45:25 | <p>I am trying to install git on a server and have some problem when I try to perform the first push.
I successfully installed git on the server, created the repository locally and on the server but when I try to make the first push I get this message:</p>
<pre><code>stdin: is not a tty
fatal: '/my_repo.git' does not ... | 84,899 | 1,123,278 | 2022-12-22 12:03:41 | 10,392,265 | 59 | 2012-05-01 00:45:57 | 6,309 | 2022-12-22 12:03:41 | https://stackoverflow.com/q/10391522 | https://stackoverflow.com/a/10392265 | <p>I will assume you are using ssh to clone your repo.</p>
<p>That means you need the full path of the repo on the server in your ssh address:</p>
<pre><code>git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo
</code></pre>
<p>Note: if your 'my_repo' is a bare one (to allow pushing), that would be:</p>
<pre>... | <p>I will assume you are using ssh to clone your repo.</p> <p>That means you need the full path of the repo on the server in your ssh address:</p> <pre><code>git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo </code></pre> <p>Note: if your 'my_repo' is a bare one (to allow pushing), that would be:</p> <pre>... | 119 | git | <h1>Git "does not appear to be a git repository"</h1>
<p>I am trying to install git on a server and have some problem when I try to perform the first push.
I successfully installed git on the server, created the repository locally and on the server but when I try to make the first push I get this message:</p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,035 | git | # Git "does not appear to be a git repository"
I am trying to install git on a server and have some problem when I try to perform the first push.
I successfully installed git on the server, created the repository locally and on the server but when I try to make the first push I get this message:
```
stdin: is not a t... | I will assume you are using ssh to clone your repo.
That means you need the full path of the repo on the server in your ssh address:
```
git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo
```
Note: if your 'my_repo' is a bare one (to allow pushing), that would be:
```
git clone ssh://sshuser@serverIP/fu... |
24874978 | .gitignore does not ignore one folder | 21 | 2014-07-21 21:19:05 | <p>I've got the following in my .gitignore:</p>
<pre><code>#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
... | 20,533 | 1,024,057 | 2018-08-31 17:33:10 | 40,214,308 | 59 | 2016-10-24 08:55:13 | 2,998,007 | 2018-08-31 17:33:10 | https://stackoverflow.com/q/24874978 | https://stackoverflow.com/a/40214308 | <p>It is possible that Git is already tracking these files. Running the following command in terminal worked for me for both <code>.gradle</code> and <code>.idea</code> files:</p>
<pre><code>git rm --cached .gradle -r
</code></pre>
| <p>It is possible that Git is already tracking these files. Running the following command in terminal worked for me for both <code>.gradle</code> and <code>.idea</code> files:</p> <pre><code>git rm --cached .gradle -r </code></pre> | 119, 25056 | git, gitignore | <h1>.gitignore does not ignore one folder</h1>
<p>I've got the following in my .gitignore:</p>
<pre><code>#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,036 | git | # .gitignore does not ignore one folder
I've got the following in my .gitignore:
```
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Sto... | It is possible that Git is already tracking these files. Running the following command in terminal worked for me for both `.gradle` and `.idea` files:
```
git rm --cached .gradle -r
``` |
17429091 | git move locally committed changes to the new branch and push | 21 | 2013-07-02 15:04:27 | <p>I am on <code>master</code>. When I do git status I am told</p>
<pre><code>$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 13 commits.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
</code></pre>
<p>So all 13 only exist on my local machi... | 24,204 | 964,335 | 2017-04-30 09:14:06 | 17,429,124 | 59 | 2013-07-02 15:05:56 | 2,422,194 | 2015-09-18 05:11:00 | https://stackoverflow.com/q/17429091 | https://stackoverflow.com/a/17429124 | <p>Just do <code>git checkout -b yourbranch</code> and push that.</p>
<p>Then reset master to origin/master.</p>
<p>Order:</p>
<pre><code>git checkout -b mybranch
git push
git checkout master
git reset --hard origin/master
</code></pre>
| <p>Just do <code>git checkout -b yourbranch</code> and push that.</p> <p>Then reset master to origin/master.</p> <p>Order:</p> <pre><code>git checkout -b mybranch git push git checkout master git reset --hard origin/master </code></pre> | 119, 1879, 8974, 29934, 76220 | branch, git, git-branch, git-rebase, rebase | <h1>git move locally committed changes to the new branch and push</h1>
<p>I am on <code>master</code>. When I do git status I am told</p>
<pre><code>$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 13 commits.
# (use "git push" to publish your local commits)
#
nothing to commit, working d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,037 | git | # git move locally committed changes to the new branch and push
I am on `master`. When I do git status I am told
```
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 13 commits.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
```
So all 13 o... | Just do `git checkout -b yourbranch` and push that.
Then reset master to origin/master.
Order:
```
git checkout -b mybranch
git push
git checkout master
git reset --hard origin/master
``` |
38648772 | In Visual Studio Code How do I merge between two local branches? | 168 | 2016-07-29 00:32:52 | <p>In Visual Studio Code it seems that I am only allowed to push, pull and sync. There is documented support for merge conflicts but I can't figure out how to actually merge between two branches. The Git command line within VSC (press F1) only facillitates a subset of commands:</p>
<p><a href="https://i.sstatic.net/Hy... | 345,703 | 2,797,303 | 2024-09-08 05:01:02 | 38,653,254 | 58 | 2016-07-29 07:46:58 | 6,309 | 2019-03-27 05:59:45 | https://stackoverflow.com/q/38648772 | https://stackoverflow.com/a/38653254 | <p>Update June 2017 (from <a href="https://code.visualstudio.com/updates/v1_14" rel="noreferrer">VSCode 1.14</a>)</p>
<p>The ability to merge local branches has been added through <a href="https://github.com/Microsoft/vscode/pull/25731" rel="noreferrer">PR 25731</a> and commit <a href="https://github.com/Microsoft/vsco... | <p>Update June 2017 (from <a href="https://code.visualstudio.com/updates/v1_14" rel="noreferrer">VSCode 1.14</a>)</p> <p>The ability to merge local branches has been added through <a href="https://github.com/Microsoft/vscode/pull/25731" rel="noreferrer">PR 25731</a> and commit <a href="https://github.com/Microsoft/vsco... | 119, 111608 | git, visual-studio-code | <h1>In Visual Studio Code How do I merge between two local branches?</h1>
<p>In Visual Studio Code it seems that I am only allowed to push, pull and sync. There is documented support for merge conflicts but I can't figure out how to actually merge between two branches. The Git command line within VSC (press F1) only fa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,038 | git | # In Visual Studio Code How do I merge between two local branches?
In Visual Studio Code it seems that I am only allowed to push, pull and sync. There is documented support for merge conflicts but I can't figure out how to actually merge between two branches. The Git command line within VSC (press F1) only facillitate... | Update June 2017 (from [VSCode 1.14](https://code.visualstudio.com/updates/v1_14))
The ability to merge local branches has been added through [PR 25731](https://github.com/Microsoft/vscode/pull/25731) and commit [89cd05f](https://github.com/Microsoft/vscode/commit/89cd05f877231e54c8c099142f03689d9feff451): accessible ... |
6119956 | How to determine if Git handles a file as binary or as text? | 111 | 2011-05-25 05:34:45 | <p>I know that Git somehow automatically detects if a file is binary or text and that <code>.gitattributes</code> can be used to set this manually if needed. But is there also a way to ask Git how it treats a file?</p>
<p>So let's say I have a Git repository with two files in it: An <code>ascii.dat</code> file contain... | 31,961 | 274,473 | 2024-12-04 20:01:16 | 6,134,127 | 58 | 2011-05-26 05:36:30 | 193,688 | 2021-01-25 21:00:59 | https://stackoverflow.com/q/6119956 | https://stackoverflow.com/a/6134127 | <p><a href="https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3403" rel="noreferrer"><code>builtin_diff()</code></a><sup>1</sup> calls <a href="https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3354" rel="noreferrer"><code>diff_filespec_is_binary()</code></a> which calls <a href="https:/... | <p><a href="https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3403" rel="noreferrer"><code>builtin_diff()</code></a><sup>1</sup> calls <a href="https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3354" rel="noreferrer"><code>diff_filespec_is_binary()</code></a> which calls <a href="https:/... | 119 | git | <h1>How to determine if Git handles a file as binary or as text?</h1>
<p>I know that Git somehow automatically detects if a file is binary or text and that <code>.gitattributes</code> can be used to set this manually if needed. But is there also a way to ask Git how it treats a file?</p>
<p>So let's say I have a Git r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,040 | git | # How to determine if Git handles a file as binary or as text?
I know that Git somehow automatically detects if a file is binary or text and that `.gitattributes` can be used to set this manually if needed. But is there also a way to ask Git how it treats a file?
So let's say I have a Git repository with two files in... | [`builtin_diff()`](https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3403)1 calls [`diff_filespec_is_binary()`](https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?h=v2.30.0#n3354) which calls [`buffer_is_binary()`](https://git.kernel.org/pub/scm/git/git.git/tree/xdiff-interface.c?h=v2.30.0#n187) whi... |
3160976 | Should I have to add files to git every time I want to commit? | 82 | 2010-07-01 19:18:28 | <p>I'm new to git, coming from SVN world. So far, it seems a lot more useful, but I am still working out the kinks. </p>
<p>Currently, my workflow is like this: </p>
<p>make changes > git add . > git commit > enter log message</p>
<p>What I don't understand is why I seem to have to add all of my files before I commi... | 24,773 | 119,592 | 2018-08-24 17:34:13 | 3,161,025 | 58 | 2010-07-01 19:26:05 | 292,731 | 2010-07-01 19:26:05 | https://stackoverflow.com/q/3160976 | https://stackoverflow.com/a/3161025 | <p>This allows you to separate commits by edits. If you only want to commit these files now, under one commit, and then these next files now, under a second commit, you could do:</p>
<pre><code>git add files_under_one_topic
git commit -m "this is about one thing"
git add files_left_over_to_commit_about_a_completely_... | <p>This allows you to separate commits by edits. If you only want to commit these files now, under one commit, and then these next files now, under a second commit, you could do:</p> <pre><code>git add files_under_one_topic git commit -m "this is about one thing" git add files_left_over_to_commit_about_a_completely_... | 63, 119, 6452 | git, git-svn, svn | <h1>Should I have to add files to git every time I want to commit?</h1>
<p>I'm new to git, coming from SVN world. So far, it seems a lot more useful, but I am still working out the kinks. </p>
<p>Currently, my workflow is like this: </p>
<p>make changes > git add . > git commit > enter log message</p>
<p>What I don'... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,043 | git | # Should I have to add files to git every time I want to commit?
I'm new to git, coming from SVN world. So far, it seems a lot more useful, but I am still working out the kinks.
Currently, my workflow is like this:
make changes > git add . > git commit > enter log message
What I don't understand is why I seem to ha... | This allows you to separate commits by edits. If you only want to commit these files now, under one commit, and then these next files now, under a second commit, you could do:
```
git add files_under_one_topic
git commit -m "this is about one thing"
git add files_left_over_to_commit_about_a_completely_different_topic... |
50920506 | How to commit a change in git when git commit opens Nano? | 80 | 2018-06-19 04:07:13 | <p>I'm new to git and I'm trying to commit my first changes on a Windows machine. However, when I type in <code>$git commit</code> it takes me to a different screen than any online tutorials show or than what is mentioned in <a href="https://git-scm.com/book/en/v2" rel="noreferrer">Pro Git</a>. No online searching yiel... | 109,099 | 5,484,302 | 2025-02-25 13:23:11 | 50,920,577 | 58 | 2018-06-19 04:15:22 | 8,133,868 | 2025-02-25 13:23:11 | https://stackoverflow.com/q/50920506 | https://stackoverflow.com/a/50920577 | <p>That screen is just a text editor (called Nano) and those options at the bottom, represent commands, typically it's the <kbd>ctrl</kbd> key + the letter for the command.</p>
<p>To make the commit you should write your commit message, then press <kbd>ctrl</kbd>+<kbd>o</kbd> to save your message, and then <kbd>ctrl</k... | <p>That screen is just a text editor (called Nano) and those options at the bottom, represent commands, typically it's the <kbd>ctrl</kbd> key + the letter for the command.</p> <p>To make the commit you should write your commit message, then press <kbd>ctrl</kbd>+<kbd>o</kbd> to save your message, and then <kbd>ctrl</k... | 119, 18209, 53850 | git, git-commit, nano | <h1>How to commit a change in git when git commit opens Nano?</h1>
<p>I'm new to git and I'm trying to commit my first changes on a Windows machine. However, when I type in <code>$git commit</code> it takes me to a different screen than any online tutorials show or than what is mentioned in <a href="https://git-scm.com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,044 | git | # How to commit a change in git when git commit opens Nano?
I'm new to git and I'm trying to commit my first changes on a Windows machine. However, when I type in `$git commit` it takes me to a different screen than any online tutorials show or than what is mentioned in [Pro Git](https://git-scm.com/book/en/v2). No on... | That screen is just a text editor (called Nano) and those options at the bottom, represent commands, typically it's the `ctrl` key + the letter for the command.
To make the commit you should write your commit message, then press `ctrl`+`o` to save your message, and then `ctrl`+`x` to exit the editor.
To avoid that sc... |
58398995 | black as pre-commit hook always fails my commits | 75 | 2019-10-15 16:24:34 | <p>I'm trying to use <a href="https://pre-commit.com/" rel="noreferrer">pre-commit</a> to manage <a href="https://github.com/psf/black/blob/master/README.md" rel="noreferrer">Black</a> as a Git pre-commit hook, but I must be doing it wrong.</p>
<p>In my pre-commit config file I have:</p>
<pre><code>- repo: https://gi... | 58,497 | 119,775 | 2024-01-26 11:38:44 | 58,459,499 | 58 | 2019-10-19 00:18:25 | 812,183 | 2019-10-19 00:18:25 | https://stackoverflow.com/q/58398995 | https://stackoverflow.com/a/58459499 | <p>(author of <code>pre-commit</code> here)</p>
<p>the framework intentionally does not provide a way to auto-commit modifications. Here's a few issues which have asked for such:</p>
<ul>
<li><a href="https://github.com/pre-commit/pre-commit/issues/806" rel="noreferrer">pre-commit/pre-commit#806</a></li>
<li><a href... | <p>(author of <code>pre-commit</code> here)</p> <p>the framework intentionally does not provide a way to auto-commit modifications. Here's a few issues which have asked for such:</p> <ul> <li><a href="https://github.com/pre-commit/pre-commit/issues/806" rel="noreferrer">pre-commit/pre-commit#806</a></li> <li><a href... | 119, 14000, 43087, 136262, 139402 | git, githooks, pre-commit, pre-commit.com, python-black | <h1>black as pre-commit hook always fails my commits</h1>
<p>I'm trying to use <a href="https://pre-commit.com/" rel="noreferrer">pre-commit</a> to manage <a href="https://github.com/psf/black/blob/master/README.md" rel="noreferrer">Black</a> as a Git pre-commit hook, but I must be doing it wrong.</p>
<p>In my pre-comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,045 | git | # black as pre-commit hook always fails my commits
I'm trying to use [pre-commit](https://pre-commit.com/) to manage [Black](https://github.com/psf/black/blob/master/README.md) as a Git pre-commit hook, but I must be doing it wrong.
In my pre-commit config file I have:
```
- repo: https://github.com/psf/black
... | (author of `pre-commit` here)
the framework intentionally does not provide a way to auto-commit modifications. Here's a few issues which have asked for such:
- [pre-commit/pre-commit#806](https://github.com/pre-commit/pre-commit/issues/806)
- [pre-commit/pre-commit#747](https://github.com/pre-commit/pre-commit/issues... |
20842750 | "Conflicts prevent checkout" error using Git in Visual Studio | 68 | 2013-12-30 15:46:45 | <p>I am using Git in Visual Studio. When I am trying to synchronize, the following message appears:</p>
<blockquote>
<p>An error occured. Detailed message: An error was raised by libgit2. Cetegory = checkout(MergeConflict). 1 conflicts prevent checkout</p>
</blockquote>
<p>I don't have a clue about what the conflic... | 86,304 | 2,824,542 | 2022-07-27 11:11:19 | 23,155,224 | 58 | 2014-04-18 13:31:32 | 3,001,953 | 2014-04-18 13:31:32 | https://stackoverflow.com/q/20842750 | https://stackoverflow.com/a/23155224 | <p>I have solved the same problem by using the Git command prompt in Visual Studio, because it gives you more ability:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx</a></p>
<p>You also may install this exte... | <p>I have solved the same problem by using the Git command prompt in Visual Studio, because it gives you more ability:</p> <p><a href="http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx</a></p> <p>You also may install this exte... | 119, 3146, 33953, 93364 | conflict, git, visual-studio, visual-studio-2013 | <h1>"Conflicts prevent checkout" error using Git in Visual Studio</h1>
<p>I am using Git in Visual Studio. When I am trying to synchronize, the following message appears:</p>
<blockquote>
<p>An error occured. Detailed message: An error was raised by libgit2. Cetegory = checkout(MergeConflict). 1 conflicts prevent ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,046 | git | # "Conflicts prevent checkout" error using Git in Visual Studio
I am using Git in Visual Studio. When I am trying to synchronize, the following message appears:
> An error occured. Detailed message: An error was raised by libgit2. Cetegory = checkout(MergeConflict). 1 conflicts prevent checkout
I don't have a clue a... | I have solved the same problem by using the Git command prompt in Visual Studio, because it gives you more ability:
<http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx>
You also may install this extension to facilitate the work with it (it gives you ability do not enter passwords each time):
<http://gitcr... |
2468230 | How to use Winmerge with Git Extensions? | 60 | 2010-03-18 07:54:18 | <p>I'm using <a href="http://code.google.com/p/gitextensions/" rel="noreferrer">Git Extensions</a> and it pre-installs and sets up KDiff as the diff tool to solve merge conflicts. I'm very fond of Winmerge though and would like to replace KDiff with Winmerge.</p>
<p>In the Git Extensions settings, there are settings t... | 50,674 | 5,018 | 2016-12-15 00:19:24 | 8,190,125 | 58 | 2011-11-18 22:48:11 | 638,423 | 2016-12-15 00:19:24 | https://stackoverflow.com/q/2468230 | https://stackoverflow.com/a/8190125 | <p><strong>Overview</strong><br/>
The following is instructions on how to setup GIT Version Control so that you can use a better set of tools than the default installation. The setup requires that GIT Extensions is already installed and involves configuring Winmerge in GIT extensions. </p>
<p><strong>Installation</str... | <p><strong>Overview</strong><br/> The following is instructions on how to setup GIT Version Control so that you can use a better set of tools than the default installation. The setup requires that GIT Extensions is already installed and involves configuring Winmerge in GIT extensions. </p> <p><strong>Installation</str... | 119, 602, 10933, 39597 | git, git-extensions, settings, winmerge | <h1>How to use Winmerge with Git Extensions?</h1>
<p>I'm using <a href="http://code.google.com/p/gitextensions/" rel="noreferrer">Git Extensions</a> and it pre-installs and sets up KDiff as the diff tool to solve merge conflicts. I'm very fond of Winmerge though and would like to replace KDiff with Winmerge.</p>
<p>In... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,049 | git | # How to use Winmerge with Git Extensions?
I'm using [Git Extensions](http://code.google.com/p/gitextensions/) and it pre-installs and sets up KDiff as the diff tool to solve merge conflicts. I'm very fond of Winmerge though and would like to replace KDiff with Winmerge.
In the Git Extensions settings, there are sett... | **Overview**
The following is instructions on how to setup GIT Version Control so that you can use a better set of tools than the default installation. The setup requires that GIT Extensions is already installed and involves configuring Winmerge in GIT extensions.
**Installation**
Walk through all the prompts and ... |
21266948 | Use git to manage home directory | 58 | 2014-01-21 19:07:58 | <p>I'd like to create <strong>one single git repo</strong> in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like <em>.vimrc</em>, <em>.vim</em>, <em>.bashrc</em>, et... | 26,749 | 3,046,043 | 2021-10-08 23:28:40 | 21,267,097 | 58 | 2014-01-21 19:15:20 | 1,979,703 | 2021-10-08 23:28:40 | https://stackoverflow.com/q/21266948 | https://stackoverflow.com/a/21267097 | <p><strong>.gitignore</strong></p>
<pre><code># Ignore everything
*
# But not these files...
!*.vimrc
!*.vim
!*.bashrc
!.gitignore
# etc...
</code></pre>
<p>My home directory is also on <a href="https://github.com/vanniktech/config-home" rel="noreferrer">GitHub</a>.</p>
| <p><strong>.gitignore</strong></p> <pre><code># Ignore everything * # But not these files... !*.vimrc !*.vim !*.bashrc !.gitignore # etc... </code></pre> <p>My home directory is also on <a href="https://github.com/vanniktech/config-home" rel="noreferrer">GitHub</a>.</p> | 119 | git | <h1>Use git to manage home directory</h1>
<p>I'd like to create <strong>one single git repo</strong> in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like <em>.vimrc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,051 | git | # Use git to manage home directory
I'd like to create **one single git repo** in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like *.vimrc*, *.vim*, *.bashrc*, etc... | **.gitignore**
```
# Ignore everything
*
# But not these files...
!*.vimrc
!*.vim
!*.bashrc
!.gitignore
# etc...
```
My home directory is also on [GitHub](https://github.com/vanniktech/config-home). |
2922652 | Git: Is there a way to figure out where a commit was cherry-pick'ed from? | 54 | 2010-05-27 15:51:31 | <p>If I cherry-pick from multiple branches, is there a simple way to figure out where the commit was coming from (e.g. the sha of the original commit)?</p>
<p>Example:<br>
- at master branch<br>
- cherry pick commit A from a dev branch<br>
- A becomes D at the master branch </p>
<p>Before:</p>
<pre><code>* B (maste... | 26,736 | 8,976 | 2025-04-14 19:14:44 | 2,937,724 | 58 | 2010-05-30 06:09:37 | 193,688 | 2010-05-30 06:09:37 | https://stackoverflow.com/q/2922652 | https://stackoverflow.com/a/2937724 | <p>By default, the information about the original, “cherry” commit is not recorded as part of the new commit.</p>
<h2>Record the Source Commit in the Commit Message</h2>
<p>If you can force the use of particular workflows/options,
<a href="http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" rel="no... | <p>By default, the information about the original, “cherry” commit is not recorded as part of the new commit.</p> <h2>Record the Source Commit in the Commit Message</h2> <p>If you can force the use of particular workflows/options, <a href="http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" rel="no... | 119, 456, 36489 | cherry-pick, git, version-control | <h1>Git: Is there a way to figure out where a commit was cherry-pick'ed from?</h1>
<p>If I cherry-pick from multiple branches, is there a simple way to figure out where the commit was coming from (e.g. the sha of the original commit)?</p>
<p>Example:<br>
- at master branch<br>
- cherry pick commit A from a dev branch<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,055 | git | # Git: Is there a way to figure out where a commit was cherry-pick'ed from?
If I cherry-pick from multiple branches, is there a simple way to figure out where the commit was coming from (e.g. the sha of the original commit)?
Example:
- at master branch
- cherry pick commit A from a dev branch
- A becomes D at t... | By default, the information about the original, “cherry” commit is not recorded as part of the new commit.
## Record the Source Commit in the Commit Message
If you can force the use of particular workflows/options,
[*git cherry-pick*](http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html) has the `-x` ... |
3983829 | How can I get a git submodule's associated commit ID from a past commit in the parent clone? | 47 | 2010-10-21 02:18:09 | <p>Is there a way, short of actually checking out the parent commit, to determine a submodule's SHA-1 commit ID based on a commit ID in the parent clone? I know I can find the <em>currently</em> associated SHA-1 with <code>git submodule</code>.</p>
<p>Here's an example: </p>
<ul>
<li>I have a clone with a single subm... | 23,720 | 143,397 | 2019-09-06 15:14:06 | 4,010,165 | 58 | 2010-10-24 20:03:50 | 19,750 | 2016-09-19 12:11:59 | https://stackoverflow.com/q/3983829 | https://stackoverflow.com/a/4010165 | <p>You may use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-tree.html" rel="noreferrer"><code>git-ls-tree</code></a> to see what the SHA-1 id of a given path was during a given commit:</p>
<pre><code>$ git ls-tree released-1.2.3 foo
160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 foo
</code>... | <p>You may use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-tree.html" rel="noreferrer"><code>git-ls-tree</code></a> to see what the SHA-1 id of a given path was during a given commit:</p> <pre><code>$ git ls-tree released-1.2.3 foo 160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 foo </code>... | 119, 606, 41612 | diff, git, git-submodules | <h1>How can I get a git submodule's associated commit ID from a past commit in the parent clone?</h1>
<p>Is there a way, short of actually checking out the parent commit, to determine a submodule's SHA-1 commit ID based on a commit ID in the parent clone? I know I can find the <em>currently</em> associated SHA-1 with <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,056 | git | # How can I get a git submodule's associated commit ID from a past commit in the parent clone?
Is there a way, short of actually checking out the parent commit, to determine a submodule's SHA-1 commit ID based on a commit ID in the parent clone? I know I can find the *currently* associated SHA-1 with `git submodule`.
... | You may use [`git-ls-tree`](http://www.kernel.org/pub/software/scm/git/docs/git-ls-tree.html) to see what the SHA-1 id of a given path was during a given commit:
```
$ git ls-tree released-1.2.3 foo
160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 foo
```
(My first thought was `git show released-1.2.3 foo`, bu... |
40210885 | Git reflog a specific branch? | 45 | 2016-10-24 04:50:14 | <p>Can I reflog a specific branch?</p>
<p><code>git reflog</code> shows all history on the repo. But I want to check the history of one specific branch, say <code>production</code>. Is there a way to do that? </p>
| 23,300 | 4,015,856 | 2023-07-29 05:41:26 | 40,210,979 | 58 | 2016-10-24 04:59:33 | 1,256,452 | 2018-09-21 19:10:02 | https://stackoverflow.com/q/40210885 | https://stackoverflow.com/a/40210979 | <p>As noted in <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">the documentation</a>, <code>git reflog</code> takes an action verb (called <code><subcommand></code>) and optional modifiers. The action defaults to <code>show</code>, and its optional modifier is the reference name to show.</p>
<p>T... | <p>As noted in <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">the documentation</a>, <code>git reflog</code> takes an action verb (called <code><subcommand></code>) and optional modifiers. The action defaults to <code>show</code>, and its optional modifier is the reference name to show.</p> <p>T... | 119, 79719 | git, git-reflog | <h1>Git reflog a specific branch?</h1>
<p>Can I reflog a specific branch?</p>
<p><code>git reflog</code> shows all history on the repo. But I want to check the history of one specific branch, say <code>production</code>. Is there a way to do that? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,058 | git | # Git reflog a specific branch?
Can I reflog a specific branch?
`git reflog` shows all history on the repo. But I want to check the history of one specific branch, say `production`. Is there a way to do that? | As noted in [the documentation](https://git-scm.com/docs/git-reflog), `git reflog` takes an action verb (called `<subcommand>`) and optional modifiers. The action defaults to `show`, and its optional modifier is the reference name to show.
The default is to show operations on `HEAD`. (Most, but *not* all, "everyday" c... |
59714347 | Semi linear merge | 42 | 2020-01-13 10:04:38 | <p>I just noticed in Azure DevOps, there's this option called <code>semi-linear merge</code>. I was wondering what it does? Does it come between the merge strategy & rebase strategy (from the name semi-linear)? If so, what are the pros/cons?</p>
<p><a href="https://i.sstatic.net/DanCn.png" rel="noreferrer"><img sr... | 24,167 | 8,011,544 | 2025-06-11 08:59:57 | 59,714,422 | 58 | 2020-01-13 10:08:28 | 1,945,525 | 2020-01-13 10:08:28 | https://stackoverflow.com/q/59714347 | https://stackoverflow.com/a/59714422 | <blockquote>
<p><strong>Semi-linear merge</strong><br />
This strategy is the most exotic – it’s a mix of rebase and a merge. First, the commits in the pull request are rebased on top of the master branch. Then those rebased pull requests are merged into master branch. It emulates running <code>git rebase master</code>... | <blockquote> <p><strong>Semi-linear merge</strong><br /> This strategy is the most exotic – it’s a mix of rebase and a merge. First, the commits in the pull request are rebased on top of the master branch. Then those rebased pull requests are merged into master branch. It emulates running <code>git rebase master</code>... | 119, 105024, 116537 | azure-devops, git, merge-strategy | <h1>Semi linear merge</h1>
<p>I just noticed in Azure DevOps, there's this option called <code>semi-linear merge</code>. I was wondering what it does? Does it come between the merge strategy & rebase strategy (from the name semi-linear)? If so, what are the pros/cons?</p>
<p><a href="https://i.sstatic.net/DanCn.pn... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,059 | git | # Semi linear merge
I just noticed in Azure DevOps, there's this option called `semi-linear merge`. I was wondering what it does? Does it come between the merge strategy & rebase strategy (from the name semi-linear)? If so, what are the pros/cons?
[](htt... | > **Semi-linear merge**
> This strategy is the most exotic – it’s a mix of rebase and a merge. First, the commits in the pull request are rebased on top of the master branch. Then those rebased pull requests are merged into master branch. It emulates running `git rebase master` on the pull request branch, followed by... |
31454603 | Order of commit arguments in git diff | 42 | 2015-07-16 12:47:30 | <p>In what order does the git command</p>
<pre><code>git diff [--options] <commit> <commit> [--] [<path>…]
</code></pre>
<p>Compare the different commits against each other? It seems like if I want to compare the new against the old one I need to do</p>
<p><code>git diff [--options] <New_commit&... | 11,883 | 1,825,441 | 2021-10-15 06:19:01 | 31,455,033 | 58 | 2015-07-16 13:05:11 | 2,541,573 | 2017-06-03 09:11:51 | https://stackoverflow.com/q/31454603 | https://stackoverflow.com/a/31455033 | <h1>TL;DR</h1>
<p>In the following <code>git-diff</code> syntax,</p>
<pre><code>git diff [--options] <commit> <commit> [--] [<path>...]
</code></pre>
<ul>
<li>the first <code><commit></code> corresponds to the base commit,</li>
<li>the second <code><commit></code> corresponds to the com... | <h1>TL;DR</h1> <p>In the following <code>git-diff</code> syntax,</p> <pre><code>git diff [--options] <commit> <commit> [--] [<path>...] </code></pre> <ul> <li>the first <code><commit></code> corresponds to the base commit,</li> <li>the second <code><commit></code> corresponds to the com... | 119, 9033 | git, git-diff | <h1>Order of commit arguments in git diff</h1>
<p>In what order does the git command</p>
<pre><code>git diff [--options] <commit> <commit> [--] [<path>…]
</code></pre>
<p>Compare the different commits against each other? It seems like if I want to compare the new against the old one I need to do</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,060 | git | # Order of commit arguments in git diff
In what order does the git command
```
git diff [--options] <commit> <commit> [--] [<path>…]
```
Compare the different commits against each other? It seems like if I want to compare the new against the old one I need to do
`git diff [--options] <New_commit> <Old_commit>` in o... | # TL;DR
In the following `git-diff` syntax,
```
git diff [--options] <commit> <commit> [--] [<path>...]
```
- the first `<commit>` corresponds to the base commit,
- the second `<commit>` corresponds to the commit to compare to the base commit.
Using a mathematically inspired notation,
```
git diff <x> <x+∆x>
```
... |
17122245 | What is a git upstream | 42 | 2013-06-15 09:42:32 | <p>When you have created a github-repo and added the the github-repo as remote </p>
<pre><code>git remote add origin https://github.com/githubname/reponame.git
</code></pre>
<p>then you need to push your first commit with </p>
<pre><code>git push -u origin master
</code></pre>
<p>I read (<a href="https://stackoverf... | 38,720 | 931,738 | 2020-02-08 12:34:37 | 17,122,300 | 58 | 2013-06-15 09:50:07 | 46,194 | 2020-02-08 12:34:37 | https://stackoverflow.com/q/17122245 | https://stackoverflow.com/a/17122300 | <p>In the command</p>
<pre><code>git push -u origin master
</code></pre>
<p>The <code>-u</code> flag means that your local branch will become a <em>tracking branch</em>. That is, a branch that tracks a remote branch (the "upstream" branch), so that future <code>git pull</code> will know which branch to merge from and... | <p>In the command</p> <pre><code>git push -u origin master </code></pre> <p>The <code>-u</code> flag means that your local branch will become a <em>tracking branch</em>. That is, a branch that tracks a remote branch (the "upstream" branch), so that future <code>git pull</code> will know which branch to merge from and... | 119 | git | <h1>What is a git upstream</h1>
<p>When you have created a github-repo and added the the github-repo as remote </p>
<pre><code>git remote add origin https://github.com/githubname/reponame.git
</code></pre>
<p>then you need to push your first commit with </p>
<pre><code>git push -u origin master
</code></pre>
<p>I r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,061 | git | # What is a git upstream
When you have created a github-repo and added the the github-repo as remote
```
git remote add origin https://github.com/githubname/reponame.git
```
then you need to push your first commit with
```
git push -u origin master
```
I read ([Why do I need to do `--set-upstream` all the time?](h... | In the command
```
git push -u origin master
```
The `-u` flag means that your local branch will become a *tracking branch*. That is, a branch that tracks a remote branch (the "upstream" branch), so that future `git pull` will know which branch to merge from and `git push` will be directed to the correct remote branc... |
12495756 | Why doesn't git allow me to safely delete a branch? | 39 | 2012-09-19 13:28:03 | <p>I needed to merge two branches -- <code>second</code> into <code>first</code> and then get rid of <code>second</code>. Here's what I did:</p>
<ul>
<li><code>git clone</code>d the project to get a fresh copy</li>
<li><code>git checkout --track origin/second</code>, made some changes, and committed</li>
<li><code>gi... | 12,263 | 894,284 | 2020-12-09 00:54:41 | 12,520,718 | 58 | 2012-09-20 20:49:49 | 894,284 | 2012-09-20 20:49:49 | https://stackoverflow.com/q/12495756 | https://stackoverflow.com/a/12520718 | <p>Based on my experiments and @knittl's and @twalberg's comments, it seems that git just wanted me to push my changes to the <code>second</code> branch before deleting it.</p>
<p>I did:</p>
<pre><code>$ git checkout second
$ git push origin second
$ git checkout first
$ git branch -d second
</code></pre>
<p>which w... | <p>Based on my experiments and @knittl's and @twalberg's comments, it seems that git just wanted me to push my changes to the <code>second</code> branch before deleting it.</p> <p>I did:</p> <pre><code>$ git checkout second $ git push origin second $ git checkout first $ git branch -d second </code></pre> <p>which w... | 119, 717, 1879 | branch, git, merge | <h1>Why doesn't git allow me to safely delete a branch?</h1>
<p>I needed to merge two branches -- <code>second</code> into <code>first</code> and then get rid of <code>second</code>. Here's what I did:</p>
<ul>
<li><code>git clone</code>d the project to get a fresh copy</li>
<li><code>git checkout --track origin/seco... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,063 | git | # Why doesn't git allow me to safely delete a branch?
I needed to merge two branches -- `second` into `first` and then get rid of `second`. Here's what I did:
- `git clone`d the project to get a fresh copy
- `git checkout --track origin/second`, made some changes, and committed
- `git checkout --track origin/first`, ... | Based on my experiments and @knittl's and @twalberg's comments, it seems that git just wanted me to push my changes to the `second` branch before deleting it.
I did:
```
$ git checkout second
$ git push origin second
$ git checkout first
$ git branch -d second
```
which worked without warnings. |
5669621 | Git, find out which files have had the most commits | 37 | 2011-04-14 20:59:53 | <p>How can I search my git logs to see which files have had the most activity?</p>
| 7,859 | 103,739 | 2021-03-24 07:31:48 | 5,670,168 | 58 | 2011-04-14 21:53:25 | 85,371 | 2019-02-14 11:21:56 | https://stackoverflow.com/q/5669621 | https://stackoverflow.com/a/5670168 | <p>that's one of these things that is very easy, accidentally (?):</p>
<pre class="lang-sh prettyprint-override"><code>git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | head
</code></pre>
<ol>
<li>give me all objects from all revisions in all branches</li>
<li>ignore any results without a pa... | <p>that's one of these things that is very easy, accidentally (?):</p> <pre class="lang-sh prettyprint-override"><code>git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | head </code></pre> <ol> <li>give me all objects from all revisions in all branches</li> <li>ignore any results without a pa... | 119 | git | <h1>Git, find out which files have had the most commits</h1>
<p>How can I search my git logs to see which files have had the most activity?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,064 | git | # Git, find out which files have had the most commits
How can I search my git logs to see which files have had the most activity? | that's one of these things that is very easy, accidentally (?):
```
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | head
```
1. give me all objects from all revisions in all branches
2. ignore any results without a path
3. sort them by path
4. make them unique (ignoring the blob hash), pre... |
5292184 | Merging multiple branches with git | 36 | 2011-03-13 20:33:11 | <p>I have 2 local branches called "develop" and "master"; they are similar. On my company's server there's one "main" repo (production) and several branches that were made by other developers:</p>
<pre>
$ git branch -a
* develop
master
remotes/origin/HEAD -> origin/master
remotes/origin/some-test
remotes/origi... | 67,158 | 598,717 | 2018-10-03 02:04:40 | 5,292,267 | 58 | 2011-03-13 20:45:36 | 474,283 | 2011-03-13 20:45:36 | https://stackoverflow.com/q/5292184 | https://stackoverflow.com/a/5292267 | <ol>
<li><code>git checkout master</code></li>
<li><code>git pull origin feature1 feature2</code></li>
<li><code>git checkout develop</code></li>
<li><code>git pull . master</code> (or maybe <code>git rebase ./master</code>)</li>
</ol>
<p>The first command changes your current branch to <code>master</code>.</p>
<p>Th... | <ol> <li><code>git checkout master</code></li> <li><code>git pull origin feature1 feature2</code></li> <li><code>git checkout develop</code></li> <li><code>git pull . master</code> (or maybe <code>git rebase ./master</code>)</li> </ol> <p>The first command changes your current branch to <code>master</code>.</p> <p>Th... | 119, 717, 8974 | git, merge, rebase | <h1>Merging multiple branches with git</h1>
<p>I have 2 local branches called "develop" and "master"; they are similar. On my company's server there's one "main" repo (production) and several branches that were made by other developers:</p>
<pre>
$ git branch -a
* develop
master
remotes/origin/HEAD -> origin/maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,065 | git | # Merging multiple branches with git
I have 2 local branches called "develop" and "master"; they are similar. On my company's server there's one "main" repo (production) and several branches that were made by other developers:
```
$ git branch -a
* develop
master
remotes/origin/HEAD -> origin/master
remotes/ori... | 1. `git checkout master`
2. `git pull origin feature1 feature2`
3. `git checkout develop`
4. `git pull . master` (or maybe `git rebase ./master`)
The first command changes your current branch to `master`.
The second command pulls in changes from the remote `feature1` and `feature2` branches. This is an "octopus" merg... |
29319361 | How to see diff between working directory and staging index? | 33 | 2015-03-28 16:09:23 | <p>We can see difference between <strong>repository and working directory</strong> with:</p>
<pre><code>git diff
</code></pre>
<p>We can see difference between <strong>repository and staging index</strong> with:</p>
<pre><code>git diff --staged
</code></pre>
<p>But how do we see difference between <strong>working d... | 19,725 | 1,075,423 | 2021-04-30 15:05:06 | 29,319,403 | 58 | 2015-03-28 16:13:39 | 6,309 | 2020-09-20 11:39:32 | https://stackoverflow.com/q/29319361 | https://stackoverflow.com/a/29319403 | <p>Actually, <code>git diff</code> is between index and working tree. It just so happens that until you have staged changes to the index (with <code>git add</code>) that its contents will be identical to the <code>HEAD</code> commit.</p>
<p><code>git diff HEAD</code> is between repo and working tree.</p>
<p>See <a hre... | <p>Actually, <code>git diff</code> is between index and working tree. It just so happens that until you have staged changes to the index (with <code>git add</code>) that its contents will be identical to the <code>HEAD</code> commit.</p> <p><code>git diff HEAD</code> is between repo and working tree.</p> <p>See <a hre... | 119, 9033 | git, git-diff | <h1>How to see diff between working directory and staging index?</h1>
<p>We can see difference between <strong>repository and working directory</strong> with:</p>
<pre><code>git diff
</code></pre>
<p>We can see difference between <strong>repository and staging index</strong> with:</p>
<pre><code>git diff --staged
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,068 | git | # How to see diff between working directory and staging index?
We can see difference between **repository and working directory** with:
```
git diff
```
We can see difference between **repository and staging index** with:
```
git diff --staged
```
But how do we see difference between **working directory and stagin... | Actually, `git diff` is between index and working tree. It just so happens that until you have staged changes to the index (with `git add`) that its contents will be identical to the `HEAD` commit.
`git diff HEAD` is between repo and working tree.
See [365git.tumblr.com post](http://365git.tumblr.com/post/3464927214/... |
26048582 | Git - How to revert entire directory to specific commit (removing any added files) | 33 | 2014-09-25 21:39:20 | <p>I want revert a directory in git - reverting all files inside, as well as removing any files added since that commit. Doing a checkout only seems to satisfy my first requirement, but doesn't delete any files.</p>
| 29,520 | 843,432 | 2023-10-11 10:28:19 | 26,061,338 | 58 | 2014-09-26 13:56:30 | 843,432 | 2018-09-21 02:19:29 | https://stackoverflow.com/q/26048582 | https://stackoverflow.com/a/26061338 | <p>I figured out the simplest solution.</p>
<pre><code>git rm /path/to/dir
git checkout <rev> /path/to/dir
git commit -m "reverting directory"
</code></pre>
<p>Then delete any untracked files.</p>
<pre><code>git rm
</code></pre>
<blockquote>
<blockquote>
<p>Remove files from the working tree and from th... | <p>I figured out the simplest solution.</p> <pre><code>git rm /path/to/dir git checkout <rev> /path/to/dir git commit -m "reverting directory" </code></pre> <p>Then delete any untracked files.</p> <pre><code>git rm </code></pre> <blockquote> <blockquote> <p>Remove files from the working tree and from th... | 119 | git | <h1>Git - How to revert entire directory to specific commit (removing any added files)</h1>
<p>I want revert a directory in git - reverting all files inside, as well as removing any files added since that commit. Doing a checkout only seems to satisfy my first requirement, but doesn't delete any files.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,069 | git | # Git - How to revert entire directory to specific commit (removing any added files)
I want revert a directory in git - reverting all files inside, as well as removing any files added since that commit. Doing a checkout only seems to satisfy my first requirement, but doesn't delete any files. | I figured out the simplest solution.
```
git rm /path/to/dir
git checkout <rev> /path/to/dir
git commit -m "reverting directory"
```
Then delete any untracked files.
```
git rm
```
> > Remove files from the working tree and from the index <https://git-scm.com/docs/git-rm>
```
git checkout
```
> > Updates files in... |
33733453 | Get changed files using gitpython | 32 | 2015-11-16 10:45:52 | <p>I want to get a list of changed files of the current git-repo. The files, that are normally listed under <code>Changes not staged for commit:</code> when calling <code>git status</code>. </p>
<p>So far I have managed to connected to the repository, pulled it and show all untracked files: </p>
<pre><code>from git i... | 46,115 | 2,162,377 | 2023-03-24 16:20:17 | 42,792,158 | 58 | 2017-03-14 17:01:04 | 3,678,249 | 2023-03-24 16:20:17 | https://stackoverflow.com/q/33733453 | https://stackoverflow.com/a/42792158 | <pre><code>for item in repo.index.diff(None):
print(item.a_path)
</code></pre>
<p>or to get just the list:</p>
<pre><code>changedFiles = [item.a_path for item in repo.index.diff(None)]
</code></pre>
<p><code>repo.index.diff()</code> returns <code>git.diff.Diffable</code> described in <a href="http://gitpython.readt... | <pre><code>for item in repo.index.diff(None): print(item.a_path) </code></pre> <p>or to get just the list:</p> <pre><code>changedFiles = [item.a_path for item in repo.index.diff(None)] </code></pre> <p><code>repo.index.diff()</code> returns <code>git.diff.Diffable</code> described in <a href="http://gitpython.readt... | 16, 61013 | gitpython, python | <h1>Get changed files using gitpython</h1>
<p>I want to get a list of changed files of the current git-repo. The files, that are normally listed under <code>Changes not staged for commit:</code> when calling <code>git status</code>. </p>
<p>So far I have managed to connected to the repository, pulled it and show all u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,070 | git | # Get changed files using gitpython
I want to get a list of changed files of the current git-repo. The files, that are normally listed under `Changes not staged for commit:` when calling `git status`.
So far I have managed to connected to the repository, pulled it and show all untracked files:
```
from git import Re... | ```
for item in repo.index.diff(None):
print(item.a_path)
```
or to get just the list:
```
changedFiles = [item.a_path for item in repo.index.diff(None)]
```
`repo.index.diff()` returns `git.diff.Diffable` described in <http://gitpython.readthedocs.io/en/stable/reference.html#module-git.diff>
So the function ca... |
11855517 | git rm file name with space | 32 | 2012-08-07 23:26:25 | <p>I tried merging with the command line for a project in Xcode and I think a file needs to be removed. It is a file that exists in the branch I was merging from, but not the branch I was merging into. The problem is it has a space in the name:</p>
<pre><code>TestService/TestService copy-Info.plist
</code></pre>
<p... | 35,128 | 980,962 | 2013-04-12 15:19:28 | 11,855,549 | 58 | 2012-08-07 23:29:32 | 827,263 | 2013-04-12 15:19:28 | https://stackoverflow.com/q/11855517 | https://stackoverflow.com/a/11855549 | <p>The same way you'd use <code>rm</code> to remove such a file: quote the name:</p>
<pre><code>git rm "TestService/TestService copy-Info.plist"
</code></pre>
<p>or</p>
<pre><code>git rm 'TestService/TestService copy-Info.plist'
</code></pre>
<p>or</p>
<pre><code>git rm TestService/TestService\ copy-Info.plist
</c... | <p>The same way you'd use <code>rm</code> to remove such a file: quote the name:</p> <pre><code>git rm "TestService/TestService copy-Info.plist" </code></pre> <p>or</p> <pre><code>git rm 'TestService/TestService copy-Info.plist' </code></pre> <p>or</p> <pre><code>git rm TestService/TestService\ copy-Info.plist </c... | 119 | git | <h1>git rm file name with space</h1>
<p>I tried merging with the command line for a project in Xcode and I think a file needs to be removed. It is a file that exists in the branch I was merging from, but not the branch I was merging into. The problem is it has a space in the name:</p>
<pre><code>TestService/TestServ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,071 | git | # git rm file name with space
I tried merging with the command line for a project in Xcode and I think a file needs to be removed. It is a file that exists in the branch I was merging from, but not the branch I was merging into. The problem is it has a space in the name:
```
TestService/TestService copy-Info.plist
``... | The same way you'd use `rm` to remove such a file: quote the name:
```
git rm "TestService/TestService copy-Info.plist"
```
or
```
git rm 'TestService/TestService copy-Info.plist'
```
or
```
git rm TestService/TestService\ copy-Info.plist
```
Depending on your shell and the names of other files, tab completion ma... |
4133138 | how do I correct the error: pathspec message when committing in git? | 32 | 2010-11-09 11:28:46 | <p>I am trying to commit changes with the command <code>git commit "commit message"</code> to a local branch, but am getting the following message:</p>
<pre><code>error: pathspec 'commit message' did not match any file(s) known to git.
</code></pre>
| 29,378 | 445,126 | 2021-02-11 17:39:04 | 4,133,271 | 58 | 2010-11-09 11:43:23 | 126,042 | 2010-11-09 11:43:23 | https://stackoverflow.com/q/4133138 | https://stackoverflow.com/a/4133271 | <p>It's <code>git commit -m "commit message"</code>. You're missing the <code>-m</code> flag.</p>
| <p>It's <code>git commit -m "commit message"</code>. You're missing the <code>-m</code> flag.</p> | 119 | git | <h1>how do I correct the error: pathspec message when committing in git?</h1>
<p>I am trying to commit changes with the command <code>git commit "commit message"</code> to a local branch, but am getting the following message:</p>
<pre><code>error: pathspec 'commit message' did not match any file(s) known to git.
</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,072 | git | # how do I correct the error: pathspec message when committing in git?
I am trying to commit changes with the command `git commit "commit message"` to a local branch, but am getting the following message:
```
error: pathspec 'commit message' did not match any file(s) known to git.
``` | It's `git commit -m "commit message"`. You're missing the `-m` flag. |
22005259 | git push error: RPC failed; result=56, HTTP code = 0 | 29 | 2014-02-25 05:19:03 | <p>Detailed info:</p>
<pre><code>Username for 'https://xiangwan.visualstudio.com': xiangwan
Password for 'https://xiangwan@xiangwan.visualstudio.com':
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (58/58), done.
Writing objects: 100% (63/63), 20.67 KiB | 0 bytes/s, done... | 32,478 | 3,349,657 | 2014-02-25 05:50:00 | 22,005,335 | 58 | 2014-02-25 05:24:33 | 1,853,299 | 2014-02-25 05:50:00 | https://stackoverflow.com/q/22005259 | https://stackoverflow.com/a/22005335 | <p>The problem is most likely because your git buffer is too low.</p>
<p>You will need to increase Git’s HTTP buffer by setting.</p>
<pre><code>git config --global http.postBuffer 2M
</code></pre>
| <p>The problem is most likely because your git buffer is too low.</p> <p>You will need to increase Git’s HTTP buffer by setting.</p> <pre><code>git config --global http.postBuffer 2M </code></pre> | 119 | git | <h1>git push error: RPC failed; result=56, HTTP code = 0</h1>
<p>Detailed info:</p>
<pre><code>Username for 'https://xiangwan.visualstudio.com': xiangwan
Password for 'https://xiangwan@xiangwan.visualstudio.com':
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (58/58), do... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,073 | git | # git push error: RPC failed; result=56, HTTP code = 0
Detailed info:
```
Username for 'https://xiangwan.visualstudio.com': xiangwan
Password for 'https://xiangwan@xiangwan.visualstudio.com':
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (58/58), done.
Writing objects:... | The problem is most likely because your git buffer is too low.
You will need to increase Git’s HTTP buffer by setting.
```
git config --global http.postBuffer 2M
``` |
11482180 | Reset without losing already committed files | 29 | 2012-07-14 08:20:49 | <p>When I accidentally committed a file to the wrong branch, I normally use <code>git reset --hard HEAD~1</code>. However, using this method I generally lose all the files committed. Is there a way to reset a commit, without losing the edited files?</p>
| 29,682 | 1,183,106 | 2019-10-15 06:02:56 | 11,482,202 | 58 | 2012-07-14 08:23:42 | 887,836 | 2016-11-22 08:29:39 | https://stackoverflow.com/q/11482180 | https://stackoverflow.com/a/11482202 | <p>do not use <code>--hard</code> use <code>--soft</code> instead.</p>
<p>Thus if you want to remove your latest commit you'd do:</p>
<p><code>git reset --soft HEAD^
</code></p>
| <p>do not use <code>--hard</code> use <code>--soft</code> instead.</p> <p>Thus if you want to remove your latest commit you'd do:</p> <p><code>git reset --soft HEAD^ </code></p> | 119, 51381 | git, git-reset | <h1>Reset without losing already committed files</h1>
<p>When I accidentally committed a file to the wrong branch, I normally use <code>git reset --hard HEAD~1</code>. However, using this method I generally lose all the files committed. Is there a way to reset a commit, without losing the edited files?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,074 | git | # Reset without losing already committed files
When I accidentally committed a file to the wrong branch, I normally use `git reset --hard HEAD~1`. However, using this method I generally lose all the files committed. Is there a way to reset a commit, without losing the edited files? | do not use `--hard` use `--soft` instead.
Thus if you want to remove your latest commit you'd do:
`git reset --soft HEAD^` |
41379997 | Force-delete a branch in Git? | 24 | 2016-12-29 12:44:20 | <p>I have created a branch <code>test</code> in my Git repository. Now I have no use for it. How can I force-delete this branch?</p>
<p>I tried the following command:</p>
<pre><code>git branch -d test
</code></pre>
<p>But it returns an error.</p>
| 65,058 | 6,617,433 | 2018-07-19 17:07:31 | 41,380,025 | 58 | 2016-12-29 12:46:24 | 6,006,461 | 2016-12-29 15:06:40 | https://stackoverflow.com/q/41379997 | https://stackoverflow.com/a/41380025 | <p>You can force-delete a branch with the following command:</p>
<pre><code>git branch -D test
</code></pre>
<p>By replacing <code>-d</code> with <code>-D</code>, you are telling git to delete the branch and that you don't care to merge changes from that branch.</p>
<p>Be careful, you can lose data.</p>
| <p>You can force-delete a branch with the following command:</p> <pre><code>git branch -D test </code></pre> <p>By replacing <code>-d</code> with <code>-D</code>, you are telling git to delete the branch and that you don't care to merge changes from that branch.</p> <p>Be careful, you can lose data.</p> | 119, 76220 | git, git-branch | <h1>Force-delete a branch in Git?</h1>
<p>I have created a branch <code>test</code> in my Git repository. Now I have no use for it. How can I force-delete this branch?</p>
<p>I tried the following command:</p>
<pre><code>git branch -d test
</code></pre>
<p>But it returns an error.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,076 | git | # Force-delete a branch in Git?
I have created a branch `test` in my Git repository. Now I have no use for it. How can I force-delete this branch?
I tried the following command:
```
git branch -d test
```
But it returns an error. | You can force-delete a branch with the following command:
```
git branch -D test
```
By replacing `-d` with `-D`, you are telling git to delete the branch and that you don't care to merge changes from that branch.
Be careful, you can lose data. |
9966191 | homebrew update irritating error message | 22 | 2012-04-01 16:44:19 | <p>When I do ...</p>
<pre><code>brew update
</code></pre>
<p>I keep getting this error message ...</p>
<pre><code>From https://github.com/mxcl/homebrew
25c0495..af1d9f1 master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
Library/Formula/postgresql.r... | 5,392 | 910,182 | 2012-05-22 01:14:13 | 10,693,539 | 58 | 2012-05-21 22:33:06 | 347,353 | 2012-05-22 01:14:13 | https://stackoverflow.com/q/9966191 | https://stackoverflow.com/a/10693539 | <p></p>
<pre class="lang-bsh prettyprint-override"><code>cd `brew --repository`
git reset --hard HEAD
brew update
</code></pre>
<p>Sometimes the above doesn't work. In that case, do</p>
<pre class="lang-bsh prettyprint-override"><code>cd `brew --repository`
git reset --hard origin/master
brew update
</code></pre>
| <p></p> <pre class="lang-bsh prettyprint-override"><code>cd `brew --repository` git reset --hard HEAD brew update </code></pre> <p>Sometimes the above doesn't work. In that case, do</p> <pre class="lang-bsh prettyprint-override"><code>cd `brew --repository` git reset --hard origin/master brew update </code></pre> | 119, 256, 1067 | git, homebrew, postgresql | <h1>homebrew update irritating error message</h1>
<p>When I do ...</p>
<pre><code>brew update
</code></pre>
<p>I keep getting this error message ...</p>
<pre><code>From https://github.com/mxcl/homebrew
25c0495..af1d9f1 master -> origin/master
error: Your local changes to the following files would be overwrit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,077 | git | # homebrew update irritating error message
When I do ...
```
brew update
```
I keep getting this error message ...
```
From https://github.com/mxcl/homebrew
25c0495..af1d9f1 master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
Library/Formula/postgresq... | ```
cd `brew --repository`
git reset --hard HEAD
brew update
```
Sometimes the above doesn't work. In that case, do
```
cd `brew --repository`
git reset --hard origin/master
brew update
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.