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
5577501
How to tell if string starts with a number with Python?
146
2011-04-07 07:33:48
<p>I have a string that starts with a number (from 0-9) I know I can "or" 10 test cases using startswith() but there is probably a neater solution</p> <p>so instead of writing</p> <pre><code>if (string.startswith('0') || string.startswith('2') || string.startswith('3') || string.startswith('4') || string.star...
208,645
612,258
2022-02-24 13:24:39
5,577,536
259
2011-04-07 07:37:03
157,176
2011-04-07 07:37:03
https://stackoverflow.com/q/5577501
https://stackoverflow.com/a/5577536
<p>Python's <code>string</code> library has <code>isdigit()</code> method:</p> <pre><code>string[0].isdigit() </code></pre>
<p>Python's <code>string</code> library has <code>isdigit()</code> method:</p> <pre><code>string[0].isdigit() </code></pre>
16, 139, 9914
digits, python, string
<h1>How to tell if string starts with a number with Python?</h1> <p>I have a string that starts with a number (from 0-9) I know I can "or" 10 test cases using startswith() but there is probably a neater solution</p> <p>so instead of writing</p> <pre><code>if (string.startswith('0') || string.startswith('2') || st...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,843
git
# How to tell if string starts with a number with Python? I have a string that starts with a number (from 0-9) I know I can "or" 10 test cases using startswith() but there is probably a neater solution so instead of writing ``` if (string.startswith('0') || string.startswith('2') || string.startswith('3') || str...
Python's `string` library has `isdigit()` method: ``` string[0].isdigit() ```
8083282
How do I remove a big file wrongly committed in git
145
2011-11-10 16:55:42
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2100907/how-to-purge-a-huge-file-from-commits-history-in-git">How to purge a huge file from commits history in Git?</a> </p> </blockquote> <p>I did a stupid thing. Imagine that I committed a 100MB file. Then I ...
109,939
632,472
2023-07-29 13:30:49
8,083,362
259
2011-11-10 17:00:44
907,678
2023-07-29 13:30:49
https://stackoverflow.com/q/8083282
https://stackoverflow.com/a/8083362
<p>You can do it using the git <code>filter-branch</code> command, like this :</p> <pre><code>git filter-branch --index-filter &quot;git rm -rf --cached --ignore-unmatch path_to_file&quot; HEAD </code></pre> <p>You can find more documentation here <a href="http://dalibornasevic.com/posts/2-permanently-remove-files-and-...
<p>You can do it using the git <code>filter-branch</code> command, like this :</p> <pre><code>git filter-branch --index-filter &quot;git rm -rf --cached --ignore-unmatch path_to_file&quot; HEAD </code></pre> <p>You can find more documentation here <a href="http://dalibornasevic.com/posts/2-permanently-remove-files-and-...
119, 91259
git, git-rewrite-history
<h1>How do I remove a big file wrongly committed in git</h1> <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2100907/how-to-purge-a-huge-file-from-commits-history-in-git">How to purge a huge file from commits history in Git?</a> </p> </blockquote> <p>I did a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,844
git
# How do I remove a big file wrongly committed in git > **Possible Duplicate:** > [How to purge a huge file from commits history in Git?](https://stackoverflow.com/questions/2100907/how-to-purge-a-huge-file-from-commits-history-in-git) I did a stupid thing. Imagine that I committed a 100MB file. Then I see this and...
You can do it using the git `filter-branch` command, like this : ``` git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD ``` You can find more documentation here <http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository>
23517464
Error: Cannot pull with rebase: You have unstaged changes
308
2014-05-07 12:12:04
<p>I have started collaborating with a few friends on a project &amp; they use the heroku git repository.</p> <p>I cloned the repository a few days ago and they have since made some changes so I am trying to get the latest updates</p> <p>I ran the <code>git pull --rebase</code> command as stated here(Is this the righ...
565,523
3,597,950
2024-03-20 02:15:44
23,517,643
258
2014-05-07 12:20:19
498,699
2014-05-07 12:20:19
https://stackoverflow.com/q/23517464
https://stackoverflow.com/a/23517643
<p>Do <code>git status</code>, this will show you what files have changed. Since you stated that you don't want to keep the changes you can do <code>git checkout -- &lt;file name&gt;</code> or <code>git reset --hard</code> to get rid of the changes.</p> <p>For the most part, git will tell you what to do about changes...
<p>Do <code>git status</code>, this will show you what files have changed. Since you stated that you don't want to keep the changes you can do <code>git checkout -- &lt;file name&gt;</code> or <code>git reset --hard</code> to get rid of the changes.</p> <p>For the most part, git will tell you what to do about changes...
119, 4860, 8279
git, heroku, pull
<h1>Error: Cannot pull with rebase: You have unstaged changes</h1> <p>I have started collaborating with a few friends on a project &amp; they use the heroku git repository.</p> <p>I cloned the repository a few days ago and they have since made some changes so I am trying to get the latest updates</p> <p>I ran the <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,845
git
# Error: Cannot pull with rebase: You have unstaged changes I have started collaborating with a few friends on a project & they use the heroku git repository. I cloned the repository a few days ago and they have since made some changes so I am trying to get the latest updates I ran the `git pull --rebase` command as...
Do `git status`, this will show you what files have changed. Since you stated that you don't want to keep the changes you can do `git checkout -- <file name>` or `git reset --hard` to get rid of the changes. For the most part, git will tell you what to do about changes. For example, your error message said to `git sta...
14243380
How to configure 'git log' to show 'commit date'
240
2013-01-09 17:52:10
<p>How can I configure <code>git log</code> to show <code>commit date</code> instead of <code>author date</code>?</p>
154,663
286,802
2024-07-12 09:41:15
14,244,466
258
2013-01-09 18:59:00
1,253,222
2019-11-13 16:29:30
https://stackoverflow.com/q/14243380
https://stackoverflow.com/a/14244466
<p>There are several options to <a href="https://git-scm.com/docs/pretty-formats" rel="noreferrer">pretty print</a> the date. Probably the easiest is to just use one of the pre-baked <code>--pretty</code> formats, like <code>git log --pretty=fuller</code> - this will show both dates. If you want to see only one date, b...
<p>There are several options to <a href="https://git-scm.com/docs/pretty-formats" rel="noreferrer">pretty print</a> the date. Probably the easiest is to just use one of the pre-baked <code>--pretty</code> formats, like <code>git log --pretty=fuller</code> - this will show both dates. If you want to see only one date, b...
119, 47913
git, git-log
<h1>How to configure 'git log' to show 'commit date'</h1> <p>How can I configure <code>git log</code> to show <code>commit date</code> instead of <code>author date</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,846
git
# How to configure 'git log' to show 'commit date' How can I configure `git log` to show `commit date` instead of `author date`?
There are several options to [pretty print](https://git-scm.com/docs/pretty-formats) the date. Probably the easiest is to just use one of the pre-baked `--pretty` formats, like `git log --pretty=fuller` - this will show both dates. If you want to see only one date, but make it the commit date, you can use `git log --fo...
14273531
How to sort git tags by version string order of form rc-X.Y.Z.W?
181
2013-01-11 07:23:44
<p>When I enter a command:</p> <pre><code>git tag -l </code></pre> <p>I get such results:</p> <pre><code>rc-0.9.0.0 rc-0.9.0.1 rc-0.9.0.10 rc-0.9.0.11 rc-0.9.0.12 rc-0.9.0.2 rc-0.9.0.3 rc-0.9.0.4 rc-0.9.0.5 rc-0.9.0.6 rc-0.9.0.7 rc-0.9.0.8 rc-0.9.0.9 </code></pre> <p>Instead of this I want:</p> <pre><code>rc-0.9.0...
77,669
1,442,283
2022-02-11 06:52:08
14,273,595
258
2013-01-11 07:29:11
216,841
2016-11-28 08:21:26
https://stackoverflow.com/q/14273531
https://stackoverflow.com/a/14273595
<p>Use version sort</p> <pre><code>git tag -l | sort -V </code></pre> <p>or for git version >= 2.0</p> <pre><code>git tag -l --sort=v:refname git tag -l --sort=-v:refname # reverse </code></pre>
<p>Use version sort</p> <pre><code>git tag -l | sort -V </code></pre> <p>or for git version >= 2.0</p> <pre><code>git tag -l --sort=v:refname git tag -l --sort=-v:refname # reverse </code></pre>
115, 119, 134
git, sorting, tags
<h1>How to sort git tags by version string order of form rc-X.Y.Z.W?</h1> <p>When I enter a command:</p> <pre><code>git tag -l </code></pre> <p>I get such results:</p> <pre><code>rc-0.9.0.0 rc-0.9.0.1 rc-0.9.0.10 rc-0.9.0.11 rc-0.9.0.12 rc-0.9.0.2 rc-0.9.0.3 rc-0.9.0.4 rc-0.9.0.5 rc-0.9.0.6 rc-0.9.0.7 rc-0.9.0.8 rc-...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,847
git
# How to sort git tags by version string order of form rc-X.Y.Z.W? When I enter a command: ``` git tag -l ``` I get such results: ``` rc-0.9.0.0 rc-0.9.0.1 rc-0.9.0.10 rc-0.9.0.11 rc-0.9.0.12 rc-0.9.0.2 rc-0.9.0.3 rc-0.9.0.4 rc-0.9.0.5 rc-0.9.0.6 rc-0.9.0.7 rc-0.9.0.8 rc-0.9.0.9 ``` Instead of this I want: ``` rc...
Use version sort ``` git tag -l | sort -V ``` or for git version >= 2.0 ``` git tag -l --sort=v:refname git tag -l --sort=-v:refname # reverse ```
17077973
How to make git diff write to stdout?
162
2013-06-13 01:39:55
<p>By default <code>git diff</code> prints all <code>+-</code> lines to the stdout however I have a (devian) machine (which I connect through ssh) where <code>git diff</code> leads me to an editor (which I don't know which is) and I need to press <kbd>q</kbd> to continue.</p> <p>I've checker git config and it looks li...
55,860
149,008
2022-01-20 06:37:26
17,078,021
258
2013-06-13 01:49:10
28,804
2013-06-13 01:49:10
https://stackoverflow.com/q/17077973
https://stackoverflow.com/a/17078021
<p>By default, Git sends its diff output (and generally any output that may be more than a screenful) to the system's <em>pager</em>, which is a utility that prints only one screenful of output at a time. If you want to disable the pager when you run a command, pass <code>--no-pager</code> to Git:</p> <pre><code>$ git...
<p>By default, Git sends its diff output (and generally any output that may be more than a screenful) to the system's <em>pager</em>, which is a utility that prints only one screenful of output at a time. If you want to disable the pager when you run a command, pass <code>--no-pager</code> to Git:</p> <pre><code>$ git...
119, 391
git, terminal
<h1>How to make git diff write to stdout?</h1> <p>By default <code>git diff</code> prints all <code>+-</code> lines to the stdout however I have a (devian) machine (which I connect through ssh) where <code>git diff</code> leads me to an editor (which I don't know which is) and I need to press <kbd>q</kbd> to continue.<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,848
git
# How to make git diff write to stdout? By default `git diff` prints all `+-` lines to the stdout however I have a (devian) machine (which I connect through ssh) where `git diff` leads me to an editor (which I don't know which is) and I need to press `q` to continue. I've checker git config and it looks like : ``` $...
By default, Git sends its diff output (and generally any output that may be more than a screenful) to the system's *pager*, which is a utility that prints only one screenful of output at a time. If you want to disable the pager when you run a command, pass `--no-pager` to Git: ``` $ git --no-pager <subcommand> <option...
1020132
How to reverse apply a stash?
351
2009-06-19 21:34:59
<p>I have a small patch saved away in my git stash. I've applied it to my working copy using <code>git stash apply</code>. Now, I'd like to back out those changes by reverse applying the patch (kind of like what <code>git revert</code> would do but against the stash).</p> <p>Does anyone know how to do this?</p> <p>...
389,815
825
2025-05-22 17:19:31
1,021,867
257
2009-06-20 15:39:33
123,109
2025-05-22 17:19:31
https://stackoverflow.com/q/1020132
https://stackoverflow.com/a/1021867
<p>According to the <a href="http://git-scm.com/docs/git-stash" rel="nofollow noreferrer">git-stash manpage</a>, &quot;A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at <code>HEAD</code> when the stash was created,&quot; and <code>git stash s...
<p>According to the <a href="http://git-scm.com/docs/git-stash" rel="nofollow noreferrer">git-stash manpage</a>, &quot;A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at <code>HEAD</code> when the stash was created,&quot; and <code>git stash s...
119, 13091
git, git-stash
<h1>How to reverse apply a stash?</h1> <p>I have a small patch saved away in my git stash. I've applied it to my working copy using <code>git stash apply</code>. Now, I'd like to back out those changes by reverse applying the patch (kind of like what <code>git revert</code> would do but against the stash).</p> <p>Do...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,850
git
# How to reverse apply a stash? I have a small patch saved away in my git stash. I've applied it to my working copy using `git stash apply`. Now, I'd like to back out those changes by reverse applying the patch (kind of like what `git revert` would do but against the stash). Does anyone know how to do this? **Clarif...
According to the [git-stash manpage](http://git-scm.com/docs/git-stash), "A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at `HEAD` when the stash was created," and `git stash show -p` gives us "the changes recorded in the stash as a diff betw...
9730486
Can you have additional .gitignore per directory within a single repo?
173
2012-03-16 01:08:29
<p>Can you create a <code>.gitignore</code> file in a directory that only applies to files (and directories) within that directory?</p>
76,809
336,920
2023-03-07 00:13:39
9,733,413
256
2012-03-16 07:22:07
179,675
2012-03-16 07:22:07
https://stackoverflow.com/q/9730486
https://stackoverflow.com/a/9733413
<p>Yes, you can. Try it, it works fine. Put a <code>.gitignore</code> in the root of your repo, and put another <code>.gitignore</code> with additional things to ignore in a subdirectory.</p>
<p>Yes, you can. Try it, it works fine. Put a <code>.gitignore</code> in the root of your repo, and put another <code>.gitignore</code> with additional things to ignore in a subdirectory.</p>
119, 456, 7330, 25056
git, gitignore, repository, version-control
<h1>Can you have additional .gitignore per directory within a single repo?</h1> <p>Can you create a <code>.gitignore</code> file in a directory that only applies to files (and directories) within that directory?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,854
git
# Can you have additional .gitignore per directory within a single repo? Can you create a `.gitignore` file in a directory that only applies to files (and directories) within that directory?
Yes, you can. Try it, it works fine. Put a `.gitignore` in the root of your repo, and put another `.gitignore` with additional things to ignore in a subdirectory.
2425059
How to pull specific directory with git
287
2010-03-11 13:06:31
<p>I have a project with git, and I just want to clone or pull a specific directory, like myproject/javascript just like subversion does. <br /> make some changes, commit and push back again. <br /> It's possible?</p>
539,871
468,508
2024-11-28 12:03:29
4,048,993
255
2010-10-29 04:33:40
84,832
2019-04-05 22:03:50
https://stackoverflow.com/q/2425059
https://stackoverflow.com/a/4048993
<ol> <li>cd into the top of your repo copy</li> <li><code>git fetch</code></li> <li><p><code>git checkout HEAD path/to/your/dir/or/file</code></p> <ul> <li><p>Where "<code>path/...</code>" in (3) starts at the directory just below the repo root containing your "<code>.../file</code>"</p></li> <li><p>NOTE that instead ...
<ol> <li>cd into the top of your repo copy</li> <li><code>git fetch</code></li> <li><p><code>git checkout HEAD path/to/your/dir/or/file</code></p> <ul> <li><p>Where "<code>path/...</code>" in (3) starts at the directory just below the repo root containing your "<code>.../file</code>"</p></li> <li><p>NOTE that instead ...
119, 218, 4860
directory, git, pull
<h1>How to pull specific directory with git</h1> <p>I have a project with git, and I just want to clone or pull a specific directory, like myproject/javascript just like subversion does. <br /> make some changes, commit and push back again. <br /> It's possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,856
git
# How to pull specific directory with git I have a project with git, and I just want to clone or pull a specific directory, like myproject/javascript just like subversion does. make some changes, commit and push back again. It's possible?
1. cd into the top of your repo copy 2. `git fetch` 3. `git checkout HEAD path/to/your/dir/or/file` - Where "`path/...`" in (3) starts at the directory just below the repo root containing your "`.../file`" - NOTE that instead of "HEAD", the hash code of a specific commit may be used, and then you will get the re...
3900805
git command to move a folder inside another
274
2010-10-10 15:01:31
<p>I have created a folder <code>common</code> with a bunch of source files and folders.</p> <p>Now I want to move the <code>common</code> folder into the <code>include</code> folder so it looks like <code>include/common</code></p> <p>I tried these:</p> <ol> <li><p><code>git add include</code></p> </li> <li><p><code>gi...
309,203
170,521
2024-01-29 13:49:29
3,900,841
255
2010-10-10 15:11:24
1,288,364
2021-09-29 10:27:47
https://stackoverflow.com/q/3900805
https://stackoverflow.com/a/3900841
<p>One of the nicest things about git is that you don't need to track file renames explicitly. Git will figure it out by comparing the contents of the files.</p> <p>So, in your case, don't work so hard: Ref: <a href="https://git-scm.com/docs/git-mv" rel="noreferrer">Git mv docs</a></p> <pre><code>$ mkdir include $ git ...
<p>One of the nicest things about git is that you don't need to track file renames explicitly. Git will figure it out by comparing the contents of the files.</p> <p>So, in your case, don't work so hard: Ref: <a href="https://git-scm.com/docs/git-mv" rel="noreferrer">Git mv docs</a></p> <pre><code>$ mkdir include $ git ...
119
git
<h1>git command to move a folder inside another</h1> <p>I have created a folder <code>common</code> with a bunch of source files and folders.</p> <p>Now I want to move the <code>common</code> folder into the <code>include</code> folder so it looks like <code>include/common</code></p> <p>I tried these:</p> <ol> <li><p><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,857
git
# git command to move a folder inside another I have created a folder `common` with a bunch of source files and folders. Now I want to move the `common` folder into the `include` folder so it looks like `include/common` I tried these: 1. `git add include` 2. `git mv common/ include/` but it fails with this erro...
One of the nicest things about git is that you don't need to track file renames explicitly. Git will figure it out by comparing the contents of the files. So, in your case, don't work so hard: Ref: [Git mv docs](https://git-scm.com/docs/git-mv) ``` $ mkdir include $ git mv common include $ git rm -r common $ git add ...
12240154
What is the difference between git am and git apply?
235
2012-09-02 22:10:53
<p>Both <a href="https://git-scm.com/docs/git-am" rel="noreferrer"><code>git am</code></a> and <a href="https://git-scm.com/docs/git-apply" rel="noreferrer"><code>git apply</code></a> can be used to apply patches.</p> <p>It seems that <code>git am</code> automatically commits, whereas <code>git apply</code> only touche...
145,021
288,703
2025-12-06 09:53:10
12,240,235
255
2012-09-02 22:23:10
5,168
2023-09-04 05:49:33
https://stackoverflow.com/q/12240154
https://stackoverflow.com/a/12240235
<p>Both the input and output are different:</p> <ul> <li><a href="https://git-scm.com/docs/git-apply" rel="noreferrer"><code>git apply</code></a> takes a patch (e.g. the output of <a href="https://git-scm.com/docs/git-diff" rel="noreferrer"><code>git diff</code></a>) and applies it to the working directory (or index, i...
<p>Both the input and output are different:</p> <ul> <li><a href="https://git-scm.com/docs/git-apply" rel="noreferrer"><code>git apply</code></a> takes a patch (e.g. the output of <a href="https://git-scm.com/docs/git-diff" rel="noreferrer"><code>git diff</code></a>) and applies it to the working directory (or index, i...
119, 2132
git, patch
<h1>What is the difference between git am and git apply?</h1> <p>Both <a href="https://git-scm.com/docs/git-am" rel="noreferrer"><code>git am</code></a> and <a href="https://git-scm.com/docs/git-apply" rel="noreferrer"><code>git apply</code></a> can be used to apply patches.</p> <p>It seems that <code>git am</code> aut...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,858
git
# What is the difference between git am and git apply? Both [`git am`](https://git-scm.com/docs/git-am) and [`git apply`](https://git-scm.com/docs/git-apply) can be used to apply patches. It seems that `git am` automatically commits, whereas `git apply` only touches the files but doesn't create a commit. Is that the ...
Both the input and output are different: - [`git apply`](https://git-scm.com/docs/git-apply) takes a patch (e.g. the output of [`git diff`](https://git-scm.com/docs/git-diff)) and applies it to the working directory (or index, if `--index` or `--cached` is used). - [`git am`](https://git-scm.com/docs/git-am) takes a m...
3769137
Use git "log" from another folder
199
2010-09-22 12:22:24
<p>I am in directory <code>A</code>. How do I execute <code>git log</code> for the git repository in directory <code>B</code>?</p>
66,173
424,953
2022-05-30 06:17:50
3,769,169
255
2010-09-22 12:26:29
190,381
2018-01-11 21:38:26
https://stackoverflow.com/q/3769137
https://stackoverflow.com/a/3769169
<p>From, <code>man git</code>:</p> <p>You can do this with the <code>--git-dir</code> parameter, before passing any commands.</p> <pre><code>git --git-dir /foo/bar/.git log </code></pre> <p>(Specifying the <code>.git</code> directory is necessary.) From the <a href="https://git-scm.com/docs/git#git---git-dirltpathgt...
<p>From, <code>man git</code>:</p> <p>You can do this with the <code>--git-dir</code> parameter, before passing any commands.</p> <pre><code>git --git-dir /foo/bar/.git log </code></pre> <p>(Specifying the <code>.git</code> directory is necessary.) From the <a href="https://git-scm.com/docs/git#git---git-dirltpathgt...
119
git
<h1>Use git "log" from another folder</h1> <p>I am in directory <code>A</code>. How do I execute <code>git log</code> for the git repository in directory <code>B</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,860
git
# Use git "log" from another folder I am in directory `A`. How do I execute `git log` for the git repository in directory `B`?
From, `man git`: You can do this with the `--git-dir` parameter, before passing any commands. ``` git --git-dir /foo/bar/.git log ``` (Specifying the `.git` directory is necessary.) From the [documentation](https://git-scm.com/docs/git#git---git-dirltpathgt): > `--git-dir=<path>` > > Set the path to the repository....
13583231
push an 'unchecked out' branch
166
2012-11-27 11:28:59
<p>I want to push a branch (not the current) without having to check it out first, how can I achieve that ?</p> <p>this is how I'd do:</p> <pre><code>#currently in master git checkout feature git push origin feature git checkout master </code></pre> <p>but checking out feature can cause conflicts, can't I just push ...
35,260
521,257
2021-06-17 12:07:32
13,583,433
255
2012-11-27 11:39:37
299,924
2021-06-17 12:07:32
https://stackoverflow.com/q/13583231
https://stackoverflow.com/a/13583433
<p>Simply:</p> <pre><code>git push origin feature:feature </code></pre> <p>Or shorter:</p> <pre><code>git push origin feature </code></pre>
<p>Simply:</p> <pre><code>git push origin feature:feature </code></pre> <p>Or shorter:</p> <pre><code>git push origin feature </code></pre>
119
git
<h1>push an 'unchecked out' branch</h1> <p>I want to push a branch (not the current) without having to check it out first, how can I achieve that ?</p> <p>this is how I'd do:</p> <pre><code>#currently in master git checkout feature git push origin feature git checkout master </code></pre> <p>but checking out feature...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,862
git
# push an 'unchecked out' branch I want to push a branch (not the current) without having to check it out first, how can I achieve that ? this is how I'd do: ``` #currently in master git checkout feature git push origin feature git checkout master ``` but checking out feature can cause conflicts, can't I just push ...
Simply: ``` git push origin feature:feature ``` Or shorter: ``` git push origin feature ```
52950
How to make git ignore changes in case?
154
2008-09-09 21:24:53
<p>I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,:</p> <p>before: <code>File.h</code></p> <p>after: <code>file.h</code></p> <p>I don't really care why this is happening, but this causes git to think it is a new file, and then I have to go...
161,677
3,146
2024-11-14 09:22:12
53,116
254
2008-09-09 23:14:28
2,996
2024-11-14 09:22:12
https://stackoverflow.com/q/52950
https://stackoverflow.com/a/53116
<p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.6.txt#L15" rel="noreferrer">version 1.5.6</a> there is an <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase" rel="noreferrer"><code>ignorecase</code> option</a> available in the <code>[core]</code>...
<p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.6.txt#L15" rel="noreferrer">version 1.5.6</a> there is an <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase" rel="noreferrer"><code>ignorecase</code> option</a> available in the <code>[core]</code>...
64, 119
git, windows
<h1>How to make git ignore changes in case?</h1> <p>I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,:</p> <p>before: <code>File.h</code></p> <p>after: <code>file.h</code></p> <p>I don't really care why this is happening, but this causes git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,863
git
# How to make git ignore changes in case? I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,: before: `File.h` after: `file.h` I don't really care why this is happening, but this causes git to think it is a new file, and then I have to go...
Since [version 1.5.6](https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.6.txt#L15) there is an [`ignorecase` option](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase) available in the `[core]` section of `.git/config` e.g. add `ignorecase = true` To change it for just on...
7539382
How can I deploy/push only a subdirectory of my git repo to Heroku?
143
2011-09-24 13:39:31
<p>I have a project that uses <a href="http://get-serve.com">Serve</a> and is version controlled using Git. Serve creates an <code>output</code> folder with static files that I want to deploy to Heroku.</p> <p>I don't want to deploy the Serve project itself since the Heroku Cedar stack doesn't seem too fond of it, but...
49,866
385,622
2021-12-10 23:00:23
10,648,623
254
2012-05-18 07:41:06
1,003,412
2012-08-15 19:40:29
https://stackoverflow.com/q/7539382
https://stackoverflow.com/a/10648623
<p>There's an even easier way via <a href="https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt" rel="noreferrer">git-subtree</a>. Assuming you want to push your folder 'output' as the root to Heroku, you can do:</p> <pre><code>git subtree push --prefix output heroku master </code></pre> <p>It appears...
<p>There's an even easier way via <a href="https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt" rel="noreferrer">git-subtree</a>. Assuming you want to push your folder 'output' as the root to Heroku, you can do:</p> <pre><code>git subtree push --prefix output heroku master </code></pre> <p>It appears...
119, 8279
git, heroku
<h1>How can I deploy/push only a subdirectory of my git repo to Heroku?</h1> <p>I have a project that uses <a href="http://get-serve.com">Serve</a> and is version controlled using Git. Serve creates an <code>output</code> folder with static files that I want to deploy to Heroku.</p> <p>I don't want to deploy the Serve...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,865
git
# How can I deploy/push only a subdirectory of my git repo to Heroku? I have a project that uses [Serve](http://get-serve.com) and is version controlled using Git. Serve creates an `output` folder with static files that I want to deploy to Heroku. I don't want to deploy the Serve project itself since the Heroku Cedar...
There's an even easier way via [git-subtree](https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt). Assuming you want to push your folder 'output' as the root to Heroku, you can do: ``` git subtree push --prefix output heroku master ``` It appears currently that git-subtree is being included into git-c...
5037480
Removing non-repository files with git?
141
2011-02-18 04:03:59
<p>I'm writing Autotools code and in the process of development, tons of files are generated.</p> <p>Is there anyway to tell git to remove all files from a directory that are not part of the repository?</p>
48,005
67,491
2019-01-11 09:56:48
5,037,526
254
2011-02-18 04:14:03
582
2014-10-27 14:08:47
https://stackoverflow.com/q/5037480
https://stackoverflow.com/a/5037526
<p>You can use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-clean.html" rel="noreferrer">git-clean</a>. This command will remove untracked files/directories. By default, it will only print what it would have removed, without actually removing them.</p> <p>Given the <code>-f</code> flag to remove the fi...
<p>You can use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-clean.html" rel="noreferrer">git-clean</a>. This command will remove untracked files/directories. By default, it will only print what it would have removed, without actually removing them.</p> <p>Given the <code>-f</code> flag to remove the fi...
119
git
<h1>Removing non-repository files with git?</h1> <p>I'm writing Autotools code and in the process of development, tons of files are generated.</p> <p>Is there anyway to tell git to remove all files from a directory that are not part of the repository?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,866
git
# Removing non-repository files with git? I'm writing Autotools code and in the process of development, tons of files are generated. Is there anyway to tell git to remove all files from a directory that are not part of the repository?
You can use [git-clean](http://www.kernel.org/pub/software/scm/git/docs/git-clean.html). This command will remove untracked files/directories. By default, it will only print what it would have removed, without actually removing them. Given the `-f` flag to remove the files, and the `-d` flag to remove empty directorie...
6802145
How to convert a Git shallow clone to a full clone?
443
2011-07-23 17:39:29
<p>Follow-up of <a href="https://stackoverflow.com/questions/1209999/using-git-to-get-just-the-latest-revision" title="How to use git to get just the latest revision of a project?">this</a> so-question: if I have a shallow clone, how to fetch all older commits to make it a full clone?</p>
173,893
209,706
2025-06-10 09:41:52
6,802,238
253
2011-07-23 17:55:39
41,071
2022-02-08 09:17:08
https://stackoverflow.com/q/6802145
https://stackoverflow.com/a/6802238
<p><strong>EDIT:</strong> <code>git fetch --unshallow</code> now is an option (thanks Jack O'Connor).</p> <p>You can run <code>git fetch --depth=2147483647</code></p> <p>From the <a href="https://git-scm.com/docs/shallow" rel="noreferrer">docs on shallow</a>:</p> <blockquote> <p>The special depth 2147483647 (or 0x7ffff...
<p><strong>EDIT:</strong> <code>git fetch --unshallow</code> now is an option (thanks Jack O'Connor).</p> <p>You can run <code>git fetch --depth=2147483647</code></p> <p>From the <a href="https://git-scm.com/docs/shallow" rel="noreferrer">docs on shallow</a>:</p> <blockquote> <p>The special depth 2147483647 (or 0x7ffff...
119, 34099
git, git-clone
<h1>How to convert a Git shallow clone to a full clone?</h1> <p>Follow-up of <a href="https://stackoverflow.com/questions/1209999/using-git-to-get-just-the-latest-revision" title="How to use git to get just the latest revision of a project?">this</a> so-question: if I have a shallow clone, how to fetch all older commit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,867
git
# How to convert a Git shallow clone to a full clone? Follow-up of [this](https://stackoverflow.com/questions/1209999/using-git-to-get-just-the-latest-revision "How to use git to get just the latest revision of a project?") so-question: if I have a shallow clone, how to fetch all older commits to make it a full clone?
**EDIT:** `git fetch --unshallow` now is an option (thanks Jack O'Connor). You can run `git fetch --depth=2147483647` From the [docs on shallow](https://git-scm.com/docs/shallow): > The special depth 2147483647 (or 0x7fffffff, the largest positive number a signed 32-bit integer can contain) means infinite depth.
2048470
git working on two branches simultaneously
241
2010-01-12 11:22:10
<p>I have a project with many branches.</p> <p>I would like to work on <strong>several</strong> branches simultaneously without switching back and forth with <code>git checkout</code>.</p> <p>Is there any way I can do that besides copying the whole repository somewhere else?</p>
126,895
158,263
2022-08-07 11:51:15
30,186,843
253
2015-05-12 09:29:49
6,309
2020-06-03 02:09:14
https://stackoverflow.com/q/2048470
https://stackoverflow.com/a/30186843
<p>Git 2.5+ (Q2 2015) supports this feature!</p> <p>If you have a git repo <code>cool-app</code>, cd to root (<code>cd cool-app</code>), run <code>git worktree add ../cool-app-feature-A feature/A</code>. This checks out the branch <code>feature/A</code> in it's own new dedicated directory, <code>cool-app-feature-A</co...
<p>Git 2.5+ (Q2 2015) supports this feature!</p> <p>If you have a git repo <code>cool-app</code>, cd to root (<code>cd cool-app</code>), run <code>git worktree add ../cool-app-feature-A feature/A</code>. This checks out the branch <code>feature/A</code> in it's own new dedicated directory, <code>cool-app-feature-A</co...
119, 1879
branch, git
<h1>git working on two branches simultaneously</h1> <p>I have a project with many branches.</p> <p>I would like to work on <strong>several</strong> branches simultaneously without switching back and forth with <code>git checkout</code>.</p> <p>Is there any way I can do that besides copying the whole repository somewh...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,868
git
# git working on two branches simultaneously I have a project with many branches. I would like to work on **several** branches simultaneously without switching back and forth with `git checkout`. Is there any way I can do that besides copying the whole repository somewhere else?
Git 2.5+ (Q2 2015) supports this feature! If you have a git repo `cool-app`, cd to root (`cd cool-app`), run `git worktree add ../cool-app-feature-A feature/A`. This checks out the branch `feature/A` in it's own new dedicated directory, `cool-app-feature-A`. That replaces an older script `contrib/workdir/git-new-work...
604399
how do you push only some of your local git commits?
211
2009-03-02 22:48:25
<p>Suppose I have 5 local commits. I want to push only 2 of them to a centralized repo (using an SVN-style workflow). How do I do this?</p> <p>This did not work:</p> <pre class="lang-bash prettyprint-override"><code>git checkout HEAD~3 #set head to three commits ago git push #attempt push from that head </code></pre> ...
108,026
72,994
2024-11-13 11:23:15
604,504
253
2009-03-02 23:31:44
62,525
2009-03-03 17:25:37
https://stackoverflow.com/q/604399
https://stackoverflow.com/a/604504
<p>Assuming your commits are on the master branch and you want to push them to the remote master branch:</p> <pre><code>$ git push origin master~3:master </code></pre> <p>If you were using git-svn:</p> <pre><code>$ git svn dcommit master~3 </code></pre> <p>In the case of git-svn, you could also use HEAD~3, since it...
<p>Assuming your commits are on the master branch and you want to push them to the remote master branch:</p> <pre><code>$ git push origin master~3:master </code></pre> <p>If you were using git-svn:</p> <pre><code>$ git svn dcommit master~3 </code></pre> <p>In the case of git-svn, you could also use HEAD~3, since it...
119, 456
git, version-control
<h1>how do you push only some of your local git commits?</h1> <p>Suppose I have 5 local commits. I want to push only 2 of them to a centralized repo (using an SVN-style workflow). How do I do this?</p> <p>This did not work:</p> <pre class="lang-bash prettyprint-override"><code>git checkout HEAD~3 #set head to three co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,870
git
# how do you push only some of your local git commits? Suppose I have 5 local commits. I want to push only 2 of them to a centralized repo (using an SVN-style workflow). How do I do this? This did not work: ``` git checkout HEAD~3 #set head to three commits ago git push #attempt push from that head ``` That ends u...
Assuming your commits are on the master branch and you want to push them to the remote master branch: ``` $ git push origin master~3:master ``` If you were using git-svn: ``` $ git svn dcommit master~3 ``` In the case of git-svn, you could also use HEAD~3, since it is expecting a commit. In the case of straight git...
11893678
warning: remote HEAD refers to nonexistent ref, unable to checkout
173
2012-08-10 00:00:15
<p>This seems like a popular error for different causes.</p> <p>I've got a simple bare git repo called "kiflea.git", I clone it like this:</p> <pre><code>git clone git://kipdola.be/kiflea.git </code></pre> <p>Then git tells me: <code>warning: remote HEAD refers to nonexistent ref, unable to checkout.</code></p> <p>...
195,083
233,428
2024-06-18 09:26:08
15,631,690
253
2013-03-26 07:33:33
334,451
2024-06-18 09:26:08
https://stackoverflow.com/q/11893678
https://stackoverflow.com/a/15631690
<p>The <code>warning: remote HEAD refers to nonexistent ref, unable to checkout.</code> means that the remote (bare) repository contains <em>branch reference</em> in the file called <code>HEAD</code> with a value that does not match any published branch in the same repository. In practice, that file defines <em>which b...
<p>The <code>warning: remote HEAD refers to nonexistent ref, unable to checkout.</code> means that the remote (bare) repository contains <em>branch reference</em> in the file called <code>HEAD</code> with a value that does not match any published branch in the same repository. In practice, that file defines <em>which b...
119
git
<h1>warning: remote HEAD refers to nonexistent ref, unable to checkout</h1> <p>This seems like a popular error for different causes.</p> <p>I've got a simple bare git repo called "kiflea.git", I clone it like this:</p> <pre><code>git clone git://kipdola.be/kiflea.git </code></pre> <p>Then git tells me: <code>warning...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,871
git
# warning: remote HEAD refers to nonexistent ref, unable to checkout This seems like a popular error for different causes. I've got a simple bare git repo called "kiflea.git", I clone it like this: ``` git clone git://kipdola.be/kiflea.git ``` Then git tells me: `warning: remote HEAD refers to nonexistent ref, unab...
The `warning: remote HEAD refers to nonexistent ref, unable to checkout.` means that the remote (bare) repository contains *branch reference* in the file called `HEAD` with a value that does not match any published branch in the same repository. In practice, that file defines *which branch* should be checked out *by de...
2959443
Why is the meaning of “ours” and “theirs” reversed with git-svn
99
2010-06-02 16:05:37
<p>I use git-svn and I noticed that when I have to fix a merge conflict after performing a <code>git svn rebase</code>, the meaning of the <code>--ours</code> and <code>--theirs</code> options to e.g. <code>git checkout</code> is reversed. That is, if there's a conflict and I want to keep the version that came from the...
46,000
182,781
2023-05-31 10:59:51
2,960,751
253
2010-06-02 19:03:07
6,309
2023-05-31 10:59:51
https://stackoverflow.com/q/2959443
https://stackoverflow.com/a/2960751
<p>That seems consistent with what a rebase does.</p> <ul> <li><p><a href="http://git-scm.com/docs/git-svn" rel="noreferrer"><code>git svn rebase</code></a> will fetch revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.</p> </li> <li><p><a href="http://git-scm...
<p>That seems consistent with what a rebase does.</p> <ul> <li><p><a href="http://git-scm.com/docs/git-svn" rel="noreferrer"><code>git svn rebase</code></a> will fetch revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.</p> </li> <li><p><a href="http://git-scm...
119, 6452
git, git-svn
<h1>Why is the meaning of “ours” and “theirs” reversed with git-svn</h1> <p>I use git-svn and I noticed that when I have to fix a merge conflict after performing a <code>git svn rebase</code>, the meaning of the <code>--ours</code> and <code>--theirs</code> options to e.g. <code>git checkout</code> is reversed. That is...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,872
git
# Why is the meaning of “ours” and “theirs” reversed with git-svn I use git-svn and I noticed that when I have to fix a merge conflict after performing a `git svn rebase`, the meaning of the `--ours` and `--theirs` options to e.g. `git checkout` is reversed. That is, if there's a conflict and I want to keep the versio...
That seems consistent with what a rebase does. - [`git svn rebase`](http://git-scm.com/docs/git-svn) will fetch revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it. - [`git rebase`](http://git-scm.com/docs/git-rebase) does mention: Note that a rebase merge...
13106179
Error "Fatal: Not possible to fast-forward, aborting"
781
2012-10-28 03:40:18
<p>Why is Git not allowing me to fast forward merge anymore?</p> <p>If I try to force it using <code>--ff-only</code>, I get the message</p> <blockquote> <p>fatal: Not possible to fast-forward, aborting.</p> </blockquote> <p>I realize that there are huge advantages to <code>merge --no-ff</code>, but I'm just puzzled wh...
1,635,861
1,425,100
2026-01-01 16:57:42
13,106,251
252
2012-10-28 03:57:50
148,870
2012-10-28 03:57:50
https://stackoverflow.com/q/13106179
https://stackoverflow.com/a/13106251
<p>Your branch is no longer directly based off of the branch you're trying to merge it into - e.g. another commit was added to the destination branch that isn't in your branch. Thus, you can't fast-forward into it (because fast-forward requires your branch to completely contain the destination branch).</p> <p>You can ...
<p>Your branch is no longer directly based off of the branch you're trying to merge it into - e.g. another commit was added to the destination branch that isn't in your branch. Thus, you can't fast-forward into it (because fast-forward requires your branch to completely contain the destination branch).</p> <p>You can ...
119
git
<h1>Error "Fatal: Not possible to fast-forward, aborting"</h1> <p>Why is Git not allowing me to fast forward merge anymore?</p> <p>If I try to force it using <code>--ff-only</code>, I get the message</p> <blockquote> <p>fatal: Not possible to fast-forward, aborting.</p> </blockquote> <p>I realize that there are huge ad...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,873
git
# Error "Fatal: Not possible to fast-forward, aborting" Why is Git not allowing me to fast forward merge anymore? If I try to force it using `--ff-only`, I get the message > fatal: Not possible to fast-forward, aborting. I realize that there are huge advantages to `merge --no-ff`, but I'm just puzzled why I can't `...
Your branch is no longer directly based off of the branch you're trying to merge it into - e.g. another commit was added to the destination branch that isn't in your branch. Thus, you can't fast-forward into it (because fast-forward requires your branch to completely contain the destination branch). You can rebase you...
2263674
How do I find the next commit in Git? (child/children of ref)
306
2010-02-15 02:04:31
<p><code>ref^</code> refers to the commit before <code>ref</code>. What about getting the commit <em>after</em> <code>ref</code>?</p> <p>For example, if I <code>git checkout 12345</code>, how do I check out the next commit?</p> <p>Yes, Git's a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="noreferr...
95,016
14,660
2024-04-26 00:26:27
9,870,218
252
2012-03-26 10:07:31
1,292,707
2023-01-16 06:04:20
https://stackoverflow.com/q/2263674
https://stackoverflow.com/a/9870218
<p>To list all the commits, starting from the current one, and then its child, and so on - basically standard git log, but going the other way in time, use something like</p> <pre><code>git log --reverse --ancestry-path 894e8b4e93d8f3^..master </code></pre> <p>where 894e8b4e93d8f3 is the first commit you want to show.<...
<p>To list all the commits, starting from the current one, and then its child, and so on - basically standard git log, but going the other way in time, use something like</p> <pre><code>git log --reverse --ancestry-path 894e8b4e93d8f3^..master </code></pre> <p>where 894e8b4e93d8f3 is the first commit you want to show.<...
119, 456
git, version-control
<h1>How do I find the next commit in Git? (child/children of ref)</h1> <p><code>ref^</code> refers to the commit before <code>ref</code>. What about getting the commit <em>after</em> <code>ref</code>?</p> <p>For example, if I <code>git checkout 12345</code>, how do I check out the next commit?</p> <p>Yes, Git's a <a hr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,874
git
# How do I find the next commit in Git? (child/children of ref) `ref^` refers to the commit before `ref`. What about getting the commit *after* `ref`? For example, if I `git checkout 12345`, how do I check out the next commit? Yes, Git's a [DAG](https://en.wikipedia.org/wiki/Directed_acyclic_graph) node pointer stru...
To list all the commits, starting from the current one, and then its child, and so on - basically standard git log, but going the other way in time, use something like ``` git log --reverse --ancestry-path 894e8b4e93d8f3^..master ``` where 894e8b4e93d8f3 is the first commit you want to show. N.b. When using a DOS co...
3380805
Checkout old commit and make it a new commit
249
2010-08-01 05:00:52
<p>On Git, say I mess up my commits, and I want to make the version 3 commits ago as the new version. If I do <code>git checkout xxxx</code>, it creates a new branch and it seems like I can only merge it? Could I make this the new "master version"?</p> <p>I want:</p> <pre><code>A-B-C-D-E </code></pre> <p>to become</...
246,967
133,747
2015-05-20 09:25:02
3,382,249
252
2010-08-01 13:46:36
41,071
2010-08-01 13:46:36
https://stackoverflow.com/q/3380805
https://stackoverflow.com/a/3382249
<pre><code>git rm -r . git checkout HEAD~3 . git commit </code></pre> <p>After the commit, files in the new <code>HEAD</code> will be the same as they were in the revision <code>HEAD~3</code>.</p>
<pre><code>git rm -r . git checkout HEAD~3 . git commit </code></pre> <p>After the commit, files in the new <code>HEAD</code> will be the same as they were in the revision <code>HEAD~3</code>.</p>
119
git
<h1>Checkout old commit and make it a new commit</h1> <p>On Git, say I mess up my commits, and I want to make the version 3 commits ago as the new version. If I do <code>git checkout xxxx</code>, it creates a new branch and it seems like I can only merge it? Could I make this the new "master version"?</p> <p>I want:</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,875
git
# Checkout old commit and make it a new commit On Git, say I mess up my commits, and I want to make the version 3 commits ago as the new version. If I do `git checkout xxxx`, it creates a new branch and it seems like I can only merge it? Could I make this the new "master version"? I want: ``` A-B-C-D-E ``` to becom...
``` git rm -r . git checkout HEAD~3 . git commit ``` After the commit, files in the new `HEAD` will be the same as they were in the revision `HEAD~3`.
31368434
How can I print the log for a branch other than the current one?
174
2015-07-12 13:46:56
<p>I'm on a branch with some changes. Changing branch is a pain as some files are locked by processes, so to change branch I'd have to stop all the processes which have locks, then <code>stash</code> the changes before checking out the other branch to see its log.</p> <p>Is it possible to view the log for a different...
71,946
442,351
2022-09-14 15:31:43
31,370,483
252
2015-07-12 17:20:52
2,541,573
2021-11-18 17:25:48
https://stackoverflow.com/q/31368434
https://stackoverflow.com/a/31370483
<h2>TL;DR</h2> <p>Use</p> <pre><code>git log &lt;branch&gt; </code></pre> <p>where <code>&lt;branch&gt;</code> is the name of the branch of interest.</p> <h2>From the <code>git-log</code> man-page...</h2> <p>A simplified version of the <code>git-log</code> synopsis given in <a href="http://git-scm.com/docs/git-log" rel...
<h2>TL;DR</h2> <p>Use</p> <pre><code>git log &lt;branch&gt; </code></pre> <p>where <code>&lt;branch&gt;</code> is the name of the branch of interest.</p> <h2>From the <code>git-log</code> man-page...</h2> <p>A simplified version of the <code>git-log</code> synopsis given in <a href="http://git-scm.com/docs/git-log" rel...
119, 1879, 13091, 37230, 47913
branch, git, git-checkout, git-log, git-stash
<h1>How can I print the log for a branch other than the current one?</h1> <p>I'm on a branch with some changes. Changing branch is a pain as some files are locked by processes, so to change branch I'd have to stop all the processes which have locks, then <code>stash</code> the changes before checking out the other bra...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,876
git
# How can I print the log for a branch other than the current one? I'm on a branch with some changes. Changing branch is a pain as some files are locked by processes, so to change branch I'd have to stop all the processes which have locks, then `stash` the changes before checking out the other branch to see its log. ...
## TL;DR Use ``` git log <branch> ``` where `<branch>` is the name of the branch of interest. ## From the `git-log` man-page... A simplified version of the `git-log` synopsis given in [that command's man page](http://git-scm.com/docs/git-log) is ``` git log [<revision range>] ``` Further down, you can find the f...
23512402
How can I delete a git alias?
165
2014-05-07 08:18:18
<p>I'm learning to work with git, and I tried to set some aliases like this:</p> <pre><code>git config --global alias.trololo 'status' </code></pre> <p>So now when I type <code>git trololo</code> it works like <code>git status</code>. </p> <p>Now trololo alias is not needed. How can I correctly delete it?</p>
50,562
2,902,432
2024-02-01 11:13:05
23,512,420
252
2014-05-07 08:19:12
6,309
2014-05-07 08:21:18
https://stackoverflow.com/q/23512402
https://stackoverflow.com/a/23512420
<p>You can try <code>--unset</code> in <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>git config</code></a>:</p> <pre><code>git config --global --unset alias.trololo </code></pre> <p>I find it safer than editing directly the config file (<code>git config --global --edit</code>)</p>
<p>You can try <code>--unset</code> in <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>git config</code></a>:</p> <pre><code>git config --global --unset alias.trololo </code></pre> <p>I find it safer than editing directly the config file (<code>git config --global --edit</code>)</p>
119, 1448
alias, git
<h1>How can I delete a git alias?</h1> <p>I'm learning to work with git, and I tried to set some aliases like this:</p> <pre><code>git config --global alias.trololo 'status' </code></pre> <p>So now when I type <code>git trololo</code> it works like <code>git status</code>. </p> <p>Now trololo alias is not needed. H...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,877
git
# How can I delete a git alias? I'm learning to work with git, and I tried to set some aliases like this: ``` git config --global alias.trololo 'status' ``` So now when I type `git trololo` it works like `git status`. Now trololo alias is not needed. How can I correctly delete it?
You can try `--unset` in [`git config`](http://git-scm.com/docs/git-config): ``` git config --global --unset alias.trololo ``` I find it safer than editing directly the config file (`git config --global --edit`)
59533905
Azure DevOps - compare two commits right in the web UI?
158
2019-12-30 16:26:37
<p>This is surely something simple I'm overlooking. In the Azure DevOps web interface (not integrated as part of an IDE), I see how to compare any commit to its parent, but I can't figure out how to compare it to an arbitrary commit.</p> <p>ie, I'm looking for the equivalent of <a href="https://help.github.com/en/gith...
115,021
230,851
2025-04-15 09:44:38
60,229,869
252
2020-02-14 16:11:30
2,486,830
2020-02-27 09:11:36
https://stackoverflow.com/q/59533905
https://stackoverflow.com/a/60229869
<p>If you go to the list of branches for a repository, you can click on <code>...</code> (More Actions) on one of the branches and choose <code>Compare branches</code></p> <p>This will take you to a URL in the form: <code>https://dev.azure.com/{organisation}/{project}/_git/{repository}/branches?baseVersion=GB{baseBran...
<p>If you go to the list of branches for a repository, you can click on <code>...</code> (More Actions) on one of the branches and choose <code>Compare branches</code></p> <p>This will take you to a URL in the form: <code>https://dev.azure.com/{organisation}/{project}/_git/{repository}/branches?baseVersion=GB{baseBran...
119, 2936, 116537, 134848
azure-devops, azure-repos, compare, git
<h1>Azure DevOps - compare two commits right in the web UI?</h1> <p>This is surely something simple I'm overlooking. In the Azure DevOps web interface (not integrated as part of an IDE), I see how to compare any commit to its parent, but I can't figure out how to compare it to an arbitrary commit.</p> <p>ie, I'm looki...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,878
git
# Azure DevOps - compare two commits right in the web UI? This is surely something simple I'm overlooking. In the Azure DevOps web interface (not integrated as part of an IDE), I see how to compare any commit to its parent, but I can't figure out how to compare it to an arbitrary commit. ie, I'm looking for the equiv...
If you go to the list of branches for a repository, you can click on `...` (More Actions) on one of the branches and choose `Compare branches` This will take you to a URL in the form: `https://dev.azure.com/{organisation}/{project}/_git/{repository}/branches?baseVersion=GB{baseBranch}&targetVersion=GB{targetBranch}&_a...
2108405
Branch descriptions in Git
370
2010-01-21 10:26:17
<p>Is there a way in Git to have a 'description' for branches?</p> <p>While I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for the branches, but I think a 'description' (short note about t...
85,038
229,602
2025-10-19 10:32:44
8,858,853
251
2012-01-13 23:56:29
893
2018-07-05 13:36:55
https://stackoverflow.com/q/2108405
https://stackoverflow.com/a/8858853
<p>Git 1.7.9 supports this. From the <a href="https://github.com/gitster/git/blob/master/Documentation/RelNotes/1.7.9.txt" rel="noreferrer">1.7.9 release notes</a>:</p> <pre> * "git branch --edit-description" can be used to add descriptive text to explain what a topic branch is about. </pre> <p>You can see that f...
<p>Git 1.7.9 supports this. From the <a href="https://github.com/gitster/git/blob/master/Documentation/RelNotes/1.7.9.txt" rel="noreferrer">1.7.9 release notes</a>:</p> <pre> * "git branch --edit-description" can be used to add descriptive text to explain what a topic branch is about. </pre> <p>You can see that f...
119, 1066, 1879, 6141
branch, continuous-integration, git, task-tracking
<h1>Branch descriptions in Git</h1> <p>Is there a way in Git to have a 'description' for branches?</p> <p>While I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for the branches, but I think...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,879
git
# Branch descriptions in Git Is there a way in Git to have a 'description' for branches? While I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for the branches, but I think a 'description'...
Git 1.7.9 supports this. From the [1.7.9 release notes](https://github.com/gitster/git/blob/master/Documentation/RelNotes/1.7.9.txt): ``` * "git branch --edit-description" can be used to add descriptive text to explain what a topic branch is about. ``` You can see that feature introduced back in September 2011, w...
14679614
Is there a way to put multiple projects in a git repository?
259
2013-02-04 02:22:51
<p>For some reason, I only have <strong>one repository</strong> to use.<br /> But I have <em><strong>multiple projects</strong></em> including <code>java</code> projects, <code>PHP scripts</code> and <code>Android</code> apps projects.</p> <p>Now my problem is, I have to put them to different <strong>sub-folders</stron...
333,553
1,263,556
2021-09-13 15:13:27
14,680,329
251
2013-02-04 04:22:01
577,081
2013-02-04 04:22:01
https://stackoverflow.com/q/14679614
https://stackoverflow.com/a/14680329
<p>While most people will tell you to just use multiple repositories, I feel it's worth mentioning there are other solutions.</p> <h2>Solution 1</h2> <p>A single repository can contain multiple <em>independent</em> branches, called <strong>orphan branches</strong>. Orphan branches are completely separate from each ot...
<p>While most people will tell you to just use multiple repositories, I feel it's worth mentioning there are other solutions.</p> <h2>Solution 1</h2> <p>A single repository can contain multiple <em>independent</em> branches, called <strong>orphan branches</strong>. Orphan branches are completely separate from each ot...
119
git
<h1>Is there a way to put multiple projects in a git repository?</h1> <p>For some reason, I only have <strong>one repository</strong> to use.<br /> But I have <em><strong>multiple projects</strong></em> including <code>java</code> projects, <code>PHP scripts</code> and <code>Android</code> apps projects.</p> <p>Now my ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,881
git
# Is there a way to put multiple projects in a git repository? For some reason, I only have **one repository** to use. But I have ***multiple projects*** including `java` projects, `PHP scripts` and `Android` apps projects. Now my problem is, I have to put them to different **sub-folders** inside the repository I...
While most people will tell you to just use multiple repositories, I feel it's worth mentioning there are other solutions. ## Solution 1 A single repository can contain multiple *independent* branches, called **orphan branches**. Orphan branches are completely separate from each other; they do not share histories. `...
36687536
How to open 2 Visual Studio instances, with same Git projects and different branches
201
2016-04-17 19:32:55
<p>I need to open 2 Visual Studio instances: one will be to just look at the code of the Project X / Branch 1, and the other will be used to code in the Project X / Branch 2.</p> <p>How can I do that without losing changes when committing?</p>
110,492
256,925
2024-10-29 11:49:56
53,706,560
250
2018-12-10 13:20:21
9,898,659
2021-05-28 07:48:44
https://stackoverflow.com/q/36687536
https://stackoverflow.com/a/53706560
<p><strong>The issue here isn't to do with Visual studio, but how Git works.</strong> When you check out a branch in git, it places that branch into your working tree or (file structure, whatever you wish to call it).</p> <p>With git you can only have one branch checked out at a time, but wait <strong>there is a soluti...
<p><strong>The issue here isn't to do with Visual studio, but how Git works.</strong> When you check out a branch in git, it places that branch into your working tree or (file structure, whatever you wish to call it).</p> <p>With git you can only have one branch checked out at a time, but wait <strong>there is a soluti...
119, 33953
git, visual-studio
<h1>How to open 2 Visual Studio instances, with same Git projects and different branches</h1> <p>I need to open 2 Visual Studio instances: one will be to just look at the code of the Project X / Branch 1, and the other will be used to code in the Project X / Branch 2.</p> <p>How can I do that without losing changes whe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,883
git
# How to open 2 Visual Studio instances, with same Git projects and different branches I need to open 2 Visual Studio instances: one will be to just look at the code of the Project X / Branch 1, and the other will be used to code in the Project X / Branch 2. How can I do that without losing changes when committing?
**The issue here isn't to do with Visual studio, but how Git works.** When you check out a branch in git, it places that branch into your working tree or (file structure, whatever you wish to call it). With git you can only have one branch checked out at a time, but wait **there is a solution!** By **utilising the** *...
13847425
Overwrite single file in my current branch with the same file in the main branch?
179
2012-12-12 19:47:21
<p>Say I have two branches - <code>master</code> and <code>redesign</code>. How would I go about overwriting the file <code>default.aspx.cs</code> in my redesign branch with the one from master?</p> <p>I found <a href="https://stackoverflow.com/questions/692246/how-do-i-revert-one-file-to-the-last-commit-in-git">this...
146,402
226,897
2021-08-09 06:57:37
13,847,492
250
2012-12-12 19:51:07
1,021,809
2014-06-28 16:53:19
https://stackoverflow.com/q/13847425
https://stackoverflow.com/a/13847492
<p><code>git checkout master path/to/default.aspx.cs</code></p> <p>Before doing this, you probably have to : <code>git checkout redesign</code></p> <p>So, just <strong><code>git checkout FROM_BRANCH_NAME path/to/file</code></strong></p>
<p><code>git checkout master path/to/default.aspx.cs</code></p> <p>Before doing this, you probably have to : <code>git checkout redesign</code></p> <p>So, just <strong><code>git checkout FROM_BRANCH_NAME path/to/file</code></strong></p>
119
git
<h1>Overwrite single file in my current branch with the same file in the main branch?</h1> <p>Say I have two branches - <code>master</code> and <code>redesign</code>. How would I go about overwriting the file <code>default.aspx.cs</code> in my redesign branch with the one from master?</p> <p>I found <a href="https://...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,884
git
# Overwrite single file in my current branch with the same file in the main branch? Say I have two branches - `master` and `redesign`. How would I go about overwriting the file `default.aspx.cs` in my redesign branch with the one from master? I found [this question](https://stackoverflow.com/questions/692246/how-do-i...
`git checkout master path/to/default.aspx.cs` Before doing this, you probably have to : `git checkout redesign` So, just **`git checkout FROM_BRANCH_NAME path/to/file`**
6406762
Why am I merging "remote-tracking branch 'origin/develop' into develop"?
168
2011-06-20 04:15:59
<p>I'm the only one in my organization who's making commits with the following message:</p> <blockquote> <p>Merge remote-tracking branch 'origin/develop' into develop </p> </blockquote> <p>Not sure what I'm doing to cause them, but I'd like to stop.</p> <p>What command am I issuing to create this commit, and what ...
145,481
311,901
2021-07-08 20:58:39
6,406,947
250
2011-06-20 04:55:44
712,605
2013-09-19 18:40:00
https://stackoverflow.com/q/6406762
https://stackoverflow.com/a/6406947
<p><code>git pull</code> is probably creating the commit. If you make a local commit and then run <code>git pull</code> after someone else pushes a commit up to the repository, Git downloads the other developer's commit and then merges it into your local branch.</p> <h2>How to avoid these merge commits in the future<...
<p><code>git pull</code> is probably creating the commit. If you make a local commit and then run <code>git pull</code> after someone else pushes a commit up to the repository, Git downloads the other developer's commit and then merges it into your local branch.</p> <h2>How to avoid these merge commits in the future<...
119, 28897, 41346, 53847
branching-and-merging, git, git-merge, git-remote
<h1>Why am I merging "remote-tracking branch 'origin/develop' into develop"?</h1> <p>I'm the only one in my organization who's making commits with the following message:</p> <blockquote> <p>Merge remote-tracking branch 'origin/develop' into develop </p> </blockquote> <p>Not sure what I'm doing to cause them, but I'...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,885
git
# Why am I merging "remote-tracking branch 'origin/develop' into develop"? I'm the only one in my organization who's making commits with the following message: > Merge remote-tracking branch 'origin/develop' into develop Not sure what I'm doing to cause them, but I'd like to stop. What command am I issuing to creat...
`git pull` is probably creating the commit. If you make a local commit and then run `git pull` after someone else pushes a commit up to the repository, Git downloads the other developer's commit and then merges it into your local branch. ## How to avoid these merge commits in the future You could use `git pull --reba...
4161022
How to track untracked content?
167
2010-11-12 02:04:54
<p>See below the solid line for my original question.</p> <p>I have a folder in my local directory that is untracked. When I run <code>git status</code>, I get:</p> <pre><code>Changed but not updated: modified: vendor/plugins/open_flash_chart_2 (modified content, untracked content) </code></pre> <p>When I type <co...
178,242
341,583
2023-10-29 09:32:16
4,162,672
250
2010-11-12 08:06:31
193,688
2010-11-12 08:06:31
https://stackoverflow.com/q/4161022
https://stackoverflow.com/a/4162672
<p>You have added <code>vendor/plugins/open_flash_chart_2</code> as “gitlink” entry, but never defined it as a submodule. Effectively you are using the internal feature that <em>git submodule</em> uses (gitlink entries) but you are not using the submodule feature itself.</p> <p>You probably did something like this:</...
<p>You have added <code>vendor/plugins/open_flash_chart_2</code> as “gitlink” entry, but never defined it as a submodule. Effectively you are using the internal feature that <em>git submodule</em> uses (gitlink entries) but you are not using the submodule feature itself.</p> <p>You probably did something like this:</...
119, 41612
git, git-submodules
<h1>How to track untracked content?</h1> <p>See below the solid line for my original question.</p> <p>I have a folder in my local directory that is untracked. When I run <code>git status</code>, I get:</p> <pre><code>Changed but not updated: modified: vendor/plugins/open_flash_chart_2 (modified content, untracked c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,886
git
# How to track untracked content? See below the solid line for my original question. I have a folder in my local directory that is untracked. When I run `git status`, I get: ``` Changed but not updated: modified: vendor/plugins/open_flash_chart_2 (modified content, untracked content) ``` When I type `git add vend...
You have added `vendor/plugins/open_flash_chart_2` as “gitlink” entry, but never defined it as a submodule. Effectively you are using the internal feature that *git submodule* uses (gitlink entries) but you are not using the submodule feature itself. You probably did something like this: ``` git clone git://github.co...
16283280
How to locate the git config file in Mac
201
2013-04-29 16:09:04
<p>As title reads, how to locate the git config file in Mac? Not sure how to find it. Need to set </p> <pre><code>git config --global http.postBuffer 524288000 </code></pre> <p>Need some guidance on finding it..</p>
375,197
1,152,000
2017-09-07 11:53:48
16,283,303
248
2013-04-29 16:10:17
501,250
2017-09-07 11:53:48
https://stackoverflow.com/q/16283280
https://stackoverflow.com/a/16283303
<p>The global Git configuration file is stored at <code>$HOME/.gitconfig</code> on all platforms.</p> <p>However, you can simply open a terminal and execute <code>git config</code>, which will write the appropriate changes to this file. You shouldn't need to manually tweak <code>.gitconfig</code>, unless you particul...
<p>The global Git configuration file is stored at <code>$HOME/.gitconfig</code> on all platforms.</p> <p>However, you can simply open a terminal and execute <code>git config</code>, which will write the appropriate changes to this file. You shouldn't need to manually tweak <code>.gitconfig</code>, unless you particul...
119, 369
git, macos
<h1>How to locate the git config file in Mac</h1> <p>As title reads, how to locate the git config file in Mac? Not sure how to find it. Need to set </p> <pre><code>git config --global http.postBuffer 524288000 </code></pre> <p>Need some guidance on finding it..</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,891
git
# How to locate the git config file in Mac As title reads, how to locate the git config file in Mac? Not sure how to find it. Need to set ``` git config --global http.postBuffer 524288000 ``` Need some guidance on finding it..
The global Git configuration file is stored at `$HOME/.gitconfig` on all platforms. However, you can simply open a terminal and execute `git config`, which will write the appropriate changes to this file. You shouldn't need to manually tweak `.gitconfig`, unless you particularly want to.
15292391
Is it possible to perform a 'grep search' in all the branches of a Git project?
196
2013-03-08 10:58:37
<p>Is it possible to run <code>git grep</code> inside all the branches of a Git control sourced project? Or is there another command to run?</p>
98,945
1,275,959
2024-06-01 02:18:06
15,293,283
247
2013-03-08 11:47:08
6,309
2024-02-01 07:18:54
https://stackoverflow.com/q/15292391
https://stackoverflow.com/a/15293283
<p>The question &quot;<a href="https://stackoverflow.com/q/2928584/6309">How to grep (search) committed code in the Git history?</a>&quot; recommends:</p> <pre><code> git grep &lt;regexp&gt; $(git rev-list --all) </code></pre> <p>That searches through all the commits, which should include all the branches.</p> <p>Anoth...
<p>The question &quot;<a href="https://stackoverflow.com/q/2928584/6309">How to grep (search) committed code in the Git history?</a>&quot; recommends:</p> <pre><code> git grep &lt;regexp&gt; $(git rev-list --all) </code></pre> <p>That searches through all the commits, which should include all the branches.</p> <p>Anoth...
119, 1271
git, grep
<h1>Is it possible to perform a 'grep search' in all the branches of a Git project?</h1> <p>Is it possible to run <code>git grep</code> inside all the branches of a Git control sourced project? Or is there another command to run?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,894
git
# Is it possible to perform a 'grep search' in all the branches of a Git project? Is it possible to run `git grep` inside all the branches of a Git control sourced project? Or is there another command to run?
The question "[How to grep (search) committed code in the Git history?](https://stackoverflow.com/q/2928584/6309)" recommends: ``` git grep <regexp> $(git rev-list --all) ``` That searches through all the commits, which should include all the branches. Another form would be: ``` git rev-list --all | ( while re...
25671785
git: fatal unable to auto-detect email address
167
2014-09-04 17:40:08
<p>I just cannot commit with git on Ubuntu 14.04</p> <p><strong><em>Error message is:</em></strong></p> <blockquote> <p>git: fatal unable to auto-detect email address (got "some wrong email")</p> </blockquote> <p>I tried <code>git-config</code> with and without the <code>--global</code> option setting user.name an...
408,551
2,428,094
2025-02-04 15:55:51
27,318,036
247
2014-12-05 14:25:31
3,617,227
2017-07-03 14:39:18
https://stackoverflow.com/q/25671785
https://stackoverflow.com/a/27318036
<p>Probably a typo mistake: set <code>user.mail</code> with no <strong>e</strong>. Fix it by setting <code>user.email</code> in the Global Configuration with</p> <pre><code>$ git config --global user.email "you@example.com" </code></pre> <p>Already been asked: <a href="https://stackoverflow.com/questions/14662526/why...
<p>Probably a typo mistake: set <code>user.mail</code> with no <strong>e</strong>. Fix it by setting <code>user.email</code> in the Global Configuration with</p> <pre><code>$ git config --global user.email "you@example.com" </code></pre> <p>Already been asked: <a href="https://stackoverflow.com/questions/14662526/why...
32868
git-config
<h1>git: fatal unable to auto-detect email address</h1> <p>I just cannot commit with git on Ubuntu 14.04</p> <p><strong><em>Error message is:</em></strong></p> <blockquote> <p>git: fatal unable to auto-detect email address (got "some wrong email")</p> </blockquote> <p>I tried <code>git-config</code> with and witho...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,895
git
# git: fatal unable to auto-detect email address I just cannot commit with git on Ubuntu 14.04 ***Error message is:*** > git: fatal unable to auto-detect email address (got "some wrong email") I tried `git-config` with and without the `--global` option setting user.name and user.mail but nothing works
Probably a typo mistake: set `user.mail` with no **e**. Fix it by setting `user.email` in the Global Configuration with ``` $ git config --global user.email "you@example.com" ``` Already been asked: [Why Git is not allowing me to commit even after configuration?](https://stackoverflow.com/questions/14662526/why-git-i...
12591247
How to find commit when line was deleted/removed?
194
2012-09-25 21:22:00
<p>I have a deleted line in a file in my Git repository. I knew some of the missing text, and the file that it was in, so I used <code>git log -S'missingtext' /path/to/file</code>.</p> <p>However, the only thing that came back was the commit in which I added the line containing the missing text. The text wasn't present...
73,915
155,370
2025-12-12 19:51:11
12,591,569
246
2012-09-25 21:47:56
356,955
2021-02-04 19:05:38
https://stackoverflow.com/q/12591247
https://stackoverflow.com/a/12591569
<p><code>git log -c -S'missingtext' /path/to/file</code></p> <p><code>git log</code> doesn't show a diff for merge commits by default. Try the <code>-c</code> or <code>--cc</code> flags.</p> <p>More discussion/explanation:<br /> <a href="https://git-scm.com/docs/git-log" rel="noreferrer">https://git-scm.com/docs/git-lo...
<p><code>git log -c -S'missingtext' /path/to/file</code></p> <p><code>git log</code> doesn't show a diff for merge commits by default. Try the <code>-c</code> or <code>--cc</code> flags.</p> <p>More discussion/explanation:<br /> <a href="https://git-scm.com/docs/git-log" rel="noreferrer">https://git-scm.com/docs/git-lo...
119, 47913
git, git-log
<h1>How to find commit when line was deleted/removed?</h1> <p>I have a deleted line in a file in my Git repository. I knew some of the missing text, and the file that it was in, so I used <code>git log -S'missingtext' /path/to/file</code>.</p> <p>However, the only thing that came back was the commit in which I added th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,896
git
# How to find commit when line was deleted/removed? I have a deleted line in a file in my Git repository. I knew some of the missing text, and the file that it was in, so I used `git log -S'missingtext' /path/to/file`. However, the only thing that came back was the commit in which I added the line containing the miss...
`git log -c -S'missingtext' /path/to/file` `git log` doesn't show a diff for merge commits by default. Try the `-c` or `--cc` flags. More discussion/explanation: <https://git-scm.com/docs/git-log> [nabble.com](http://git.661346.n2.nabble.com/log-p-hides-changes-in-merge-commit-td5896280.html) From the git-log do...
11188801
Connect a local repository with a remote repository
177
2012-06-25 11:48:19
<p>I have a local repository. I created the whole application, but now I want to push it to a remote repository. I already have remote repo as well. How can I connect these two repositories without losing any work that I did?</p>
216,160
1,136,062
2023-06-30 14:38:00
11,188,828
246
2012-06-25 11:50:49
718,180
2022-03-07 20:36:25
https://stackoverflow.com/q/11188801
https://stackoverflow.com/a/11188828
<p>Use:</p> <pre><code>git remote add origin &lt;remote_repo_URL&gt; git push --all origin </code></pre> <p>If you want to set all of your branches to automatically use this remote repository when you use <code>git pull</code>, add <code>--set-upstream</code> to the push:</p> <pre><code>git push --all --set-upstream or...
<p>Use:</p> <pre><code>git remote add origin &lt;remote_repo_URL&gt; git push --all origin </code></pre> <p>If you want to set all of your branches to automatically use this remote repository when you use <code>git pull</code>, add <code>--set-upstream</code> to the push:</p> <pre><code>git push --all --set-upstream or...
119, 7330
git, repository
<h1>Connect a local repository with a remote repository</h1> <p>I have a local repository. I created the whole application, but now I want to push it to a remote repository. I already have remote repo as well. How can I connect these two repositories without losing any work that I did?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,897
git
# Connect a local repository with a remote repository I have a local repository. I created the whole application, but now I want to push it to a remote repository. I already have remote repo as well. How can I connect these two repositories without losing any work that I did?
Use: ``` git remote add origin <remote_repo_URL> git push --all origin ``` If you want to set all of your branches to automatically use this remote repository when you use `git pull`, add `--set-upstream` to the push: ``` git push --all --set-upstream origin ```
7986139
Git error when trying to push -- pre-receive hook declined
460
2011-11-02 19:22:24
<p>When I try and push a change I've committed, I get the following error:</p> <pre><code>git.exe push -v --progress &quot;origin&quot; iteration1:iteration1 remote: ********************************************************************* To ssh://git@mycogit/cit_pplus.git ! [remote rejected] iteration1 -&gt; iteration1...
1,516,952
1,235,929
2025-04-03 14:28:03
7,988,885
244
2011-11-03 00:09:20
6,236
2015-01-13 10:24:32
https://stackoverflow.com/q/7986139
https://stackoverflow.com/a/7988885
<p>You should ask whoever maintains the repo at <code>git@mycogit/cit_pplus.git</code>.</p> <p>Your commits were rejected by the <a href="http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks" rel="noreferrer"><code>pre-receive</code> hook</a> of that repo (that's a user-configurable script that is...
<p>You should ask whoever maintains the repo at <code>git@mycogit/cit_pplus.git</code>.</p> <p>Your commits were rejected by the <a href="http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks" rel="noreferrer"><code>pre-receive</code> hook</a> of that repo (that's a user-configurable script that is...
119
git
<h1>Git error when trying to push -- pre-receive hook declined</h1> <p>When I try and push a change I've committed, I get the following error:</p> <pre><code>git.exe push -v --progress &quot;origin&quot; iteration1:iteration1 remote: ********************************************************************* To ssh://git@m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,902
git
# Git error when trying to push -- pre-receive hook declined When I try and push a change I've committed, I get the following error: ``` git.exe push -v --progress "origin" iteration1:iteration1 remote: ********************************************************************* To ssh://git@mycogit/cit_pplus.git ! [remot...
You should ask whoever maintains the repo at `git@mycogit/cit_pplus.git`. Your commits were rejected by the [`pre-receive` hook](http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks) of that repo (that's a user-configurable script that is intended to analyze incoming commits and decide if they are...
10588291
Git branching: master vs. origin/master vs. remotes/origin/master
235
2012-05-14 17:33:26
<p>I think I'm on the right track to understand the basic concepts of git.</p> <p>I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it.</p> <p>My problem is that I don't understand the difference between:</p> <ul> <li>origin/master vs...
151,271
1,020,719
2022-02-24 23:18:00
10,588,561
244
2012-05-14 17:56:41
147,356
2012-05-14 17:56:41
https://stackoverflow.com/q/10588291
https://stackoverflow.com/a/10588561
<p>Take a clone of a remote repository and run <code>git branch -a</code> (to show all the branches git knows about). It will probably look something like this:</p> <pre><code>* master remotes/origin/HEAD -&gt; origin/master remotes/origin/master </code></pre> <p>Here, <code>master</code> is a branch in the loca...
<p>Take a clone of a remote repository and run <code>git branch -a</code> (to show all the branches git knows about). It will probably look something like this:</p> <pre><code>* master remotes/origin/HEAD -&gt; origin/master remotes/origin/master </code></pre> <p>Here, <code>master</code> is a branch in the loca...
119, 41346, 76220
git, git-branch, git-remote
<h1>Git branching: master vs. origin/master vs. remotes/origin/master</h1> <p>I think I'm on the right track to understand the basic concepts of git.</p> <p>I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it.</p> <p>My problem is tha...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,903
git
# Git branching: master vs. origin/master vs. remotes/origin/master I think I'm on the right track to understand the basic concepts of git. I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it. My problem is that I don't understand th...
Take a clone of a remote repository and run `git branch -a` (to show all the branches git knows about). It will probably look something like this: ``` * master remotes/origin/HEAD -> origin/master remotes/origin/master ``` Here, `master` is a branch in the local repository. `remotes/origin/master` is a branch nam...
5798930
"git rm --cached x" vs "git reset head --​ x"?
181
2011-04-27 03:13:02
<p><a href="http://gitref.org/basic/" rel="noreferrer">GitRef.org - Basic</a>:</p> <blockquote> <p><code>git rm</code> will remove entries from the staging area. This is a bit different from <code>git reset HEAD</code> which "unstages" files. By "unstage" I mean it reverts the staging area to what was there ...
214,555
632,951
2020-10-18 07:53:47
5,800,164
244
2011-04-27 06:14:58
526,535
2020-10-18 07:53:47
https://stackoverflow.com/q/5798930
https://stackoverflow.com/a/5800164
<p>There are three places where a file, say, can be - the (committed) tree, the index and the working copy. When you just add a file to a folder, you are adding it to the working copy.</p> <p>When you do something like <code>git add file</code> you add it to the index. And when you commit it, you add it to the tree as ...
<p>There are three places where a file, say, can be - the (committed) tree, the index and the working copy. When you just add a file to a folder, you are adding it to the working copy.</p> <p>When you do something like <code>git add file</code> you add it to the index. And when you commit it, you add it to the tree as ...
119, 51381, 68400, 112901
git, git-index, git-reset, git-rm
<h1>"git rm --cached x" vs "git reset head --​ x"?</h1> <p><a href="http://gitref.org/basic/" rel="noreferrer">GitRef.org - Basic</a>:</p> <blockquote> <p><code>git rm</code> will remove entries from the staging area. This is a bit different from <code>git reset HEAD</code> which "unstages" files. By "unstage"...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,904
git
# "git rm --cached x" vs "git reset head --​ x"? [GitRef.org - Basic](http://gitref.org/basic/): > `git rm` will remove entries from the > staging area. This is a bit different > from `git reset HEAD` which "unstages" > files. By "unstage" I mean it reverts > the staging area to what was there > before we started mod...
There are three places where a file, say, can be - the (committed) tree, the index and the working copy. When you just add a file to a folder, you are adding it to the working copy. When you do something like `git add file` you add it to the index. And when you commit it, you add it to the tree as well. It will proba...
9110478
How to find the hash of branch in Git?
150
2012-02-02 10:12:05
<p>Given a local / remote branch name, how could I get the hash of the commit that this branch points to?</p>
152,195
247,243
2022-05-07 12:17:11
9,110,527
244
2012-02-02 10:15:20
223,092
2016-04-01 13:46:50
https://stackoverflow.com/q/9110478
https://stackoverflow.com/a/9110527
<p>The command <a href="https://git-scm.com/docs/git-rev-parse" rel="noreferrer"><code>git rev-parse</code></a> is your friend, e.g.:</p> <pre><code>$ git rev-parse development 17f2303133734f4b9a9aacfe52209e04ec11aff4 </code></pre> <p>... or for a remote-tracking branch:</p> <pre><code>$ git rev-parse origin/master ...
<p>The command <a href="https://git-scm.com/docs/git-rev-parse" rel="noreferrer"><code>git rev-parse</code></a> is your friend, e.g.:</p> <pre><code>$ git rev-parse development 17f2303133734f4b9a9aacfe52209e04ec11aff4 </code></pre> <p>... or for a remote-tracking branch:</p> <pre><code>$ git rev-parse origin/master ...
119
git
<h1>How to find the hash of branch in Git?</h1> <p>Given a local / remote branch name, how could I get the hash of the commit that this branch points to?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,905
git
# How to find the hash of branch in Git? Given a local / remote branch name, how could I get the hash of the commit that this branch points to?
The command [`git rev-parse`](https://git-scm.com/docs/git-rev-parse) is your friend, e.g.: ``` $ git rev-parse development 17f2303133734f4b9a9aacfe52209e04ec11aff4 ``` ... or for a remote-tracking branch: ``` $ git rev-parse origin/master da1ec1472c108f52d4256049fe1f674af69e785d ``` This command is generally very ...
17413493
Create a submodule repository from a folder and keep its git commit history
144
2013-07-01 20:52:43
<p>I have a web application that explores other web applications in a particular way. It contains some web demos in a <code>demos</code> folder and one of the demo should now have it's own repository. I would like to create a separate repository for this demo application and make it a <del>subpackage</del> <a href="htt...
60,460
1,092,815
2024-10-03 16:52:09
18,129,693
244
2013-08-08 15:12:15
1,092,815
2021-09-13 19:41:41
https://stackoverflow.com/q/17413493
https://stackoverflow.com/a/18129693
<h1>Detailed Solution</h1> <blockquote> <p>See the note at the end of this answer (last paragraph) for a quick alternative to git submodules using npm ;)</p> </blockquote> <p>In the following answer, you will know how to extract a folder from a repository and make a git repository from it and then including it as a <a ...
<h1>Detailed Solution</h1> <blockquote> <p>See the note at the end of this answer (last paragraph) for a quick alternative to git submodules using npm ;)</p> </blockquote> <p>In the following answer, you will know how to extract a folder from a repository and make a git repository from it and then including it as a <a ...
119, 41612, 69559
git, git-submodules, revision-history
<h1>Create a submodule repository from a folder and keep its git commit history</h1> <p>I have a web application that explores other web applications in a particular way. It contains some web demos in a <code>demos</code> folder and one of the demo should now have it's own repository. I would like to create a separate ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,906
git
# Create a submodule repository from a folder and keep its git commit history I have a web application that explores other web applications in a particular way. It contains some web demos in a `demos` folder and one of the demo should now have it's own repository. I would like to create a separate repository for this ...
# Detailed Solution > See the note at the end of this answer (last paragraph) for a quick alternative to git submodules using npm ;) In the following answer, you will know how to extract a folder from a repository and make a git repository from it and then including it as a [submodule](http://git-scm.com/book/en/Git-...
15127078
Git Pull is Not Possible, Unmerged Files
110
2013-02-28 03:45:40
<p>I've read all of the similar questions on this; it seems that none of the following have worked:</p> <pre><code>Delete offending files git reset --hard HEAD git stash git pull </code></pre> <p>Nearly every combination, stashing changes and pulling from repository, results in unmergable files. I'd like to discard a...
302,083
431,369
2024-10-29 15:49:56
15,129,293
244
2013-02-28 06:51:05
591,166
2024-10-29 15:49:56
https://stackoverflow.com/q/15127078
https://stackoverflow.com/a/15129293
<p>Say the remote is <code>origin</code> and the branch is <code>master</code>, and say you already have <code>master</code> checked out, might try the following:</p> <pre><code>git fetch origin git reset --hard origin/master </code></pre> <p>This basically just takes the current branch and points it to the <code>HEAD<...
<p>Say the remote is <code>origin</code> and the branch is <code>master</code>, and say you already have <code>master</code> checked out, might try the following:</p> <pre><code>git fetch origin git reset --hard origin/master </code></pre> <p>This basically just takes the current branch and points it to the <code>HEAD<...
119
git
<h1>Git Pull is Not Possible, Unmerged Files</h1> <p>I've read all of the similar questions on this; it seems that none of the following have worked:</p> <pre><code>Delete offending files git reset --hard HEAD git stash git pull </code></pre> <p>Nearly every combination, stashing changes and pulling from repository, ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,907
git
# Git Pull is Not Possible, Unmerged Files I've read all of the similar questions on this; it seems that none of the following have worked: ``` Delete offending files git reset --hard HEAD git stash git pull ``` Nearly every combination, stashing changes and pulling from repository, results in unmergable files. I'd ...
Say the remote is `origin` and the branch is `master`, and say you already have `master` checked out, might try the following: ``` git fetch origin git reset --hard origin/master ``` This basically just takes the current branch and points it to the `HEAD` of the remote branch. **WARNING**: As stated in the comments,...
9933325
Is there a way of having git show lines added, lines changed and lines removed?
218
2012-03-29 20:50:28
<p><code>git diff --stat</code> and <code>git log --stat</code> show output like:</p> <pre class="lang-bash prettyprint-override"><code>$ git diff -C --stat HEAD c9af3e6136e8aec1f79368c2a6164e56bf7a7e07 app/controllers/application_controller.rb | 34 +++------------------------- 1 files changed, 4 insertions(+), 30 de...
187,867
722,456
2023-09-30 18:51:16
9,933,440
243
2012-03-29 20:59:13
420,452
2023-09-30 18:51:16
https://stackoverflow.com/q/9933325
https://stackoverflow.com/a/9933440
<p>For per-file numerical diff information:</p> <pre class="lang-bash prettyprint-override"><code>git diff --numstat </code></pre> <p>For aggregated numerical diff information:</p> <pre class="lang-bash prettyprint-override"><code>git diff --shortstat </code></pre> <p>As far as separating modification from an add and r...
<p>For per-file numerical diff information:</p> <pre class="lang-bash prettyprint-override"><code>git diff --numstat </code></pre> <p>For aggregated numerical diff information:</p> <pre class="lang-bash prettyprint-override"><code>git diff --shortstat </code></pre> <p>As far as separating modification from an add and r...
119, 9033
git, git-diff
<h1>Is there a way of having git show lines added, lines changed and lines removed?</h1> <p><code>git diff --stat</code> and <code>git log --stat</code> show output like:</p> <pre class="lang-bash prettyprint-override"><code>$ git diff -C --stat HEAD c9af3e6136e8aec1f79368c2a6164e56bf7a7e07 app/controllers/application_...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,908
git
# Is there a way of having git show lines added, lines changed and lines removed? `git diff --stat` and `git log --stat` show output like: ``` $ git diff -C --stat HEAD c9af3e6136e8aec1f79368c2a6164e56bf7a7e07 app/controllers/application_controller.rb | 34 +++------------------------- 1 files changed, 4 insertions(...
For per-file numerical diff information: ``` git diff --numstat ``` For aggregated numerical diff information: ``` git diff --shortstat ``` As far as separating modification from an add and remove pair, `--word-diff` might help. You could try something like this: ``` MOD_PATTERN='^.+(\[-|\{\+).*$' \ ADD_PATTERN='^...
12522565
How can I combine two commits into one commit?
170
2012-09-20 23:56:41
<p>I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. </p> <p>The command <code>git merge --squash</code> sounds promising, but when I run <code>git merge --squash</code> my terminal just brings up options for the command. What is the correct comm...
250,789
1,001,938
2026-01-22 20:39:11
12,523,432
243
2012-09-21 02:19:24
229,044
2020-06-19 03:34:44
https://stackoverflow.com/q/12522565
https://stackoverflow.com/a/12523432
<p>You want to <code>git rebase -i</code> to perform an <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages" rel="noreferrer">interactive rebase</a>.</p> <p>If you're currently <em>on</em> your "commit 1", and the commit you want to merge, "commit 2", is the previous commi...
<p>You want to <code>git rebase -i</code> to perform an <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages" rel="noreferrer">interactive rebase</a>.</p> <p>If you're currently <em>on</em> your "commit 1", and the commit you want to merge, "commit 2", is the previous commi...
119, 717, 1879, 6452, 8974
branch, git, git-svn, merge, rebase
<h1>How can I combine two commits into one commit?</h1> <p>I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. </p> <p>The command <code>git merge --squash</code> sounds promising, but when I run <code>git merge --squash</code> my terminal just bri...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,909
git
# How can I combine two commits into one commit? I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. The command `git merge --squash` sounds promising, but when I run `git merge --squash` my terminal just brings up options for the command. What is...
You want to `git rebase -i` to perform an [interactive rebase](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages). If you're currently *on* your "commit 1", and the commit you want to merge, "commit 2", is the previous commit, you can run `git rebase -i HEAD~2`, which will spawn ...
1078146
Re-doing a reverted merge in Git
364
2009-07-03 07:15:28
<p>I have run into a bit of a problem here: I had a problem-specific branch <code>28s</code> in Git, that I merged in the general <code>develop</code> branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge <code>28s</code> into <code>develop</code>, bu...
221,604
123,144
2025-07-03 14:49:40
1,078,209
242
2009-07-03 07:35:17
88,442
2019-09-05 02:08:59
https://stackoverflow.com/q/1078146
https://stackoverflow.com/a/1078209
<p>You have to "revert the revert". Depending on you how did the original revert, it may not be as easy as it sounds. Look at the <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt" rel="noreferrer">official document on this topic</a>.</p> <pre><code>---o---o---o---M---x---x---W--...
<p>You have to "revert the revert". Depending on you how did the original revert, it may not be as easy as it sounds. Look at the <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt" rel="noreferrer">official document on this topic</a>.</p> <pre><code>---o---o---o---M---x---x---W--...
119, 28897, 34403
git, git-merge, git-revert
<h1>Re-doing a reverted merge in Git</h1> <p>I have run into a bit of a problem here: I had a problem-specific branch <code>28s</code> in Git, that I merged in the general <code>develop</code> branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge <cod...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,910
git
# Re-doing a reverted merge in Git I have run into a bit of a problem here: I had a problem-specific branch `28s` in Git, that I merged in the general `develop` branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge `28s` into `develop`, but git-merge...
You have to "revert the revert". Depending on you how did the original revert, it may not be as easy as it sounds. Look at the [official document on this topic](http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt). ``` ---o---o---o---M---x---x---W---x---Y / ---A---B-----...
6199889
Rebasing remote branches in Git
178
2011-06-01 10:43:01
<p>I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has its master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example:</p> <pre><code>remote: master local: master featur...
264,762
246,534
2023-03-25 22:55:31
6,204,804
242
2011-06-01 16:49:51
1,864,976
2022-12-23 06:25:54
https://stackoverflow.com/q/6199889
https://stackoverflow.com/a/6204804
<p>It comes down to whether the feature is used by one person or if others are working off of it.</p> <p>You can force the push after the rebase if it's just you:</p> <pre><code>git push origin feature -f </code></pre> <p>However, if others are working on it, you should merge and not rebase off of master.</p> <pre><cod...
<p>It comes down to whether the feature is used by one person or if others are working off of it.</p> <p>You can force the push after the rebase if it's just you:</p> <pre><code>git push origin feature -f </code></pre> <p>However, if others are working on it, you should merge and not rebase off of master.</p> <pre><cod...
119, 456, 1879, 8974, 40701
branch, feature-branch, git, rebase, version-control
<h1>Rebasing remote branches in Git</h1> <p>I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has its master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example:</p> <pre><code>r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,911
git
# Rebasing remote branches in Git I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has its master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example: ``` remote: master lo...
It comes down to whether the feature is used by one person or if others are working off of it. You can force the push after the rebase if it's just you: ``` git push origin feature -f ``` However, if others are working on it, you should merge and not rebase off of master. ``` git merge master git push origin featur...
16974204
How to get commit history for just one branch?
202
2013-06-07 00:05:18
<p>Let's say I created a new branch <code>my_experiment</code> from <code>master</code> and made several commits to <code>my_experiment</code>. If I do a <code>git log</code> when on <code>my_experiment</code>, I see the commits made to this branch, but also the commits made to <code>master</code> before the <code>my_...
463,239
48,413
2023-04-17 07:18:51
16,974,215
241
2013-06-07 00:06:31
31,671
2014-11-17 19:29:28
https://stackoverflow.com/q/16974204
https://stackoverflow.com/a/16974215
<p>You can use a <a href="http://git-scm.com/book/be/v2/Git-Tools-Revision-Selection#Commit-Ranges">range</a> to do that.</p> <pre><code>git log master.. </code></pre> <p>If you've checked out your <code>my_experiment</code> branch. This will compare where <code>master</code> is at to <code>HEAD</code> (the tip of <c...
<p>You can use a <a href="http://git-scm.com/book/be/v2/Git-Tools-Revision-Selection#Commit-Ranges">range</a> to do that.</p> <pre><code>git log master.. </code></pre> <p>If you've checked out your <code>my_experiment</code> branch. This will compare where <code>master</code> is at to <code>HEAD</code> (the tip of <c...
119, 47913
git, git-log
<h1>How to get commit history for just one branch?</h1> <p>Let's say I created a new branch <code>my_experiment</code> from <code>master</code> and made several commits to <code>my_experiment</code>. If I do a <code>git log</code> when on <code>my_experiment</code>, I see the commits made to this branch, but also the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,913
git
# How to get commit history for just one branch? Let's say I created a new branch `my_experiment` from `master` and made several commits to `my_experiment`. If I do a `git log` when on `my_experiment`, I see the commits made to this branch, but also the commits made to `master` before the `my_experiments` branch was c...
You can use a [range](http://git-scm.com/book/be/v2/Git-Tools-Revision-Selection#Commit-Ranges) to do that. ``` git log master.. ``` If you've checked out your `my_experiment` branch. This will compare where `master` is at to `HEAD` (the tip of `my_experiment`).
3119850
Is there a way to reduce the size of the Git folder?
186
2010-06-25 16:53:44
<p>It seems like my project is getting bigger and bigger with every Git <code>commit/push</code>. Is there a way to clean up my Git folder?</p>
216,378
19,875
2025-03-05 22:02:10
3,119,876
241
2010-06-25 16:58:43
363,078
2025-03-05 22:02:10
https://stackoverflow.com/q/3119850
https://stackoverflow.com/a/3119876
<p>I'm not sure what you want. First of all, of course each time you commit/push the directory is going to get a little larger, since it has to store each of those additional commits.</p> <p>However, probably you want <code>git gc</code> which will &quot;cleanup unnecessary files and optimize the local repository&quot;...
<p>I'm not sure what you want. First of all, of course each time you commit/push the directory is going to get a little larger, since it has to store each of those additional commits.</p> <p>However, probably you want <code>git gc</code> which will &quot;cleanup unnecessary files and optimize the local repository&quot;...
119
git
<h1>Is there a way to reduce the size of the Git folder?</h1> <p>It seems like my project is getting bigger and bigger with every Git <code>commit/push</code>. Is there a way to clean up my Git folder?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,914
git
# Is there a way to reduce the size of the Git folder? It seems like my project is getting bigger and bigger with every Git `commit/push`. Is there a way to clean up my Git folder?
I'm not sure what you want. First of all, of course each time you commit/push the directory is going to get a little larger, since it has to store each of those additional commits. However, probably you want `git gc` which will "cleanup unnecessary files and optimize the local repository" ([manual page](http://git-scm...
20168639
git commit get fatal error "fatal: CRLF would be replaced by LF in"
98
2013-11-23 22:22:39
<p>I'm using Ubuntu 13.10 x64, and I am working on a project that some developers are using Windows , I recently changed the git config <code>core.eol</code> to "lf" and <code>core.autocrlf</code> to "input" and <code>core.safecrlf</code> to "true". Since then, when I try to commit file into my local repository, I get ...
110,625
2,221,411
2024-02-14 00:56:07
20,168,775
241
2013-11-23 22:36:42
6,309
2014-10-09 14:49:53
https://stackoverflow.com/q/20168639
https://stackoverflow.com/a/20168775
<p>This is a classic issue:</p> <p><img src="https://i.sstatic.net/7SWV6.png" alt="http://toub.es/sites/toub.es/files/styles/standard_article/public/field/image/firstcommit.png"><br> (picture from <a href="http://toub.es/about" rel="noreferrer">Luis Tubes</a>'s <a href="http://toub.es/2012/05/28/fatal-crlf-would-be-re...
<p>This is a classic issue:</p> <p><img src="https://i.sstatic.net/7SWV6.png" alt="http://toub.es/sites/toub.es/files/styles/standard_article/public/field/image/firstcommit.png"><br> (picture from <a href="http://toub.es/about" rel="noreferrer">Luis Tubes</a>'s <a href="http://toub.es/2012/05/28/fatal-crlf-would-be-re...
119, 12863
eol, git
<h1>git commit get fatal error "fatal: CRLF would be replaced by LF in"</h1> <p>I'm using Ubuntu 13.10 x64, and I am working on a project that some developers are using Windows , I recently changed the git config <code>core.eol</code> to "lf" and <code>core.autocrlf</code> to "input" and <code>core.safecrlf</code> to "...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,916
git
# git commit get fatal error "fatal: CRLF would be replaced by LF in" I'm using Ubuntu 13.10 x64, and I am working on a project that some developers are using Windows , I recently changed the git config `core.eol` to "lf" and `core.autocrlf` to "input" and `core.safecrlf` to "true". Since then, when I try to commit fi...
This is a classic issue: ![http://toub.es/sites/toub.es/files/styles/standard_article/public/field/image/firstcommit.png](https://i.sstatic.net/7SWV6.png) (picture from [Luis Tubes](http://toub.es/about)'s [blog post](http://toub.es/2012/05/28/fatal-crlf-would-be-replaced-lf)) The usual fix is to convert those file...
48301280
How can I manually run a Git pre-commit hook, without attempting a commit?
224
2018-01-17 12:33:56
<p>I just want to be able to run it to see if the code in my working tree passes it, without actually attempting a commit.</p>
231,395
414,825
2025-03-31 02:58:01
48,301,424
240
2018-01-17 12:41:20
9,079,863
2021-11-24 21:28:34
https://stackoverflow.com/q/48301280
https://stackoverflow.com/a/48301424
<p>Just run the <code>pre-commit</code> script through the shell:</p> <pre><code>bash .git/hooks/pre-commit </code></pre>
<p>Just run the <code>pre-commit</code> script through the shell:</p> <pre><code>bash .git/hooks/pre-commit </code></pre>
43087
githooks
<h1>How can I manually run a Git pre-commit hook, without attempting a commit?</h1> <p>I just want to be able to run it to see if the code in my working tree passes it, without actually attempting a commit.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,917
git
# How can I manually run a Git pre-commit hook, without attempting a commit? I just want to be able to run it to see if the code in my working tree passes it, without actually attempting a commit.
Just run the `pre-commit` script through the shell: ``` bash .git/hooks/pre-commit ```
16853624
GIT_DISCOVERY_ACROSS_FILESYSTEM not set
165
2013-05-31 09:03:48
<p>I have searched and read few post but my problem is not the same as described. So here's the issue: using <code>git clone</code> into folder under external partition of the disk works fine but all Git commands fail. can't execute <code>git status</code> or <code>git log</code>... I always get error</p> <pre><code>fa...
449,218
2,439,755
2025-12-26 22:20:23
17,975,161
239
2013-07-31 15:55:48
2,280,854
2024-10-03 08:42:34
https://stackoverflow.com/q/16853624
https://stackoverflow.com/a/17975161
<p>Just type <code>git init</code> into your command line and press enter. Then run your command again, you probably were running <code>git remote add origin [your-repository]</code>.</p>
<p>Just type <code>git init</code> into your command line and press enter. Then run your command again, you probably were running <code>git remote add origin [your-repository]</code>.</p>
119
git
<h1>GIT_DISCOVERY_ACROSS_FILESYSTEM not set</h1> <p>I have searched and read few post but my problem is not the same as described. So here's the issue: using <code>git clone</code> into folder under external partition of the disk works fine but all Git commands fail. can't execute <code>git status</code> or <code>git l...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,918
git
# GIT_DISCOVERY_ACROSS_FILESYSTEM not set I have searched and read few post but my problem is not the same as described. So here's the issue: using `git clone` into folder under external partition of the disk works fine but all Git commands fail. can't execute `git status` or `git log`... I always get error ``` fatal...
Just type `git init` into your command line and press enter. Then run your command again, you probably were running `git remote add origin [your-repository]`.
5143795
How can I check in a Bash script if my local Git repository has changes?
303
2011-02-28 15:15:13
<p>There are some scripts that do not work correctly if they check for changes.</p> <p>I tried it like this:</p> <pre><code>VN=$(git describe --abbrev=7 HEAD 2&gt;/dev/null) git update-index -q --refresh CHANGED=$(git diff-index --name-only HEAD --) if [ ! -z $CHANGED ]; then VN="$VN-mod" fi </code></pre> <p>Is...
173,228
455,578
2024-03-18 09:54:19
5,143,914
238
2011-02-28 15:27:11
119,963
2017-12-31 13:56:19
https://stackoverflow.com/q/5143795
https://stackoverflow.com/a/5143914
<p>What you're doing will almost work: you should quote <code>$CHANGED</code> in case it's empty, and <code>-z</code> tests for empty, which means no changes. What you meant was:</p> <pre><code>if [ -n "$CHANGED" ]; then VN="$VN-mod" fi </code></pre> <p>A quote from Git's <code>GIT-VERSION-GEN</code>:</p> <pre><...
<p>What you're doing will almost work: you should quote <code>$CHANGED</code> in case it's empty, and <code>-z</code> tests for empty, which means no changes. What you meant was:</p> <pre><code>if [ -n "$CHANGED" ]; then VN="$VN-mod" fi </code></pre> <p>A quote from Git's <code>GIT-VERSION-GEN</code>:</p> <pre><...
119
git
<h1>How can I check in a Bash script if my local Git repository has changes?</h1> <p>There are some scripts that do not work correctly if they check for changes.</p> <p>I tried it like this:</p> <pre><code>VN=$(git describe --abbrev=7 HEAD 2&gt;/dev/null) git update-index -q --refresh CHANGED=$(git diff-index --name...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,919
git
# How can I check in a Bash script if my local Git repository has changes? There are some scripts that do not work correctly if they check for changes. I tried it like this: ``` VN=$(git describe --abbrev=7 HEAD 2>/dev/null) git update-index -q --refresh CHANGED=$(git diff-index --name-only HEAD --) if [ ! -z $CHAN...
What you're doing will almost work: you should quote `$CHANGED` in case it's empty, and `-z` tests for empty, which means no changes. What you meant was: ``` if [ -n "$CHANGED" ]; then VN="$VN-mod" fi ``` A quote from Git's `GIT-VERSION-GEN`: ``` git update-index -q --refresh test -z "$(git diff-index --name-onl...
4847101
Git: which is the default configured remote for branch?
220
2011-01-31 02:19:49
<p>I have a remote bare repository <code>hub</code>. I work only in the <code>master</code> branch. The last sentence of this error message below makes me wonder: How do I find out which is the <em>"default configured remote for your current branch"</em>? And how do I set it?</p> <pre><code>[myserver]~/progs $ git rem...
126,137
277,304
2024-09-04 17:01:22
4,847,136
238
2011-01-31 02:28:23
576,506
2013-03-05 22:58:46
https://stackoverflow.com/q/4847101
https://stackoverflow.com/a/4847136
<p>Track the remote branch</p> <p>You can specify the default remote repository for pushing and pulling using git-branch’s track option. You’d normally do this by specifying the --track option when creating your local master branch, but as it already exists we’ll just update the config manually like so:</p> <p>Edit y...
<p>Track the remote branch</p> <p>You can specify the default remote repository for pushing and pulling using git-branch’s track option. You’d normally do this by specifying the --track option when creating your local master branch, but as it already exists we’ll just update the config manually like so:</p> <p>Edit y...
119, 28898, 31678
git, git-push, remote-branch
<h1>Git: which is the default configured remote for branch?</h1> <p>I have a remote bare repository <code>hub</code>. I work only in the <code>master</code> branch. The last sentence of this error message below makes me wonder: How do I find out which is the <em>"default configured remote for your current branch"</em>?...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,920
git
# Git: which is the default configured remote for branch? I have a remote bare repository `hub`. I work only in the `master` branch. The last sentence of this error message below makes me wonder: How do I find out which is the *"default configured remote for your current branch"*? And how do I set it? ``` [myserver]~...
Track the remote branch You can specify the default remote repository for pushing and pulling using git-branch’s track option. You’d normally do this by specifying the --track option when creating your local master branch, but as it already exists we’ll just update the config manually like so: Edit your `.git/config`...
23212452
How to only push a specific tag to remote?
134
2014-04-22 06:51:03
<p>Is there a command like <code>git push --tag tag_a</code>? I only found <code>git push --tags</code>.</p>
87,241
1,089,063
2020-08-28 12:15:44
23,212,493
238
2014-04-22 06:52:41
2,876,370
2014-04-22 10:14:03
https://stackoverflow.com/q/23212452
https://stackoverflow.com/a/23212493
<p>You can simply use:</p> <pre><code>git push origin tag_a </code></pre> <p>Alternatively (mainly to solve tag/branch name clashes), you could use:</p> <pre><code>git push origin refs/tags/tag_a </code></pre>
<p>You can simply use:</p> <pre><code>git push origin tag_a </code></pre> <p>Alternatively (mainly to solve tag/branch name clashes), you could use:</p> <pre><code>git push origin refs/tags/tag_a </code></pre>
119
git
<h1>How to only push a specific tag to remote?</h1> <p>Is there a command like <code>git push --tag tag_a</code>? I only found <code>git push --tags</code>.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,921
git
# How to only push a specific tag to remote? Is there a command like `git push --tag tag_a`? I only found `git push --tags`.
You can simply use: ``` git push origin tag_a ``` Alternatively (mainly to solve tag/branch name clashes), you could use: ``` git push origin refs/tags/tag_a ```
6930147
git pull displays "fatal: Couldn't find remote ref refs/heads/xxxx" and hangs up
128
2011-08-03 16:52:29
<p>I created a branch called <code>6796</code>, then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with <code>master</code>, and deleted it locally and remotely on the other machine (<code>git push :6796</code>). Now, when I run <code>git pull</code>:</p> <pre><co...
311,038
584,552
2023-01-19 09:56:29
6,930,399
238
2011-08-03 17:13:16
389,146
2011-08-03 17:13:16
https://stackoverflow.com/q/6930147
https://stackoverflow.com/a/6930399
<p>There are probably some commands to resolve it, but I would start by looking in your <code>.git/config</code> file for references to that branch, and removing them.</p>
<p>There are probably some commands to resolve it, but I would start by looking in your <code>.git/config</code> file for references to that branch, and removing them.</p>
119
git
<h1>git pull displays "fatal: Couldn't find remote ref refs/heads/xxxx" and hangs up</h1> <p>I created a branch called <code>6796</code>, then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with <code>master</code>, and deleted it locally and remotely on the other ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,922
git
# git pull displays "fatal: Couldn't find remote ref refs/heads/xxxx" and hangs up I created a branch called `6796`, then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with `master`, and deleted it locally and remotely on the other machine (`git push :6796`). Now...
There are probably some commands to resolve it, but I would start by looking in your `.git/config` file for references to that branch, and removing them.
18276951
How do I stop Git from tracking any changes to a file from this commit forward?
115
2013-08-16 15:28:25
<p>I have a database configuration file that has default values that are unimportant. However, any changes to this file would contain sensitive information that should not be tracked in the repo. </p> <p>I would like future pulls of the Git repository to include the default version but disregard any changes made by an...
42,359
328,504
2017-12-31 17:37:33
18,277,622
238
2013-08-16 16:04:48
759,682
2014-09-17 02:27:42
https://stackoverflow.com/q/18276951
https://stackoverflow.com/a/18277622
<p>As usual github has a great doc on this.</p> <p><a href="https://help.github.com/articles/ignoring-files#ignoring-versioned-files" rel="noreferrer">https://help.github.com/articles/ignoring-files#ignoring-versioned-files</a></p> <p>Here's the relevant snippet:</p> <blockquote> <h3>Ignoring versioned files</h3> <p>So...
<p>As usual github has a great doc on this.</p> <p><a href="https://help.github.com/articles/ignoring-files#ignoring-versioned-files" rel="noreferrer">https://help.github.com/articles/ignoring-files#ignoring-versioned-files</a></p> <p>Here's the relevant snippet:</p> <blockquote> <h3>Ignoring versioned files</h3> <p>So...
119
git
<h1>How do I stop Git from tracking any changes to a file from this commit forward?</h1> <p>I have a database configuration file that has default values that are unimportant. However, any changes to this file would contain sensitive information that should not be tracked in the repo. </p> <p>I would like future pulls ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,925
git
# How do I stop Git from tracking any changes to a file from this commit forward? I have a database configuration file that has default values that are unimportant. However, any changes to this file would contain sensitive information that should not be tracked in the repo. I would like future pulls of the Git reposi...
As usual github has a great doc on this. <https://help.github.com/articles/ignoring-files#ignoring-versioned-files> Here's the relevant snippet: > ### Ignoring versioned files > > Some files in a repository change often but are rarely committed. Usually, these are various local configuration files that are edited, b...
634546
Git merge reports "Already up-to-date" though there is a difference
442
2009-03-11 13:36:54
<p>I have a git repository with 2 branches: master and test.</p> <p>There are differences between master and test branches.</p> <p>Both branches have all changes committed.</p> <p>If I do:</p> <pre> git checkout master<br> git diff test </pre> <p>A screen full of changes appears showing the differences. I want to ...
455,543
68,657
2023-10-18 15:18:33
634,575
237
2009-03-11 13:45:52
43,582
2019-10-13 02:11:50
https://stackoverflow.com/q/634546
https://stackoverflow.com/a/634575
<p>The message “Already up-to-date” means that all the changes from the branch you’re trying to merge have already been merged to the branch you’re currently on. More specifically it means that the branch you’re trying to merge <em>is a parent of your current branch</em>. Congratulations, that’s the easiest merge you’l...
<p>The message “Already up-to-date” means that all the changes from the branch you’re trying to merge have already been merged to the branch you’re currently on. More specifically it means that the branch you’re trying to merge <em>is a parent of your current branch</em>. Congratulations, that’s the easiest merge you’l...
119, 717
git, merge
<h1>Git merge reports "Already up-to-date" though there is a difference</h1> <p>I have a git repository with 2 branches: master and test.</p> <p>There are differences between master and test branches.</p> <p>Both branches have all changes committed.</p> <p>If I do:</p> <pre> git checkout master<br> git diff test </...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,926
git
# Git merge reports "Already up-to-date" though there is a difference I have a git repository with 2 branches: master and test. There are differences between master and test branches. Both branches have all changes committed. If I do: ``` git checkout master git diff test ``` A screen full of changes appears s...
The message “Already up-to-date” means that all the changes from the branch you’re trying to merge have already been merged to the branch you’re currently on. More specifically it means that the branch you’re trying to merge *is a parent of your current branch*. Congratulations, that’s the easiest merge you’ll ever do....
2144406
How to make shallow git submodules?
223
2010-01-27 03:34:26
<p>Is it possible to have shallow submodules? I have a superproject with several submodules, each with a long history, so it gets unnecessarily big dragging all that history.</p> <p>All I have found is <a href="http://kerneltrap.org/mailarchive/git/2009/1/19/4766964/thread" rel="noreferrer">this unanswered thread</a>....
127,256
21,239
2022-12-10 22:05:20
17,692,710
237
2013-07-17 06:32:59
6,309
2022-12-10 22:05:20
https://stackoverflow.com/q/2144406
https://stackoverflow.com/a/17692710
<p>TLDR;</p> <pre><code>git clone --recurse-submodules --shallow-submodules </code></pre> <p>(But see caveat with <a href="https://stackoverflow.com/users/895245/ciro-santilli-ourbigbook-com">Ciro Santilli</a> <a href="https://stackoverflow.com/a/47374702/6309">answer</a>)<br /> Or: record that a submodule should be sh...
<p>TLDR;</p> <pre><code>git clone --recurse-submodules --shallow-submodules </code></pre> <p>(But see caveat with <a href="https://stackoverflow.com/users/895245/ciro-santilli-ourbigbook-com">Ciro Santilli</a> <a href="https://stackoverflow.com/a/47374702/6309">answer</a>)<br /> Or: record that a submodule should be sh...
119, 41612
git, git-submodules
<h1>How to make shallow git submodules?</h1> <p>Is it possible to have shallow submodules? I have a superproject with several submodules, each with a long history, so it gets unnecessarily big dragging all that history.</p> <p>All I have found is <a href="http://kerneltrap.org/mailarchive/git/2009/1/19/4766964/thread"...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,927
git
# How to make shallow git submodules? Is it possible to have shallow submodules? I have a superproject with several submodules, each with a long history, so it gets unnecessarily big dragging all that history. All I have found is [this unanswered thread](http://kerneltrap.org/mailarchive/git/2009/1/19/4766964/thread)...
TLDR; ``` git clone --recurse-submodules --shallow-submodules ``` (But see caveat with [Ciro Santilli](https://stackoverflow.com/users/895245/ciro-santilli-ourbigbook-com) [answer](https://stackoverflow.com/a/47374702/6309)) Or: record that a submodule should be shallow cloned: ``` git config -f .gitmodules submod...
17371955
Verifying signed git commits?
202
2013-06-28 19:09:08
<p>With newer versions of <code>git</code> it's possible to sign individual commits (in addition to tags) with a PGP key:</p> <pre class="lang-bash prettyprint-override"><code>git commit -m &quot;some message&quot; -S </code></pre> <p>And you can show these signatures in the output of <code>git log</code> with the <cod...
135,454
147,356
2024-05-19 15:27:07
30,236,531
237
2015-05-14 11:44:15
2,425,163
2024-04-26 21:58:51
https://stackoverflow.com/q/17371955
https://stackoverflow.com/a/30236531
<p>Just in case someone comes to this page through a search engine, like I did: New tools have been made available in the two years since the question was posted.</p> <p>There are now git commands for this task: <code>git verify-commit</code> and <code>git verify-tag</code> can be used to verify commits and tags, respe...
<p>Just in case someone comes to this page through a search engine, like I did: New tools have been made available in the two years since the question was posted.</p> <p>There are now git commands for this task: <code>git verify-commit</code> and <code>git verify-tag</code> can be used to verify commits and tags, respe...
119
git
<h1>Verifying signed git commits?</h1> <p>With newer versions of <code>git</code> it's possible to sign individual commits (in addition to tags) with a PGP key:</p> <pre class="lang-bash prettyprint-override"><code>git commit -m &quot;some message&quot; -S </code></pre> <p>And you can show these signatures in the outpu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,928
git
# Verifying signed git commits? With newer versions of `git` it's possible to sign individual commits (in addition to tags) with a PGP key: ``` git commit -m "some message" -S ``` And you can show these signatures in the output of `git log` with the `--show-signature` option: ``` $ git log --show-signature commit 9...
Just in case someone comes to this page through a search engine, like I did: New tools have been made available in the two years since the question was posted. There are now git commands for this task: `git verify-commit` and `git verify-tag` can be used to verify commits and tags, respectively.
35916658
How to git ignore ipython notebook checkpoints anywhere in repository
187
2016-03-10 12:35:02
<p>This is mostly a git question. I want to commit my ipython notebooks but gitignore the checkpoints. </p> <p>The repo has multiple folders which each have ipython notebooks, therefore just ignoring a single directory does not solve it. I want to keep adding new folders with notebooks inside without worrying about it...
148,152
2,468,113
2020-11-03 12:17:38
35,936,602
237
2016-03-11 09:36:27
938,949
2016-03-11 09:36:27
https://stackoverflow.com/q/35916658
https://stackoverflow.com/a/35936602
<p>If you add to .gitignore:</p> <pre><code>.ipynb_checkpoints </code></pre> <p>(no slashes anywhere), any file or directory in the repo with that name will be ignored. Paths are only checked if you include <code>/</code>.</p> <p>From <a href="https://stackoverflow.com/a/7335487/938949">this answer</a> you can also ...
<p>If you add to .gitignore:</p> <pre><code>.ipynb_checkpoints </code></pre> <p>(no slashes anywhere), any file or directory in the repo with that name will be ignored. Paths are only checked if you include <code>/</code>.</p> <p>From <a href="https://stackoverflow.com/a/7335487/938949">this answer</a> you can also ...
119, 5597, 25056, 116342
commit, git, gitignore, jupyter-notebook
<h1>How to git ignore ipython notebook checkpoints anywhere in repository</h1> <p>This is mostly a git question. I want to commit my ipython notebooks but gitignore the checkpoints. </p> <p>The repo has multiple folders which each have ipython notebooks, therefore just ignoring a single directory does not solve it. I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,929
git
# How to git ignore ipython notebook checkpoints anywhere in repository This is mostly a git question. I want to commit my ipython notebooks but gitignore the checkpoints. The repo has multiple folders which each have ipython notebooks, therefore just ignoring a single directory does not solve it. I want to keep addi...
If you add to .gitignore: ``` .ipynb_checkpoints ``` (no slashes anywhere), any file or directory in the repo with that name will be ignored. Paths are only checked if you include `/`. From [this answer](https://stackoverflow.com/a/7335487/938949) you can also have a global gitignore for your computer: ``` git conf...
16858069
Git: How to reuse/retain commit messages after 'git reset'?
174
2013-05-31 13:09:16
<p>As Git user I regular come across the situation, that I need to rework one or more commits in a way which do not fit into <code>--amend</code> or <code>rebase -i</code>with fixup commits. Typically I would do something like</p> <pre><code>git reset HEAD~1 # hack, fix, hack git commit -a # argh .. do I need to retyp...
39,458
1,237,653
2025-03-30 00:52:49
25,930,432
237
2014-09-19 09:15:23
1,013,628
2024-04-19 12:13:54
https://stackoverflow.com/q/16858069
https://stackoverflow.com/a/25930432
<p>After a <code>git reset</code>, this one-liner can do it:</p> <pre><code>git commit --reuse-message=HEAD@{1} </code></pre> <p>or even shorter:</p> <pre><code>git commit -C HEAD@{1} </code></pre> <p>Perhaps more clear:</p> <pre><code>git commit --reuse-message=ORIG_HEAD </code></pre> <p>You can use the other options ...
<p>After a <code>git reset</code>, this one-liner can do it:</p> <pre><code>git commit --reuse-message=HEAD@{1} </code></pre> <p>or even shorter:</p> <pre><code>git commit -C HEAD@{1} </code></pre> <p>Perhaps more clear:</p> <pre><code>git commit --reuse-message=ORIG_HEAD </code></pre> <p>You can use the other options ...
119, 3809, 51381, 53850
commit-message, git, git-commit, git-reset
<h1>Git: How to reuse/retain commit messages after 'git reset'?</h1> <p>As Git user I regular come across the situation, that I need to rework one or more commits in a way which do not fit into <code>--amend</code> or <code>rebase -i</code>with fixup commits. Typically I would do something like</p> <pre><code>git rese...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,930
git
# Git: How to reuse/retain commit messages after 'git reset'? As Git user I regular come across the situation, that I need to rework one or more commits in a way which do not fit into `--amend` or `rebase -i`with fixup commits. Typically I would do something like ``` git reset HEAD~1 # hack, fix, hack git commit -a #...
After a `git reset`, this one-liner can do it: ``` git commit --reuse-message=HEAD@{1} ``` or even shorter: ``` git commit -C HEAD@{1} ``` Perhaps more clear: ``` git commit --reuse-message=ORIG_HEAD ``` You can use the other options given by [@user2718704](https://stackoverflow.com/a/18451418/1013628).
11887203
"You are on a branch yet to be born" when adding git submodule
137
2012-08-09 15:51:48
<p>I am attempting to add a few submodules to my <code>.vim/bundles</code> directory, and when I attempt to add this particular repo Git gives me a strange error I've never seen before:</p> <pre><code>$ git submodule add -f git://github.com/derekwyatt/vim-scala.git .vim/bundle/vim-scala fatal: You are on a branch yet ...
41,373
4,249
2015-08-21 21:33:08
12,072,517
236
2012-08-22 11:53:21
801,258
2012-08-22 11:53:21
https://stackoverflow.com/q/11887203
https://stackoverflow.com/a/12072517
<p>To fix that error, you should delete the folder with the same path to the submodule inside <code>.git/modules/</code> directory. This error can occurs when url was incorrect for submodule for the first-time when submodule was added.</p>
<p>To fix that error, you should delete the folder with the same path to the submodule inside <code>.git/modules/</code> directory. This error can occurs when url was incorrect for submodule for the first-time when submodule was added.</p>
119, 41612
git, git-submodules
<h1>"You are on a branch yet to be born" when adding git submodule</h1> <p>I am attempting to add a few submodules to my <code>.vim/bundles</code> directory, and when I attempt to add this particular repo Git gives me a strange error I've never seen before:</p> <pre><code>$ git submodule add -f git://github.com/derekw...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,931
git
# "You are on a branch yet to be born" when adding git submodule I am attempting to add a few submodules to my `.vim/bundles` directory, and when I attempt to add this particular repo Git gives me a strange error I've never seen before: ``` $ git submodule add -f git://github.com/derekwyatt/vim-scala.git .vim/bundle/...
To fix that error, you should delete the folder with the same path to the submodule inside `.git/modules/` directory. This error can occurs when url was incorrect for submodule for the first-time when submodule was added.
10879783
git doesn't ignore 2 specifically named files
105
2012-06-04 10:24:16
<p>I want to automatically exclude 2 files from committing, that are part of the git repository but have some changes, that shouldn't be part of the github repo, because they have some changes that are only meaningful to my local system and not the other developers.</p> <p>I added them to <code>.git/info/exclude</code...
30,514
131,120
2017-09-09 18:15:24
10,881,296
236
2012-06-04 12:30:20
520,162
2012-06-04 15:09:31
https://stackoverflow.com/q/10879783
https://stackoverflow.com/a/10881296
<p>What you want to is to ignore changes on tracked files. This cannot achieved (as <a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> <a href="https://stackoverflow.com/questions/10879783/git-doesnt-ignore-2-specifically-named-files/10881296#comment14178464_10879783">says</a>) correctly,...
<p>What you want to is to ignore changes on tracked files. This cannot achieved (as <a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> <a href="https://stackoverflow.com/questions/10879783/git-doesnt-ignore-2-specifically-named-files/10881296#comment14178464_10879783">says</a>) correctly,...
119, 25056
git, gitignore
<h1>git doesn't ignore 2 specifically named files</h1> <p>I want to automatically exclude 2 files from committing, that are part of the git repository but have some changes, that shouldn't be part of the github repo, because they have some changes that are only meaningful to my local system and not the other developers...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,932
git
# git doesn't ignore 2 specifically named files I want to automatically exclude 2 files from committing, that are part of the git repository but have some changes, that shouldn't be part of the github repo, because they have some changes that are only meaningful to my local system and not the other developers. I adde...
What you want to is to ignore changes on tracked files. This cannot achieved (as [Charles Bailey](https://stackoverflow.com/users/19563/charles-bailey) [says](https://stackoverflow.com/questions/10879783/git-doesnt-ignore-2-specifically-named-files/10881296#comment14178464_10879783)) correctly, neither with `.gitignore...
3639342
What's the difference between "git reset" and "git checkout"?
530
2010-09-03 20:21:43
<p>I've always thought of <code>git reset</code> and <code>git checkout</code> as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redundant. What is the actual difference between the two? I'm a bit confused, as the svn only h...
183,125
260,127
2024-06-12 18:12:05
3,639,387
235
2010-09-03 20:29:42
6,309
2021-07-08 13:19:50
https://stackoverflow.com/q/3639342
https://stackoverflow.com/a/3639387
<ul> <li><a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code></a> is specifically about <strong>updating the index</strong>, moving the HEAD.</li> <li><a href="http://git-scm.com/docs/git-checkout" rel="noreferrer"><code>git checkout</code></a> is about <strong>updating the working tree</...
<ul> <li><a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code></a> is specifically about <strong>updating the index</strong>, moving the HEAD.</li> <li><a href="http://git-scm.com/docs/git-checkout" rel="noreferrer"><code>git checkout</code></a> is about <strong>updating the working tree</...
119, 37230, 51381
git, git-checkout, git-reset
<h1>What's the difference between "git reset" and "git checkout"?</h1> <p>I've always thought of <code>git reset</code> and <code>git checkout</code> as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redundant. What is the a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,934
git
# What's the difference between "git reset" and "git checkout"? I've always thought of `git reset` and `git checkout` as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redundant. What is the actual difference between the tw...
- [`git reset`](http://git-scm.com/docs/git-reset) is specifically about **updating the index**, moving the HEAD. - [`git checkout`](http://git-scm.com/docs/git-checkout) is about **updating the working tree** (to the index or the specified tree). It will update the HEAD only if you checkout a branch (if not, you end u...
1204190
Does "git fetch --tags" include "git fetch"?
323
2009-07-30 02:47:31
<p>A nice and simple question - is the function of "git fetch" a strict sub-set of <code>git fetch --tags</code>?</p> <p>I.e. if I run <code>git fetch --tags</code>, is there ever a reason to immediately run <code>git fetch</code> straight afterward?</p> <p>What about <code>git pull</code> and <code>git pull --tags</...
317,101
143,397
2021-10-05 12:04:03
20,608,181
235
2013-12-16 10:10:00
6,309
2021-10-05 12:04:03
https://stackoverflow.com/q/1204190
https://stackoverflow.com/a/20608181
<p>Note: starting with <a href="https://github.com/git/git/blob/d7aced95cd681b761468635f8d2a8b82d7ed26fd/Documentation/RelNotes/1.9.txt#L18-L20" rel="noreferrer">git 1.9/2.0 (Q1 2014)</a>, <code>git fetch --tags</code> fetches tags <em>in addition to</em> what are fetched by the same command line without the option.</p...
<p>Note: starting with <a href="https://github.com/git/git/blob/d7aced95cd681b761468635f8d2a8b82d7ed26fd/Documentation/RelNotes/1.9.txt#L18-L20" rel="noreferrer">git 1.9/2.0 (Q1 2014)</a>, <code>git fetch --tags</code> fetches tags <em>in addition to</em> what are fetched by the same command line without the option.</p...
119, 4860, 33720, 60718
git, git-fetch, git-tag, pull
<h1>Does "git fetch --tags" include "git fetch"?</h1> <p>A nice and simple question - is the function of "git fetch" a strict sub-set of <code>git fetch --tags</code>?</p> <p>I.e. if I run <code>git fetch --tags</code>, is there ever a reason to immediately run <code>git fetch</code> straight afterward?</p> <p>What a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,935
git
# Does "git fetch --tags" include "git fetch"? A nice and simple question - is the function of "git fetch" a strict sub-set of `git fetch --tags`? I.e. if I run `git fetch --tags`, is there ever a reason to immediately run `git fetch` straight afterward? What about `git pull` and `git pull --tags`? Same situation?
Note: starting with [git 1.9/2.0 (Q1 2014)](https://github.com/git/git/blob/d7aced95cd681b761468635f8d2a8b82d7ed26fd/Documentation/RelNotes/1.9.txt#L18-L20), `git fetch --tags` fetches tags *in addition to* what are fetched by the same command line without the option. To fetch only tags: ``` git fetch <remote> 'refs/...
5074136
Git rebase fails, 'Your local changes to the following files would be overwritten by merge'. No local changes?
134
2011-02-22 04:52:10
<p>Here is my transcript from trying to merge my bugfix branch onto my master branch in preparation to push it upstream. There have been some upstream changes pulled into master since the bugfix branch was created, and it now refuses to rebase.</p> <p>The files it throws errors on are not diffed when opened. no files ...
28,227
200,768
2024-12-23 19:52:46
5,255,710
235
2011-03-10 05:07:52
200,768
2015-04-07 07:14:35
https://stackoverflow.com/q/5074136
https://stackoverflow.com/a/5255710
<p>This is the same answer as another one of my questions re git troubles.</p> <p>I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none.</p> <pre><code>git config --global core.trustctime false </code></pre> <p>I think it's to do with differences betwe...
<p>This is the same answer as another one of my questions re git troubles.</p> <p>I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none.</p> <pre><code>git config --global core.trustctime false </code></pre> <p>I think it's to do with differences betwe...
119, 29934
git, git-rebase
<h1>Git rebase fails, 'Your local changes to the following files would be overwritten by merge'. No local changes?</h1> <p>Here is my transcript from trying to merge my bugfix branch onto my master branch in preparation to push it upstream. There have been some upstream changes pulled into master since the bugfix branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,937
git
# Git rebase fails, 'Your local changes to the following files would be overwritten by merge'. No local changes? Here is my transcript from trying to merge my bugfix branch onto my master branch in preparation to push it upstream. There have been some upstream changes pulled into master since the bugfix branch was cre...
This is the same answer as another one of my questions re git troubles. I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none. ``` git config --global core.trustctime false ``` I think it's to do with differences between windows file times, linux file ...
12912985
git visual diff between branches
221
2012-10-16 10:45:53
<p>This answer is great for seeing a visual diff between two files that are checked into git: <a href="https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-a-visual-diff-program/949242#949242">How do I view &#39;git diff&#39; output with a visual diff program?</a> </p> <p>However, I'd like to ...
277,966
343,204
2022-01-26 11:31:42
12,913,063
234
2012-10-16 10:50:30
31,671
2017-05-26 10:33:57
https://stackoverflow.com/q/12912985
https://stackoverflow.com/a/12913063
<p>Use <a href="https://www.kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer"><code>git diff</code></a> with a <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_commit_ranges" rel="noreferrer">range</a>.</p> <pre><code>git diff branch1..branch2 </code></pre> <p>This will compare...
<p>Use <a href="https://www.kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer"><code>git diff</code></a> with a <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_commit_ranges" rel="noreferrer">range</a>.</p> <pre><code>git diff branch1..branch2 </code></pre> <p>This will compare...
119, 606
diff, git
<h1>git visual diff between branches</h1> <p>This answer is great for seeing a visual diff between two files that are checked into git: <a href="https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-a-visual-diff-program/949242#949242">How do I view &#39;git diff&#39; output with a visual diff p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,938
git
# git visual diff between branches This answer is great for seeing a visual diff between two files that are checked into git: [How do I view 'git diff' output with a visual diff program?](https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-a-visual-diff-program/949242#949242) However, I'd li...
Use [`git diff`](https://www.kernel.org/pub/software/scm/git/docs/git-diff.html) with a [range](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_commit_ranges). ``` git diff branch1..branch2 ``` This will compare the tips of each branch. If you really want some GUI software, you can try something like [S...
4185400
Is there any git hook for pull?
209
2010-11-15 14:41:50
<p>I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run <code>git pull</code>. Is there any suitable git hook, which I could use for this purpose please?</p>
118,401
175,900
2024-09-27 13:12:01
4,185,449
234
2010-11-15 14:46:00
119,963
2021-11-04 09:10:32
https://stackoverflow.com/q/4185400
https://stackoverflow.com/a/4185449
<p>The <a href="https://git-scm.com/docs/githooks" rel="noreferrer"><code>githooks</code></a> man page is a complete list of hooks. If it's not on there, it doesn't exist.</p> <p>That said, there <em>is</em> a <a href="https://git-scm.com/docs/githooks#_post_merge" rel="noreferrer">post-merge hook</a>, and all pulls in...
<p>The <a href="https://git-scm.com/docs/githooks" rel="noreferrer"><code>githooks</code></a> man page is a complete list of hooks. If it's not on there, it doesn't exist.</p> <p>That said, there <em>is</em> a <a href="https://git-scm.com/docs/githooks#_post_merge" rel="noreferrer">post-merge hook</a>, and all pulls in...
119, 853, 10025
gettext, git, hook
<h1>Is there any git hook for pull?</h1> <p>I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run <code>git pull</code>. Is there any suitable git hook, which I could use for this purpose please?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,939
git
# Is there any git hook for pull? I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run `git pull`. Is there any suitable git hook, which I could use for this purpose please?
The [`githooks`](https://git-scm.com/docs/githooks) man page is a complete list of hooks. If it's not on there, it doesn't exist. That said, there *is* a [post-merge hook](https://git-scm.com/docs/githooks#_post_merge), and all pulls include a merge, though not all merges are pulls. It's run after merges, and can't af...
63943401
husky > pre-commit hook failed (add --no-verify to bypass)
109
2020-09-17 17:35:13
<p>Suddenly I am getting the &quot;<strong>husky &gt; pre-commit hook failed (add --no-verify to bypass)</strong>&quot; error message when I give the <code>git commit</code>.</p> <pre><code>(C:\Windows\System32\cmd.exe) &gt; git commit husky &gt; npm run -s precommit (node v12.18.3) 'pretty-quick' is not recognized as...
276,075
1,862,590
2025-09-24 15:09:07
63,948,896
234
2020-09-18 03:25:09
1,862,590
2024-03-13 00:37:36
https://stackoverflow.com/q/63943401
https://stackoverflow.com/a/63948896
<p>Husky can prevent you from bad <code>git commit</code>, <code>git push</code>, and more. If you are getting this error check your <em><strong>code syntax</strong></em>. In case you are getting this error even if your code is valid, please use the below solution.</p> <h1>#Solution 1:</h1> <p>Delete the <code>.git/hoo...
<p>Husky can prevent you from bad <code>git commit</code>, <code>git push</code>, and more. If you are getting this error check your <em><strong>code syntax</strong></em>. In case you are getting this error even if your code is valid, please use the below solution.</p> <h1>#Solution 1:</h1> <p>Delete the <code>.git/hoo...
119, 25281, 124263, 125866, 130301
angular, git, git-husky, husky, pre-commit-hook
<h1>husky > pre-commit hook failed (add --no-verify to bypass)</h1> <p>Suddenly I am getting the &quot;<strong>husky &gt; pre-commit hook failed (add --no-verify to bypass)</strong>&quot; error message when I give the <code>git commit</code>.</p> <pre><code>(C:\Windows\System32\cmd.exe) &gt; git commit husky &gt; npm r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,940
git
# husky > pre-commit hook failed (add --no-verify to bypass) Suddenly I am getting the "**husky > pre-commit hook failed (add --no-verify to bypass)**" error message when I give the `git commit`. ``` (C:\Windows\System32\cmd.exe) > git commit husky > npm run -s precommit (node v12.18.3) 'pretty-quick' is not recogni...
Husky can prevent you from bad `git commit`, `git push`, and more. If you are getting this error check your ***code syntax***. In case you are getting this error even if your code is valid, please use the below solution. # #Solution 1: Delete the `.git/hooks` folder and then do the `npm install` to reinstall husky. T...
9113280
diff current working copy of a file with another branch's committed copy
249
2012-02-02 13:36:30
<p>I have a repo with file <code>foo</code> in the master branch. I switched to bar branch and made some changes to <code>foo</code>. How can I now run a <code>git diff</code> between this copy (which isn't committed yet) and the copy of the master branch?</p>
200,472
320,615
2021-07-27 19:47:58
9,113,407
233
2012-02-02 13:46:17
223,092
2016-09-02 00:37:36
https://stackoverflow.com/q/9113280
https://stackoverflow.com/a/9113407
<p>The following works for me:</p> <p><code>git diff master:foo foo</code></p> <p>In the past, it may have been:</p> <p><code>git diff foo master:foo</code></p>
<p>The following works for me:</p> <p><code>git diff master:foo foo</code></p> <p>In the past, it may have been:</p> <p><code>git diff foo master:foo</code></p>
119
git
<h1>diff current working copy of a file with another branch's committed copy</h1> <p>I have a repo with file <code>foo</code> in the master branch. I switched to bar branch and made some changes to <code>foo</code>. How can I now run a <code>git diff</code> between this copy (which isn't committed yet) and the copy of ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,942
git
# diff current working copy of a file with another branch's committed copy I have a repo with file `foo` in the master branch. I switched to bar branch and made some changes to `foo`. How can I now run a `git diff` between this copy (which isn't committed yet) and the copy of the master branch?
The following works for me: `git diff master:foo foo` In the past, it may have been: `git diff foo master:foo`
28792784
Why does Git use a cryptographic hash function?
167
2015-03-01 11:01:34
<p>Why does Git use <a href="http://en.wikipedia.org/wiki/SHA-1" rel="noreferrer">SHA-1</a>, a cryptographic hash function, instead of a faster non-cryptographic hash function?</p> <p><strong>Related question:</strong></p> <p>Stack&nbsp;Overflow question <em><a href="https://stackoverflow.com/questions/11233591">Why ...
41,047
1,128,289
2018-09-14 14:21:44
28,792,805
233
2015-03-01 11:04:36
6,309
2018-09-14 14:21:44
https://stackoverflow.com/q/28792784
https://stackoverflow.com/a/28792805
<p>TLDR; </p> <ul> <li>from 2005 up to 2018/Git 2.18: <a href="https://en.wikipedia.org/wiki/SHA-1" rel="noreferrer">SHA-1</a> (see below) </li> <li><a href="https://stackoverflow.com/a/47838703/6309">2019, will switch at some point</a> to <a href="https://en.wikipedia.org/wiki/SHA-2" rel="noreferrer">SHA-256</a></li...
<p>TLDR; </p> <ul> <li>from 2005 up to 2018/Git 2.18: <a href="https://en.wikipedia.org/wiki/SHA-1" rel="noreferrer">SHA-1</a> (see below) </li> <li><a href="https://stackoverflow.com/a/47838703/6309">2019, will switch at some point</a> to <a href="https://en.wikipedia.org/wiki/SHA-2" rel="noreferrer">SHA-256</a></li...
119, 5059
git, hash-function
<h1>Why does Git use a cryptographic hash function?</h1> <p>Why does Git use <a href="http://en.wikipedia.org/wiki/SHA-1" rel="noreferrer">SHA-1</a>, a cryptographic hash function, instead of a faster non-cryptographic hash function?</p> <p><strong>Related question:</strong></p> <p>Stack&nbsp;Overflow question <em><a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,943
git
# Why does Git use a cryptographic hash function? Why does Git use [SHA-1](http://en.wikipedia.org/wiki/SHA-1), a cryptographic hash function, instead of a faster non-cryptographic hash function? **Related question:** Stack Overflow question *[Why does Git use SHA-1 as version numbers?](https://stackoverflow.com/que...
TLDR; - from 2005 up to 2018/Git 2.18: [SHA-1](https://en.wikipedia.org/wiki/SHA-1) (see below) - [2019, will switch at some point](https://stackoverflow.com/a/47838703/6309) to [SHA-256](https://en.wikipedia.org/wiki/SHA-2) --- You can check that from [Linus Torvalds himself, when he presented Git to Google back in...
23918062
"simple" vs "current" push.default in git for decentralized workflow
154
2014-05-28 17:20:54
<p>Functionally speaking, in a decentralized workflow, I don't see the difference between <code>simple</code> and <code>current</code> options for <code>push.default</code> config setting.</p> <p><code>current</code> will push the current branch to an identically named branch on the specified remote. <code>simple</cod...
62,735
157,971
2021-01-21 15:04:58
23,918,418
233
2014-05-28 17:42:11
null
2021-01-21 15:04:58
https://stackoverflow.com/q/23918062
https://stackoverflow.com/a/23918418
<p>The difference is that with <code>simple</code>, <code>git push</code> (without passing a refspec) will fail if the current branch isn't tracking a remote upstream branch (even if a branch with the same name exists on the remote):</p> <pre><code>$ git checkout -b foo Switched to a new branch 'foo' $ git config push...
<p>The difference is that with <code>simple</code>, <code>git push</code> (without passing a refspec) will fail if the current branch isn't tracking a remote upstream branch (even if a branch with the same name exists on the remote):</p> <pre><code>$ git checkout -b foo Switched to a new branch 'foo' $ git config push...
119, 28898, 32868
git, git-config, git-push
<h1>"simple" vs "current" push.default in git for decentralized workflow</h1> <p>Functionally speaking, in a decentralized workflow, I don't see the difference between <code>simple</code> and <code>current</code> options for <code>push.default</code> config setting.</p> <p><code>current</code> will push the current br...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,944
git
# "simple" vs "current" push.default in git for decentralized workflow Functionally speaking, in a decentralized workflow, I don't see the difference between `simple` and `current` options for `push.default` config setting. `current` will push the current branch to an identically named branch on the specified remote....
The difference is that with `simple`, `git push` (without passing a refspec) will fail if the current branch isn't tracking a remote upstream branch (even if a branch with the same name exists on the remote): ``` $ git checkout -b foo Switched to a new branch 'foo' $ git config push.default simple $ git push fatal: T...
71849415
I cannot add the parent directory to *safe.directory* in Git
232
2022-04-12 21:38:34
<p>After updating Git to <code>v2.35.2.windows.1</code> I'm getting the following error:</p> <blockquote> <p>fatal: unsafe repository ('F:/GitHub/my-project' is owned by someone else) <br /> To add an exception for this directory, call: <br /> <br /> git config --global --add safe.directory F:/GitHub/my-project</p> </b...
321,916
5,613,377
2024-09-20 16:46:24
71,904,131
232
2022-04-17 17:49:13
353,714
2022-04-26 19:15:10
https://stackoverflow.com/q/71849415
https://stackoverflow.com/a/71904131
<p>Starting in Git v2.35.3, <a href="https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory" rel="noreferrer">safe directory</a> checks can be disabled, which will end all the &quot;unsafe repository&quot; errors (this will also work in <a href="https://marc.info/?l=git&amp;m=164989570902...
<p>Starting in Git v2.35.3, <a href="https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory" rel="noreferrer">safe directory</a> checks can be disabled, which will end all the &quot;unsafe repository&quot; errors (this will also work in <a href="https://marc.info/?l=git&amp;m=164989570902...
119, 155837
cve-2022-24765, git
<h1>I cannot add the parent directory to *safe.directory* in Git</h1> <p>After updating Git to <code>v2.35.2.windows.1</code> I'm getting the following error:</p> <blockquote> <p>fatal: unsafe repository ('F:/GitHub/my-project' is owned by someone else) <br /> To add an exception for this directory, call: <br /> <br />...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,945
git
# I cannot add the parent directory to *safe.directory* in Git After updating Git to `v2.35.2.windows.1` I'm getting the following error: > fatal: unsafe repository ('F:/GitHub/my-project' is owned by someone else) > To add an exception for this directory, call: > > git config --global --add safe.directory F...
Starting in Git v2.35.3, [safe directory](https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory) checks can be disabled, which will end all the "unsafe repository" errors (this will also work in [the latest patch versions of 2.30-34](https://marc.info/?l=git&m=164989570902912&w=2)). Thi...
6031214
Git - How to use .netrc file on Windows to save user and password
189
2011-05-17 13:08:40
<p>Is it possible to use a .netrc file on Windows when I'm using Git to clone a remote repository with HTTP and user - password?</p>
184,871
757,334
2025-12-23 15:41:40
6,031,266
232
2011-05-17 13:13:01
6,309
2025-12-23 15:41:40
https://stackoverflow.com/q/6031214
https://stackoverflow.com/a/6031266
<blockquote> <p>Is it possible to use a <code>.netrc</code> file on Windows?</p> </blockquote> <p>Yes: You must:</p> <ul> <li>define environment variable <code>%HOME%</code> (pre-Git 2.0, no longer needed with Git 2.0+)</li> <li>put a <code>_netrc</code> file in <code>%HOME%</code></li> </ul> <p>If you are using Window...
<blockquote> <p>Is it possible to use a <code>.netrc</code> file on Windows?</p> </blockquote> <p>Yes: You must:</p> <ul> <li>define environment variable <code>%HOME%</code> (pre-Git 2.0, no longer needed with Git 2.0+)</li> <li>put a <code>_netrc</code> file in <code>%HOME%</code></li> </ul> <p>If you are using Window...
64, 119, 183
authentication, git, windows
<h1>Git - How to use .netrc file on Windows to save user and password</h1> <p>Is it possible to use a .netrc file on Windows when I'm using Git to clone a remote repository with HTTP and user - password?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,946
git
# Git - How to use .netrc file on Windows to save user and password Is it possible to use a .netrc file on Windows when I'm using Git to clone a remote repository with HTTP and user - password?
> Is it possible to use a `.netrc` file on Windows? Yes: You must: - define environment variable `%HOME%` (pre-Git 2.0, no longer needed with Git 2.0+) - put a `_netrc` file in `%HOME%` If you are using Windows 7/10, in a `CMD` session, type: ``` setx HOME %USERPROFILE% ``` and the `%HOME%` will be set to '`C:\Use...
7529266
Git global ignore not working
122
2011-09-23 12:55:18
<p>I've created the file <code>.gitignore_global</code> and put it in my git install directory. When I run the command:</p> <pre><code>git config --global core.excludesfile ~/.gitignore </code></pre> <p>the rules in the ignore file do not get applied to my commits.</p> <p>When I rename the file <code>.gitignore</cod...
61,673
880,954
2023-11-15 00:43:46
7,529,343
231
2011-09-23 13:01:08
11,343
2023-08-08 07:58:56
https://stackoverflow.com/q/7529266
https://stackoverflow.com/a/7529343
<p>Maybe you <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreexcludesFile" rel="noreferrer">need to do</a>:</p> <pre><code>git config --global core.excludesFile ~/.gitignore_global </code></pre> <p>And to have some coffee.</p>
<p>Maybe you <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreexcludesFile" rel="noreferrer">need to do</a>:</p> <pre><code>git config --global core.excludesFile ~/.gitignore_global </code></pre> <p>And to have some coffee.</p>
119
git
<h1>Git global ignore not working</h1> <p>I've created the file <code>.gitignore_global</code> and put it in my git install directory. When I run the command:</p> <pre><code>git config --global core.excludesfile ~/.gitignore </code></pre> <p>the rules in the ignore file do not get applied to my commits.</p> <p>When ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,948
git
# Git global ignore not working I've created the file `.gitignore_global` and put it in my git install directory. When I run the command: ``` git config --global core.excludesfile ~/.gitignore ``` the rules in the ignore file do not get applied to my commits. When I rename the file `.gitignore` and put it in my pro...
Maybe you [need to do](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreexcludesFile): ``` git config --global core.excludesFile ~/.gitignore_global ``` And to have some coffee.
7882603
How to revert a Git Submodule pointer to the commit stored in the containing repository?
189
2011-10-24 22:13:15
<p>I have a git submodule in my main git repo. As I understand it, the main repo stores a SHA value (somewhere...), pointing to the specific commit of the submodule that it is "linked to". </p> <p>I went in to my submodule and typed <code>git checkout some_other_branch</code>. I have no idea which commit I came from.<...
121,004
14,902
2025-08-23 15:18:15
7,883,120
230
2011-10-24 23:28:07
2,063
2020-09-15 01:10:50
https://stackoverflow.com/q/7882603
https://stackoverflow.com/a/7883120
<p>You want to update your submodule so it is in sync with what the parent repository believes it should be. This is what the update command is for:</p> <p>From the submodule manpage:</p> <pre> Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the contain...
<p>You want to update your submodule so it is in sync with what the parent repository believes it should be. This is what the update command is for:</p> <p>From the submodule manpage:</p> <pre> Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the contain...
119, 41612
git, git-submodules
<h1>How to revert a Git Submodule pointer to the commit stored in the containing repository?</h1> <p>I have a git submodule in my main git repo. As I understand it, the main repo stores a SHA value (somewhere...), pointing to the specific commit of the submodule that it is "linked to". </p> <p>I went in to my submodul...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,950
git
# How to revert a Git Submodule pointer to the commit stored in the containing repository? I have a git submodule in my main git repo. As I understand it, the main repo stores a SHA value (somewhere...), pointing to the specific commit of the submodule that it is "linked to". I went in to my submodule and typed `git ...
You want to update your submodule so it is in sync with what the parent repository believes it should be. This is what the update command is for: From the submodule manpage: ``` Update the registered submodules, i.e. clone missing submodules and checkout the commit specified in the index of the containing repository....
8740187
Git: How to remove file from historical commit?
171
2012-01-05 09:29:47
<p>I have a commit with the ID <code>56f06019</code>, for example. In that commit I have accidentally committed large file (50 MB). In another commit I added the same file but in the right size (small). Now my repo is too heavy when I clone. How do I remove that large file from the repo history to reduce the size of my...
92,658
404,395
2022-08-25 06:26:23
8,741,530
230
2012-01-05 11:15:00
85,371
2014-02-05 04:39:32
https://stackoverflow.com/q/8740187
https://stackoverflow.com/a/8741530
<p>Chapter 9 of the <a href="http://git-scm.com/book" rel="noreferrer">Pro Git</a> book has a section on <a href="http://git-scm.com/book/en/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects" rel="noreferrer">Removing Objects</a>.</p> <p>Let me outline the steps briefly here:</p> <pre><code>git filter-bran...
<p>Chapter 9 of the <a href="http://git-scm.com/book" rel="noreferrer">Pro Git</a> book has a section on <a href="http://git-scm.com/book/en/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects" rel="noreferrer">Removing Objects</a>.</p> <p>Let me outline the steps briefly here:</p> <pre><code>git filter-bran...
119
git
<h1>Git: How to remove file from historical commit?</h1> <p>I have a commit with the ID <code>56f06019</code>, for example. In that commit I have accidentally committed large file (50 MB). In another commit I added the same file but in the right size (small). Now my repo is too heavy when I clone. How do I remove that ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,951
git
# Git: How to remove file from historical commit? I have a commit with the ID `56f06019`, for example. In that commit I have accidentally committed large file (50 MB). In another commit I added the same file but in the right size (small). Now my repo is too heavy when I clone. How do I remove that large file from the ...
Chapter 9 of the [Pro Git](http://git-scm.com/book) book has a section on [Removing Objects](http://git-scm.com/book/en/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects). Let me outline the steps briefly here: ``` git filter-branch --index-filter \ 'git rm --cached --ignore-unmatch path/to/mylarge_50m...
11961600
"fatal: Not a git repository (or any of the parent directories)" from git status
152
2012-08-14 22:14:22
<p>This command works to get the files and compile them:</p> <pre><code>git clone a-valid-git-url </code></pre> <p>for example:</p> <pre><code>git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts </code></pre> <p>However, <code>git status</code> (or any other git command) then gives the above <code>fata...
607,550
412,234
2023-10-27 14:20:39
11,961,642
230
2012-08-14 22:19:01
631,619
2012-08-14 22:19:01
https://stackoverflow.com/q/11961600
https://stackoverflow.com/a/11961642
<p>You have to actually cd into the directory first:</p> <pre><code>$ git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts Cloning into 'liggghts'... remote: Counting objects: 3005, done. remote: Compressing objects: 100% (2141/2141), done. remote: Total 3005 (delta 1052), reused 2714 (delta 827) Receiving...
<p>You have to actually cd into the directory first:</p> <pre><code>$ git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts Cloning into 'liggghts'... remote: Counting objects: 3005, done. remote: Compressing objects: 100% (2141/2141), done. remote: Total 3005 (delta 1052), reused 2714 (delta 827) Receiving...
119, 3050, 7330, 34099, 54839
clone, git, git-clone, git-status, repository
<h1>"fatal: Not a git repository (or any of the parent directories)" from git status</h1> <p>This command works to get the files and compile them:</p> <pre><code>git clone a-valid-git-url </code></pre> <p>for example:</p> <pre><code>git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts </code></pre> <p>H...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,952
git
# "fatal: Not a git repository (or any of the parent directories)" from git status This command works to get the files and compile them: ``` git clone a-valid-git-url ``` for example: ``` git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts ``` However, `git status` (or any other git command) then give...
You have to actually cd into the directory first: ``` $ git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts Cloning into 'liggghts'... remote: Counting objects: 3005, done. remote: Compressing objects: 100% (2141/2141), done. remote: Total 3005 (delta 1052), reused 2714 (delta 827) Receiving objects: 100%...
4104764
Show list of files changed in recent commits in a specific directory
125
2010-11-05 09:39:28
<p>In Subversion, <code>svn log</code> displays commit log messages <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.log.html" rel="noreferrer">(reference)</a>.</p> <p>How can I do the following in git?</p> <pre><code>svn log -v -l 10 ./ </code></pre>
111,052
11,439
2022-11-03 21:42:36
4,106,051
230
2010-11-05 13:03:54
4,353
2015-10-06 17:08:26
https://stackoverflow.com/q/4104764
https://stackoverflow.com/a/4106051
<p>This one is more similar to the svn command as it shows the file status: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), and others.</p> <pre><code>git log --name-status -10 path/to/dir </code></pre> <p>It is worth looking at the full documentation page for <a href="http://git-scm.com/docs/git-log" ...
<p>This one is more similar to the svn command as it shows the file status: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), and others.</p> <pre><code>git log --name-status -10 path/to/dir </code></pre> <p>It is worth looking at the full documentation page for <a href="http://git-scm.com/docs/git-log" ...
119
git
<h1>Show list of files changed in recent commits in a specific directory</h1> <p>In Subversion, <code>svn log</code> displays commit log messages <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.log.html" rel="noreferrer">(reference)</a>.</p> <p>How can I do the following in git?</p> <pre><code>svn log -v -l 1...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,953
git
# Show list of files changed in recent commits in a specific directory In Subversion, `svn log` displays commit log messages [(reference)](http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.log.html). How can I do the following in git? ``` svn log -v -l 10 ./ ```
This one is more similar to the svn command as it shows the file status: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), and others. ``` git log --name-status -10 path/to/dir ``` It is worth looking at the full documentation page for [`git log`](http://git-scm.com/docs/git-log). There you will learn th...
16675766
Get the difference between two branches in Git
113
2013-05-21 17:14:36
<p>I did following (I simplified this comparing to a reality):</p> <ul> <li>created a branch <strong>Branch1</strong>, switched to it</li> <li>added file <strong>File1</strong> and modified existing file <strong>File2</strong> and commited this</li> <li>figured out that I don't need <strong>File1</strong>, removed it ...
107,582
422,080
2021-08-18 17:20:53
16,676,931
230
2013-05-21 18:25:47
46,194
2013-05-22 13:05:33
https://stackoverflow.com/q/16675766
https://stackoverflow.com/a/16676931
<p>Let's assume that you started on the branch <code>master</code>. Then you can do:</p> <pre><code>git diff master Branch1 &gt; ../patchfile git checkout Branch2 git apply ../patchfile </code></pre> <p>Alternatively, if your goal is to rewrite history, then you could use an <a href="https://help.github.com/artic...
<p>Let's assume that you started on the branch <code>master</code>. Then you can do:</p> <pre><code>git diff master Branch1 &gt; ../patchfile git checkout Branch2 git apply ../patchfile </code></pre> <p>Alternatively, if your goal is to rewrite history, then you could use an <a href="https://help.github.com/artic...
119
git
<h1>Get the difference between two branches in Git</h1> <p>I did following (I simplified this comparing to a reality):</p> <ul> <li>created a branch <strong>Branch1</strong>, switched to it</li> <li>added file <strong>File1</strong> and modified existing file <strong>File2</strong> and commited this</li> <li>figured o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,954
git
# Get the difference between two branches in Git I did following (I simplified this comparing to a reality): - created a branch **Branch1**, switched to it - added file **File1** and modified existing file **File2** and commited this - figured out that I don't need **File1**, removed it and commited this So, the act...
Let's assume that you started on the branch `master`. Then you can do: ``` git diff master Branch1 > ../patchfile git checkout Branch2 git apply ../patchfile ``` Alternatively, if your goal is to rewrite history, then you could use an [interactive rebase](https://help.github.com/articles/interactive-rebase) to sq...
12657168
Can I use my existing git repo with openshift?
104
2012-09-29 22:44:51
<p>Is it necessary to have git repo on openshift only? I already have bitbucket / github git repo and would prefer to push there only. Can I simply hook into it so that openshift gets intimation ?</p> <p>Or for simplification, I push only at github, but when I want to deploy, I do something with openshift?</p> <p>I d...
55,537
129,795
2022-09-27 05:54:09
12,669,112
230
2012-10-01 07:33:42
231,357
2012-10-04 06:33:26
https://stackoverflow.com/q/12657168
https://stackoverflow.com/a/12669112
<p>I have the impression that you're not used to use git enough yet. I'd advise you to get into git to fully understand how to push your code to openshift. Nevertheless let me try to explain you the steps involved: As you'd do with git in general, the approach to choose here is to clone your other git repo (ex. on bitb...
<p>I have the impression that you're not used to use git enough yet. I'd advise you to get into git to fully understand how to push your code to openshift. Nevertheless let me try to explain you the steps involved: As you'd do with git in general, the approach to choose here is to clone your other git repo (ex. on bitb...
119, 77738
git, openshift
<h1>Can I use my existing git repo with openshift?</h1> <p>Is it necessary to have git repo on openshift only? I already have bitbucket / github git repo and would prefer to push there only. Can I simply hook into it so that openshift gets intimation ?</p> <p>Or for simplification, I push only at github, but when I wa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,955
git
# Can I use my existing git repo with openshift? Is it necessary to have git repo on openshift only? I already have bitbucket / github git repo and would prefer to push there only. Can I simply hook into it so that openshift gets intimation ? Or for simplification, I push only at github, but when I want to deploy, I ...
I have the impression that you're not used to use git enough yet. I'd advise you to get into git to fully understand how to push your code to openshift. Nevertheless let me try to explain you the steps involved: As you'd do with git in general, the approach to choose here is to clone your other git repo (ex. on bitbuck...
435646
Combine the first two commits of a Git repository?
238
2009-01-12 14:53:21
<p>Suppose you have a history containing the three commits <i>A, B</i> and <i>C</i>:</p> <pre><code>A-B-C </code></pre> <p>I would like to combine the two commits <i>A</i> and <i>B</i> to one commit <i>AB</i>:</p> <pre><code>AB-C </code></pre> <p>I tried</p> <pre><code>git rebase -i A </code></pre> <p>which opens...
52,584
54,193
2023-06-21 01:51:13
21,654,379
229
2014-02-09 02:14:48
105,137
2014-02-10 08:00:05
https://stackoverflow.com/q/435646
https://stackoverflow.com/a/21654379
<p>Use <code>git rebase -i --root</code> as of Git <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt" rel="noreferrer">version 1.7.12</a>.</p> <p>In the interactive rebase file, change the second line of commit <em>B</em> to <em>squash</em> and leave the other lines at <em>pick</em>:</p...
<p>Use <code>git rebase -i --root</code> as of Git <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt" rel="noreferrer">version 1.7.12</a>.</p> <p>In the interactive rebase file, change the second line of commit <em>B</em> to <em>squash</em> and leave the other lines at <em>pick</em>:</p...
119, 8974, 29934, 91259
git, git-rebase, git-rewrite-history, rebase
<h1>Combine the first two commits of a Git repository?</h1> <p>Suppose you have a history containing the three commits <i>A, B</i> and <i>C</i>:</p> <pre><code>A-B-C </code></pre> <p>I would like to combine the two commits <i>A</i> and <i>B</i> to one commit <i>AB</i>:</p> <pre><code>AB-C </code></pre> <p>I tried</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,956
git
# Combine the first two commits of a Git repository? Suppose you have a history containing the three commits *A, B* and *C*: ``` A-B-C ``` I would like to combine the two commits *A* and *B* to one commit *AB*: ``` AB-C ``` I tried ``` git rebase -i A ``` which opens up my editor with the following contents: ``...
Use `git rebase -i --root` as of Git [version 1.7.12](https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt). In the interactive rebase file, change the second line of commit *B* to *squash* and leave the other lines at *pick*: ``` pick f4202da A squash bea708e B pick a8c6abc C ``` This will combi...
4084921
What does the git index contain EXACTLY?
251
2010-11-03 07:20:42
<p>What does the Git index exactly contain, and what command can I use to view the content of the index?</p> <hr /> <p>Thanks for all your answers. I know that the index acts as a staging area, and what is committed is in the index rather than the working tree. I am just curious about what an index object consists of. ...
113,399
310,938
2025-07-21 13:15:39
4,086,986
228
2010-11-03 12:23:19
6,309
2025-07-21 13:15:39
https://stackoverflow.com/q/4084921
https://stackoverflow.com/a/4086986
<p>The Git book contains an article on <a href="http://shafiulazam.com/gitbook/7_the_git_index.html" rel="noreferrer">what an index includes</a>:</p> <blockquote> <p>The index is a binary file (generally kept in <code>.git/index</code>) containing a sorted list of path names, each with permissions and the SHA1 of a blo...
<p>The Git book contains an article on <a href="http://shafiulazam.com/gitbook/7_the_git_index.html" rel="noreferrer">what an index includes</a>:</p> <blockquote> <p>The index is a binary file (generally kept in <code>.git/index</code>) containing a sorted list of path names, each with permissions and the SHA1 of a blo...
119, 6796, 68400
git, git-index, internals
<h1>What does the git index contain EXACTLY?</h1> <p>What does the Git index exactly contain, and what command can I use to view the content of the index?</p> <hr /> <p>Thanks for all your answers. I know that the index acts as a staging area, and what is committed is in the index rather than the working tree. I am jus...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,957
git
# What does the git index contain EXACTLY? What does the Git index exactly contain, and what command can I use to view the content of the index? --- Thanks for all your answers. I know that the index acts as a staging area, and what is committed is in the index rather than the working tree. I am just curious about w...
The Git book contains an article on [what an index includes](http://shafiulazam.com/gitbook/7_the_git_index.html): > The index is a binary file (generally kept in `.git/index`) containing a sorted list of path names, each with permissions and the SHA1 of a blob object; `git ls-files` can show you the contents of the i...
50469927
View git history of specific line
160
2018-05-22 14:13:39
<p>I want to view the commit history related to the specific line in the file. I know we can get the history of the file. Are there any commands available to sort only the commits related to one specific line?</p>
96,058
9,624,430
2025-07-19 19:38:38
50,473,741
228
2018-05-22 17:51:18
2,468,549
2025-07-19 19:38:38
https://stackoverflow.com/q/50469927
https://stackoverflow.com/a/50473741
<p>bomz gave the right option but with wrong syntax. Fixed line would look like this:</p> <pre><code>git log -L '/the line from your file/,+1:path/to/your/file.txt' </code></pre> <p>The meaning of argument to <code>-L</code> is &quot;find the first occurrence of regex <code>/the line from your file/</code>, in <code>pa...
<p>bomz gave the right option but with wrong syntax. Fixed line would look like this:</p> <pre><code>git log -L '/the line from your file/,+1:path/to/your/file.txt' </code></pre> <p>The meaning of argument to <code>-L</code> is &quot;find the first occurrence of regex <code>/the line from your file/</code>, in <code>pa...
119
git
<h1>View git history of specific line</h1> <p>I want to view the commit history related to the specific line in the file. I know we can get the history of the file. Are there any commands available to sort only the commits related to one specific line?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,958
git
# View git history of specific line I want to view the commit history related to the specific line in the file. I know we can get the history of the file. Are there any commands available to sort only the commits related to one specific line?
bomz gave the right option but with wrong syntax. Fixed line would look like this: ``` git log -L '/the line from your file/,+1:path/to/your/file.txt' ``` The meaning of argument to `-L` is "find the first occurrence of regex `/the line from your file/`, in `path/to/your/file.txt` and show the log regarding one line ...
5033441
Where does Git store the SHA1 of the commit for a submodule?
214
2011-02-17 19:12:37
<p>I know that when you add a submodule to a git repository it tracks a particular commit of that submodule referenced by its sha1.</p> <p>I'm trying to find where this sha1 value is stored.</p> <p>The <code>.gitmodules</code> and <code>.git/config</code> files only show the paths for the submodule, but not the sha1 ...
53,030
41,116
2021-10-04 20:21:46
5,033,973
227
2011-02-17 20:05:38
95,706
2017-07-12 12:42:39
https://stackoverflow.com/q/5033441
https://stackoverflow.com/a/5033973
<p>It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink").</p> <p>Try doing <code>git ls-tree master &lt;path-to-directory-containing-submodule&gt;</code> (or just <code>git ls-tree mas...
<p>It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink").</p> <p>Try doing <code>git ls-tree master &lt;path-to-directory-containing-submodule&gt;</code> (or just <code>git ls-tree mas...
119, 10188, 41612
git, git-submodules, sha
<h1>Where does Git store the SHA1 of the commit for a submodule?</h1> <p>I know that when you add a submodule to a git repository it tracks a particular commit of that submodule referenced by its sha1.</p> <p>I'm trying to find where this sha1 value is stored.</p> <p>The <code>.gitmodules</code> and <code>.git/config...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,959
git
# Where does Git store the SHA1 of the commit for a submodule? I know that when you add a submodule to a git repository it tracks a particular commit of that submodule referenced by its sha1. I'm trying to find where this sha1 value is stored. The `.gitmodules` and `.git/config` files only show the paths for the sub...
It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink"). Try doing `git ls-tree master <path-to-directory-containing-submodule>` (or just `git ls-tree master` if the submodule lives in th...
12543055
How to push new branch without history
169
2012-09-22 10:45:05
<p>I have git repo with two unrelated branches, master and configs. I've created configs, purged all the files and then placed in configuration files only. Now I want to push this on remote repo, but as it were new, empty branch (without logs of all my changes and old revisions of original branch).</p> <p>How can I pu...
146,651
882,600
2024-07-05 19:00:53
12,543,340
227
2012-09-22 11:32:02
683,080
2013-04-19 16:45:04
https://stackoverflow.com/q/12543055
https://stackoverflow.com/a/12543340
<p>Purging all the files doesn't get rid of the history. You need to create a branch that has no history first, and the add your config files. These days <code>git checkout</code> has a <code>--orphan</code> option that makes a branch with no history. Here's the information on the <code>--orphan</code> option:</p> <...
<p>Purging all the files doesn't get rid of the history. You need to create a branch that has no history first, and the add your config files. These days <code>git checkout</code> has a <code>--orphan</code> option that makes a branch with no history. Here's the information on the <code>--orphan</code> option:</p> <...
119
git
<h1>How to push new branch without history</h1> <p>I have git repo with two unrelated branches, master and configs. I've created configs, purged all the files and then placed in configuration files only. Now I want to push this on remote repo, but as it were new, empty branch (without logs of all my changes and old rev...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,960
git
# How to push new branch without history I have git repo with two unrelated branches, master and configs. I've created configs, purged all the files and then placed in configuration files only. Now I want to push this on remote repo, but as it were new, empty branch (without logs of all my changes and old revisions of...
Purging all the files doesn't get rid of the history. You need to create a branch that has no history first, and the add your config files. These days `git checkout` has a `--orphan` option that makes a branch with no history. Here's the information on the `--orphan` option: > --orphan <new_branch> > > Create a new or...
38461705
Checkout Jenkins Pipeline Git SCM with credentials?
158
2016-07-19 14:43:12
<p>I was following <a href="https://jenkins.io/doc/pipeline/" rel="noreferrer">this tutorial</a>:</p> <pre><code>node { git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git' ... } </code></pre> <p>However it doesn't tell how to add credentials. Jenkins does have specific "Credentials" section...
503,512
4,078,670
2024-06-02 02:40:34
38,462,645
227
2016-07-19 15:23:49
1,598,323
2017-12-14 01:13:29
https://stackoverflow.com/q/38461705
https://stackoverflow.com/a/38462645
<p>You can use the following in a pipeline:</p> <pre><code>git branch: 'master', credentialsId: '12345-1234-4696-af25-123455', url: 'ssh://git@bitbucket.org:company/repo.git' </code></pre> <p>If you're using the ssh url then your credentials must be username + private key. If you're using the https clone url ...
<p>You can use the following in a pipeline:</p> <pre><code>git branch: 'master', credentialsId: '12345-1234-4696-af25-123455', url: 'ssh://git@bitbucket.org:company/repo.git' </code></pre> <p>If you're using the ssh url then your credentials must be username + private key. If you're using the https clone url ...
119, 64999, 118285
git, jenkins, jenkins-pipeline
<h1>Checkout Jenkins Pipeline Git SCM with credentials?</h1> <p>I was following <a href="https://jenkins.io/doc/pipeline/" rel="noreferrer">this tutorial</a>:</p> <pre><code>node { git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git' ... } </code></pre> <p>However it doesn't tell how to add ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,961
git
# Checkout Jenkins Pipeline Git SCM with credentials? I was following [this tutorial](https://jenkins.io/doc/pipeline/): ``` node { git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git' ... } ``` However it doesn't tell how to add credentials. Jenkins does have specific "Credentials" section...
You can use the following in a pipeline: ``` git branch: 'master', credentialsId: '12345-1234-4696-af25-123455', url: 'ssh://git@bitbucket.org:company/repo.git' ``` If you're using the ssh url then your credentials must be username + private key. If you're using the https clone url instead of the ssh one, the...
36999937
Rename a Git branch locally and remotely?
132
2016-05-03 09:05:09
<p>Is there a way to rename a Git branch locally and push it to the remote branch, even if there are already many commits pushed to the remote branch?</p> <p>Or, is it necessary to create a new local branch, delete the old local branch, and then repeat the operation on the remote repository?</p>
53,237
3,197,383
2018-07-19 16:57:06
36,999,938
227
2016-05-03 09:05:09
3,197,383
2018-01-04 19:34:33
https://stackoverflow.com/q/36999937
https://stackoverflow.com/a/36999938
<h1>Yes,</h1> <p>the feature <code>move</code> exists to rename the branch locally</p> <pre><code>git branch --move &lt;old_name&gt; &lt;new_name&gt; </code></pre> <p>but to push it, you must delete the old and push the new</p> <pre><code>git checkout &lt;new_name&gt; git push origin [--set-upstream] &lt;new_name&gt; g...
<h1>Yes,</h1> <p>the feature <code>move</code> exists to rename the branch locally</p> <pre><code>git branch --move &lt;old_name&gt; &lt;new_name&gt; </code></pre> <p>but to push it, you must delete the old and push the new</p> <pre><code>git checkout &lt;new_name&gt; git push origin [--set-upstream] &lt;new_name&gt; g...
119, 76220
git, git-branch
<h1>Rename a Git branch locally and remotely?</h1> <p>Is there a way to rename a Git branch locally and push it to the remote branch, even if there are already many commits pushed to the remote branch?</p> <p>Or, is it necessary to create a new local branch, delete the old local branch, and then repeat the operation o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,962
git
# Rename a Git branch locally and remotely? Is there a way to rename a Git branch locally and push it to the remote branch, even if there are already many commits pushed to the remote branch? Or, is it necessary to create a new local branch, delete the old local branch, and then repeat the operation on the remote rep...
# Yes, the feature `move` exists to rename the branch locally ``` git branch --move <old_name> <new_name> ``` but to push it, you must delete the old and push the new ``` git checkout <new_name> git push origin [--set-upstream] <new_name> git push origin --delete <old_name> ``` > `--set-upstream` is optional, it c...
22827239
How to make Git properly display UTF-8 encoded pathnames in the console window?
122
2014-04-03 03:22:43
<p>I have file names in UTF-8, git handles them O.K, it will create files properly and github pages also display it right. Except that it will display it in console like below. Is it possible to make git display UTF-8 encoded characters beyond ASCII 127 in console properly?</p> <pre><code>git status # On branch master...
36,542
1,968,972
2017-11-08 23:38:41
22,828,826
227
2014-04-03 05:45:50
6,309
2017-11-08 23:38:41
https://stackoverflow.com/q/22827239
https://stackoverflow.com/a/22828826
<p>git has always used octal utf8 display, and one way to show the actual name is by using <a href="http://www.manpagez.com/man/1/printf/" rel="noreferrer"><code>printf</code></a> in a bash shell.</p> <p>According to <a href="https://stackoverflow.com/questions/10687589/git-how-to-specify-file-names-containing-octal-n...
<p>git has always used octal utf8 display, and one way to show the actual name is by using <a href="http://www.manpagez.com/man/1/printf/" rel="noreferrer"><code>printf</code></a> in a bash shell.</p> <p>According to <a href="https://stackoverflow.com/questions/10687589/git-how-to-specify-file-names-containing-octal-n...
119
git
<h1>How to make Git properly display UTF-8 encoded pathnames in the console window?</h1> <p>I have file names in UTF-8, git handles them O.K, it will create files properly and github pages also display it right. Except that it will display it in console like below. Is it possible to make git display UTF-8 encoded chara...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,963
git
# How to make Git properly display UTF-8 encoded pathnames in the console window? I have file names in UTF-8, git handles them O.K, it will create files properly and github pages also display it right. Except that it will display it in console like below. Is it possible to make git display UTF-8 encoded characters bey...
git has always used octal utf8 display, and one way to show the actual name is by using [`printf`](http://www.manpagez.com/man/1/printf/) in a bash shell. According to [this comment](https://stackoverflow.com/questions/10687589/git-how-to-specify-file-names-containing-octal-notation-on-the-command-line#comment13872666...
11696295
rejected master -> master (non-fast-forward)
335
2012-07-27 22:09:23
<p>I'm trying to push my project (all files in a new repository). I follow the steps but when I push with <code>git push -u origin master</code> I get this error:</p> <pre><code>! [rejected] master -&gt; master (non-fast-forward) error: failed to push some refs to 'git@github.com:asantoya/projectnewbies.git' To...
604,232
1,546,116
2025-04-20 04:13:27
11,696,452
226
2012-07-27 22:25:27
105,672
2012-12-18 17:51:59
https://stackoverflow.com/q/11696295
https://stackoverflow.com/a/11696452
<p>As the error message says: <code>git pull</code> before you try to <code>git push</code>. Apparently your local branch is out of sync with your tracking branch.</p> <p>Depending on project rules and your workflow you might also want to use <code>git pull --rebase</code>.</p>
<p>As the error message says: <code>git pull</code> before you try to <code>git push</code>. Apparently your local branch is out of sync with your tracking branch.</p> <p>Depending on project rules and your workflow you might also want to use <code>git pull --rebase</code>.</p>
119, 4236
git, push
<h1>rejected master -> master (non-fast-forward)</h1> <p>I'm trying to push my project (all files in a new repository). I follow the steps but when I push with <code>git push -u origin master</code> I get this error:</p> <pre><code>! [rejected] master -&gt; master (non-fast-forward) error: failed to push some r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,964
git
# rejected master -> master (non-fast-forward) I'm trying to push my project (all files in a new repository). I follow the steps but when I push with `git push -u origin master` I get this error: ``` ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:asantoya/pr...
As the error message says: `git pull` before you try to `git push`. Apparently your local branch is out of sync with your tracking branch. Depending on project rules and your workflow you might also want to use `git pull --rebase`.
30331338
Remove git integrations from VSCode
129
2015-05-19 16:35:44
<p>I downloaded Visual Studio Code to try out at work and I'm in love with almost everything about it. One part I am not in love with though: Git integration.</p> <p>I imported my entire working folder (~14000 source files + git items), and the layout and everything within Visual Studio Code is awesome. I moved from o...
124,006
1,344,548
2023-04-08 15:39:31
33,956,083
226
2015-11-27 11:09:46
724,015
2018-11-28 10:52:36
https://stackoverflow.com/q/30331338
https://stackoverflow.com/a/33956083
<p>Add this to <code>settings.json</code>:</p> <pre><code>// Whether git is enabled. "git.enabled": false, </code></pre> <p>Some other commands related to Git execution:</p> <pre><code>// Path and filename of the git executable, e.g. `C:\Program Files\Git\bin\git.exe` (Windows). "git.path": null, // When enabled, c...
<p>Add this to <code>settings.json</code>:</p> <pre><code>// Whether git is enabled. "git.enabled": false, </code></pre> <p>Some other commands related to Git execution:</p> <pre><code>// Path and filename of the git executable, e.g. `C:\Program Files\Git\bin\git.exe` (Windows). "git.path": null, // When enabled, c...
119, 111608
git, visual-studio-code
<h1>Remove git integrations from VSCode</h1> <p>I downloaded Visual Studio Code to try out at work and I'm in love with almost everything about it. One part I am not in love with though: Git integration.</p> <p>I imported my entire working folder (~14000 source files + git items), and the layout and everything within ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,965
git
# Remove git integrations from VSCode I downloaded Visual Studio Code to try out at work and I'm in love with almost everything about it. One part I am not in love with though: Git integration. I imported my entire working folder (~14000 source files + git items), and the layout and everything within Visual Studio Co...
Add this to `settings.json`: ``` // Whether git is enabled. "git.enabled": false, ``` Some other commands related to Git execution: ``` // Path and filename of the git executable, e.g. `C:\Program Files\Git\bin\git.exe` (Windows). "git.path": null, // When enabled, commits will automatically be fetched from the def...
6857082
Redo merge of just a single file
147
2011-07-28 09:54:34
<p>I'm in the middle of a large merge, and I've used <code>git mergetool</code> to resolve all the conflicts, but I have not committed yet, as I wanted to make sure the merge was ok first.</p> <p>It turns out that I made a mistake while resolving the conflicts in one file, and I would like to redo the conflict resolut...
24,688
98,117
2012-11-30 21:58:53
6,865,041
225
2011-07-28 20:09:26
98,117
2011-07-28 20:14:44
https://stackoverflow.com/q/6857082
https://stackoverflow.com/a/6865041
<p>It seems I was just looking in the wrong place. The solution turned out to be quite simple.</p> <pre><code>git checkout -m &lt;file&gt; </code></pre> <p>This returns the file to its conflicted state. I can then run <code>git mergetool</code> to redo the merge.</p>
<p>It seems I was just looking in the wrong place. The solution turned out to be quite simple.</p> <pre><code>git checkout -m &lt;file&gt; </code></pre> <p>This returns the file to its conflicted state. I can then run <code>git mergetool</code> to redo the merge.</p>
119, 717
git, merge
<h1>Redo merge of just a single file</h1> <p>I'm in the middle of a large merge, and I've used <code>git mergetool</code> to resolve all the conflicts, but I have not committed yet, as I wanted to make sure the merge was ok first.</p> <p>It turns out that I made a mistake while resolving the conflicts in one file, and...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,969
git
# Redo merge of just a single file I'm in the middle of a large merge, and I've used `git mergetool` to resolve all the conflicts, but I have not committed yet, as I wanted to make sure the merge was ok first. It turns out that I made a mistake while resolving the conflicts in one file, and I would like to redo the c...
It seems I was just looking in the wrong place. The solution turned out to be quite simple. ``` git checkout -m <file> ``` This returns the file to its conflicted state. I can then run `git mergetool` to redo the merge.
5600621
.gitignore exclude files in directory but not certain directories
102
2011-04-08 20:47:25
<pre><code>application/cache/* application/cache/folder/* application/cache/folder/onemorefolder/* </code></pre> <p>This doesn't seem to be working. When I clone the project, there is no <code>"application/cache"</code> folder or <code>"application/cache/folder"</code> folder, etc...</p> <p>I'd like if files in the c...
95,708
299,216
2017-01-18 22:00:21
5,600,673
225
2011-04-08 20:55:36
28,804
2011-04-08 20:55:36
https://stackoverflow.com/q/5600621
https://stackoverflow.com/a/5600673
<p>Git doesn't track folders, only files, so if you ignore everything in a folder, Git won't have anything to track. You can add a <code>.gitignore</code> file to each directory (<code>application/cache</code>, <code>application/cache/folder</code>, <code>application/cache/folder/onemorefolder/</code>) with the followi...
<p>Git doesn't track folders, only files, so if you ignore everything in a folder, Git won't have anything to track. You can add a <code>.gitignore</code> file to each directory (<code>application/cache</code>, <code>application/cache/folder</code>, <code>application/cache/folder/onemorefolder/</code>) with the followi...
119, 25056
git, gitignore
<h1>.gitignore exclude files in directory but not certain directories</h1> <pre><code>application/cache/* application/cache/folder/* application/cache/folder/onemorefolder/* </code></pre> <p>This doesn't seem to be working. When I clone the project, there is no <code>"application/cache"</code> folder or <code>"applica...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,970
git
# .gitignore exclude files in directory but not certain directories ``` application/cache/* application/cache/folder/* application/cache/folder/onemorefolder/* ``` This doesn't seem to be working. When I clone the project, there is no `"application/cache"` folder or `"application/cache/folder"` folder, etc... I'd li...
Git doesn't track folders, only files, so if you ignore everything in a folder, Git won't have anything to track. You can add a `.gitignore` file to each directory (`application/cache`, `application/cache/folder`, `application/cache/folder/onemorefolder/`) with the following contents: ``` * !.gitignore ``` Then, you ...
4318161
Can "git pull --all" update all my local branches?
600
2010-11-30 20:20:27
<p>I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.</p> <p>Updating all my local branches is tedious:</p> <pre><code>git fetch --all git rebase origin/master git checkout staging git rebase origin/staging git checkout production git reb...
408,907
502,457
2025-09-09 08:24:59
4,318,198
223
2010-11-30 20:24:46
119,963
2010-11-30 20:24:46
https://stackoverflow.com/q/4318161
https://stackoverflow.com/a/4318198
<p>The behavior you describe for <code>pull --all</code> is exactly as expected, though not necessarily useful. The option is passed along to git fetch, which then fetches all refs from all remotes, instead of just the needed one; <code>pull</code> then merges (or in your case, rebases) the appropriate single branch.</...
<p>The behavior you describe for <code>pull --all</code> is exactly as expected, though not necessarily useful. The option is passed along to git fetch, which then fetches all refs from all remotes, instead of just the needed one; <code>pull</code> then merges (or in your case, rebases) the appropriate single branch.</...
119
git
<h1>Can "git pull --all" update all my local branches?</h1> <p>I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.</p> <p>Updating all my local branches is tedious:</p> <pre><code>git fetch --all git rebase origin/master git checkout stagi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,973
git
# Can "git pull --all" update all my local branches? I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches. Updating all my local branches is tedious: ``` git fetch --all git rebase origin/master git checkout staging git rebase origin/stagin...
The behavior you describe for `pull --all` is exactly as expected, though not necessarily useful. The option is passed along to git fetch, which then fetches all refs from all remotes, instead of just the needed one; `pull` then merges (or in your case, rebases) the appropriate single branch. If you want to check out ...
3926768
Amend a commit that wasn't the previous commit
172
2010-10-13 18:25:52
<p>Frequently I'll have a workflow like the following:</p> <ol> <li>Commit changes to a group of files</li> <li>Commit changes to a different group of files</li> <li>Realize I missed some changes that belong in the first commit</li> <li>Curse</li> </ol> <p>I can't make use of <code>git commit --amend</code> because i...
107,259
223,897
2014-09-10 21:39:08
3,926,832
223
2010-10-13 18:33:14
350,351
2014-09-10 21:39:08
https://stackoverflow.com/q/3926768
https://stackoverflow.com/a/3926832
<p>You can use <code>git rebase</code> to solve this. Run <code>git rebase -i sha1~1</code> where sha1 is the commit hash of the one you want to change. Find the commit you want to change, and replace "pick" with "edit" as described in the comments of the rebase editor. When you continue from there, you can edit that c...
<p>You can use <code>git rebase</code> to solve this. Run <code>git rebase -i sha1~1</code> where sha1 is the commit hash of the one you want to change. Find the commit you want to change, and replace "pick" with "edit" as described in the comments of the rebase editor. When you continue from there, you can edit that c...
119
git
<h1>Amend a commit that wasn't the previous commit</h1> <p>Frequently I'll have a workflow like the following:</p> <ol> <li>Commit changes to a group of files</li> <li>Commit changes to a different group of files</li> <li>Realize I missed some changes that belong in the first commit</li> <li>Curse</li> </ol> <p>I can...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,974
git
# Amend a commit that wasn't the previous commit Frequently I'll have a workflow like the following: 1. Commit changes to a group of files 2. Commit changes to a different group of files 3. Realize I missed some changes that belong in the first commit 4. Curse I can't make use of `git commit --amend` because it's no...
You can use `git rebase` to solve this. Run `git rebase -i sha1~1` where sha1 is the commit hash of the one you want to change. Find the commit you want to change, and replace "pick" with "edit" as described in the comments of the rebase editor. When you continue from there, you can edit that commit. Note that this wi...
2840816
git stash blunder: git stash pop and ended up with merge conflicts
202
2010-05-15 16:18:53
<p>I did a <code>git stash pop</code> and ended up with merge conflicts. I removed the files from the file system and did a <code>git checkout</code> as shown below, but it thinks the files are still unmerged. I then tried replacing the files and doing a <code>git checkout</code> again and same result. I event tried fo...
139,560
135,414
2021-09-10 17:09:17
2,840,936
222
2010-05-15 16:56:23
52,444
2017-09-12 17:09:39
https://stackoverflow.com/q/2840816
https://stackoverflow.com/a/2840936
<p>See <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">man git merge</a> (<em>HOW TO RESOLVE CONFLICTS</em>):</p> <blockquote> <p>After seeing a conflict, you can do two things:</p> <ul> <li><p>Decide not to merge. The only clean-ups you need are to reset the index file to the...
<p>See <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">man git merge</a> (<em>HOW TO RESOLVE CONFLICTS</em>):</p> <blockquote> <p>After seeing a conflict, you can do two things:</p> <ul> <li><p>Decide not to merge. The only clean-ups you need are to reset the index file to the...
119, 13091, 37230
git, git-checkout, git-stash
<h1>git stash blunder: git stash pop and ended up with merge conflicts</h1> <p>I did a <code>git stash pop</code> and ended up with merge conflicts. I removed the files from the file system and did a <code>git checkout</code> as shown below, but it thinks the files are still unmerged. I then tried replacing the files a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,975
git
# git stash blunder: git stash pop and ended up with merge conflicts I did a `git stash pop` and ended up with merge conflicts. I removed the files from the file system and did a `git checkout` as shown below, but it thinks the files are still unmerged. I then tried replacing the files and doing a `git checkout` again...
See [man git merge](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html) (*HOW TO RESOLVE CONFLICTS*): > After seeing a conflict, you can do two things: > > - Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes m...
4044368
What does tree-ish mean in Git?
159
2010-10-28 15:25:03
<p>I'm very confused about how to use <code>git archive</code>.</p> <p>I have a git repository with folder <em>Foo</em>, <em>Bar</em> and <em>Baz</em> at the top level. I need to export folder <strong>Foo</strong> in a SVN-ish sort of way for quick test deployment.</p> <p>I learned that I could use <code>git-archiv...
58,466
256,854
2019-08-26 22:52:08
18,605,496
222
2013-09-04 04:38:08
null
2014-06-14 16:29:11
https://stackoverflow.com/q/4044368
https://stackoverflow.com/a/18605496
<h1>The Short Answer (TL;DR)</h1> <p>"Tree-ish" is a term that refers to any identifier (as specified in <a href="https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions" rel="noreferrer">the Git revisions documentation</a>) that ultimately leads to a (sub)directory tree (Git refers to...
<h1>The Short Answer (TL;DR)</h1> <p>"Tree-ish" is a term that refers to any identifier (as specified in <a href="https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions" rel="noreferrer">the Git revisions documentation</a>) that ultimately leads to a (sub)directory tree (Git refers to...
119, 81662
git, git-archive
<h1>What does tree-ish mean in Git?</h1> <p>I'm very confused about how to use <code>git archive</code>.</p> <p>I have a git repository with folder <em>Foo</em>, <em>Bar</em> and <em>Baz</em> at the top level. I need to export folder <strong>Foo</strong> in a SVN-ish sort of way for quick test deployment.</p> <p>I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,976
git
# What does tree-ish mean in Git? I'm very confused about how to use `git archive`. I have a git repository with folder *Foo*, *Bar* and *Baz* at the top level. I need to export folder **Foo** in a SVN-ish sort of way for quick test deployment. I learned that I could use `git-archive` in an [SVN-ish export sort of w...
# The Short Answer (TL;DR) "Tree-ish" is a term that refers to any identifier (as specified in [the Git revisions documentation](https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions)) that ultimately leads to a (sub)directory tree (Git refers to directories as "trees" and "tree obje...
12288212
git update-index --assume-unchanged on directory
127
2012-09-05 19:10:58
<p>git 1.7.12</p> <p>I want to mark all files below a given directory as assume-unchanged.</p> <ol> <li><p><code>git update-index --assume-unchanged dir/</code> gives &quot;Ignoring path.&quot;</p> </li> <li><p><code>git update-index --assume-unchanged dir/*</code> quickly fails because it will encounter files which ar...
74,928
529,743
2021-10-26 21:28:18
12,288,918
222
2012-09-05 20:03:36
1,253,222
2019-05-15 13:07:57
https://stackoverflow.com/q/12288212
https://stackoverflow.com/a/12288918
<p><code>git update-index</code> wants the file names on its command line, not on its standard input. </p> <h2>Step 1:</h2> <p><code>cd</code> into the folder you want to assume is unchanged</p> <h2>Step 2:</h2> <p>You can do either this:</p> <pre><code>git update-index --assume-unchanged $(git ls-files | tr '\n' ...
<p><code>git update-index</code> wants the file names on its command line, not on its standard input. </p> <h2>Step 1:</h2> <p><code>cd</code> into the folder you want to assume is unchanged</p> <h2>Step 2:</h2> <p>You can do either this:</p> <pre><code>git update-index --assume-unchanged $(git ls-files | tr '\n' ...
119, 1231, 5813
command-line, git, pipe
<h1>git update-index --assume-unchanged on directory</h1> <p>git 1.7.12</p> <p>I want to mark all files below a given directory as assume-unchanged.</p> <ol> <li><p><code>git update-index --assume-unchanged dir/</code> gives &quot;Ignoring path.&quot;</p> </li> <li><p><code>git update-index --assume-unchanged dir/*</co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,979
git
# git update-index --assume-unchanged on directory git 1.7.12 I want to mark all files below a given directory as assume-unchanged. 1. `git update-index --assume-unchanged dir/` gives "Ignoring path." 2. `git update-index --assume-unchanged dir/*` quickly fails because it will encounter files which are not being tra...
`git update-index` wants the file names on its command line, not on its standard input. ## Step 1: `cd` into the folder you want to assume is unchanged ## Step 2: You can do either this: ``` git update-index --assume-unchanged $(git ls-files | tr '\n' ' ') ``` or ``` git ls-files | tr '\n' ' ' | xargs git update...