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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3594894 | How to avoid "Merge branch 'name_of_branch' in commit messages? | 43 | 2010-08-29 13:18:44 | <p>I remember that for about a year ago I did some merges that resulted in the commit messages being <code>Merge branch 'Name_of_branch'</code> on the remote repository.</p>
<p>From what I remember it would happen if I rebased all commits in a branch and then merged it to master and then pushed to remote repository.</... | 39,531 | 256,439 | 2018-11-21 01:05:53 | 3,595,134 | 45 | 2010-08-29 14:34:25 | 119,963 | 2010-08-29 14:34:25 | https://stackoverflow.com/q/3594894 | https://stackoverflow.com/a/3595134 | <p>That's a default merge commit message. It doesn't take anything special to get it - just do any nontrivial merge into master:</p>
<pre><code>- o - o - X (master)
\ /
o - o (topic)
</code></pre>
<p>The default commit message for commit X will be "Merge branch 'topic'". If you merge into a branch other th... | <p>That's a default merge commit message. It doesn't take anything special to get it - just do any nontrivial merge into master:</p> <pre><code>- o - o - X (master) \ / o - o (topic) </code></pre> <p>The default commit message for commit X will be "Merge branch 'topic'". If you merge into a branch other th... | 119 | git | <h1>How to avoid "Merge branch 'name_of_branch' in commit messages?</h1>
<p>I remember that for about a year ago I did some merges that resulted in the commit messages being <code>Merge branch 'Name_of_branch'</code> on the remote repository.</p>
<p>From what I remember it would happen if I rebased all commits in a br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,660 | git | # How to avoid "Merge branch 'name_of_branch' in commit messages?
I remember that for about a year ago I did some merges that resulted in the commit messages being `Merge branch 'Name_of_branch'` on the remote repository.
From what I remember it would happen if I rebased all commits in a branch and then merged it to ... | That's a default merge commit message. It doesn't take anything special to get it - just do any nontrivial merge into master:
```
- o - o - X (master)
\ /
o - o (topic)
```
The default commit message for commit X will be "Merge branch 'topic'". If you merge into a branch other than master, the default mess... |
35591887 | How to undo 'git fetch' | 42 | 2016-02-24 02:00:14 | <p>I just added additional <code>remote A</code> to my <code>repo B</code> and then run <code>git fetch A</code>. How can I undo the fetch? If I just remove <code>remote A</code>: <code>git remote remove A1</code> would it undo fetch?</p>
<h3>UPDATE:</h3>
<pre><code>$ git remote add A path/to/A
$ git fetch A
</code><... | 78,405 | 2,926,340 | 2023-09-05 01:00:13 | 35,604,024 | 45 | 2016-02-24 13:50:28 | 5,508,756 | 2016-02-24 13:50:28 | https://stackoverflow.com/q/35591887 | https://stackoverflow.com/a/35604024 | <p>You can undo <em>all</em> fetches from remote <code>A</code> simply by removing this remote:</p>
<pre><code>git remote remove A
</code></pre>
<p>Now just add it again and fetch only single branch:</p>
<pre><code>git remote add A <path/to/repository>
git fetch A <name of branch>
</code></pre>
| <p>You can undo <em>all</em> fetches from remote <code>A</code> simply by removing this remote:</p> <pre><code>git remote remove A </code></pre> <p>Now just add it again and fetch only single branch:</p> <pre><code>git remote add A <path/to/repository> git fetch A <name of branch> </code></pre> | 119, 33720, 41346 | git, git-fetch, git-remote | <h1>How to undo 'git fetch'</h1>
<p>I just added additional <code>remote A</code> to my <code>repo B</code> and then run <code>git fetch A</code>. How can I undo the fetch? If I just remove <code>remote A</code>: <code>git remote remove A1</code> would it undo fetch?</p>
<h3>UPDATE:</h3>
<pre><code>$ git remote add A... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,662 | git | # How to undo 'git fetch'
I just added additional `remote A` to my `repo B` and then run `git fetch A`. How can I undo the fetch? If I just remove `remote A`: `git remote remove A1` would it undo fetch?
### UPDATE:
```
$ git remote add A path/to/A
$ git fetch A
```
The above are commands I run so in result I got al... | You can undo *all* fetches from remote `A` simply by removing this remote:
```
git remote remove A
```
Now just add it again and fetch only single branch:
```
git remote add A <path/to/repository>
git fetch A <name of branch>
``` |
13055685 | How to get total additions and deletions on a given branch for an given author in git | 42 | 2012-10-24 18:44:48 | <p>Is there a way in git to count the total deletions and additions for a given user on a given branch? Something like that is on github, in the graph section there is a chart that shows you the total additions and deletions but only on the master branch... i think if they did it this mus be possible in git also, so, d... | 21,512 | 851,313 | 2022-12-27 14:05:34 | 13,056,003 | 45 | 2012-10-24 19:05:18 | 95,706 | 2012-10-25 11:31:57 | https://stackoverflow.com/q/13055685 | https://stackoverflow.com/a/13056003 | <p>I don't think Git has any built-in command that does this. But with the help of some other standard utilities, it can be done. Here is an example that filters Git's log output through awk to get the summary of total insertions and deletions:</p>
<pre><code>git log --author=$USER --shortstat $BRANCH | \
awk '/^ [0-9... | <p>I don't think Git has any built-in command that does this. But with the help of some other standard utilities, it can be done. Here is an example that filters Git's log output through awk to get the summary of total insertions and deletions:</p> <pre><code>git log --author=$USER --shortstat $BRANCH | \ awk '/^ [0-9... | 119 | git | <h1>How to get total additions and deletions on a given branch for an given author in git</h1>
<p>Is there a way in git to count the total deletions and additions for a given user on a given branch? Something like that is on github, in the graph section there is a chart that shows you the total additions and deletions ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,663 | git | # How to get total additions and deletions on a given branch for an given author in git
Is there a way in git to count the total deletions and additions for a given user on a given branch? Something like that is on github, in the graph section there is a chart that shows you the total additions and deletions but only ... | I don't think Git has any built-in command that does this. But with the help of some other standard utilities, it can be done. Here is an example that filters Git's log output through awk to get the summary of total insertions and deletions:
```
git log --author=$USER --shortstat $BRANCH | \
awk '/^ [0-9]/ { f += $1; ... |
11892517 | git fetch vs. git fetch origin master have different effects on tracking branch | 40 | 2012-08-09 21:52:53 | <p>This is mostly of the nature of a curiosity as I'm trying to get familiar with Git. I have looked at the documentation for 'git fetch' but I don't see an obvious explanation for the below. Thanks in advance, and apologies if this is howlingly obvious.</p>
<p>1) From a central repository, say GitHub, I clone a repo... | 105,204 | 571,575 | 2019-08-27 07:46:17 | 11,896,392 | 45 | 2012-08-10 06:14:15 | 6,309 | 2016-08-04 16:56:34 | https://stackoverflow.com/q/11892517 | https://stackoverflow.com/a/11896392 | <p>If your branch has an associated <a href="https://stackoverflow.com/a/4697054/6309">remote tracking branch</a> that means its configuration is like:</p>
<pre><code>git config branch.[branch-name].remote [remote-name]
git config branch.[branch-name].merge [remote-master]
</code></pre>
<p>The key part of <strong><a ... | <p>If your branch has an associated <a href="https://stackoverflow.com/a/4697054/6309">remote tracking branch</a> that means its configuration is like:</p> <pre><code>git config branch.[branch-name].remote [remote-name] git config branch.[branch-name].merge [remote-master] </code></pre> <p>The key part of <strong><a ... | 119, 1879, 33720 | branch, git, git-fetch | <h1>git fetch vs. git fetch origin master have different effects on tracking branch</h1>
<p>This is mostly of the nature of a curiosity as I'm trying to get familiar with Git. I have looked at the documentation for 'git fetch' but I don't see an obvious explanation for the below. Thanks in advance, and apologies if th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,665 | git | # git fetch vs. git fetch origin master have different effects on tracking branch
This is mostly of the nature of a curiosity as I'm trying to get familiar with Git. I have looked at the documentation for 'git fetch' but I don't see an obvious explanation for the below. Thanks in advance, and apologies if this is howl... | If your branch has an associated [remote tracking branch](https://stackoverflow.com/a/4697054/6309) that means its configuration is like:
```
git config branch.[branch-name].remote [remote-name]
git config branch.[branch-name].merge [remote-master]
```
The key part of **[`git fetch`](http://git-scm.com/docs/git-fetch... |
8964666 | how do I find a list of files committed to a git branch? | 40 | 2012-01-22 21:01:26 | <p>How do I list all the files that I committed to a specific branch? I've committed about 40+ files to a branch, and I need to find the file names because I am trying to debug something, hard to do when I don't remember the file names.</p>
<p><code>git log</code> only gives me a long list of commits but not the actua... | 65,609 | 802,281 | 2024-03-12 14:35:09 | 8,965,167 | 45 | 2012-01-22 22:07:51 | 13,760 | 2012-01-22 22:07:51 | https://stackoverflow.com/q/8964666 | https://stackoverflow.com/a/8965167 | <p>Have you tried git ls-tree?</p>
<pre><code>git ls-tree --name-only -r <branch_name>
</code></pre>
<p>--name-only gives you just the file names.
-r recurses into sub directories.</p>
<p>If you want the name of the sub-directory listed before recursing into it, add -t to the argument list. </p>
| <p>Have you tried git ls-tree?</p> <pre><code>git ls-tree --name-only -r <branch_name> </code></pre> <p>--name-only gives you just the file names. -r recurses into sub directories.</p> <p>If you want the name of the sub-directory listed before recursing into it, add -t to the argument list. </p> | 119, 5597, 6452 | commit, git, git-svn | <h1>how do I find a list of files committed to a git branch?</h1>
<p>How do I list all the files that I committed to a specific branch? I've committed about 40+ files to a branch, and I need to find the file names because I am trying to debug something, hard to do when I don't remember the file names.</p>
<p><code>git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,666 | git | # how do I find a list of files committed to a git branch?
How do I list all the files that I committed to a specific branch? I've committed about 40+ files to a branch, and I need to find the file names because I am trying to debug something, hard to do when I don't remember the file names.
`git log` only gives me a... | Have you tried git ls-tree?
```
git ls-tree --name-only -r <branch_name>
```
--name-only gives you just the file names.
-r recurses into sub directories.
If you want the name of the sub-directory listed before recursing into it, add -t to the argument list. |
6066585 | Stopping a git gc --aggressive, is that a bad thing? | 39 | 2011-05-20 01:28:19 | <p>I am running a <code>git gc --aggressive</code> on a very large repo (apx 100 gb). It's been running since two nights ago, and as of a couple hours, it has been stuck on: "Compressing Objects: 99% (76496/76777)"</p>
<p>If I <kbd>Ctrl</kbd>-<kbd>C</kbd> the process, what are the consequences? Will my repo be unusabl... | 12,516 | 507,058 | 2023-07-29 01:59:30 | 6,066,772 | 45 | 2011-05-20 02:06:02 | 719,673 | 2023-07-29 01:59:30 | https://stackoverflow.com/q/6066585 | https://stackoverflow.com/a/6066772 | <p>git is supposed to be always safe from interruptions like this. If you are worried, though, I suggest <kbd>Ctrl</kbd>+<kbd>Z</kbd> and then run a <code>git fsck --full</code> to make sure the system is consistent.</p>
<p>There are a number of git-config variables which might help your git-gc go faster. I use the f... | <p>git is supposed to be always safe from interruptions like this. If you are worried, though, I suggest <kbd>Ctrl</kbd>+<kbd>Z</kbd> and then run a <code>git fsck --full</code> to make sure the system is consistent.</p> <p>There are a number of git-config variables which might help your git-gc go faster. I use the f... | 119, 44929 | git, git-gc | <h1>Stopping a git gc --aggressive, is that a bad thing?</h1>
<p>I am running a <code>git gc --aggressive</code> on a very large repo (apx 100 gb). It's been running since two nights ago, and as of a couple hours, it has been stuck on: "Compressing Objects: 99% (76496/76777)"</p>
<p>If I <kbd>Ctrl</kbd>-<kbd>C</kbd> t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,667 | git | # Stopping a git gc --aggressive, is that a bad thing?
I am running a `git gc --aggressive` on a very large repo (apx 100 gb). It's been running since two nights ago, and as of a couple hours, it has been stuck on: "Compressing Objects: 99% (76496/76777)"
If I `Ctrl`-`C` the process, what are the consequences? Will m... | git is supposed to be always safe from interruptions like this. If you are worried, though, I suggest `Ctrl`+`Z` and then run a `git fsck --full` to make sure the system is consistent.
There are a number of git-config variables which might help your git-gc go faster. I use the following on one particular large repo, b... |
2673431 | git commit message showing file as 'copied' instead of 'modified'. What are the implications? | 37 | 2010-04-20 07:47:33 | <p>strong textgit status shows file as <strong>modified</strong>, however when commiting it shows the file as been <strong>copied</strong> ie:</p>
<p>git status<br>
modified: foo/bar/baz.xml</p>
<p>git commit<br>
copied: bar/foo/baz.xml -> foo/bar/baz.xml</p>
<p>Why is it showing this file as copied if it wa... | 24,437 | 321,061 | 2019-05-20 10:14:21 | 2,673,456 | 45 | 2010-04-20 07:51:58 | 112,968 | 2010-04-20 08:03:12 | https://stackoverflow.com/q/2673431 | https://stackoverflow.com/a/2673456 | <p>git tracks content, not files. if two files are the same (or very much the same) git recognizes them as copied. there shouldn't be any implications from this</p>
<p>in your case both files were identical (100 %), so git has no possibility to know if the file was copied, or just accidentally happened to be the same.... | <p>git tracks content, not files. if two files are the same (or very much the same) git recognizes them as copied. there shouldn't be any implications from this</p> <p>in your case both files were identical (100 %), so git has no possibility to know if the file was copied, or just accidentally happened to be the same.... | 119 | git | <h1>git commit message showing file as 'copied' instead of 'modified'. What are the implications?</h1>
<p>strong textgit status shows file as <strong>modified</strong>, however when commiting it shows the file as been <strong>copied</strong> ie:</p>
<p>git status<br>
modified: foo/bar/baz.xml</p>
<p>git commit<br>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,669 | git | # git commit message showing file as 'copied' instead of 'modified'. What are the implications?
strong textgit status shows file as **modified**, however when commiting it shows the file as been **copied** ie:
git status
modified: foo/bar/baz.xml
git commit
copied: bar/foo/baz.xml -> foo/bar/baz.xml
Why is it s... | git tracks content, not files. if two files are the same (or very much the same) git recognizes them as copied. there shouldn't be any implications from this
in your case both files were identical (100 %), so git has no possibility to know if the file was copied, or just accidentally happened to be the same.
don't wo... |
55246165 | How to SSH a git repository after already cloned with https? | 35 | 2019-03-19 16:49:12 | <p>I have a repository that I have already cloned on my computer using <code>https</code>. I want to set up this repository as <code>ssh</code> so that I don't have to enter in my username and password every time I git push.</p>
<p>Any suggestions on how I can convert this <code>https</code> cloned repository to <code... | 18,381 | 11,069,485 | 2019-03-19 16:59:32 | 55,246,364 | 45 | 2019-03-19 16:59:32 | 574,379 | 2019-03-19 16:59:32 | https://stackoverflow.com/q/55246165 | https://stackoverflow.com/a/55246364 | <p>There is a pretty good documentation from GitHub:<br>
<a href="https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh" rel="noreferrer">https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh</a></p>
<p>In short, this should do i... | <p>There is a pretty good documentation from GitHub:<br> <a href="https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh" rel="noreferrer">https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh</a></p> <p>In short, this should do i... | 119 | git | <h1>How to SSH a git repository after already cloned with https?</h1>
<p>I have a repository that I have already cloned on my computer using <code>https</code>. I want to set up this repository as <code>ssh</code> so that I don't have to enter in my username and password every time I git push.</p>
<p>Any suggestions o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,671 | git | # How to SSH a git repository after already cloned with https?
I have a repository that I have already cloned on my computer using `https`. I want to set up this repository as `ssh` so that I don't have to enter in my username and password every time I git push.
Any suggestions on how I can convert this `https` clone... | There is a pretty good documentation from GitHub:
<https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh>
In short, this should do it:
```
git remote set-url origin user@example.com:PATH/REPOSITORY
``` |
33483716 | Merge or Rebase or Branch Default In Android Studio? What are the differences? | 35 | 2015-11-02 17:46:28 | <p>I read <a href="https://stackoverflow.com/questions/24393148/android-studio-update-project-merge-vs-rebase-vs-branch-default">this</a> but that did not explain Branch default. It would be nice to have a short explanation for all in one post.
thank you</p>
<p><a href="https://i.sstatic.net/M4hAa.jpg" rel="noreferrer... | 20,424 | 4,173,238 | 2015-11-04 09:17:27 | 33,517,862 | 45 | 2015-11-04 09:17:27 | 1,387,190 | 2015-11-04 09:17:27 | https://stackoverflow.com/q/33483716 | https://stackoverflow.com/a/33517862 | <p><strong>Merge:</strong> The result is identical with that of running <code>git fetch ; git merge</code> or <code>git pull</code>.<br/>
<strong>Rebase:</strong> The result is identical with that of running <code>git fetch ; git rebase</code> or <code>git pull --rebase</code>.<br/>
<strong>Branch Default:</strong> Thi... | <p><strong>Merge:</strong> The result is identical with that of running <code>git fetch ; git merge</code> or <code>git pull</code>.<br/> <strong>Rebase:</strong> The result is identical with that of running <code>git fetch ; git rebase</code> or <code>git pull --rebase</code>.<br/> <strong>Branch Default:</strong> Thi... | 119, 1386, 91905 | android, android-studio, git | <h1>Merge or Rebase or Branch Default In Android Studio? What are the differences?</h1>
<p>I read <a href="https://stackoverflow.com/questions/24393148/android-studio-update-project-merge-vs-rebase-vs-branch-default">this</a> but that did not explain Branch default. It would be nice to have a short explanation for all ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,672 | git | # Merge or Rebase or Branch Default In Android Studio? What are the differences?
I read [this](https://stackoverflow.com/questions/24393148/android-studio-update-project-merge-vs-rebase-vs-branch-default) but that did not explain Branch default. It would be nice to have a short explanation for all in one post.
thank y... | **Merge:** The result is identical with that of running `git fetch ; git merge` or `git pull`.
**Rebase:** The result is identical with that of running `git fetch ; git rebase` or `git pull --rebase`.
**Branch Default:** This option is to choose the default command for the branch applied. The default command is spe... |
22666606 | How to force Git to commit a file if it is recognized as unchanged | 34 | 2014-03-26 15:59:40 | <p>I have 2 binary files, which have</p>
<ul>
<li>exactly same size</li>
<li>exactly same modification date</li>
<li>exactly same creation date</li>
</ul>
<p>but</p>
<ul>
<li>different content</li>
</ul>
<p>If I replace one file with the other,
git does not recognize this file as changed.</p>
<p>Filesystem: NTFS,... | 39,609 | 1,826,281 | 2014-03-26 18:45:46 | 22,670,154 | 45 | 2014-03-26 18:37:26 | 3,426,575 | 2014-03-26 18:37:26 | https://stackoverflow.com/q/22666606 | https://stackoverflow.com/a/22670154 | <p>You could always do</p>
<pre><code>git rm --cached <file>
git add <file>
</code></pre>
<p>This should put the new file into the index regardless of what was previously there.</p>
| <p>You could always do</p> <pre><code>git rm --cached <file> git add <file> </code></pre> <p>This should put the new file into the index regardless of what was previously there.</p> | 119 | git | <h1>How to force Git to commit a file if it is recognized as unchanged</h1>
<p>I have 2 binary files, which have</p>
<ul>
<li>exactly same size</li>
<li>exactly same modification date</li>
<li>exactly same creation date</li>
</ul>
<p>but</p>
<ul>
<li>different content</li>
</ul>
<p>If I replace one file with the ot... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,674 | git | # How to force Git to commit a file if it is recognized as unchanged
I have 2 binary files, which have
- exactly same size
- exactly same modification date
- exactly same creation date
but
- different content
If I replace one file with the other,
git does not recognize this file as changed.
Filesystem: NTFS, OS: ... | You could always do
```
git rm --cached <file>
git add <file>
```
This should put the new file into the index regardless of what was previously there. |
17792588 | Composer says Git not found | 34 | 2013-07-22 16:20:15 | <p>When installing dependencies via <code>"composer install"</code>, I'm getting error:</p>
<blockquote>
<p>Installing doctrine/lexer (dev-master bc0e1f0) Cloning
bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94
[RuntimeException]
<strong>Failed to clone</strong> <a href="http://github.com/doctrine/lexer.git" rel="n... | 129,186 | 2,545,994 | 2021-07-05 07:19:50 | 17,794,382 | 45 | 2013-07-22 18:06:28 | 2,545,994 | 2018-01-23 15:42:52 | https://stackoverflow.com/q/17792588 | https://stackoverflow.com/a/17794382 | <p>Using <code>--prefer-dist</code> worked:</p>
<pre><code>composer install --prefer-dist
</code></pre>
<p>to force <code>dist</code> part, which @ivoba mentioned; it seems default switch which uses <code>git</code> is <code>--prefer-source</code>.</p>
| <p>Using <code>--prefer-dist</code> worked:</p> <pre><code>composer install --prefer-dist </code></pre> <p>to force <code>dist</code> part, which @ivoba mentioned; it seems default switch which uses <code>git</code> is <code>--prefer-source</code>.</p> | 119, 78546 | composer-php, git | <h1>Composer says Git not found</h1>
<p>When installing dependencies via <code>"composer install"</code>, I'm getting error:</p>
<blockquote>
<p>Installing doctrine/lexer (dev-master bc0e1f0) Cloning
bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94
[RuntimeException]
<strong>Failed to clone</strong> <a href="http://... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,675 | git | # Composer says Git not found
When installing dependencies via `"composer install"`, I'm getting error:
> Installing doctrine/lexer (dev-master bc0e1f0) Cloning
> bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94
> [RuntimeException]
> **Failed to clone** <http://github.com/doctrine/lexer.git>, **git was not
> found**, check ... | Using `--prefer-dist` worked:
```
composer install --prefer-dist
```
to force `dist` part, which @ivoba mentioned; it seems default switch which uses `git` is `--prefer-source`. |
6764465 | Remove an old Git commit from a branch without using a reverse patch? | 34 | 2011-07-20 15:30:53 | <p>I have a master branch like this..</p>
<pre><code>A -- B -- C -- D -- E -- HEAD
</code></pre>
<p>Is there any command that remove one of a old commit and retain the others, say commit C?</p>
<p>finally it becomes like this</p>
<pre><code>A -- B -- D -- E -- HEAD
</code></pre>
<p>I know that we can use a reverse... | 32,477 | 514,316 | 2015-10-16 04:33:59 | 6,764,519 | 45 | 2011-07-20 15:34:21 | 385,478 | 2011-07-20 15:34:21 | https://stackoverflow.com/q/6764465 | https://stackoverflow.com/a/6764519 | <p>Use interactive rebase. For example, to go back 5 commits:</p>
<pre><code>git rebase -i HEAD~5
</code></pre>
<p>Then in the editor which pops up, delete the line containing the commit you want to remove.</p>
| <p>Use interactive rebase. For example, to go back 5 commits:</p> <pre><code>git rebase -i HEAD~5 </code></pre> <p>Then in the editor which pops up, delete the line containing the commit you want to remove.</p> | 119, 29934 | git, git-rebase | <h1>Remove an old Git commit from a branch without using a reverse patch?</h1>
<p>I have a master branch like this..</p>
<pre><code>A -- B -- C -- D -- E -- HEAD
</code></pre>
<p>Is there any command that remove one of a old commit and retain the others, say commit C?</p>
<p>finally it becomes like this</p>
<pre><c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,677 | git | # Remove an old Git commit from a branch without using a reverse patch?
I have a master branch like this..
```
A -- B -- C -- D -- E -- HEAD
```
Is there any command that remove one of a old commit and retain the others, say commit C?
finally it becomes like this
```
A -- B -- D -- E -- HEAD
```
I know that we ca... | Use interactive rebase. For example, to go back 5 commits:
```
git rebase -i HEAD~5
```
Then in the editor which pops up, delete the line containing the commit you want to remove. |
5671387 | Git merging theirs steps | 34 | 2011-04-15 01:01:32 | <p>I am dealing with quite a few binary files generated by a program. Auto merging doesn't work well for these files. What I'd like to do when merging, is quite literally take one copy or the other. It's not ideal, but I think it's the best approach.</p>
<p>Now my understanding, is that if I wanted to take a file from... | 23,883 | 145,567 | 2018-04-23 12:31:21 | 5,671,498 | 45 | 2011-04-15 01:24:06 | 119,963 | 2018-04-23 12:31:21 | https://stackoverflow.com/q/5671387 | https://stackoverflow.com/a/5671498 | <p>If your goal is indeed to keep one version or the other, then yes, you will want to use:</p>
<pre><code>git checkout <--theirs|--ours> <path>
git add <path>
</code></pre>
<p>Of course, as you say, it's not ideal. If there's any way you can avoid this, you should. If you can, try to adopt workflow... | <p>If your goal is indeed to keep one version or the other, then yes, you will want to use:</p> <pre><code>git checkout <--theirs|--ours> <path> git add <path> </code></pre> <p>Of course, as you say, it's not ideal. If there's any way you can avoid this, you should. If you can, try to adopt workflow... | 119, 717 | git, merge | <h1>Git merging theirs steps</h1>
<p>I am dealing with quite a few binary files generated by a program. Auto merging doesn't work well for these files. What I'd like to do when merging, is quite literally take one copy or the other. It's not ideal, but I think it's the best approach.</p>
<p>Now my understanding, is th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,678 | git | # Git merging theirs steps
I am dealing with quite a few binary files generated by a program. Auto merging doesn't work well for these files. What I'd like to do when merging, is quite literally take one copy or the other. It's not ideal, but I think it's the best approach.
Now my understanding, is that if I wanted t... | If your goal is indeed to keep one version or the other, then yes, you will want to use:
```
git checkout <--theirs|--ours> <path>
git add <path>
```
Of course, as you say, it's not ideal. If there's any way you can avoid this, you should. If you can, try to adopt workflow habits which avoid changing those files on d... |
25265528 | How do I swap the order of two parents of a Git commit? | 33 | 2014-08-12 13:26:58 | <p>A merge commit is a commit with at least two parents. These parents are in specific order.</p>
<p>If I'm currently on the branch <code>master</code>, and I merge in the branch <code>feature</code>, I create a new commit with its first parent being the commit from <code>master</code>, and the second commit being the... | 5,392 | 247,696 | 2019-06-20 00:47:54 | 36,528,357 | 45 | 2016-04-10 10:05:52 | 180,513 | 2016-04-10 10:05:52 | https://stackoverflow.com/q/25265528 | https://stackoverflow.com/a/36528357 | <p>Actualy, there's a really cool command I learned recently that will do exactly what you want:</p>
<pre><code>git commit-tree -p HEAD^2 -p HEAD^1 -m "Commit message" "HEAD^{tree}"
</code></pre>
<p>This will create a new commit based on what is currently HEAD, but pretend that it's parents were HEAD^2,HEAD^1 (note ... | <p>Actualy, there's a really cool command I learned recently that will do exactly what you want:</p> <pre><code>git commit-tree -p HEAD^2 -p HEAD^1 -m "Commit message" "HEAD^{tree}" </code></pre> <p>This will create a new commit based on what is currently HEAD, but pretend that it's parents were HEAD^2,HEAD^1 (note ... | 119 | git | <h1>How do I swap the order of two parents of a Git commit?</h1>
<p>A merge commit is a commit with at least two parents. These parents are in specific order.</p>
<p>If I'm currently on the branch <code>master</code>, and I merge in the branch <code>feature</code>, I create a new commit with its first parent being the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,680 | git | # How do I swap the order of two parents of a Git commit?
A merge commit is a commit with at least two parents. These parents are in specific order.
If I'm currently on the branch `master`, and I merge in the branch `feature`, I create a new commit with its first parent being the commit from `master`, and the second ... | Actualy, there's a really cool command I learned recently that will do exactly what you want:
```
git commit-tree -p HEAD^2 -p HEAD^1 -m "Commit message" "HEAD^{tree}"
```
This will create a new commit based on what is currently HEAD, but pretend that it's parents were HEAD^2,HEAD^1 (note this is the reversed order).... |
10978257 | Extending Git functionality | 33 | 2012-06-11 10:19:50 | <p>I was wondering if there was an easy way to extend Git commands. </p>
<p>So I could create commands like:</p>
<pre><code>git my-custom-made-extension --my-options <my-other-arguments>
</code></pre>
<p>In a perfect world, I would be able to do it in any language it pleases me and I would be able to add my cu... | 9,835 | 773,999 | 2014-09-15 19:37:43 | 10,978,296 | 45 | 2012-06-11 10:21:39 | 102,441 | 2013-11-08 08:26:03 | https://stackoverflow.com/q/10978257 | https://stackoverflow.com/a/10978296 | <p>As you can see <a href="https://github.com/git/git/blob/master/git.c">in the source code</a> in <code>execv_dashed_external</code>, If you make the command <code>git-my-custom-made-extension</code>, then git will alias:</p>
<ul>
<li><code>git my-custom-made-extension ...</code> → <code>git-my-custom-made-exten... | <p>As you can see <a href="https://github.com/git/git/blob/master/git.c">in the source code</a> in <code>execv_dashed_external</code>, If you make the command <code>git-my-custom-made-extension</code>, then git will alias:</p> <ul> <li><code>git my-custom-made-extension ...</code> → <code>git-my-custom-made-exten... | 119 | git | <h1>Extending Git functionality</h1>
<p>I was wondering if there was an easy way to extend Git commands. </p>
<p>So I could create commands like:</p>
<pre><code>git my-custom-made-extension --my-options <my-other-arguments>
</code></pre>
<p>In a perfect world, I would be able to do it in any language it please... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,681 | git | # Extending Git functionality
I was wondering if there was an easy way to extend Git commands.
So I could create commands like:
```
git my-custom-made-extension --my-options <my-other-arguments>
```
In a perfect world, I would be able to do it in any language it pleases me and I would be able to add my custom made ... | As you can see [in the source code](https://github.com/git/git/blob/master/git.c) in `execv_dashed_external`, If you make the command `git-my-custom-made-extension`, then git will alias:
- `git my-custom-made-extension ...` → `git-my-custom-made-extension ...`
- `git help my-custom-made-extension` → `man git-my-custom... |
88929 | Using git to grep through a file's previous versions? | 33 | 2008-09-18 00:34:23 | <p>Is there a command that would allow me to check if the string <code>"xyz"</code> was ever in file <code>foo.c</code> in the repository and print which revisions they were found in? </p>
| 5,788 | 4,883 | 2023-07-13 09:49:18 | 89,008 | 45 | 2008-09-18 00:46:52 | 15,203 | 2023-07-13 09:49:18 | https://stackoverflow.com/q/88929 | https://stackoverflow.com/a/89008 | <p>This will print any commits where the diff contains <code>xyz</code></p>
<pre><code>git log -Sxyz foo.c
</code></pre>
<p>Same thing but more readable:</p>
<pre><code>git log -S "xyz" foo.c
</code></pre>
| <p>This will print any commits where the diff contains <code>xyz</code></p> <pre><code>git log -Sxyz foo.c </code></pre> <p>Same thing but more readable:</p> <pre><code>git log -S "xyz" foo.c </code></pre> | 119 | git | <h1>Using git to grep through a file's previous versions?</h1>
<p>Is there a command that would allow me to check if the string <code>"xyz"</code> was ever in file <code>foo.c</code> in the repository and print which revisions they were found in? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,682 | git | # Using git to grep through a file's previous versions?
Is there a command that would allow me to check if the string `"xyz"` was ever in file `foo.c` in the repository and print which revisions they were found in? | This will print any commits where the diff contains `xyz`
```
git log -Sxyz foo.c
```
Same thing but more readable:
```
git log -S "xyz" foo.c
``` |
2531204 | In "git checkout -- files", what does "--" mean? | 32 | 2010-03-27 22:40:27 | <p>Is it the "end of option" I am used to see in bash (and if yes, why do we use it) or is it a Git notation for the Index or the HEAD?</p>
| 4,979 | 9,951 | 2016-08-10 22:01:43 | 2,531,228 | 45 | 2010-03-27 22:50:31 | 61,974 | 2010-03-27 23:01:36 | https://stackoverflow.com/q/2531204 | https://stackoverflow.com/a/2531228 | <p>The <code>--</code> separates the paths from the other options. From the <a href="http://www.ru.kernel.org/pub/software/scm/git/docs/git-checkout.html" rel="noreferrer">documentation</a>:</p>
<pre><code>git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
</code></p... | <p>The <code>--</code> separates the paths from the other options. From the <a href="http://www.ru.kernel.org/pub/software/scm/git/docs/git-checkout.html" rel="noreferrer">documentation</a>:</p> <pre><code>git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>... </code></p... | 119 | git | <h1>In "git checkout -- files", what does "--" mean?</h1>
<p>Is it the "end of option" I am used to see in bash (and if yes, why do we use it) or is it a Git notation for the Index or the HEAD?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,686 | git | # In "git checkout -- files", what does "--" mean?
Is it the "end of option" I am used to see in bash (and if yes, why do we use it) or is it a Git notation for the Index or the HEAD? | The `--` separates the paths from the other options. From the [documentation](http://www.ru.kernel.org/pub/software/scm/git/docs/git-checkout.html):
```
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
```
If this notation didn't exist the following two commands would be ambiguous:... |
12114519 | how to get git log display name of (deleted) branches | 31 | 2012-08-24 18:05:20 | <p>The way I like to see my git logs are with</p>
<pre><code>git log --graph --oneline --all --decorate
</code></pre>
<p>Among other things that I found useful its output, there are the branch names. However, if I delete a branch, then the above does not display them anymore. I mean seeing a bunch of stuff like:</p>
... | 37,834 | 25,891 | 2022-04-12 06:11:54 | 12,114,948 | 45 | 2012-08-24 18:40:43 | 1,198,509 | 2022-04-12 06:11:54 | https://stackoverflow.com/q/12114519 | https://stackoverflow.com/a/12114948 | <p>In Git, branches are simply pointers to a commit that move as new commits are added on that branch. In other words, once the pointer has moved, there is no memory that previous commits were on that branch. This was a hard concept for me to wrap my head around at first. Perhaps it's the name: "branch" ma... | <p>In Git, branches are simply pointers to a commit that move as new commits are added on that branch. In other words, once the pointer has moved, there is no memory that previous commits were on that branch. This was a hard concept for me to wrap my head around at first. Perhaps it's the name: "branch" ma... | 119, 942 | git, logging | <h1>how to get git log display name of (deleted) branches</h1>
<p>The way I like to see my git logs are with</p>
<pre><code>git log --graph --oneline --all --decorate
</code></pre>
<p>Among other things that I found useful its output, there are the branch names. However, if I delete a branch, then the above does not ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,687 | git | # how to get git log display name of (deleted) branches
The way I like to see my git logs are with
```
git log --graph --oneline --all --decorate
```
Among other things that I found useful its output, there are the branch names. However, if I delete a branch, then the above does not display them anymore. I mean seei... | In Git, branches are simply pointers to a commit that move as new commits are added on that branch. In other words, once the pointer has moved, there is no memory that previous commits were on that branch. This was a hard concept for me to wrap my head around at first. Perhaps it's the name: "branch" makes me think of ... |
27951603 | git command to show branch upstream | 30 | 2015-01-14 20:12:58 | <p>git's --help and man page very clearly shows good ways to <em>set</em> upstream for a branch, but I have not found a great way to <em>get</em> the current upstream.</p>
<p>Unfortunately, <code>git branch -v</code> shows only the <em>relationship</em> to the upstream branch, and doesn't tell you what remote the upst... | 29,789 | 3,154,930 | 2025-10-29 16:23:31 | 27,952,587 | 45 | 2015-01-14 21:15:32 | 4,021,077 | 2015-01-14 21:15:32 | https://stackoverflow.com/q/27951603 | https://stackoverflow.com/a/27952587 | <p>A couple of options.</p>
<p>If you pass in the -v parameter twice then git will print the upstream in addition to the relationship </p>
<pre><code>git branch -vv
</code></pre>
<p>You can also use something like </p>
<pre><code>git name-rev @{u}
</code></pre>
<p>Where <code>@{u}</code> is a special git referenc... | <p>A couple of options.</p> <p>If you pass in the -v parameter twice then git will print the upstream in addition to the relationship </p> <pre><code>git branch -vv </code></pre> <p>You can also use something like </p> <pre><code>git name-rev @{u} </code></pre> <p>Where <code>@{u}</code> is a special git referenc... | 119 | git | <h1>git command to show branch upstream</h1>
<p>git's --help and man page very clearly shows good ways to <em>set</em> upstream for a branch, but I have not found a great way to <em>get</em> the current upstream.</p>
<p>Unfortunately, <code>git branch -v</code> shows only the <em>relationship</em> to the upstream bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,688 | git | # git command to show branch upstream
git's --help and man page very clearly shows good ways to *set* upstream for a branch, but I have not found a great way to *get* the current upstream.
Unfortunately, `git branch -v` shows only the *relationship* to the upstream branch, and doesn't tell you what remote the upstrea... | A couple of options.
If you pass in the -v parameter twice then git will print the upstream in addition to the relationship
```
git branch -vv
```
You can also use something like
```
git name-rev @{u}
```
Where `@{u}` is a special git reference for your upstream. |
10712550 | Difference between GNUWin32 and cygwin | 29 | 2012-05-23 02:03:50 | <p>I can't seem to get a handle on the difference between the two. </p>
<p>It seems that one (<code>GNUWin32</code>) is an layer on top of windows (like <code>MSYS</code>) and the<br>
other (cygwin) is something else (?)</p>
<p>What does that mean? When would I use one over the other? Are they both suited for the s... | 21,563 | 465,546 | 2020-11-18 10:23:28 | 10,712,976 | 45 | 2012-05-23 03:16:56 | 1,306,033 | 2015-12-11 02:55:28 | https://stackoverflow.com/q/10712550 | https://stackoverflow.com/a/10712976 | <p><a href="https://www.cygwin.com/" rel="noreferrer">Cygwin</a> is a library that endeavours to make UNIX programs able to compile and run on Windows systems with minimal or no modifications, and a comprehensive set of packaged UNIX tools and applications compiled with this library. It is almost a complete wrapper ar... | <p><a href="https://www.cygwin.com/" rel="noreferrer">Cygwin</a> is a library that endeavours to make UNIX programs able to compile and run on Windows systems with minimal or no modifications, and a comprehensive set of packaged UNIX tools and applications compiled with this library. It is almost a complete wrapper ar... | 58, 1731, 13232, 16888, 21628 | cygwin, gnuwin32, linux, msys, msysgit | <h1>Difference between GNUWin32 and cygwin</h1>
<p>I can't seem to get a handle on the difference between the two. </p>
<p>It seems that one (<code>GNUWin32</code>) is an layer on top of windows (like <code>MSYS</code>) and the<br>
other (cygwin) is something else (?)</p>
<p>What does that mean? When would I use on... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,689 | git | # Difference between GNUWin32 and cygwin
I can't seem to get a handle on the difference between the two.
It seems that one (`GNUWin32`) is an layer on top of windows (like `MSYS`) and the
other (cygwin) is something else (?)
What does that mean? When would I use one over the other? Are they both suited for the sam... | [Cygwin](https://www.cygwin.com/) is a library that endeavours to make UNIX programs able to compile and run on Windows systems with minimal or no modifications, and a comprehensive set of packaged UNIX tools and applications compiled with this library. It is almost a complete wrapper around Windows. It includes an X s... |
12927163 | JGit: Checkout a remote branch | 28 | 2012-10-17 04:32:47 | <p>I'm using JGit to checkout a remote tracking branch.</p>
<pre class="lang-java prettyprint-override"><code>Git binrepository = cloneCmd.call()
CheckoutCommand checkoutCmd = binrepository.checkout();
checkoutCmd.setName( "origin/" + branchName);
checkoutCmd.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRAC... | 29,644 | 1,304,351 | 2019-05-12 09:13:48 | 12,928,374 | 45 | 2012-10-17 06:26:56 | 305,973 | 2012-10-17 19:55:56 | https://stackoverflow.com/q/12927163 | https://stackoverflow.com/a/12928374 | <p>You have to use <code>setCreateBranch</code> to create a branch:</p>
<pre><code>Ref ref = git.checkout().
setCreateBranch(true).
setName("branchName").
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).
setStartPoint("origin/" + branchName).
call();
</code></pre>
... | <p>You have to use <code>setCreateBranch</code> to create a branch:</p> <pre><code>Ref ref = git.checkout(). setCreateBranch(true). setName("branchName"). setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK). setStartPoint("origin/" + branchName). call(); </code></pre> ... | 119, 61058 | git, jgit | <h1>JGit: Checkout a remote branch</h1>
<p>I'm using JGit to checkout a remote tracking branch.</p>
<pre class="lang-java prettyprint-override"><code>Git binrepository = cloneCmd.call()
CheckoutCommand checkoutCmd = binrepository.checkout();
checkoutCmd.setName( "origin/" + branchName);
checkoutCmd.setUpstreamMode(Cr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,691 | git | # JGit: Checkout a remote branch
I'm using JGit to checkout a remote tracking branch.
```
Git binrepository = cloneCmd.call()
CheckoutCommand checkoutCmd = binrepository.checkout();
checkoutCmd.setName( "origin/" + branchName);
checkoutCmd.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK );
checkoutCmd.se... | You have to use `setCreateBranch` to create a branch:
```
Ref ref = git.checkout().
setCreateBranch(true).
setName("branchName").
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).
setStartPoint("origin/" + branchName).
call();
```
Your first command was the equivale... |
37444154 | Git Clone Fails: Server Certificate Verification Failed | 27 | 2016-05-25 17:38:42 | <p>I've been unable to <code>git clone</code> just about any github repo because of this error</p>
<blockquote>
<p>fatal: unable to access 'github_url': server certificate verification failed. CAfile: /home/ubuntu/.ssh/rel3_dodroot_2048.crt CRLFile: none</p>
</blockquote>
<p>I've noticed a few other people have had... | 42,784 | 2,502,333 | 2024-04-08 19:36:31 | 37,488,570 | 45 | 2016-05-27 16:42:27 | 2,502,333 | 2024-04-08 19:36:31 | https://stackoverflow.com/q/37444154 | https://stackoverflow.com/a/37488570 | <p><strong>Community note:</strong> <em>This answer degrades the security of your system. Please read the comments and other answers to find the best solution for the issue you are encountering.</em></p>
<p>Ok, I found the solution...
I guess a script (I hadn't looked at) ran on my computer which ran the line</p>
<pre>... | <p><strong>Community note:</strong> <em>This answer degrades the security of your system. Please read the comments and other answers to find the best solution for the issue you are encountering.</em></p> <p>Ok, I found the solution... I guess a script (I hadn't looked at) ran on my computer which ran the line</p> <pre>... | 58, 119, 386, 6011, 34099 | ca, git, git-clone, linux, ssh | <h1>Git Clone Fails: Server Certificate Verification Failed</h1>
<p>I've been unable to <code>git clone</code> just about any github repo because of this error</p>
<blockquote>
<p>fatal: unable to access 'github_url': server certificate verification failed. CAfile: /home/ubuntu/.ssh/rel3_dodroot_2048.crt CRLFile: no... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,692 | git | # Git Clone Fails: Server Certificate Verification Failed
I've been unable to `git clone` just about any github repo because of this error
> fatal: unable to access 'github_url': server certificate verification failed. CAfile: /home/ubuntu/.ssh/rel3_dodroot_2048.crt CRLFile: none
I've noticed a few other people have... | **Community note:** *This answer degrades the security of your system. Please read the comments and other answers to find the best solution for the issue you are encountering.*
Ok, I found the solution...
I guess a script (I hadn't looked at) ran on my computer which ran the line
```
git config --global http.sslVerif... |
4506758 | Flatten old history in Git | 27 | 2010-12-22 06:37:05 | <p>I have a git project that has run for a while and now I want to throw away the old history, say from start to two years back from now. With throw away I mean replace the many commits within this time with one single commit doing the same.</p>
<p>I checked <code>git rebase -i</code> but this does not remove the other... | 22,838 | 108,238 | 2024-05-08 12:05:13 | 14,234,503 | 45 | 2013-01-09 11:45:39 | 1,923,672 | 2013-01-09 12:00:01 | https://stackoverflow.com/q/4506758 | https://stackoverflow.com/a/14234503 | <p>If you do not really care about the whole history, another simple way to do this would be to take the current branch and create an orphan branch based on this. Then add all files to this branch and make one initial commit (which would lose all history). This can then be pushed to the remote repository.</p>
<p>Assum... | <p>If you do not really care about the whole history, another simple way to do this would be to take the current branch and create an orphan branch based on this. Then add all files to this branch and make one initial commit (which would lose all history). This can then be pushed to the remote repository.</p> <p>Assum... | 119, 29934 | git, git-rebase | <h1>Flatten old history in Git</h1>
<p>I have a git project that has run for a while and now I want to throw away the old history, say from start to two years back from now. With throw away I mean replace the many commits within this time with one single commit doing the same.</p>
<p>I checked <code>git rebase -i</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,694 | git | # Flatten old history in Git
I have a git project that has run for a while and now I want to throw away the old history, say from start to two years back from now. With throw away I mean replace the many commits within this time with one single commit doing the same.
I checked `git rebase -i` but this does not remove... | If you do not really care about the whole history, another simple way to do this would be to take the current branch and create an orphan branch based on this. Then add all files to this branch and make one initial commit (which would lose all history). This can then be pushed to the remote repository.
Assuming you ar... |
44477512 | How to share local changes without git push? | 26 | 2017-06-10 19:57:35 | <p>I'm using <code>git</code> in my project. Sometimes I need to share my modified changes with my colleagues or to different PC, but I don't want to push those changes. He will take my code and modify something and then will push that code.
For now I manually give him file via mail or send in pen drive. I want this to... | 17,851 | 6,527,049 | 2017-06-11 14:59:35 | 44,477,686 | 45 | 2017-06-10 20:19:09 | 6,939,011 | 2017-06-10 20:24:30 | https://stackoverflow.com/q/44477512 | https://stackoverflow.com/a/44477686 | <p>You can save the changes to a patch file with</p>
<pre><code>git diff > /path/to/file.patch
</code></pre>
<p>This supposes that your changes are unstaged. Use <code>git diff --cached</code> if they are staged. I would not commit them, since your colleague is going to do that and you'll run into conflicts otherw... | <p>You can save the changes to a patch file with</p> <pre><code>git diff > /path/to/file.patch </code></pre> <p>This supposes that your changes are unstaged. Use <code>git diff --cached</code> if they are staged. I would not commit them, since your colleague is going to do that and you'll run into conflicts otherw... | 119 | git | <h1>How to share local changes without git push?</h1>
<p>I'm using <code>git</code> in my project. Sometimes I need to share my modified changes with my colleagues or to different PC, but I don't want to push those changes. He will take my code and modify something and then will push that code.
For now I manually give ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,695 | git | # How to share local changes without git push?
I'm using `git` in my project. Sometimes I need to share my modified changes with my colleagues or to different PC, but I don't want to push those changes. He will take my code and modify something and then will push that code.
For now I manually give him file via mail or... | You can save the changes to a patch file with
```
git diff > /path/to/file.patch
```
This supposes that your changes are unstaged. Use `git diff --cached` if they are staged. I would not commit them, since your colleague is going to do that and you'll run into conflicts otherwise.
You can send this file via mail or ... |
8421415 | git: replace folder with the same folder on a different branch | 25 | 2011-12-07 19:37:15 | <p>I tried</p>
<pre><code>git checkout OTHER_BRANCH -- /path/to/folder
</code></pre>
<p>the problem is with files that exist on current branch, but do not exist on the other branch.
I want to delete these.</p>
| 11,770 | 244,005 | 2011-12-07 19:55:56 | 8,421,654 | 45 | 2011-12-07 19:55:56 | 526,535 | 2011-12-07 19:55:56 | https://stackoverflow.com/q/8421415 | https://stackoverflow.com/a/8421654 | <p>I think you want:</p>
<pre><code>git rm -r /path/to/folder
git checkout OTHER_BRANCH -- /path/to/folder
</code></pre>
| <p>I think you want:</p> <pre><code>git rm -r /path/to/folder git checkout OTHER_BRANCH -- /path/to/folder </code></pre> | 119, 37230 | git, git-checkout | <h1>git: replace folder with the same folder on a different branch</h1>
<p>I tried</p>
<pre><code>git checkout OTHER_BRANCH -- /path/to/folder
</code></pre>
<p>the problem is with files that exist on current branch, but do not exist on the other branch.
I want to delete these.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,696 | git | # git: replace folder with the same folder on a different branch
I tried
```
git checkout OTHER_BRANCH -- /path/to/folder
```
the problem is with files that exist on current branch, but do not exist on the other branch.
I want to delete these. | I think you want:
```
git rm -r /path/to/folder
git checkout OTHER_BRANCH -- /path/to/folder
``` |
42132520 | How to obtain the effective git-config values and their source? | 24 | 2017-02-09 09:16:27 | <p>I know <a href="https://stackoverflow.com/a/33720449/321973"><code>git-config</code> doesn't know all possible default values</a>, but is there any way to see not only which config values apply to the current repo but also <em>which</em> config (local, global, system) is responsible?</p>
| 8,325 | 321,973 | 2017-02-09 09:16:27 | 42,132,521 | 45 | 2017-02-09 09:16:27 | 321,973 | 2017-02-09 09:16:27 | https://stackoverflow.com/q/42132520 | https://stackoverflow.com/a/42132521 | <p>Sure, just</p>
<pre><code>git config --list --show-origin
</code></pre>
| <p>Sure, just</p> <pre><code>git config --list --show-origin </code></pre> | 119, 32868 | git, git-config | <h1>How to obtain the effective git-config values and their source?</h1>
<p>I know <a href="https://stackoverflow.com/a/33720449/321973"><code>git-config</code> doesn't know all possible default values</a>, but is there any way to see not only which config values apply to the current repo but also <em>which</em> config... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,697 | git | # How to obtain the effective git-config values and their source?
I know [`git-config` doesn't know all possible default values](https://stackoverflow.com/a/33720449/321973), but is there any way to see not only which config values apply to the current repo but also *which* config (local, global, system) is responsibl... | Sure, just
```
git config --list --show-origin
``` |
18536279 | git subtree: possible to change subtree branch/path in a forked repository? | 24 | 2013-08-30 15:14:12 | <p>In a repository <code>A</code> the folder <code>sub</code> is included as git subtree of the repository <code>S</code> - pointing to <code>master</code> branch.</p>
<p>I have forked repository <code>A</code> into <code>F</code>. Now I want to do one of the following in <code>F</code>:</p>
<ul>
<li>change <code>sub... | 22,074 | 201,863 | 2013-08-30 16:50:36 | 18,537,904 | 45 | 2013-08-30 16:50:36 | 1,863,015 | 2013-08-30 16:50:36 | https://stackoverflow.com/q/18536279 | https://stackoverflow.com/a/18537904 | <p>If you used <code>git subtree</code> (and not <code>git submodule</code>) to create the subtree, then it's just a normal dir. To switch it to another branch, just delete it and recreate the subtree from the new branch. This is:</p>
<pre><code>git rm <subtree>
git commit
git subtree add --prefix=<subtree>... | <p>If you used <code>git subtree</code> (and not <code>git submodule</code>) to create the subtree, then it's just a normal dir. To switch it to another branch, just delete it and recreate the subtree from the new branch. This is:</p> <pre><code>git rm <subtree> git commit git subtree add --prefix=<subtree>... | 119, 717, 7330, 68200 | git, git-subtree, merge, repository | <h1>git subtree: possible to change subtree branch/path in a forked repository?</h1>
<p>In a repository <code>A</code> the folder <code>sub</code> is included as git subtree of the repository <code>S</code> - pointing to <code>master</code> branch.</p>
<p>I have forked repository <code>A</code> into <code>F</code>. No... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,699 | git | # git subtree: possible to change subtree branch/path in a forked repository?
In a repository `A` the folder `sub` is included as git subtree of the repository `S` - pointing to `master` branch.
I have forked repository `A` into `F`. Now I want to do one of the following in `F`:
- change `sub` to use a different bra... | If you used `git subtree` (and not `git submodule`) to create the subtree, then it's just a normal dir. To switch it to another branch, just delete it and recreate the subtree from the new branch. This is:
```
git rm <subtree>
git commit
git subtree add --prefix=<subtree> <repository_url> <branch>
```
That should wor... |
9103396 | How do I edit a previous git commit? | 22 | 2012-01-26 19:05:31 | <p>I just realized that I left out a file that I was supposed to add to a commit like 5 commits back. In the commit message I said that the file was included, and I don't feel like doing a new commit with the text "Oops forgot to add this file in commit #XXXXX"</p>
<p>What's the best way to edit a previous commit so I... | 21,649 | 388,916 | 2019-06-14 02:27:35 | 9,103,397 | 45 | 2012-01-28 00:10:23 | 92,542 | 2014-08-25 17:21:46 | https://stackoverflow.com/q/9103396 | https://stackoverflow.com/a/9103397 | <p>Commit your fix, then use <code>git rebase --interactive</code> to reorder your commits and squash the two commits together. See <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History#Reordering-Commits" rel="noreferrer">the git book</a> for details.</p>
<p>Note that doing this is bad idea if those commits... | <p>Commit your fix, then use <code>git rebase --interactive</code> to reorder your commits and squash the two commits together. See <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History#Reordering-Commits" rel="noreferrer">the git book</a> for details.</p> <p>Note that doing this is bad idea if those commits... | 119 | git | <h1>How do I edit a previous git commit?</h1>
<p>I just realized that I left out a file that I was supposed to add to a commit like 5 commits back. In the commit message I said that the file was included, and I don't feel like doing a new commit with the text "Oops forgot to add this file in commit #XXXXX"</p>
<p>What... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,702 | git | # How do I edit a previous git commit?
I just realized that I left out a file that I was supposed to add to a commit like 5 commits back. In the commit message I said that the file was included, and I don't feel like doing a new commit with the text "Oops forgot to add this file in commit #XXXXX"
What's the best way ... | Commit your fix, then use `git rebase --interactive` to reorder your commits and squash the two commits together. See [the git book](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Reordering-Commits) for details.
Note that doing this is bad idea if those commits have been pushed somewehere already, since you w... |
14336411 | How to get previous tag name? | 21 | 2013-01-15 11:08:09 | <p>There are some tags:</p>
<pre><code>first
second
third
fourth
</code></pre>
<p>I need to get the tag before "second" (third).</p>
| 20,312 | 1,980,028 | 2024-02-02 14:36:22 | 14,337,129 | 45 | 2013-01-15 11:53:12 | 390,363 | 2024-02-02 14:36:22 | https://stackoverflow.com/q/14336411 | https://stackoverflow.com/a/14337129 | <p><code>git describe --tags --abbrev=0 second^</code></p>
| <p><code>git describe --tags --abbrev=0 second^</code></p> | 119 | git | <h1>How to get previous tag name?</h1>
<p>There are some tags:</p>
<pre><code>first
second
third
fourth
</code></pre>
<p>I need to get the tag before "second" (third).</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,704 | git | # How to get previous tag name?
There are some tags:
```
first
second
third
fourth
```
I need to get the tag before "second" (third). | `git describe --tags --abbrev=0 second^` |
1739364 | Move a file/directory but still merge changes easily? | 20 | 2009-11-15 23:57:39 | <p>I've read in various FAQs that <code>git</code> doesn't explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That's great, but will it cope with this situation: a friend's remote repository has a new feature (i18n) involving some new files at <code>debian/po/*.po</... | 26,044 | 6,540 | 2012-05-05 06:43:47 | 1,739,394 | 45 | 2009-11-16 00:06:34 | 57,461 | 2009-11-16 00:06:34 | https://stackoverflow.com/q/1739364 | https://stackoverflow.com/a/1739394 | <p>use <code>git mv</code> and everything will be AOK.</p>
<p>Why not just try it instead of asking? You can always reset easily in git. :)</p>
| <p>use <code>git mv</code> and everything will be AOK.</p> <p>Why not just try it instead of asking? You can always reset easily in git. :)</p> | 119, 717, 4510 | git, merge, rename | <h1>Move a file/directory but still merge changes easily?</h1>
<p>I've read in various FAQs that <code>git</code> doesn't explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That's great, but will it cope with this situation: a friend's remote repository has a new fe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,706 | git | # Move a file/directory but still merge changes easily?
I've read in various FAQs that `git` doesn't explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That's great, but will it cope with this situation: a friend's remote repository has a new feature (i18n) involvi... | use `git mv` and everything will be AOK.
Why not just try it instead of asking? You can always reset easily in git. :) |
23986048 | Gitignore not ignoring certain project.properties | 19 | 2014-06-02 00:59:27 | <p>I am using the github app for windows and mac and I am having a problem with my .gitignore file. </p>
<p>I am trying to ignore the project.properties file that gets generated when switch between my two machines but I simply cannot seem to get it to work. </p>
<p>Below is a copy of my .gitignore, and it seems to be... | 30,188 | 3,658,795 | 2014-06-02 01:50:53 | 23,986,345 | 45 | 2014-06-02 01:50:53 | 3,498,898 | 2014-06-02 01:50:53 | https://stackoverflow.com/q/23986048 | https://stackoverflow.com/a/23986345 | <p>I suspect you added the project.properties line to .gitignore after that file had been committed.</p>
<p>What you need to do is the following:</p>
<p><code>git rm --cached project.properties</code></p>
<p>and for gen/*</p>
<p><code>git rm --cached gen/</code></p>
<p>Then commit.</p>
<p>the --cached option will... | <p>I suspect you added the project.properties line to .gitignore after that file had been committed.</p> <p>What you need to do is the following:</p> <p><code>git rm --cached project.properties</code></p> <p>and for gen/*</p> <p><code>git rm --cached gen/</code></p> <p>Then commit.</p> <p>the --cached option will... | 119, 1386 | android, git | <h1>Gitignore not ignoring certain project.properties</h1>
<p>I am using the github app for windows and mac and I am having a problem with my .gitignore file. </p>
<p>I am trying to ignore the project.properties file that gets generated when switch between my two machines but I simply cannot seem to get it to work. </... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,707 | git | # Gitignore not ignoring certain project.properties
I am using the github app for windows and mac and I am having a problem with my .gitignore file.
I am trying to ignore the project.properties file that gets generated when switch between my two machines but I simply cannot seem to get it to work.
Below is a copy of... | I suspect you added the project.properties line to .gitignore after that file had been committed.
What you need to do is the following:
`git rm --cached project.properties`
and for gen/*
`git rm --cached gen/`
Then commit.
the --cached option will unstage and remove paths only from the index. Working tree files, ... |
13978151 | .gitignore isn't ignoring itself | 19 | 2012-12-20 18:20:21 | <p>I added .gitignore and another directory to my <code>.gitignore</code> file, but when I <code>git status</code>, <code>.gitignore</code> is still showing up!</p>
<p>I feel like I'm missing something really obvious.</p>
| 24,271 | 892,387 | 2012-12-20 20:49:35 | 13,978,331 | 45 | 2012-12-20 18:32:23 | 758,345 | 2012-12-20 20:49:35 | https://stackoverflow.com/q/13978151 | https://stackoverflow.com/a/13978331 | <p>As <a href="https://stackoverflow.com/a/13978226/758345">Carl Norum</a> pointed out, files are not allowed to be tracked in order to be ignored. You will have to call</p>
<pre><code>git rm --cached .gitignore
</code></pre>
<p>in order for it to actually be ignored.</p>
<p>But what you are trying to do is a very b... | <p>As <a href="https://stackoverflow.com/a/13978226/758345">Carl Norum</a> pointed out, files are not allowed to be tracked in order to be ignored. You will have to call</p> <pre><code>git rm --cached .gitignore </code></pre> <p>in order for it to actually be ignored.</p> <p>But what you are trying to do is a very b... | 119, 25056 | git, gitignore | <h1>.gitignore isn't ignoring itself</h1>
<p>I added .gitignore and another directory to my <code>.gitignore</code> file, but when I <code>git status</code>, <code>.gitignore</code> is still showing up!</p>
<p>I feel like I'm missing something really obvious.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,708 | git | # .gitignore isn't ignoring itself
I added .gitignore and another directory to my `.gitignore` file, but when I `git status`, `.gitignore` is still showing up!
I feel like I'm missing something really obvious. | As [Carl Norum](https://stackoverflow.com/a/13978226/758345) pointed out, files are not allowed to be tracked in order to be ignored. You will have to call
```
git rm --cached .gitignore
```
in order for it to actually be ignored.
But what you are trying to do is a very bad idea. The .gitignore file is supposed to b... |
63611460 | git pull --rebase resolve conflicts by keeping local changes | 18 | 2020-08-27 07:49:47 | <p>I rebased to master on my local branch. Meanwhile someone did changes on this branch on remote. I am doing <code>git pull --rebase</code>. I don't understand how git interprets this command when it comes to the naming of <code>current</code> and <code>incoming</code>, as well as <code>ours</code> and <code>theirs</c... | 23,506 | 2,701,428 | 2020-08-27 09:19:10 | 63,612,379 | 45 | 2020-08-27 08:45:08 | 26,396 | 2020-08-27 09:19:10 | https://stackoverflow.com/q/63611460 | https://stackoverflow.com/a/63612379 | <p>The command to favor the changes in <em>your local branch</em> is:</p>
<pre><code>git pull --rebase -X theirs
</code></pre>
<p>The reason why you have to say "theirs" when, intuitively, you'd like to say "ours" is because the meaning of "ours" and "theirs" is swapped during a ... | <p>The command to favor the changes in <em>your local branch</em> is:</p> <pre><code>git pull --rebase -X theirs </code></pre> <p>The reason why you have to say "theirs" when, intuitively, you'd like to say "ours" is because the meaning of "ours" and "theirs" is swapped during a ... | 119, 4860, 8974 | git, pull, rebase | <h1>git pull --rebase resolve conflicts by keeping local changes</h1>
<p>I rebased to master on my local branch. Meanwhile someone did changes on this branch on remote. I am doing <code>git pull --rebase</code>. I don't understand how git interprets this command when it comes to the naming of <code>current</code> and <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,709 | git | # git pull --rebase resolve conflicts by keeping local changes
I rebased to master on my local branch. Meanwhile someone did changes on this branch on remote. I am doing `git pull --rebase`. I don't understand how git interprets this command when it comes to the naming of `current` and `incoming`, as well as `ours` an... | The command to favor the changes in *your local branch* is:
```
git pull --rebase -X theirs
```
The reason why you have to say "theirs" when, intuitively, you'd like to say "ours" is because the meaning of "ours" and "theirs" is swapped during a rebase compared to a merge. Let me explain.
### Ours and Theirs in a Me... |
57377518 | When I try to apply a certain git stash in VS2019, I get an error saying there are uncommitted changes (there aren't) and only one file is applied | 17 | 2019-08-06 13:45:18 | <blockquote>
<p>Git operation failed because there are uncommitted changes. Commit or undo your changes before retrying. See the Output window for details.</p>
</blockquote>
<p>However there are no uncommitted changes. One file that was added is restored from the stash, but that's it - the rest of them are stuck in ... | 10,680 | 1,159,763 | 2024-10-12 22:53:49 | 57,598,815 | 45 | 2019-08-21 20:29:52 | 2,762 | 2019-08-21 20:29:52 | https://stackoverflow.com/q/57377518 | https://stackoverflow.com/a/57598815 | <p>Running <code>git status</code> from my SourceTree terminal cleared up the error in Visual Studio. Even though the output of the command didn't show anything of interest:</p>
<pre><code>$ git status
On branch develop
Your branch is up to date with 'origin/develop'.
nothing to commit, working tree clean
</code></p... | <p>Running <code>git status</code> from my SourceTree terminal cleared up the error in Visual Studio. Even though the output of the command didn't show anything of interest:</p> <pre><code>$ git status On branch develop Your branch is up to date with 'origin/develop'. nothing to commit, working tree clean </code></p... | 119, 33953, 135964 | git, visual-studio, visual-studio-2019 | <h1>When I try to apply a certain git stash in VS2019, I get an error saying there are uncommitted changes (there aren't) and only one file is applied</h1>
<blockquote>
<p>Git operation failed because there are uncommitted changes. Commit or undo your changes before retrying. See the Output window for details.</p>
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,710 | git | # When I try to apply a certain git stash in VS2019, I get an error saying there are uncommitted changes (there aren't) and only one file is applied
> Git operation failed because there are uncommitted changes. Commit or undo your changes before retrying. See the Output window for details.
However there are no uncomm... | Running `git status` from my SourceTree terminal cleared up the error in Visual Studio. Even though the output of the command didn't show anything of interest:
```
$ git status
On branch develop
Your branch is up to date with 'origin/develop'.
nothing to commit, working tree clean
```
...but after doing that, Visual... |
8599200 | Calculate distance given 2 points, latitude and longitude | 17 | 2011-12-22 03:42:20 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/4726031/mysql-latitude-and-longitude-table-setup">MySQL latitude and Longitude table setup</a> </p>
</blockquote>
<p>I know this question has probably been asked many times, I've researched a lot and I need hel... | 31,927 | 854,698 | 2015-09-04 03:59:23 | 8,599,305 | 45 | 2011-12-22 04:03:57 | 1,111,018 | 2015-09-04 03:59:23 | https://stackoverflow.com/q/8599200 | https://stackoverflow.com/a/8599305 | <p>You can use the formula that calculates distances between two points.
For example:</p>
<pre><code>function get_distance($latitude1, $longitude1, $latitude2, $longitude2, $unit = 'Mi') {
$theta = $longitude1 - $longitude2;
$distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) +
... | <p>You can use the formula that calculates distances between two points. For example:</p> <pre><code>function get_distance($latitude1, $longitude1, $latitude2, $longitude2, $unit = 'Mi') { $theta = $longitude1 - $longitude2; $distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + ... | 21, 640, 20301 | latitude-longitude, maps, mysql | <h1>Calculate distance given 2 points, latitude and longitude</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/4726031/mysql-latitude-and-longitude-table-setup">MySQL latitude and Longitude table setup</a> </p>
</blockquote>
<p>I know this question has p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,713 | git | # Calculate distance given 2 points, latitude and longitude
> **Possible Duplicate:**
> [MySQL latitude and Longitude table setup](https://stackoverflow.com/questions/4726031/mysql-latitude-and-longitude-table-setup)
I know this question has probably been asked many times, I've researched a lot and I need help with... | You can use the formula that calculates distances between two points.
For example:
```
function get_distance($latitude1, $longitude1, $latitude2, $longitude2, $unit = 'Mi') {
$theta = $longitude1 - $longitude2;
$distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) +
(cos(deg2rad(... |
3370730 | How do I see changes in the git index? | 17 | 2010-07-30 10:47:03 | <p>Say I do</p>
<pre><code>git add foo.txt
</code></pre>
<p>Now, foo's changes are in the index (I'm assuming git was already tracking that file). Now, when I do git diff, I can't see the changes in foo by doing</p>
<pre><code>git diff
</code></pre>
<p>Are there some extra things that <code>git diff</code> wants be... | 3,091 | 62,163 | 2018-09-11 21:09:43 | 3,370,798 | 45 | 2010-07-30 10:56:33 | 379,894 | 2018-09-11 21:09:43 | https://stackoverflow.com/q/3370730 | https://stackoverflow.com/a/3370798 | <ul>
<li>To show unstaged changes only:</li>
</ul>
<pre><code>git diff
</code></pre>
<ul>
<li>To show the staged/cached changes only:</li>
</ul>
<pre><code>git diff --cached
</code></pre>
<ul>
<li>To show both cached and uncached changes, compare the whole working tree to the named commit (HEAD):</li>
</ul>
... | <ul> <li>To show unstaged changes only:</li> </ul> <pre><code>git diff </code></pre> <ul> <li>To show the staged/cached changes only:</li> </ul> <pre><code>git diff --cached </code></pre> <ul> <li>To show both cached and uncached changes, compare the whole working tree to the named commit (HEAD):</li> </ul> ... | 119 | git | <h1>How do I see changes in the git index?</h1>
<p>Say I do</p>
<pre><code>git add foo.txt
</code></pre>
<p>Now, foo's changes are in the index (I'm assuming git was already tracking that file). Now, when I do git diff, I can't see the changes in foo by doing</p>
<pre><code>git diff
</code></pre>
<p>Are there some ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,714 | git | # How do I see changes in the git index?
Say I do
```
git add foo.txt
```
Now, foo's changes are in the index (I'm assuming git was already tracking that file). Now, when I do git diff, I can't see the changes in foo by doing
```
git diff
```
Are there some extra things that `git diff` wants before it shows me tho... | - To show unstaged changes only:
```
git diff
```
- To show the staged/cached changes only:
```
git diff --cached
```
- To show both cached and uncached changes, compare the whole working tree to the named commit (HEAD):
```
git diff HEAD
``` |
31128783 | How to find the install path of git in Mac or Linux? | 11 | 2015-06-30 02:56:33 | <p>I want to configure the git in jenkins,but I can't find the install path of git in my mac. can you help me ?</p>
| 61,602 | 4,143,849 | 2019-09-23 12:26:48 | 31,128,834 | 45 | 2015-06-30 03:01:43 | 4,905,916 | 2015-06-30 03:12:30 | https://stackoverflow.com/q/31128783 | https://stackoverflow.com/a/31128834 | <p>Execute in terminal</p>
<pre><code>$ which git
</code></pre>
<p>that produces output</p>
<pre><code>/usr/bin/git
</code></pre>
<p>on Linux. If you are looking for where is install directory on MAC and you installed git with brew then</p>
<pre><code>brew info git
</code></pre>
<p>on Debian</p>
<pre><code>dpkg ... | <p>Execute in terminal</p> <pre><code>$ which git </code></pre> <p>that produces output</p> <pre><code>/usr/bin/git </code></pre> <p>on Linux. If you are looking for where is install directory on MAC and you installed git with brew then</p> <pre><code>brew info git </code></pre> <p>on Debian</p> <pre><code>dpkg ... | 58, 119, 369 | git, linux, macos | <h1>How to find the install path of git in Mac or Linux?</h1>
<p>I want to configure the git in jenkins,but I can't find the install path of git in my mac. can you help me ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,715 | git | # How to find the install path of git in Mac or Linux?
I want to configure the git in jenkins,but I can't find the install path of git in my mac. can you help me ? | Execute in terminal
```
$ which git
```
that produces output
```
/usr/bin/git
```
on Linux. If you are looking for where is install directory on MAC and you installed git with brew then
```
brew info git
```
on Debian
```
dpkg -L git
``` |
3178566 | How can I DEFLATE with a command line tool to extract a Git object? | 98 | 2010-07-05 09:54:32 | <p>I'm looking for a command line wrapper for the DEFLATE algorithm.</p>
<p>I have a file (Git blob) that is compressed using DEFLATE, and I want to uncompress it. The gzip command does not seem to have an option to directly use the DEFLATE algorithm, rather than the gzip format.</p>
<p>Ideally I'm looking for a standa... | 88,230 | 62,383 | 2025-07-25 19:19:36 | 3,178,638 | 44 | 2010-07-05 10:08:21 | 199,201 | 2022-06-06 16:29:24 | https://stackoverflow.com/q/3178566 | https://stackoverflow.com/a/3178638 | <p><strong>UPDATE:</strong> Mark Adler noted that git blobs are not raw DEFLATE streams, but zlib streams. These can be unpacked by the <code>pigz</code> tool, which comes pre-packaged in several Linux distributions:</p>
<pre><code>$ cat foo.txt
file foo.txt!
$ git ls-files -s foo.txt
100644 7a79fc625cac65001fb127f46... | <p><strong>UPDATE:</strong> Mark Adler noted that git blobs are not raw DEFLATE streams, but zlib streams. These can be unpacked by the <code>pigz</code> tool, which comes pre-packaged in several Linux distributions:</p> <pre><code>$ cat foo.txt file foo.txt! $ git ls-files -s foo.txt 100644 7a79fc625cac65001fb127f46... | 119, 3883, 12815 | blob, deflate, git | <h1>How can I DEFLATE with a command line tool to extract a Git object?</h1>
<p>I'm looking for a command line wrapper for the DEFLATE algorithm.</p>
<p>I have a file (Git blob) that is compressed using DEFLATE, and I want to uncompress it. The gzip command does not seem to have an option to directly use the DEFLATE al... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,717 | git | # How can I DEFLATE with a command line tool to extract a Git object?
I'm looking for a command line wrapper for the DEFLATE algorithm.
I have a file (Git blob) that is compressed using DEFLATE, and I want to uncompress it. The gzip command does not seem to have an option to directly use the DEFLATE algorithm, rather... | **UPDATE:** Mark Adler noted that git blobs are not raw DEFLATE streams, but zlib streams. These can be unpacked by the `pigz` tool, which comes pre-packaged in several Linux distributions:
```
$ cat foo.txt
file foo.txt!
$ git ls-files -s foo.txt
100644 7a79fc625cac65001fb127f468847ab93b5f8b19 0 foo.txt
$ pigz -... |
65224262 | How do you `git cherry-pick --continue` with `--no-verify`? | 83 | 2020-12-09 20:18:29 | <p>How do you <code>git cherry-pick --continue</code> with <code>--no-verify</code> since <code>--no-verify</code> is not a valid option. <code>git cherry-pick --no-commit --continue</code> does not work since those two parameters are mutually exclusive.</p>
| 39,720 | 242,042 | 2025-06-26 00:18:28 | 65,224,452 | 44 | 2020-12-09 20:33:16 | 1,057,485 | 2020-12-09 20:33:16 | https://stackoverflow.com/q/65224262 | https://stackoverflow.com/a/65224452 | <p><code>--no-verify</code> is an option for the <code>commit</code> command, not <code>cherry-pick</code>.</p>
<p>However what you <em>can</em> do is to use the <code>--no-commit</code> <a href="https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---no-commit" rel="noreferrer">flag</a> for your <... | <p><code>--no-verify</code> is an option for the <code>commit</code> command, not <code>cherry-pick</code>.</p> <p>However what you <em>can</em> do is to use the <code>--no-commit</code> <a href="https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---no-commit" rel="noreferrer">flag</a> for your <... | 119, 43087, 78810 | git, git-cherry-pick, githooks | <h1>How do you `git cherry-pick --continue` with `--no-verify`?</h1>
<p>How do you <code>git cherry-pick --continue</code> with <code>--no-verify</code> since <code>--no-verify</code> is not a valid option. <code>git cherry-pick --no-commit --continue</code> does not work since those two parameters are mutually exclus... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,719 | git | # How do you `git cherry-pick --continue` with `--no-verify`?
How do you `git cherry-pick --continue` with `--no-verify` since `--no-verify` is not a valid option. `git cherry-pick --no-commit --continue` does not work since those two parameters are mutually exclusive. | `--no-verify` is an option for the `commit` command, not `cherry-pick`.
However what you *can* do is to use the `--no-commit` [flag](https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---no-commit) for your `cherry-pick`, then `git commit --no-verify` is fine to conclude the cherry-pick. |
35430584 | How is the Git hash calculated? | 79 | 2016-02-16 10:53:19 | <p>I'm trying to understand how Git calculates the hash of refs.</p>
<pre><code>$ git ls-remote https://github.com/git/git
....
29932f3915935d773dc8d52c292cadd81c81071d refs/tags/v2.4.2
9eabf5b536662000f79978c4d1b6e4eff5c8d785 refs/tags/v2.4.2^{}
....
</code></pre>
<p>Clone the repo locally. Check the <code>re... | 63,086 | 3,257,971 | 2025-04-02 00:42:26 | 35,433,481 | 44 | 2016-02-16 13:07:25 | 6,309 | 2016-02-16 14:14:48 | https://stackoverflow.com/q/35430584 | https://stackoverflow.com/a/35433481 | <p>As described in "<a href="https://gist.github.com/masak/2415865" rel="noreferrer">How is git commit sha1 formed </a>", the formula is:</p>
<pre><code>(printf "<type> %s\0" $(git cat-file <type> <ref> | wc -c); git cat-file <type> <ref>)|sha1sum
</code></pre>
<p>In the case of the <str... | <p>As described in "<a href="https://gist.github.com/masak/2415865" rel="noreferrer">How is git commit sha1 formed </a>", the formula is:</p> <pre><code>(printf "<type> %s\0" $(git cat-file <type> <ref> | wc -c); git cat-file <type> <ref>)|sha1sum </code></pre> <p>In the case of the <str... | 119, 581 | git, hash | <h1>How is the Git hash calculated?</h1>
<p>I'm trying to understand how Git calculates the hash of refs.</p>
<pre><code>$ git ls-remote https://github.com/git/git
....
29932f3915935d773dc8d52c292cadd81c81071d refs/tags/v2.4.2
9eabf5b536662000f79978c4d1b6e4eff5c8d785 refs/tags/v2.4.2^{}
....
</code></pre>
<p>C... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,720 | git | # How is the Git hash calculated?
I'm trying to understand how Git calculates the hash of refs.
```
$ git ls-remote https://github.com/git/git
....
29932f3915935d773dc8d52c292cadd81c81071d refs/tags/v2.4.2
9eabf5b536662000f79978c4d1b6e4eff5c8d785 refs/tags/v2.4.2^{}
....
```
Clone the repo locally. Check th... | As described in "[How is git commit sha1 formed](https://gist.github.com/masak/2415865) ", the formula is:
```
(printf "<type> %s\0" $(git cat-file <type> <ref> | wc -c); git cat-file <type> <ref>)|sha1sum
```
In the case of the **commit** 9eabf5b536662000f79978c4d1b6e4eff5c8d785 (which is `v2.4.2^{}`, and which refe... |
7149740 | Git: list all commits on all remote branches? | 68 | 2011-08-22 15:24:31 | <p>I would like to list all commits on all remote branches in my repository.</p>
<p>I just want the SHA1 for each commit.</p>
| 54,896 | 244,005 | 2023-11-08 23:17:27 | 7,149,811 | 44 | 2011-08-22 15:29:40 | 223,092 | 2011-08-22 15:36:17 | https://stackoverflow.com/q/7149740 | https://stackoverflow.com/a/7149811 | <p>The following should do what you want:</p>
<pre><code>git rev-list --remotes
</code></pre>
<p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html#_options" rel="noreferrer">documentation for the <code>--remotes</code> option</a> says:</p>
<blockquote>
<p>--remotes[=<pattern>]</p>
<p>... | <p>The following should do what you want:</p> <pre><code>git rev-list --remotes </code></pre> <p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html#_options" rel="noreferrer">documentation for the <code>--remotes</code> option</a> says:</p> <blockquote> <p>--remotes[=<pattern>]</p> <p>... | 119 | git | <h1>Git: list all commits on all remote branches?</h1>
<p>I would like to list all commits on all remote branches in my repository.</p>
<p>I just want the SHA1 for each commit.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,722 | git | # Git: list all commits on all remote branches?
I would like to list all commits on all remote branches in my repository.
I just want the SHA1 for each commit. | The following should do what you want:
```
git rev-list --remotes
```
The [documentation for the `--remotes` option](http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html#_options) says:
> --remotes[=<pattern>]
>
> Pretend as if all the refs in refs/remotes are listed on the command line as <commit>. If ... |
20291731 | How to connect to a remote Git repository? | 60 | 2013-11-29 18:43:32 | <p>I am working with a team and we want to use Git (Not with GitHub, we have a private remote machine). We were using SVN until now.
We have a remote machine that works like an SVN repository.
Now, we want to turn this machine into the Git central repository.
By what I have read, what everyone needs to do on their mach... | 605,710 | 2,332,384 | 2022-03-11 18:11:50 | 20,291,778 | 44 | 2013-11-29 18:47:58 | 3,035,334 | 2013-11-29 18:47:58 | https://stackoverflow.com/q/20291731 | https://stackoverflow.com/a/20291778 | <p>Now, if the repository is already existing on a remote machine, and you do not have anything locally, you do git clone instead.</p>
<p>The URL format is simple, it is PROTOCOL:/[user@]remoteMachineAddress/path/to/repository.git</p>
<p>For example, cloning a repository on a machine to which you have SSH access usi... | <p>Now, if the repository is already existing on a remote machine, and you do not have anything locally, you do git clone instead.</p> <p>The URL format is simple, it is PROTOCOL:/[user@]remoteMachineAddress/path/to/repository.git</p> <p>For example, cloning a repository on a machine to which you have SSH access usi... | 119, 7330, 41346 | git, git-remote, repository | <h1>How to connect to a remote Git repository?</h1>
<p>I am working with a team and we want to use Git (Not with GitHub, we have a private remote machine). We were using SVN until now.
We have a remote machine that works like an SVN repository.
Now, we want to turn this machine into the Git central repository.
By what ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,725 | git | # How to connect to a remote Git repository?
I am working with a team and we want to use Git (Not with GitHub, we have a private remote machine). We were using SVN until now.
We have a remote machine that works like an SVN repository.
Now, we want to turn this machine into the Git central repository.
By what I have re... | Now, if the repository is already existing on a remote machine, and you do not have anything locally, you do git clone instead.
The URL format is simple, it is PROTOCOL:/[user@]remoteMachineAddress/path/to/repository.git
For example, cloning a repository on a machine to which you have SSH access using the "dev" user,... |
43109615 | Gitkraken stuck at opening repo | 58 | 2017-03-30 05:55:40 | <p>Every time I open gitkrarken it gets stuck at opening repo icon. I can't open/clone/init repo.
I heard some others have the same problem but no one seems to know why this is happening and what the solution is.
Can anyone help with this?</p>
<p><strong>UPDATE 1</strong>
Reinstalled it. Still having the same problem<... | 61,738 | 6,567,911 | 2023-10-25 21:51:41 | 45,185,589 | 44 | 2017-07-19 08:54:52 | 4,369,087 | 2023-05-05 14:32:10 | https://stackoverflow.com/q/43109615 | https://stackoverflow.com/a/45185589 | <p>A possible solution for resolving this issue with <code>GitKraken</code> is to delete the hidden folder <code>.gitkraken</code> located in your home directory (macOS/Linux) or the <code>%APPDATA%</code> directory (Windows). Keep in mind that this action will reset all of your GitKraken settings and preferences.</p>
... | <p>A possible solution for resolving this issue with <code>GitKraken</code> is to delete the hidden folder <code>.gitkraken</code> located in your home directory (macOS/Linux) or the <code>%APPDATA%</code> directory (Windows). Keep in mind that this action will reset all of your GitKraken settings and preferences.</p> ... | 119, 119628 | git, gitkraken | <h1>Gitkraken stuck at opening repo</h1>
<p>Every time I open gitkrarken it gets stuck at opening repo icon. I can't open/clone/init repo.
I heard some others have the same problem but no one seems to know why this is happening and what the solution is.
Can anyone help with this?</p>
<p><strong>UPDATE 1</strong>
Reins... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,726 | git | # Gitkraken stuck at opening repo
Every time I open gitkrarken it gets stuck at opening repo icon. I can't open/clone/init repo.
I heard some others have the same problem but no one seems to know why this is happening and what the solution is.
Can anyone help with this?
**UPDATE 1**
Reinstalled it. Still having the s... | A possible solution for resolving this issue with `GitKraken` is to delete the hidden folder `.gitkraken` located in your home directory (macOS/Linux) or the `%APPDATA%` directory (Windows). Keep in mind that this action will reset all of your GitKraken settings and preferences.
**For macOS and Linux users:**
1. Clos... |
22799825 | Using Git on Windows, behind an HTTP proxy, without storing proxy password on disk | 57 | 2014-04-02 01:18:58 | <p>I'm using Git on Windows, on a corporate network where I'm behind an HTTP proxy with Basic authentication. Outbound SSH doesn't work, so I have to use HTTPS through the proxy.</p>
<p>I'm aware of how to use <code>git config http.proxy</code> to configure the settings as <code>http://[username]:[password]@[proxy]:[p... | 114,210 | 1,877,783 | 2024-06-22 21:00:32 | 22,803,427 | 44 | 2014-04-02 06:43:23 | 6,309 | 2020-03-18 13:22:12 | https://stackoverflow.com/q/22799825 | https://stackoverflow.com/a/22803427 | <p>Instead of using git setting, you can also use environment variable (that you can set just for your session), as described in <a href="https://stackoverflow.com/a/16069911/6309">this answer</a>:</p>
<pre><code>set http_proxy=http://username:password@proxydomain:port
set https_proxy=http://username:password@proxydom... | <p>Instead of using git setting, you can also use environment variable (that you can set just for your session), as described in <a href="https://stackoverflow.com/a/16069911/6309">this answer</a>:</p> <pre><code>set http_proxy=http://username:password@proxydomain:port set https_proxy=http://username:password@proxydom... | 119, 760, 5210, 32868 | git, git-config, http, proxy | <h1>Using Git on Windows, behind an HTTP proxy, without storing proxy password on disk</h1>
<p>I'm using Git on Windows, on a corporate network where I'm behind an HTTP proxy with Basic authentication. Outbound SSH doesn't work, so I have to use HTTPS through the proxy.</p>
<p>I'm aware of how to use <code>git config ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,727 | git | # Using Git on Windows, behind an HTTP proxy, without storing proxy password on disk
I'm using Git on Windows, on a corporate network where I'm behind an HTTP proxy with Basic authentication. Outbound SSH doesn't work, so I have to use HTTPS through the proxy.
I'm aware of how to use `git config http.proxy` to config... | Instead of using git setting, you can also use environment variable (that you can set just for your session), as described in [this answer](https://stackoverflow.com/a/16069911/6309):
```
set http_proxy=http://username:password@proxydomain:port
set https_proxy=http://username:password@proxydomain:port
set no_proxy=loc... |
16831536 | Can you change a file content during git commit? | 51 | 2013-05-30 08:39:43 | <p>One of the things I keep in my <a href="http://jj.github.io/hoborg/" rel="noreferrer">open novel in GitHub</a> is a <a href="https://github.com/JJ/hoborg/blob/master/text/words.dic" rel="noreferrer">list of words</a> I would like to set automatically the first line, which is the number of words in the dictionary. My... | 39,377 | 891,440 | 2021-08-06 12:28:24 | 16,832,764 | 44 | 2013-05-30 09:41:10 | 1,256,452 | 2021-08-06 12:28:24 | https://stackoverflow.com/q/16831536 | https://stackoverflow.com/a/16832764 | <p>The actual commit stuck in by <code>git commit</code> is whatever is in the index once the pre-commit hook finishes. This means that you <em>can</em> change files in the pre-commit hook, as long as you <code>git add</code> them too.</p>
<p>Here's my example pre-commit hook, modified from the .sample:</p>
<pre><code... | <p>The actual commit stuck in by <code>git commit</code> is whatever is in the index once the pre-commit hook finishes. This means that you <em>can</em> change files in the pre-commit hook, as long as you <code>git add</code> them too.</p> <p>Here's my example pre-commit hook, modified from the .sample:</p> <pre><code... | 119, 853, 5597 | commit, git, hook | <h1>Can you change a file content during git commit?</h1>
<p>One of the things I keep in my <a href="http://jj.github.io/hoborg/" rel="noreferrer">open novel in GitHub</a> is a <a href="https://github.com/JJ/hoborg/blob/master/text/words.dic" rel="noreferrer">list of words</a> I would like to set automatically the firs... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,728 | git | # Can you change a file content during git commit?
One of the things I keep in my [open novel in GitHub](http://jj.github.io/hoborg/) is a [list of words](https://github.com/JJ/hoborg/blob/master/text/words.dic) I would like to set automatically the first line, which is the number of words in the dictionary. My first ... | The actual commit stuck in by `git commit` is whatever is in the index once the pre-commit hook finishes. This means that you *can* change files in the pre-commit hook, as long as you `git add` them too.
Here's my example pre-commit hook, modified from the .sample:
```
#!/bin/sh
#
# An example hook script to verify w... |
4603221 | Git: Merge in only one commit | 50 | 2011-01-05 10:51:36 | <p>Usually, I work with branches in Git, but I don't like to see hundreds of branches in my working tree (Git history). I'm wondering if there is a method in Git to "join" all commits in a branch in only one commit (ideally with a clear commit message).</p>
<p>Something like this:</p>
<pre><code>git checkout -b branc... | 39,972 | 299,897 | 2023-11-22 10:30:54 | 4,603,304 | 44 | 2011-01-05 11:00:34 | 201,672 | 2011-02-23 13:57:09 | https://stackoverflow.com/q/4603221 | https://stackoverflow.com/a/4603304 | <p>This can be done using <code>git rebase</code> and squash, or using <code>git merge --squash</code>, see </p>
<p><a href="https://stackoverflow.com/questions/783731/git-merge-flattening">Git merge flattening</a></p>
<p>and </p>
<p><a href="https://stackoverflow.com/questions/204461/git-squash-my-commit">git: squa... | <p>This can be done using <code>git rebase</code> and squash, or using <code>git merge --squash</code>, see </p> <p><a href="https://stackoverflow.com/questions/783731/git-merge-flattening">Git merge flattening</a></p> <p>and </p> <p><a href="https://stackoverflow.com/questions/204461/git-squash-my-commit">git: squa... | 119, 1879 | branch, git | <h1>Git: Merge in only one commit</h1>
<p>Usually, I work with branches in Git, but I don't like to see hundreds of branches in my working tree (Git history). I'm wondering if there is a method in Git to "join" all commits in a branch in only one commit (ideally with a clear commit message).</p>
<p>Something like this... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,729 | git | # Git: Merge in only one commit
Usually, I work with branches in Git, but I don't like to see hundreds of branches in my working tree (Git history). I'm wondering if there is a method in Git to "join" all commits in a branch in only one commit (ideally with a clear commit message).
Something like this:
```
git check... | This can be done using `git rebase` and squash, or using `git merge --squash`, see
[Git merge flattening](https://stackoverflow.com/questions/783731/git-merge-flattening)
and
[git: squash/fixup earlier commit](https://stackoverflow.com/questions/204461/git-squash-my-commit) |
19033709 | Understanding detached HEAD in git | 49 | 2013-09-26 16:29:51 | <p>I am learning git and am following the excellent tutorials at <a href="http://gitimmersion.com" rel="noreferrer">http://gitimmersion.com</a>.</p>
<p>In those tutorials, there is a blurb that tries to explain detached HEADs, and that states:</p>
<blockquote>
<p>A “detached HEAD” message in git just means that HEA... | 64,174 | null | 2024-12-06 23:27:00 | 19,034,007 | 44 | 2013-09-26 16:46:43 | 498,699 | 2024-12-06 23:27:00 | https://stackoverflow.com/q/19033709 | https://stackoverflow.com/a/19034007 | <p>If you are working in your repo and do <code>git checkout <SHA></code> you will be in a "detached HEAD". You are not on a branch (the commit is likely to be on multiple branches). You are checked out to a specific instance in the history.</p>
<p>A detached head can also occur when you are rebasing.... | <p>If you are working in your repo and do <code>git checkout <SHA></code> you will be in a "detached HEAD". You are not on a branch (the commit is likely to be on multiple branches). You are checked out to a specific instance in the history.</p> <p>A detached head can also occur when you are rebasing.... | 119 | git | <h1>Understanding detached HEAD in git</h1>
<p>I am learning git and am following the excellent tutorials at <a href="http://gitimmersion.com" rel="noreferrer">http://gitimmersion.com</a>.</p>
<p>In those tutorials, there is a blurb that tries to explain detached HEADs, and that states:</p>
<blockquote>
<p>A “detac... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,730 | git | # Understanding detached HEAD in git
I am learning git and am following the excellent tutorials at <http://gitimmersion.com>.
In those tutorials, there is a blurb that tries to explain detached HEADs, and that states:
> A “detached HEAD” message in git just means that HEAD (the part of git that tracks what your curr... | If you are working in your repo and do `git checkout <SHA>` you will be in a "detached HEAD". You are not on a branch (the commit is likely to be on multiple branches). You are checked out to a specific instance in the history.
A detached head can also occur when you are rebasing. You are checked out to a specific com... |
4535251 | Show the original branch for a commit | 47 | 2010-12-26 20:18:10 | <p>I've used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I'll use the branch name to find the particular ticket)</p>
<p>Let's define "original branch" as "the branch to which the commit was made before the branch was merged into any other branch".</p>... | 27,760 | 3,488 | 2016-10-29 13:39:38 | 4,535,867 | 44 | 2010-12-26 23:34:16 | 47,978 | 2010-12-26 23:34:16 | https://stackoverflow.com/q/4535251 | https://stackoverflow.com/a/4535867 | <p>Like the others said, if the branch you are looking for isn't local to the repository on which you are blaming this commit (e.g. a branch only in the personal repo of a distant developer), you are screwed.</p>
<p>But assuming that sought-after branch is something you can see, and that of course you have the commit'... | <p>Like the others said, if the branch you are looking for isn't local to the repository on which you are blaming this commit (e.g. a branch only in the personal repo of a distant developer), you are screwed.</p> <p>But assuming that sought-after branch is something you can see, and that of course you have the commit'... | 119, 1879, 76220 | branch, git, git-branch | <h1>Show the original branch for a commit</h1>
<p>I've used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I'll use the branch name to find the particular ticket)</p>
<p>Let's define "original branch" as "the branch to which the commit was made before th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,733 | git | # Show the original branch for a commit
I've used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I'll use the branch name to find the particular ticket)
Let's define "original branch" as "the branch to which the commit was made before the branch was mer... | Like the others said, if the branch you are looking for isn't local to the repository on which you are blaming this commit (e.g. a branch only in the personal repo of a distant developer), you are screwed.
But assuming that sought-after branch is something you can see, and that of course you have the commit's hash, sa... |
14649605 | git-apply fails mysteriously, how do I troubleshoot/fix? | 45 | 2013-02-01 15:29:12 | <p>I'm currently trying to to code-style checking on the PRs of a (github) repository, and I want to deliver patches to the submitters with which they can easily fix the codestyle. To this end, I'm pulling down their PR, run our uncrustify script over it to fix any style errors, and want to create a .patch file they ca... | 74,435 | 599,884 | 2020-06-17 16:17:12 | 14,649,971 | 44 | 2013-02-01 15:48:14 | 17,028 | 2013-02-01 22:41:22 | https://stackoverflow.com/q/14649605 | https://stackoverflow.com/a/14649971 | <p><strong>Update:</strong> </p>
<p>You can use <code>git apply -v</code> to see more detailed info about what's going on, <code>git apply --check</code> to just verify the operation, or <code>git apply --index</code> to rebuild the local index file.</p>
<p>Based on your comment, it seems your local index was corrupt... | <p><strong>Update:</strong> </p> <p>You can use <code>git apply -v</code> to see more detailed info about what's going on, <code>git apply --check</code> to just verify the operation, or <code>git apply --index</code> to rebuild the local index file.</p> <p>Based on your comment, it seems your local index was corrupt... | 119, 2132 | git, patch | <h1>git-apply fails mysteriously, how do I troubleshoot/fix?</h1>
<p>I'm currently trying to to code-style checking on the PRs of a (github) repository, and I want to deliver patches to the submitters with which they can easily fix the codestyle. To this end, I'm pulling down their PR, run our uncrustify script over it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,735 | git | # git-apply fails mysteriously, how do I troubleshoot/fix?
I'm currently trying to to code-style checking on the PRs of a (github) repository, and I want to deliver patches to the submitters with which they can easily fix the codestyle. To this end, I'm pulling down their PR, run our uncrustify script over it to fix a... | **Update:**
You can use `git apply -v` to see more detailed info about what's going on, `git apply --check` to just verify the operation, or `git apply --index` to rebuild the local index file.
Based on your comment, it seems your local index was corrupted, and so `index` solved it.
I will leave my original answer a... |
23791999 | Why does git commit --amend change the hash even if I don't make any changes? | 44 | 2014-05-21 19:20:29 | <p>Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running <code>git commit --amend</code>?</p>
<p>Say I run the following at the command line.</p>
<pre class="lang-bash prettyprint-override"><code>cd ~/Desktop
mkdir test_amend
cd test_amend
git i... | 31,766 | 2,541,573 | 2023-08-04 22:14:29 | 23,792,149 | 44 | 2014-05-21 19:29:08 | 14,637 | 2014-05-21 19:38:49 | https://stackoverflow.com/q/23791999 | https://stackoverflow.com/a/23792149 | <p>Yes, it's the commit timestamp. Inspecting the contents of the two commits reveals:</p>
<pre><code>$ git cat-file commit 82c7363bcfd727fe2d6b0a98412f71a10c8849c9
tree d87cbcba0e2ede0752bdafc5938da35546803ba5
author Thomas <xxx> 1400700200 +0200
committer Thomas <xxx> 1400700200 +0200
hello
$ git cat-f... | <p>Yes, it's the commit timestamp. Inspecting the contents of the two commits reveals:</p> <pre><code>$ git cat-file commit 82c7363bcfd727fe2d6b0a98412f71a10c8849c9 tree d87cbcba0e2ede0752bdafc5938da35546803ba5 author Thomas <xxx> 1400700200 +0200 committer Thomas <xxx> 1400700200 +0200 hello $ git cat-f... | 119, 10188, 30968 | git, git-amend, sha | <h1>Why does git commit --amend change the hash even if I don't make any changes?</h1>
<p>Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running <code>git commit --amend</code>?</p>
<p>Say I run the following at the command line.</p>
<pre class="... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,736 | git | # Why does git commit --amend change the hash even if I don't make any changes?
Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running `git commit --amend`?
Say I run the following at the command line.
```
cd ~/Desktop
mkdir test_amend
cd test... | Yes, it's the commit timestamp. Inspecting the contents of the two commits reveals:
```
$ git cat-file commit 82c7363bcfd727fe2d6b0a98412f71a10c8849c9
tree d87cbcba0e2ede0752bdafc5938da35546803ba5
author Thomas <xxx> 1400700200 +0200
committer Thomas <xxx> 1400700200 +0200
hello
$ git cat-file commit 7432fcf82b65d9d... |
2187000 | Untracked files between branches in Git | 44 | 2010-02-02 19:29:42 | <p>I've been searching around here for to look for an answer and it seems I may just be making incorrect assumptions on how git branches are supposed to work.</p>
<p>I have my <code>master</code> branch and I've created a feature branch called <code>profiles</code> where I'm doing some specific work to profiles. While... | 38,639 | 264,653 | 2022-09-20 14:32:35 | 2,187,113 | 44 | 2010-02-02 19:45:14 | 22,483 | 2014-07-09 18:27:15 | https://stackoverflow.com/q/2187000 | https://stackoverflow.com/a/2187113 | <blockquote>
<p>"I'm not ready to commit the changes locally yet."</p>
</blockquote>
<p>Commits in git are local things that can be undone, redone and re-re-done at will. It's only when you push the commit somewhere that you need to pay attention.</p>
<p>Plus, commits are visible to local tools like <code>gitk</co... | <blockquote> <p>"I'm not ready to commit the changes locally yet."</p> </blockquote> <p>Commits in git are local things that can be undone, redone and re-re-done at will. It's only when you push the commit somewhere that you need to pay attention.</p> <p>Plus, commits are visible to local tools like <code>gitk</co... | 119, 1879 | branch, git | <h1>Untracked files between branches in Git</h1>
<p>I've been searching around here for to look for an answer and it seems I may just be making incorrect assumptions on how git branches are supposed to work.</p>
<p>I have my <code>master</code> branch and I've created a feature branch called <code>profiles</code> wher... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,737 | git | # Untracked files between branches in Git
I've been searching around here for to look for an answer and it seems I may just be making incorrect assumptions on how git branches are supposed to work.
I have my `master` branch and I've created a feature branch called `profiles` where I'm doing some specific work to prof... | > "I'm not ready to commit the changes locally yet."
Commits in git are local things that can be undone, redone and re-re-done at will. It's only when you push the commit somewhere that you need to pay attention.
Plus, commits are visible to local tools like `gitk`, and can have diffs taken of them and can be rebased... |
8044675 | Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit | 43 | 2011-11-08 00:45:13 | <p>I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. What do I do?</p>
<pre><code>git pull
M Gemfile
U Gemfile.lock
Pull is not possible because you have unmerged files... | 125,101 | 165,448 | 2022-01-03 12:33:09 | 8,044,695 | 44 | 2011-11-08 00:48:24 | 148,870 | 2011-11-08 00:48:24 | https://stackoverflow.com/q/8044675 | https://stackoverflow.com/a/8044695 | <p>You can use <code>git checkout <file></code> to check out the committed version of the file (thus discarding your changes), or <code>git reset --hard HEAD</code> to throw away any uncommitted changes for all files.</p>
| <p>You can use <code>git checkout <file></code> to check out the committed version of the file (thus discarding your changes), or <code>git reset --hard HEAD</code> to throw away any uncommitted changes for all files.</p> | 119, 13091, 28896 | git, git-pull, git-stash | <h1>Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit</h1>
<p>I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. What do I do... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,738 | git | # Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit
I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. What do I do?
```
gi... | You can use `git checkout <file>` to check out the committed version of the file (thus discarding your changes), or `git reset --hard HEAD` to throw away any uncommitted changes for all files. |
3741931 | How do I use Git's `difftool` to merge conflicts? | 43 | 2010-09-18 13:48:42 | <p>After a merge failed with some conflicts, I can list those with <code>git diff</code>, but <code>git difftool</code> won't display them with the difftool set in the config (in my case Kaleidoscope). Instead it will just use normal diff.</p>
<p>A <code>git difftool</code> comparing with a previous commit will work.</... | 39,302 | 259,692 | 2023-09-14 21:27:14 | 3,741,987 | 44 | 2010-09-18 14:08:04 | 230,900 | 2010-09-18 14:08:04 | https://stackoverflow.com/q/3741931 | https://stackoverflow.com/a/3741987 | <p>Try <code>git mergetool</code>.</p>
| <p>Try <code>git mergetool</code>.</p> | 119, 62599, 105625 | git, git-difftool, merge-conflict-resolution | <h1>How do I use Git's `difftool` to merge conflicts?</h1>
<p>After a merge failed with some conflicts, I can list those with <code>git diff</code>, but <code>git difftool</code> won't display them with the difftool set in the config (in my case Kaleidoscope). Instead it will just use normal diff.</p>
<p>A <code>git di... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,739 | git | # How do I use Git's `difftool` to merge conflicts?
After a merge failed with some conflicts, I can list those with `git diff`, but `git difftool` won't display them with the difftool set in the config (in my case Kaleidoscope). Instead it will just use normal diff.
A `git difftool` comparing with a previous commit w... | Try `git mergetool`. |
22070232 | How to get an Ansible check to run only once in a playbook? | 41 | 2014-02-27 13:37:26 | <p>As a safeguard against using an outdated playbook, I'd like to ensure that I have an updated copy of the git checkout before Ansible is allowed to modify anything on the servers.</p>
<p>This is how I've attempted to do it. This action is located in a file included by all play books:</p>
<pre><code>- name: Ensure l... | 76,681 | 22,146 | 2019-11-27 20:46:37 | 22,079,408 | 44 | 2014-02-27 20:17:28 | 126,273 | 2019-11-27 20:46:37 | https://stackoverflow.com/q/22070232 | https://stackoverflow.com/a/22079408 | <h1>Updated</h1>
<p>When I fist wrote my answer (2014-02-27), Ansible had no built-in support for running a task <em>only once</em> per playbook, <em>not</em> once per affected host that the playbook was run on. However, as <a href="https://stackoverflow.com/a/34526387/126273">tlo writes</a>, support for this was int... | <h1>Updated</h1> <p>When I fist wrote my answer (2014-02-27), Ansible had no built-in support for running a task <em>only once</em> per playbook, <em>not</em> once per affected host that the playbook was run on. However, as <a href="https://stackoverflow.com/a/34526387/126273">tlo writes</a>, support for this was int... | 119, 86394 | ansible, git | <h1>How to get an Ansible check to run only once in a playbook?</h1>
<p>As a safeguard against using an outdated playbook, I'd like to ensure that I have an updated copy of the git checkout before Ansible is allowed to modify anything on the servers.</p>
<p>This is how I've attempted to do it. This action is located i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,740 | git | # How to get an Ansible check to run only once in a playbook?
As a safeguard against using an outdated playbook, I'd like to ensure that I have an updated copy of the git checkout before Ansible is allowed to modify anything on the servers.
This is how I've attempted to do it. This action is located in a file include... | # Updated
When I fist wrote my answer (2014-02-27), Ansible had no built-in support for running a task *only once* per playbook, *not* once per affected host that the playbook was run on. However, as [tlo writes](https://stackoverflow.com/a/34526387/126273), support for this was introduced with [`run_once: true`](http... |
8412081 | git add multiple files at once | 41 | 2011-12-07 08:01:40 | <p>I had this project with a lot .c files in source directory,then I make the project, there is .o files inside of the project, I also want to push these files to repository,so instead of add each .o which is possible but...,how to add .o files easily?</p>
| 95,422 | 1,051,003 | 2016-03-11 15:08:06 | 8,412,119 | 44 | 2011-12-07 08:07:13 | 211,659 | 2011-12-07 08:07:13 | https://stackoverflow.com/q/8412081 | https://stackoverflow.com/a/8412119 | <p>Putting aside the fact, that this is just a terrible idea, you can add them as any other file:</p>
<pre><code>git add *.o
git commit -m "Committing compiled files, which is bad"
</code></pre>
<p>Of course instead of <code>git add *.o</code> you can use <code>git add */*.o</code> or even <code>find -name *.o | whil... | <p>Putting aside the fact, that this is just a terrible idea, you can add them as any other file:</p> <pre><code>git add *.o git commit -m "Committing compiled files, which is bad" </code></pre> <p>Of course instead of <code>git add *.o</code> you can use <code>git add */*.o</code> or even <code>find -name *.o | whil... | 119, 14215 | addition, git | <h1>git add multiple files at once</h1>
<p>I had this project with a lot .c files in source directory,then I make the project, there is .o files inside of the project, I also want to push these files to repository,so instead of add each .o which is possible but...,how to add .o files easily?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,741 | git | # git add multiple files at once
I had this project with a lot .c files in source directory,then I make the project, there is .o files inside of the project, I also want to push these files to repository,so instead of add each .o which is possible but...,how to add .o files easily? | Putting aside the fact, that this is just a terrible idea, you can add them as any other file:
```
git add *.o
git commit -m "Committing compiled files, which is bad"
```
Of course instead of `git add *.o` you can use `git add */*.o` or even `find -name *.o | while read x; do git add $x; done` |
623518 | msysgit on windows -- what should I be aware of, if any? | 41 | 2009-03-08 12:46:06 | <p>This is related to another <a href="https://stackoverflow.com/questions/623018/git-without-bash-cygwin">question I asked</a> recently.</p>
<p>When installing msysgit, the installer presents 3 options related to system path:</p>
<ol>
<li><p>Never change windows environment. With this option, you have to use the "ba... | 22,396 | 35,364 | 2012-04-21 05:08:15 | 647,636 | 44 | 2009-03-15 11:02:30 | 15,031 | 2009-03-15 11:02:30 | https://stackoverflow.com/q/623518 | https://stackoverflow.com/a/647636 | <p>You get <code>bash</code> regardless of which option you pick, the latter options just add methods for using Git outside it.</p>
<p>For the latter options, <strong>msysgit</strong> adds Windows builds of common Linux utilities to <strong><code>PATH</code></strong>. This includes <strong><code>find</code></strong>, ... | <p>You get <code>bash</code> regardless of which option you pick, the latter options just add methods for using Git outside it.</p> <p>For the latter options, <strong>msysgit</strong> adds Windows builds of common Linux utilities to <strong><code>PATH</code></strong>. This includes <strong><code>find</code></strong>, ... | 64, 119, 456, 21628 | git, msysgit, version-control, windows | <h1>msysgit on windows -- what should I be aware of, if any?</h1>
<p>This is related to another <a href="https://stackoverflow.com/questions/623018/git-without-bash-cygwin">question I asked</a> recently.</p>
<p>When installing msysgit, the installer presents 3 options related to system path:</p>
<ol>
<li><p>Never cha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,742 | git | # msysgit on windows -- what should I be aware of, if any?
This is related to another [question I asked](https://stackoverflow.com/questions/623018/git-without-bash-cygwin) recently.
When installing msysgit, the installer presents 3 options related to system path:
1. Never change windows environment. With this optio... | You get `bash` regardless of which option you pick, the latter options just add methods for using Git outside it.
For the latter options, **msysgit** adds Windows builds of common Linux utilities to **`PATH`**. This includes **`find`**, **`kill`** and **`sort`**, as well as **`cp`**, **`ls`**, **`rm`**, and about 20-3... |
56892981 | How to solve: "Sorry, cannot split this hunk"? | 37 | 2019-07-04 18:39:33 | <p>I've run:</p>
<pre><code>git add -p
</code></pre>
<p>and I then want to split my hunk by typing <code>s</code>:</p>
<pre><code> import org.hamcrest.CoreMatchers;
-import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.... | 8,237 | 1,807,667 | 2019-07-04 18:51:25 | 56,893,036 | 44 | 2019-07-04 18:45:42 | 2,340,612 | 2019-07-04 18:51:25 | https://stackoverflow.com/q/56892981 | https://stackoverflow.com/a/56893036 | <p>You can manually edit the hunk by typing <code>e</code> and then edit the hunk so that it only contains whatever you need (note the space before all imports except the one you want to add):</p>
<pre><code># Manual hunk edit mode -- see bottom for a quick guide.
@@ -1,5 +1,5 @@
import org.hamcrest.CoreMatchers;
im... | <p>You can manually edit the hunk by typing <code>e</code> and then edit the hunk so that it only contains whatever you need (note the space before all imports except the one you want to add):</p> <pre><code># Manual hunk edit mode -- see bottom for a quick guide. @@ -1,5 +1,5 @@ import org.hamcrest.CoreMatchers; im... | 119 | git | <h1>How to solve: "Sorry, cannot split this hunk"?</h1>
<p>I've run:</p>
<pre><code>git add -p
</code></pre>
<p>and I then want to split my hunk by typing <code>s</code>:</p>
<pre><code> import org.hamcrest.CoreMatchers;
-import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import org.junit.ru... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,743 | git | # How to solve: "Sorry, cannot split this hunk"?
I've run:
```
git add -p
```
and I then want to split my hunk by typing `s`:
```
import org.hamcrest.CoreMatchers;
-import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory... | You can manually edit the hunk by typing `e` and then edit the hunk so that it only contains whatever you need (note the space before all imports except the one you want to add):
```
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -1,5 +1,5 @@
import org.hamcrest.CoreMatchers;
import org.junit.Ignore;
+i... |
16658087 | Automatically add .gitignore and hooks on git init | 37 | 2013-05-20 20:45:36 | <p>Is there a way to tell git to automatically create/populate .gitignore and certain files in the .git/hooks folder every time <code>git init</code> is run on a certain machine? Maybe a global config somewhere?</p>
<p>We have symlinks that need to be ignored across the board, as well as pre-receive and post-receive h... | 23,387 | 1,097,816 | 2019-08-03 07:04:36 | 16,658,321 | 44 | 2013-05-20 20:58:44 | 46,194 | 2019-08-03 07:04:36 | https://stackoverflow.com/q/16658087 | https://stackoverflow.com/a/16658321 | <p>You can achieve this using a git template directory</p>
<pre><code>git config --global init.templatedir /path/to/template
</code></pre>
<p>You can then add files to the folder <code>/path/to/template/hooks</code> and they will be automatically copied to the <code>.git/hooks</code> folder on <code>git init</code></... | <p>You can achieve this using a git template directory</p> <pre><code>git config --global init.templatedir /path/to/template </code></pre> <p>You can then add files to the folder <code>/path/to/template/hooks</code> and they will be automatically copied to the <code>.git/hooks</code> folder on <code>git init</code></... | 119 | git | <h1>Automatically add .gitignore and hooks on git init</h1>
<p>Is there a way to tell git to automatically create/populate .gitignore and certain files in the .git/hooks folder every time <code>git init</code> is run on a certain machine? Maybe a global config somewhere?</p>
<p>We have symlinks that need to be ignored... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,744 | git | # Automatically add .gitignore and hooks on git init
Is there a way to tell git to automatically create/populate .gitignore and certain files in the .git/hooks folder every time `git init` is run on a certain machine? Maybe a global config somewhere?
We have symlinks that need to be ignored across the board, as well ... | You can achieve this using a git template directory
```
git config --global init.templatedir /path/to/template
```
You can then add files to the folder `/path/to/template/hooks` and they will be automatically copied to the `.git/hooks` folder on `git init`
You can place the .gitignore contents you want in a file you... |
13750182 | Git: How to Archive from remote repository directly? | 36 | 2012-12-06 18:33:05 | <p>I usually use the command below inside my <code>project.git</code> to get an archive in the specified destinations:</p>
<pre><code>git archive master | tar -x -C /home/kave/site/
</code></pre>
<p>I wonder if its possible to archive directly from a remote repository instead into a destination directory?</p>
<p>I t... | 54,995 | 92,153 | 2020-07-10 01:57:42 | 13,751,126 | 44 | 2012-12-06 19:33:42 | 641,451 | 2016-05-26 14:58:42 | https://stackoverflow.com/q/13750182 | https://stackoverflow.com/a/13751126 | <p>From <a href="https://git-scm.com/docs/git-archive" rel="noreferrer"><code>git help archive</code></a>:</p>
<pre><code> --remote=<repo>
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
</code></pre>
<p>Command should end up like:</p>
<pre><... | <p>From <a href="https://git-scm.com/docs/git-archive" rel="noreferrer"><code>git help archive</code></a>:</p> <pre><code> --remote=<repo> Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository. </code></pre> <p>Command should end up like:</p> <pre><... | 119 | git | <h1>Git: How to Archive from remote repository directly?</h1>
<p>I usually use the command below inside my <code>project.git</code> to get an archive in the specified destinations:</p>
<pre><code>git archive master | tar -x -C /home/kave/site/
</code></pre>
<p>I wonder if its possible to archive directly from a remot... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,745 | git | # Git: How to Archive from remote repository directly?
I usually use the command below inside my `project.git` to get an archive in the specified destinations:
```
git archive master | tar -x -C /home/kave/site/
```
I wonder if its possible to archive directly from a remote repository instead into a destination dire... | From [`git help archive`](https://git-scm.com/docs/git-archive):
```
--remote=<repo>
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
```
Command should end up like:
```
$ git archive --remote=https://kave@dndigital.git.cloudforge.com/myoproject.gi... |
5865439 | Can I interactively pick hunks from another git commit? | 36 | 2011-05-03 05:31:55 | <p>I'm looking for exactly the same behavior as </p>
<pre><code>git add -i -p
</code></pre>
<p>But instead of composing a commit from my working directory, I'd like to compose my working directory from (parts of) a commit. How can I do that ?</p>
<p>My use case is that I have several distinct features that are group... | 9,677 | 23,691 | 2024-06-08 17:30:22 | 5,868,642 | 44 | 2011-05-03 11:17:13 | 134,841 | 2019-06-28 03:59:21 | https://stackoverflow.com/q/5865439 | https://stackoverflow.com/a/5868642 | <blockquote>
<p>Using cherry-pick -n is not really satisfactory, since it leaves me with the dirty job of
removing all the unrequired code. I'd really just like to pick the selected changes I want to
test.</p>
</blockquote>
<p>The job may have been a dirty one before, but with the advent of <a href="https://git-... | <blockquote> <p>Using cherry-pick -n is not really satisfactory, since it leaves me with the dirty job of removing all the unrequired code. I'd really just like to pick the selected changes I want to test.</p> </blockquote> <p>The job may have been a dirty one before, but with the advent of <a href="https://git-... | 119 | git | <h1>Can I interactively pick hunks from another git commit?</h1>
<p>I'm looking for exactly the same behavior as </p>
<pre><code>git add -i -p
</code></pre>
<p>But instead of composing a commit from my working directory, I'd like to compose my working directory from (parts of) a commit. How can I do that ?</p>
<p>My... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,746 | git | # Can I interactively pick hunks from another git commit?
I'm looking for exactly the same behavior as
```
git add -i -p
```
But instead of composing a commit from my working directory, I'd like to compose my working directory from (parts of) a commit. How can I do that ?
My use case is that I have several distinct... | > Using cherry-pick -n is not really satisfactory, since it leaves me with the dirty job of
> removing all the unrequired code. I'd really just like to pick the selected changes I want to
> test.
The job may have been a dirty one before, but with the advent of [`git checkout --patch`](https://git-scm.com/docs/git-chec... |
16223561 | "No commit specified and merge.defaultToUpstream not set" | 35 | 2013-04-25 19:52:22 | <p>As a new git user, who is an expert with SVN and CVS, I am struggling to get the most basic of git functions to work.</p>
<p>I'm using a shared repo at assembla.com</p>
<p>I created a local clone, and added a file:</p>
<pre><code>$ git clone repository-url
$ echo "hello" > ha.txt
$ git add -A
$ git commit -a -... | 22,841 | 1,072,187 | 2021-07-09 14:14:00 | 16,223,800 | 44 | 2013-04-25 20:07:21 | 366,299 | 2015-07-22 19:14:15 | https://stackoverflow.com/q/16223561 | https://stackoverflow.com/a/16223800 | <p>Usually you do not invoke <code>git merge</code> without arguments (at least I don't know anyone who does). If you want that <code>merge</code> defaults to the tracking branch, you need to set <code>merge.defaultToUpstream</code> to true: <code>git config merge.defaultToUpstream true</code>. Your <code>master</code>... | <p>Usually you do not invoke <code>git merge</code> without arguments (at least I don't know anyone who does). If you want that <code>merge</code> defaults to the tracking branch, you need to set <code>merge.defaultToUpstream</code> to true: <code>git config merge.defaultToUpstream true</code>. Your <code>master</code>... | 119 | git | <h1>"No commit specified and merge.defaultToUpstream not set"</h1>
<p>As a new git user, who is an expert with SVN and CVS, I am struggling to get the most basic of git functions to work.</p>
<p>I'm using a shared repo at assembla.com</p>
<p>I created a local clone, and added a file:</p>
<pre><code>$ git clone repos... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,747 | git | # "No commit specified and merge.defaultToUpstream not set"
As a new git user, who is an expert with SVN and CVS, I am struggling to get the most basic of git functions to work.
I'm using a shared repo at assembla.com
I created a local clone, and added a file:
```
$ git clone repository-url
$ echo "hello" > ha.txt
... | Usually you do not invoke `git merge` without arguments (at least I don't know anyone who does). If you want that `merge` defaults to the tracking branch, you need to set `merge.defaultToUpstream` to true: `git config merge.defaultToUpstream true`. Your `master` branch has to track `origin/master` in this case: `git br... |
13881609 | Git refs/remotes/origin/master does not point to a valid object | 35 | 2012-12-14 15:28:58 | <p>After the last merge to the master branch of my Git repository I have lost the ability to clone repository.</p>
<pre>
Cloning into test-repository...
remote: Counting objects: 126084, done.
remote: Compressing objects: 100% (28327/28327), done.
Receiving objects: 100% (126084/126084), 132.63 MiB | 29.30 MiB/s, done... | 75,027 | 228,517 | 2021-07-09 11:30:50 | 14,316,087 | 44 | 2013-01-14 09:47:01 | 228,517 | 2013-01-14 09:47:01 | https://stackoverflow.com/q/13881609 | https://stackoverflow.com/a/14316087 | <pre><code>git gc
git fsck --full
git reflog expire --expire=0 --all
git update-ref -d 0d998c99b6d01e8aabca72b1934802acf90b8fc9
git gc --aggressive
git remote update --prune
</code></pre>
<p>and it worked!</p>
| <pre><code>git gc git fsck --full git reflog expire --expire=0 --all git update-ref -d 0d998c99b6d01e8aabca72b1934802acf90b8fc9 git gc --aggressive git remote update --prune </code></pre> <p>and it worked!</p> | 119 | git | <h1>Git refs/remotes/origin/master does not point to a valid object</h1>
<p>After the last merge to the master branch of my Git repository I have lost the ability to clone repository.</p>
<pre>
Cloning into test-repository...
remote: Counting objects: 126084, done.
remote: Compressing objects: 100% (28327/28327), done... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,748 | git | # Git refs/remotes/origin/master does not point to a valid object
After the last merge to the master branch of my Git repository I have lost the ability to clone repository.
```
Cloning into test-repository...
remote: Counting objects: 126084, done.
remote: Compressing objects: 100% (28327/28327), done.
Receiving obj... | ```
git gc
git fsck --full
git reflog expire --expire=0 --all
git update-ref -d 0d998c99b6d01e8aabca72b1934802acf90b8fc9
git gc --aggressive
git remote update --prune
```
and it worked! |
53188741 | How to git stage changes in JetBrains IDE or similar functionality | 34 | 2018-11-07 11:39:17 | <p>How to add files to git stage in JetBrains Rider? Is this feature implemented? If it's not implemented then in which window can I look through the staged files which I've staged using some external tool?</p>
<p>[UPD]:
The use case is to hold separately files I want to commit and files I don't want to commit at the ... | 23,093 | 8,356,436 | 2023-08-16 07:16:21 | 73,975,888 | 44 | 2022-10-06 14:53:13 | 3,018,212 | 2023-08-16 07:16:21 | https://stackoverflow.com/q/53188741 | https://stackoverflow.com/a/73975888 | <p>The <strong>staging area</strong> is an alternative to <strong>changelists</strong> that <em>@Jura Gorohovsky</em> has mentioned. For those more comfortable with the concept of staging changes on a file-by-file basis like the Visual Studio experience you described, you basically need to do two things:</p>
<h3>1. Ena... | <p>The <strong>staging area</strong> is an alternative to <strong>changelists</strong> that <em>@Jura Gorohovsky</em> has mentioned. For those more comfortable with the concept of staging changes on a file-by-file basis like the Visual Studio experience you described, you basically need to do two things:</p> <h3>1. Ena... | 119, 5794, 120390 | git, jetbrains-ide, rider | <h1>How to git stage changes in JetBrains IDE or similar functionality</h1>
<p>How to add files to git stage in JetBrains Rider? Is this feature implemented? If it's not implemented then in which window can I look through the staged files which I've staged using some external tool?</p>
<p>[UPD]:
The use case is to hol... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,749 | git | # How to git stage changes in JetBrains IDE or similar functionality
How to add files to git stage in JetBrains Rider? Is this feature implemented? If it's not implemented then in which window can I look through the staged files which I've staged using some external tool?
[UPD]:
The use case is to hold separately fil... | The **staging area** is an alternative to **changelists** that *@Jura Gorohovsky* has mentioned. For those more comfortable with the concept of staging changes on a file-by-file basis like the Visual Studio experience you described, you basically need to do two things:
### 1. Enable Staging Area
1. Open the Rider IDE... |
22699614 | Git commit messages lost by vi | 34 | 2014-03-27 21:29:55 | <p>I'm a clumsy typist, and I don't use vi/vim very often, but I do use it for commit messages. However, if you type a wrong command while editing a commit message (<code>:Wq</code>, say, instead of <code>:wq</code>), when you correctly close out the commit message in vim with <code>:wq</code> or <code>:x</code>, you g... | 4,138 | 221,814 | 2022-01-01 06:24:00 | 22,699,894 | 44 | 2014-03-27 21:47:48 | 1,814,139 | 2014-03-28 00:14:42 | https://stackoverflow.com/q/22699614 | https://stackoverflow.com/a/22699894 | <p>You should set vim to not detach from the shell and be in the foreground. You can do this with the following command: </p>
<pre><code>git config --global core.editor vim -f
</code></pre>
<p>From the man:</p>
<pre><code> -f Foreground. For the GUI version, Vim will not fork and detach from the shell it... | <p>You should set vim to not detach from the shell and be in the foreground. You can do this with the following command: </p> <pre><code>git config --global core.editor vim -f </code></pre> <p>From the man:</p> <pre><code> -f Foreground. For the GUI version, Vim will not fork and detach from the shell it... | 119, 370 | git, vim | <h1>Git commit messages lost by vi</h1>
<p>I'm a clumsy typist, and I don't use vi/vim very often, but I do use it for commit messages. However, if you type a wrong command while editing a commit message (<code>:Wq</code>, say, instead of <code>:wq</code>), when you correctly close out the commit message in vim with <c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,750 | git | # Git commit messages lost by vi
I'm a clumsy typist, and I don't use vi/vim very often, but I do use it for commit messages. However, if you type a wrong command while editing a commit message (`:Wq`, say, instead of `:wq`), when you correctly close out the commit message in vim with `:wq` or `:x`, you get this:
```... | You should set vim to not detach from the shell and be in the foreground. You can do this with the following command:
```
git config --global core.editor vim -f
```
From the man:
```
-f Foreground. For the GUI version, Vim will not fork and detach from the shell it
was started in. On th... |
10066749 | git excludes vs ignores | 34 | 2012-04-08 21:36:20 | <p>I use <a href="http://www.git-tower.com/">Tower</a> for using Git in Mac.
The settings in Tower has Ignores section which creates the .gitignore, but it has another section named "Excludes". And it seems like that one can use excludes with "# git ls-files --others --exclude-from=.git/info/exclude".</p>
<p><img src=... | 15,164 | 260,127 | 2018-04-04 11:37:13 | 10,066,774 | 44 | 2012-04-08 21:40:03 | 47,773 | 2012-04-08 21:40:03 | https://stackoverflow.com/q/10066749 | https://stackoverflow.com/a/10066774 | <p>It's a list of files that are not in <code>.gitignore</code> (which can be versioned), but which you want to exclude on your machine's copy of the repo.</p>
<p>From <a href="http://linux.die.net/man/5/gitignore">the docs</a>:</p>
<blockquote>
<p>Patterns which are specific to a particular repository but which do... | <p>It's a list of files that are not in <code>.gitignore</code> (which can be versioned), but which you want to exclude on your machine's copy of the repo.</p> <p>From <a href="http://linux.die.net/man/5/gitignore">the docs</a>:</p> <blockquote> <p>Patterns which are specific to a particular repository but which do... | 119, 25056, 78499 | git, gitignore, git-tower | <h1>git excludes vs ignores</h1>
<p>I use <a href="http://www.git-tower.com/">Tower</a> for using Git in Mac.
The settings in Tower has Ignores section which creates the .gitignore, but it has another section named "Excludes". And it seems like that one can use excludes with "# git ls-files --others --exclude-from=.git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,751 | git | # git excludes vs ignores
I use [Tower](http://www.git-tower.com/) for using Git in Mac.
The settings in Tower has Ignores section which creates the .gitignore, but it has another section named "Excludes". And it seems like that one can use excludes with "# git ls-files --others --exclude-from=.git/info/exclude".
:
> Patterns which are specific to a particular repository but which do
> not need to be shared with other related reposito... |
26190837 | How many / how long are stashes saved by git? | 32 | 2014-10-04 07:54:55 | <p>I'm very new to git and have some question about stashing. If I've worked on a branch but was not able to get to a position where I can commit the branch, stashing is the right thing to use. My questions regarding stashing are:</p>
<ol>
<li>How many stashes are saved?</li>
<li>How long are these stashes saved?</li>... | 15,360 | 1,355,634 | 2019-11-19 06:17:28 | 26,192,691 | 44 | 2014-10-04 12:11:48 | 2,541,573 | 2019-11-19 06:17:28 | https://stackoverflow.com/q/26190837 | https://stackoverflow.com/a/26192691 | <blockquote>
<p><strong>1 - How many stashes are saved?</strong></p>
</blockquote>
<p>Stashes don't appear out of thin air; only if you create them, using</p>
<pre><code>git stash
</code></pre>
<p>or, equivalently,</p>
<pre><code>git stash save
</code></pre>
<p>So how many are saved? As many as you create.</p>
... | <blockquote> <p><strong>1 - How many stashes are saved?</strong></p> </blockquote> <p>Stashes don't appear out of thin air; only if you create them, using</p> <pre><code>git stash </code></pre> <p>or, equivalently,</p> <pre><code>git stash save </code></pre> <p>So how many are saved? As many as you create.</p> ... | 119, 13091 | git, git-stash | <h1>How many / how long are stashes saved by git?</h1>
<p>I'm very new to git and have some question about stashing. If I've worked on a branch but was not able to get to a position where I can commit the branch, stashing is the right thing to use. My questions regarding stashing are:</p>
<ol>
<li>How many stashes are... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,752 | git | # How many / how long are stashes saved by git?
I'm very new to git and have some question about stashing. If I've worked on a branch but was not able to get to a position where I can commit the branch, stashing is the right thing to use. My questions regarding stashing are:
1. How many stashes are saved?
2. How long... | > **1 - How many stashes are saved?**
Stashes don't appear out of thin air; only if you create them, using
```
git stash
```
or, equivalently,
```
git stash save
```
So how many are saved? As many as you create.
> **2 - How long are these stashes saved?**
This question looks innocent, but the answer is actually ... |
3179498 | How can I cut down a Git bisect run using file paths? | 31 | 2010-07-05 12:40:16 | <p>I'm using <a href="http://www.kernel.org/pub/software/scm/git/docs/git-bisect.html" rel="nofollow noreferrer">Git bisect</a> to find a failure inducing commit. However, a lot of the commits in the range are definitely irrelevant (because they are commits to the documentation or to unit tests). I'd like to make Git b... | 5,695 | 91,757 | 2025-05-13 13:02:20 | 3,179,584 | 44 | 2010-07-05 12:53:17 | 158,676 | 2020-10-05 19:49:14 | https://stackoverflow.com/q/3179498 | https://stackoverflow.com/a/3179584 | <p>You have several options here:</p>
<ol>
<li><p><strong>Ignoring specific commits</strong></p>
<p><code>git bisect</code> contains functionality of skipping commits. You can specify commits, tags, ranges you don't want to test with</p>
<pre><code> git bisect skip 0dae5f ff049ab ...
</code></pre>
<p>Just do this befo... | <p>You have several options here:</p> <ol> <li><p><strong>Ignoring specific commits</strong></p> <p><code>git bisect</code> contains functionality of skipping commits. You can specify commits, tags, ranges you don't want to test with</p> <pre><code> git bisect skip 0dae5f ff049ab ... </code></pre> <p>Just do this befo... | 119, 47326 | git, git-bisect | <h1>How can I cut down a Git bisect run using file paths?</h1>
<p>I'm using <a href="http://www.kernel.org/pub/software/scm/git/docs/git-bisect.html" rel="nofollow noreferrer">Git bisect</a> to find a failure inducing commit. However, a lot of the commits in the range are definitely irrelevant (because they are commits... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,753 | git | # How can I cut down a Git bisect run using file paths?
I'm using [Git bisect](http://www.kernel.org/pub/software/scm/git/docs/git-bisect.html) to find a failure inducing commit. However, a lot of the commits in the range are definitely irrelevant (because they are commits to the documentation or to unit tests). I'd l... | You have several options here:
1. **Ignoring specific commits**
`git bisect` contains functionality of skipping commits. You can specify commits, tags, ranges you don't want to test with
```
git bisect skip 0dae5f ff049ab ...
```
Just do this before you `git bisect run`, and it should skip what you ... |
3144082 | Difference between msysgit and Cygwin + git? | 31 | 2010-06-29 19:36:41 | <p>What is the difference between msysgit and Cygwin + git?</p>
<p>Now I'm using msysgit, but I don't like the Git Bash (you can't resize or copy/paste) so I'm thinking think about switching to Cygwin, because then I could use <a href="http://code.google.com/p/mintty/" rel="noreferrer">mintty</a>.</p>
| 30,151 | 1,799,796 | 2019-12-04 00:15:11 | 3,144,417 | 44 | 2010-06-29 20:19:47 | 6,309 | 2018-01-26 12:35:04 | https://stackoverflow.com/q/3144082 | https://stackoverflow.com/a/3144417 | <p>Edit 2018:</p>
<p>Since my 2010-2012-2014 answer, in 2015 Git for Windows uses msys2, as I <a href="https://stackoverflow.com/a/26826359/6309">detail here</a>.</p>
<p>See more in "<a href="https://stackoverflow.com/a/35099458/6309">How are msys, msys2, and msysgit related to each other?</a>".</p>
<hr>
<p>Edit (2... | <p>Edit 2018:</p> <p>Since my 2010-2012-2014 answer, in 2015 Git for Windows uses msys2, as I <a href="https://stackoverflow.com/a/26826359/6309">detail here</a>.</p> <p>See more in "<a href="https://stackoverflow.com/a/35099458/6309">How are msys, msys2, and msysgit related to each other?</a>".</p> <hr> <p>Edit (2... | 119, 1731, 21628 | cygwin, git, msysgit | <h1>Difference between msysgit and Cygwin + git?</h1>
<p>What is the difference between msysgit and Cygwin + git?</p>
<p>Now I'm using msysgit, but I don't like the Git Bash (you can't resize or copy/paste) so I'm thinking think about switching to Cygwin, because then I could use <a href="http://code.google.com/p/mint... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,754 | git | # Difference between msysgit and Cygwin + git?
What is the difference between msysgit and Cygwin + git?
Now I'm using msysgit, but I don't like the Git Bash (you can't resize or copy/paste) so I'm thinking think about switching to Cygwin, because then I could use [mintty](http://code.google.com/p/mintty/). | Edit 2018:
Since my 2010-2012-2014 answer, in 2015 Git for Windows uses msys2, as I [detail here](https://stackoverflow.com/a/26826359/6309).
See more in "[How are msys, msys2, and msysgit related to each other?](https://stackoverflow.com/a/35099458/6309)".
---
Edit (2 more years later: October 2014)
[Johannes Sch... |
2938791 | How to unversion an entire folder? | 31 | 2010-05-30 13:25:02 | <p>I have a folder versioned in a git. I want to unversion it, that is to remove the .git meta data, how can I do this?</p>
<p>Thanks</p>
| 16,190 | 118,644 | 2010-05-30 13:49:50 | 2,938,871 | 44 | 2010-05-30 13:49:50 | 268,330 | 2010-05-30 13:49:50 | https://stackoverflow.com/q/2938791 | https://stackoverflow.com/a/2938871 | <p>If the folder is the top level of a git repository, and you actually want to completely remove the entire git repo associated with the folder, then simply delete the (hidden) <code>.git</code> directory from the folder:</p>
<pre><code>cd foldername
rm -r .git
</code></pre>
<p>If the folder is a subdirectory of a ... | <p>If the folder is the top level of a git repository, and you actually want to completely remove the entire git repo associated with the folder, then simply delete the (hidden) <code>.git</code> directory from the folder:</p> <pre><code>cd foldername rm -r .git </code></pre> <p>If the folder is a subdirectory of a ... | 119 | git | <h1>How to unversion an entire folder?</h1>
<p>I have a folder versioned in a git. I want to unversion it, that is to remove the .git meta data, how can I do this?</p>
<p>Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,755 | git | # How to unversion an entire folder?
I have a folder versioned in a git. I want to unversion it, that is to remove the .git meta data, how can I do this?
Thanks | If the folder is the top level of a git repository, and you actually want to completely remove the entire git repo associated with the folder, then simply delete the (hidden) `.git` directory from the folder:
```
cd foldername
rm -r .git
```
If the folder is a subdirectory of a git repository, then gautier's method i... |
25254694 | git svn show-ignore gives error "command returned error: 1" | 30 | 2014-08-12 01:04:14 | <p>I'm trying to migrate a project from SVN to git. This is the command I use:</p>
<pre><code>$ git svn clone http://oursvnserver/ --no-metadata -A ../authors-transform.txt --trunk=path/to/trunk --branches=path/to/branches --tags=path/to/tags . --username=mysvnusername --prefix=origin/
</code></pre>
<p>The current di... | 11,134 | 1,394,393 | 2016-05-24 00:53:36 | 25,272,388 | 44 | 2014-08-12 19:21:27 | 1,394,393 | 2014-08-12 19:21:27 | https://stackoverflow.com/q/25254694 | https://stackoverflow.com/a/25272388 | <p>So this is caused by git not being able to find a matching <code>fetch</code> entry in the <code>svn-remote</code> section of the <code>$GIT_DIR/config</code> file. Without an argument to <code>git svn show-ignore</code>, it doesn't know what to look for in that section. (Maybe my tracking isn't set up right?)</p>
... | <p>So this is caused by git not being able to find a matching <code>fetch</code> entry in the <code>svn-remote</code> section of the <code>$GIT_DIR/config</code> file. Without an argument to <code>git svn show-ignore</code>, it doesn't know what to look for in that section. (Maybe my tracking isn't set up right?)</p> ... | 119, 6452, 19160, 21628, 25056 | git, gitignore, git-svn, msysgit, svnignore | <h1>git svn show-ignore gives error "command returned error: 1"</h1>
<p>I'm trying to migrate a project from SVN to git. This is the command I use:</p>
<pre><code>$ git svn clone http://oursvnserver/ --no-metadata -A ../authors-transform.txt --trunk=path/to/trunk --branches=path/to/branches --tags=path/to/tags . --use... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,756 | git | # git svn show-ignore gives error "command returned error: 1"
I'm trying to migrate a project from SVN to git. This is the command I use:
```
$ git svn clone http://oursvnserver/ --no-metadata -A ../authors-transform.txt --trunk=path/to/trunk --branches=path/to/branches --tags=path/to/tags . --username=mysvnusername ... | So this is caused by git not being able to find a matching `fetch` entry in the `svn-remote` section of the `$GIT_DIR/config` file. Without an argument to `git svn show-ignore`, it doesn't know what to look for in that section. (Maybe my tracking isn't set up right?)
To deal with this, you need to first specify which ... |
38980293 | Git clone leads to deleted & untracked files | 29 | 2016-08-16 16:43:38 | <p>I am new to Git.</p>
<p>I just installed Git (2.9.3) for Windows (10), then I opened git-bash and did a <code>git clone <remoteURL></code>. A new folder is created with the whole copy of the remote repository, which is good. But then I run a <code>git status</code> and I get a ton of <code>deleted</code> file... | 26,036 | 1,585,148 | 2023-07-12 11:03:40 | 38,992,095 | 44 | 2016-08-17 08:53:30 | 1,585,148 | 2016-08-17 08:53:30 | https://stackoverflow.com/q/38980293 | https://stackoverflow.com/a/38992095 | <p>I was retrieving a huge project with very long paths. I forgot to set up Git to use long paths:</p>
<pre><code>git config --global core.longpaths true
</code></pre>
<p>After this, the cloning went fine and the status clean.</p>
| <p>I was retrieving a huge project with very long paths. I forgot to set up Git to use long paths:</p> <pre><code>git config --global core.longpaths true </code></pre> <p>After this, the cloning went fine and the status clean.</p> | 119, 34099 | git, git-clone | <h1>Git clone leads to deleted & untracked files</h1>
<p>I am new to Git.</p>
<p>I just installed Git (2.9.3) for Windows (10), then I opened git-bash and did a <code>git clone <remoteURL></code>. A new folder is created with the whole copy of the remote repository, which is good. But then I run a <code>git stat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,759 | git | # Git clone leads to deleted & untracked files
I am new to Git.
I just installed Git (2.9.3) for Windows (10), then I opened git-bash and did a `git clone <remoteURL>`. A new folder is created with the whole copy of the remote repository, which is good. But then I run a `git status` and I get a ton of `deleted` files... | I was retrieving a huge project with very long paths. I forgot to set up Git to use long paths:
```
git config --global core.longpaths true
```
After this, the cloning went fine and the status clean. |
2135601 | Update git-svn list of remote branches | 29 | 2010-01-25 21:01:09 | <p>When I have to use svn, I use git-svn to talk to svn. I cloned the repo with the standard git svn clone -s line, and all the remote branches at the time were there.</p>
<p>Since then, a new branch has been created, but not by me. I want to checkout/track this branch locally. I can track a branch that I can see (wit... | 13,075 | 4,657 | 2015-09-01 06:50:03 | 2,136,176 | 44 | 2010-01-25 22:31:11 | 123,109 | 2010-01-25 22:31:11 | https://stackoverflow.com/q/2135601 | https://stackoverflow.com/a/2136176 | <p>After running the following commands, you'll be able to see the new branch on the git side:</p>
<pre><code>$ git svn fetch
$ git svn rebase
</code></pre>
<p>Make sure your branch is clean first.</p>
| <p>After running the following commands, you'll be able to see the new branch on the git side:</p> <pre><code>$ git svn fetch $ git svn rebase </code></pre> <p>Make sure your branch is clean first.</p> | 63, 119, 1879, 6452 | branch, git, git-svn, svn | <h1>Update git-svn list of remote branches</h1>
<p>When I have to use svn, I use git-svn to talk to svn. I cloned the repo with the standard git svn clone -s line, and all the remote branches at the time were there.</p>
<p>Since then, a new branch has been created, but not by me. I want to checkout/track this branch l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,761 | git | # Update git-svn list of remote branches
When I have to use svn, I use git-svn to talk to svn. I cloned the repo with the standard git svn clone -s line, and all the remote branches at the time were there.
Since then, a new branch has been created, but not by me. I want to checkout/track this branch locally. I can tr... | After running the following commands, you'll be able to see the new branch on the git side:
```
$ git svn fetch
$ git svn rebase
```
Make sure your branch is clean first. |
16951416 | How do I revert one file to its original state in git? | 28 | 2013-06-05 23:19:07 | <p>I have a few files I made changes to.</p>
<p>Then I committed it and realized I made a change to a file I didn't want to change. How can I get the file back to its original state? I am on a branch.</p>
<pre><code>git checkout --file
</code></pre>
<p>didn't do anything at all.</p>
| 46,225 | 2,041,546 | 2024-12-02 22:18:39 | 16,951,437 | 44 | 2013-06-05 23:22:16 | 625,403 | 2013-06-05 23:22:16 | https://stackoverflow.com/q/16951416 | https://stackoverflow.com/a/16951437 | <pre><code>git checkout filename
</code></pre>
<p>will work in most cases, unless you have a branch with the same name as a file. In either case,</p>
<pre><code>git checkout -- filename
</code></pre>
<p>will be sufficient.</p>
| <pre><code>git checkout filename </code></pre> <p>will work in most cases, unless you have a branch with the same name as a file. In either case,</p> <pre><code>git checkout -- filename </code></pre> <p>will be sufficient.</p> | 119 | git | <h1>How do I revert one file to its original state in git?</h1>
<p>I have a few files I made changes to.</p>
<p>Then I committed it and realized I made a change to a file I didn't want to change. How can I get the file back to its original state? I am on a branch.</p>
<pre><code>git checkout --file
</code></pre>
<p>did... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,762 | git | # How do I revert one file to its original state in git?
I have a few files I made changes to.
Then I committed it and realized I made a change to a file I didn't want to change. How can I get the file back to its original state? I am on a branch.
```
git checkout --file
```
didn't do anything at all. | ```
git checkout filename
```
will work in most cases, unless you have a branch with the same name as a file. In either case,
```
git checkout -- filename
```
will be sufficient. |
16560095 | Git pull origin/master branch to local/master, when in local/develop | 28 | 2013-05-15 08:22:04 | <p>I work in develop branch. Sometimes, when I want to push changes to origin, git say, that there are some changes in origin/master branch.</p>
<p>How to pull changes from remote master to local master without checkout to local master?</p>
| 55,682 | 1,208,512 | 2020-05-16 20:21:32 | 16,560,695 | 44 | 2013-05-15 08:52:55 | 971,121 | 2013-05-15 08:58:01 | https://stackoverflow.com/q/16560095 | https://stackoverflow.com/a/16560695 | <p>If you want to update your local master without checkout, you can do :</p>
<pre><code>git pull origin master:master
</code></pre>
<p>That will update your local master with the <code>origin/master</code></p>
<p>Or, as I assume that you want to ultimately rebase your <code>develop</code> branch with the changes oc... | <p>If you want to update your local master without checkout, you can do :</p> <pre><code>git pull origin master:master </code></pre> <p>That will update your local master with the <code>origin/master</code></p> <p>Or, as I assume that you want to ultimately rebase your <code>develop</code> branch with the changes oc... | 119, 1879 | branch, git | <h1>Git pull origin/master branch to local/master, when in local/develop</h1>
<p>I work in develop branch. Sometimes, when I want to push changes to origin, git say, that there are some changes in origin/master branch.</p>
<p>How to pull changes from remote master to local master without checkout to local master?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,763 | git | # Git pull origin/master branch to local/master, when in local/develop
I work in develop branch. Sometimes, when I want to push changes to origin, git say, that there are some changes in origin/master branch.
How to pull changes from remote master to local master without checkout to local master? | If you want to update your local master without checkout, you can do :
```
git pull origin master:master
```
That will update your local master with the `origin/master`
Or, as I assume that you want to ultimately rebase your `develop` branch with the changes occured in `origin/master`, you can do a simple `git fetch... |
30869912 | Git clone over ssh, push over https | 27 | 2015-06-16 14:02:13 | <p>I have a set of private Git repos in BitBucket. I want to clone them through SSH so that the cloning can be automated without asking for a password. However, I want to push over HTTPS because I want to push with a different user name. </p>
<p>The PC is a common PC, and I want to distinguish who pushes changes but I... | 72,095 | 2,283,531 | 2015-06-16 14:29:16 | 30,870,550 | 44 | 2015-06-16 14:29:16 | 5,002,783 | 2015-06-16 14:29:16 | https://stackoverflow.com/q/30869912 | https://stackoverflow.com/a/30870550 | <p>You can use two or more different remotes for that. By default, when you clone a remote repository, the remote <code>origin</code> is automatically created for you. But you can specify a different repository on the git command line each time literally like e.g.</p>
<pre><code>git push https://git-server/myrepo.git ... | <p>You can use two or more different remotes for that. By default, when you clone a remote repository, the remote <code>origin</code> is automatically created for you. But you can specify a different repository on the git command line each time literally like e.g.</p> <pre><code>git push https://git-server/myrepo.git ... | 119, 386, 642, 8337 | bitbucket, git, https, ssh | <h1>Git clone over ssh, push over https</h1>
<p>I have a set of private Git repos in BitBucket. I want to clone them through SSH so that the cloning can be automated without asking for a password. However, I want to push over HTTPS because I want to push with a different user name. </p>
<p>The PC is a common PC, and I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,765 | git | # Git clone over ssh, push over https
I have a set of private Git repos in BitBucket. I want to clone them through SSH so that the cloning can be automated without asking for a password. However, I want to push over HTTPS because I want to push with a different user name.
The PC is a common PC, and I want to distingu... | You can use two or more different remotes for that. By default, when you clone a remote repository, the remote `origin` is automatically created for you. But you can specify a different repository on the git command line each time literally like e.g.
```
git push https://git-server/myrepo.git branch
```
but it is muc... |
26407059 | git add and commit single tracked file in one command | 27 | 2014-10-16 14:34:36 | <p>I'm looking for the equivalent of <code>git commit -am "blah blah"</code> but for just a single file. If I try:</p>
<pre><code>git commit my.file -am "blah blah"
</code></pre>
<p>I get:</p>
<pre><code>fatal: Paths with -a does not make sense.
</code></pre>
<p>I looked around but I could only find solutions that... | 30,243 | 2,725,969 | 2018-01-31 09:48:15 | 26,407,084 | 44 | 2014-10-16 14:35:49 | 4,323 | 2014-10-16 14:35:49 | https://stackoverflow.com/q/26407059 | https://stackoverflow.com/a/26407084 | <p>Just omit the <code>-a</code> which means <code>--all</code> which is not what you want. Do this:</p>
<pre><code>git commit my.file -m "blah blah"
</code></pre>
<p>That will commit only <code>my.file</code>, even if other files are staged (by <code>git add</code>).</p>
| <p>Just omit the <code>-a</code> which means <code>--all</code> which is not what you want. Do this:</p> <pre><code>git commit my.file -m "blah blah" </code></pre> <p>That will commit only <code>my.file</code>, even if other files are staged (by <code>git add</code>).</p> | 119, 1448 | alias, git | <h1>git add and commit single tracked file in one command</h1>
<p>I'm looking for the equivalent of <code>git commit -am "blah blah"</code> but for just a single file. If I try:</p>
<pre><code>git commit my.file -am "blah blah"
</code></pre>
<p>I get:</p>
<pre><code>fatal: Paths with -a does not make sense.
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,766 | git | # git add and commit single tracked file in one command
I'm looking for the equivalent of `git commit -am "blah blah"` but for just a single file. If I try:
```
git commit my.file -am "blah blah"
```
I get:
```
fatal: Paths with -a does not make sense.
```
I looked around but I could only find solutions that sugge... | Just omit the `-a` which means `--all` which is not what you want. Do this:
```
git commit my.file -m "blah blah"
```
That will commit only `my.file`, even if other files are staged (by `git add`). |
5583139 | how can git post-receive hook get name of repo it is running on? | 27 | 2011-04-07 14:57:10 | <p>I have a git post receive hook that will trigger a build on my build system.
I need to create a string of the form "$repo-name + $branch" in the hook script.</p>
<p>I can parse the branch, but how can I get the repository name from git?</p>
<p>Thanks!</p>
| 9,728 | 244,005 | 2017-03-21 13:38:16 | 5,584,084 | 44 | 2011-04-07 16:04:53 | 223,092 | 2011-04-07 16:49:27 | https://stackoverflow.com/q/5583139 | https://stackoverflow.com/a/5584084 | <p>The "repository name" isn't a well-defined idea in git, I think. Perhaps what would be most useful is to return <code>whatever.git</code> in the case of a bare repository or <code>whatever</code> in the case of a repository with a working tree. I've tested that this bit of Bourne shell deals with both cases proper... | <p>The "repository name" isn't a well-defined idea in git, I think. Perhaps what would be most useful is to return <code>whatever.git</code> in the case of a bare repository or <code>whatever</code> in the case of a repository with a working tree. I've tested that this bit of Bourne shell deals with both cases proper... | 119 | git | <h1>how can git post-receive hook get name of repo it is running on?</h1>
<p>I have a git post receive hook that will trigger a build on my build system.
I need to create a string of the form "$repo-name + $branch" in the hook script.</p>
<p>I can parse the branch, but how can I get the repository name from git?</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,768 | git | # how can git post-receive hook get name of repo it is running on?
I have a git post receive hook that will trigger a build on my build system.
I need to create a string of the form "$repo-name + $branch" in the hook script.
I can parse the branch, but how can I get the repository name from git?
Thanks! | The "repository name" isn't a well-defined idea in git, I think. Perhaps what would be most useful is to return `whatever.git` in the case of a bare repository or `whatever` in the case of a repository with a working tree. I've tested that this bit of Bourne shell deals with both cases properly from within a `post-rece... |
40113902 | How to resolve Git error: "fatal: BUG: get_tempfile_fd() called for inactive object" | 26 | 2016-10-18 16:51:56 | <p>When doing a <code>git pull</code> on a repo I work in everyday, I received the following error:</p>
<pre><code>fatal: BUG: get_tempfile_fd() called for inactive object
</code></pre>
<p>That's all the error said. What does it mean and what do I do?</p>
| 6,752 | 949,598 | 2020-08-03 12:27:01 | 40,116,189 | 44 | 2016-10-18 19:10:03 | 949,598 | 2016-10-18 19:10:03 | https://stackoverflow.com/q/40113902 | https://stackoverflow.com/a/40116189 | <p>The resolution for me was was deleting <code>.git/index.lock</code>.</p>
| <p>The resolution for me was was deleting <code>.git/index.lock</code>.</p> | 119 | git | <h1>How to resolve Git error: "fatal: BUG: get_tempfile_fd() called for inactive object"</h1>
<p>When doing a <code>git pull</code> on a repo I work in everyday, I received the following error:</p>
<pre><code>fatal: BUG: get_tempfile_fd() called for inactive object
</code></pre>
<p>That's all the error said. What does... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,769 | git | # How to resolve Git error: "fatal: BUG: get_tempfile_fd() called for inactive object"
When doing a `git pull` on a repo I work in everyday, I received the following error:
```
fatal: BUG: get_tempfile_fd() called for inactive object
```
That's all the error said. What does it mean and what do I do? | The resolution for me was was deleting `.git/index.lock`. |
21557004 | protocol error: expected old/new/ref, got 'shallow deeb...' | 25 | 2014-02-04 15:49:55 | <p>I am editing a git repository that was cloned using <code>--depth 1</code> (shallow clone).</p>
<p>I want to push my changes (commits) but I get this error:</p>
<pre><code>$ git push
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8... | 14,469 | 1,420,197 | 2015-04-27 01:40:05 | 21,557,983 | 44 | 2014-02-04 16:30:32 | 454,103 | 2015-04-27 01:40:05 | https://stackoverflow.com/q/21557004 | https://stackoverflow.com/a/21557983 | <pre><code>git fetch --unshallow
</code></pre>
<p>Also see: <a href="https://stackoverflow.com/a/17937889/1420197">how to unshallow your repo</a></p>
| <pre><code>git fetch --unshallow </code></pre> <p>Also see: <a href="https://stackoverflow.com/a/17937889/1420197">how to unshallow your repo</a></p> | 119 | git | <h1>protocol error: expected old/new/ref, got 'shallow deeb...'</h1>
<p>I am editing a git repository that was cloned using <code>--depth 1</code> (shallow clone).</p>
<p>I want to push my changes (commits) but I get this error:</p>
<pre><code>$ git push
Counting objects: 14, done.
Delta compression using up to 4 thr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,770 | git | # protocol error: expected old/new/ref, got 'shallow deeb...'
I am editing a git repository that was cloned using `--depth 1` (shallow clone).
I want to push my changes (commits) but I get this error:
```
$ git push
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8),... | ```
git fetch --unshallow
```
Also see: [how to unshallow your repo](https://stackoverflow.com/a/17937889/1420197) |
52479641 | manage 2 git users gpg key and choose gpg sign per user | 24 | 2018-09-24 12:40:09 | <p>I have 1 github user and another gitlab user, and I have created 1 gpg key for each because my email address differs. </p>
<p>The problem is I have to execute <code>git config --global user.signingkey</code> everytime I want to commit to different git repos.</p>
<p>Is there a way I can manage my gpg keys per git u... | 8,042 | 8,779,111 | 2024-05-16 11:57:51 | 58,623,519 | 44 | 2019-10-30 10:39:57 | 3,055 | 2023-05-19 23:39:43 | https://stackoverflow.com/q/52479641 | https://stackoverflow.com/a/58623519 | <p>I have the same situation but with splitting of work/personal accounts. And I have a lot of repositories but I don't want to run <code>git config</code> every time I clone something new.</p>
<p>I have written <a href="https://dev.to/chakrit/multiple-identity-gitconfig-with-gpg-signing-8c0" rel="noreferrer">a blog po... | <p>I have the same situation but with splitting of work/personal accounts. And I have a lot of repositories but I don't want to run <code>git config</code> every time I clone something new.</p> <p>I have written <a href="https://dev.to/chakrit/multiple-identity-gitconfig-with-gpg-signing-8c0" rel="noreferrer">a blog po... | 119, 122019 | git, gpg-signature | <h1>manage 2 git users gpg key and choose gpg sign per user</h1>
<p>I have 1 github user and another gitlab user, and I have created 1 gpg key for each because my email address differs. </p>
<p>The problem is I have to execute <code>git config --global user.signingkey</code> everytime I want to commit to different git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,771 | git | # manage 2 git users gpg key and choose gpg sign per user
I have 1 github user and another gitlab user, and I have created 1 gpg key for each because my email address differs.
The problem is I have to execute `git config --global user.signingkey` everytime I want to commit to different git repos.
Is there a way I ca... | I have the same situation but with splitting of work/personal accounts. And I have a lot of repositories but I don't want to run `git config` every time I clone something new.
I have written [a blog post](https://dev.to/chakrit/multiple-identity-gitconfig-with-gpg-signing-8c0) about it. A way to do this automatically ... |
21051874 | git svn fetch/rebase error: unable to remap msys-ssl-0.9.8.dll to same address as parent -- 0x678F0000 | 23 | 2014-01-10 18:36:58 | <p>I recently started getting the following git error on <code>git svn fetch</code> or <code>git svn rebase</code>, but other local git commands are working fine:</p>
<p><strong>Following is the detailed error message:</strong></p>
<pre><code>C:\Git\bin\perl.exe: ** unable to remap C:\Git\bin\msys-ssl-0.9.8.dll to sa... | 9,233 | 1,302,408 | 2017-07-20 15:41:54 | 25,436,636 | 44 | 2014-08-21 21:58:36 | 81,949 | 2014-08-21 21:58:36 | https://stackoverflow.com/q/21051874 | https://stackoverflow.com/a/25436636 | <p>The root cause of this issue and any variants of it is two DLLs have been mapped to the same address, causing a conflict. Individual cases can be solved using <i>rebase</i>.</p>
<p>Msysgit 1.9.4-preview20140815 contains <a href="https://github.com/msysgit/msysgit/pull/245" rel="noreferrer">a case of this issue with... | <p>The root cause of this issue and any variants of it is two DLLs have been mapped to the same address, causing a conflict. Individual cases can be solved using <i>rebase</i>.</p> <p>Msysgit 1.9.4-preview20140815 contains <a href="https://github.com/msysgit/msysgit/pull/245" rel="noreferrer">a case of this issue with... | 119, 457, 580, 6452, 21628 | dll, git, git-svn, msysgit, perl | <h1>git svn fetch/rebase error: unable to remap msys-ssl-0.9.8.dll to same address as parent -- 0x678F0000</h1>
<p>I recently started getting the following git error on <code>git svn fetch</code> or <code>git svn rebase</code>, but other local git commands are working fine:</p>
<p><strong>Following is the detailed err... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,772 | git | # git svn fetch/rebase error: unable to remap msys-ssl-0.9.8.dll to same address as parent -- 0x678F0000
I recently started getting the following git error on `git svn fetch` or `git svn rebase`, but other local git commands are working fine:
**Following is the detailed error message:**
```
C:\Git\bin\perl.exe: ** u... | The root cause of this issue and any variants of it is two DLLs have been mapped to the same address, causing a conflict. Individual cases can be solved using *rebase*.
Msysgit 1.9.4-preview20140815 contains [a case of this issue with the libsvn_repos-1-0.dll and libneon-25.dll libraries](https://github.com/msysgit/ms... |
15552063 | Git find out the last commit i pushed | 23 | 2013-03-21 15:46:16 | <p>I want to find out the last thing that I pushed, not the last thing i commited, but pushed. </p>
<p>Is there a git command for this?</p>
<p><em>Context:</em>
I want to squash some commits before merging my dev_branch with a master branch but I have been told you can not rebase anything that is already pushed (is t... | 46,409 | 1,044,650 | 2022-09-16 15:37:53 | 15,552,121 | 44 | 2013-03-21 15:48:29 | 501,250 | 2013-03-21 15:48:29 | https://stackoverflow.com/q/15552063 | https://stackoverflow.com/a/15552121 | <p>If you mean the last commit you pushed to the <code>master</code> branch then, assuming your remote is <code>origin</code>:</p>
<pre><code>git rev-parse origin/master
</code></pre>
<p>This will show you the commit ID of the tip of the <code>master</code> branch of the <code>origin</code> origin, <em>as your local ... | <p>If you mean the last commit you pushed to the <code>master</code> branch then, assuming your remote is <code>origin</code>:</p> <pre><code>git rev-parse origin/master </code></pre> <p>This will show you the commit ID of the tip of the <code>master</code> branch of the <code>origin</code> origin, <em>as your local ... | 119 | git | <h1>Git find out the last commit i pushed</h1>
<p>I want to find out the last thing that I pushed, not the last thing i commited, but pushed. </p>
<p>Is there a git command for this?</p>
<p><em>Context:</em>
I want to squash some commits before merging my dev_branch with a master branch but I have been told you can n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,773 | git | # Git find out the last commit i pushed
I want to find out the last thing that I pushed, not the last thing i commited, but pushed.
Is there a git command for this?
*Context:*
I want to squash some commits before merging my dev_branch with a master branch but I have been told you can not rebase anything that is alre... | If you mean the last commit you pushed to the `master` branch then, assuming your remote is `origin`:
```
git rev-parse origin/master
```
This will show you the commit ID of the tip of the `master` branch of the `origin` origin, *as your local repository is currently aware.* This may mean that the commit is someone e... |
17041317 | Undo git fast forward merge | 22 | 2013-06-11 09:54:54 | <p>I have this situation :
Working on some testBranch for some time and I wanted to sync with master so I did
git checkout testBranch and
git merge master/testBranch</p>
<p>So now my branch is synced with master but then I found out that I want to undo that merge and problem is that merge is done with fast forward an... | 8,747 | 1,441,771 | 2016-06-27 20:46:07 | 32,783,586 | 44 | 2015-09-25 13:42:06 | 775,138 | 2016-06-27 20:46:07 | https://stackoverflow.com/q/17041317 | https://stackoverflow.com/a/32783586 | <p><code>git reflog show testBranch</code></p>
<p>should show the Fast-forward merge as last item (<code>{0}</code>).
After making sure this is the case, checkout <code>testBranch</code> and then just do</p>
<p><code>git reset --keep testBranch@{1}</code></p>
<p>to revert to the previous state.</p>
| <p><code>git reflog show testBranch</code></p> <p>should show the Fast-forward merge as last item (<code>{0}</code>). After making sure this is the case, checkout <code>testBranch</code> and then just do</p> <p><code>git reset --keep testBranch@{1}</code></p> <p>to revert to the previous state.</p> | 119, 28897, 52842 | fast-forward, git, git-merge | <h1>Undo git fast forward merge</h1>
<p>I have this situation :
Working on some testBranch for some time and I wanted to sync with master so I did
git checkout testBranch and
git merge master/testBranch</p>
<p>So now my branch is synced with master but then I found out that I want to undo that merge and problem is th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,775 | git | # Undo git fast forward merge
I have this situation :
Working on some testBranch for some time and I wanted to sync with master so I did
git checkout testBranch and
git merge master/testBranch
So now my branch is synced with master but then I found out that I want to undo that merge and problem is that merge is done ... | `git reflog show testBranch`
should show the Fast-forward merge as last item (`{0}`).
After making sure this is the case, checkout `testBranch` and then just do
`git reset --keep testBranch@{1}`
to revert to the previous state. |
24315115 | Git: Can't delete remote branch permanently | 21 | 2014-06-19 19:49:39 | <p>I know this has been asked, I've seen so my responses on it, but nothing seems to work.</p>
<p>Here was my workflow. Create a new branch and work on it. Sometimes I use multiple computers so I pushed it to remote so that I could get it elsewhere</p>
<pre><code>git branch new_branch
git checkout new_branch
git push... | 29,244 | 1,272,355 | 2019-10-30 10:30:53 | 24,315,334 | 44 | 2014-06-19 20:02:36 | 46,194 | 2014-06-19 20:10:56 | https://stackoverflow.com/q/24315115 | https://stackoverflow.com/a/24315334 | <p>You have to do this to remove the branch <em>on the remote</em>.</p>
<pre><code>git push origin --delete new_branch
</code></pre>
<p>This will remove the branch called <code>new_branch</code> from the remote repository. (The <code>new_branch</code> is a local branch on the remote. To put it another way, if you cou... | <p>You have to do this to remove the branch <em>on the remote</em>.</p> <pre><code>git push origin --delete new_branch </code></pre> <p>This will remove the branch called <code>new_branch</code> from the remote repository. (The <code>new_branch</code> is a local branch on the remote. To put it another way, if you cou... | 119, 1879 | branch, git | <h1>Git: Can't delete remote branch permanently</h1>
<p>I know this has been asked, I've seen so my responses on it, but nothing seems to work.</p>
<p>Here was my workflow. Create a new branch and work on it. Sometimes I use multiple computers so I pushed it to remote so that I could get it elsewhere</p>
<pre><code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,776 | git | # Git: Can't delete remote branch permanently
I know this has been asked, I've seen so my responses on it, but nothing seems to work.
Here was my workflow. Create a new branch and work on it. Sometimes I use multiple computers so I pushed it to remote so that I could get it elsewhere
```
git branch new_branch
git ch... | You have to do this to remove the branch *on the remote*.
```
git push origin --delete new_branch
```
This will remove the branch called `new_branch` from the remote repository. (The `new_branch` is a local branch on the remote. To put it another way, if you could cd into the remote repository, making it the local re... |
1356233 | fatal: git-write-tree: error building trees | 21 | 2009-08-31 07:25:38 | <p>I'm trying to import a large subversion repository into git using git-svn (so that I can work in git but still dcommit to subversion from time to time). After importing more than 4000 revisions I'm now getting the following error whenever I run <code>git svn fetch</code> or <code>git svn rebase</code>, which I don't... | 15,482 | 30,703 | 2015-10-23 16:30:21 | 1,436,386 | 44 | 2009-09-17 02:04:35 | 174,710 | 2015-10-23 16:30:21 | https://stackoverflow.com/q/1356233 | https://stackoverflow.com/a/1436386 | <p><code>git svn gc</code></p>
<p>(possibly <code>git gc</code> and <code>git prune</code> before)</p>
| <p><code>git svn gc</code></p> <p>(possibly <code>git gc</code> and <code>git prune</code> before)</p> | 119, 6452, 10816, 21628 | corruption, git, git-svn, msysgit | <h1>fatal: git-write-tree: error building trees</h1>
<p>I'm trying to import a large subversion repository into git using git-svn (so that I can work in git but still dcommit to subversion from time to time). After importing more than 4000 revisions I'm now getting the following error whenever I run <code>git svn fetch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,778 | git | # fatal: git-write-tree: error building trees
I'm trying to import a large subversion repository into git using git-svn (so that I can work in git but still dcommit to subversion from time to time). After importing more than 4000 revisions I'm now getting the following error whenever I run `git svn fetch` or `git svn ... | `git svn gc`
(possibly `git gc` and `git prune` before) |
48497590 | Fork is not a heroku command | 20 | 2018-01-29 09:02:31 | <p>I'm trying to change my Heroku app region by following this official guide: <a href="https://devcenter.heroku.com/articles/app-migration" rel="noreferrer">https://devcenter.heroku.com/articles/app-migration</a>. </p>
<p>The problem is that, when I try to fork it at the very beginning using: <code>heroku fork --from... | 4,057 | 4,788,165 | 2018-02-11 05:07:47 | 48,498,209 | 44 | 2018-01-29 09:38:57 | 4,172,515 | 2018-02-11 05:07:47 | https://stackoverflow.com/q/48497590 | https://stackoverflow.com/a/48498209 | <p><strong>heroku-fork says</strong></p>
<p>Heroku CLI plugin to fork an existing app into a new app.</p>
<p><strong>DEPRECATED:</strong> Heroku fork is deprecated as a core command. It will no longer be included in the CLI by default 2017-12-01. See <a href="https://devcenter.heroku.com/articles/developing-cli-plugi... | <p><strong>heroku-fork says</strong></p> <p>Heroku CLI plugin to fork an existing app into a new app.</p> <p><strong>DEPRECATED:</strong> Heroku fork is deprecated as a core command. It will no longer be included in the CLI by default 2017-12-01. See <a href="https://devcenter.heroku.com/articles/developing-cli-plugi... | 119, 4984, 8279, 124840 | git, heroku, heroku-cli, ruby-on-rails | <h1>Fork is not a heroku command</h1>
<p>I'm trying to change my Heroku app region by following this official guide: <a href="https://devcenter.heroku.com/articles/app-migration" rel="noreferrer">https://devcenter.heroku.com/articles/app-migration</a>. </p>
<p>The problem is that, when I try to fork it at the very beg... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,779 | git | # Fork is not a heroku command
I'm trying to change my Heroku app region by following this official guide: <https://devcenter.heroku.com/articles/app-migration>.
The problem is that, when I try to fork it at the very beginning using: `heroku fork --from sourceapp --to targetapp --region eu`.
Heroku cli returns:
```... | **heroku-fork says**
Heroku CLI plugin to fork an existing app into a new app.
**DEPRECATED:** Heroku fork is deprecated as a core command. It will no longer be included in the CLI by default 2017-12-01. See [Developing CLI Plugins](https://devcenter.heroku.com/articles/developing-cli-plugins) for more information on... |
12768502 | How do I log unique authors in git? | 20 | 2012-10-07 11:42:18 | <p>I have a big project with many authors. </p>
<p>For example, </p>
<pre><code>user1 - commit1
user2 - commit2
user1 - commit3
</code></pre>
<p>I want to get all unique authors.
The result must be <strong><em>user1 user2</em></strong></p>
<p>How do I log unique authors in git?</p>
| 5,293 | 499,825 | 2020-07-04 14:15:26 | 12,768,586 | 44 | 2012-10-07 11:54:37 | 499,449 | 2012-10-07 11:54:37 | https://stackoverflow.com/q/12768502 | https://stackoverflow.com/a/12768586 | <p>Here's one easy way:</p>
<pre><code>git log --format="%an" | sort -u
</code></pre>
| <p>Here's one easy way:</p> <pre><code>git log --format="%an" | sort -u </code></pre> | 119 | git | <h1>How do I log unique authors in git?</h1>
<p>I have a big project with many authors. </p>
<p>For example, </p>
<pre><code>user1 - commit1
user2 - commit2
user1 - commit3
</code></pre>
<p>I want to get all unique authors.
The result must be <strong><em>user1 user2</em></strong></p>
<p>How do I log unique author... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,780 | git | # How do I log unique authors in git?
I have a big project with many authors.
For example,
```
user1 - commit1
user2 - commit2
user1 - commit3
```
I want to get all unique authors.
The result must be ***user1 user2***
How do I log unique authors in git? | Here's one easy way:
```
git log --format="%an" | sort -u
``` |
1112622 | Git repository not exported: fatal: The remote end hung up unexpectedly | 20 | 2009-07-11 01:00:12 | <p>Setting up new git installations.</p>
<p>On one Windows laptop, I'm running (under cygwin): </p>
<pre><code>git daemon --base-path=/cygdrive/c/work/proj/
</code></pre>
<p>My project's root is c:\work\proj\proj1. There is a c:\work\proj\proj1\.git directory.<br>
git-daemon-export-ok exists in c:\work\proj\proj... | 16,144 | 107,037 | 2021-07-01 00:08:28 | 1,112,631 | 44 | 2009-07-11 01:05:52 | 954 | 2011-01-25 13:55:20 | https://stackoverflow.com/q/1112622 | https://stackoverflow.com/a/1112631 | <p>You need to create the <strong>git-daemon-export-ok</strong> file in the <code>.git</code> directory. Don't commit it into the repository along with your code, but just create an empty file with that name along with the <code>branches</code>, <code>hooks</code>, <code>info</code>, etc. directories.</p>
| <p>You need to create the <strong>git-daemon-export-ok</strong> file in the <code>.git</code> directory. Don't commit it into the repository along with your code, but just create an empty file with that name along with the <code>branches</code>, <code>hooks</code>, <code>info</code>, etc. directories.</p> | 119, 456 | git, version-control | <h1>Git repository not exported: fatal: The remote end hung up unexpectedly</h1>
<p>Setting up new git installations.</p>
<p>On one Windows laptop, I'm running (under cygwin): </p>
<pre><code>git daemon --base-path=/cygdrive/c/work/proj/
</code></pre>
<p>My project's root is c:\work\proj\proj1. There is a c:\wor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,782 | git | # Git repository not exported: fatal: The remote end hung up unexpectedly
Setting up new git installations.
On one Windows laptop, I'm running (under cygwin):
```
git daemon --base-path=/cygdrive/c/work/proj/
```
My project's root is c:\work\proj\proj1. There is a c:\work\proj\proj1\.git directory.
git-daemon-exp... | You need to create the **git-daemon-export-ok** file in the `.git` directory. Don't commit it into the repository along with your code, but just create an empty file with that name along with the `branches`, `hooks`, `info`, etc. directories. |
45957377 | Git pull error "unable to update local ref" how to fix this? | 18 | 2017-08-30 10:00:33 | <p>This is the error message :</p>
<pre><code> error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference 'refs/remotes/origin/master': reference broken
From https://bitbucket.org/abc/abc
! [new branch] master -> origin/master (unable to update local ref)
</code></pre>
<p... | 32,512 | 8,374,731 | 2018-12-06 22:54:02 | 45,959,746 | 44 | 2017-08-30 11:54:24 | 2,298,137 | 2018-12-06 22:54:02 | https://stackoverflow.com/q/45957377 | https://stackoverflow.com/a/45959746 | <p>It sounds like your ref to the origin/master branch is broken or corrupt.</p>
<p>First - take a copy of your local repo.</p>
<p>You can do two things (that I know of):</p>
<ol>
<li><p>Delete the ref to master and then do a fetch (to get the latest):
<code>
cd <path-to-your-repo>
rm .git/refs/remotes/origin/... | <p>It sounds like your ref to the origin/master branch is broken or corrupt.</p> <p>First - take a copy of your local repo.</p> <p>You can do two things (that I know of):</p> <ol> <li><p>Delete the ref to master and then do a fetch (to get the latest): <code> cd <path-to-your-repo> rm .git/refs/remotes/origin/... | 119, 90056 | atlassian-sourcetree, git | <h1>Git pull error "unable to update local ref" how to fix this?</h1>
<p>This is the error message :</p>
<pre><code> error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference 'refs/remotes/origin/master': reference broken
From https://bitbucket.org/abc/abc
! [new branch] master ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,784 | git | # Git pull error "unable to update local ref" how to fix this?
This is the error message :
```
error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference 'refs/remotes/origin/master': reference broken
From https://bitbucket.org/abc/abc
! [new branch] master -> origin/master ... | It sounds like your ref to the origin/master branch is broken or corrupt.
First - take a copy of your local repo.
You can do two things (that I know of):
1. Delete the ref to master and then do a fetch (to get the latest):
`cd <path-to-your-repo>
rm .git/refs/remotes/origin/master
git fetch`
2. Try using th... |
6926323 | Git Fundamentals - Merging back into master | 18 | 2011-08-03 12:17:57 | <p>I'm new to git.</p>
<p>I made a branch, did my changes, and now I want to merge back to master to make them "permanent".</p>
<p>So I did <code>git merge 1.2</code> which reported as already up-to-date, did the same on master to the same result, and tried <code>merge -v HEAD master</code> which gave me a slightly d... | 7,102 | 359,380 | 2011-08-03 12:23:10 | 6,926,362 | 44 | 2011-08-03 12:21:17 | 211,659 | 2011-08-03 12:21:17 | https://stackoverflow.com/q/6926323 | https://stackoverflow.com/a/6926362 | <p>You need to be on the master branch to merge into it.</p>
<pre><code>git checkout master
git merge some_development_effort
</code></pre>
| <p>You need to be on the master branch to merge into it.</p> <pre><code>git checkout master git merge some_development_effort </code></pre> | 119 | git | <h1>Git Fundamentals - Merging back into master</h1>
<p>I'm new to git.</p>
<p>I made a branch, did my changes, and now I want to merge back to master to make them "permanent".</p>
<p>So I did <code>git merge 1.2</code> which reported as already up-to-date, did the same on master to the same result, and tried <code>m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,786 | git | # Git Fundamentals - Merging back into master
I'm new to git.
I made a branch, did my changes, and now I want to merge back to master to make them "permanent".
So I did `git merge 1.2` which reported as already up-to-date, did the same on master to the same result, and tried `merge -v HEAD master` which gave me a sl... | You need to be on the master branch to merge into it.
```
git checkout master
git merge some_development_effort
``` |
41245475 | Differences between the staged and unstaged versions of the same file, using difftool | 17 | 2016-12-20 15:10:21 | <p>Is there a way of viewing the differences between the <code>staged</code> and <code>unstaged</code> versions of the same file?</p>
<p>For example:</p>
<pre><code>Changes to be committed:
modified: conf/application.conf
Changes not staged for commit:
(use "git add/rm <file>..." to update what will b... | 16,222 | 1,410,452 | 2018-04-10 16:46:19 | 41,249,720 | 44 | 2016-12-20 19:19:41 | 4,522,186 | 2018-04-10 16:46:19 | https://stackoverflow.com/q/41245475 | https://stackoverflow.com/a/41249720 | <p><code>git diff</code> will show the difference between your workspace and the index.
(the index is where the staged files live)</p>
<p>This may not seem obvious because we usually use <code>git diff</code> to see the changes in the workspace vs what is checked in. However, technically <code>git diff</code> shows... | <p><code>git diff</code> will show the difference between your workspace and the index. (the index is where the staged files live)</p> <p>This may not seem obvious because we usually use <code>git diff</code> to see the changes in the workspace vs what is checked in. However, technically <code>git diff</code> shows... | 119, 606, 9033, 33608, 74978 | diff, difftool, git, git-diff, git-stage | <h1>Differences between the staged and unstaged versions of the same file, using difftool</h1>
<p>Is there a way of viewing the differences between the <code>staged</code> and <code>unstaged</code> versions of the same file?</p>
<p>For example:</p>
<pre><code>Changes to be committed:
modified: conf/application... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,787 | git | # Differences between the staged and unstaged versions of the same file, using difftool
Is there a way of viewing the differences between the `staged` and `unstaged` versions of the same file?
For example:
```
Changes to be committed:
modified: conf/application.conf
Changes not staged for commit:
(use "git... | `git diff` will show the difference between your workspace and the index.
(the index is where the staged files live)
This may not seem obvious because we usually use `git diff` to see the changes in the workspace vs what is checked in. However, technically `git diff` shows workspace vs index, and if you haven't added ... |
28669961 | Git open default git editor instead of VIM or any other editor (Git Rebase) | 13 | 2015-02-23 08:57:14 | <p>I recently installed Vim. Now, when I rebase my branch in interactive mode, Git automatically opens Vim.</p>
<p>However, I do not want to open Vim in interactive mode; instead, I want to open default Git interactive mode editor. How can I set the default interactive editor used by Git?</p>
| 21,129 | 1,153,551 | 2022-05-09 19:06:10 | 28,670,018 | 44 | 2015-02-23 09:01:19 | 4,227,313 | 2022-05-09 19:06:10 | https://stackoverflow.com/q/28669961 | https://stackoverflow.com/a/28670018 | <p>I think what you want is to use nano (which is the default text editor on Ubuntu), you can set that up by:</p>
<pre><code>git config --global core.editor "nano"
</code></pre>
<p>or</p>
<pre><code>git config --global core.editor "vim"
</code></pre>
| <p>I think what you want is to use nano (which is the default text editor on Ubuntu), you can set that up by:</p> <pre><code>git config --global core.editor "nano" </code></pre> <p>or</p> <pre><code>git config --global core.editor "vim" </code></pre> | 119, 370, 84381 | git, git-interactive-rebase, vim | <h1>Git open default git editor instead of VIM or any other editor (Git Rebase)</h1>
<p>I recently installed Vim. Now, when I rebase my branch in interactive mode, Git automatically opens Vim.</p>
<p>However, I do not want to open Vim in interactive mode; instead, I want to open default Git interactive mode editor. Ho... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,791 | git | # Git open default git editor instead of VIM or any other editor (Git Rebase)
I recently installed Vim. Now, when I rebase my branch in interactive mode, Git automatically opens Vim.
However, I do not want to open Vim in interactive mode; instead, I want to open default Git interactive mode editor. How can I set the ... | I think what you want is to use nano (which is the default text editor on Ubuntu), you can set that up by:
```
git config --global core.editor "nano"
```
or
```
git config --global core.editor "vim"
``` |
25933056 | How can I do a bugfix on master and integrate it into my less stable branch(es)? | 11 | 2014-09-19 11:36:41 | <p>I'm using Git for one of my projects at the moment, and I love it.</p>
<p>However, because I'm the only one working on my project, the only commands I've been using are</p>
<pre><code>git status
git add .
git commit -m 'message here'
git push origin master
</code></pre>
<p>I have pushed the project to remote a lo... | 10,743 | 4,037,042 | 2025-02-08 15:04:02 | 25,934,341 | 44 | 2014-09-19 12:49:57 | 2,541,573 | 2022-05-24 19:48:39 | https://stackoverflow.com/q/25933056 | https://stackoverflow.com/a/25934341 | <p>This is a classic case in which you can take advantage of Git branches. Here is the workflow you should use.</p>
<p>Let's say you've created a <code>develop</code> branch stemming from <code>master</code> and you've made a few commits on that branch:</p>
<p><img src="https://i.sstatic.net/9DX3H.png" alt="enter image... | <p>This is a classic case in which you can take advantage of Git branches. Here is the workflow you should use.</p> <p>Let's say you've created a <code>develop</code> branch stemming from <code>master</code> and you've made a few commits on that branch:</p> <p><img src="https://i.sstatic.net/9DX3H.png" alt="enter image... | 119, 64464 | branching-strategy, git | <h1>How can I do a bugfix on master and integrate it into my less stable branch(es)?</h1>
<p>I'm using Git for one of my projects at the moment, and I love it.</p>
<p>However, because I'm the only one working on my project, the only commands I've been using are</p>
<pre><code>git status
git add .
git commit -m 'messa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,792 | git | # How can I do a bugfix on master and integrate it into my less stable branch(es)?
I'm using Git for one of my projects at the moment, and I love it.
However, because I'm the only one working on my project, the only commands I've been using are
```
git status
git add .
git commit -m 'message here'
git push origin ma... | This is a classic case in which you can take advantage of Git branches. Here is the workflow you should use.
Let's say you've created a `develop` branch stemming from `master` and you've made a few commits on that branch:

Suddenly, you realise that the... |
20390267 | Installing Openstack errors | 11 | 2013-12-05 02:30:54 | <p>I have no experience in openstack and would appreciate anyone who can help and guide me with this issue. I'm installing openstack in virtual environment (Ubuntu 12.04) and this came out:</p>
<blockquote>
<ul>
<li>git clone git//git.openstack.org/openstack/requirements.git/opt/stack/reqiurements
Cloning into '... | 26,035 | 1,684,769 | 2020-02-07 07:29:23 | 20,629,692 | 44 | 2013-12-17 08:53:09 | 3,069,871 | 2014-01-07 18:05:30 | https://stackoverflow.com/q/20390267 | https://stackoverflow.com/a/20629692 | <p>I had the same problem, the git protocol is blocked in my testing environment.</p>
<p>The solution is to modify the <strong>sourcerc</strong> file in the devstack installation folder to use <strong>https</strong> instead of <strong>git</strong>. You have to look for that line and change it. This file is also known ... | <p>I had the same problem, the git protocol is blocked in my testing environment.</p> <p>The solution is to modify the <strong>sourcerc</strong> file in the devstack installation folder to use <strong>https</strong> instead of <strong>git</strong>. You have to look for that line and change it. This file is also known ... | 119, 68631, 89474 | devstack, git, openstack | <h1>Installing Openstack errors</h1>
<p>I have no experience in openstack and would appreciate anyone who can help and guide me with this issue. I'm installing openstack in virtual environment (Ubuntu 12.04) and this came out:</p>
<blockquote>
<ul>
<li>git clone git//git.openstack.org/openstack/requirements.git/op... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,793 | git | # Installing Openstack errors
I have no experience in openstack and would appreciate anyone who can help and guide me with this issue. I'm installing openstack in virtual environment (Ubuntu 12.04) and this came out:
> - git clone git//git.openstack.org/openstack/requirements.git/opt/stack/reqiurements
> Cloning in... | I had the same problem, the git protocol is blocked in my testing environment.
The solution is to modify the **sourcerc** file in the devstack installation folder to use **https** instead of **git**. You have to look for that line and change it. This file is also known as the **local.conf** file.
Default setting in s... |
11579311 | GIT commit as different user without email / or only email | 174 | 2012-07-20 12:23:15 | <p>I'm trying to commit some changes as a different user, but i do not have a valid email address, following command is not working for me:</p>
<pre><code>git commit --author="john doe" -m "some fix"
fatal: No existing author found with 'john doe'
</code></pre>
<p>I have the same problem when trying to commit with on... | 229,477 | 867,294 | 2023-07-29 13:57:12 | 11,612,125 | 43 | 2012-07-23 12:01:37 | 867,294 | 2015-11-19 19:54:06 | https://stackoverflow.com/q/11579311 | https://stackoverflow.com/a/11612125 | <p>The </p>
<blockquote>
<p><em>standard</em> A U Thor <author@example.com> format</p>
</blockquote>
<p>Seems to be defined as followed:
( as far as i know, with absolutely no warranty )</p>
<p>A U Thor = <strong>required username</strong></p>
<ul>
<li>The separation of the characters <em>probably</em> ind... | <p>The </p> <blockquote> <p><em>standard</em> A U Thor <author@example.com> format</p> </blockquote> <p>Seems to be defined as followed: ( as far as i know, with absolutely no warranty )</p> <p>A U Thor = <strong>required username</strong></p> <ul> <li>The separation of the characters <em>probably</em> ind... | 119, 5597 | commit, git | <h1>GIT commit as different user without email / or only email</h1>
<p>I'm trying to commit some changes as a different user, but i do not have a valid email address, following command is not working for me:</p>
<pre><code>git commit --author="john doe" -m "some fix"
fatal: No existing author found with 'john doe'
</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,795 | git | # GIT commit as different user without email / or only email
I'm trying to commit some changes as a different user, but i do not have a valid email address, following command is not working for me:
```
git commit --author="john doe" -m "some fix"
fatal: No existing author found with 'john doe'
```
I have the same pr... | The
> *standard* A U Thor <author@example.com> format
Seems to be defined as followed:
( as far as i know, with absolutely no warranty )
A U Thor = **required username**
- The separation of the characters *probably* indicates that spaces are allowed, it could also be resembling initials.
- The username has to be fo... |
44366417 | What is the point of 'git submodule init'? | 164 | 2017-06-05 10:02:31 | <h3>Background</h3>
<p>To populate a repository's submodules, one <a href="https://stackoverflow.com/a/3796947">typically invokes</a>:</p>
<pre><code>git submodule init
git submodule update
</code></pre>
<p>In this usage, <code>git submodule init</code> seems to do only one thing: populate <code>.git/config</code> w... | 193,806 | null | 2025-06-09 23:46:59 | 44,367,364 | 43 | 2017-06-05 10:53:12 | null | 2017-10-05 17:18:35 | https://stackoverflow.com/q/44366417 | https://stackoverflow.com/a/44367364 | <p>Reading the <code>git submodule</code> <a href="https://git-scm.com/docs/git-submodule" rel="noreferrer">documentation</a>, there <em>is</em> a use-case that ostensibly justifies the existence of <code>git submodule init</code> as a standalone command.</p>
<p>If a user who has cloned a repository wishes to use a di... | <p>Reading the <code>git submodule</code> <a href="https://git-scm.com/docs/git-submodule" rel="noreferrer">documentation</a>, there <em>is</em> a use-case that ostensibly justifies the existence of <code>git submodule init</code> as a standalone command.</p> <p>If a user who has cloned a repository wishes to use a di... | 119, 41612 | git, git-submodules | <h1>What is the point of 'git submodule init'?</h1>
<h3>Background</h3>
<p>To populate a repository's submodules, one <a href="https://stackoverflow.com/a/3796947">typically invokes</a>:</p>
<pre><code>git submodule init
git submodule update
</code></pre>
<p>In this usage, <code>git submodule init</code> seems to do... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,796 | git | # What is the point of 'git submodule init'?
### Background
To populate a repository's submodules, one [typically invokes](https://stackoverflow.com/a/3796947):
```
git submodule init
git submodule update
```
In this usage, `git submodule init` seems to do only one thing: populate `.git/config` with information tha... | Reading the `git submodule` [documentation](https://git-scm.com/docs/git-submodule), there *is* a use-case that ostensibly justifies the existence of `git submodule init` as a standalone command.
If a user who has cloned a repository wishes to use a different URL for a submodule than is specified by the upstream repos... |
36086202 | Git merge is not possible because I have unmerged files | 141 | 2016-03-18 13:53:01 | <p>git continues to confuse me with its unhelpful error warnings This one really deserves a prize:</p>
<pre><code>git merge is not possible because you have unmerged files
</code></pre>
<p>My situation: My master branch on github was edited (directly in the browser) while my local master branch was also edited.</p>
... | 428,421 | 1,083,572 | 2025-12-12 18:20:12 | 36,086,226 | 43 | 2016-03-18 13:54:14 | 2,295,034 | 2016-03-18 13:54:14 | https://stackoverflow.com/q/36086202 | https://stackoverflow.com/a/36086226 | <p>The error message: </p>
<blockquote>
<p>merge: remote/master - not something we can merge</p>
</blockquote>
<p>is saying that Git doesn't recognize <code>remote/master</code>. This is probably because you don't have a "remote" named "remote". You have a "remote" named "origin".</p>
<p>Think of "remotes" as an a... | <p>The error message: </p> <blockquote> <p>merge: remote/master - not something we can merge</p> </blockquote> <p>is saying that Git doesn't recognize <code>remote/master</code>. This is probably because you don't have a "remote" named "remote". You have a "remote" named "origin".</p> <p>Think of "remotes" as an a... | 119, 717 | git, merge | <h1>Git merge is not possible because I have unmerged files</h1>
<p>git continues to confuse me with its unhelpful error warnings This one really deserves a prize:</p>
<pre><code>git merge is not possible because you have unmerged files
</code></pre>
<p>My situation: My master branch on github was edited (directly in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,797 | git | # Git merge is not possible because I have unmerged files
git continues to confuse me with its unhelpful error warnings This one really deserves a prize:
```
git merge is not possible because you have unmerged files
```
My situation: My master branch on github was edited (directly in the browser) while my local mast... | The error message:
> merge: remote/master - not something we can merge
is saying that Git doesn't recognize `remote/master`. This is probably because you don't have a "remote" named "remote". You have a "remote" named "origin".
Think of "remotes" as an alias for the url to your Git server. `master` is your locally c... |
1704907 | How can I get my C code to automatically print out its Git version hash? | 103 | 2009-11-10 00:30:55 | <p>Is there an easy way to write C code that can access its Git version hash? </p>
<p>I wrote software in C to collect scientific data in a laboratory setting. My code records the data it collects in a .yaml file for later analysis. My experiments change from day-to-day and I often have to modify the code. To keep tra... | 67,977 | 200,688 | 2025-11-05 14:30:59 | 1,705,263 | 43 | 2009-11-10 02:18:15 | null | 2013-01-27 20:43:33 | https://stackoverflow.com/q/1704907 | https://stackoverflow.com/a/1705263 | <p>In my program, I hold the git version number and the date of the build in a separate file, called <code>version.c</code>, which looks like this:</p>
<pre><code>#include "version.h"
const char * build_date = "2009-11-10 11:09";
const char * build_git_sha = "6b54ea36e92d4907aba8b3fade7f2d58a921b6cd";
</code></pre>
<... | <p>In my program, I hold the git version number and the date of the build in a separate file, called <code>version.c</code>, which looks like this:</p> <pre><code>#include "version.h" const char * build_date = "2009-11-10 11:09"; const char * build_git_sha = "6b54ea36e92d4907aba8b3fade7f2d58a921b6cd"; </code></pre> <... | 8, 119, 456, 758 | c, git, version-control, workflow | <h1>How can I get my C code to automatically print out its Git version hash?</h1>
<p>Is there an easy way to write C code that can access its Git version hash? </p>
<p>I wrote software in C to collect scientific data in a laboratory setting. My code records the data it collects in a .yaml file for later analysis. My e... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,798 | git | # How can I get my C code to automatically print out its Git version hash?
Is there an easy way to write C code that can access its Git version hash?
I wrote software in C to collect scientific data in a laboratory setting. My code records the data it collects in a .yaml file for later analysis. My experiments change... | In my program, I hold the git version number and the date of the build in a separate file, called `version.c`, which looks like this:
```
#include "version.h"
const char * build_date = "2009-11-10 11:09";
const char * build_git_sha = "6b54ea36e92d4907aba8b3fade7f2d58a921b6cd";
```
There is also a header file, which l... |
42383273 | Get git branch name in Jenkins Pipeline/Jenkinsfile | 94 | 2017-02-22 05:18:40 | <p>I've create a jenkins pipeline and it is pulling the pipeline script from scm.<br>
I set the branch specifier to '<code>all</code>', so it builds on any change to any branch. </p>
<p>How do I access the branch name causing this build from the Jenkinsfile? </p>
<p>Everything I have tried echos out null except </p>... | 280,199 | 3,577,332 | 2024-07-26 06:27:19 | 42,383,691 | 43 | 2017-02-22 05:52:32 | 6,309 | 2017-02-22 07:51:06 | https://stackoverflow.com/q/42383273 | https://stackoverflow.com/a/42383691 | <p>If you have a jenkinsfile for your pipeline, check if you see at execution time your branch name in your <a href="https://jenkins.io/doc/pipeline/tour/environment/" rel="noreferrer">environment variables</a>.</p>
<p>You can print them with:</p>
<pre><code>pipeline {
agent any
environment {
DISABLE... | <p>If you have a jenkinsfile for your pipeline, check if you see at execution time your branch name in your <a href="https://jenkins.io/doc/pipeline/tour/environment/" rel="noreferrer">environment variables</a>.</p> <p>You can print them with:</p> <pre><code>pipeline { agent any environment { DISABLE... | 119, 1879, 64999, 118285 | branch, git, jenkins, jenkins-pipeline | <h1>Get git branch name in Jenkins Pipeline/Jenkinsfile</h1>
<p>I've create a jenkins pipeline and it is pulling the pipeline script from scm.<br>
I set the branch specifier to '<code>all</code>', so it builds on any change to any branch. </p>
<p>How do I access the branch name causing this build from the Jenkinsfile?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,799 | git | # Get git branch name in Jenkins Pipeline/Jenkinsfile
I've create a jenkins pipeline and it is pulling the pipeline script from scm.
I set the branch specifier to '`all`', so it builds on any change to any branch.
How do I access the branch name causing this build from the Jenkinsfile?
Everything I have tried echo... | If you have a jenkinsfile for your pipeline, check if you see at execution time your branch name in your [environment variables](https://jenkins.io/doc/pipeline/tour/environment/).
You can print them with:
```
pipeline {
agent any
environment {
DISABLE_AUTH = 'true'
DB_ENGINE = 'sqlite'
... |
4025708 | git: can't push (unpacker error) related to permission issues | 74 | 2010-10-26 16:25:02 | <p>I have this problem when I try to push in Git:</p>
<pre><code>error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://<repo url>/<repo dir>
! [remote rejected] master -> master (n/a... | 168,232 | 138,557 | 2024-11-16 19:00:19 | 18,196,948 | 43 | 2013-08-12 21:26:18 | 1,259,614 | 2017-11-20 15:39:41 | https://stackoverflow.com/q/4025708 | https://stackoverflow.com/a/18196948 | <p>I had this error for two weeks, and the majority of the solutions stated 'chmod -R' as the the answer, unfortunately for me my git repos (local / remote / shared - with team) were all on Windows OS, and even though chmod -Rv showed all the files changed to 'rwxrwxrwx', a subsequent 'ls -l' still showed all files as ... | <p>I had this error for two weeks, and the majority of the solutions stated 'chmod -R' as the the answer, unfortunately for me my git repos (local / remote / shared - with team) were all on Windows OS, and even though chmod -Rv showed all the files changed to 'rwxrwxrwx', a subsequent 'ls -l' still showed all files as ... | 58, 119 | git, linux | <h1>git: can't push (unpacker error) related to permission issues</h1>
<p>I have this problem when I try to push in Git:</p>
<pre><code>error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://<repo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,800 | git | # git: can't push (unpacker error) related to permission issues
I have this problem when I try to push in Git:
```
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://<repo url>/<repo dir>
! [r... | I had this error for two weeks, and the majority of the solutions stated 'chmod -R' as the the answer, unfortunately for me my git repos (local / remote / shared - with team) were all on Windows OS, and even though chmod -Rv showed all the files changed to 'rwxrwxrwx', a subsequent 'ls -l' still showed all files as 'rw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.