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
34269864
Amend commit message from older commits using SHA ID
8
2015-12-14 14:47:25
<p>Let's assume i have 3 commits:</p> <pre><code>Added bar.txt (3) Second Commit (2) Initial Commit (1) </code></pre> <p>How can i change the commit message from <code>(2)</code> by using its SHA ID? The commit was not pushed to the remote repository yet.</p> <p>I tried: <code>git commit --amend -m "Added...
3,365
4,684,797
2024-01-23 11:52:03
34,269,929
11
2015-12-14 14:50:16
177,053
2015-12-18 11:11:31
https://stackoverflow.com/q/34269864
https://stackoverflow.com/a/34269929
<p>Do an interactive rebase, it is described in <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History" rel="noreferrer">https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History</a></p> <pre><code>git rebase -i HEAD~2 </code></pre> <p>Mark all as 'pick'(just retain that commit) or 'reword' for changing...
<p>Do an interactive rebase, it is described in <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History" rel="noreferrer">https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History</a></p> <pre><code>git rebase -i HEAD~2 </code></pre> <p>Mark all as 'pick'(just retain that commit) or 'reword' for changing...
119, 5597
commit, git
<h1>Amend commit message from older commits using SHA ID</h1> <p>Let's assume i have 3 commits:</p> <pre><code>Added bar.txt (3) Second Commit (2) Initial Commit (1) </code></pre> <p>How can i change the commit message from <code>(2)</code> by using its SHA ID? The commit was not pushed to the remote repos...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,603
git
# Amend commit message from older commits using SHA ID Let's assume i have 3 commits: ``` Added bar.txt (3) Second Commit (2) Initial Commit (1) ``` How can i change the commit message from `(2)` by using its SHA ID? The commit was not pushed to the remote repository yet. I tried: `git commit --amend -m ...
Do an interactive rebase, it is described in <https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History> ``` git rebase -i HEAD~2 ``` Mark all as 'pick'(just retain that commit) or 'reword' for changing message. Note that all these commits will be rewritten, so it's better not to go deeper than `origin/HEAD` points ...
32751425
Is it safe to force push personal branch in git?
8
2015-09-24 00:14:13
<p>Suppose I work on a personal branch called <code>feature</code>.</p> <ol> <li>I make 5 commits.</li> <li>I rebase on top of master.</li> <li>I push my branch to a remote.</li> <li>I <code>git reset --hard</code> back to commit 3.</li> <li>I merge from master.</li> <li>I push to the remote (I have to use <code>-f</c...
1,877
4,119,095
2016-02-19 18:43:43
32,751,736
11
2015-09-24 00:55:13
1,256,452
2015-09-24 00:55:13
https://stackoverflow.com/q/32751425
https://stackoverflow.com/a/32751736
<p>You're safe enough, as long as it really is private, and you only push to the private branch; here's why.</p> <p>A branch is a specific kind of "reference", giving the ID of a commit.</p> <p>When you're pushing or fetching, you are asking your git to use your repo to talk with another git and another repo. With a...
<p>You're safe enough, as long as it really is private, and you only push to the private branch; here's why.</p> <p>A branch is a specific kind of "reference", giving the ID of a commit.</p> <p>When you're pushing or fetching, you are asking your git to use your repo to talk with another git and another repo. With a...
119, 456, 53850
git, git-commit, version-control
<h1>Is it safe to force push personal branch in git?</h1> <p>Suppose I work on a personal branch called <code>feature</code>.</p> <ol> <li>I make 5 commits.</li> <li>I rebase on top of master.</li> <li>I push my branch to a remote.</li> <li>I <code>git reset --hard</code> back to commit 3.</li> <li>I merge from master...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,606
git
# Is it safe to force push personal branch in git? Suppose I work on a personal branch called `feature`. 1. I make 5 commits. 2. I rebase on top of master. 3. I push my branch to a remote. 4. I `git reset --hard` back to commit 3. 5. I merge from master. 6. I push to the remote (I have to use `-f`). Is that safe to ...
You're safe enough, as long as it really is private, and you only push to the private branch; here's why. A branch is a specific kind of "reference", giving the ID of a commit. When you're pushing or fetching, you are asking your git to use your repo to talk with another git and another repo. With a `fetch` you ask y...
32729614
Git branch no tracking information
8
2015-09-23 01:29:57
<p>After git pull I get this output. </p> <pre><code>There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull &lt;remote&gt; &lt;branch&gt; If you wish to set tracking information for this branch you can do so with: git branch ...
17,451
1,649,887
2021-01-20 16:30:16
32,729,663
11
2015-09-23 01:37:45
762,073
2015-09-23 01:37:45
https://stackoverflow.com/q/32729614
https://stackoverflow.com/a/32729663
<p>This is because you didn't set the <code>upstream</code> (which means which remote branch you want to track).</p> <p><strong>To set the tracking remote branch:</strong></p> <p>If the local branch is created in your local machine, then when you push to the remote, you could use <code>-u</code>/<code>--set-upstream<...
<p>This is because you didn't set the <code>upstream</code> (which means which remote branch you want to track).</p> <p><strong>To set the tracking remote branch:</strong></p> <p>If the local branch is created in your local machine, then when you push to the remote, you could use <code>-u</code>/<code>--set-upstream<...
119
git
<h1>Git branch no tracking information</h1> <p>After git pull I get this output. </p> <pre><code>There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull &lt;remote&gt; &lt;branch&gt; If you wish to set tracking information for ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,607
git
# Git branch no tracking information After git pull I get this output. ``` There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: ...
This is because you didn't set the `upstream` (which means which remote branch you want to track). **To set the tracking remote branch:** If the local branch is created in your local machine, then when you push to the remote, you could use `-u`/`--set-upstream` option when you do `git push`. If the branch is checked...
31995829
How does git track changes to files
8
2015-08-13 18:29:13
<p>For the longest time I thought git commits keep diffs of changed files and not copies. Any information I could find states the contrary. I conducted a little experiment:</p> <pre><code>$ git init $ subl wtf </code></pre> <blockquote> <p>Here I create a file with 99 999 lines, each of which is <em>foo bar baz <st...
3,730
2,423,164
2015-08-13 19:21:36
31,996,121
11
2015-08-13 18:45:35
438,742
2015-08-13 19:01:40
https://stackoverflow.com/q/31995829
https://stackoverflow.com/a/31996121
<p>The git has object database. There is a type of object "blob" which is identified by sha1 of its content. So, it means, if you have a file of the same content anywhere in repository (branch/point of history/directory/etc) it will be stored in the database only once.</p> <p>There are two parts in the database, the <...
<p>The git has object database. There is a type of object "blob" which is identified by sha1 of its content. So, it means, if you have a file of the same content anywhere in repository (branch/point of history/directory/etc) it will be stored in the database only once.</p> <p>There are two parts in the database, the <...
119, 6796
git, internals
<h1>How does git track changes to files</h1> <p>For the longest time I thought git commits keep diffs of changed files and not copies. Any information I could find states the contrary. I conducted a little experiment:</p> <pre><code>$ git init $ subl wtf </code></pre> <blockquote> <p>Here I create a file with 99 99...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,608
git
# How does git track changes to files For the longest time I thought git commits keep diffs of changed files and not copies. Any information I could find states the contrary. I conducted a little experiment: ``` $ git init $ subl wtf ``` > Here I create a file with 99 999 lines, each of which is *foo bar baz **#line...
The git has object database. There is a type of object "blob" which is identified by sha1 of its content. So, it means, if you have a file of the same content anywhere in repository (branch/point of history/directory/etc) it will be stored in the database only once. There are two parts in the database, the `objects/??...
27023402
How to set default editor when using Git in Cygwin?
8
2014-11-19 17:41:12
<p>I am using the <code>Git</code> CLI in <code>Cygwin</code> on <code>Win7</code>. I have a problem when I issue a command that requires editor interaction, such as </p> <pre><code>git commit --amend </code></pre> <p>In Cygwin, the command simply hangs and I must do <code>Ctrl-Z</code> to get the next prompt. The ...
5,138
1,312,080
2014-11-20 16:38:55
27,024,442
11
2014-11-19 18:39:20
1,312,080
2014-11-19 18:39:20
https://stackoverflow.com/q/27023402
https://stackoverflow.com/a/27024442
<p>As per <a href="https://superuser.com/a/638907/134610">this answer</a>, I did the following:</p> <pre><code>git config --global core.editor "D:/homex/SFTWR/cygwin/bin/vi.exe" </code></pre> <p><code>D:/homex/SFTWR/cygwin</code> is the location of my <code>Cygwin</code> install. I am still perplexed why it is takin...
<p>As per <a href="https://superuser.com/a/638907/134610">this answer</a>, I did the following:</p> <pre><code>git config --global core.editor "D:/homex/SFTWR/cygwin/bin/vi.exe" </code></pre> <p><code>D:/homex/SFTWR/cygwin</code> is the location of my <code>Cygwin</code> install. I am still perplexed why it is takin...
119, 1731
cygwin, git
<h1>How to set default editor when using Git in Cygwin?</h1> <p>I am using the <code>Git</code> CLI in <code>Cygwin</code> on <code>Win7</code>. I have a problem when I issue a command that requires editor interaction, such as </p> <pre><code>git commit --amend </code></pre> <p>In Cygwin, the command simply hangs an...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,611
git
# How to set default editor when using Git in Cygwin? I am using the `Git` CLI in `Cygwin` on `Win7`. I have a problem when I issue a command that requires editor interaction, such as ``` git commit --amend ``` In Cygwin, the command simply hangs and I must do `Ctrl-Z` to get the next prompt. The commit does not go ...
As per [this answer](https://superuser.com/a/638907/134610), I did the following: ``` git config --global core.editor "D:/homex/SFTWR/cygwin/bin/vi.exe" ``` `D:/homex/SFTWR/cygwin` is the location of my `Cygwin` install. I am still perplexed why it is taking a Windows path when it's running in the Cygwin shell.
25993871
What is the difference between git-stash and git-checkout?
8
2014-09-23 11:24:34
<p>I try to go from one local branch to another one. Git tells me that I cannot do it because my <code>local changes to the following files would be overwritten by checkout</code>.</p> <p>Then I get a "recommendation" <code>Please, commit your changes or stash them before you can switch branches</code>.</p> <p>I know...
46,155
245,549
2018-04-05 05:37:03
25,993,943
11
2014-09-23 11:28:58
2,607,581
2015-06-10 05:36:25
https://stackoverflow.com/q/25993871
https://stackoverflow.com/a/25993943
<p>You cannot stash a single file explicitly. Had you run <code>git-stash</code> it would have stashed all your modifications.</p> <p><code>git checkout -- file</code> discards your changes to that file in working dir and checkout the version of that file recorded by the current commit (i.e. the one that HEAD points t...
<p>You cannot stash a single file explicitly. Had you run <code>git-stash</code> it would have stashed all your modifications.</p> <p><code>git checkout -- file</code> discards your changes to that file in working dir and checkout the version of that file recorded by the current commit (i.e. the one that HEAD points t...
119, 13091, 37230
git, git-checkout, git-stash
<h1>What is the difference between git-stash and git-checkout?</h1> <p>I try to go from one local branch to another one. Git tells me that I cannot do it because my <code>local changes to the following files would be overwritten by checkout</code>.</p> <p>Then I get a "recommendation" <code>Please, commit your changes...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,612
git
# What is the difference between git-stash and git-checkout? I try to go from one local branch to another one. Git tells me that I cannot do it because my `local changes to the following files would be overwritten by checkout`. Then I get a "recommendation" `Please, commit your changes or stash them before you can sw...
You cannot stash a single file explicitly. Had you run `git-stash` it would have stashed all your modifications. `git checkout -- file` discards your changes to that file in working dir and checkout the version of that file recorded by the current commit (i.e. the one that HEAD points to).
25527812
Git corrupted repo: how to pick a git object from a clean repository
8
2014-08-27 12:57:17
<p>This is one of the numerous questions regarding a Git repo that is corrupted, precisely a loose object that went wrong:</p> <pre><code>$ git gc Counting objects: 3299, done. error: inflate: data stream error (unknown compression method) error: unable to unpack 831a5d31af4a0af2f5a367689bee27a44efc22c9 header Delta c...
19,517
11,343
2016-03-23 21:21:43
25,527,813
11
2014-08-27 12:57:17
11,343
2016-03-23 21:21:43
https://stackoverflow.com/q/25527812
https://stackoverflow.com/a/25527813
<p><strong>If the file exists elsewhere</strong></p> <p>The object of the clean repository has been repacked, that's why it doesn't exist anymore as a file.</p> <p>To restore it, first save it as a file, from the clean repository, with </p> <pre><code>git show 831a5d31af4a0af2f5a367689bee27a44efc22c9 &gt; 831a5-file...
<p><strong>If the file exists elsewhere</strong></p> <p>The object of the clean repository has been repacked, that's why it doesn't exist anymore as a file.</p> <p>To restore it, first save it as a file, from the clean repository, with </p> <pre><code>git show 831a5d31af4a0af2f5a367689bee27a44efc22c9 &gt; 831a5-file...
119, 7330, 10816
corruption, git, repository
<h1>Git corrupted repo: how to pick a git object from a clean repository</h1> <p>This is one of the numerous questions regarding a Git repo that is corrupted, precisely a loose object that went wrong:</p> <pre><code>$ git gc Counting objects: 3299, done. error: inflate: data stream error (unknown compression method) e...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,613
git
# Git corrupted repo: how to pick a git object from a clean repository This is one of the numerous questions regarding a Git repo that is corrupted, precisely a loose object that went wrong: ``` $ git gc Counting objects: 3299, done. error: inflate: data stream error (unknown compression method) error: unable to unpa...
**If the file exists elsewhere** The object of the clean repository has been repacked, that's why it doesn't exist anymore as a file. To restore it, first save it as a file, from the clean repository, with ``` git show 831a5d31af4a0af2f5a367689bee27a44efc22c9 > 831a5-file ``` Move `831a5-file` in the corrupted repo...
25339828
Ignore files in git log -p
8
2014-08-16 11:43:42
<p>I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of <code>git log --patch</code>.</p> <p>The files are in a single directory called <code>mtest</code>; however, that folder also contains test suite code that I do want to show. Test files, which I wa...
3,210
673,760
2014-12-27 04:46:32
25,340,187
11
2014-08-16 12:34:07
2,541,573
2014-12-27 04:44:42
https://stackoverflow.com/q/25339828
https://stackoverflow.com/a/25340187
<p>I don't know which version of Git you are/were using, but the problem you report appears to have been fixed in Git 1.9.5 (for more details about the bugfix, see <a href="https://stackoverflow.com/a/27662758/2541573">this</a>). The following command</p> <pre><code>git log --patch -- . ":(exclude)*.xml" </code></pre>...
<p>I don't know which version of Git you are/were using, but the problem you report appears to have been fixed in Git 1.9.5 (for more details about the bugfix, see <a href="https://stackoverflow.com/a/27662758/2541573">this</a>). The following command</p> <pre><code>git log --patch -- . ":(exclude)*.xml" </code></pre>...
119, 47913
git, git-log
<h1>Ignore files in git log -p</h1> <p>I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of <code>git log --patch</code>.</p> <p>The files are in a single directory called <code>mtest</code>; however, that folder also contains test suite code that I do ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,614
git
# Ignore files in git log -p I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of `git log --patch`. The files are in a single directory called `mtest`; however, that folder also contains test suite code that I do want to show. Test files, which I want...
I don't know which version of Git you are/were using, but the problem you report appears to have been fixed in Git 1.9.5 (for more details about the bugfix, see [this](https://stackoverflow.com/a/27662758/2541573)). The following command ``` git log --patch -- . ":(exclude)*.xml" ``` does what you want in your toy ex...
25306081
Why cannot a feature be finished with unstaged changes?
8
2014-08-14 10:41:17
<p>Is there a special reason why I cannot "finish a feature" (using git-flow) while my sandbox contains unstaged/non-commited changes?</p>
2,444
160,691
2015-05-03 22:41:57
25,312,649
11
2014-08-14 16:06:32
3,611,461
2014-08-14 16:14:06
https://stackoverflow.com/q/25306081
https://stackoverflow.com/a/25312649
<h2>Git cannot merge while you have non-committed changes.</h2> <p>You can do the following:</p> <ul> <li><code>git stash</code> to store your changes temporarily</li> <li>finish your feature</li> <li><code>git stash pop</code> to get the stashed changes back on top of your current working directory</li> </ul>
<h2>Git cannot merge while you have non-committed changes.</h2> <p>You can do the following:</p> <ul> <li><code>git stash</code> to store your changes temporarily</li> <li>finish your feature</li> <li><code>git stash pop</code> to get the stashed changes back on top of your current working directory</li> </ul>
119, 64339, 90056
atlassian-sourcetree, git, git-flow
<h1>Why cannot a feature be finished with unstaged changes?</h1> <p>Is there a special reason why I cannot "finish a feature" (using git-flow) while my sandbox contains unstaged/non-commited changes?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,615
git
# Why cannot a feature be finished with unstaged changes? Is there a special reason why I cannot "finish a feature" (using git-flow) while my sandbox contains unstaged/non-commited changes?
## Git cannot merge while you have non-committed changes. You can do the following: - `git stash` to store your changes temporarily - finish your feature - `git stash pop` to get the stashed changes back on top of your current working directory
14046563
Ignore .git in parent directories for git status, branch, etc?
8
2012-12-26 21:38:08
<p>Is it possible to prevent git from searching parent directories for <code>.git</code> folders? I have a <code>.git</code> in my user root directory to back up / branch my config files, but that has the undesired consequence that all subdirectories that don't have their own <code>.git</code> folders appear to be chi...
815
814,354
2023-12-31 23:08:41
24,234,530
11
2014-06-15 22:06:23
null
2023-12-31 23:08:41
https://stackoverflow.com/q/14046563
https://stackoverflow.com/a/24234530
<p>Try putting this in your .bashrc:</p> <pre class="lang-bash prettyprint-override"><code>export GIT_CEILING_DIRECTORIES='/home/keflavich' </code></pre> <p>If you're in a subdirectory of /home/keflavich, the .git stuff in /home/keflavich will be invisible. But if you're in /home/keflavich, it will be visible, which I ...
<p>Try putting this in your .bashrc:</p> <pre class="lang-bash prettyprint-override"><code>export GIT_CEILING_DIRECTORIES='/home/keflavich' </code></pre> <p>If you're in a subdirectory of /home/keflavich, the .git stuff in /home/keflavich will be invisible. But if you're in /home/keflavich, it will be visible, which I ...
119
git
<h1>Ignore .git in parent directories for git status, branch, etc?</h1> <p>Is it possible to prevent git from searching parent directories for <code>.git</code> folders? I have a <code>.git</code> in my user root directory to back up / branch my config files, but that has the undesired consequence that all subdirector...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,617
git
# Ignore .git in parent directories for git status, branch, etc? Is it possible to prevent git from searching parent directories for `.git` folders? I have a `.git` in my user root directory to back up / branch my config files, but that has the undesired consequence that all subdirectories that don't have their own `....
Try putting this in your .bashrc: ``` export GIT_CEILING_DIRECTORIES='/home/keflavich' ``` If you're in a subdirectory of /home/keflavich, the .git stuff in /home/keflavich will be invisible. But if you're in /home/keflavich, it will be visible, which I think is what you want.
24230455
How to check if a directory is a git repository in C#
8
2014-06-15 14:14:40
<p>I've started using LibGit2Sharp in my project and I have to admit its pretty awesome. I'm glad i didnt go the command line route with processinfo. But I have a question which I couldn't find an answer for in the wiki and could not find a test in the source code that had it. How can you check with LibGit2Sharp if a ...
4,534
2,348,615
2021-06-02 08:58:03
24,230,795
11
2014-06-15 14:51:12
241,605
2021-06-02 08:58:03
https://stackoverflow.com/q/24230455
https://stackoverflow.com/a/24230795
<p>You can call <code>Repository.IsValid(path)</code>. The source code for <code>Repository</code> is <a href="https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs" rel="nofollow noreferrer">here</a>.</p> <p>The path can be either to the <code>.git</code> folder or to the working directory.</p...
<p>You can call <code>Repository.IsValid(path)</code>. The source code for <code>Repository</code> is <a href="https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs" rel="nofollow noreferrer">here</a>.</p> <p>The path can be either to the <code>.git</code> folder or to the working directory.</p...
9, 119, 74777
c#, git, libgit2sharp
<h1>How to check if a directory is a git repository in C#</h1> <p>I've started using LibGit2Sharp in my project and I have to admit its pretty awesome. I'm glad i didnt go the command line route with processinfo. But I have a question which I couldn't find an answer for in the wiki and could not find a test in the sou...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,618
git
# How to check if a directory is a git repository in C# I've started using LibGit2Sharp in my project and I have to admit its pretty awesome. I'm glad i didnt go the command line route with processinfo. But I have a question which I couldn't find an answer for in the wiki and could not find a test in the source code t...
You can call `Repository.IsValid(path)`. The source code for `Repository` is [here](https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs). The path can be either to the `.git` folder or to the working directory.
23062249
git autosetuprebase is not working?
8
2014-04-14 14:04:58
<p>I have set up git with </p> <pre><code>git config --global branch.autosetuprebase always </code></pre> <p>and it looks ok in my <code>~/.gitconfig</code>file:</p> <pre><code>[branch] autosetuprebase = always </code></pre> <p>Yet when I do </p> <pre><code>git pull </code></pre> <p>he performs a merge (I rem...
2,541
2,082,964
2014-04-14 15:57:55
23,064,713
11
2014-04-14 15:57:55
1,253,222
2014-04-14 15:57:55
https://stackoverflow.com/q/23062249
https://stackoverflow.com/a/23064713
<p>The <code>branch.autosetuprebase</code> option in <code>git</code> only affects branches created after it is set. From the manual page (<code>git help config</code>):</p> <pre><code> branch.autosetuprebase When a new branch is created with git branch or git checkout that tracks another branch, this variable...
<p>The <code>branch.autosetuprebase</code> option in <code>git</code> only affects branches created after it is set. From the manual page (<code>git help config</code>):</p> <pre><code> branch.autosetuprebase When a new branch is created with git branch or git checkout that tracks another branch, this variable...
119, 8974, 29934
git, git-rebase, rebase
<h1>git autosetuprebase is not working?</h1> <p>I have set up git with </p> <pre><code>git config --global branch.autosetuprebase always </code></pre> <p>and it looks ok in my <code>~/.gitconfig</code>file:</p> <pre><code>[branch] autosetuprebase = always </code></pre> <p>Yet when I do </p> <pre><code>git pull...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,620
git
# git autosetuprebase is not working? I have set up git with ``` git config --global branch.autosetuprebase always ``` and it looks ok in my `~/.gitconfig`file: ``` [branch] autosetuprebase = always ``` Yet when I do ``` git pull ``` he performs a merge (I removed company specific data): ``` From gitlab:***...
The `branch.autosetuprebase` option in `git` only affects branches created after it is set. From the manual page (`git help config`): ``` branch.autosetuprebase When a new branch is created with git branch or git checkout that tracks another branch, this variable tells Git to set up pull to rebase inst...
21656309
Transfer most recent commit to another branch
8
2014-02-09 06:55:53
<p>I had created an extra branch for some testing purpose. </p> <p>Before starting to work, I switched back to master branch and, after having a tea, I started adding files and modifying some other files in master branch. </p> <p>Only after I committed, I remembered that I was in master branch, while I had to switch ...
1,423
805,896
2018-10-19 08:42:53
21,656,411
11
2014-02-09 07:14:31
2,699,113
2014-02-09 07:14:31
https://stackoverflow.com/q/21656309
https://stackoverflow.com/a/21656411
<p>If I understood you right you can do such things:</p> <pre><code>git checkout master git log now check hash commit you want to move - for example: 0123456 git checkout branch git cherry-pick 0123456 git checkout master git revert 0123456 </code></pre> <p>that's all.</p>
<p>If I understood you right you can do such things:</p> <pre><code>git checkout master git log now check hash commit you want to move - for example: 0123456 git checkout branch git cherry-pick 0123456 git checkout master git revert 0123456 </code></pre> <p>that's all.</p>
119
git
<h1>Transfer most recent commit to another branch</h1> <p>I had created an extra branch for some testing purpose. </p> <p>Before starting to work, I switched back to master branch and, after having a tea, I started adding files and modifying some other files in master branch. </p> <p>Only after I committed, I remembe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,622
git
# Transfer most recent commit to another branch I had created an extra branch for some testing purpose. Before starting to work, I switched back to master branch and, after having a tea, I started adding files and modifying some other files in master branch. Only after I committed, I remembered that I was in master ...
If I understood you right you can do such things: ``` git checkout master git log now check hash commit you want to move - for example: 0123456 git checkout branch git cherry-pick 0123456 git checkout master git revert 0123456 ``` that's all.
21003971
Bitbucket: Conflict in remote repo, can't figure out how to resolve
8
2014-01-08 18:43:38
<p>I hope I can express this properly... I have the following setup in Bitbucket (using Git protocol). I have a master repo that contains my application. I then fork the master repo per client in order to have the flexibility to make client specific changes without affecting the master. When a generic change is requ...
11,523
2,045,598
2015-07-09 16:32:35
21,004,402
11
2014-01-08 19:07:38
354,577
2015-07-09 16:32:35
https://stackoverflow.com/q/21003971
https://stackoverflow.com/a/21004402
<p>When working with a fork, it is often helpful to have the upstream repository (your Master repository) configured as a remote as well as the fork (your Client A repository). For example, you probably already have an <code>origin</code> that represents the fork.</p> <p>Add a new remote <code>upstream</code> to repre...
<p>When working with a fork, it is often helpful to have the upstream repository (your Master repository) configured as a remote as well as the fork (your Client A repository). For example, you probably already have an <code>origin</code> that represents the fork.</p> <p>Add a new remote <code>upstream</code> to repre...
119, 8337, 28897, 62599
bitbucket, git, git-merge, merge-conflict-resolution
<h1>Bitbucket: Conflict in remote repo, can't figure out how to resolve</h1> <p>I hope I can express this properly... I have the following setup in Bitbucket (using Git protocol). I have a master repo that contains my application. I then fork the master repo per client in order to have the flexibility to make client ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,623
git
# Bitbucket: Conflict in remote repo, can't figure out how to resolve I hope I can express this properly... I have the following setup in Bitbucket (using Git protocol). I have a master repo that contains my application. I then fork the master repo per client in order to have the flexibility to make client specific ch...
When working with a fork, it is often helpful to have the upstream repository (your Master repository) configured as a remote as well as the fork (your Client A repository). For example, you probably already have an `origin` that represents the fork. Add a new remote `upstream` to represent the "Master" repository: `...
19174497
How to show diff of changes made in a merge commit?
8
2013-10-04 06:13:03
<p>I didn't realize I was in the middle of a merge when I wrote a bunch of code. Now <code>git log -p</code> will not show me the diff of this change (which got auto-committed as a merge commit).</p> <p>How can I get it to show up in my log diff history?</p>
1,391
340,947
2013-10-04 08:20:48
19,176,519
11
2013-10-04 08:20:48
683,080
2013-10-04 08:20:48
https://stackoverflow.com/q/19174497
https://stackoverflow.com/a/19176519
<p>It's a bit disappointing that Git doesn't show you a patch for merges with <code>-p</code>. Part of the reason is that the patch produced by <code>-p</code> is a unified diff, and it's created from one base and one target revision. A merge has two bases, so a unified diff isn't representative of the change that ne...
<p>It's a bit disappointing that Git doesn't show you a patch for merges with <code>-p</code>. Part of the reason is that the patch produced by <code>-p</code> is a unified diff, and it's created from one base and one target revision. A merge has two bases, so a unified diff isn't representative of the change that ne...
119
git
<h1>How to show diff of changes made in a merge commit?</h1> <p>I didn't realize I was in the middle of a merge when I wrote a bunch of code. Now <code>git log -p</code> will not show me the diff of this change (which got auto-committed as a merge commit).</p> <p>How can I get it to show up in my log diff history?</p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,625
git
# How to show diff of changes made in a merge commit? I didn't realize I was in the middle of a merge when I wrote a bunch of code. Now `git log -p` will not show me the diff of this change (which got auto-committed as a merge commit). How can I get it to show up in my log diff history?
It's a bit disappointing that Git doesn't show you a patch for merges with `-p`. Part of the reason is that the patch produced by `-p` is a unified diff, and it's created from one base and one target revision. A merge has two bases, so a unified diff isn't representative of the change that needs to be made. So there a...
18508421
How to ignore changes to a file when committing with Git?
8
2013-08-29 10:25:39
<p>I did search for the solution, yet I believe my situation is a bit different than those I read about. </p> <p>I am working on a particular branch and made a mistake, having edited a file in a way that is unrelated to the theme of the branch, and now want these changes to not make it into the commit. I do not want t...
8,269
254,343
2019-10-02 08:26:47
18,508,610
11
2013-08-29 10:35:07
1,084,945
2013-08-29 10:43:08
https://stackoverflow.com/q/18508421
https://stackoverflow.com/a/18508610
<p>If you do not stage the changes, they will not be part of the commit, something like this:</p> <pre><code>git status # On branch development # Changes not staged for commit: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;..." to discard changes in working ...
<p>If you do not stage the changes, they will not be part of the commit, something like this:</p> <pre><code>git status # On branch development # Changes not staged for commit: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;..." to discard changes in working ...
119, 1879
branch, git
<h1>How to ignore changes to a file when committing with Git?</h1> <p>I did search for the solution, yet I believe my situation is a bit different than those I read about. </p> <p>I am working on a particular branch and made a mistake, having edited a file in a way that is unrelated to the theme of the branch, and now...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,626
git
# How to ignore changes to a file when committing with Git? I did search for the solution, yet I believe my situation is a bit different than those I read about. I am working on a particular branch and made a mistake, having edited a file in a way that is unrelated to the theme of the branch, and now want these chang...
If you do not stage the changes, they will not be part of the commit, something like this: ``` git status # On branch development # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified:...
15939694
Git check if there is outstanding commits to push
8
2013-04-11 02:27:11
<p>Is there a command I can run to check if there is any commits to push to origin/master?</p> <pre><code>git [some command] origin master </code></pre> <p>Would output something like:</p> <pre><code>origin/master is behind by 7 commits </code></pre>
3,805
268,074
2022-07-01 17:12:17
15,939,719
11
2013-04-11 02:31:19
343,381
2013-04-11 02:31:19
https://stackoverflow.com/q/15939694
https://stackoverflow.com/a/15939719
<p>Here are two ways to list the "extra" commits you have which are not on origin/master:</p> <pre><code>git log --oneline origin/master..HEAD git rev-list --oneline ^origin/master HEAD </code></pre> <p>The <code>--oneline</code> just lists them in a shorter format. Also, if your branch tracks origin/master, a simpl...
<p>Here are two ways to list the "extra" commits you have which are not on origin/master:</p> <pre><code>git log --oneline origin/master..HEAD git rev-list --oneline ^origin/master HEAD </code></pre> <p>The <code>--oneline</code> just lists them in a shorter format. Also, if your branch tracks origin/master, a simpl...
119, 456
git, version-control
<h1>Git check if there is outstanding commits to push</h1> <p>Is there a command I can run to check if there is any commits to push to origin/master?</p> <pre><code>git [some command] origin master </code></pre> <p>Would output something like:</p> <pre><code>origin/master is behind by 7 commits </code></pre>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,627
git
# Git check if there is outstanding commits to push Is there a command I can run to check if there is any commits to push to origin/master? ``` git [some command] origin master ``` Would output something like: ``` origin/master is behind by 7 commits ```
Here are two ways to list the "extra" commits you have which are not on origin/master: ``` git log --oneline origin/master..HEAD git rev-list --oneline ^origin/master HEAD ``` The `--oneline` just lists them in a shorter format. Also, if your branch tracks origin/master, a simple `git status` will show you.
15800806
push to heroku through port 443
8
2013-04-04 00:55:43
<p>I am unable to use the default port 22 and so have run into difficulties setting up git and heroku according to the hartl rails tutorial.</p> <p>I was able to push to git by including the following in the ~/.ssh/config file:</p> <pre><code>Host github.com User git Hostname ssh.github.com PreferredAuthentications p...
2,377
904,296
2014-10-22 23:09:46
15,801,206
11
2013-04-04 01:44:53
2,942
2014-10-22 23:09:46
https://stackoverflow.com/q/15800806
https://stackoverflow.com/a/15801206
<p>Heroku is working on providing alternative ways to move source code onto the platform, take a look at <code>heroku push</code>, for example: <a href="https://github.com/ddollar/heroku-push" rel="nofollow">https://github.com/ddollar/heroku-push</a></p> <p>It uses https and is thus not susceptible to the firewall-blo...
<p>Heroku is working on providing alternative ways to move source code onto the platform, take a look at <code>heroku push</code>, for example: <a href="https://github.com/ddollar/heroku-push" rel="nofollow">https://github.com/ddollar/heroku-push</a></p> <p>It uses https and is thus not susceptible to the firewall-blo...
119, 386, 8279
git, heroku, ssh
<h1>push to heroku through port 443</h1> <p>I am unable to use the default port 22 and so have run into difficulties setting up git and heroku according to the hartl rails tutorial.</p> <p>I was able to push to git by including the following in the ~/.ssh/config file:</p> <pre><code>Host github.com User git Hostname ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,628
git
# push to heroku through port 443 I am unable to use the default port 22 and so have run into difficulties setting up git and heroku according to the hartl rails tutorial. I was able to push to git by including the following in the ~/.ssh/config file: ``` Host github.com User git Hostname ssh.github.com PreferredAut...
Heroku is working on providing alternative ways to move source code onto the platform, take a look at `heroku push`, for example: <https://github.com/ddollar/heroku-push> It uses https and is thus not susceptible to the firewall-blocking you're experiencing. **UPDATE** Heroku now has [beta HTTP Git](https://devcente...
15420947
git - "debug" branch, merge "fix" branch without "debug"
8
2013-03-14 21:55:56
<p>I have a buggy <code>master</code> branch that I need to debug. To do that, I want to insert a bunch of debug procedures (e.g., printing variables), pin point the bug and apply fixes. Later, I want to merge the fixes into the <code>master</code> branch, but I want not to skip debug changes.</p> <pre><code># create ...
2,220
497,208
2016-03-04 23:12:16
15,421,463
11
2013-03-14 22:31:44
1,286,639
2016-03-04 23:12:16
https://stackoverflow.com/q/15420947
https://stackoverflow.com/a/15421463
<p>What you are looking for is the 'onto' option of 'git rebase' (see 'git help rebase'). From what you described it would be:</p> <pre><code>git rebase --onto master debug fix </code></pre> <p>This actually re-roots the (from 'fix', to 'debug') commits at master. You still have the fix branch. To complete rework,...
<p>What you are looking for is the 'onto' option of 'git rebase' (see 'git help rebase'). From what you described it would be:</p> <pre><code>git rebase --onto master debug fix </code></pre> <p>This actually re-roots the (from 'fix', to 'debug') commits at master. You still have the fix branch. To complete rework,...
119
git
<h1>git - "debug" branch, merge "fix" branch without "debug"</h1> <p>I have a buggy <code>master</code> branch that I need to debug. To do that, I want to insert a bunch of debug procedures (e.g., printing variables), pin point the bug and apply fixes. Later, I want to merge the fixes into the <code>master</code> branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,629
git
# git - "debug" branch, merge "fix" branch without "debug" I have a buggy `master` branch that I need to debug. To do that, I want to insert a bunch of debug procedures (e.g., printing variables), pin point the bug and apply fixes. Later, I want to merge the fixes into the `master` branch, but I want not to skip debug...
What you are looking for is the 'onto' option of 'git rebase' (see 'git help rebase'). From what you described it would be: ``` git rebase --onto master debug fix ``` This actually re-roots the (from 'fix', to 'debug') commits at master. You still have the fix branch. To complete rework, follow up with: ``` git chec...
11985346
Git rebase after merge confused about deleted file
8
2012-08-16 10:34:57
<p>My Git repository has two files, <code>alpha</code> and <code>beta</code>, with identical content.</p> <p>If I delete <code>alpha</code> in my master branch, and edit it in my feature branch, then when I merge master into feature, I'm warned about a conflict. Assume I resolve this by deleting <code>alpha</code>.</p...
6,124
220,155
2012-08-16 10:40:05
11,985,425
11
2012-08-16 10:40:05
893
2012-08-16 10:40:05
https://stackoverflow.com/q/11985346
https://stackoverflow.com/a/11985425
<p>From the <a href="http://git-scm.com/docs/git-rebase" rel="noreferrer">documentation for <code>git-rebase</code></a>:</p> <blockquote> <p>-m<br> --merge<br> Use merging strategies to rebase. When the recursive (default) merge strategy is used, this allows rebase to be aware of renames on the upstream side.</p...
<p>From the <a href="http://git-scm.com/docs/git-rebase" rel="noreferrer">documentation for <code>git-rebase</code></a>:</p> <blockquote> <p>-m<br> --merge<br> Use merging strategies to rebase. When the recursive (default) merge strategy is used, this allows rebase to be aware of renames on the upstream side.</p...
119, 28897, 29934
git, git-merge, git-rebase
<h1>Git rebase after merge confused about deleted file</h1> <p>My Git repository has two files, <code>alpha</code> and <code>beta</code>, with identical content.</p> <p>If I delete <code>alpha</code> in my master branch, and edit it in my feature branch, then when I merge master into feature, I'm warned about a confli...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,632
git
# Git rebase after merge confused about deleted file My Git repository has two files, `alpha` and `beta`, with identical content. If I delete `alpha` in my master branch, and edit it in my feature branch, then when I merge master into feature, I'm warned about a conflict. Assume I resolve this by deleting `alpha`. I...
From the [documentation for `git-rebase`](http://git-scm.com/docs/git-rebase): > -m > --merge > Use merging strategies to rebase. When the recursive (default) merge strategy is used, this allows rebase to be aware of renames on the upstream side. When a file is deleted, Git considers that a candidate for a rename...
10973341
heroku console show the latest sha hash from git deployment
8
2012-06-11 00:02:21
<p>I have a development branch hosted on Heroku and we have a couple of people using this branch to look for bugs, it would be nice to show the SHA-1 Hash of the commit that's the latest deployed on Heroku so that we know which bugs belong to which commit.</p> <p>But I cannot at all find any way to find this informati...
5,265
126,749
2014-11-26 15:26:27
10,973,398
11
2012-06-11 00:13:42
506,338
2012-06-11 06:01:46
https://stackoverflow.com/q/10973341
https://stackoverflow.com/a/10973398
<p>Treat Heroku just like any other remote Git repo - you can use <code>git ls-remote</code>:</p> <p><code>git ls-remote heroku</code></p> <p>(<code>heroku</code> here being the remote name)</p> <p><strong>UPDATE:</strong></p> <p>Since the OP is actually looking to acquire the SHA in the Ruby env, one possible way ...
<p>Treat Heroku just like any other remote Git repo - you can use <code>git ls-remote</code>:</p> <p><code>git ls-remote heroku</code></p> <p>(<code>heroku</code> here being the remote name)</p> <p><strong>UPDATE:</strong></p> <p>Since the OP is actually looking to acquire the SHA in the Ruby env, one possible way ...
119, 4984, 8279
git, heroku, ruby-on-rails
<h1>heroku console show the latest sha hash from git deployment</h1> <p>I have a development branch hosted on Heroku and we have a couple of people using this branch to look for bugs, it would be nice to show the SHA-1 Hash of the commit that's the latest deployed on Heroku so that we know which bugs belong to which co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,633
git
# heroku console show the latest sha hash from git deployment I have a development branch hosted on Heroku and we have a couple of people using this branch to look for bugs, it would be nice to show the SHA-1 Hash of the commit that's the latest deployed on Heroku so that we know which bugs belong to which commit. Bu...
Treat Heroku just like any other remote Git repo - you can use `git ls-remote`: `git ls-remote heroku` (`heroku` here being the remote name) **UPDATE:** Since the OP is actually looking to acquire the SHA in the Ruby env, one possible way would be to use a [custom buildpack](https://devcenter.heroku.com/articles/bu...
9981948
MySQL - Searching negative longitude values with BETWEEN
8
2012-04-02 18:40:21
<p>I have found many similar posts and even tried to find out how to handle negative values within MySQL, but to no avail.</p> <p>I have a site that I'm using Google Maps on and as a performance enhancement I'm limiting the markers that are drawn on the map to those that are within the map boundaries.</p> <p>I would ...
3,013
804,867
2015-02-01 20:25:04
9,982,064
11
2012-04-02 18:49:26
268,273
2012-04-02 18:49:26
https://stackoverflow.com/q/9981948
https://stackoverflow.com/a/9982064
<p>You can also use the <code>greatest()</code> and <code>least()</code> functions, so you don't have to worry about the parameters. For example:</p> <pre><code>SELECT * FROM table WHERE latitude BETWEEN least(@lat1, @lat2) AND greatest(@lat1, @lat2) AND longitude BETWEEN least(@lon1, @lon2) AND greatest(@lon1, @lon2...
<p>You can also use the <code>greatest()</code> and <code>least()</code> functions, so you don't have to worry about the parameters. For example:</p> <pre><code>SELECT * FROM table WHERE latitude BETWEEN least(@lat1, @lat2) AND greatest(@lat1, @lat2) AND longitude BETWEEN least(@lon1, @lon2) AND greatest(@lon1, @lon2...
21, 1151, 20301
latitude-longitude, mysql, select
<h1>MySQL - Searching negative longitude values with BETWEEN</h1> <p>I have found many similar posts and even tried to find out how to handle negative values within MySQL, but to no avail.</p> <p>I have a site that I'm using Google Maps on and as a performance enhancement I'm limiting the markers that are drawn on the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,635
git
# MySQL - Searching negative longitude values with BETWEEN I have found many similar posts and even tried to find out how to handle negative values within MySQL, but to no avail. I have a site that I'm using Google Maps on and as a performance enhancement I'm limiting the markers that are drawn on the map to those th...
You can also use the `greatest()` and `least()` functions, so you don't have to worry about the parameters. For example: ``` SELECT * FROM table WHERE latitude BETWEEN least(@lat1, @lat2) AND greatest(@lat1, @lat2) AND longitude BETWEEN least(@lon1, @lon2) AND greatest(@lon1, @lon2) ```
9736325
Git connection time out trying to clone via proxy
8
2012-03-16 11:20:38
<p>I am getting a connection timeout error when I try to clone a Git repo via a proxy server. </p> <blockquote> <p>git clone <code>http://opensource.freescale.com/pub/scm/imx/linux-2.6-imx.git</code><br> Cloning into linux-2.6-imx...<br> error: Failed connect to opensource.freescale.com:8080; Connection timed ou...
16,535
900,785
2013-10-29 21:24:29
9,736,435
11
2012-03-16 11:28:54
350,890
2012-03-16 11:28:54
https://stackoverflow.com/q/9736325
https://stackoverflow.com/a/9736435
<p>you do not need corkscrew for accessing a http repo behind a proxy server.</p> <p>set the environment variable http_proxy</p> <pre><code>export http_proxy=http://&lt;proxy&gt;:&lt;port&gt;/ </code></pre> <p>and then git will use the http proxy</p> <p>see also <a href="http://roshansingh.wordpress.com/2008/08/29/...
<p>you do not need corkscrew for accessing a http repo behind a proxy server.</p> <p>set the environment variable http_proxy</p> <pre><code>export http_proxy=http://&lt;proxy&gt;:&lt;port&gt;/ </code></pre> <p>and then git will use the http proxy</p> <p>see also <a href="http://roshansingh.wordpress.com/2008/08/29/...
119, 760
git, proxy
<h1>Git connection time out trying to clone via proxy</h1> <p>I am getting a connection timeout error when I try to clone a Git repo via a proxy server. </p> <blockquote> <p>git clone <code>http://opensource.freescale.com/pub/scm/imx/linux-2.6-imx.git</code><br> Cloning into linux-2.6-imx...<br> error: Failed co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,636
git
# Git connection time out trying to clone via proxy I am getting a connection timeout error when I try to clone a Git repo via a proxy server. > git clone `http://opensource.freescale.com/pub/scm/imx/linux-2.6-imx.git` > Cloning into linux-2.6-imx... > error: Failed connect to opensource.freescale.com:8080; Conne...
you do not need corkscrew for accessing a http repo behind a proxy server. set the environment variable http_proxy ``` export http_proxy=http://<proxy>:<port>/ ``` and then git will use the http proxy see also <http://roshansingh.wordpress.com/2008/08/29/using-git-behind-proxy/>
9143251
is there a way to find out where a branch came from?
8
2012-02-04 18:22:57
<p>is there a way to show like the tree structure for the branches created?</p> <p>say i start from MASTER then to SONAR-VIOLATIONS then to PROJECT_ONE_VIOLATION, what is the command/method to show where the new branches branched from? in sort of a tree structure?</p>
4,714
802,281
2012-02-04 18:27:37
9,143,285
11
2012-02-04 18:27:37
357,743
2012-02-04 18:27:37
https://stackoverflow.com/q/9143251
https://stackoverflow.com/a/9143285
<p>One of the simplest solution would be <code>git log --graph</code> (better with <code>--oneline</code> and <code>--decorate</code> options).</p>
<p>One of the simplest solution would be <code>git log --graph</code> (better with <code>--oneline</code> and <code>--decorate</code> options).</p>
119
git
<h1>is there a way to find out where a branch came from?</h1> <p>is there a way to show like the tree structure for the branches created?</p> <p>say i start from MASTER then to SONAR-VIOLATIONS then to PROJECT_ONE_VIOLATION, what is the command/method to show where the new branches branched from? in sort of a tree str...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,637
git
# is there a way to find out where a branch came from? is there a way to show like the tree structure for the branches created? say i start from MASTER then to SONAR-VIOLATIONS then to PROJECT_ONE_VIOLATION, what is the command/method to show where the new branches branched from? in sort of a tree structure?
One of the simplest solution would be `git log --graph` (better with `--oneline` and `--decorate` options).
8773967
git-p4 -- any great explanations for how it works
8
2012-01-07 23:22:01
<p>If you use perforce remotely and desire to have the awesome speed of git for tracking diffs, here is the solution: <a href="http://kb.perforce.com/article/1417/git-p4" rel="nofollow noreferrer">http://kb.perforce.com/article/1417/git-p4</a></p> <p>However, I've noticed the following:</p> <ol> <li>Follow the instruct...
8,419
1,009,332
2024-07-18 01:36:34
8,810,334
11
2012-01-10 20:49:50
1,141,479
2012-01-10 20:49:50
https://stackoverflow.com/q/8773967
https://stackoverflow.com/a/8810334
<p>There is some more information in <code>Documentation/git-p4.txt</code> in the git project source code.</p> <p>git-p4 maintains a refs/remotes/p4 branch to mirror the remote Perforce server. By default <code>git-p4 clone</code> and <code>git-p4 sync</code> update this remote and you rebase your master against it.</...
<p>There is some more information in <code>Documentation/git-p4.txt</code> in the git project source code.</p> <p>git-p4 maintains a refs/remotes/p4 branch to mirror the remote Perforce server. By default <code>git-p4 clone</code> and <code>git-p4 sync</code> update this remote and you rebase your master against it.</...
119, 1286, 55021
git, git-p4, perforce
<h1>git-p4 -- any great explanations for how it works</h1> <p>If you use perforce remotely and desire to have the awesome speed of git for tracking diffs, here is the solution: <a href="http://kb.perforce.com/article/1417/git-p4" rel="nofollow noreferrer">http://kb.perforce.com/article/1417/git-p4</a></p> <p>However, I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,638
git
# git-p4 -- any great explanations for how it works If you use perforce remotely and desire to have the awesome speed of git for tracking diffs, here is the solution: <http://kb.perforce.com/article/1417/git-p4> However, I've noticed the following: 1. Follow the instructions exactly 2. It can take a while to import ...
There is some more information in `Documentation/git-p4.txt` in the git project source code. git-p4 maintains a refs/remotes/p4 branch to mirror the remote Perforce server. By default `git-p4 clone` and `git-p4 sync` update this remote and you rebase your master against it. `git-p4 submit` requires configuring an add...
8587317
Is it Possible to transfer the Git SSHKey from one system to another
8
2011-12-21 09:07:21
<p>I am very New to Git. My client asket me to install git in my system and told me to pass the ssh key (id_rsa.pub ).I transfered the key and he registered, after that we were able to download the app.</p> <p>Then we decided to move to Fedora 14 (Linux). We installed git again and we transferred the key again for reg...
15,052
352,619
2023-06-20 19:21:52
8,587,397
11
2011-12-21 09:14:58
526,535
2011-12-21 09:14:58
https://stackoverflow.com/q/8587317
https://stackoverflow.com/a/8587397
<p>The ssh private key is not tied to a machine and you can just copy it from one machine to another and should be able to ssh ( and hence use git) to the server that has your public key. You do not have to recreate the keys and replace with the copies etc, but even what you have done is fine from the keys point of vi...
<p>The ssh private key is not tied to a machine and you can just copy it from one machine to another and should be able to ssh ( and hence use git) to the server that has your public key. You do not have to recreate the keys and replace with the copies etc, but even what you have done is fine from the keys point of vi...
119, 25308
git, ssh-keys
<h1>Is it Possible to transfer the Git SSHKey from one system to another</h1> <p>I am very New to Git. My client asket me to install git in my system and told me to pass the ssh key (id_rsa.pub ).I transfered the key and he registered, after that we were able to download the app.</p> <p>Then we decided to move to Fedo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,639
git
# Is it Possible to transfer the Git SSHKey from one system to another I am very New to Git. My client asket me to install git in my system and told me to pass the ssh key (id_rsa.pub ).I transfered the key and he registered, after that we were able to download the app. Then we decided to move to Fedora 14 (Linux). W...
The ssh private key is not tied to a machine and you can just copy it from one machine to another and should be able to ssh ( and hence use git) to the server that has your public key. You do not have to recreate the keys and replace with the copies etc, but even what you have done is fine from the keys point of view. ...
8100119
Remove a specific changeset from Git repository altogether?
8
2011-11-11 21:21:01
<p>Is it even possible to remove a particular changeset from a Git repository altogether. I want to do this because there was a commit while ago that added some binary files that are absolutely useless for source code management.</p> <p>I can understand if this is impossible to do given the fact that the commit nodes ...
5,596
283,055
2019-04-26 07:36:20
8,100,215
11
2011-11-11 21:31:17
438,742
2019-04-26 07:36:20
https://stackoverflow.com/q/8100119
https://stackoverflow.com/a/8100215
<p>Use <code>git rebase -i &lt;commit-id&gt;</code>, where id is a commit before the changeset you want to remove. It will open a list of commits between the head and the changeset, delete from the list the commit you want and continue. When this commit will be "detached", it means it will be floating in the repository...
<p>Use <code>git rebase -i &lt;commit-id&gt;</code>, where id is a commit before the changeset you want to remove. It will open a list of commits between the head and the changeset, delete from the list the commit you want and continue. When this commit will be "detached", it means it will be floating in the repository...
119
git
<h1>Remove a specific changeset from Git repository altogether?</h1> <p>Is it even possible to remove a particular changeset from a Git repository altogether. I want to do this because there was a commit while ago that added some binary files that are absolutely useless for source code management.</p> <p>I can underst...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,640
git
# Remove a specific changeset from Git repository altogether? Is it even possible to remove a particular changeset from a Git repository altogether. I want to do this because there was a commit while ago that added some binary files that are absolutely useless for source code management. I can understand if this is i...
Use `git rebase -i <commit-id>`, where id is a commit before the changeset you want to remove. It will open a list of commits between the head and the changeset, delete from the list the commit you want and continue. When this commit will be "detached", it means it will be floating in the repository until it's garbage ...
7608904
Can't see differences in remote branch after a git fetch
8
2011-09-30 10:12:03
<p>I'm a little confused about git fetch and comparing differences . </p> <p>I have the following local branches;</p> <ul> <li>master </li> <li>remote/origin/master</li> </ul> <p>In master branch I have a text file which I make changes to, commit and then push to the origin/master. </p> <p>In another local repo (fo...
5,182
228,049
2011-09-30 13:11:53
7,609,922
11
2011-09-30 11:50:22
859,596
2011-09-30 13:11:53
https://stackoverflow.com/q/7608904
https://stackoverflow.com/a/7609922
<p>What you need to do to perform a diff (after a fetch) in respect to the head of your branch and the origin at the same branch is a </p> <p><code>git diff HEAD...origin</code></p> <p>Please note the 3 dots. By the way, the question can possibly be considered a duplicate of <a href="https://stackoverflow.com/questio...
<p>What you need to do to perform a diff (after a fetch) in respect to the head of your branch and the origin at the same branch is a </p> <p><code>git diff HEAD...origin</code></p> <p>Please note the 3 dots. By the way, the question can possibly be considered a duplicate of <a href="https://stackoverflow.com/questio...
119
git
<h1>Can't see differences in remote branch after a git fetch</h1> <p>I'm a little confused about git fetch and comparing differences . </p> <p>I have the following local branches;</p> <ul> <li>master </li> <li>remote/origin/master</li> </ul> <p>In master branch I have a text file which I make changes to, commit and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,641
git
# Can't see differences in remote branch after a git fetch I'm a little confused about git fetch and comparing differences . I have the following local branches; - master - remote/origin/master In master branch I have a text file which I make changes to, commit and then push to the origin/master. In another local ...
What you need to do to perform a diff (after a fetch) in respect to the head of your branch and the origin at the same branch is a `git diff HEAD...origin` Please note the 3 dots. By the way, the question can possibly be considered a duplicate of [this one](https://stackoverflow.com/questions/180272/how-to-preview-gi...
7163736
How to preserve the file permission in git?
8
2011-08-23 15:43:37
<p>I encountered a problem which took me a long time to find a solution and still fail to get one.</p> <p>The problem I had is 'DatabaseError: 'attempt to write a readonly database' when I tried to deploy my website through git to a Django hosting.</p> <p>It seems like git will change the permission of my files, fro...
10,810
329,554
2016-04-14 17:00:31
7,163,755
11
2011-08-23 15:45:16
71,522
2011-08-23 15:45:16
https://stackoverflow.com/q/7163736
https://stackoverflow.com/a/7163755
<p>In short, you can't.</p> <p>In longer, there are projects like etckeeper which can do it automatically, or you can write a small hook script which will fix up the permissions (which is probably how I'd do it).</p> <p>For example, if you commit something this:</p> <pre><code>#!/bin/sh chmod -R XXX file_or_director...
<p>In short, you can't.</p> <p>In longer, there are projects like etckeeper which can do it automatically, or you can write a small hook script which will fix up the permissions (which is probably how I'd do it).</p> <p>For example, if you commit something this:</p> <pre><code>#!/bin/sh chmod -R XXX file_or_director...
30, 119, 243, 359
database, django, git, permissions
<h1>How to preserve the file permission in git?</h1> <p>I encountered a problem which took me a long time to find a solution and still fail to get one.</p> <p>The problem I had is 'DatabaseError: 'attempt to write a readonly database' when I tried to deploy my website through git to a Django hosting.</p> <p>It seems...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,642
git
# How to preserve the file permission in git? I encountered a problem which took me a long time to find a solution and still fail to get one. The problem I had is 'DatabaseError: 'attempt to write a readonly database' when I tried to deploy my website through git to a Django hosting. It seems like git will change th...
In short, you can't. In longer, there are projects like etckeeper which can do it automatically, or you can write a small hook script which will fix up the permissions (which is probably how I'd do it). For example, if you commit something this: ``` #!/bin/sh chmod -R XXX file_or_directory/ ``` To, eg, `scripts/fix...
5604232
Can someone explain the distinction between content tracking used in Git and file tracking used in other SCMs
8
2011-04-09 09:45:10
<p>I've been using Git for a while now and love the features and flexibility in workflow it allows. The ability to commit early and often is a huge deal for me and really fits into my way of working.</p> <p>One feature of Git I've heard mentioned many times but have yet to get my head around is the fact that it tracks...
1,228
298,100
2011-04-09 11:40:03
5,604,370
11
2011-04-09 10:10:14
14,660
2011-04-09 10:10:14
https://stackoverflow.com/q/5604232
https://stackoverflow.com/a/5604370
<p>Git stores <a href="https://git.wiki.kernel.org/index.php/Git#Design" rel="noreferrer">three pieces of data separately</a>:</p> <ul> <li>content is stored in blob objects</li> <li>history is stored in commit objects</li> <li>structure is stored in tree objects</li> </ul> <p>A consequence of this is that if you hav...
<p>Git stores <a href="https://git.wiki.kernel.org/index.php/Git#Design" rel="noreferrer">three pieces of data separately</a>:</p> <ul> <li>content is stored in blob objects</li> <li>history is stored in commit objects</li> <li>structure is stored in tree objects</li> </ul> <p>A consequence of this is that if you hav...
63, 119
git, svn
<h1>Can someone explain the distinction between content tracking used in Git and file tracking used in other SCMs</h1> <p>I've been using Git for a while now and love the features and flexibility in workflow it allows. The ability to commit early and often is a huge deal for me and really fits into my way of working.</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,643
git
# Can someone explain the distinction between content tracking used in Git and file tracking used in other SCMs I've been using Git for a while now and love the features and flexibility in workflow it allows. The ability to commit early and often is a huge deal for me and really fits into my way of working. One featu...
Git stores [three pieces of data separately](https://git.wiki.kernel.org/index.php/Git#Design): - content is stored in blob objects - history is stored in commit objects - structure is stored in tree objects A consequence of this is that if you have the same data in several files, git only has to store it once, becau...
4523668
How to get a list of incoming commits on git push for a new branch in a hook
8
2010-12-24 01:23:34
<p>I'm writing a pre-receive hook to do some validation before accepting commits on the push. It works fine with existing branches since I use following git command to get a list of incoming commits:</p> <pre><code>git rev-list $old_sha1..$new_sha1 </code></pre> <p>However, above command fails if user pushing a new b...
2,530
497,958
2016-01-20 14:31:45
4,531,905
11
2010-12-25 22:19:49
9,410
2010-12-25 22:19:49
https://stackoverflow.com/q/4523668
https://stackoverflow.com/a/4531905
<p>Try this:</p> <pre><code>git rev-list $new_sha1 $(git for-each-ref --format '^%(refname:short)' refs/heads/) </code></pre> <p>This uses <code>git for-each-ref</code> to print known refs; specifies in <code>--format</code> that the short name be output along with a preceding caret; and says with <code>refs/heads/</...
<p>Try this:</p> <pre><code>git rev-list $new_sha1 $(git for-each-ref --format '^%(refname:short)' refs/heads/) </code></pre> <p>This uses <code>git for-each-ref</code> to print known refs; specifies in <code>--format</code> that the short name be output along with a preceding caret; and says with <code>refs/heads/</...
119, 853
git, hook
<h1>How to get a list of incoming commits on git push for a new branch in a hook</h1> <p>I'm writing a pre-receive hook to do some validation before accepting commits on the push. It works fine with existing branches since I use following git command to get a list of incoming commits:</p> <pre><code>git rev-list $old_...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,644
git
# How to get a list of incoming commits on git push for a new branch in a hook I'm writing a pre-receive hook to do some validation before accepting commits on the push. It works fine with existing branches since I use following git command to get a list of incoming commits: ``` git rev-list $old_sha1..$new_sha1 ``` ...
Try this: ``` git rev-list $new_sha1 $(git for-each-ref --format '^%(refname:short)' refs/heads/) ``` This uses `git for-each-ref` to print known refs; specifies in `--format` that the short name be output along with a preceding caret; and says with `refs/heads/` to selecting just local heads. You end up running some...
3858931
Git: convert carriage return \r to new line \n with git hook?
8
2010-10-04 20:38:53
<p>A fellow coder uses a Windows computer that is putting carriage returns everywhere in our source.</p> <p>Is there a way to write a git hook that converts all <code>\r\n</code> to <code>\n</code>?</p> <p><strong>Note</strong> I haven't used git hooks before, so a little extra hand-holding might go a long way :)</p>...
11,231
184,600
2010-10-05 01:22:55
3,858,971
11
2010-10-04 20:45:38
6,309
2010-10-04 21:27:14
https://stackoverflow.com/q/3858931
https://stackoverflow.com/a/3858971
<p>The simplest thing is to <a href="https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278">set <code>core.autocrlf</code> to false</a> on The Windows side.<br> (that way Git won't do any conversion and will keep the eol untouched). </p> <p>On the unix side, a <code>...
<p>The simplest thing is to <a href="https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278">set <code>core.autocrlf</code> to false</a> on The Windows side.<br> (that way Git won't do any conversion and will keep the eol untouched). </p> <p>On the unix side, a <code>...
119, 3705, 43087
git, githooks, newline
<h1>Git: convert carriage return \r to new line \n with git hook?</h1> <p>A fellow coder uses a Windows computer that is putting carriage returns everywhere in our source.</p> <p>Is there a way to write a git hook that converts all <code>\r\n</code> to <code>\n</code>?</p> <p><strong>Note</strong> I haven't used git ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,645
git
# Git: convert carriage return \r to new line \n with git hook? A fellow coder uses a Windows computer that is putting carriage returns everywhere in our source. Is there a way to write a git hook that converts all `\r\n` to `\n`? **Note** I haven't used git hooks before, so a little extra hand-holding might go a lo...
The simplest thing is to [set `core.autocrlf` to false](https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278) on The Windows side. (that way Git won't do any conversion and will keep the eol untouched). On the unix side, a `core.autocrlf` set to true could help res...
3127888
Why doesn't git diff work on the command line for me?
8
2010-06-27 16:00:01
<p>Every piece of documentation I've read on git (including the online book and the built-in help) says I can type "git diff" from command line, but whenever I do that I get:</p> <p><code>usage: git diff [--no-index] &lt;path&gt; &lt;path&gt;</code></p> <p>Here's what I've tried so far (all are examples from the docu...
5,684
377,446
2011-03-14 17:31:34
3,127,920
11
2010-06-27 16:09:17
85,134
2010-06-27 16:09:17
https://stackoverflow.com/q/3127888
https://stackoverflow.com/a/3127920
<p>Are you actually inside a directory with a Git repository when you're running these? (<code>git rev-parse --git-dir</code>) The command needs to be able to find the repository and determine what your working tree is in order to produce useful output. Otherwise (if a repository cannot be identified), it defaults to b...
<p>Are you actually inside a directory with a Git repository when you're running these? (<code>git rev-parse --git-dir</code>) The command needs to be able to find the repository and determine what your working tree is in order to produce useful output. Otherwise (if a repository cannot be identified), it defaults to b...
119, 606
diff, git
<h1>Why doesn't git diff work on the command line for me?</h1> <p>Every piece of documentation I've read on git (including the online book and the built-in help) says I can type "git diff" from command line, but whenever I do that I get:</p> <p><code>usage: git diff [--no-index] &lt;path&gt; &lt;path&gt;</code></p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,648
git
# Why doesn't git diff work on the command line for me? Every piece of documentation I've read on git (including the online book and the built-in help) says I can type "git diff" from command line, but whenever I do that I get: `usage: git diff [--no-index] <path> <path>` Here's what I've tried so far (all are examp...
Are you actually inside a directory with a Git repository when you're running these? (`git rev-parse --git-dir`) The command needs to be able to find the repository and determine what your working tree is in order to produce useful output. Otherwise (if a repository cannot be identified), it defaults to being a plain r...
2152595
git-svn create branch off past revision
8
2010-01-28 05:56:23
<p>I know how to <a href="https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git">create an svn branch w/git</a>. But, can I do that off of a past revision/commit ?</p>
1,476
132,426
2014-07-08 14:04:17
2,152,847
11
2010-01-28 07:05:27
132,426
2010-01-28 07:05:27
https://stackoverflow.com/q/2152595
https://stackoverflow.com/a/2152847
<p>Answer for myself (and anyone else) - not strictly git-svn, but it works:</p> <pre><code>svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch' # in your git working directory git svn fetch git branch -a </code></pre> <p>You should see <code>remotes/mybranch</...
<p>Answer for myself (and anyone else) - not strictly git-svn, but it works:</p> <pre><code>svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch' # in your git working directory git svn fetch git branch -a </code></pre> <p>You should see <code>remotes/mybranch</...
63, 119
git, svn
<h1>git-svn create branch off past revision</h1> <p>I know how to <a href="https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git">create an svn branch w/git</a>. But, can I do that off of a past revision/commit ?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,649
git
# git-svn create branch off past revision I know how to [create an svn branch w/git](https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git). But, can I do that off of a past revision/commit ?
Answer for myself (and anyone else) - not strictly git-svn, but it works: ``` svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch' # in your git working directory git svn fetch git branch -a ``` You should see `remotes/mybranch` in that list, now create a local...
889984
bring git repo up to a certain revision
8
2009-05-20 20:10:59
<p>I have a git repo, and a revision code I want it to get my local clone to. How can I bring it up to a specific revision and get rid of any changes I've made?</p>
2,760
73,450
2009-05-20 20:15:14
890,006
11
2009-05-20 20:15:14
90,322
2009-05-20 20:15:14
https://stackoverflow.com/q/889984
https://stackoverflow.com/a/890006
<p>Checkout the branch you want to mess with. Find the revision that you want in the log, then do:</p> <pre><code>$ git reset --hard abcd93 </code></pre> <p>With <em>abcd93</em> being whatever version you found in the log. Note though, that this will change the branch pointer.</p> <p>It is usually best to spawn off ...
<p>Checkout the branch you want to mess with. Find the revision that you want in the log, then do:</p> <pre><code>$ git reset --hard abcd93 </code></pre> <p>With <em>abcd93</em> being whatever version you found in the log. Note though, that this will change the branch pointer.</p> <p>It is usually best to spawn off ...
119
git
<h1>bring git repo up to a certain revision</h1> <p>I have a git repo, and a revision code I want it to get my local clone to. How can I bring it up to a specific revision and get rid of any changes I've made?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,651
git
# bring git repo up to a certain revision I have a git repo, and a revision code I want it to get my local clone to. How can I bring it up to a specific revision and get rid of any changes I've made?
Checkout the branch you want to mess with. Find the revision that you want in the log, then do: ``` $ git reset --hard abcd93 ``` With *abcd93* being whatever version you found in the log. Note though, that this will change the branch pointer. It is usually best to spawn off a new branch, so consider ``` $ git chec...
66087700
Is there a danger of using "git push --force" if I am working on a project alone?
7
2021-02-07 12:04:46
<p>Is there a danger of using <code>git push --force</code> if I am working on a project alone? I know there are danger when I am working with a team. But what if I am alone?</p>
24,305
9,953,550
2021-02-09 14:29:15
66,087,818
11
2021-02-07 12:17:12
717,372
2021-02-09 14:29:15
https://stackoverflow.com/q/66087700
https://stackoverflow.com/a/66087818
<p>The main danger when you use <code>git push --force</code> is indeed to loose pushed by others developers. So it should not happen.</p> <p>But you still can loose your own commits by mistake...</p> <p>As @Prihex mentioned it rightfully in the comments, in this specific case where you loose one of your own commit by ...
<p>The main danger when you use <code>git push --force</code> is indeed to loose pushed by others developers. So it should not happen.</p> <p>But you still can loose your own commits by mistake...</p> <p>As @Prihex mentioned it rightfully in the comments, in this specific case where you loose one of your own commit by ...
119, 28898, 53850
git, git-commit, git-push
<h1>Is there a danger of using "git push --force" if I am working on a project alone?</h1> <p>Is there a danger of using <code>git push --force</code> if I am working on a project alone? I know there are danger when I am working with a team. But what if I am alone?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,657
git
# Is there a danger of using "git push --force" if I am working on a project alone? Is there a danger of using `git push --force` if I am working on a project alone? I know there are danger when I am working with a team. But what if I am alone?
The main danger when you use `git push --force` is indeed to loose pushed by others developers. So it should not happen. But you still can loose your own commits by mistake... As @Prihex mentioned it rightfully in the comments, in this specific case where you loose one of your own commit by mistake, you will still be...
60816327
difference between git command - checkout and switch
7
2020-03-23 15:15:13
<p>What's the difference between <code>git checkout -b branch_name</code> vs <code>git switch -c branch_name</code>?</p> <p>I tried git command -h as a way to find solution and I was looking for it in documantation. In neither way I managed to find it. In git's documantation I've found this: </p> <blockquote> <p>No...
6,406
10,487,853
2020-03-23 16:36:18
60,817,767
11
2020-03-23 16:36:18
8,899,044
2020-03-23 16:36:18
https://stackoverflow.com/q/60816327
https://stackoverflow.com/a/60817767
<p>Generally, as it was mentioned in the comments there is no actual difference between <code>git switch</code> &amp; <code>git checkout</code> in terms of what You can do with branches. </p> <p>The idea to create the <code>git switch</code> &amp; <code>git restore</code> because they were introduced together, arose f...
<p>Generally, as it was mentioned in the comments there is no actual difference between <code>git switch</code> &amp; <code>git checkout</code> in terms of what You can do with branches. </p> <p>The idea to create the <code>git switch</code> &amp; <code>git restore</code> because they were introduced together, arose f...
119, 456
git, version-control
<h1>difference between git command - checkout and switch</h1> <p>What's the difference between <code>git checkout -b branch_name</code> vs <code>git switch -c branch_name</code>?</p> <p>I tried git command -h as a way to find solution and I was looking for it in documantation. In neither way I managed to find it. In g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,661
git
# difference between git command - checkout and switch What's the difference between `git checkout -b branch_name` vs `git switch -c branch_name`? I tried git command -h as a way to find solution and I was looking for it in documantation. In neither way I managed to find it. In git's documantation I've found this: >...
Generally, as it was mentioned in the comments there is no actual difference between `git switch` & `git checkout` in terms of what You can do with branches. The idea to create the `git switch` & `git restore` because they were introduced together, arose from multiple questions & issues that new users had with `git ch...
58731178
How to stage single lines in git using git bash?
7
2019-11-06 13:22:22
<p>Just create an folder containing an empty <code>test.txt</code> file, add and commit it. Then add the following:</p> <pre><code>new line keep new line skip new line bad new line keep 2 </code></pre> <p>Now assume, I only want to keep the first and the last line. According to this <a href="https://stackoverflow....
3,045
5,784,831
2019-11-06 19:48:56
58,731,238
11
2019-11-06 13:24:59
11,239,008
2019-11-06 13:37:19
https://stackoverflow.com/q/58731178
https://stackoverflow.com/a/58731238
<p>This is very easy to do in <code>git gui</code>. Select the file in the staging window. Highlight the line(s) you want then right-click in text area and select "Stage Line For Commit"</p> <p>For the command line: Select <code>e</code> to manually split hunk. This will bring up a text editor. Change the <code>+</cod...
<p>This is very easy to do in <code>git gui</code>. Select the file in the staging window. Highlight the line(s) you want then right-click in text area and select "Stage Line For Commit"</p> <p>For the command line: Select <code>e</code> to manually split hunk. This will bring up a text editor. Change the <code>+</cod...
119
git
<h1>How to stage single lines in git using git bash?</h1> <p>Just create an folder containing an empty <code>test.txt</code> file, add and commit it. Then add the following:</p> <pre><code>new line keep new line skip new line bad new line keep 2 </code></pre> <p>Now assume, I only want to keep the first and the la...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,662
git
# How to stage single lines in git using git bash? Just create an folder containing an empty `test.txt` file, add and commit it. Then add the following: ``` new line keep new line skip new line bad new line keep 2 ``` Now assume, I only want to keep the first and the last line. According to this [answer](https://...
This is very easy to do in `git gui`. Select the file in the staging window. Highlight the line(s) you want then right-click in text area and select "Stage Line For Commit" For the command line: Select `e` to manually split hunk. This will bring up a text editor. Change the `+` to a `#`for any lines you don't want to ...
57726872
BUG: There are unmerged index entries
7
2019-08-30 12:34:43
<p>I am trying to merge with a branch, and this is the error I'm getting:</p> <pre><code>BUG: There are unmerged index entries: BUG: 2 src/assets/svg/arrow-black.svg BUG: merge-recursive.c:429: unmerged index entries in merge-recursive.c </code></pre> <p>I don't really know what else to add. I've been searching, but ...
3,654
7,055,769
2022-02-28 13:33:23
57,755,459
11
2019-09-02 10:35:40
7,055,769
2022-02-28 13:33:23
https://stackoverflow.com/q/57726872
https://stackoverflow.com/a/57755459
<p>Thank you <a href="https://stackoverflow.com/users/7050130/mark-adelsberger">Mark Adelsberger</a> for the suggestion.</p> <p>This is the answer that helped me <a href="https://stackoverflow.com/a/6013497/7055769">https://stackoverflow.com/a/6013497/7055769</a></p> <p>I fixed it by running</p> <pre><code>git merge -s...
<p>Thank you <a href="https://stackoverflow.com/users/7050130/mark-adelsberger">Mark Adelsberger</a> for the suggestion.</p> <p>This is the answer that helped me <a href="https://stackoverflow.com/a/6013497/7055769">https://stackoverflow.com/a/6013497/7055769</a></p> <p>I fixed it by running</p> <pre><code>git merge -s...
119
git
<h1>BUG: There are unmerged index entries</h1> <p>I am trying to merge with a branch, and this is the error I'm getting:</p> <pre><code>BUG: There are unmerged index entries: BUG: 2 src/assets/svg/arrow-black.svg BUG: merge-recursive.c:429: unmerged index entries in merge-recursive.c </code></pre> <p>I don't really k...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,663
git
# BUG: There are unmerged index entries I am trying to merge with a branch, and this is the error I'm getting: ``` BUG: There are unmerged index entries: BUG: 2 src/assets/svg/arrow-black.svg BUG: merge-recursive.c:429: unmerged index entries in merge-recursive.c ``` I don't really know what else to add. I've been s...
Thank you [Mark Adelsberger](https://stackoverflow.com/users/7050130/mark-adelsberger) for the suggestion. This is the answer that helped me <https://stackoverflow.com/a/6013497/7055769> I fixed it by running ``` git merge -s resolve branch_A ```
57702930
Cloning all remote repositories from TFS
7
2019-08-29 04:21:40
<p>Is there a way to clone all the <code>master</code> branches from all the projects uploaded under 1 account.</p> <p>I have a requirement to backup all the code in <code>master</code> branch every week. Is there a way to accomplish this using git, Powershell or any other way?</p> <p><strong>Note</strong> that I req...
4,959
5,733,738
2022-12-08 20:03:34
57,707,245
11
2019-08-29 09:34:46
7,409,220
2022-12-08 20:03:34
https://stackoverflow.com/q/57702930
https://stackoverflow.com/a/57707245
<p>You can do it with PowerShell and <a href="https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1" rel="nofollow noreferrer">TFS Rest API</a>.</p> <p>First of all, get the projects with <a href="https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view=azure-devops-...
<p>You can do it with PowerShell and <a href="https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1" rel="nofollow noreferrer">TFS Rest API</a>.</p> <p>First of all, get the projects with <a href="https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view=azure-devops-...
119, 733, 134617
azure-devops-rest-api, git, tfs
<h1>Cloning all remote repositories from TFS</h1> <p>Is there a way to clone all the <code>master</code> branches from all the projects uploaded under 1 account.</p> <p>I have a requirement to backup all the code in <code>master</code> branch every week. Is there a way to accomplish this using git, Powershell or any o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,664
git
# Cloning all remote repositories from TFS Is there a way to clone all the `master` branches from all the projects uploaded under 1 account. I have a requirement to backup all the code in `master` branch every week. Is there a way to accomplish this using git, Powershell or any other way? **Note** that I required to...
You can do it with PowerShell and [TFS Rest API](https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1). First of all, get the projects with [Projects - List API](https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view=azure-devops-rest-5.1), then get to each proje...
54567567
How can I search my ENTIRE git repo's commit history for a string change?
7
2019-02-07 06:33:56
<p>I have a website/repo.</p> <p>Part of my website says:</p> <p>"Powered by <a href="https://myotherwebsite.com/" rel="nofollow noreferrer">https://myotherwebsite.com/</a>'"</p> <p>at some point, some troll I had working on the website switched it to say:</p> <p>"Powered by <a href="https://theirwebsite.com" rel="...
1,183
10,821,986
2019-04-09 21:37:18
54,567,708
11
2019-02-07 06:44:35
1,057,485
2019-03-09 13:20:11
https://stackoverflow.com/q/54567567
https://stackoverflow.com/a/54567708
<p>If you can ignore dead branches and assume that all relevant code is reachable from your most recent master version, I'd recommend using the <code>-S</code> option of git log :</p> <pre><code>git log -S "theirwebsite" </code></pre> <p>Take a look at the <a href="https://git-scm.com/docs/git-log#git-log--Sltstringg...
<p>If you can ignore dead branches and assume that all relevant code is reachable from your most recent master version, I'd recommend using the <code>-S</code> option of git log :</p> <pre><code>git log -S "theirwebsite" </code></pre> <p>Take a look at the <a href="https://git-scm.com/docs/git-log#git-log--Sltstringg...
18, 119, 456, 47913
git, git-log, regex, version-control
<h1>How can I search my ENTIRE git repo's commit history for a string change?</h1> <p>I have a website/repo.</p> <p>Part of my website says:</p> <p>"Powered by <a href="https://myotherwebsite.com/" rel="nofollow noreferrer">https://myotherwebsite.com/</a>'"</p> <p>at some point, some troll I had working on the websi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,668
git
# How can I search my ENTIRE git repo's commit history for a string change? I have a website/repo. Part of my website says: "Powered by <https://myotherwebsite.com/>'" at some point, some troll I had working on the website switched it to say: "Powered by <https://theirwebsite.com>" How can I search the entire rep...
If you can ignore dead branches and assume that all relevant code is reachable from your most recent master version, I'd recommend using the `-S` option of git log : ``` git log -S "theirwebsite" ``` Take a look at the [doc](https://git-scm.com/docs/git-log#git-log--Sltstringgt), and maybe consider using [regexp](htt...
51909540
Why use "HEAD:master" instead of just "master" in a "git push origin"
7
2018-08-18 14:13:37
<p>I am synching multiple git repositories. It's challenging; I can sync just the diffs easily, but if I want to sync changes I need to do pulls and pushes, and (sometimes) resolve the conflicts locally.</p> <p>Sometimes, when I do a <code>git push</code>, git tells me to use:</p> <pre><code>git push origin HEAD:&lt;...
12,890
51,167
2021-10-12 09:38:07
51,909,592
11
2018-08-18 14:22:01
82,294
2018-08-18 14:22:01
https://stackoverflow.com/q/51909540
https://stackoverflow.com/a/51909592
<p>When you run</p> <pre><code>git push origin X:Y </code></pre> <p>What happens is that you push something locally named X to the remote name Y. HEAD is an alias for whatever is currently checked out. If you currently have master checked out, then this is equivalent to</p> <pre><code>git push origin master:master <...
<p>When you run</p> <pre><code>git push origin X:Y </code></pre> <p>What happens is that you push something locally named X to the remote name Y. HEAD is an alias for whatever is currently checked out. If you currently have master checked out, then this is equivalent to</p> <pre><code>git push origin master:master <...
119
git
<h1>Why use "HEAD:master" instead of just "master" in a "git push origin"</h1> <p>I am synching multiple git repositories. It's challenging; I can sync just the diffs easily, but if I want to sync changes I need to do pulls and pushes, and (sometimes) resolve the conflicts locally.</p> <p>Sometimes, when I do a <code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,670
git
# Why use "HEAD:master" instead of just "master" in a "git push origin" I am synching multiple git repositories. It's challenging; I can sync just the diffs easily, but if I want to sync changes I need to do pulls and pushes, and (sometimes) resolve the conflicts locally. Sometimes, when I do a `git push`, git tells ...
When you run ``` git push origin X:Y ``` What happens is that you push something locally named X to the remote name Y. HEAD is an alias for whatever is currently checked out. If you currently have master checked out, then this is equivalent to ``` git push origin master:master ``` If you have a different branch che...
51724436
Percentage symbol at the end of git log --pretty=format
7
2018-08-07 10:22:58
<p>When I run</p> <pre><code>git log --pretty=format:%s -1 </code></pre> <p>I get this feedback:</p> <pre><code>Merge branch 'feature/416_NewTemplate' into develop% </code></pre> <p>A percentage symbol, black text on white background, appears at the end for some reason. I can't find why. I removed all my gitconf...
1,430
5,592,833
2018-08-08 07:26:26
51,740,738
11
2018-08-08 07:20:09
1,848,654
2018-08-08 07:26:26
https://stackoverflow.com/q/51724436
https://stackoverflow.com/a/51740738
<p>That <code>%</code> is zsh indicating that the last line of output wasn't properly terminated (no newline). See also <a href="http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting" rel="noreferrer">http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting</a>.</p> <p>As described in <a href="https://www...
<p>That <code>%</code> is zsh indicating that the last line of output wasn't properly terminated (no newline). See also <a href="http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting" rel="noreferrer">http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting</a>.</p> <p>As described in <a href="https://www...
119, 3791
git, zsh
<h1>Percentage symbol at the end of git log --pretty=format</h1> <p>When I run</p> <pre><code>git log --pretty=format:%s -1 </code></pre> <p>I get this feedback:</p> <pre><code>Merge branch 'feature/416_NewTemplate' into develop% </code></pre> <p>A percentage symbol, black text on white background, appears at the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,671
git
# Percentage symbol at the end of git log --pretty=format When I run ``` git log --pretty=format:%s -1 ``` I get this feedback: ``` Merge branch 'feature/416_NewTemplate' into develop% ``` A percentage symbol, black text on white background, appears at the end for some reason. I can't find why. I removed all my gi...
That `%` is zsh indicating that the last line of output wasn't properly terminated (no newline). See also <http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting>. As described in [`man git-log`](https://www.git-scm.com/docs/git-log#_pretty_formats), you probably want `--pretty=tformat:%s`, not `format:`. > - ...
51210915
Understanding the output of git status with the short flag
7
2018-07-06 12:55:58
<pre><code>$ git status -s M README MM Rakefile A lib/git.rb M lib/simplegit.rb ?? LICENSE.txt </code></pre> <p>There are two columns to the output - the left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree. So for example in that output, the R...
6,288
9,993,284
2022-09-11 21:18:22
51,213,527
11
2018-07-06 15:25:28
1,256,452
2022-09-11 21:18:22
https://stackoverflow.com/q/51210915
https://stackoverflow.com/a/51213527
<blockquote> <p>&quot;the README file is modified in the working directory but not yet staged&quot;: We're not tracking this file. Still, Git understands that it has been modified. From the last snapshot.</p> </blockquote> <p>No, this is wrong: specifically, the file <em>is</em> staged (and the staged copy matches the ...
<blockquote> <p>&quot;the README file is modified in the working directory but not yet staged&quot;: We're not tracking this file. Still, Git understands that it has been modified. From the last snapshot.</p> </blockquote> <p>No, this is wrong: specifically, the file <em>is</em> staged (and the staged copy matches the ...
119, 3819
git, terminology
<h1>Understanding the output of git status with the short flag</h1> <pre><code>$ git status -s M README MM Rakefile A lib/git.rb M lib/simplegit.rb ?? LICENSE.txt </code></pre> <p>There are two columns to the output - the left-hand column indicates the status of the staging area and the right-hand column indicates ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,672
git
# Understanding the output of git status with the short flag ``` $ git status -s M README MM Rakefile A lib/git.rb M lib/simplegit.rb ?? LICENSE.txt ``` There are two columns to the output - the left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working ...
> "the README file is modified in the working directory but not yet staged": We're not tracking this file. Still, Git understands that it has been modified. From the last snapshot. No, this is wrong: specifically, the file *is* staged (and the staged copy matches the `HEAD` copy, and this makes the file *tracked*). Th...
50093304
Does circleci checkout pull the latest code from master or the code for the specific commit
7
2018-04-30 02:38:05
<p>Hello stackoverflow/circleci gods.</p> <p>I have been using circleCI for a while now and I have a question about the 'checkout' step which I will do my best to explain. This is a snippet from my circleCI config file (I have a job 'a-job' whose first step is checkout):</p> <pre><code>a-job: docker: - image: d...
4,621
8,763,034
2018-04-30 22:05:12
50,106,998
11
2018-04-30 19:31:24
1,195,276
2018-04-30 19:31:24
https://stackoverflow.com/q/50093304
https://stackoverflow.com/a/50106998
<p><em>disclaimer: Developer Evangelist at CircleCI</em></p> <p>VonC's answer is incorrect. In CircleCI 2.0 (which is what that config is), the "special step" <code>checkout</code> checks out the current commit. The current commit is the commit that initiated the CI run in the first place.</p> <p>So whenever you <cod...
<p><em>disclaimer: Developer Evangelist at CircleCI</em></p> <p>VonC's answer is incorrect. In CircleCI 2.0 (which is what that config is), the "special step" <code>checkout</code> checks out the current commit. The current commit is the commit that initiated the CI run in the first place.</p> <p>So whenever you <cod...
119, 90475
circleci, git
<h1>Does circleci checkout pull the latest code from master or the code for the specific commit</h1> <p>Hello stackoverflow/circleci gods.</p> <p>I have been using circleCI for a while now and I have a question about the 'checkout' step which I will do my best to explain. This is a snippet from my circleCI config file...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,674
git
# Does circleci checkout pull the latest code from master or the code for the specific commit Hello stackoverflow/circleci gods. I have been using circleCI for a while now and I have a question about the 'checkout' step which I will do my best to explain. This is a snippet from my circleCI config file (I have a job '...
*disclaimer: Developer Evangelist at CircleCI* VonC's answer is incorrect. In CircleCI 2.0 (which is what that config is), the "special step" `checkout` checks out the current commit. The current commit is the commit that initiated the CI run in the first place. So whenever you `git push` to GitHub or Bitbucket, that...
48578095
How do you abort git merge at the prompt "Please enter a commit message to explain why this merge is necessary."
7
2018-02-02 07:52:17
<p>Right before pulling I ran <code>git reset HEAD --hard</code>. Then I <code>git pull</code>ed and got the message</p> <blockquote> <p>Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream...</p> </blockquote> <p>Is it possible to issue a <code>merge --abort...
2,890
7,100,300
2018-02-02 08:30:41
48,578,137
11
2018-02-02 07:54:35
625,403
2018-02-02 07:54:35
https://stackoverflow.com/q/48578095
https://stackoverflow.com/a/48578137
<p>Generally when git asks you to edit a text file as part of some action, you can abort the action by saving an empty text file. This works for commit messages as well as for, e.g., <code>git rebase -i</code>.</p>
<p>Generally when git asks you to edit a text file as part of some action, you can abort the action by saving an empty text file. This works for commit messages as well as for, e.g., <code>git rebase -i</code>.</p>
119
git
<h1>How do you abort git merge at the prompt "Please enter a commit message to explain why this merge is necessary."</h1> <p>Right before pulling I ran <code>git reset HEAD --hard</code>. Then I <code>git pull</code>ed and got the message</p> <blockquote> <p>Please enter a commit message to explain why this merge is ne...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,675
git
# How do you abort git merge at the prompt "Please enter a commit message to explain why this merge is necessary." Right before pulling I ran `git reset HEAD --hard`. Then I `git pull`ed and got the message > Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upst...
Generally when git asks you to edit a text file as part of some action, you can abort the action by saving an empty text file. This works for commit messages as well as for, e.g., `git rebase -i`.
37868225
ignore whitespace/identation in annotate mode with Intelliji and git
7
2016-06-16 19:50:09
<p><code>git blame</code> , on a file , give for each line which was the last commit who have update the line.(like the annotate action on the IDE)</p> <p><code>git blame -w</code> do the same , but only if the commit do more than indentatation or whitespace.</p> <p>My issue is, how can I ignore the whitespace with a...
2,124
2,560,685
2018-12-29 20:38:07
44,062,545
11
2017-05-19 06:06:32
2,247,103
2017-05-19 06:06:32
https://stackoverflow.com/q/37868225
https://stackoverflow.com/a/44062545
<p>IntelliJ uses <code>git blame -w</code> by default, as described in this question: <a href="https://stackoverflow.com/questions/34825675/intellij-annotate-vs-git-blame">IntelliJ annotate vs git blame</a></p> <p>But there isn't an option to change this behaviour as it is hardcoded into the IDEA Git plugin.</p>
<p>IntelliJ uses <code>git blame -w</code> by default, as described in this question: <a href="https://stackoverflow.com/questions/34825675/intellij-annotate-vs-git-blame">IntelliJ annotate vs git blame</a></p> <p>But there isn't an option to change this behaviour as it is hardcoded into the IDEA Git plugin.</p>
119, 8945, 21455
blame, git, intellij-idea
<h1>ignore whitespace/identation in annotate mode with Intelliji and git</h1> <p><code>git blame</code> , on a file , give for each line which was the last commit who have update the line.(like the annotate action on the IDE)</p> <p><code>git blame -w</code> do the same , but only if the commit do more than indentatat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,676
git
# ignore whitespace/identation in annotate mode with Intelliji and git `git blame` , on a file , give for each line which was the last commit who have update the line.(like the annotate action on the IDE) `git blame -w` do the same , but only if the commit do more than indentatation or whitespace. My issue is, how c...
IntelliJ uses `git blame -w` by default, as described in this question: [IntelliJ annotate vs git blame](https://stackoverflow.com/questions/34825675/intellij-annotate-vs-git-blame) But there isn't an option to change this behaviour as it is hardcoded into the IDEA Git plugin.
43281313
Git: alternative for stash
7
2017-04-07 14:59:47
<p>I'm using <strong>Git Extensions</strong> for my projects. I really like it. There is an issue that keeps bugging me and I'm pretty sure there is a trick in Git Extensions for it. Here is the scenario: </p> <ul> <li>From master branch, I created 3 branches <code>A</code>, <code>B</code> and <code>C</code>.</li> <li...
6,056
7,512,358
2017-04-09 19:32:41
43,281,409
11
2017-04-07 15:04:45
1,755,598
2017-04-07 15:04:45
https://stackoverflow.com/q/43281313
https://stackoverflow.com/a/43281409
<h1><strong><em><code>git worktree</code></em></strong></h1> <p>Git worktree was introduced in 2007 under the <code>contrib</code> folder in git repo and was called <code>new-workdir</code>. </p> <hr> <p>for example:</p> <pre><code>git worktree add &lt;second path&gt; </code></pre> <p>will create another folder on...
<h1><strong><em><code>git worktree</code></em></strong></h1> <p>Git worktree was introduced in 2007 under the <code>contrib</code> folder in git repo and was called <code>new-workdir</code>. </p> <hr> <p>for example:</p> <pre><code>git worktree add &lt;second path&gt; </code></pre> <p>will create another folder on...
119, 39597, 117020
git, git-extensions, git-worktree
<h1>Git: alternative for stash</h1> <p>I'm using <strong>Git Extensions</strong> for my projects. I really like it. There is an issue that keeps bugging me and I'm pretty sure there is a trick in Git Extensions for it. Here is the scenario: </p> <ul> <li>From master branch, I created 3 branches <code>A</code>, <code>B...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,678
git
# Git: alternative for stash I'm using **Git Extensions** for my projects. I really like it. There is an issue that keeps bugging me and I'm pretty sure there is a trick in Git Extensions for it. Here is the scenario: - From master branch, I created 3 branches `A`, `B` and `C`. - Started working in branch `A`, did so...
# ***`git worktree`*** Git worktree was introduced in 2007 under the `contrib` folder in git repo and was called `new-workdir`. --- for example: ``` git worktree add <second path> ``` will create another folder on your computer which allow you to work on different branch simultaneously. `git worktree` will create...
39579936
Files to exclude from GIT for Android Studio Gradle Project to maintain the code in MAC as well as Windows.?
7
2016-09-19 18:36:51
<p>I code in MAC - OSX and my partner codes in PC - Windows but when I commit and push changes there are multiple files in project directories ending with .IML or .config or .properties, which gets overwritten and cause frequent overwrites which is a nuisance.</p> <p>So my question is which files can be excluded from ...
4,509
1,143,807
2016-09-19 18:50:45
39,580,041
11
2016-09-19 18:44:29
1,974,614
2016-09-19 18:50:45
https://stackoverflow.com/q/39579936
https://stackoverflow.com/a/39580041
<p>Here is a decent <code>.gitignore</code> file which you put in the root directory of your project, e.g. the folder where the <code>.git</code> folder is:</p> <pre><code>#built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration ...
<p>Here is a decent <code>.gitignore</code> file which you put in the root directory of your project, e.g. the folder where the <code>.git</code> folder is:</p> <pre><code>#built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration ...
64, 119, 369, 1386, 32307
android, git, gradle, macos, windows
<h1>Files to exclude from GIT for Android Studio Gradle Project to maintain the code in MAC as well as Windows.?</h1> <p>I code in MAC - OSX and my partner codes in PC - Windows but when I commit and push changes there are multiple files in project directories ending with .IML or .config or .properties, which gets over...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,682
git
# Files to exclude from GIT for Android Studio Gradle Project to maintain the code in MAC as well as Windows.? I code in MAC - OSX and my partner codes in PC - Windows but when I commit and push changes there are multiple files in project directories ending with .IML or .config or .properties, which gets overwritten a...
Here is a decent `.gitignore` file which you put in the root directory of your project, e.g. the folder where the `.git` folder is: ``` #built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.propertie...
38848334
Is there any difference between `git gc` and `git repack -ad; git prune`?
7
2016-08-09 10:32:56
<p>Is there any difference between <code>git gc</code> and <code>git repack -ad; git prune</code>?<br> If yes, what additional steps will be done by <code>git gc</code> (or vice versa)?<br> Which one is better to use in regard to space optimization or safety?</p>
3,278
2,493,081
2021-05-09 23:32:21
38,850,390
11
2016-08-09 12:12:15
26,396
2016-08-10 14:58:53
https://stackoverflow.com/q/38848334
https://stackoverflow.com/a/38850390
<blockquote> <p>Is there any difference between <code>git gc</code> and <code>git repack -ad; git prune</code>?</p> </blockquote> <p>The difference is that by default <code>git gc</code> is very conservative about what housekeeping tasks are needed. For example, it won't run <code>git repack</code> unless the number...
<blockquote> <p>Is there any difference between <code>git gc</code> and <code>git repack -ad; git prune</code>?</p> </blockquote> <p>The difference is that by default <code>git gc</code> is very conservative about what housekeeping tasks are needed. For example, it won't run <code>git repack</code> unless the number...
119, 44929
git, git-gc
<h1>Is there any difference between `git gc` and `git repack -ad; git prune`?</h1> <p>Is there any difference between <code>git gc</code> and <code>git repack -ad; git prune</code>?<br> If yes, what additional steps will be done by <code>git gc</code> (or vice versa)?<br> Which one is better to use in regard to space o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,683
git
# Is there any difference between `git gc` and `git repack -ad; git prune`? Is there any difference between `git gc` and `git repack -ad; git prune`? If yes, what additional steps will be done by `git gc` (or vice versa)? Which one is better to use in regard to space optimization or safety?
> Is there any difference between `git gc` and `git repack -ad; git prune`? The difference is that by default `git gc` is very conservative about what housekeeping tasks are needed. For example, it won't run `git repack` unless the number of loose objects in the repository is above a certain threshold (configurable vi...
38135810
Why git push --quiet produce output?
7
2016-07-01 01:48:43
<p>I'm doing git push with a quiet flag and expect that git will not produce any messages. The documentation says </p> <blockquote> <p><strong>--quiet</strong> Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to the standard error stream.</p> </blockquote...
8,279
4,517,895
2021-05-01 21:48:37
38,135,823
11
2016-07-01 01:51:53
3,195,526
2016-07-01 01:51:53
https://stackoverflow.com/q/38135810
https://stackoverflow.com/a/38135823
<p>It's the <code>--set-upstream</code> that is producing that message. The <code>push</code> is totally quiet. <code>--set-upstream</code> is effectively a call-out to <code>git branch -u upstream/foo</code>. If you want <code>git branch</code> to be silent, you will need to call it yourself, with its own <code>--qui...
<p>It's the <code>--set-upstream</code> that is producing that message. The <code>push</code> is totally quiet. <code>--set-upstream</code> is effectively a call-out to <code>git branch -u upstream/foo</code>. If you want <code>git branch</code> to be silent, you will need to call it yourself, with its own <code>--qui...
119
git
<h1>Why git push --quiet produce output?</h1> <p>I'm doing git push with a quiet flag and expect that git will not produce any messages. The documentation says </p> <blockquote> <p><strong>--quiet</strong> Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,684
git
# Why git push --quiet produce output? I'm doing git push with a quiet flag and expect that git will not produce any messages. The documentation says > **--quiet** Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to the standard error > stream. but I still ...
It's the `--set-upstream` that is producing that message. The `push` is totally quiet. `--set-upstream` is effectively a call-out to `git branch -u upstream/foo`. If you want `git branch` to be silent, you will need to call it yourself, with its own `--quiet` option.
37673813
How to rebase commits from another repository with a different history?
7
2016-06-07 08:06:09
<p>We have two Git repositories. </p> <p>Repo 1. Commits: A, B, C. This repository was created from SVN history.</p> <p>Repo 2. Commits: D, E, F. This repository was created without SVN history, just by using the working copy (as of commit C) which became the commit D. In another words, the file trees of the commits ...
6,605
404,615
2016-06-08 08:19:56
37,674,353
11
2016-06-07 08:34:33
26,396
2016-06-08 08:19:56
https://stackoverflow.com/q/37673813
https://stackoverflow.com/a/37674353
<p>The easiest thing to do would be to add <em>Repo 2</em> as a <a href="https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes" rel="noreferrer">remote</a> in <em>Repo 1</em> using its <em>physical path</em> on disk and then simply <a href="https://git-scm.com/docs/git-cherry-pick" rel="noreferrer">cherry pick...
<p>The easiest thing to do would be to add <em>Repo 2</em> as a <a href="https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes" rel="noreferrer">remote</a> in <em>Repo 1</em> using its <em>physical path</em> on disk and then simply <a href="https://git-scm.com/docs/git-cherry-pick" rel="noreferrer">cherry pick...
119, 456, 717, 8974
git, merge, rebase, version-control
<h1>How to rebase commits from another repository with a different history?</h1> <p>We have two Git repositories. </p> <p>Repo 1. Commits: A, B, C. This repository was created from SVN history.</p> <p>Repo 2. Commits: D, E, F. This repository was created without SVN history, just by using the working copy (as of comm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,685
git
# How to rebase commits from another repository with a different history? We have two Git repositories. Repo 1. Commits: A, B, C. This repository was created from SVN history. Repo 2. Commits: D, E, F. This repository was created without SVN history, just by using the working copy (as of commit C) which became the c...
The easiest thing to do would be to add *Repo 2* as a [remote](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) in *Repo 1* using its *physical path* on disk and then simply [cherry pick](https://git-scm.com/docs/git-cherry-pick) commits `E` and `F` on top of `C`. So, in *Repo 1* you would do: ``` git ...
34550249
How to get the "committer" info that Git will use
7
2015-12-31 18:21:36
<p>Reading the doc, I see that I could predict what Git will use as "committer" by combining <code>git config user.name</code> and <code>git config user.email</code> along with <code>$GIT_COMMITTER_NAME</code> and <code>$GIT_COMMITTER_EMAIL</code>. But when I write the code which does that, I end up with the feeling t...
2,172
1,283,394
2019-08-28 02:36:09
34,550,442
11
2015-12-31 18:41:00
null
2015-12-31 18:41:00
https://stackoverflow.com/q/34550249
https://stackoverflow.com/a/34550442
<p>You can use the <code>git var</code> command:</p> <pre><code>git var GIT_COMMITTER_IDENT </code></pre> <p>This can be run outside of any Git worktree, prints the committer info in the format <code>name &lt;email&gt; timestamp timezone</code>, and uses the same Git code that also gets run when committing, so respec...
<p>You can use the <code>git var</code> command:</p> <pre><code>git var GIT_COMMITTER_IDENT </code></pre> <p>This can be run outside of any Git worktree, prints the committer info in the format <code>name &lt;email&gt; timestamp timezone</code>, and uses the same Git code that also gets run when committing, so respec...
119
git
<h1>How to get the "committer" info that Git will use</h1> <p>Reading the doc, I see that I could predict what Git will use as "committer" by combining <code>git config user.name</code> and <code>git config user.email</code> along with <code>$GIT_COMMITTER_NAME</code> and <code>$GIT_COMMITTER_EMAIL</code>. But when I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,686
git
# How to get the "committer" info that Git will use Reading the doc, I see that I could predict what Git will use as "committer" by combining `git config user.name` and `git config user.email` along with `$GIT_COMMITTER_NAME` and `$GIT_COMMITTER_EMAIL`. But when I write the code which does that, I end up with the feel...
You can use the `git var` command: ``` git var GIT_COMMITTER_IDENT ``` This can be run outside of any Git worktree, prints the committer info in the format `name <email> timestamp timezone`, and uses the same Git code that also gets run when committing, so respects the configuration keys and environment variables. De...
33787890
Creating Git branch tag in VSO or VS2015
7
2015-11-18 18:43:51
<p>Is there a way to create a branch tag in vso?</p> <p>Also, I've tried creating a tag in VS2015 and push a change commit to vso, but I'm not seeing the tag in vso. Just wondering if this VS2015 &lt;-> VSO tagging feature is in place?</p>
4,971
3,419,791
2018-04-20 11:11:37
33,793,973
11
2015-11-19 02:01:31
5,475,003
2015-11-19 02:01:31
https://stackoverflow.com/q/33787890
https://stackoverflow.com/a/33793973
<p>The tag you created in VS2015 is in local repository. VS2015 cannot push the tag to remote repository for now. You need to push the tags to remote repository by following command manually:</p> <pre><code>git push --tags </code></pre> <p>After executing this command, you will see the tags in VSO. <a href="https://i...
<p>The tag you created in VS2015 is in local repository. VS2015 cannot push the tag to remote repository for now. You need to push the tags to remote repository by following command manually:</p> <pre><code>git push --tags </code></pre> <p>After executing this command, you will see the tags in VSO. <a href="https://i...
119, 108143, 116537
azure-devops, git, visual-studio-2015
<h1>Creating Git branch tag in VSO or VS2015</h1> <p>Is there a way to create a branch tag in vso?</p> <p>Also, I've tried creating a tag in VS2015 and push a change commit to vso, but I'm not seeing the tag in vso. Just wondering if this VS2015 &lt;-> VSO tagging feature is in place?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,688
git
# Creating Git branch tag in VSO or VS2015 Is there a way to create a branch tag in vso? Also, I've tried creating a tag in VS2015 and push a change commit to vso, but I'm not seeing the tag in vso. Just wondering if this VS2015 <-> VSO tagging feature is in place?
The tag you created in VS2015 is in local repository. VS2015 cannot push the tag to remote repository for now. You need to push the tags to remote repository by following command manually: ``` git push --tags ``` After executing this command, you will see the tags in VSO. [![enter image description here](https://i.ss...
26917900
Rounding to n significant digits
7
2014-11-13 20:35:29
<p>I'm trying to write code in MATLAB that will round number to certain (as I ask) significant digits.</p> <p>I'm not sure how to do it. Any suggestions?</p>
14,402
2,906,376
2017-05-04 20:19:56
26,917,932
11
2014-11-13 20:37:20
2,586,922
2016-05-25 19:30:43
https://stackoverflow.com/q/26917900
https://stackoverflow.com/a/26917932
<p>To round to <code>d</code> <strong>significant digits</strong>:</p> <pre><code>&gt;&gt; d = 3; %// number of digits &gt;&gt; x = 5.237234; %// example number &gt;&gt; D = 10^(d-ceil(log10(x))); &gt;&gt; y = round(x*D)/D y = 5.2400 </code></pre> <p>To round to <code>d</code> <strong>decimal digits</strong>:</p...
<p>To round to <code>d</code> <strong>significant digits</strong>:</p> <pre><code>&gt;&gt; d = 3; %// number of digits &gt;&gt; x = 5.237234; %// example number &gt;&gt; D = 10^(d-ceil(log10(x))); &gt;&gt; y = round(x*D)/D y = 5.2400 </code></pre> <p>To round to <code>d</code> <strong>decimal digits</strong>:</p...
305, 854, 9914, 12414
digits, floating-point, matlab, significant-digits
<h1>Rounding to n significant digits</h1> <p>I'm trying to write code in MATLAB that will round number to certain (as I ask) significant digits.</p> <p>I'm not sure how to do it. Any suggestions?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,689
git
# Rounding to n significant digits I'm trying to write code in MATLAB that will round number to certain (as I ask) significant digits. I'm not sure how to do it. Any suggestions?
To round to `d` **significant digits**: ``` >> d = 3; %// number of digits >> x = 5.237234; %// example number >> D = 10^(d-ceil(log10(x))); >> y = round(x*D)/D y = 5.2400 ``` To round to `d` **decimal digits**: ``` >> d = 3; %// number of digits >> x = 5.237234; %// example number >> D = 10^d; >> y = round(x*...
22005344
How to debug Cannot run program "C:\Program Files\Git" in a Jenkins job?
7
2014-02-25 05:24:56
<p>I'm using jenkins to build my git project, this is the error I am getting when see the log.<br> I am using git plugin in jenkins.</p> <p>How would you troubleshoot that error message?</p> <pre><code>Started by user anonymous Building in workspace E:\sw\jenkins\workspace\se12 ERROR: Workspace has a .git repository,...
14,863
3,093,983
2021-05-04 10:40:03
22,006,715
11
2014-02-25 06:50:39
6,309
2014-02-25 06:50:39
https://stackoverflow.com/q/22005344
https://stackoverflow.com/a/22006715
<p>Maybe you incorrectly set the git executable path.</p> <p>It shouldn't be <code>C:\Program Files\Git</code>, but <code>C:\Program Files\Git\bin\git.exe</code><br> (this is similar to <a href="https://issues.jenkins-ci.org/browse/JENKINS-6181" rel="noreferrer">JENKINS-6181</a>)</p> <p><a href="https://wiki.jenkins-...
<p>Maybe you incorrectly set the git executable path.</p> <p>It shouldn't be <code>C:\Program Files\Git</code>, but <code>C:\Program Files\Git\bin\git.exe</code><br> (this is similar to <a href="https://issues.jenkins-ci.org/browse/JENKINS-6181" rel="noreferrer">JENKINS-6181</a>)</p> <p><a href="https://wiki.jenkins-...
119, 186, 64999
git, jenkins, testing
<h1>How to debug Cannot run program "C:\Program Files\Git" in a Jenkins job?</h1> <p>I'm using jenkins to build my git project, this is the error I am getting when see the log.<br> I am using git plugin in jenkins.</p> <p>How would you troubleshoot that error message?</p> <pre><code>Started by user anonymous Building...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,690
git
# How to debug Cannot run program "C:\Program Files\Git" in a Jenkins job? I'm using jenkins to build my git project, this is the error I am getting when see the log. I am using git plugin in jenkins. How would you troubleshoot that error message? ``` Started by user anonymous Building in workspace E:\sw\jenkins\w...
Maybe you incorrectly set the git executable path. It shouldn't be `C:\Program Files\Git`, but `C:\Program Files\Git\bin\git.exe` (this is similar to [JENKINS-6181](https://issues.jenkins-ci.org/browse/JENKINS-6181)) [The Git plugin page](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin) does mention: > If y...
19457301
Have .gitignore to NOT ignore an .htaccess file within top level directory
7
2013-10-18 19:08:00
<p>I am trying to ignore ALL files except the .htaccess file within the www directory.</p> <p>I have this:</p> <pre><code># Ignore everything in this directory * # Except this file !.gitignore !/www/.htaccess </code></pre> <p>And I have also tried this:</p> <pre><code># Ignore everything in this directory * # Excep...
14,767
146,602
2021-03-16 17:29:26
19,457,929
11
2013-10-18 19:51:43
1,860,929
2013-10-18 19:59:13
https://stackoverflow.com/q/19457301
https://stackoverflow.com/a/19457929
<p>I tried some sample steps on my machine, try them and check if they work for you.</p> <pre><code>cd ~/Desktop/test mkdir www &amp;&amp; touch .gitignore www/.gitkeep www/.htaccess www/file1 www/file2 git init &amp;&amp; git add www/.gitkeep &amp;&amp; git commit -m "gitkeep to make www trackable" </code></pre> <p>...
<p>I tried some sample steps on my machine, try them and check if they work for you.</p> <pre><code>cd ~/Desktop/test mkdir www &amp;&amp; touch .gitignore www/.gitkeep www/.htaccess www/file1 www/file2 git init &amp;&amp; git add www/.gitkeep &amp;&amp; git commit -m "gitkeep to make www trackable" </code></pre> <p>...
119, 607, 5597
.htaccess, commit, git
<h1>Have .gitignore to NOT ignore an .htaccess file within top level directory</h1> <p>I am trying to ignore ALL files except the .htaccess file within the www directory.</p> <p>I have this:</p> <pre><code># Ignore everything in this directory * # Except this file !.gitignore !/www/.htaccess </code></pre> <p>And I h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,692
git
# Have .gitignore to NOT ignore an .htaccess file within top level directory I am trying to ignore ALL files except the .htaccess file within the www directory. I have this: ``` # Ignore everything in this directory * # Except this file !.gitignore !/www/.htaccess ``` And I have also tried this: ``` # Ignore every...
I tried some sample steps on my machine, try them and check if they work for you. ``` cd ~/Desktop/test mkdir www && touch .gitignore www/.gitkeep www/.htaccess www/file1 www/file2 git init && git add www/.gitkeep && git commit -m "gitkeep to make www trackable" ``` Doing `git status` will now show you ``` .gitignor...
16240989
How do I pull in a new branch from a remote repo?
7
2013-04-26 16:22:32
<p>I forked a repo on github but they than created another branch inside that repo. When I do git fetch upstream it does not create that branch in my repo. How do I do this?</p>
7,540
1,809,913
2013-04-26 18:29:13
16,241,533
11
2013-04-26 16:55:38
46,194
2013-04-26 18:29:13
https://stackoverflow.com/q/16240989
https://stackoverflow.com/a/16241533
<p>After you have done <code>git fetch</code> and gotten the new remote branch <code>origin/branchname</code> you can do</p> <pre><code>git checkout -t origin/branchname </code></pre> <p>This creates a local branch called <code>branchname</code> that tracks the remote branch.</p> <p>If you know for sure that the nam...
<p>After you have done <code>git fetch</code> and gotten the new remote branch <code>origin/branchname</code> you can do</p> <pre><code>git checkout -t origin/branchname </code></pre> <p>This creates a local branch called <code>branchname</code> that tracks the remote branch.</p> <p>If you know for sure that the nam...
119, 1879
branch, git
<h1>How do I pull in a new branch from a remote repo?</h1> <p>I forked a repo on github but they than created another branch inside that repo. When I do git fetch upstream it does not create that branch in my repo. How do I do this?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,693
git
# How do I pull in a new branch from a remote repo? I forked a repo on github but they than created another branch inside that repo. When I do git fetch upstream it does not create that branch in my repo. How do I do this?
After you have done `git fetch` and gotten the new remote branch `origin/branchname` you can do ``` git checkout -t origin/branchname ``` This creates a local branch called `branchname` that tracks the remote branch. If you know for sure that the name of the remote branch is exactly `origin/branchname`, and there is...
15139128
Two-step git import over ssh
7
2013-02-28 15:18:10
<p>Bitbucket has an importer tool for importing repositories from remote locations, but it only supports the <code>git://</code> protocol. Our existing repositories are on a company controlled machine behind a firewall that I can't change, and <code>git://</code> is not available. I need to move the repositories from o...
3,872
418,413
2013-03-06 00:58:23
15,229,676
11
2013-03-05 16:57:33
316,950
2013-03-05 16:57:33
https://stackoverflow.com/q/15139128
https://stackoverflow.com/a/15229676
<p>You'll want to be sure you have the <em>entire</em> history. You can do this by performing a full local bare clone first.</p> <pre><code>git clone --mirror git://LOCAL_URL/somerepo.git </code></pre> <p>Then add the remote and push as Timothy pointed out. Though, you probably want to use something other than origin...
<p>You'll want to be sure you have the <em>entire</em> history. You can do this by performing a full local bare clone first.</p> <pre><code>git clone --mirror git://LOCAL_URL/somerepo.git </code></pre> <p>Then add the remote and push as Timothy pointed out. Though, you probably want to use something other than origin...
119, 386, 432, 8337
bitbucket, git, import, ssh
<h1>Two-step git import over ssh</h1> <p>Bitbucket has an importer tool for importing repositories from remote locations, but it only supports the <code>git://</code> protocol. Our existing repositories are on a company controlled machine behind a firewall that I can't change, and <code>git://</code> is not available. ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,694
git
# Two-step git import over ssh Bitbucket has an importer tool for importing repositories from remote locations, but it only supports the `git://` protocol. Our existing repositories are on a company controlled machine behind a firewall that I can't change, and `git://` is not available. I need to move the repositories...
You'll want to be sure you have the *entire* history. You can do this by performing a full local bare clone first. ``` git clone --mirror git://LOCAL_URL/somerepo.git ``` Then add the remote and push as Timothy pointed out. Though, you probably want to use something other than origin for the remote alias. ``` git re...
12754078
How to get the branch from tag name in Git?
7
2012-10-05 21:10:16
<p>I am trying to get the branch name from a given tag. I tried <code>git describe --tag &lt;tag-name&gt;</code> but this doesn't provide me any branch name. I tried using <code>gitk</code> to show to the tags and branch but gitk doesn't show me the tag. When I list out the tags <code>git tag -l</code> I see the tag n...
8,728
1,024,482
2022-05-20 10:03:57
12,754,155
11
2012-10-05 21:16:48
1,024,223
2022-05-20 10:03:57
https://stackoverflow.com/q/12754078
https://stackoverflow.com/a/12754155
<p>Tags and Branches in Git are only Labels pointing to specific snapshot of your files. That being said, Tags ain't linked to a branch, but to a commit.</p> <p>As so, you have to check which branch contain the commit pointed by your tag, as so:</p> <pre><code>git branch --contains &lt;tag name&gt; </code></pre>
<p>Tags and Branches in Git are only Labels pointing to specific snapshot of your files. That being said, Tags ain't linked to a branch, but to a commit.</p> <p>As so, you have to check which branch contain the commit pointed by your tag, as so:</p> <pre><code>git branch --contains &lt;tag name&gt; </code></pre>
119, 60718, 76220
git, git-branch, git-tag
<h1>How to get the branch from tag name in Git?</h1> <p>I am trying to get the branch name from a given tag. I tried <code>git describe --tag &lt;tag-name&gt;</code> but this doesn't provide me any branch name. I tried using <code>gitk</code> to show to the tags and branch but gitk doesn't show me the tag. When I list...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,696
git
# How to get the branch from tag name in Git? I am trying to get the branch name from a given tag. I tried `git describe --tag <tag-name>` but this doesn't provide me any branch name. I tried using `gitk` to show to the tags and branch but gitk doesn't show me the tag. When I list out the tags `git tag -l` I see the t...
Tags and Branches in Git are only Labels pointing to specific snapshot of your files. That being said, Tags ain't linked to a branch, but to a commit. As so, you have to check which branch contain the commit pointed by your tag, as so: ``` git branch --contains <tag name> ```
12300647
GitExtensions and PuTTY via SSH on a custom port
7
2012-09-06 12:57:26
<p>I have a Git repository that I pull using a path similar to this:</p> <pre><code>git pull ssh://username@host.com:1234/path/to/repository.git </code></pre> <p>When GitExtensions then tries to pull from the repository using plink, it makes this call:</p> <pre><code>plink -T username@host.com:/path/to/repository.git <...
10,613
1,576,874
2022-01-01 20:31:14
12,306,472
11
2012-09-06 18:45:04
1,576,874
2022-01-01 20:26:04
https://stackoverflow.com/q/12300647
https://stackoverflow.com/a/12306472
<p>I got it figured out.</p> <p>Here's what got me down the wrong path:</p> <ul> <li>Do not create any sessions in PuTTY as outlined <a href="http://blog.dmbcllc.com/gitextension-putty-alternate-port/" rel="nofollow noreferrer">here</a></li> <li>Do not use any host aliases you might have defined in file <em>~/.ssh/conf...
<p>I got it figured out.</p> <p>Here's what got me down the wrong path:</p> <ul> <li>Do not create any sessions in PuTTY as outlined <a href="http://blog.dmbcllc.com/gitextension-putty-alternate-port/" rel="nofollow noreferrer">here</a></li> <li>Do not use any host aliases you might have defined in file <em>~/.ssh/conf...
119, 386, 1768, 39597
git, git-extensions, putty, ssh
<h1>GitExtensions and PuTTY via SSH on a custom port</h1> <p>I have a Git repository that I pull using a path similar to this:</p> <pre><code>git pull ssh://username@host.com:1234/path/to/repository.git </code></pre> <p>When GitExtensions then tries to pull from the repository using plink, it makes this call:</p> <pre>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,697
git
# GitExtensions and PuTTY via SSH on a custom port I have a Git repository that I pull using a path similar to this: ``` git pull ssh://username@host.com:1234/path/to/repository.git ``` When GitExtensions then tries to pull from the repository using plink, it makes this call: ``` plink -T username@host.com:/path/to...
I got it figured out. Here's what got me down the wrong path: - Do not create any sessions in PuTTY as outlined [here](http://blog.dmbcllc.com/gitextension-putty-alternate-port/) - Do not use any host aliases you might have defined in file *~/.ssh/config* Here's how you get it working: - Obviously make sure GitExte...
12081060
Creating a New Git Repo from existing files on Windows
7
2012-08-22 20:39:27
<p>I'm trying to use Git on my local Windows machine only. I have an existing project that I want to move into Git. I'm not quite sure how I should structure the workflow. Should I make that existing project folder the main repo for my project and then create other branches off of that? Or should I create one centr...
10,908
684,396
2017-03-06 16:57:08
12,081,243
11
2012-08-22 20:51:49
6,309
2017-03-06 16:57:08
https://stackoverflow.com/q/12081060
https://stackoverflow.com/a/12081243
<p>You can directly create your Git repo within the folder of your main project.<br> They will be added by default in the master branch.<br> (<code>cd c:\path\to\yout\project &amp;&amp; git init . &amp;&amp; git add . &amp;&amp; git commit -m "first commit"</code>)</p> <p>No need for a "central" folder where all your ...
<p>You can directly create your Git repo within the folder of your main project.<br> They will be added by default in the master branch.<br> (<code>cd c:\path\to\yout\project &amp;&amp; git init . &amp;&amp; git add . &amp;&amp; git commit -m "first commit"</code>)</p> <p>No need for a "central" folder where all your ...
119
git
<h1>Creating a New Git Repo from existing files on Windows</h1> <p>I'm trying to use Git on my local Windows machine only. I have an existing project that I want to move into Git. I'm not quite sure how I should structure the workflow. Should I make that existing project folder the main repo for my project and then ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,698
git
# Creating a New Git Repo from existing files on Windows I'm trying to use Git on my local Windows machine only. I have an existing project that I want to move into Git. I'm not quite sure how I should structure the workflow. Should I make that existing project folder the main repo for my project and then create other...
You can directly create your Git repo within the folder of your main project. They will be added by default in the master branch. (`cd c:\path\to\yout\project && git init . && git add . && git commit -m "first commit"`) No need for a "central" folder where all your git repos should live. Each Git repo can evolve...
10501814
How to fill in an empty commit message?
7
2012-05-08 15:35:59
<p>Until a minute ago, I had a Git repo where the last commit had an empty commit message. I've filled it in by squashing a new commit onto it with <code>git rebase -i</code> (I was planning to amend the contents anyway) but I would still like to know if there's a proper way to fill in empty commit messages.</p> <p>I ...
5,140
166,749
2019-12-14 23:05:59
10,503,032
11
2012-05-08 17:00:32
248,066
2012-05-08 17:00:32
https://stackoverflow.com/q/10501814
https://stackoverflow.com/a/10503032
<p>This seems to be a <a href="http://git.661346.n2.nabble.com/PATCH-commit-allow-amend-c-foo-when-HEAD-foo-has-empty-message-td7324888.html">bug</a> which hasn't been fixed yet (although there are proposed patches for it). As a workaround, you can provide the message on the command line:</p> <pre><code>git commit --a...
<p>This seems to be a <a href="http://git.661346.n2.nabble.com/PATCH-commit-allow-amend-c-foo-when-HEAD-foo-has-empty-message-td7324888.html">bug</a> which hasn't been fixed yet (although there are proposed patches for it). As a workaround, you can provide the message on the command line:</p> <pre><code>git commit --a...
119
git
<h1>How to fill in an empty commit message?</h1> <p>Until a minute ago, I had a Git repo where the last commit had an empty commit message. I've filled it in by squashing a new commit onto it with <code>git rebase -i</code> (I was planning to amend the contents anyway) but I would still like to know if there's a proper...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,699
git
# How to fill in an empty commit message? Until a minute ago, I had a Git repo where the last commit had an empty commit message. I've filled it in by squashing a new commit onto it with `git rebase -i` (I was planning to amend the contents anyway) but I would still like to know if there's a proper way to fill in empt...
This seems to be a [bug](http://git.661346.n2.nabble.com/PATCH-commit-allow-amend-c-foo-when-HEAD-foo-has-empty-message-td7324888.html) which hasn't been fixed yet (although there are proposed patches for it). As a workaround, you can provide the message on the command line: ``` git commit --amend -m "foo" ```
10400158
Updating git repo name
7
2012-05-01 15:41:35
<p>I just changed the name of my github repo and now my local repo (as expected) can't find it. How do I update the name, or am I just supposed to treat it as a new remote repo?</p>
1,161
165,673
2012-05-03 14:03:10
10,400,194
11
2012-05-01 15:43:49
null
2012-05-01 15:43:49
https://stackoverflow.com/q/10400158
https://stackoverflow.com/a/10400194
<p>From how I read this my understanding is that you changed the name of your repository (which changed the URL for it) and now you want to update the URL to match the new repository location. </p> <p>You can use <code>git remote set-url &lt;remote-name&gt; &lt;new-url&gt;</code> to switch the URL for an existing remo...
<p>From how I read this my understanding is that you changed the name of your repository (which changed the URL for it) and now you want to update the URL to match the new repository location. </p> <p>You can use <code>git remote set-url &lt;remote-name&gt; &lt;new-url&gt;</code> to switch the URL for an existing remo...
119
git
<h1>Updating git repo name</h1> <p>I just changed the name of my github repo and now my local repo (as expected) can't find it. How do I update the name, or am I just supposed to treat it as a new remote repo?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,700
git
# Updating git repo name I just changed the name of my github repo and now my local repo (as expected) can't find it. How do I update the name, or am I just supposed to treat it as a new remote repo?
From how I read this my understanding is that you changed the name of your repository (which changed the URL for it) and now you want to update the URL to match the new repository location. You can use `git remote set-url <remote-name> <new-url>` to switch the URL for an existing remote repo.
9900889
Git tag release version?
7
2012-03-28 03:51:29
<blockquote> <p>A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.</p> </blockquote> <p><a href="http://semver.org" rel="noreferrer">semver.org</a></p> <p>For t...
12,386
1,002,260
2019-04-25 13:41:31
9,902,133
11
2012-03-28 06:20:43
6,309
2019-04-25 13:41:31
https://stackoverflow.com/q/9900889
https://stackoverflow.com/a/9902133
<p>You can choose a policy similar to Git itself (see its <a href="https://github.com/git/git/tags" rel="nofollow noreferrer">tags in the GitHub repo</a>):</p> <pre><code>v1.7.2-rc0 v1.7.2-rc1 v1.7.2-rc2 v1.7.2-rc3 v1.7.2 </code></pre> <p>The idea (as described in <a href="https://web.archive.org/web/20151022171727/h...
<p>You can choose a policy similar to Git itself (see its <a href="https://github.com/git/git/tags" rel="nofollow noreferrer">tags in the GitHub repo</a>):</p> <pre><code>v1.7.2-rc0 v1.7.2-rc1 v1.7.2-rc2 v1.7.2-rc3 v1.7.2 </code></pre> <p>The idea (as described in <a href="https://web.archive.org/web/20151022171727/h...
119, 60718, 76220
git, git-branch, git-tag
<h1>Git tag release version?</h1> <blockquote> <p>A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.</p> </blockquote> <p><a href="http://semver.org" rel="norefe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,702
git
# Git tag release version? > A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92. [semver.org](http://semver.org) For the purpose of disambiguation, what would be ...
You can choose a policy similar to Git itself (see its [tags in the GitHub repo](https://github.com/git/git/tags)): ``` v1.7.2-rc0 v1.7.2-rc1 v1.7.2-rc2 v1.7.2-rc3 v1.7.2 ``` The idea (as described in [Choosing a good version numbering policy](https://web.archive.org/web/20151022171727/http://thesp0nge.tumblr.com/)) ...
8550400
Should git-apply or git-am come up with the same hash?
7
2011-12-18 07:17:26
<p>I think I'm missing something. I was under the impression that git's usage of a SHA-1 hash commit identifier meant that one could be certain that patch obtained from someone else for that commit had not been altered.</p> <p>Take this test I did on my machine (name and email changed, obviously):</p> <pre><code>cd ...
3,581
136,451
2011-12-18 07:20:53
8,550,417
11
2011-12-18 07:20:53
582
2011-12-18 07:20:53
https://stackoverflow.com/q/8550400
https://stackoverflow.com/a/8550417
<p>By default, <code>git am</code> sets the Committer Date to the current time. You can use the <code>--committer-date-is-author-date</code> flag to avoid that, though it may still set you as the committer (in fact, it probably will). You can verify this by using <code>git log --format=fuller</code> instead which shows...
<p>By default, <code>git am</code> sets the Committer Date to the current time. You can use the <code>--committer-date-is-author-date</code> flag to avoid that, though it may still set you as the committer (in fact, it probably will). You can verify this by using <code>git log --format=fuller</code> instead which shows...
119, 3190
git, sha1
<h1>Should git-apply or git-am come up with the same hash?</h1> <p>I think I'm missing something. I was under the impression that git's usage of a SHA-1 hash commit identifier meant that one could be certain that patch obtained from someone else for that commit had not been altered.</p> <p>Take this test I did on my ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,703
git
# Should git-apply or git-am come up with the same hash? I think I'm missing something. I was under the impression that git's usage of a SHA-1 hash commit identifier meant that one could be certain that patch obtained from someone else for that commit had not been altered. Take this test I did on my machine (name and...
By default, `git am` sets the Committer Date to the current time. You can use the `--committer-date-is-author-date` flag to avoid that, though it may still set you as the committer (in fact, it probably will). You can verify this by using `git log --format=fuller` instead which shows the Committer information as well.
5930371
Indexing a mysql table for geo lookup using latitude/longitude
7
2011-05-08 21:05:57
<p>I have a legacy innodb table Listing containing a business with latitude/longitude. Given an input latitude/longitude (below 51.2167/4.41667), the query is to return the first active, enabled, not-deleted 30 businesses in order of proximity (kilometers). A join with the accounts table is made to check the validity...
6,305
138,699
2011-05-08 22:46:35
5,930,891
11
2011-05-08 22:46:35
205,608
2011-05-08 22:46:35
https://stackoverflow.com/q/5930371
https://stackoverflow.com/a/5930891
<p>This is taking a long time because your query is computing that great-circle-distance formula with all the transcendental functions once for each row in your 50k row table (twice when you include the sort).</p> <p>Can you limit the distance range of your search? You've probably noticed that most store-finder web a...
<p>This is taking a long time because your query is computing that great-circle-distance formula with all the transcendental functions once for each row in your 50k row table (twice when you include the sort).</p> <p>Can you limit the distance range of your search? You've probably noticed that most store-finder web a...
21, 30, 317, 12620, 20301
database, geospatial, indexing, latitude-longitude, mysql
<h1>Indexing a mysql table for geo lookup using latitude/longitude</h1> <p>I have a legacy innodb table Listing containing a business with latitude/longitude. Given an input latitude/longitude (below 51.2167/4.41667), the query is to return the first active, enabled, not-deleted 30 businesses in order of proximity (ki...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,705
git
# Indexing a mysql table for geo lookup using latitude/longitude I have a legacy innodb table Listing containing a business with latitude/longitude. Given an input latitude/longitude (below 51.2167/4.41667), the query is to return the first active, enabled, not-deleted 30 businesses in order of proximity (kilometers)....
This is taking a long time because your query is computing that great-circle-distance formula with all the transcendental functions once for each row in your 50k row table (twice when you include the sort). Can you limit the distance range of your search? You've probably noticed that most store-finder web apps have a ...
4024487
How to remove a branch named "--orphan"
7
2010-10-26 14:06:44
<p>So I was trying to create an orphan branch. I tried a couple of things and one of them (<code>git checkout -b --orphan newbranch</code>) managed to create a branch called "--orphan"; now it won't let me delete it using <code>git branch -d --orphan</code>. I've also tried using quotes and escape characters. Nothing s...
1,641
251,561
2011-09-12 23:35:02
4,024,533
11
2010-10-26 14:11:06
238,886
2011-09-12 23:35:02
https://stackoverflow.com/q/4024487
https://stackoverflow.com/a/4024533
<pre><code>git branch -d -- --orphan </code></pre> <p>Everything after <code>--</code> is taken as an argument and not a switch. This works in many places in git (and in many other Unix programs).</p>
<pre><code>git branch -d -- --orphan </code></pre> <p>Everything after <code>--</code> is taken as an argument and not a switch. This works in many places in git (and in many other Unix programs).</p>
119
git
<h1>How to remove a branch named "--orphan"</h1> <p>So I was trying to create an orphan branch. I tried a couple of things and one of them (<code>git checkout -b --orphan newbranch</code>) managed to create a branch called "--orphan"; now it won't let me delete it using <code>git branch -d --orphan</code>. I've also tr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,706
git
# How to remove a branch named "--orphan" So I was trying to create an orphan branch. I tried a couple of things and one of them (`git checkout -b --orphan newbranch`) managed to create a branch called "--orphan"; now it won't let me delete it using `git branch -d --orphan`. I've also tried using quotes and escape cha...
``` git branch -d -- --orphan ``` Everything after `--` is taken as an argument and not a switch. This works in many places in git (and in many other Unix programs).
2752253
I accidentally created a git local branch called --track, how can I delete it?
7
2010-05-02 02:31:17
<p>I mistyped a git command which resulted in the creation of a local branch called, '--track'.</p> <p>I've tried the following:</p> <pre><code>git branch -m --track delme (this renames the current branch to delme, not the branch called --track) git checkout --track &gt; fatal: --track needs a branch name git branc...
485
114,658
2010-05-02 10:30:14
2,752,290
11
2010-05-02 02:51:38
9,990
2010-05-02 10:30:14
https://stackoverflow.com/q/2752253
https://stackoverflow.com/a/2752290
<pre><code>git branch -d -- --track </code></pre> <p>In general, <code>--</code> tells git to treat all subsequent command-line arguments as non-options.</p> <p>EDIT: See the comments for clarification regarding how git uses <code>--</code>.</p>
<pre><code>git branch -d -- --track </code></pre> <p>In general, <code>--</code> tells git to treat all subsequent command-line arguments as non-options.</p> <p>EDIT: See the comments for clarification regarding how git uses <code>--</code>.</p>
119
git
<h1>I accidentally created a git local branch called --track, how can I delete it?</h1> <p>I mistyped a git command which resulted in the creation of a local branch called, '--track'.</p> <p>I've tried the following:</p> <pre><code>git branch -m --track delme (this renames the current branch to delme, not the branch ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,707
git
# I accidentally created a git local branch called --track, how can I delete it? I mistyped a git command which resulted in the creation of a local branch called, '--track'. I've tried the following: ``` git branch -m --track delme (this renames the current branch to delme, not the branch called --track) git checko...
``` git branch -d -- --track ``` In general, `--` tells git to treat all subsequent command-line arguments as non-options. EDIT: See the comments for clarification regarding how git uses `--`.
1314262
Multiple simultaneous version control systems?
7
2009-08-21 21:13:53
<p>I'm relatively new to version control, and so far only have experience working with Subversion using TortoiseSVN/VisualSVN. I've been reading about other types of VCS (git, mercurial, etc), and am considering trying them out - however, many of the arguments for or against a particular VCS seem like they largely come...
2,428
42,297
2009-08-25 16:56:44
1,314,287
11
2009-08-21 21:18:48
75,170
2009-08-21 21:18:48
https://stackoverflow.com/q/1314262
https://stackoverflow.com/a/1314287
<p>Certainly, this is possible, even commonplace in some cases. For example, <code>git</code> and <code>svn</code> are a natural pair for this. The standard use case is an organization which must have a legacy central Subversion repository for various reasons, but in which the developers want to use Git for the product...
<p>Certainly, this is possible, even commonplace in some cases. For example, <code>git</code> and <code>svn</code> are a natural pair for this. The standard use case is an organization which must have a legacy central Subversion repository for various reasons, but in which the developers want to use Git for the product...
63, 119, 456, 802, 3346
dvcs, git, mercurial, svn, version-control
<h1>Multiple simultaneous version control systems?</h1> <p>I'm relatively new to version control, and so far only have experience working with Subversion using TortoiseSVN/VisualSVN. I've been reading about other types of VCS (git, mercurial, etc), and am considering trying them out - however, many of the arguments for...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,709
git
# Multiple simultaneous version control systems? I'm relatively new to version control, and so far only have experience working with Subversion using TortoiseSVN/VisualSVN. I've been reading about other types of VCS (git, mercurial, etc), and am considering trying them out - however, many of the arguments for or again...
Certainly, this is possible, even commonplace in some cases. For example, `git` and `svn` are a natural pair for this. The standard use case is an organization which must have a legacy central Subversion repository for various reasons, but in which the developers want to use Git for the productivity boost it provides. ...
76841077
How to get `git log` to display only commit messages?
6
2023-08-05 09:55:53
<p>Is there a way for <code>git log</code> to output <em>only</em> the commit messages, nothing else?</p> <p>I'd like to do this as a starting point for composing release notes.</p>
1,632
501,266
2023-08-07 07:32:04
76,841,136
11
2023-08-05 10:13:44
3,050,293
2023-08-05 10:13:44
https://stackoverflow.com/q/76841077
https://stackoverflow.com/a/76841136
<pre><code>git log --format=%s </code></pre> <p><code>git log</code> has an option called <code>format</code> which you can use to specify the format for how each entry is logged. The option can take various &quot;placeholders&quot; to extract specific bits of information. <code>%s</code> is the placeholder for the com...
<pre><code>git log --format=%s </code></pre> <p><code>git log</code> has an option called <code>format</code> which you can use to specify the format for how each entry is logged. The option can take various &quot;placeholders&quot; to extract specific bits of information. <code>%s</code> is the placeholder for the com...
119, 47913, 158175
git, git-format, git-log
<h1>How to get `git log` to display only commit messages?</h1> <p>Is there a way for <code>git log</code> to output <em>only</em> the commit messages, nothing else?</p> <p>I'd like to do this as a starting point for composing release notes.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,711
git
# How to get `git log` to display only commit messages? Is there a way for `git log` to output *only* the commit messages, nothing else? I'd like to do this as a starting point for composing release notes.
``` git log --format=%s ``` `git log` has an option called `format` which you can use to specify the format for how each entry is logged. The option can take various "placeholders" to extract specific bits of information. `%s` is the placeholder for the commit subject. See [documentation](https://git-scm.com/docs/git-...
64319349
Force Git to fail when password required, instead of prompting for password
6
2020-10-12 13:58:34
<p>I am working on an application where a user can enter a Git repository, which is then cloned to the local machine. In some cases (such as a mistyped URL pointing to a nonexistent repo on Github), the Git client will prompt the user for a username and password. I do not want this behavior -- I just want Git to fail w...
1,754
2,954,547
2022-07-04 21:28:03
64,319,771
11
2020-10-12 14:24:41
3,486,675
2020-10-12 18:45:47
https://stackoverflow.com/q/64319349
https://stackoverflow.com/a/64319771
<p>You can set the <a href="https://www.git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode" rel="noreferrer"><code>GIT_TERMINAL_PROMPT</code> environment variable</a> to <code>0</code> if you don't want git to prompt for any input.</p> <pre><code>&gt;&gt;&gt; git clone https://github.com/private/priva...
<p>You can set the <a href="https://www.git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode" rel="noreferrer"><code>GIT_TERMINAL_PROMPT</code> environment variable</a> to <code>0</code> if you don't want git to prompt for any input.</p> <pre><code>&gt;&gt;&gt; git clone https://github.com/private/priva...
119
git
<h1>Force Git to fail when password required, instead of prompting for password</h1> <p>I am working on an application where a user can enter a Git repository, which is then cloned to the local machine. In some cases (such as a mistyped URL pointing to a nonexistent repo on Github), the Git client will prompt the user ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,715
git
# Force Git to fail when password required, instead of prompting for password I am working on an application where a user can enter a Git repository, which is then cloned to the local machine. In some cases (such as a mistyped URL pointing to a nonexistent repo on Github), the Git client will prompt the user for a use...
You can set the [`GIT_TERMINAL_PROMPT` environment variable](https://www.git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode) to `0` if you don't want git to prompt for any input. ``` >>> git clone https://github.com/private/private.git Cloning into 'private'... Username for 'https://github.com': >>>...
64249715
Short flag for `git push --force-with-lease`?
6
2020-10-07 17:55:01
<p>I've begun using <code>git push --force-with-lease</code> rather than <code>--force</code> in most cases for the additional branch protection:</p> <ul> <li><a href="https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force">git push --force-with-lease vs. --force</a></li> </ul> <p>I may even tr...
2,456
1,265,393
2025-09-28 12:12:32
64,250,212
11
2020-10-07 18:28:48
6,577,998
2022-05-08 15:11:20
https://stackoverflow.com/q/64249715
https://stackoverflow.com/a/64250212
<p>There is no shorthand for that option. To <a href="https://stackoverflow.com/questions/2553786/how-do-i-alias-commands-in-git">make a global alias</a>, just add this to <code>~/.gitconfig</code></p> <pre class="lang-sh prettyprint-override"><code>[alias] push-fwl = push --force-with-lease </code></pre> <p>wh...
<p>There is no shorthand for that option. To <a href="https://stackoverflow.com/questions/2553786/how-do-i-alias-commands-in-git">make a global alias</a>, just add this to <code>~/.gitconfig</code></p> <pre class="lang-sh prettyprint-override"><code>[alias] push-fwl = push --force-with-lease </code></pre> <p>wh...
119, 11225, 28898
command-line-interface, git, git-push
<h1>Short flag for `git push --force-with-lease`?</h1> <p>I've begun using <code>git push --force-with-lease</code> rather than <code>--force</code> in most cases for the additional branch protection:</p> <ul> <li><a href="https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force">git push --force...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,716
git
# Short flag for `git push --force-with-lease`? I've begun using `git push --force-with-lease` rather than `--force` in most cases for the additional branch protection: - [git push --force-with-lease vs. --force](https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force) I may even try to set t...
There is no shorthand for that option. To [make a global alias](https://stackoverflow.com/questions/2553786/how-do-i-alias-commands-in-git), just add this to `~/.gitconfig` ``` [alias] push-fwl = push --force-with-lease ``` where you would use the alias like -> `git push-fwl` Of course, you can name `push-fw...
64219093
Getting whole commit message of a reset commit
6
2020-10-06 03:50:01
<p>How do I get the whole commit message of a commit which I hard reset?</p> <p>There could be a way to do it using <code>git reflog</code>, however, do we have another way?</p>
1,855
12,226,311
2021-08-15 15:19:18
64,219,270
11
2020-10-06 04:15:03
14,660
2020-10-06 04:21:00
https://stackoverflow.com/q/64219093
https://stackoverflow.com/a/64219270
<p>You could use <code>git log -g</code> to walk back through your previous HEADs, but it will not have information about why HEAD moved.</p> <p>You could read the logs straight from <code>.git/logs/HEAD</code>. That won't show you anything <code>git reflog</code> won't, but it might be easier to develop a tool to find...
<p>You could use <code>git log -g</code> to walk back through your previous HEADs, but it will not have information about why HEAD moved.</p> <p>You could read the logs straight from <code>.git/logs/HEAD</code>. That won't show you anything <code>git reflog</code> won't, but it might be easier to develop a tool to find...
119, 456
git, version-control
<h1>Getting whole commit message of a reset commit</h1> <p>How do I get the whole commit message of a commit which I hard reset?</p> <p>There could be a way to do it using <code>git reflog</code>, however, do we have another way?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,717
git
# Getting whole commit message of a reset commit How do I get the whole commit message of a commit which I hard reset? There could be a way to do it using `git reflog`, however, do we have another way?
You could use `git log -g` to walk back through your previous HEADs, but it will not have information about why HEAD moved. You could read the logs straight from `.git/logs/HEAD`. That won't show you anything `git reflog` won't, but it might be easier to develop a tool to find the IDs of resets. `git reflog` will sho...
63404369
Why do I suddenly have a merge commit in my pushes?
6
2020-08-13 23:08:08
<p>Well, I seem to have gone and mucked something up.</p> <p>Until just recently, I used to be able to do a merge commit and then push to origin without that separate commit showing up. Now that it does, the merge commit is all I can see at my pipeline:</p> <p><a href="https://i.sstatic.net/6wdOT.png" rel="noreferrer">...
3,262
722,393
2020-08-16 23:14:24
63,406,697
11
2020-08-14 04:47:28
1,256,452
2020-08-14 04:47:28
https://stackoverflow.com/q/63404369
https://stackoverflow.com/a/63406697
<p>It seems likely that you were doing fast-forward operations before. The <code>git merge</code> command will do this <em>instead</em> of merging, provided conditions are correct:</p> <ol> <li>A fast-forward needs to be possible.</li> <li>You are required to <em>avoid</em> the <code>--no-ff</code> option, which would...
<p>It seems likely that you were doing fast-forward operations before. The <code>git merge</code> command will do this <em>instead</em> of merging, provided conditions are correct:</p> <ol> <li>A fast-forward needs to be possible.</li> <li>You are required to <em>avoid</em> the <code>--no-ff</code> option, which would...
119, 28897, 34403, 37315, 53850
git, git-commit, git-merge, git-revert, team-explorer
<h1>Why do I suddenly have a merge commit in my pushes?</h1> <p>Well, I seem to have gone and mucked something up.</p> <p>Until just recently, I used to be able to do a merge commit and then push to origin without that separate commit showing up. Now that it does, the merge commit is all I can see at my pipeline:</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,718
git
# Why do I suddenly have a merge commit in my pushes? Well, I seem to have gone and mucked something up. Until just recently, I used to be able to do a merge commit and then push to origin without that separate commit showing up. Now that it does, the merge commit is all I can see at my pipeline: [![Pipeline commits...
It seems likely that you were doing fast-forward operations before. The `git merge` command will do this *instead* of merging, provided conditions are correct: 1. A fast-forward needs to be possible. 2. You are required to *avoid* the `--no-ff` option, which would disable the fast-forward. > This all started right af...
60611612
Expansion of alias failed; not a git command
6
2020-03-10 04:36:16
<p>I must be missing something obvious... but Git aliases are not working at all. Help me please!</p> <pre class="lang-sh prettyprint-override"><code>$ git config --global alias.v version $ git config --global --list alias.v=version $ git config --global alias.v version $ git v Expansion of alias 'v' failed; 'version'...
9,276
554,518
2024-07-31 19:16:42
60,611,930
11
2020-03-10 05:19:46
1,256,452
2020-03-10 05:34:21
https://stackoverflow.com/q/60611612
https://stackoverflow.com/a/60611930
<p>Use a command other than <code>version</code>. Try aliasing <code>l</code> to <code>log</code>, for instance. (Or, as VonC notes, upgrade—it actually <em>does</em> work in modern Git. The alias handling seems to have been rewritten between 2.17.3 and 2.18.0.)</p> <h3>Why does <code>l = log</code> work, and yet <...
<p>Use a command other than <code>version</code>. Try aliasing <code>l</code> to <code>log</code>, for instance. (Or, as VonC notes, upgrade—it actually <em>does</em> work in modern Git. The alias handling seems to have been rewritten between 2.17.3 and 2.18.0.)</p> <h3>Why does <code>l = log</code> work, and yet <...
119
git
<h1>Expansion of alias failed; not a git command</h1> <p>I must be missing something obvious... but Git aliases are not working at all. Help me please!</p> <pre class="lang-sh prettyprint-override"><code>$ git config --global alias.v version $ git config --global --list alias.v=version $ git config --global alias.v ve...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,721
git
# Expansion of alias failed; not a git command I must be missing something obvious... but Git aliases are not working at all. Help me please! ``` $ git config --global alias.v version $ git config --global --list alias.v=version $ git config --global alias.v version $ git v Expansion of alias 'v' failed; 'version' is...
Use a command other than `version`. Try aliasing `l` to `log`, for instance. (Or, as VonC notes, upgrade—it actually *does* work in modern Git. The alias handling seems to have been rewritten between 2.17.3 and 2.18.0.) ### Why does `l = log` work, and yet `v = version` not? This is a little tricky! Most Git command...
59457061
Rebase "fixup" commit into prior merge commit
6
2019-12-23 14:36:20
<p>I have performed the following merge:</p> <pre><code>A---B---C---E (HEAD, merge of C and D) / D---| </code></pre> <p>But I noticed some issues in E, and fixed them in F:</p> <pre><code>A---B---C---E---F (HEAD) / D---| </code></pre> <p>I want to modify commit <code>E</code> so th...
815
88,111
2025-11-12 13:02:12
59,457,130
11
2019-12-23 14:42:05
1,057,485
2025-11-12 13:02:12
https://stackoverflow.com/q/59457061
https://stackoverflow.com/a/59457130
<pre><code>git reset --soft E git commit --amend # (add --no-edit to keep the same commit message) </code></pre> <p>should be enough. It'll recreate a merge commit (with a different hash than <code>E</code>, let's call it <code>E'</code>) while inserting whatever changes you made between <code>E</code> and <code>F</co...
<pre><code>git reset --soft E git commit --amend # (add --no-edit to keep the same commit message) </code></pre> <p>should be enough. It'll recreate a merge commit (with a different hash than <code>E</code>, let's call it <code>E'</code>) while inserting whatever changes you made between <code>E</code> and <code>F</co...
119, 29934, 42532, 84381
git, git-interactive-rebase, git-rebase, squash
<h1>Rebase "fixup" commit into prior merge commit</h1> <p>I have performed the following merge:</p> <pre><code>A---B---C---E (HEAD, merge of C and D) / D---| </code></pre> <p>But I noticed some issues in E, and fixed them in F:</p> <pre><code>A---B---C---E---F (HEAD) / D---| </code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,722
git
# Rebase "fixup" commit into prior merge commit I have performed the following merge: ``` A---B---C---E (HEAD, merge of C and D) / D---| ``` But I noticed some issues in E, and fixed them in F: ``` A---B---C---E---F (HEAD) / D---| ``` I want to modify commit `E` so that it contain...
``` git reset --soft E git commit --amend # (add --no-edit to keep the same commit message) ``` should be enough. It'll recreate a merge commit (with a different hash than `E`, let's call it `E'`) while inserting whatever changes you made between `E` and `F`. *Note*: If the changes you're squashing into the merge co...
55484498
Dokku subdomain cant be found
6
2019-04-02 22:38:44
<p>I deployed an app to my Digital Ocean Dokku instance, and set it up with a domain such that <code>https://example.com</code> (using letsencrypt dokku plugin) points to my <code>originalApp</code>. I recently tried to deploy a second app on my Dokku instance thinking I would be able to access it with <code>http://new...
1,665
2,780,176
2020-08-06 12:04:01
55,486,859
11
2019-04-03 03:59:57
1,060,541
2020-08-06 12:04:01
https://stackoverflow.com/q/55484498
https://stackoverflow.com/a/55486859
<p>Its possible, I have done it several times with DigitalOcean droplets and you will have your mini-Heroku at last. It's a kind of tricky to get it working but I will try to explain my steps to replicate it.</p> <p>First of all you need to deploy your DO droplet with Dokku to get started. Remember to select the option...
<p>Its possible, I have done it several times with DigitalOcean droplets and you will have your mini-Heroku at last. It's a kind of tricky to get it working but I will try to explain my steps to replicate it.</p> <p>First of all you need to deploy your DO droplet with Dokku to get started. Remember to select the option...
324, 6605, 97102, 102986
digital-ocean, dokku, nginx, subdomain
<h1>Dokku subdomain cant be found</h1> <p>I deployed an app to my Digital Ocean Dokku instance, and set it up with a domain such that <code>https://example.com</code> (using letsencrypt dokku plugin) points to my <code>originalApp</code>. I recently tried to deploy a second app on my Dokku instance thinking I would be ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,725
git
# Dokku subdomain cant be found I deployed an app to my Digital Ocean Dokku instance, and set it up with a domain such that `https://example.com` (using letsencrypt dokku plugin) points to my `originalApp`. I recently tried to deploy a second app on my Dokku instance thinking I would be able to access it with `http://...
Its possible, I have done it several times with DigitalOcean droplets and you will have your mini-Heroku at last. It's a kind of tricky to get it working but I will try to explain my steps to replicate it. First of all you need to deploy your DO droplet with Dokku to get started. Remember to select the option "Use vir...
51755069
how to clone git repository with submodules without asking for password for every subrepository
6
2018-08-08 20:23:31
<p>I'm recently put a repository into bitbucket. And this repository has some submodules</p> <p>I'm working on a Initialization script. I would like to clone the main directory and them pull all subdirectories.</p> <pre><code> git clone https://bitbucket.org/#####/main.git elastic --recurse-submodules </code></pre> ...
5,453
888,469
2018-08-09 20:25:00
51,775,249
11
2018-08-09 20:25:00
888,469
2018-08-09 20:25:00
https://stackoverflow.com/q/51755069
https://stackoverflow.com/a/51775249
<p>Setting up the git to use the credential memory cache solves my problem</p> <pre><code>git config --global credential.helper cache </code></pre> <p>this is enough to pull all repos with the same user/password</p> <p>If i want to keep the same cache for a entire day, I'm able to set the time for a longer timespan:...
<p>Setting up the git to use the credential memory cache solves my problem</p> <pre><code>git config --global credential.helper cache </code></pre> <p>this is enough to pull all repos with the same user/password</p> <p>If i want to keep the same cache for a entire day, I'm able to set the time for a longer timespan:...
119, 41612
git, git-submodules
<h1>how to clone git repository with submodules without asking for password for every subrepository</h1> <p>I'm recently put a repository into bitbucket. And this repository has some submodules</p> <p>I'm working on a Initialization script. I would like to clone the main directory and them pull all subdirectories.</p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,726
git
# how to clone git repository with submodules without asking for password for every subrepository I'm recently put a repository into bitbucket. And this repository has some submodules I'm working on a Initialization script. I would like to clone the main directory and them pull all subdirectories. ``` git clone htt...
Setting up the git to use the credential memory cache solves my problem ``` git config --global credential.helper cache ``` this is enough to pull all repos with the same user/password If i want to keep the same cache for a entire day, I'm able to set the time for a longer timespan: ``` git config --global credenti...
50488030
Checkout old commit from git based on date
6
2018-05-23 12:08:35
<p>I am trying to retrieve an old commit from git, due to incompatibility with another project (which shares this code). The git repo is OpenZWave.</p> <p>I found a post on SO saying to issue command:</p> <pre><code>git checkout @{14.days.ago} </code></pre> <p>But that results in:</p> <pre><code>warning: Log for '...
4,865
659,503
2018-05-23 12:34:45
50,488,492
11
2018-05-23 12:31:19
4,830,165
2018-05-23 12:31:19
https://stackoverflow.com/q/50488030
https://stackoverflow.com/a/50488492
<p>The syntax <code>@{XXX.days.ago}</code> refers to the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a>, a local history kept by Git in addition to the history as shown by e.g. <code>git log</code>. So, <code>@{14.days.ago}</code> means "where <code>HEAD</code> pointed to 14 days ago <em>on t...
<p>The syntax <code>@{XXX.days.ago}</code> refers to the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a>, a local history kept by Git in addition to the history as shown by e.g. <code>git log</code>. So, <code>@{14.days.ago}</code> means "where <code>HEAD</code> pointed to 14 days ago <em>on t...
119, 37230
git, git-checkout
<h1>Checkout old commit from git based on date</h1> <p>I am trying to retrieve an old commit from git, due to incompatibility with another project (which shares this code). The git repo is OpenZWave.</p> <p>I found a post on SO saying to issue command:</p> <pre><code>git checkout @{14.days.ago} </code></pre> <p>But...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,727
git
# Checkout old commit from git based on date I am trying to retrieve an old commit from git, due to incompatibility with another project (which shares this code). The git repo is OpenZWave. I found a post on SO saying to issue command: ``` git checkout @{14.days.ago} ``` But that results in: ``` warning: Log for '...
The syntax `@{XXX.days.ago}` refers to the [reflog](https://git-scm.com/docs/git-reflog), a local history kept by Git in addition to the history as shown by e.g. `git log`. So, `@{14.days.ago}` means "where `HEAD` pointed to 14 days ago *on this repository, on my computer*", not "the commit made 14 days ago" (which was...
44515293
Re-applying git commit
6
2017-06-13 07:46:51
<p>I had a commit with a pull-request already merged in the development branch. Then after a weak someone made a mistake and merged the master branch back to the development and somehow, i don't know how, but my already merged commit is now gone from the development branch. </p> <p>I can track down the commits to dev ...
2,182
1,306,083
2017-06-13 08:00:08
44,515,570
11
2017-06-13 08:00:08
6,936,103
2017-06-13 08:00:08
https://stackoverflow.com/q/44515293
https://stackoverflow.com/a/44515570
<p>You just need to find the commit sha-1 value that you made the changes, and then cherry-pick this commit to your <code>development</code> branch:</p> <pre><code>git checkout development git cherry-pick &lt;commit you found&gt; </code></pre>
<p>You just need to find the commit sha-1 value that you made the changes, and then cherry-pick this commit to your <code>development</code> branch:</p> <pre><code>git checkout development git cherry-pick &lt;commit you found&gt; </code></pre>
119, 456, 717
git, merge, version-control
<h1>Re-applying git commit</h1> <p>I had a commit with a pull-request already merged in the development branch. Then after a weak someone made a mistake and merged the master branch back to the development and somehow, i don't know how, but my already merged commit is now gone from the development branch. </p> <p>I ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,731
git
# Re-applying git commit I had a commit with a pull-request already merged in the development branch. Then after a weak someone made a mistake and merged the master branch back to the development and somehow, i don't know how, but my already merged commit is now gone from the development branch. I can track down the ...
You just need to find the commit sha-1 value that you made the changes, and then cherry-pick this commit to your `development` branch: ``` git checkout development git cherry-pick <commit you found> ```
43900525
I wish I'd branched in Git - can I turn back time?
6
2017-05-10 18:48:49
<p>This is a use case which has come up a couple of times. Because I'm (unfortunately) not in the habit of branching for every feature, sometimes I start work on a task, make a couple of commits, and then say "Crap...this is more complicated than I thought...I wish I'd created a branch three commits ago."</p> <p>At th...
100
11,027
2017-05-10 18:51:26
43,900,557
11
2017-05-10 18:50:41
2,437,508
2017-05-10 18:51:26
https://stackoverflow.com/q/43900525
https://stackoverflow.com/a/43900557
<p>Shortest thing to do:</p> <ul> <li>create new branch where master is</li> <li>reset master back to where you want it:</li> </ul> <p>Suppose you are on master and you realize the last two commits on master should be on a feature branch:</p> <pre><code>git branch feature-A git reset --hard HEAD~2 </code></pre> <p>...
<p>Shortest thing to do:</p> <ul> <li>create new branch where master is</li> <li>reset master back to where you want it:</li> </ul> <p>Suppose you are on master and you realize the last two commits on master should be on a feature branch:</p> <pre><code>git branch feature-A git reset --hard HEAD~2 </code></pre> <p>...
119
git
<h1>I wish I'd branched in Git - can I turn back time?</h1> <p>This is a use case which has come up a couple of times. Because I'm (unfortunately) not in the habit of branching for every feature, sometimes I start work on a task, make a couple of commits, and then say "Crap...this is more complicated than I thought...I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,732
git
# I wish I'd branched in Git - can I turn back time? This is a use case which has come up a couple of times. Because I'm (unfortunately) not in the habit of branching for every feature, sometimes I start work on a task, make a couple of commits, and then say "Crap...this is more complicated than I thought...I wish I'd...
Shortest thing to do: - create new branch where master is - reset master back to where you want it: Suppose you are on master and you realize the last two commits on master should be on a feature branch: ``` git branch feature-A git reset --hard HEAD~2 ``` That's it.
41251766
Git: move last commit from branch to master
6
2016-12-20 21:47:45
<p>I have 2 commits: A and B. Both are independent from each other and contain different files. I have 2 branches: <code>master</code> and <code>branch1</code>:</p> <pre><code>master: A branch 1: A, B </code></pre> <p>I need to remove <code>branch 1</code> and to move commit <code>B</code> to <code>master</code>. I t...
3,644
7,211,752
2016-12-20 22:30:19
41,251,859
11
2016-12-20 21:53:51
3,521,193
2016-12-20 22:30:19
https://stackoverflow.com/q/41251766
https://stackoverflow.com/a/41251859
<p>You have two options, a <a href="https://www.atlassian.com/git/tutorials/using-branches/git-merge" rel="nofollow noreferrer">merge</a>, or a <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="nofollow noreferrer">rebase</a>.</p> <h2>Merge</h2> <p>Merging branch1 into master is the simplest operat...
<p>You have two options, a <a href="https://www.atlassian.com/git/tutorials/using-branches/git-merge" rel="nofollow noreferrer">merge</a>, or a <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="nofollow noreferrer">rebase</a>.</p> <h2>Merge</h2> <p>Merging branch1 into master is the simplest operat...
63, 119, 8337
bitbucket, git, svn
<h1>Git: move last commit from branch to master</h1> <p>I have 2 commits: A and B. Both are independent from each other and contain different files. I have 2 branches: <code>master</code> and <code>branch1</code>:</p> <pre><code>master: A branch 1: A, B </code></pre> <p>I need to remove <code>branch 1</code> and to m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,733
git
# Git: move last commit from branch to master I have 2 commits: A and B. Both are independent from each other and contain different files. I have 2 branches: `master` and `branch1`: ``` master: A branch 1: A, B ``` I need to remove `branch 1` and to move commit `B` to `master`. I tried to do that with `git cherry-p...
You have two options, a [merge](https://www.atlassian.com/git/tutorials/using-branches/git-merge), or a [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing). ## Merge Merging branch1 into master is the simplest operation to understand, and the option I would recommend. However, it will appear as a new comm...
41058929
Git pull not possible because of unmerged files
6
2016-12-09 11:02:08
<p>I have just tried replacing the <code>master</code> branch on my server with another branch, as the <code>master</code> was broken, and I couldn't seem to resolve the error...</p> <p>The branch that I replaced it with is the last working version I had. I did this by running the following commands from my local machi...
13,315
1,841,758
2022-07-21 14:21:03
41,059,123
11
2016-12-09 11:11:54
4,133,798
2017-12-30 04:42:43
https://stackoverflow.com/q/41058929
https://stackoverflow.com/a/41059123
<p>You have some unmerged files. So, first do <code>commit</code> or <code>stash</code> the files.</p> <pre><code>$ git commit -am &lt;message&gt; # add and commit $ git pull origin master # pull origin Or, $ git add . $ git stash # remove the files...
<p>You have some unmerged files. So, first do <code>commit</code> or <code>stash</code> the files.</p> <pre><code>$ git commit -am &lt;message&gt; # add and commit $ git pull origin master # pull origin Or, $ git add . $ git stash # remove the files...
119, 62599
git, merge-conflict-resolution
<h1>Git pull not possible because of unmerged files</h1> <p>I have just tried replacing the <code>master</code> branch on my server with another branch, as the <code>master</code> was broken, and I couldn't seem to resolve the error...</p> <p>The branch that I replaced it with is the last working version I had. I did t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,735
git
# Git pull not possible because of unmerged files I have just tried replacing the `master` branch on my server with another branch, as the `master` was broken, and I couldn't seem to resolve the error... The branch that I replaced it with is the last working version I had. I did this by running the following commands...
You have some unmerged files. So, first do `commit` or `stash` the files. ``` $ git commit -am <message> # add and commit $ git pull origin master # pull origin Or, $ git add . $ git stash # remove the files $ git pull origin master ```
6333950
Can gitk show all commits EXCEPT those by a given author?
6
2011-06-13 17:31:05
<p>I want to use gitk to view all commits except those by a given author. Something like the following:</p> <p><em>gitk --author=!joe</em></p> <p>Is this possible?</p>
6,530
796,347
2018-06-18 07:03:14
39,794,232
11
2016-09-30 14:46:33
2,374,478
2018-06-18 07:03:14
https://stackoverflow.com/q/6333950
https://stackoverflow.com/a/39794232
<p>From the command line:</p> <pre><code>gitk --perl-regexp --author='^(?!joe)' </code></pre> <p>To exclude commits by several authors:</p> <pre><code>gitk --perl-regexp --author='^(?!jack|jill)' </code></pre> <p>Explanation: <code>(?!whatever)</code> is a (perl-style) look-ahead regular expression: it matches a po...
<p>From the command line:</p> <pre><code>gitk --perl-regexp --author='^(?!joe)' </code></pre> <p>To exclude commits by several authors:</p> <pre><code>gitk --perl-regexp --author='^(?!jack|jill)' </code></pre> <p>Explanation: <code>(?!whatever)</code> is a (perl-style) look-ahead regular expression: it matches a po...
119, 456, 1318, 3953, 30785
author, git, gitk, history, version-control
<h1>Can gitk show all commits EXCEPT those by a given author?</h1> <p>I want to use gitk to view all commits except those by a given author. Something like the following:</p> <p><em>gitk --author=!joe</em></p> <p>Is this possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,736
git
# Can gitk show all commits EXCEPT those by a given author? I want to use gitk to view all commits except those by a given author. Something like the following: *gitk --author=!joe* Is this possible?
From the command line: ``` gitk --perl-regexp --author='^(?!joe)' ``` To exclude commits by several authors: ``` gitk --perl-regexp --author='^(?!jack|jill)' ``` Explanation: `(?!whatever)` is a (perl-style) look-ahead regular expression: it matches a position not followed by `whatever`. We anchor it to the beginni...
39516144
How can I synchronize git branches between bare repositories?
6
2016-09-15 16:34:03
<p>I have a bare repository, whose <code>origin</code> is on a remote machine.</p> <p>I would like to download its branches into the local bare repo. I.e. I want to see them with a <code>git branch -vva</code> command in the branch list, like so:</p> <pre><code>* master 0bc84f0 [origin/master] somethin...
4,090
1,783,163
2016-09-26 09:20:42
39,516,971
11
2016-09-15 17:24:38
6,834,603
2016-09-20 07:23:56
https://stackoverflow.com/q/39516144
https://stackoverflow.com/a/39516971
<p><em>Solution #1:</em></p> <p>You need to convert your repo to a mirror repo:</p> <pre><code>git remote add --mirror=fetch origin &lt;url&gt; git fetch </code></pre> <p>A mirror repo will keep to local references in sync with the origin references after a fetch. It has the disadvantage, that a mirror should be an ...
<p><em>Solution #1:</em></p> <p>You need to convert your repo to a mirror repo:</p> <pre><code>git remote add --mirror=fetch origin &lt;url&gt; git fetch </code></pre> <p>A mirror repo will keep to local references in sync with the origin references after a fetch. It has the disadvantage, that a mirror should be an ...
119
git
<h1>How can I synchronize git branches between bare repositories?</h1> <p>I have a bare repository, whose <code>origin</code> is on a remote machine.</p> <p>I would like to download its branches into the local bare repo. I.e. I want to see them with a <code>git branch -vva</code> command in the branch list, like so:</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,737
git
# How can I synchronize git branches between bare repositories? I have a bare repository, whose `origin` is on a remote machine. I would like to download its branches into the local bare repo. I.e. I want to see them with a `git branch -vva` command in the branch list, like so: ``` * master 0bc84f0 [o...
*Solution #1:* You need to convert your repo to a mirror repo: ``` git remote add --mirror=fetch origin <url> git fetch ``` A mirror repo will keep to local references in sync with the origin references after a fetch. It has the disadvantage, that a mirror should be an exact copy of the remote repo, what may be not ...
32490386
Git: How to create a new branch from a branch which is not current?
6
2015-09-09 22:51:18
<p>I have seen <code>git branch &lt;newBranchName&gt;</code> will create a new branch from the current branch. So for example if my current branch is <code>master</code> then <code>git branch build5</code> will create a new branch <code>build5</code> based on <code>master</code>.</p> <p>But if my current branch is <co...
1,875
4,633,557
2015-09-09 22:58:04
32,490,421
11
2015-09-09 22:55:43
5,298,696
2015-09-09 22:55:43
https://stackoverflow.com/q/32490386
https://stackoverflow.com/a/32490421
<p>Try this</p> <pre><code>git branch build6 build3 </code></pre> <p>or</p> <pre><code>git checkout -b build6 build3 </code></pre> <p>As you can see, <code>git branch</code> takes an optional parameter of a destination branch or commit from which to branch off of.</p>
<p>Try this</p> <pre><code>git branch build6 build3 </code></pre> <p>or</p> <pre><code>git checkout -b build6 build3 </code></pre> <p>As you can see, <code>git branch</code> takes an optional parameter of a destination branch or commit from which to branch off of.</p>
119, 456
git, version-control
<h1>Git: How to create a new branch from a branch which is not current?</h1> <p>I have seen <code>git branch &lt;newBranchName&gt;</code> will create a new branch from the current branch. So for example if my current branch is <code>master</code> then <code>git branch build5</code> will create a new branch <code>build5...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,740
git
# Git: How to create a new branch from a branch which is not current? I have seen `git branch <newBranchName>` will create a new branch from the current branch. So for example if my current branch is `master` then `git branch build5` will create a new branch `build5` based on `master`. But if my current branch is `ma...
Try this ``` git branch build6 build3 ``` or ``` git checkout -b build6 build3 ``` As you can see, `git branch` takes an optional parameter of a destination branch or commit from which to branch off of.
28143880
Solve git file conflict using SmartGit: ours vs theirs
6
2015-01-26 02:08:35
<p>I have a problem here and I don't know why, perhaps I did something wrong. I was working in the same file and other developer was working on it too. He told me that file was pushed to the repository, alright. Before pull the changes I made a commit so my changes was saved and merged with the ones from the other deve...
6,998
719,427
2015-01-26 10:47:27
28,148,663
11
2015-01-26 10:47:27
668,963
2015-01-26 10:47:27
https://stackoverflow.com/q/28143880
https://stackoverflow.com/a/28148663
<p>I don't use smartgit, but from the screenshot I can tell the options map to git commands as below:</p> <ol> <li>do nothing, leave the file unresolved. not sure what will happen by choosing this option.</li> <li>use other developers' changes as git command: <code>git checkout --ours -- FILE</code></li> <li>use my ch...
<p>I don't use smartgit, but from the screenshot I can tell the options map to git commands as below:</p> <ol> <li>do nothing, leave the file unresolved. not sure what will happen by choosing this option.</li> <li>use other developers' changes as git command: <code>git checkout --ours -- FILE</code></li> <li>use my ch...
119, 65939, 106113
git, git-merge-conflict, smartgit
<h1>Solve git file conflict using SmartGit: ours vs theirs</h1> <p>I have a problem here and I don't know why, perhaps I did something wrong. I was working in the same file and other developer was working on it too. He told me that file was pushed to the repository, alright. Before pull the changes I made a commit so m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,742
git
# Solve git file conflict using SmartGit: ours vs theirs I have a problem here and I don't know why, perhaps I did something wrong. I was working in the same file and other developer was working on it too. He told me that file was pushed to the repository, alright. Before pull the changes I made a commit so my changes...
I don't use smartgit, but from the screenshot I can tell the options map to git commands as below: 1. do nothing, leave the file unresolved. not sure what will happen by choosing this option. 2. use other developers' changes as git command: `git checkout --ours -- FILE` 3. use my changes as git command: `git checkout ...
27144441
Solving undefined reference library linking error in gcc
6
2014-11-26 08:32:33
<p>I was trying to build the first commit of git i.e commit e83c516 What I faced was a linker error as shown below</p> <pre><code>$ make gcc -g -Wall -o update-cache update-cache.o read-cache.o -lssl ...
5,772
2,670,370
2017-08-09 21:50:20
27,144,442
11
2014-11-26 08:32:33
2,670,370
2016-07-29 00:08:42
https://stackoverflow.com/q/27144441
https://stackoverflow.com/a/27144442
<p>I read <a href="http://webpages.charter.net/ppluzhnikov/linker.html" rel="noreferrer">this really nice post</a> explaining library linking to me. I'd suggest anyone facing similar problem to read it first.</p> <p>So I'll help new user to dissect the error message. The problem is that it is not able to find the cryp...
<p>I read <a href="http://webpages.charter.net/ppluzhnikov/linker.html" rel="noreferrer">this really nice post</a> explaining library linking to me. I'd suggest anyone facing similar problem to read it first.</p> <p>So I'll help new user to dissect the error message. The problem is that it is not able to find the cryp...
119, 938, 1477, 5647, 8952
build, gcc, git, linker, shared-libraries
<h1>Solving undefined reference library linking error in gcc</h1> <p>I was trying to build the first commit of git i.e commit e83c516 What I faced was a linker error as shown below</p> <pre><code>$ make gcc -g -Wall -o update-cache upd...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,744
git
# Solving undefined reference library linking error in gcc I was trying to build the first commit of git i.e commit e83c516 What I faced was a linker error as shown below ``` $ make gcc -g -Wall -o update-cache update-cache.o read-cac...
I read [this really nice post](http://webpages.charter.net/ppluzhnikov/linker.html) explaining library linking to me. I'd suggest anyone facing similar problem to read it first. So I'll help new user to dissect the error message. The problem is that it is not able to find the crypto library. So we'll need to link that...
26262817
git pull --rebase for a specific folder/file
6
2014-10-08 17:25:34
<p>I only want to rebase one folder.</p> <p>Is it possible to do something like</p> <pre><code>git pull --rebase origin/master path/to/folder/or/file.txt </code></pre> <p>and only that path will be updated?</p>
23,063
1,661,745
2021-09-21 12:27:53
26,263,796
11
2014-10-08 18:22:53
4,021,077
2014-10-08 18:22:53
https://stackoverflow.com/q/26262817
https://stackoverflow.com/a/26263796
<p>The quick answer is "no". </p> <p>The longer answer depends on what you are trying to accomplish, and whether or not you have any changes to any of the files/folders you want to rebase, and what if any history you are interested in showing. </p> <p>If you have no changes on your branch, and you just want to grab ...
<p>The quick answer is "no". </p> <p>The longer answer depends on what you are trying to accomplish, and whether or not you have any changes to any of the files/folders you want to rebase, and what if any history you are interested in showing. </p> <p>If you have no changes on your branch, and you just want to grab ...
119, 28896, 29934
git, git-pull, git-rebase
<h1>git pull --rebase for a specific folder/file</h1> <p>I only want to rebase one folder.</p> <p>Is it possible to do something like</p> <pre><code>git pull --rebase origin/master path/to/folder/or/file.txt </code></pre> <p>and only that path will be updated?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,746
git
# git pull --rebase for a specific folder/file I only want to rebase one folder. Is it possible to do something like ``` git pull --rebase origin/master path/to/folder/or/file.txt ``` and only that path will be updated?
The quick answer is "no". The longer answer depends on what you are trying to accomplish, and whether or not you have any changes to any of the files/folders you want to rebase, and what if any history you are interested in showing. If you have no changes on your branch, and you just want to grab the latest file from...
25378310
Delete last 2 commits (not pushed) in Git, keeping changes
6
2014-08-19 07:57:31
<p>I'm trying to delete, not <code>revert</code>, the last 2 commits on the develop branch of my Git repo. The commits have not been pushed. </p> <p>How would I go about doing this without losing the changes?</p>
1,853
1,960,364
2014-08-19 08:09:22
25,378,392
11
2014-08-19 08:01:40
1,705,441
2014-08-19 08:06:43
https://stackoverflow.com/q/25378310
https://stackoverflow.com/a/25378392
<p>On the develop branch, you would use</p> <pre><code>git reset HEAD~2 </code></pre> <p>This will reset the HEAD pointer to the commit 2 before your current without losing the changes.</p> <p>Here is the excerpt from the help:</p> <pre><code>git reset [-q] [&lt;tree-ish&gt;] [--] &lt;paths&gt;... This form ...
<p>On the develop branch, you would use</p> <pre><code>git reset HEAD~2 </code></pre> <p>This will reset the HEAD pointer to the commit 2 before your current without losing the changes.</p> <p>Here is the excerpt from the help:</p> <pre><code>git reset [-q] [&lt;tree-ish&gt;] [--] &lt;paths&gt;... This form ...
119, 5597, 91259
commit, git, git-rewrite-history
<h1>Delete last 2 commits (not pushed) in Git, keeping changes</h1> <p>I'm trying to delete, not <code>revert</code>, the last 2 commits on the develop branch of my Git repo. The commits have not been pushed. </p> <p>How would I go about doing this without losing the changes?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,748
git
# Delete last 2 commits (not pushed) in Git, keeping changes I'm trying to delete, not `revert`, the last 2 commits on the develop branch of my Git repo. The commits have not been pushed. How would I go about doing this without losing the changes?
On the develop branch, you would use ``` git reset HEAD~2 ``` This will reset the HEAD pointer to the commit 2 before your current without losing the changes. Here is the excerpt from the help: ``` git reset [-q] [<tree-ish>] [--] <paths>... This form resets the index entries for all <paths> to their state ...
21110272
Git - Find when a method is removed
6
2014-01-14 09:46:20
<p>I am using Git to version control a large java project. </p> <p>Is it possible to know at which commit a certain method is added or removed from a certain class?</p>
2,615
495,701
2014-01-14 11:06:00
21,111,975
11
2014-01-14 11:06:00
1,471,829
2014-01-14 11:06:00
https://stackoverflow.com/q/21110272
https://stackoverflow.com/a/21111975
<p>You can search for the name of the method and you will find the all commits that entered or deleted that string:</p> <pre><code>git log -c -S'methodName' /path/to/file.java </code></pre> <p>Another solution is to find the last commit in which that method exists:</p> <pre><code>$ git blame --reverse START_COMMIT.....
<p>You can search for the name of the method and you will find the all commits that entered or deleted that string:</p> <pre><code>git log -c -S'methodName' /path/to/file.java </code></pre> <p>Another solution is to find the last commit in which that method exists:</p> <pre><code>$ git blame --reverse START_COMMIT.....
17, 119
git, java
<h1>Git - Find when a method is removed</h1> <p>I am using Git to version control a large java project. </p> <p>Is it possible to know at which commit a certain method is added or removed from a certain class?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,749
git
# Git - Find when a method is removed I am using Git to version control a large java project. Is it possible to know at which commit a certain method is added or removed from a certain class?
You can search for the name of the method and you will find the all commits that entered or deleted that string: ``` git log -c -S'methodName' /path/to/file.java ``` Another solution is to find the last commit in which that method exists: ``` $ git blame --reverse START_COMMIT.. file.ext ``` `START_COMMIT` is a com...
20822073
Best practice - Git + Build automation - Keeping configs separate
6
2013-12-29 04:11:01
<p>Searching for the best approach to keep my config files separate, yet not introduce extra steps for new developers setting up their environments.</p> <p>I am guessing a submodule would suffice to do the job, but then how would I switch configs seamlessly depending on the task at hand, aka pull in DEV config regular...
2,491
103,647
2022-01-21 08:13:47
20,822,928
11
2013-12-29 07:05:32
6,309
2020-05-05 15:04:36
https://stackoverflow.com/q/20822073
https://stackoverflow.com/a/20822928
<p>That is called <strong><a href="https://stackoverflow.com/a/11961257/6309">content filter driver</a></strong>, and it allows you to declare, in a <code>.gitattributes</code> file (and only for your config files type) a <strong>smudge script</strong> which will <em>automatically on checkout</em>:</p> <ul> <li>combin...
<p>That is called <strong><a href="https://stackoverflow.com/a/11961257/6309">content filter driver</a></strong>, and it allows you to declare, in a <code>.gitattributes</code> file (and only for your config files type) a <strong>smudge script</strong> which will <em>automatically on checkout</em>:</p> <ul> <li>combin...
119, 1362, 5647, 8337, 80988
automation, bitbucket, build, git, gruntjs
<h1>Best practice - Git + Build automation - Keeping configs separate</h1> <p>Searching for the best approach to keep my config files separate, yet not introduce extra steps for new developers setting up their environments.</p> <p>I am guessing a submodule would suffice to do the job, but then how would I switch confi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,750
git
# Best practice - Git + Build automation - Keeping configs separate Searching for the best approach to keep my config files separate, yet not introduce extra steps for new developers setting up their environments. I am guessing a submodule would suffice to do the job, but then how would I switch configs seamlessly de...
That is called **[content filter driver](https://stackoverflow.com/a/11961257/6309)**, and it allows you to declare, in a `.gitattributes` file (and only for your config files type) a **smudge script** which will *automatically on checkout*: - combine a config file *template* file (`config.tpl`) - with the right confi...
19557177
Setting up a git repository on the same server that the code will be deployed to
6
2013-10-24 04:49:36
<p>I have git installed on my Ubuntu server and on my client. I'm planning to install git-flow as well. </p> <p>When I create a project on the server, to where I will pull either the test branch or the production branch (both are on the same server), after I do the git init, what do I do about naming the remote, given...
6,657
1,635,948
2013-10-24 06:00:15
19,558,086
11
2013-10-24 06:00:15
6,309
2013-10-24 06:00:15
https://stackoverflow.com/q/19557177
https://stackoverflow.com/a/19558086
<p>If you clone it locally, the remote will be named for you.</p> <pre><code>git clone /path/to/repo cd repo git remote -v </code></pre> <p>You will see a remote named <code>origin</code>, referring to <code>/path/to/repo</code>.</p> <p>That would be the same as:</p> <pre><code>mkdir repo cd repo git init . git rem...
<p>If you clone it locally, the remote will be named for you.</p> <pre><code>git clone /path/to/repo cd repo git remote -v </code></pre> <p>You will see a remote named <code>origin</code>, referring to <code>/path/to/repo</code>.</p> <p>That would be the same as:</p> <pre><code>mkdir repo cd repo git init . git rem...
119
git
<h1>Setting up a git repository on the same server that the code will be deployed to</h1> <p>I have git installed on my Ubuntu server and on my client. I'm planning to install git-flow as well. </p> <p>When I create a project on the server, to where I will pull either the test branch or the production branch (both are...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,751
git
# Setting up a git repository on the same server that the code will be deployed to I have git installed on my Ubuntu server and on my client. I'm planning to install git-flow as well. When I create a project on the server, to where I will pull either the test branch or the production branch (both are on the same serv...
If you clone it locally, the remote will be named for you. ``` git clone /path/to/repo cd repo git remote -v ``` You will see a remote named `origin`, referring to `/path/to/repo`. That would be the same as: ``` mkdir repo cd repo git init . git remote add origin /path/to/repo git pull ```
17340194
Syntax to submit single git commit to Review Board using post-review
6
2013-06-27 10:00:02
<p>I want to create a Review Board review from a single commit.</p> <p>When I use <code>post-review</code>, it submits all the diffs between my repo and master.</p> <p>How do I limit this to a specific commit? Or the files in a specific commit?</p>
10,971
939,250
2018-02-12 10:51:16
17,340,579
11
2013-06-27 10:20:58
939,250
2013-11-27 15:17:08
https://stackoverflow.com/q/17340194
https://stackoverflow.com/a/17340579
<p>Turns out you need to use <code>--revision-range</code> with the git commits for before and after your change. E.g.</p> <pre><code> post-review --revision-range=f17f771:f5b67e3 </code></pre> <p>Notice that I'm using a truncated value for the commit numbers. Their actual values are f5b67e3978ec0348d33672ba79215fe...
<p>Turns out you need to use <code>--revision-range</code> with the git commits for before and after your change. E.g.</p> <pre><code> post-review --revision-range=f17f771:f5b67e3 </code></pre> <p>Notice that I'm using a truncated value for the commit numbers. Their actual values are f5b67e3978ec0348d33672ba79215fe...
119, 37373
git, review-board
<h1>Syntax to submit single git commit to Review Board using post-review</h1> <p>I want to create a Review Board review from a single commit.</p> <p>When I use <code>post-review</code>, it submits all the diffs between my repo and master.</p> <p>How do I limit this to a specific commit? Or the files in a specific co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,752
git
# Syntax to submit single git commit to Review Board using post-review I want to create a Review Board review from a single commit. When I use `post-review`, it submits all the diffs between my repo and master. How do I limit this to a specific commit? Or the files in a specific commit?
Turns out you need to use `--revision-range` with the git commits for before and after your change. E.g. ``` post-review --revision-range=f17f771:f5b67e3 ``` Notice that I'm using a truncated value for the commit numbers. Their actual values are f5b67e3978ec0348d33672ba79215fe887709bed and f17f7714f7e6c92fafb03bbfa3...
16609934
How to git checkout a remote branch named the same as a directory?
6
2013-05-17 13:10:16
<p>We have a remote branch named <code>deploy</code> for building and testing deploy scripts. Not surprisingly, the deploy scripts end up in a directory called <code>deploy</code>. Now that the directory <code>deploy</code> is in the branch <code>master</code>, when doing an initial clone it's cumbersome to actually ch...
4,439
418,413
2017-08-24 21:39:27
16,610,045
11
2013-05-17 13:15:15
216,074
2013-05-17 13:15:15
https://stackoverflow.com/q/16609934
https://stackoverflow.com/a/16610045
<p>You could simply create a new local branch that points to the remote branch using either of these commands (the latter will check it out immediately):</p> <pre><code>git branch deploy origin/deploy git checkout -b deploy origin/deploy </code></pre> <p>This will however not set up the tracking functionality that ha...
<p>You could simply create a new local branch that points to the remote branch using either of these commands (the latter will check it out immediately):</p> <pre><code>git branch deploy origin/deploy git checkout -b deploy origin/deploy </code></pre> <p>This will however not set up the tracking functionality that ha...
119, 1879
branch, git
<h1>How to git checkout a remote branch named the same as a directory?</h1> <p>We have a remote branch named <code>deploy</code> for building and testing deploy scripts. Not surprisingly, the deploy scripts end up in a directory called <code>deploy</code>. Now that the directory <code>deploy</code> is in the branch <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,753
git
# How to git checkout a remote branch named the same as a directory? We have a remote branch named `deploy` for building and testing deploy scripts. Not surprisingly, the deploy scripts end up in a directory called `deploy`. Now that the directory `deploy` is in the branch `master`, when doing an initial clone it's cu...
You could simply create a new local branch that points to the remote branch using either of these commands (the latter will check it out immediately): ``` git branch deploy origin/deploy git checkout -b deploy origin/deploy ``` This will however not set up the tracking functionality that happens when Git automaticall...
16008318
Including submodules in git checkout to GIT_WORK_TREE in hook
6
2013-04-15 05:41:45
<p>Is it possible to include submodules when using the following code in a post-update hook?</p> <pre><code>GIT_WORK_TREE=/path/to/directory git checkout -f </code></pre> <p>What other options would I have to distribute code, including submodules from a post-update hook?</p> <p>Thanks.</p>
3,731
405,161
2013-04-17 06:45:46
16,008,587
11
2013-04-15 06:04:50
6,309
2013-04-17 06:45:46
https://stackoverflow.com/q/16008318
https://stackoverflow.com/a/16008587
<p>The question "<a href="https://stackoverflow.com/q/7593467/6309">Using <code>git submodule update --init</code> on a post hook</a>" mentions the error message you could see if using this in your <code>post-update</code> hook:</p> <pre><code>GIT_WORK_TREE=/path/to/directory git submodule update --init </code></pre> ...
<p>The question "<a href="https://stackoverflow.com/q/7593467/6309">Using <code>git submodule update --init</code> on a post hook</a>" mentions the error message you could see if using this in your <code>post-update</code> hook:</p> <pre><code>GIT_WORK_TREE=/path/to/directory git submodule update --init </code></pre> ...
119, 37230, 43087
git, git-checkout, githooks
<h1>Including submodules in git checkout to GIT_WORK_TREE in hook</h1> <p>Is it possible to include submodules when using the following code in a post-update hook?</p> <pre><code>GIT_WORK_TREE=/path/to/directory git checkout -f </code></pre> <p>What other options would I have to distribute code, including submodules ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,754
git
# Including submodules in git checkout to GIT_WORK_TREE in hook Is it possible to include submodules when using the following code in a post-update hook? ``` GIT_WORK_TREE=/path/to/directory git checkout -f ``` What other options would I have to distribute code, including submodules from a post-update hook? Thanks.
The question "[Using `git submodule update --init` on a post hook](https://stackoverflow.com/q/7593467/6309)" mentions the error message you could see if using this in your `post-update` hook: ``` GIT_WORK_TREE=/path/to/directory git submodule update --init ``` That would give a: ``` remote: You need to run this com...
15127403
checking out a Git repository and switch to a specific branch using Maven SCM
6
2013-02-28 04:15:55
<p>I would like to use Maven to checkout a Git repository. In our specific use-case this makes sense as this Git Repository contain files that we need to include in out build process.</p> <p>Due to the nature of projects it is likely that the Git repository has different branches. So a simple: scm:git:git...
10,992
1,448,704
2013-02-28 06:45:19
15,129,187
11
2013-02-28 06:45:19
254,643
2013-02-28 06:45:19
https://stackoverflow.com/q/15127403
https://stackoverflow.com/a/15129187
<p>You can use <code>&lt;scmVersion&gt;</code> and <code>&lt;scmVersionType&gt;</code> properties of <a href="http://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html">maven scm plugin</a> to achieve this.</p> <pre><code> &lt;scm&gt; &lt;developerConnection&gt;scm:git:url&lt;/developerConnection&gt; &lt;/...
<p>You can use <code>&lt;scmVersion&gt;</code> and <code>&lt;scmVersionType&gt;</code> properties of <a href="http://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html">maven scm plugin</a> to achieve this.</p> <pre><code> &lt;scm&gt; &lt;developerConnection&gt;scm:git:url&lt;/developerConnection&gt; &lt;/...
119, 456, 41127
git, maven, version-control
<h1>checking out a Git repository and switch to a specific branch using Maven SCM</h1> <p>I would like to use Maven to checkout a Git repository. In our specific use-case this makes sense as this Git Repository contain files that we need to include in out build process.</p> <p>Due to the nature of projects it is likel...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,755
git
# checking out a Git repository and switch to a specific branch using Maven SCM I would like to use Maven to checkout a Git repository. In our specific use-case this makes sense as this Git Repository contain files that we need to include in out build process. Due to the nature of projects it is likely that the Git r...
You can use `<scmVersion>` and `<scmVersionType>` properties of [maven scm plugin](http://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html) to achieve this. ``` <scm> <developerConnection>scm:git:url</developerConnection> </scm> ... <build> <plugins> ... <plugin> <groupI...
14433674
Called git checkout -b branchname on pre-existing branch; was old one overwritten?
6
2013-01-21 06:52:55
<p>I've cloned a large, well-maintained repository. By accident I used the <code>-b</code> flag when checking out a different branch. Git says "Switched to a new branch". Was the pre-existing branch overwritten, is git's output misleading, or did I make another mistake?</p>
6,271
1,124,854
2013-01-21 22:42:47
14,433,875
11
2013-01-21 07:09:04
6,309
2013-01-21 22:16:37
https://stackoverflow.com/q/14433674
https://stackoverflow.com/a/14433875
<blockquote> <p>Was the preexisting branch overwrote,</p> </blockquote> <p>No.<br> The <a href="https://stackoverflow.com/questions/1485578/how-do-i-change-a-git-remote-head-to-point-to-something-besides-master">default branch</a> has been checked out, and a new local branch has been created from its HEAD.</p> <p>Y...
<blockquote> <p>Was the preexisting branch overwrote,</p> </blockquote> <p>No.<br> The <a href="https://stackoverflow.com/questions/1485578/how-do-i-change-a-git-remote-head-to-point-to-something-besides-master">default branch</a> has been checked out, and a new local branch has been created from its HEAD.</p> <p>Y...
119, 1231
command-line, git
<h1>Called git checkout -b branchname on pre-existing branch; was old one overwritten?</h1> <p>I've cloned a large, well-maintained repository. By accident I used the <code>-b</code> flag when checking out a different branch. Git says "Switched to a new branch". Was the pre-existing branch overwritten, is git's output...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,756
git
# Called git checkout -b branchname on pre-existing branch; was old one overwritten? I've cloned a large, well-maintained repository. By accident I used the `-b` flag when checking out a different branch. Git says "Switched to a new branch". Was the pre-existing branch overwritten, is git's output misleading, or did I...
> Was the preexisting branch overwrote, No. The [default branch](https://stackoverflow.com/questions/1485578/how-do-i-change-a-git-remote-head-to-point-to-something-besides-master) has been checked out, and a new local branch has been created from its HEAD. You can see all the branches with: ``` git branch -a ``` ...
13689226
How to copy a file from one git branch to another and save as different file?
6
2012-12-03 18:14:36
<p>I'd like to copy a file from one git branch to another but save it as a different filename. I know I can do this to copy it over with the same name. Is there a way to rename during the checkout?</p> <pre><code>git checkout otherbranch myfile.txt </code></pre>
334
553,994
2022-01-07 04:34:33
13,689,280
11
2012-12-03 18:18:13
631,276
2012-12-03 18:18:13
https://stackoverflow.com/q/13689226
https://stackoverflow.com/a/13689280
<pre><code>git show otherbranch:myfile.txt &gt; myfile2.txt </code></pre>
<pre><code>git show otherbranch:myfile.txt &gt; myfile2.txt </code></pre>
119
git
<h1>How to copy a file from one git branch to another and save as different file?</h1> <p>I'd like to copy a file from one git branch to another but save it as a different filename. I know I can do this to copy it over with the same name. Is there a way to rename during the checkout?</p> <pre><code>git checkout otherb...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
23,758
git
# How to copy a file from one git branch to another and save as different file? I'd like to copy a file from one git branch to another but save it as a different filename. I know I can do this to copy it over with the same name. Is there a way to rename during the checkout? ``` git checkout otherbranch myfile.txt ```
``` git show otherbranch:myfile.txt > myfile2.txt ```