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
60711665
How to prevent Git from commiting Jupyter Notebook results?
25
2020-03-16 18:51:35
<p>I m working on project in Jupyter Notebook.</p> <p>Whenever I make a commit not only changed code and markdown columns get commited but also results from code columns.</p> <p>That makes Git diffs unreadable and it is very hard to review pull requests and changes due to commiting of those code cell results.</p> <p...
12,412
7,772,068
2025-12-10 03:25:23
74,753,885
14
2022-12-10 14:41:06
5,614,602
2023-07-27 00:43:34
https://stackoverflow.com/q/60711665
https://stackoverflow.com/a/74753885
<p>I strongly recommend putting the following little script in <code>.git/hooks/pre-commit</code>. It uses <code>nbconvert</code> on all <code>.ipynb</code> files that are staged to be committed, and if after stripping all the output there's no changes to be committed it exits. That last part is important because other...
<p>I strongly recommend putting the following little script in <code>.git/hooks/pre-commit</code>. It uses <code>nbconvert</code> on all <code>.ipynb</code> files that are staged to be committed, and if after stripping all the output there's no changes to be committed it exits. That last part is important because other...
119, 116342
git, jupyter-notebook
<h1>How to prevent Git from commiting Jupyter Notebook results?</h1> <p>I m working on project in Jupyter Notebook.</p> <p>Whenever I make a commit not only changed code and markdown columns get commited but also results from code columns.</p> <p>That makes Git diffs unreadable and it is very hard to review pull requ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,122
git
# How to prevent Git from commiting Jupyter Notebook results? I m working on project in Jupyter Notebook. Whenever I make a commit not only changed code and markdown columns get commited but also results from code columns. That makes Git diffs unreadable and it is very hard to review pull requests and changes due to...
I strongly recommend putting the following little script in `.git/hooks/pre-commit`. It uses `nbconvert` on all `.ipynb` files that are staged to be committed, and if after stripping all the output there's no changes to be committed it exits. That last part is important because otherwise you'll be making useless empty ...
2466959
Git: Removing carriage returns from source-controlled files
25
2010-03-18 00:54:07
<p>I've got a Git repository that has some files with DOS format (<code>\r\n</code> line endings). I would like to just run the files through <code>dos2unix</code> (which would change all files to UNIX format, with <code>\n</code> line endings), but how badly would this affect history, and is it recommended at all?</p>...
36,795
119,081
2017-05-17 17:50:50
2,466,992
14
2010-03-18 01:05:06
200,266
2010-03-18 11:13:57
https://stackoverflow.com/q/2466959
https://stackoverflow.com/a/2466992
<p>The approach you’ll have to use depends on how public your repository is.</p> <p>If you don’t mind or care about changing all SHAs because you’re more or less the only one using it but want to have this issue sorted out for all times, you can run a <code>git filter-branch</code> and apply <code>dos2unix</code> to a...
<p>The approach you’ll have to use depends on how public your repository is.</p> <p>If you don’t mind or care about changing all SHAs because you’re more or less the only one using it but want to have this issue sorted out for all times, you can run a <code>git filter-branch</code> and apply <code>dos2unix</code> to a...
119, 456, 4113
dos2unix, git, version-control
<h1>Git: Removing carriage returns from source-controlled files</h1> <p>I've got a Git repository that has some files with DOS format (<code>\r\n</code> line endings). I would like to just run the files through <code>dos2unix</code> (which would change all files to UNIX format, with <code>\n</code> line endings), but h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,123
git
# Git: Removing carriage returns from source-controlled files I've got a Git repository that has some files with DOS format (`\r\n` line endings). I would like to just run the files through `dos2unix` (which would change all files to UNIX format, with `\n` line endings), but how badly would this affect history, and is...
The approach you’ll have to use depends on how public your repository is. If you don’t mind or care about changing all SHAs because you’re more or less the only one using it but want to have this issue sorted out for all times, you can run a `git filter-branch` and apply `dos2unix` to all files in each commit. (If you...
1807036
Git: merging public and private branches while while keeping certain files intact in both branches
25
2009-11-27 06:07:21
<p>I've read a few git questions here, but could not find an answer to this one:</p> <p>I have a public and a private branches where I want to allow certain files to diverge.</p> <p>Those are configuration files with passwords and my local customizations. </p> <p>I do want to be able to merge the branches both ways:...
4,388
110,274
2010-02-26 00:20:09
1,807,349
14
2009-11-27 08:10:06
6,309
2009-11-27 08:10:06
https://stackoverflow.com/q/1807036
https://stackoverflow.com/a/1807349
<p>To be on the safe side, you can add a <a href="http://git-scm.com/docs/gitattributes" rel="nofollow noreferrer"><code>git attribute</code></a> (see <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/930495#930495">here for an example<...
<p>To be on the safe side, you can add a <a href="http://git-scm.com/docs/gitattributes" rel="nofollow noreferrer"><code>git attribute</code></a> (see <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/930495#930495">here for an example<...
119, 717, 3346
dvcs, git, merge
<h1>Git: merging public and private branches while while keeping certain files intact in both branches</h1> <p>I've read a few git questions here, but could not find an answer to this one:</p> <p>I have a public and a private branches where I want to allow certain files to diverge.</p> <p>Those are configuration file...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,124
git
# Git: merging public and private branches while while keeping certain files intact in both branches I've read a few git questions here, but could not find an answer to this one: I have a public and a private branches where I want to allow certain files to diverge. Those are configuration files with passwords and my...
To be on the safe side, you can add a [`git attribute`](http://git-scm.com/docs/gitattributes) (see [here for an example](https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/930495#930495)) for those private files. That way, you can define a scri...
57216304
Stage single deleted lines in Visual Studio Code
24
2019-07-26 08:43:12
<p>I'm using Visual Studio Code and its integrated version control. I would like to split a group of deleted lines in two different commits. </p> <p>I know about the "Stage Selected Ranges" option but, from what I see, I can't select deleted lines.</p> <p>Is there a way to achieve it?</p> <p>Thanks</p> <p><a href="...
7,542
7,147,172
2024-03-04 16:23:03
57,231,702
14
2019-07-27 11:32:40
2,745,495
2020-01-15 23:44:16
https://stackoverflow.com/q/57216304
https://stackoverflow.com/a/57231702
<p>I'm afraid there is no way to do what you want with VS Code.</p> <p>It's not a VS Code problem, it's a <code>git</code> problem. <code>git</code> is telling VS Code to treat those consecutive changes as one hunk, and so if <code>git</code> can't split it, then VS Code can't either. </p> <p>Try running <code>git ad...
<p>I'm afraid there is no way to do what you want with VS Code.</p> <p>It's not a VS Code problem, it's a <code>git</code> problem. <code>git</code> is telling VS Code to treat those consecutive changes as one hunk, and so if <code>git</code> can't split it, then VS Code can't either. </p> <p>Try running <code>git ad...
119, 456, 111608
git, version-control, visual-studio-code
<h1>Stage single deleted lines in Visual Studio Code</h1> <p>I'm using Visual Studio Code and its integrated version control. I would like to split a group of deleted lines in two different commits. </p> <p>I know about the "Stage Selected Ranges" option but, from what I see, I can't select deleted lines.</p> <p>Is t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,125
git
# Stage single deleted lines in Visual Studio Code I'm using Visual Studio Code and its integrated version control. I would like to split a group of deleted lines in two different commits. I know about the "Stage Selected Ranges" option but, from what I see, I can't select deleted lines. Is there a way to achieve it...
I'm afraid there is no way to do what you want with VS Code. It's not a VS Code problem, it's a `git` problem. `git` is telling VS Code to treat those consecutive changes as one hunk, and so if `git` can't split it, then VS Code can't either. Try running `git add -p` on the command line, and you'll probably see that ...
35879185
Can't use git add with --patch option
24
2016-03-08 22:20:34
<p>I recently updated Git to version <code>2.7.2.windows.1</code> (I am running Windows 7 64-bit). Since the update, I have been unable to run <code>git add</code> with the <code>-p</code> option on files within a certain directory (or its subdirectories) whose name is <code>_</code> (an underscore).</p> <p><code>git...
1,341
410,076
2016-03-15 00:16:00
35,951,584
14
2016-03-11 23:14:06
5,032,339
2016-03-15 00:16:00
https://stackoverflow.com/q/35879185
https://stackoverflow.com/a/35951584
<p>Well, I was able to reproduce this, and seems that it is the same POSIX-to-Windows path conversion. ProcessMonitor shows that <code>git</code> (actually, <code>perl</code> run by <code>git</code>) looks for a file <code>C:\Program Files\Git\php\class.Menu.php</code>.</p> <p>To work this around (at least, that worke...
<p>Well, I was able to reproduce this, and seems that it is the same POSIX-to-Windows path conversion. ProcessMonitor shows that <code>git</code> (actually, <code>perl</code> run by <code>git</code>) looks for a file <code>C:\Program Files\Git\php\class.Menu.php</code>.</p> <p>To work this around (at least, that worke...
64, 119, 1062, 34792
filenames, git, git-add, windows
<h1>Can't use git add with --patch option</h1> <p>I recently updated Git to version <code>2.7.2.windows.1</code> (I am running Windows 7 64-bit). Since the update, I have been unable to run <code>git add</code> with the <code>-p</code> option on files within a certain directory (or its subdirectories) whose name is <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,127
git
# Can't use git add with --patch option I recently updated Git to version `2.7.2.windows.1` (I am running Windows 7 64-bit). Since the update, I have been unable to run `git add` with the `-p` option on files within a certain directory (or its subdirectories) whose name is `_` (an underscore). `git status` correctly ...
Well, I was able to reproduce this, and seems that it is the same POSIX-to-Windows path conversion. ProcessMonitor shows that `git` (actually, `perl` run by `git`) looks for a file `C:\Program Files\Git\php\class.Menu.php`. To work this around (at least, that worked for me), according to [documentation](https://github...
49944913
Git rebase removing more recent changes?
23
2018-04-20 15:19:24
<p>I have a <code>master</code> branch and two working branches, <code>a</code> and <code>b</code>. Branch <code>b</code> was created from the same point as <code>a</code> but touches different files (only one shared, <code>d.py</code>). Branch <code>b</code> was just pulled into <code>master</code>.</p> <pre><code> ...
18,343
5,380,436
2020-06-25 11:05:48
49,945,102
14
2018-04-20 15:29:33
1,261,399
2018-04-20 15:29:33
https://stackoverflow.com/q/49944913
https://stackoverflow.com/a/49945102
<p>If there are conflicts between master and your <code>a</code> branch, the rebase will stop at the point where the conflict exists and expects you to fix it. </p> <p>First off, to get to the original state of your branch, you can do <code>git rebase --abort</code>. This will undo the attempted rebase. </p> <p>If yo...
<p>If there are conflicts between master and your <code>a</code> branch, the rebase will stop at the point where the conflict exists and expects you to fix it. </p> <p>First off, to get to the original state of your branch, you can do <code>git rebase --abort</code>. This will undo the attempted rebase. </p> <p>If yo...
119
git
<h1>Git rebase removing more recent changes?</h1> <p>I have a <code>master</code> branch and two working branches, <code>a</code> and <code>b</code>. Branch <code>b</code> was created from the same point as <code>a</code> but touches different files (only one shared, <code>d.py</code>). Branch <code>b</code> was just p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,129
git
# Git rebase removing more recent changes? I have a `master` branch and two working branches, `a` and `b`. Branch `b` was created from the same point as `a` but touches different files (only one shared, `d.py`). Branch `b` was just pulled into `master`. ``` (a) F---H-J----L--- /...
If there are conflicts between master and your `a` branch, the rebase will stop at the point where the conflict exists and expects you to fix it. First off, to get to the original state of your branch, you can do `git rebase --abort`. This will undo the attempted rebase. If you are still in the middle of the rebase, ...
13489725
Make a git branch equal to master again
23
2012-11-21 09:07:05
<p><em>Short version</em></p> <p>What is the easiest way to make a branch equal to <code>master</code> again, discarding any differences? Up until now, I simply used <code>git branch -D wip</code>, followed by <code>git checkout -b wip</code>, but that seems a bit silly. </p> <p><em>Motivation</em></p> <p>I often ha...
37,826
16,784
2012-11-21 15:31:29
13,496,570
14
2012-11-21 15:31:29
1,507,392
2012-11-21 15:31:29
https://stackoverflow.com/q/13489725
https://stackoverflow.com/a/13496570
<p>If you really want to blow away the previous branch with that name, and create a new one you could just use:</p> <pre><code>git checkout -B wip master </code></pre> <p>Using the capital version rather than <code>-b</code> will cause git to switch to the named branch, and reset it to the new starting point named as...
<p>If you really want to blow away the previous branch with that name, and create a new one you could just use:</p> <pre><code>git checkout -B wip master </code></pre> <p>Using the capital version rather than <code>-b</code> will cause git to switch to the named branch, and reset it to the new starting point named as...
119, 1879
branch, git
<h1>Make a git branch equal to master again</h1> <p><em>Short version</em></p> <p>What is the easiest way to make a branch equal to <code>master</code> again, discarding any differences? Up until now, I simply used <code>git branch -D wip</code>, followed by <code>git checkout -b wip</code>, but that seems a bit silly...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,132
git
# Make a git branch equal to master again *Short version* What is the easiest way to make a branch equal to `master` again, discarding any differences? Up until now, I simply used `git branch -D wip`, followed by `git checkout -b wip`, but that seems a bit silly. *Motivation* I often have a `wip` branch alongside m...
If you really want to blow away the previous branch with that name, and create a new one you could just use: ``` git checkout -B wip master ``` Using the capital version rather than `-b` will cause git to switch to the named branch, and reset it to the new starting point named as the last argument. If you're currentl...
8839496
Add a git merge driver to the repository?
23
2012-01-12 17:29:56
<p>I'm creating a merge driver. I have defined a .gitattributes file as follows:</p> <p><code>filename merge=mergeStrategy</code></p> <p>I have created the merge driver in $PROJECT/.git/config as follows:</p> <pre><code>[merge "mergeStrategy"] name = My merge strategy driver = scripts/mergeScript.sh </code>...
8,191
1,837,124
2021-08-11 14:03:46
8,839,568
14
2012-01-12 17:35:32
6,309
2021-08-11 14:03:46
https://stackoverflow.com/q/8839496
https://stackoverflow.com/a/8839568
<p>You could simply add and commit (and push) <code>script/mergeScript</code> (along with the <code>.gitattributes</code> file, of course)</p> <p>That would work as long as:</p> <ul> <li><code>mergeScript</code> is somehow in the <code>$PATH</code> of the user executing the merge driver.</li> <li><code>mergeScript</cod...
<p>You could simply add and commit (and push) <code>script/mergeScript</code> (along with the <code>.gitattributes</code> file, of course)</p> <p>That would work as long as:</p> <ul> <li><code>mergeScript</code> is somehow in the <code>$PATH</code> of the user executing the merge driver.</li> <li><code>mergeScript</cod...
119, 717, 28897, 32868
git, git-config, git-merge, merge
<h1>Add a git merge driver to the repository?</h1> <p>I'm creating a merge driver. I have defined a .gitattributes file as follows:</p> <p><code>filename merge=mergeStrategy</code></p> <p>I have created the merge driver in $PROJECT/.git/config as follows:</p> <pre><code>[merge "mergeStrategy"] name = My merge s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,133
git
# Add a git merge driver to the repository? I'm creating a merge driver. I have defined a .gitattributes file as follows: `filename merge=mergeStrategy` I have created the merge driver in $PROJECT/.git/config as follows: ``` [merge "mergeStrategy"] name = My merge strategy driver = scripts/mergeScript.sh ``...
You could simply add and commit (and push) `script/mergeScript` (along with the `.gitattributes` file, of course) That would work as long as: - `mergeScript` is somehow in the `$PATH` of the user executing the merge driver. - `mergeScript` is executable, `chmod +x` - `mergeScript` is without extension, to allow you t...
6300239
How to use Git in a sneakernet environment?
23
2011-06-09 22:56:16
<p>My project has a number of test PCs which are 100% off-net. We use a USB drive to transfer files to and from these PCs. Some development happens during the tests on those PCs. We transfer zips of the updated files, with the 'version info' coded in the name of the zip file.</p> <p>My question is how best to use Git f...
4,046
717,355
2022-06-11 07:47:32
6,300,260
14
2011-06-09 22:58:55
81,071
2011-06-09 22:58:55
https://stackoverflow.com/q/6300239
https://stackoverflow.com/a/6300260
<p>Using Git with unconnected computers is easy with <code>git bundle</code>.</p> <p>See its <a href="http://www.kernel.org/pub/software/scm/git/docs/git-bundle.html" rel="noreferrer">man page</a>.</p>
<p>Using Git with unconnected computers is easy with <code>git bundle</code>.</p> <p>See its <a href="http://www.kernel.org/pub/software/scm/git/docs/git-bundle.html" rel="noreferrer">man page</a>.</p>
119, 456
git, version-control
<h1>How to use Git in a sneakernet environment?</h1> <p>My project has a number of test PCs which are 100% off-net. We use a USB drive to transfer files to and from these PCs. Some development happens during the tests on those PCs. We transfer zips of the updated files, with the 'version info' coded in the name of the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,134
git
# How to use Git in a sneakernet environment? My project has a number of test PCs which are 100% off-net. We use a USB drive to transfer files to and from these PCs. Some development happens during the tests on those PCs. We transfer zips of the updated files, with the 'version info' coded in the name of the zip file....
Using Git with unconnected computers is easy with `git bundle`. See its [man page](http://www.kernel.org/pub/software/scm/git/docs/git-bundle.html).
996164
Is anyone really using git super/subprojects?
23
2009-06-15 13:38:36
<p>Is anyone using the new git super/subproject feature in real projects? How well does it work? For instance, I understand that if I push to a subproject I have to manually call superprojects hooks (maybe using the subprojects hook, but nevertheless)?</p>
16,304
94,895
2014-12-19 13:46:52
997,936
14
2009-06-15 19:33:25
6,309
2014-12-19 13:46:52
https://stackoverflow.com/q/996164
https://stackoverflow.com/a/997936
<p>By using submodule, you are defining in your Git workspace (meaning your "super-project" Git repository) a <strong>configuration</strong>.<br> By "configuration", I mean "the list of tags or SHA-1 node necessary to work in your workspace".<br> (and by work, I mean whatever "development effort" you are doing within y...
<p>By using submodule, you are defining in your Git workspace (meaning your "super-project" Git repository) a <strong>configuration</strong>.<br> By "configuration", I mean "the list of tags or SHA-1 node necessary to work in your workspace".<br> (and by work, I mean whatever "development effort" you are doing within y...
119
git
<h1>Is anyone really using git super/subprojects?</h1> <p>Is anyone using the new git super/subproject feature in real projects? How well does it work? For instance, I understand that if I push to a subproject I have to manually call superprojects hooks (maybe using the subprojects hook, but nevertheless)?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,135
git
# Is anyone really using git super/subprojects? Is anyone using the new git super/subproject feature in real projects? How well does it work? For instance, I understand that if I push to a subproject I have to manually call superprojects hooks (maybe using the subprojects hook, but nevertheless)?
By using submodule, you are defining in your Git workspace (meaning your "super-project" Git repository) a **configuration**. By "configuration", I mean "the list of tags or SHA-1 node necessary to work in your workspace". (and by work, I mean whatever "development effort" you are doing within your workspace: class...
35738680
Avoiding "warning: There are too many unreachable loose objects" during git svn clone/fetch
22
2016-03-02 04:43:23
<p>When running a <code>git svn clone</code> or <code>git svn fetch</code> against a large Subversion repository (100k+ commits), the fetch regularly stops with:</p> <pre><code>Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping. error: The last gc run reported ...
20,424
452,210
2021-09-21 20:23:52
35,738,745
14
2016-03-02 04:49:18
152,948
2016-06-22 01:09:39
https://stackoverflow.com/q/35738680
https://stackoverflow.com/a/35738745
<p>I think if you set the config option <code>gc.pruneExpire</code> to <code>now</code>, at least temporarily during the import, it will avoid that message. With that option set, <code>git gc</code> will immediately delete <em>all</em> unreachable objects, instead of only ones that are at least two weeks old (the defau...
<p>I think if you set the config option <code>gc.pruneExpire</code> to <code>now</code>, at least temporarily during the import, it will avoid that message. With that option set, <code>git gc</code> will immediately delete <em>all</em> unreachable objects, instead of only ones that are at least two weeks old (the defau...
119, 6452
git, git-svn
<h1>Avoiding "warning: There are too many unreachable loose objects" during git svn clone/fetch</h1> <p>When running a <code>git svn clone</code> or <code>git svn fetch</code> against a large Subversion repository (100k+ commits), the fetch regularly stops with:</p> <pre><code>Auto packing the repository in background...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,137
git
# Avoiding "warning: There are too many unreachable loose objects" during git svn clone/fetch When running a `git svn clone` or `git svn fetch` against a large Subversion repository (100k+ commits), the fetch regularly stops with: ``` Auto packing the repository in background for optimum performance. See "git help gc...
I think if you set the config option `gc.pruneExpire` to `now`, at least temporarily during the import, it will avoid that message. With that option set, `git gc` will immediately delete *all* unreachable objects, instead of only ones that are at least two weeks old (the default). Coupled with a sensible value for `gc....
13514182
Git - How to revert a rebase that has been pushed to the remote branch (not origin)
22
2012-11-22 13:52:40
<p>I was working on my local branch doing some changes and when I finished I pushed everything to the remote brach. Before merging the branch with develop I thought I should do a rebase cos the other guys had merged a lot of their code there. When I did the rebase and resolved some conflicts I pushed to the remote bran...
43,421
1,844,566
2025-06-24 17:17:28
13,514,702
14
2012-11-22 14:23:48
636,626
2012-11-22 16:34:33
https://stackoverflow.com/q/13514182
https://stackoverflow.com/a/13514702
<p>You should not rewrite the history of remote repositories because if</p> <ol> <li>You push something broken</li> <li>Somebody pulls</li> <li>You force-push a different history</li> </ol> <p>not only would you have the issue of having to fix the mess but everybody else who pulled the changes. So unless you can be s...
<p>You should not rewrite the history of remote repositories because if</p> <ol> <li>You push something broken</li> <li>Somebody pulls</li> <li>You force-push a different history</li> </ol> <p>not only would you have the issue of having to fix the mess but everybody else who pulled the changes. So unless you can be s...
119, 29934
git, git-rebase
<h1>Git - How to revert a rebase that has been pushed to the remote branch (not origin)</h1> <p>I was working on my local branch doing some changes and when I finished I pushed everything to the remote brach. Before merging the branch with develop I thought I should do a rebase cos the other guys had merged a lot of th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,138
git
# Git - How to revert a rebase that has been pushed to the remote branch (not origin) I was working on my local branch doing some changes and when I finished I pushed everything to the remote brach. Before merging the branch with develop I thought I should do a rebase cos the other guys had merged a lot of their code ...
You should not rewrite the history of remote repositories because if 1. You push something broken 2. Somebody pulls 3. You force-push a different history not only would you have the issue of having to fix the mess but everybody else who pulled the changes. So unless you can be sure that nobody pulled it, *don't do a ...
40424928
Is there a way to output the previous git branch name?
21
2016-11-04 14:16:35
<p>This answer tells how to checkout to the previous branch, and helpfully explains <code>@{-1}</code>: <a href="https://stackoverflow.com/a/7207542/3150057">https://stackoverflow.com/a/7207542/3150057</a></p> <p>The previous branch is important if I stashed some code before changing branch, and am now thinking about ...
4,677
3,150,057
2023-04-17 09:44:32
40,425,123
14
2016-11-04 14:25:59
147,356
2016-11-04 14:25:59
https://stackoverflow.com/q/40424928
https://stackoverflow.com/a/40425123
<p>Maybe this is what you want:</p> <pre><code>git describe --all $(git rev-parse @{-1}) </code></pre> <p>From the <code>git-describe</code> man page:</p> <blockquote> <p><code>--all</code></p> <p>Instead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching an...
<p>Maybe this is what you want:</p> <pre><code>git describe --all $(git rev-parse @{-1}) </code></pre> <p>From the <code>git-describe</code> man page:</p> <blockquote> <p><code>--all</code></p> <p>Instead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching an...
119, 1879, 13091, 37230, 79719
branch, git, git-checkout, git-reflog, git-stash
<h1>Is there a way to output the previous git branch name?</h1> <p>This answer tells how to checkout to the previous branch, and helpfully explains <code>@{-1}</code>: <a href="https://stackoverflow.com/a/7207542/3150057">https://stackoverflow.com/a/7207542/3150057</a></p> <p>The previous branch is important if I stas...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,139
git
# Is there a way to output the previous git branch name? This answer tells how to checkout to the previous branch, and helpfully explains `@{-1}`: <https://stackoverflow.com/a/7207542/3150057> The previous branch is important if I stashed some code before changing branch, and am now thinking about working on the stas...
Maybe this is what you want: ``` git describe --all $(git rev-parse @{-1}) ``` From the `git-describe` man page: > `--all` > > Instead of using only the annotated tags, use any ref found in refs/ > namespace. This option enables matching any known branch, > remote-tracking branch, or lightweight tag. So for example...
15769298
git blame: correct author after merge
21
2013-04-02 16:26:44
<p>A GIT merge introduces a new commit. This causes problems with "git blame": the merged lines appear to be committed by the developer that did the merge.</p> <p>I can understand this being the case for <em>conflicting changes</em> (because he solved the conflicts). But is there a way to not have this happening for n...
7,261
942,823
2015-09-21 02:00:06
15,769,756
14
2013-04-02 16:50:11
1,471,829
2013-04-02 16:50:11
https://stackoverflow.com/q/15769298
https://stackoverflow.com/a/15769756
<p>Internally <code>git blame</code> uses <code>git rev-list</code> to create the revision list. And <code>git rev-list</code> accepts the <code>--no-merges</code> option.</p> <p>So you can do:</p> <pre><code>git blame --no-merges &lt;file&gt; </code></pre>
<p>Internally <code>git blame</code> uses <code>git rev-list</code> to create the revision list. And <code>git rev-list</code> accepts the <code>--no-merges</code> option.</p> <p>So you can do:</p> <pre><code>git blame --no-merges &lt;file&gt; </code></pre>
119, 717, 5681, 21455, 28897
annotate, blame, git, git-merge, merge
<h1>git blame: correct author after merge</h1> <p>A GIT merge introduces a new commit. This causes problems with "git blame": the merged lines appear to be committed by the developer that did the merge.</p> <p>I can understand this being the case for <em>conflicting changes</em> (because he solved the conflicts). But ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,140
git
# git blame: correct author after merge A GIT merge introduces a new commit. This causes problems with "git blame": the merged lines appear to be committed by the developer that did the merge. I can understand this being the case for *conflicting changes* (because he solved the conflicts). But is there a way to not h...
Internally `git blame` uses `git rev-list` to create the revision list. And `git rev-list` accepts the `--no-merges` option. So you can do: ``` git blame --no-merges <file> ```
7631579
I've just deleted one week of work! How to undo git rm -r --cached?
21
2011-10-03 06:10:07
<p>I commited a wrong file, so I wanted to clean it up, but accidentally I overwrote all my files in the directory with last files committed to git.</p> <p>Help please!</p> <p>What I did:</p> <pre><code>git add fileIdidnotwanttoadd git rm -r --cached . git reset --hard HEAD </code></pre> <p>result: All my fixes are...
14,884
974,139
2016-06-06 20:39:14
7,634,443
14
2011-10-03 11:37:17
85,371
2011-10-03 11:37:17
https://stackoverflow.com/q/7631579
https://stackoverflow.com/a/7634443
<p>(from: <a href="https://stackoverflow.com/questions/5788037/recover-from-git-reset-hard/5788069#5788069">Recover from git reset --hard?</a>)</p> <p>You <em>cannot</em> get back uncommitted changes in general, so the real answer here would be: look at your backup. <strong>Perhaps your editor/IDE stores temp copies u...
<p>(from: <a href="https://stackoverflow.com/questions/5788037/recover-from-git-reset-hard/5788069#5788069">Recover from git reset --hard?</a>)</p> <p>You <em>cannot</em> get back uncommitted changes in general, so the real answer here would be: look at your backup. <strong>Perhaps your editor/IDE stores temp copies u...
119
git
<h1>I've just deleted one week of work! How to undo git rm -r --cached?</h1> <p>I commited a wrong file, so I wanted to clean it up, but accidentally I overwrote all my files in the directory with last files committed to git.</p> <p>Help please!</p> <p>What I did:</p> <pre><code>git add fileIdidnotwanttoadd git rm -...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,142
git
# I've just deleted one week of work! How to undo git rm -r --cached? I commited a wrong file, so I wanted to clean it up, but accidentally I overwrote all my files in the directory with last files committed to git. Help please! What I did: ``` git add fileIdidnotwanttoadd git rm -r --cached . git reset --hard HEAD...
(from: [Recover from git reset --hard?](https://stackoverflow.com/questions/5788037/recover-from-git-reset-hard/5788069#5788069)) You *cannot* get back uncommitted changes in general, so the real answer here would be: look at your backup. **Perhaps your editor/IDE stores temp copies under /tmp** or C:\TEMP and things ...
7392155
Why does git run "git gc --auto" on every merge?
21
2011-09-12 18:22:51
<p>Today, git started acting funny (well, funnier than usual) by insisting on running <code>git gc</code> after every single merge, even if they are back to back.</p> <pre><code>C:\Projects\my-current-project&gt;git pull remote: Counting objects: 31, done. remote: Compressing objects: 100% (16/16), done. remote: Total...
13,303
393,077
2020-03-06 19:42:08
7,392,195
14
2011-09-12 18:26:58
85,371
2020-03-06 19:42:08
https://stackoverflow.com/q/7392155
https://stackoverflow.com/a/7392195
<p><strong>EDIT</strong></p> <p>I think I spotted the problem.</p> <p>You are probably running Cygwin/git or MsysGit on Windows. I noticed that because of the</p> <pre><code>FIND: Parameter format not correct </code></pre> <p>error message. The trouble is that somewhere your hook scripts (or git internally?!) is ca...
<p><strong>EDIT</strong></p> <p>I think I spotted the problem.</p> <p>You are probably running Cygwin/git or MsysGit on Windows. I noticed that because of the</p> <pre><code>FIND: Parameter format not correct </code></pre> <p>error message. The trouble is that somewhere your hook scripts (or git internally?!) is ca...
119
git
<h1>Why does git run "git gc --auto" on every merge?</h1> <p>Today, git started acting funny (well, funnier than usual) by insisting on running <code>git gc</code> after every single merge, even if they are back to back.</p> <pre><code>C:\Projects\my-current-project&gt;git pull remote: Counting objects: 31, done. remo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,143
git
# Why does git run "git gc --auto" on every merge? Today, git started acting funny (well, funnier than usual) by insisting on running `git gc` after every single merge, even if they are back to back. ``` C:\Projects\my-current-project>git pull remote: Counting objects: 31, done. remote: Compressing objects: 100% (16/...
**EDIT** I think I spotted the problem. You are probably running Cygwin/git or MsysGit on Windows. I noticed that because of the ``` FIND: Parameter format not correct ``` error message. The trouble is that somewhere your hook scripts (or git internally?!) is calling find, which does not find the UNIX (GNU) find ut...
52995503
How can I reset a Git repository to its newly-cloned state?
20
2018-10-25 18:03:45
<p>Is there a git statement that has the same result as a fresh git clone?</p> <p>So even if there are extra branches, extra files, other files, local tags anything... which command can accomplish this?</p>
20,486
5,262,019
2023-12-28 00:51:02
52,995,940
14
2018-10-25 18:32:20
2,988,730
2022-03-22 10:30:13
https://stackoverflow.com/q/52995503
https://stackoverflow.com/a/52995940
<p>Your best option to remove all local artifacts is to make a fresh <a href="https://git-scm.com/docs/git-clone" rel="noreferrer">clone</a>.</p> <p>Otherwise, you have to run different commands to perform the individual components of the cleanup.</p> <p>To get rid of all untracked files, use <a href="https://git-scm.c...
<p>Your best option to remove all local artifacts is to make a fresh <a href="https://git-scm.com/docs/git-clone" rel="noreferrer">clone</a>.</p> <p>Otherwise, you have to run different commands to perform the individual components of the cleanup.</p> <p>To get rid of all untracked files, use <a href="https://git-scm.c...
119, 51381
git, git-reset
<h1>How can I reset a Git repository to its newly-cloned state?</h1> <p>Is there a git statement that has the same result as a fresh git clone?</p> <p>So even if there are extra branches, extra files, other files, local tags anything... which command can accomplish this?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,144
git
# How can I reset a Git repository to its newly-cloned state? Is there a git statement that has the same result as a fresh git clone? So even if there are extra branches, extra files, other files, local tags anything... which command can accomplish this?
Your best option to remove all local artifacts is to make a fresh [clone](https://git-scm.com/docs/git-clone). Otherwise, you have to run different commands to perform the individual components of the cleanup. To get rid of all untracked files, use [`git clean`](https://git-scm.com/docs/git-clean), with any number of...
22017029
What git hooks apply to 'git rebase --continue'?
20
2014-02-25 14:24:50
<p>I'm trying to build a set of git hook scripts for my organization, and one I would like to use (for multiple project just for myself) would be to check upon a <code>git rebase --continue</code> that I don't have any conflicts markers leftover in my code (<code>&lt;&lt;&lt;&lt;&lt;</code>, <code>=====</code>, or <cod...
7,268
43,265
2025-05-27 20:18:03
22,017,539
14
2014-02-25 14:44:24
43,681
2014-02-25 14:44:24
https://stackoverflow.com/q/22017029
https://stackoverflow.com/a/22017539
<p>The manpage <a href="https://www.kernel.org/pub/software/scm/git/docs/githooks.html" rel="noreferrer"><code>githooks</code></a> has a list of the available git hooks. There is no hook for <code>git rebase --continue</code> (the list is exhaustive).</p> <p>There is a hook "post-rewrite", which "is invoked by command...
<p>The manpage <a href="https://www.kernel.org/pub/software/scm/git/docs/githooks.html" rel="noreferrer"><code>githooks</code></a> has a list of the available git hooks. There is no hook for <code>git rebase --continue</code> (the list is exhaustive).</p> <p>There is a hook "post-rewrite", which "is invoked by command...
119, 29934, 43087
git, githooks, git-rebase
<h1>What git hooks apply to 'git rebase --continue'?</h1> <p>I'm trying to build a set of git hook scripts for my organization, and one I would like to use (for multiple project just for myself) would be to check upon a <code>git rebase --continue</code> that I don't have any conflicts markers leftover in my code (<cod...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,145
git
# What git hooks apply to 'git rebase --continue'? I'm trying to build a set of git hook scripts for my organization, and one I would like to use (for multiple project just for myself) would be to check upon a `git rebase --continue` that I don't have any conflicts markers leftover in my code (`<<<<<`, `=====`, or `>>...
The manpage [`githooks`](https://www.kernel.org/pub/software/scm/git/docs/githooks.html) has a list of the available git hooks. There is no hook for `git rebase --continue` (the list is exhaustive). There is a hook "post-rewrite", which "is invoked by commands that rewrite commits", such as `git rebase`. However, it o...
16573555
Show conflict diff part of a merge
20
2013-05-15 19:36:19
<p>I need to present to the team what changes I've made during conflict resolution of a merge.</p> <p>I know this is kind of hard, but I certainly believe it is possible somehow. I've tried already <code>git show -m</code> and <code>git show -c</code>.</p>
17,781
670,229
2019-06-28 18:55:10
16,574,206
14
2013-05-15 20:17:50
236,871
2013-05-17 11:32:03
https://stackoverflow.com/q/16573555
https://stackoverflow.com/a/16574206
<p>Look at the hash (or tag) of the merge commit (the commit that has multiple parents) and do:</p> <pre><code>git diff hash hash^1 hash^2 </code></pre> <p>It will output a 3 way-diff of the changes.</p> <p><code>hash^</code> (or <code>hash^1</code>) references the <em>first</em> parent commit of <code>hash</code><b...
<p>Look at the hash (or tag) of the merge commit (the commit that has multiple parents) and do:</p> <pre><code>git diff hash hash^1 hash^2 </code></pre> <p>It will output a 3 way-diff of the changes.</p> <p><code>hash^</code> (or <code>hash^1</code>) references the <em>first</em> parent commit of <code>hash</code><b...
119, 717, 62599
git, merge, merge-conflict-resolution
<h1>Show conflict diff part of a merge</h1> <p>I need to present to the team what changes I've made during conflict resolution of a merge.</p> <p>I know this is kind of hard, but I certainly believe it is possible somehow. I've tried already <code>git show -m</code> and <code>git show -c</code>.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,148
git
# Show conflict diff part of a merge I need to present to the team what changes I've made during conflict resolution of a merge. I know this is kind of hard, but I certainly believe it is possible somehow. I've tried already `git show -m` and `git show -c`.
Look at the hash (or tag) of the merge commit (the commit that has multiple parents) and do: ``` git diff hash hash^1 hash^2 ``` It will output a 3 way-diff of the changes. `hash^` (or `hash^1`) references the *first* parent commit of `hash` `hash^2` references the *second* parent commit of `hash`
8562544
Executing git commands via PHP
20
2011-12-19 14:09:46
<p>How can git commands like <code>git add .</code> and <code>git commit -m</code> be executed using php?</p> <p>It is for a project that creates a centralized repository facility for maintaining academic projects.</p> <p>exec() didn't seem to work.</p> <pre><code>&lt;?php $path = "/var/www/repos/$_POST[project]"; ...
33,405
943,646
2021-05-07 10:33:54
8,562,666
14
2011-12-19 14:20:06
1,052,189
2011-12-19 14:20:06
https://stackoverflow.com/q/8562544
https://stackoverflow.com/a/8562666
<p>It is definetly possible. I implemented it in one of my projects. However you should be careful about permissions.</p> <p>On linux, usually, the <code>exec</code> command will execute using the <code>www-data</code> user. So you should allow <code>www-data</code> to write and read on your work directory.</p> <p>On...
<p>It is definetly possible. I implemented it in one of my projects. However you should be careful about permissions.</p> <p>On linux, usually, the <code>exec</code> command will execute using the <code>www-data</code> user. So you should allow <code>www-data</code> to write and read on your work directory.</p> <p>On...
5, 119, 7932
exec, git, php
<h1>Executing git commands via PHP</h1> <p>How can git commands like <code>git add .</code> and <code>git commit -m</code> be executed using php?</p> <p>It is for a project that creates a centralized repository facility for maintaining academic projects.</p> <p>exec() didn't seem to work.</p> <pre><code>&lt;?php $pa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,149
git
# Executing git commands via PHP How can git commands like `git add .` and `git commit -m` be executed using php? It is for a project that creates a centralized repository facility for maintaining academic projects. exec() didn't seem to work. ``` <?php $path = "/var/www/repos/$_POST[project]"; $a=''; chdir($path)...
It is definetly possible. I implemented it in one of my projects. However you should be careful about permissions. On linux, usually, the `exec` command will execute using the `www-data` user. So you should allow `www-data` to write and read on your work directory. One quick and dirty way to do it is : `chmod o+rw -R...
5101485
Is there any way to list all git repositories in terminal?
20
2011-02-24 07:06:53
<p>I have several git repositories on my system and I want to list them all in terminal.</p> <p>What I'm looking for is something like this:</p> <pre class="lang-none prettyprint-override"><code>/path/to/my/git/repo/1/ REPONAME1 /path/to/my/git/repo/2/ REPONAME2 /path/to/my/git/repo/3/ REPONAME3 </code></pre> <p>If...
42,674
374,783
2024-06-20 10:14:39
5,103,041
14
2011-02-24 09:59:53
632,069
2015-09-26 19:47:16
https://stackoverflow.com/q/5101485
https://stackoverflow.com/a/5103041
<p>To list all the git repositories you have on your system you can run the following command in a bash shell terminal (at the command line) and find them.</p> <pre><code>find / -name .git -type d -exec dirname {} \; </code></pre>
<p>To list all the git repositories you have on your system you can run the following command in a bash shell terminal (at the command line) and find them.</p> <pre><code>find / -name .git -type d -exec dirname {} \; </code></pre>
119, 391
git, terminal
<h1>Is there any way to list all git repositories in terminal?</h1> <p>I have several git repositories on my system and I want to list them all in terminal.</p> <p>What I'm looking for is something like this:</p> <pre class="lang-none prettyprint-override"><code>/path/to/my/git/repo/1/ REPONAME1 /path/to/my/git/repo/...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,150
git
# Is there any way to list all git repositories in terminal? I have several git repositories on my system and I want to list them all in terminal. What I'm looking for is something like this: ``` /path/to/my/git/repo/1/ REPONAME1 /path/to/my/git/repo/2/ REPONAME2 /path/to/my/git/repo/3/ REPONAME3 ``` If you can...
To list all the git repositories you have on your system you can run the following command in a bash shell terminal (at the command line) and find them. ``` find / -name .git -type d -exec dirname {} \; ```
3763039
git command to emit name of remote tracking branch
20
2010-09-21 17:53:50
<p>I'd like a command that emits the name of the tracked branch for the branch I'm on. Something like:</p> <pre><code>$ git checkout --track -b topic origin/master Branch topic set up to track remote branch master from origin. Switched to a new branch 'topic' $ git unknown-command origin/master </code></pre> <p>Is t...
2,088
280,043
2015-01-28 19:02:51
3,763,075
14
2010-09-21 17:58:30
148,870
2010-09-21 18:04:40
https://stackoverflow.com/q/3763039
https://stackoverflow.com/a/3763075
<p>Will emit the remote being tracked:</p> <pre><code>git config branch.&lt;branchname&gt;.remote </code></pre> <p>Will emit the ref being tracked on that remote:</p> <pre><code>git config branch.&lt;branchname&gt;.merge </code></pre> <p>I don't believe that there is a combined command that will emit both together ...
<p>Will emit the remote being tracked:</p> <pre><code>git config branch.&lt;branchname&gt;.remote </code></pre> <p>Will emit the ref being tracked on that remote:</p> <pre><code>git config branch.&lt;branchname&gt;.merge </code></pre> <p>I don't believe that there is a combined command that will emit both together ...
119, 1879
branch, git
<h1>git command to emit name of remote tracking branch</h1> <p>I'd like a command that emits the name of the tracked branch for the branch I'm on. Something like:</p> <pre><code>$ git checkout --track -b topic origin/master Branch topic set up to track remote branch master from origin. Switched to a new branch 'topic...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,151
git
# git command to emit name of remote tracking branch I'd like a command that emits the name of the tracked branch for the branch I'm on. Something like: ``` $ git checkout --track -b topic origin/master Branch topic set up to track remote branch master from origin. Switched to a new branch 'topic' $ git unknown-comma...
Will emit the remote being tracked: ``` git config branch.<branchname>.remote ``` Will emit the ref being tracked on that remote: ``` git config branch.<branchname>.merge ``` I don't believe that there is a combined command that will emit both together (at least within normal Git; you could always make your own). ...
50741967
add checkstyle as pre-commit git hook
19
2018-06-07 13:03:06
<p>I am trying to add this: <a href="https://gist.github.com/davetron5000/37350" rel="noreferrer">https://gist.github.com/davetron5000/37350</a> checkstyle code format check as pre-commit git hook. </p> <p>I followed the instructions below but it doesn't work.</p> <p>Steps I've tried:</p> <blockquote> <ol> <li>C...
13,219
7,677,457
2023-05-18 06:59:01
50,748,292
14
2018-06-07 18:48:44
7,677,457
2018-06-15 09:18:05
https://stackoverflow.com/q/50741967
https://stackoverflow.com/a/50748292
<p>Okay seems as i found a solution finally. I added some comments to the instructions how i made it work.</p> <pre><code> 1. checkstyle's jar file somewhere 2. a checkstyle XML check file somewhere 3. To configure git: * git config --add checkstyle.jar &lt;location of jar&gt; * git config --add checkstyle.che...
<p>Okay seems as i found a solution finally. I added some comments to the instructions how i made it work.</p> <pre><code> 1. checkstyle's jar file somewhere 2. a checkstyle XML check file somewhere 3. To configure git: * git config --add checkstyle.jar &lt;location of jar&gt; * git config --add checkstyle.che...
17, 119, 853, 10910
checkstyle, git, hook, java
<h1>add checkstyle as pre-commit git hook</h1> <p>I am trying to add this: <a href="https://gist.github.com/davetron5000/37350" rel="noreferrer">https://gist.github.com/davetron5000/37350</a> checkstyle code format check as pre-commit git hook. </p> <p>I followed the instructions below but it doesn't work.</p> <p>Ste...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,153
git
# add checkstyle as pre-commit git hook I am trying to add this: <https://gist.github.com/davetron5000/37350> checkstyle code format check as pre-commit git hook. I followed the instructions below but it doesn't work. Steps I've tried: > 1. Checkstyle's jar file somewhere > 2. Checkstyle XML check file somewhere > ...
Okay seems as i found a solution finally. I added some comments to the instructions how i made it work. ``` 1. checkstyle's jar file somewhere 2. a checkstyle XML check file somewhere 3. To configure git: * git config --add checkstyle.jar <location of jar> * git config --add checkstyle.checkfile <location of ...
26679856
How can I find out the git branch my current branch is based on?
19
2014-10-31 17:01:16
<p>This might be a simple question (maybe asked before?), but I haven't been able to find an answer (I really tried, I'm not just lazy :) ).</p> <p>I am working on a git branch that is based on another branch. However, I don't know which branch it is based on.</p> <p>Is there a command or a way to find out which bran...
9,589
932,201
2019-03-25 11:18:40
26,680,252
14
2014-10-31 17:24:56
1,256,452
2014-10-31 17:33:03
https://stackoverflow.com/q/26679856
https://stackoverflow.com/a/26680252
<p>There really is no such notion in git in the first place.</p> <p>This is perhaps best seen by example. Consider the following commit graph fragment:</p> <pre><code> o &lt;-- branchA / o--o--o \ o--o &lt;-- branchB </code></pre> <p>Here, "obviously" <code>branchB</code> comes from <co...
<p>There really is no such notion in git in the first place.</p> <p>This is perhaps best seen by example. Consider the following commit graph fragment:</p> <pre><code> o &lt;-- branchA / o--o--o \ o--o &lt;-- branchB </code></pre> <p>Here, "obviously" <code>branchB</code> comes from <co...
119, 1879
branch, git
<h1>How can I find out the git branch my current branch is based on?</h1> <p>This might be a simple question (maybe asked before?), but I haven't been able to find an answer (I really tried, I'm not just lazy :) ).</p> <p>I am working on a git branch that is based on another branch. However, I don't know which branch ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,156
git
# How can I find out the git branch my current branch is based on? This might be a simple question (maybe asked before?), but I haven't been able to find an answer (I really tried, I'm not just lazy :) ). I am working on a git branch that is based on another branch. However, I don't know which branch it is based on. ...
There really is no such notion in git in the first place. This is perhaps best seen by example. Consider the following commit graph fragment: ``` o <-- branchA / o--o--o \ o--o <-- branchB ``` Here, "obviously" `branchB` comes from `branchA`. But wait, there's more, there's a bit I left...
2093077
Default config settings for a new git repository?
19
2010-01-19 11:29:40
<p>When I create a new git repository, some configurations settings are automatically added to <strong>.git/config</strong>. Where can I change these default settings?</p>
9,687
70,894
2014-10-05 15:12:50
2,093,395
14
2010-01-19 12:25:43
6,309
2014-10-05 15:12:50
https://stackoverflow.com/q/2093077
https://stackoverflow.com/a/2093395
<p>Considering the option template of <a href="http://www.kernel.org/pub//software/scm/git/docs/git-init.html" rel="noreferrer"><code>git init</code></a>:</p> <pre><code> --template=&lt;template_directory&gt; </code></pre> <blockquote> <p>Provide the directory from which templates will be used. The default template...
<p>Considering the option template of <a href="http://www.kernel.org/pub//software/scm/git/docs/git-init.html" rel="noreferrer"><code>git init</code></a>:</p> <pre><code> --template=&lt;template_directory&gt; </code></pre> <blockquote> <p>Provide the directory from which templates will be used. The default template...
119, 725
configuration, git
<h1>Default config settings for a new git repository?</h1> <p>When I create a new git repository, some configurations settings are automatically added to <strong>.git/config</strong>. Where can I change these default settings?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,161
git
# Default config settings for a new git repository? When I create a new git repository, some configurations settings are automatically added to **.git/config**. Where can I change these default settings?
Considering the option template of [`git init`](http://www.kernel.org/pub//software/scm/git/docs/git-init.html): ``` --template=<template_directory> ``` > Provide the directory from which templates will be used. The default template directory is `/usr/share/git-core/templates`. > > When specified, `<template_directo...
55366930
When I use git stash I end up with <<<<<<< Updated upstream and other things in my files
18
2019-03-26 22:11:38
<p>I am using GitHub desktop and git command line (to basically stash my code when I need to make a commit on another branch). I use <code> git stash save</code> and save my code. I then update another branch and switch back to my testing branch which i update to master. I then unstash my code with <code>git stash p...
41,156
10,896,905
2022-12-23 19:07:41
55,367,049
14
2019-03-26 22:26:35
6,607,497
2019-03-26 22:37:49
https://stackoverflow.com/q/55366930
https://stackoverflow.com/a/55367049
<p>What happened was this: You changed a part ("Updated upstream") while your changes were stashed that was also changed in the stashed part ("Stashed changes"). So when restoring the stashed changes, there was a merge conflict.</p> <p>General advice: Do different things on different branches at different times, or do...
<p>What happened was this: You changed a part ("Updated upstream") while your changes were stashed that was also changed in the stashed part ("Stashed changes"). So when restoring the stashed changes, there was a merge conflict.</p> <p>General advice: Do different things on different branches at different times, or do...
119, 717
git, merge
<h1>When I use git stash I end up with <<<<<<< Updated upstream and other things in my files</h1> <p>I am using GitHub desktop and git command line (to basically stash my code when I need to make a commit on another branch). I use <code> git stash save</code> and save my code. I then update another branch and switch ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,162
git
# When I use git stash I end up with <<<<<<< Updated upstream and other things in my files I am using GitHub desktop and git command line (to basically stash my code when I need to make a commit on another branch). I use `git stash save` and save my code. I then update another branch and switch back to my testing bra...
What happened was this: You changed a part ("Updated upstream") while your changes were stashed that was also changed in the stashed part ("Stashed changes"). So when restoring the stashed changes, there was a merge conflict. General advice: Do different things on different branches at different times, or do different...
55225918
Git detect squash and merged branches
18
2019-03-18 16:28:48
<p>I want to know if there is a way to detect if a squashed (on remote after approving a pull request) branch is merged into develop. Usually, I use </p> <pre><code>git branch --merged </code></pre> <p>However, this seems not to work due to squashing.</p>
5,238
5,027,308
2024-08-22 01:52:37
55,226,185
14
2019-03-18 16:43:54
1,256,452
2019-03-18 16:43:54
https://stackoverflow.com/q/55225918
https://stackoverflow.com/a/55226185
<p>The short answer is that there's no general yet reliable way to tell.</p> <p>In many specific cases, it's easy to tell by comparing the <em>contents</em> of the new commit added to the upstream repository to the <em>contents</em> of the merge you proposed. That is, in <em>your</em> repository—and/or on the clone y...
<p>The short answer is that there's no general yet reliable way to tell.</p> <p>In many specific cases, it's easy to tell by comparing the <em>contents</em> of the new commit added to the upstream repository to the <em>contents</em> of the merge you proposed. That is, in <em>your</em> repository—and/or on the clone y...
119, 456
git, version-control
<h1>Git detect squash and merged branches</h1> <p>I want to know if there is a way to detect if a squashed (on remote after approving a pull request) branch is merged into develop. Usually, I use </p> <pre><code>git branch --merged </code></pre> <p>However, this seems not to work due to squashing.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,163
git
# Git detect squash and merged branches I want to know if there is a way to detect if a squashed (on remote after approving a pull request) branch is merged into develop. Usually, I use ``` git branch --merged ``` However, this seems not to work due to squashing.
The short answer is that there's no general yet reliable way to tell. In many specific cases, it's easy to tell by comparing the *contents* of the new commit added to the upstream repository to the *contents* of the merge you proposed. That is, in *your* repository—and/or on the clone you control on GitHub, if you and...
48368670
Sentry token in repository via sentry.properties
18
2018-01-21 15:54:14
<p>While my DSN is in a .env file and hidden from the repo browsers, I find it disturbing that my auth token is in the sentry.properties file for all to see.<br> I'm having trouble understanding what this means and how much of a security risk is it to let people outside my organization read this file?<br> (I have outso...
9,038
9,047,108
2021-05-06 07:56:22
48,376,918
14
2018-01-22 07:56:49
1,139,707
2018-01-23 11:34:52
https://stackoverflow.com/q/48368670
https://stackoverflow.com/a/48376918
<p>We recommend treating a <code>sentry.properties</code> like an <code>.env</code> file. </p> <p>It is basically the same, so you should add it to your e.g. <code>.gitignore</code>.</p> <p>The reason why it's called <code>sentry.properties</code> is because of android gradle, we needed it to be read natively.</p>
<p>We recommend treating a <code>sentry.properties</code> like an <code>.env</code> file. </p> <p>It is basically the same, so you should add it to your e.g. <code>.gitignore</code>.</p> <p>The reason why it's called <code>sentry.properties</code> is because of android gradle, we needed it to be read natively.</p>
119, 64340, 110853
git, react-native, sentry
<h1>Sentry token in repository via sentry.properties</h1> <p>While my DSN is in a .env file and hidden from the repo browsers, I find it disturbing that my auth token is in the sentry.properties file for all to see.<br> I'm having trouble understanding what this means and how much of a security risk is it to let people...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,164
git
# Sentry token in repository via sentry.properties While my DSN is in a .env file and hidden from the repo browsers, I find it disturbing that my auth token is in the sentry.properties file for all to see. I'm having trouble understanding what this means and how much of a security risk is it to let people outside my...
We recommend treating a `sentry.properties` like an `.env` file. It is basically the same, so you should add it to your e.g. `.gitignore`. The reason why it's called `sentry.properties` is because of android gradle, we needed it to be read natively.
24921595
How to replicate git-checkout using only plumbing commands?
18
2014-07-23 21:44:50
<p>I would like to avoid calling porcelain commands from my scripts, but is there a way to get some of the behavior of <code>git checkout &lt;commit&gt;</code> using only plumbing commands like <code>checkout-index</code>? I'm particularly interested in the effect on the working copy: assuming everything is clean, <cod...
1,375
823,869
2014-07-28 05:56:18
24,986,880
14
2014-07-28 00:02:23
1,290,731
2014-07-28 00:02:23
https://stackoverflow.com/q/24921595
https://stackoverflow.com/a/24986880
<p>You're looking for <a href="https://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_two_tree_merge" rel="noreferrer">the two-tree <code>git read-tree -um</code></a>. It uses a base tree, (generally you feed it <code>HEAD</code>), a target tree, and (implicitly) the index and worktree. The table descri...
<p>You're looking for <a href="https://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_two_tree_merge" rel="noreferrer">the two-tree <code>git read-tree -um</code></a>. It uses a base tree, (generally you feed it <code>HEAD</code>), a target tree, and (implicitly) the index and worktree. The table descri...
119, 37230, 106016
git, git-checkout, git-plumbing
<h1>How to replicate git-checkout using only plumbing commands?</h1> <p>I would like to avoid calling porcelain commands from my scripts, but is there a way to get some of the behavior of <code>git checkout &lt;commit&gt;</code> using only plumbing commands like <code>checkout-index</code>? I'm particularly interested ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,168
git
# How to replicate git-checkout using only plumbing commands? I would like to avoid calling porcelain commands from my scripts, but is there a way to get some of the behavior of `git checkout <commit>` using only plumbing commands like `checkout-index`? I'm particularly interested in the effect on the working copy: as...
You're looking for [the two-tree `git read-tree -um`](https://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_two_tree_merge). It uses a base tree, (generally you feed it `HEAD`), a target tree, and (implicitly) the index and worktree. The table describing its behavior was hard for me to understand so I ha...
18169639
Difference between 'git push -f' and 'deleting remote branch and push again'
18
2013-08-11 07:12:39
<p>When I found my <del>wrong</del> mistakes at remote branch, I always delete this, squash locally and push again. Because I heard 'git push -f' was dangerous. However I noticed push result showing after git fetch is some thing like below.</p> <p>new BRANCH_NAME "(force)"</p> <p>My workflow deleting and pushing agai...
5,020
1,885,622
2014-04-08 15:55:11
18,172,321
14
2013-08-11 13:17:39
1,036,728
2013-08-11 13:17:39
https://stackoverflow.com/q/18169639
https://stackoverflow.com/a/18172321
<p>Functionally, deleting and pushing again is <em>at least as dangerous</em> as <code>git push -f</code>.</p> <p>However, deleting and pushing again is actually worse than <code>git -f push</code> for a very specific reason:</p> <p>At least with <code>git -f push</code>, the <strong>replacement is atomic</strong>.</...
<p>Functionally, deleting and pushing again is <em>at least as dangerous</em> as <code>git push -f</code>.</p> <p>However, deleting and pushing again is actually worse than <code>git -f push</code> for a very specific reason:</p> <p>At least with <code>git -f push</code>, the <strong>replacement is atomic</strong>.</...
119
git
<h1>Difference between 'git push -f' and 'deleting remote branch and push again'</h1> <p>When I found my <del>wrong</del> mistakes at remote branch, I always delete this, squash locally and push again. Because I heard 'git push -f' was dangerous. However I noticed push result showing after git fetch is some thing like ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,169
git
# Difference between 'git push -f' and 'deleting remote branch and push again' When I found my ~~wrong~~ mistakes at remote branch, I always delete this, squash locally and push again. Because I heard 'git push -f' was dangerous. However I noticed push result showing after git fetch is some thing like below. new BRAN...
Functionally, deleting and pushing again is *at least as dangerous* as `git push -f`. However, deleting and pushing again is actually worse than `git -f push` for a very specific reason: At least with `git -f push`, the **replacement is atomic**. Albeit, this isn't a big deal when you're working solo. 1. When you u...
7985325
What's the fastest way to work in git over a slow network connection?
18
2011-11-02 18:19:23
<p>Here's the scenario: At work we have quite a few branches and we haven't kept the repo as tidy as we should, occasionally adding/removing large files or whatnot, and rarely removing dead branches.</p> <p>So today is a snow day and I have to work from home. I have a slow VPN connection, and all I need is the faste...
14,756
1,026,023
2020-06-19 19:05:01
7,985,731
14
2011-11-02 18:48:13
496,405
2014-06-23 11:09:08
https://stackoverflow.com/q/7985325
https://stackoverflow.com/a/7985731
<p>Doing a little test here, i was able to do the following...</p> <p>We have a shared --bare repo out on the network</p> <p>i have the remote setup as <code>git remote add origin &lt;pathToSharedRepo&gt;</code><br> i do a <code>git pull origin &lt;branch&gt; --depth=1</code> (not at <code>git fetch</code> but <code...
<p>Doing a little test here, i was able to do the following...</p> <p>We have a shared --bare repo out on the network</p> <p>i have the remote setup as <code>git remote add origin &lt;pathToSharedRepo&gt;</code><br> i do a <code>git pull origin &lt;branch&gt; --depth=1</code> (not at <code>git fetch</code> but <code...
119, 633
git, vpn
<h1>What's the fastest way to work in git over a slow network connection?</h1> <p>Here's the scenario: At work we have quite a few branches and we haven't kept the repo as tidy as we should, occasionally adding/removing large files or whatnot, and rarely removing dead branches.</p> <p>So today is a snow day and I hav...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,170
git
# What's the fastest way to work in git over a slow network connection? Here's the scenario: At work we have quite a few branches and we haven't kept the repo as tidy as we should, occasionally adding/removing large files or whatnot, and rarely removing dead branches. So today is a snow day and I have to work from ho...
Doing a little test here, i was able to do the following... We have a shared --bare repo out on the network i have the remote setup as `git remote add origin <pathToSharedRepo>` i do a `git pull origin <branch> --depth=1` (not at `git fetch` but `git pull`) this successfully pulls only the "HEAD + depth" commits f...
21262997
What is the format for valid Git repo names?
17
2014-01-21 15:56:06
<p>I'm a Git noob and using GitExtensions (GE) I'm constantly having problems with "{name} is not a valid remote name". One minute GE will not allow me to add the name, then if I try to re-add it without a single name/path change GE accepts it, then later I have the above error message again randomly. One minute I'll b...
17,302
553,663
2020-09-30 23:31:41
64,147,124
14
2020-09-30 23:31:41
325,736
2020-09-30 23:31:41
https://stackoverflow.com/q/21262997
https://stackoverflow.com/a/64147124
<p>Git repository name can be logically anything, but it's slug (how it is stored to disk and how it's cone URL can be formed) can differ from the name. However, this is totally tool specific.</p> <p>I've seen some Git hosting tools that allow wide set of characters to be used as repo name but many of them are converte...
<p>Git repository name can be logically anything, but it's slug (how it is stored to disk and how it's cone URL can be formed) can differ from the name. However, this is totally tool specific.</p> <p>I've seen some Git hosting tools that allow wide set of characters to be used as repo name but many of them are converte...
119
git
<h1>What is the format for valid Git repo names?</h1> <p>I'm a Git noob and using GitExtensions (GE) I'm constantly having problems with "{name} is not a valid remote name". One minute GE will not allow me to add the name, then if I try to re-add it without a single name/path change GE accepts it, then later I have the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,171
git
# What is the format for valid Git repo names? I'm a Git noob and using GitExtensions (GE) I'm constantly having problems with "{name} is not a valid remote name". One minute GE will not allow me to add the name, then if I try to re-add it without a single name/path change GE accepts it, then later I have the above er...
Git repository name can be logically anything, but it's slug (how it is stored to disk and how it's cone URL can be formed) can differ from the name. However, this is totally tool specific. I've seen some Git hosting tools that allow wide set of characters to be used as repo name but many of them are converted into da...
46126118
Push tags with Xcode 9
17
2017-09-09 00:33:49
<p>From cli I push tags like this</p> <pre><code>git tag 1.0.1 &amp;&amp; git push origin 1.0.1 </code></pre> <p>From Xcode 9 I can tag commits. But, how do I push that tag to origin from Xcode?</p>
2,428
251,420
2018-06-06 13:00:50
47,230,567
14
2017-11-10 20:23:28
4,095,935
2018-06-06 13:00:50
https://stackoverflow.com/q/46126118
https://stackoverflow.com/a/47230567
<p>As of Xcode 10.0 beta (10L176w) (released 2018-06-04, coincident with WWDC18), we can now optionally push tags to the remote during normal push actions. (<strong>Source Control -> Push...</strong>) There does not, however, appear to be a mechanism to selectively push tags.</p> <p><a href="https://i.sstatic.net/OrSC...
<p>As of Xcode 10.0 beta (10L176w) (released 2018-06-04, coincident with WWDC18), we can now optionally push tags to the remote during normal push actions. (<strong>Source Control -> Push...</strong>) There does not, however, appear to be a mechanism to selectively push tags.</p> <p><a href="https://i.sstatic.net/OrSC...
119, 908, 28898, 60718, 126782
git, git-push, git-tag, xcode, xcode9-beta
<h1>Push tags with Xcode 9</h1> <p>From cli I push tags like this</p> <pre><code>git tag 1.0.1 &amp;&amp; git push origin 1.0.1 </code></pre> <p>From Xcode 9 I can tag commits. But, how do I push that tag to origin from Xcode?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,172
git
# Push tags with Xcode 9 From cli I push tags like this ``` git tag 1.0.1 && git push origin 1.0.1 ``` From Xcode 9 I can tag commits. But, how do I push that tag to origin from Xcode?
As of Xcode 10.0 beta (10L176w) (released 2018-06-04, coincident with WWDC18), we can now optionally push tags to the remote during normal push actions. (**Source Control -> Push...**) There does not, however, appear to be a mechanism to selectively push tags. [![Xcode 10 Tag Pushing](https://i.sstatic.net/OrSCH.png)]...
39708972
How do I turn off git autocorrect?
17
2016-09-26 17:32:19
<p>When I typo a git command, such as typing <code>git git checkout myfile</code> (note the extra "git") I get the following output:</p> <pre><code>WARNING: You called a Git command named 'git', which does not exist. Continuing under the assumption that you meant 'init' in 0.1 seconds automatically... usage: git init ...
2,427
1,192,740
2021-06-02 18:46:56
39,708,973
14
2016-09-26 17:32:19
1,192,740
2016-09-26 17:32:19
https://stackoverflow.com/q/39708972
https://stackoverflow.com/a/39708973
<p>To see the setting of autocorrect, type:</p> <p><code>git config help.autocorrect</code></p> <p>Per <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration" rel="noreferrer">the docs</a>:</p> <p><em>help.autocorrect is actually an integer which represents tenths of a second. So if you set it to ...
<p>To see the setting of autocorrect, type:</p> <p><code>git config help.autocorrect</code></p> <p>Per <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration" rel="noreferrer">the docs</a>:</p> <p><em>help.autocorrect is actually an integer which represents tenths of a second. So if you set it to ...
119, 25125
autocorrect, git
<h1>How do I turn off git autocorrect?</h1> <p>When I typo a git command, such as typing <code>git git checkout myfile</code> (note the extra "git") I get the following output:</p> <pre><code>WARNING: You called a Git command named 'git', which does not exist. Continuing under the assumption that you meant 'init' in 0...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,173
git
# How do I turn off git autocorrect? When I typo a git command, such as typing `git git checkout myfile` (note the extra "git") I get the following output: ``` WARNING: You called a Git command named 'git', which does not exist. Continuing under the assumption that you meant 'init' in 0.1 seconds automatically... usa...
To see the setting of autocorrect, type: `git config help.autocorrect` Per [the docs](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration): *help.autocorrect is actually an integer which represents tenths of a second. So if you set it to 50, Git will give you 5 seconds to change your mind before executi...
31057527
git pre-commit hook to format and re-add files at the same time
17
2015-06-25 18:02:28
<p>We're currently using a git hook (below) to run astyle on our source code before allowing the user to commit. This has the caveat that the user must commit, have their code formatted, then commit again which is a bit of a nuisance. Ideally we'd want the hook to format the code and then include that formatted code in...
22,171
1,233,949
2023-06-06 19:49:35
31,061,610
14
2015-06-25 22:05:32
1,524,766
2015-06-25 22:05:32
https://stackoverflow.com/q/31057527
https://stackoverflow.com/a/31061610
<p>In your pre-commit hook, you need to add your files, so if your hook is something like:</p> <pre><code>#!/bin/bash echo 1 &gt; file exit 0 </code></pre> <p>then you would need to modify it to have the add:</p> <pre><code>#!/bin/bash echo 1 &gt; file git add file exit 0 </code></pre> <p>To get a list of all modif...
<p>In your pre-commit hook, you need to add your files, so if your hook is something like:</p> <pre><code>#!/bin/bash echo 1 &gt; file exit 0 </code></pre> <p>then you would need to modify it to have the add:</p> <pre><code>#!/bin/bash echo 1 &gt; file git add file exit 0 </code></pre> <p>To get a list of all modif...
119, 555, 43087
formatting, git, githooks
<h1>git pre-commit hook to format and re-add files at the same time</h1> <p>We're currently using a git hook (below) to run astyle on our source code before allowing the user to commit. This has the caveat that the user must commit, have their code formatted, then commit again which is a bit of a nuisance. Ideally we'd...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,175
git
# git pre-commit hook to format and re-add files at the same time We're currently using a git hook (below) to run astyle on our source code before allowing the user to commit. This has the caveat that the user must commit, have their code formatted, then commit again which is a bit of a nuisance. Ideally we'd want the...
In your pre-commit hook, you need to add your files, so if your hook is something like: ``` #!/bin/bash echo 1 > file exit 0 ``` then you would need to modify it to have the add: ``` #!/bin/bash echo 1 > file git add file exit 0 ``` To get a list of all modified files, you could use git-ls-files: `git ls-files -m`...
16290054
Ignoring .DS_Store in a gitignore file using Tower
17
2013-04-29 23:48:02
<p>I have a new repo and before I perform the first commit I'd like to ignore .DS_Store files.</p> <p>I've tried adding the following to the .gitignore file via Tower:</p> <pre><code>.DS_Store *.DS_Store */.DS_Store </code></pre> <p>But only the .DS_Store file at the root is ignored, all others are included ready fo...
22,191
854,987
2013-08-14 01:57:03
16,296,835
14
2013-04-30 09:45:21
6,309
2013-04-30 10:11:44
https://stackoverflow.com/q/16290054
https://stackoverflow.com/a/16296835
<p>Make sure you didn't add to the index those DS_Store first.</p> <p>If you did, check out "<a href="https://stackoverflow.com/q/107701/6309">How Can I Remove .DS_Store Files From A Git Repository?</a>", and then check if your <code>.gitignore</code> works.<br> Use <code>git rm --cached</code> if you want just to rem...
<p>Make sure you didn't add to the index those DS_Store first.</p> <p>If you did, check out "<a href="https://stackoverflow.com/q/107701/6309">How Can I Remove .DS_Store Files From A Git Repository?</a>", and then check if your <code>.gitignore</code> works.<br> Use <code>git rm --cached</code> if you want just to rem...
25056, 78499
gitignore, git-tower
<h1>Ignoring .DS_Store in a gitignore file using Tower</h1> <p>I have a new repo and before I perform the first commit I'd like to ignore .DS_Store files.</p> <p>I've tried adding the following to the .gitignore file via Tower:</p> <pre><code>.DS_Store *.DS_Store */.DS_Store </code></pre> <p>But only the .DS_Store f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,176
git
# Ignoring .DS_Store in a gitignore file using Tower I have a new repo and before I perform the first commit I'd like to ignore .DS_Store files. I've tried adding the following to the .gitignore file via Tower: ``` .DS_Store *.DS_Store */.DS_Store ``` But only the .DS_Store file at the root is ignored, all others a...
Make sure you didn't add to the index those DS_Store first. If you did, check out "[How Can I Remove .DS_Store Files From A Git Repository?](https://stackoverflow.com/q/107701/6309)", and then check if your `.gitignore` works. Use `git rm --cached` if you want just to remove then from the index while keeping them in...
10057634
Cherrypick commit orders
17
2012-04-07 19:29:27
<p>That might be a naive git question but here it is:</p> <p>Before doing a pull-request, I usually create a new branch from the latest commits in the upstream and cherry-pick the important commits from my development branch. Then make a pull-request from my new branch to the remote repository.</p> <p>But I hate the ...
13,971
50,676
2016-05-27 05:03:16
10,057,738
14
2012-04-07 19:42:57
119,963
2012-04-07 19:42:57
https://stackoverflow.com/q/10057634
https://stackoverflow.com/a/10057738
<p>You should definitely cherry-pick commits in order. If you don't, they may not apply - imagine that one commit adds foo.c, and the next one modifies it. Clearly they're not going to work out of order. In general, even if it's not that obvious, there's some logical flow of development, and you don't want to mess with...
<p>You should definitely cherry-pick commits in order. If you don't, they may not apply - imagine that one commit adds foo.c, and the next one modifies it. Clearly they're not going to work out of order. In general, even if it's not that obvious, there's some logical flow of development, and you don't want to mess with...
119, 62599, 78810
git, git-cherry-pick, merge-conflict-resolution
<h1>Cherrypick commit orders </h1> <p>That might be a naive git question but here it is:</p> <p>Before doing a pull-request, I usually create a new branch from the latest commits in the upstream and cherry-pick the important commits from my development branch. Then make a pull-request from my new branch to the remote ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,177
git
# Cherrypick commit orders That might be a naive git question but here it is: Before doing a pull-request, I usually create a new branch from the latest commits in the upstream and cherry-pick the important commits from my development branch. Then make a pull-request from my new branch to the remote repository. But ...
You should definitely cherry-pick commits in order. If you don't, they may not apply - imagine that one commit adds foo.c, and the next one modifies it. Clearly they're not going to work out of order. In general, even if it's not that obvious, there's some logical flow of development, and you don't want to mess with it...
5412562
setting up git repository on local machine
17
2011-03-23 22:40:00
<p>How can I setup a git repository on a local system ? (I am on a windoze box)</p> <p>This is the setup I am trying to achieve: (everything is on my local machine)</p> <ul> <li>host folder (which acts like central repository)</li> <li>client folder</li> </ul> <p>I want to do all my dev in the client folder. Once I ...
45,277
280,924
2011-03-23 22:46:24
5,412,619
14
2011-03-23 22:46:15
893
2011-03-23 22:46:15
https://stackoverflow.com/q/5412562
https://stackoverflow.com/a/5412619
<p>The difference between a "regular git" and a "bare git" is that a bare repository does <em>not</em> have a working directory. You should never push into a regular git repository, as you may run into problems that are hard to recover from. Always push into a bare repository.</p> <p>If you want to have a "host" where...
<p>The difference between a "regular git" and a "bare git" is that a bare repository does <em>not</em> have a working directory. You should never push into a regular git repository, as you may run into problems that are hard to recover from. Always push into a bare repository.</p> <p>If you want to have a "host" where...
119, 55606
git, git-workflow
<h1>setting up git repository on local machine</h1> <p>How can I setup a git repository on a local system ? (I am on a windoze box)</p> <p>This is the setup I am trying to achieve: (everything is on my local machine)</p> <ul> <li>host folder (which acts like central repository)</li> <li>client folder</li> </ul> <p>I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,178
git
# setting up git repository on local machine How can I setup a git repository on a local system ? (I am on a windoze box) This is the setup I am trying to achieve: (everything is on my local machine) - host folder (which acts like central repository) - client folder I want to do all my dev in the client folder. Onc...
The difference between a "regular git" and a "bare git" is that a bare repository does *not* have a working directory. You should never push into a regular git repository, as you may run into problems that are hard to recover from. Always push into a bare repository. If you want to have a "host" where copies of your f...
3103939
Git - discard added files
17
2010-06-23 17:21:04
<p>Seems like this should be super-simple but looking around for a simple (or half-way straightforward) solution seems impossible:</p> <p>Say I add a bunch of files to a Git project. "git status" now says: </p> <pre><code># On branch master # Untracked files: # (use "git add &lt;file&gt;..." to include in wha...
10,824
343,204
2016-05-27 21:12:46
3,103,956
14
2010-06-23 17:22:55
14,637
2010-06-23 17:22:55
https://stackoverflow.com/q/3103939
https://stackoverflow.com/a/3103956
<pre><code>git clean </code></pre> <p>should do the trick. By default, this requires the <code>-f</code> flag to really do anything.</p>
<pre><code>git clean </code></pre> <p>should do the trick. By default, this requires the <code>-f</code> flag to really do anything.</p>
119
git
<h1>Git - discard added files</h1> <p>Seems like this should be super-simple but looking around for a simple (or half-way straightforward) solution seems impossible:</p> <p>Say I add a bunch of files to a Git project. "git status" now says: </p> <pre><code># On branch master # Untracked files: # (use "git add...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,179
git
# Git - discard added files Seems like this should be super-simple but looking around for a simple (or half-way straightforward) solution seems impossible: Say I add a bunch of files to a Git project. "git status" now says: ``` # On branch master # Untracked files: # (use "git add <file>..." to include in what...
``` git clean ``` should do the trick. By default, this requires the `-f` flag to really do anything.
71852013
Git for windows 2.35.2 can not add exception safe.directory
16
2022-04-13 04:46:23
<p>I am using <code>git version 2.35.2.windows.1</code> on my win10. My project is stored in my NAS running Ubuntu. I set up an SMB remote disk using samba, and do all necessary work on win10.</p> <p>After the 2.35 update, i got</p> <pre class="lang-sh prettyprint-override"><code>fatal: unsafe repository ('//192.168.1....
13,089
13,482,206
2024-03-21 21:51:54
71,859,164
14
2022-04-13 14:24:52
4,473,230
2022-04-13 14:24:52
https://stackoverflow.com/q/71852013
https://stackoverflow.com/a/71859164
<ol> <li>The prefix must include the trailing <code>/</code>. Literally like this: <code>%(prefix)/</code>.</li> <li>Whether you must use hostname, IP address or FQDN <strong>depends on how you mounted the network share</strong>.</li> </ol> <p>Run <code>net use</code> to list the exact remote paths of mounted shares.</...
<ol> <li>The prefix must include the trailing <code>/</code>. Literally like this: <code>%(prefix)/</code>.</li> <li>Whether you must use hostname, IP address or FQDN <strong>depends on how you mounted the network share</strong>.</li> </ol> <p>Run <code>net use</code> to list the exact remote paths of mounted shares.</...
64, 119
git, windows
<h1>Git for windows 2.35.2 can not add exception safe.directory</h1> <p>I am using <code>git version 2.35.2.windows.1</code> on my win10. My project is stored in my NAS running Ubuntu. I set up an SMB remote disk using samba, and do all necessary work on win10.</p> <p>After the 2.35 update, i got</p> <pre class="lang-s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,180
git
# Git for windows 2.35.2 can not add exception safe.directory I am using `git version 2.35.2.windows.1` on my win10. My project is stored in my NAS running Ubuntu. I set up an SMB remote disk using samba, and do all necessary work on win10. After the 2.35 update, i got ``` fatal: unsafe repository ('//192.168.1.120/...
1. The prefix must include the trailing `/`. Literally like this: `%(prefix)/`. 2. Whether you must use hostname, IP address or FQDN **depends on how you mounted the network share**. Run `net use` to list the exact remote paths of mounted shares. ## Working examples If the network share was mounted as `\\123.123.123...
60190759
How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository?
16
2020-02-12 14:37:34
<p>How do I clone, fetch or sparse checkout a single file or directory or a list of files or directories from a git repository avoiding downloading the entire history or at least keeping history download at minimum?</p> <p>For the benefit of people landing here, these are references to other similar questions:</p> <ul>...
5,417
62,131
2021-07-23 06:52:09
60,190,760
14
2020-02-12 14:37:34
62,131
2021-05-26 06:12:48
https://stackoverflow.com/q/60190759
https://stackoverflow.com/a/60190760
<p>This <code>bash</code> function below does the trick.</p> <pre class="lang-sh prettyprint-override"><code>function git_sparse_checkout { # git repository, e.g.: http://github.com/frgomes/bash-scripts local url=$1 # directory where the repository will be downloaded, e.g.: ./build/sources local dir=$2 ...
<p>This <code>bash</code> function below does the trick.</p> <pre class="lang-sh prettyprint-override"><code>function git_sparse_checkout { # git repository, e.g.: http://github.com/frgomes/bash-scripts local url=$1 # directory where the repository will be downloaded, e.g.: ./build/sources local dir=$2 ...
119, 33720, 37230, 69559, 118645
git, git-checkout, git-fetch, git-sparse-checkout, revision-history
<h1>How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository?</h1> <p>How do I clone, fetch or sparse checkout a single file or directory or a list of files or directories from a git repository avoiding downloading the entire history or at least keeping history download a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,181
git
# How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository? How do I clone, fetch or sparse checkout a single file or directory or a list of files or directories from a git repository avoiding downloading the entire history or at least keeping history download at minimum...
This `bash` function below does the trick. ``` function git_sparse_checkout { # git repository, e.g.: http://github.com/frgomes/bash-scripts local url=$1 # directory where the repository will be downloaded, e.g.: ./build/sources local dir=$2 # repository name, in general taken from the url, e.g.: b...
49379060
Git ammend not allowed after resolving cherry-pick conflicts
16
2018-03-20 08:04:06
<p>I <code>cherry-picked</code> a commit and resolved the conflicts, added them, now when I try to do git amend it fails with below message. </p> <blockquote> <p>fatal: You are in the middle of a cherry-pick -- cannot amend.</p> </blockquote> <p>Why does git gives this message, is there a way to tell it things are ...
22,302
3,151,415
2018-03-20 09:41:16
49,380,153
14
2018-03-20 09:12:19
3,151,415
2018-03-20 09:41:16
https://stackoverflow.com/q/49379060
https://stackoverflow.com/a/49380153
<p>I manually removed <code>.git/CHERRY_PICK_HEAD</code> now git doesn't know I did a cherry-pick, so amend works like it was a normal commit amend. </p> <p><code>cherry-pick --continue</code> adds a new commit message and would need to rebase which is a hassle. </p>
<p>I manually removed <code>.git/CHERRY_PICK_HEAD</code> now git doesn't know I did a cherry-pick, so amend works like it was a normal commit amend. </p> <p><code>cherry-pick --continue</code> adds a new commit message and would need to rebase which is a hassle. </p>
119
git
<h1>Git ammend not allowed after resolving cherry-pick conflicts</h1> <p>I <code>cherry-picked</code> a commit and resolved the conflicts, added them, now when I try to do git amend it fails with below message. </p> <blockquote> <p>fatal: You are in the middle of a cherry-pick -- cannot amend.</p> </blockquote> <p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,183
git
# Git ammend not allowed after resolving cherry-pick conflicts I `cherry-picked` a commit and resolved the conflicts, added them, now when I try to do git amend it fails with below message. > fatal: You are in the middle of a cherry-pick -- cannot amend. Why does git gives this message, is there a way to tell it thi...
I manually removed `.git/CHERRY_PICK_HEAD` now git doesn't know I did a cherry-pick, so amend works like it was a normal commit amend. `cherry-pick --continue` adds a new commit message and would need to rebase which is a hassle.
38434320
How to determine which commit and/or which branch was deployed to Heroku?
16
2016-07-18 10:24:25
<p>I have an app that is deployed to Heroku, and presume that I haven't done the deployment, how can I check which branch was used to deploy to heroku, or what is the commit ID (as with it I can determine the branch if needed)?</p> <p>I am using GitHub.</p> <p>So far I have tried to run in console:</p> <pre><code>$ ...
11,215
1,612,469
2022-05-19 22:47:00
38,434,452
14
2016-07-18 10:31:05
473,467
2016-07-18 10:31:05
https://stackoverflow.com/q/38434320
https://stackoverflow.com/a/38434452
<p>The "releases" feature does not help you because it's an internal counter Heroku is using to keep track of pushes and re-configuration.</p> <p>If you re-configure your app, the counter will increase. Deployments will also increase the counter but that doesn't help you.</p> <p>But remember that Heroku is just anoth...
<p>The "releases" feature does not help you because it's an internal counter Heroku is using to keep track of pushes and re-configuration.</p> <p>If you re-configure your app, the counter will increase. Deployments will also increase the counter but that doesn't help you.</p> <p>But remember that Heroku is just anoth...
119, 4984, 8279
git, heroku, ruby-on-rails
<h1>How to determine which commit and/or which branch was deployed to Heroku?</h1> <p>I have an app that is deployed to Heroku, and presume that I haven't done the deployment, how can I check which branch was used to deploy to heroku, or what is the commit ID (as with it I can determine the branch if needed)?</p> <p>I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,184
git
# How to determine which commit and/or which branch was deployed to Heroku? I have an app that is deployed to Heroku, and presume that I haven't done the deployment, how can I check which branch was used to deploy to heroku, or what is the commit ID (as with it I can determine the branch if needed)? I am using GitHub...
The "releases" feature does not help you because it's an internal counter Heroku is using to keep track of pushes and re-configuration. If you re-configure your app, the counter will increase. Deployments will also increase the counter but that doesn't help you. But remember that Heroku is just another "git remote." ...
34696771
How does `receive.denyCurrentBranch=updateInstead` interact with the Index?
16
2016-01-09 17:42:15
<p>The <code>receive.denyCurrentBranch</code> <a href="https://git-scm.com/docs/git-config" rel="noreferrer">config option</a> controls what happens if you push to a repo's branch that is checkout. </p> <p>By default, it rejects it (which is why you usually only push to bare repos, which have no checkout branches). </...
8,362
1,172,541
2016-01-09 20:09:14
34,698,361
14
2016-01-09 20:09:14
6,309
2016-01-09 20:09:14
https://stackoverflow.com/q/34696771
https://stackoverflow.com/a/34698361
<blockquote> <p>Is the Index updated? What if HEAD and the working directory match, but not Index?</p> </blockquote> <p><a href="https://github.com/git/git/commit/0855331941b723b227e93b33955bbe0b45025659" rel="noreferrer">Commit 0855331 (git 2.4.0-rc0, Dec. 2014)</a> states it clearly:</p> <blockquote> <p>When <c...
<blockquote> <p>Is the Index updated? What if HEAD and the working directory match, but not Index?</p> </blockquote> <p><a href="https://github.com/git/git/commit/0855331941b723b227e93b33955bbe0b45025659" rel="noreferrer">Commit 0855331 (git 2.4.0-rc0, Dec. 2014)</a> states it clearly:</p> <blockquote> <p>When <c...
119, 28898, 32868, 68400
git, git-config, git-index, git-push
<h1>How does `receive.denyCurrentBranch=updateInstead` interact with the Index?</h1> <p>The <code>receive.denyCurrentBranch</code> <a href="https://git-scm.com/docs/git-config" rel="noreferrer">config option</a> controls what happens if you push to a repo's branch that is checkout. </p> <p>By default, it rejects it (w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,185
git
# How does `receive.denyCurrentBranch=updateInstead` interact with the Index? The `receive.denyCurrentBranch` [config option](https://git-scm.com/docs/git-config) controls what happens if you push to a repo's branch that is checkout. By default, it rejects it (which is why you usually only push to bare repos, which h...
> Is the Index updated? What if HEAD and the working directory match, but not Index? [Commit 0855331 (git 2.4.0-rc0, Dec. 2014)](https://github.com/git/git/commit/0855331941b723b227e93b33955bbe0b45025659) states it clearly: > When `receive.denyCurrentBranch` is set to `updateInstead`, a push that > tries to update th...
30392318
Git global core.fileMode false overridden locally on clone
16
2015-05-22 08:51:27
<p>Reading <a href="https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes">this</a>, I was able to configure both globally and locally my <code>fileMode</code> configuration to false.</p> <p>However, when I <code>git clone</code>, Git keeps initializing the projects with local con...
5,904
4,578,952
2025-07-04 15:37:28
30,394,903
14
2015-05-22 10:57:09
1,256,452
2022-04-26 00:01:00
https://stackoverflow.com/q/30392318
https://stackoverflow.com/a/30394903
<p>Clone, like init, always sets a local <code>core.filemode</code> when it creates a new repository. See my answer to <a href="https://stackoverflow.com/q/10376913/1256452">this question</a> for details. The only way to clobber the local setting after a clone is to do it manually (e.g., by having a wrapper command t...
<p>Clone, like init, always sets a local <code>core.filemode</code> when it creates a new repository. See my answer to <a href="https://stackoverflow.com/q/10376913/1256452">this question</a> for details. The only way to clobber the local setting after a clone is to do it manually (e.g., by having a wrapper command t...
119, 3574
config, git
<h1>Git global core.fileMode false overridden locally on clone</h1> <p>Reading <a href="https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes">this</a>, I was able to configure both globally and locally my <code>fileMode</code> configuration to false.</p> <p>However, when I <code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,186
git
# Git global core.fileMode false overridden locally on clone Reading [this](https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes), I was able to configure both globally and locally my `fileMode` configuration to false. However, when I `git clone`, Git keeps initializing the pro...
Clone, like init, always sets a local `core.filemode` when it creates a new repository. See my answer to [this question](https://stackoverflow.com/q/10376913/1256452) for details. The only way to clobber the local setting after a clone is to do it manually (e.g., by having a wrapper command that does the clone, then go...
16078135
Git-svn merge two SVN branches
16
2013-04-18 08:33:34
<p>I have read numerous SO questions and blogs on <code>git-svn</code> and merging. Some of them (notably <code>git-svn</code> man page) warns <em>against</em> using merge anywhere near the branch I plan to <code>dcommit</code> from.</p> <p>Others, like this <a href="https://stackoverflow.com/a/4238528/465345">SO answ...
7,716
465,345
2013-04-23 09:20:23
16,165,583
14
2013-04-23 09:20:23
465,345
2013-04-23 09:20:23
https://stackoverflow.com/q/16078135
https://stackoverflow.com/a/16165583
<p>Digging some more into the matter, I found out that git supports setting <code>svn:mergeinfo</code> property on the SVN branch when <code>dcommit</code>'ing:</p> <pre><code>git svn dcommit --mergeinfo "/branches/somebranch:1-3" </code></pre> <p><strong>NB!</strong> the <code>svn:mergeinfo</code> is <strong>overwri...
<p>Digging some more into the matter, I found out that git supports setting <code>svn:mergeinfo</code> property on the SVN branch when <code>dcommit</code>'ing:</p> <pre><code>git svn dcommit --mergeinfo "/branches/somebranch:1-3" </code></pre> <p><strong>NB!</strong> the <code>svn:mergeinfo</code> is <strong>overwri...
119, 6452
git, git-svn
<h1>Git-svn merge two SVN branches</h1> <p>I have read numerous SO questions and blogs on <code>git-svn</code> and merging. Some of them (notably <code>git-svn</code> man page) warns <em>against</em> using merge anywhere near the branch I plan to <code>dcommit</code> from.</p> <p>Others, like this <a href="https://sta...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,187
git
# Git-svn merge two SVN branches I have read numerous SO questions and blogs on `git-svn` and merging. Some of them (notably `git-svn` man page) warns *against* using merge anywhere near the branch I plan to `dcommit` from. Others, like this [SO answer](https://stackoverflow.com/a/4238528/465345), state that merging ...
Digging some more into the matter, I found out that git supports setting `svn:mergeinfo` property on the SVN branch when `dcommit`'ing: ``` git svn dcommit --mergeinfo "/branches/somebranch:1-3" ``` **NB!** the `svn:mergeinfo` is **overwritten** with whatever is given on the command-line, so be careful to list *previ...
11764439
Find gitignore file and line causing a file to be ignored by git
16
2012-08-01 17:27:28
<p>How can I find the gitignore file and line that is causing a file to be ignored by git?</p>
23,931
79,125
2015-01-26 18:27:56
11,764,441
14
2012-08-01 17:27:28
79,125
2012-08-01 17:27:28
https://stackoverflow.com/q/11764439
https://stackoverflow.com/a/11764441
<p>From the repo root, try this:</p> <pre><code>find . ~/.gitignore .git/info/exclude -name '*gitignore' -exec cat {} + | less </code></pre> <p>Also check that you're not using a different excludes file:</p> <pre><code>git config -l | grep exclude core.excludesfile=~/.gitignore </code></pre> <p>You <a href="https:/...
<p>From the repo root, try this:</p> <pre><code>find . ~/.gitignore .git/info/exclude -name '*gitignore' -exec cat {} + | less </code></pre> <p>Also check that you're not using a different excludes file:</p> <pre><code>git config -l | grep exclude core.excludesfile=~/.gitignore </code></pre> <p>You <a href="https:/...
119
git
<h1>Find gitignore file and line causing a file to be ignored by git</h1> <p>How can I find the gitignore file and line that is causing a file to be ignored by git?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,189
git
# Find gitignore file and line causing a file to be ignored by git How can I find the gitignore file and line that is causing a file to be ignored by git?
From the repo root, try this: ``` find . ~/.gitignore .git/info/exclude -name '*gitignore' -exec cat {} + | less ``` Also check that you're not using a different excludes file: ``` git config -l | grep exclude core.excludesfile=~/.gitignore ``` You [can also get that error when you have submodules in a subfolder in...
1049917
Workflow description for git usage for in-house development
16
2009-06-26 15:57:13
<p>The company I work for wants to have monthly releases, and I am trying to convince them to switch to git. I believe the proper git-way to handle this is to have a integration branch for each release (i.e. monthly) and have feature branches off the integration branches for new development and changes. The environment...
7,390
23,691
2016-11-11 13:11:47
1,050,628
14
2009-06-26 18:50:29
6,309
2016-11-11 13:11:47
https://stackoverflow.com/q/1049917
https://stackoverflow.com/a/1050628
<blockquote> <p>a logical explanation of the branch/merge structure</p> </blockquote> <p>The structure basically follows what you said: an integration branch, and features branches.<br> In this kind of workflow, it is key to understand, as you did, that all development will not make it to the next release.<br> But w...
<blockquote> <p>a logical explanation of the branch/merge structure</p> </blockquote> <p>The structure basically follows what you said: an integration branch, and features branches.<br> In this kind of workflow, it is key to understand, as you did, that all development will not make it to the next release.<br> But w...
119, 758
git, workflow
<h1>Workflow description for git usage for in-house development</h1> <p>The company I work for wants to have monthly releases, and I am trying to convince them to switch to git. I believe the proper git-way to handle this is to have a integration branch for each release (i.e. monthly) and have feature branches off the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,192
git
# Workflow description for git usage for in-house development The company I work for wants to have monthly releases, and I am trying to convince them to switch to git. I believe the proper git-way to handle this is to have a integration branch for each release (i.e. monthly) and have feature branches off the integrati...
> a logical explanation of the branch/merge structure The structure basically follows what you said: an integration branch, and features branches. In this kind of workflow, it is key to understand, as you did, that all development will not make it to the next release. But with a DVCS, it is also key to understand ...
999500
Expected FS format '2' found format '3 git-svn
16
2009-06-16 03:57:34
<p>I was just checking out git-svn and thought I would give it a try with one of my existing repository. When I ran git-svn I got this error.</p> <p>Couldn't open a repository: Unable to open an ra_local session to URL: Unable to open repository '{MyFilePath}': <strong>Expected FS format '2'; found format '3'</stron...
6,848
6,335
2012-07-26 14:51:11
999,512
14
2009-06-16 04:01:54
893
2009-06-16 04:01:54
https://stackoverflow.com/q/999500
https://stackoverflow.com/a/999512
<p>If you access your Subversion repository using a network protocol (such as <code>svn://</code>) instead of local file access, then things should work properly for you. It appears as though you're asking <code>git-svn</code> to access the repository directly, causing the problem you've shown. The Subversion network p...
<p>If you access your Subversion repository using a network protocol (such as <code>svn://</code>) instead of local file access, then things should work properly for you. It appears as though you're asking <code>git-svn</code> to access the repository directly, causing the problem you've shown. The Subversion network p...
63, 119, 456, 6452
git, git-svn, svn, version-control
<h1>Expected FS format '2' found format '3 git-svn</h1> <p>I was just checking out git-svn and thought I would give it a try with one of my existing repository. When I ran git-svn I got this error.</p> <p>Couldn't open a repository: Unable to open an ra_local session to URL: Unable to open repository '{MyFilePath}':...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,193
git
# Expected FS format '2' found format '3 git-svn I was just checking out git-svn and thought I would give it a try with one of my existing repository. When I ran git-svn I got this error. Couldn't open a repository: Unable to open an ra_local session to URL: Unable to open repository '{MyFilePath}': **Expected FS for...
If you access your Subversion repository using a network protocol (such as `svn://`) instead of local file access, then things should work properly for you. It appears as though you're asking `git-svn` to access the repository directly, causing the problem you've shown. The Subversion network protocols are more resilie...
41554303
git says I have unstaged changes but I can not see them
15
2017-01-09 18:15:03
<p>I am executing this command on the second file I want to remove (the first was JetBrains' .idea folder files which are now in .gitignore), but I am not able to:</p> <pre><code>git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch gf5/console/basic.php' --prune-empty --tag-name-filter cat -- --a...
25,104
4,127,646
2022-04-20 16:49:08
41,554,629
14
2017-01-09 18:34:11
4,127,646
2017-01-09 19:07:08
https://stackoverflow.com/q/41554303
https://stackoverflow.com/a/41554629
<p>AHA!! I figured out what is going on. Read the last few sentences for a little insight.</p> <p>The answer was to first do:</p> <pre><code>git status </code></pre> <p>This showed modified files in RED, which I presume means they are somehow "deleted" in git's mind. I then did:</p> <pre><code>git add --all </cod...
<p>AHA!! I figured out what is going on. Read the last few sentences for a little insight.</p> <p>The answer was to first do:</p> <pre><code>git status </code></pre> <p>This showed modified files in RED, which I presume means they are somehow "deleted" in git's mind. I then did:</p> <pre><code>git add --all </cod...
119, 46509
git, git-filter-branch
<h1>git says I have unstaged changes but I can not see them</h1> <p>I am executing this command on the second file I want to remove (the first was JetBrains' .idea folder files which are now in .gitignore), but I am not able to:</p> <pre><code>git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,199
git
# git says I have unstaged changes but I can not see them I am executing this command on the second file I want to remove (the first was JetBrains' .idea folder files which are now in .gitignore), but I am not able to: ``` git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch gf5/console/basic.ph...
AHA!! I figured out what is going on. Read the last few sentences for a little insight. The answer was to first do: ``` git status ``` This showed modified files in RED, which I presume means they are somehow "deleted" in git's mind. I then did: ``` git add --all ``` From there I committed all the staged files usi...
41117875
How to fast forward a branch when being offline
15
2016-12-13 09:44:02
<p>How do I fast forward a branch, when I <code>git fetch</code>ed during I was online and now I'm offline and want to fast forward to the state I fetched earlier.</p> <p>For example I'm offline and do the following:</p> <pre><code>$ git checkout develop Switched to branch 'develop' Your branch is behind 'origin/deve...
3,970
1,466,267
2020-09-09 10:20:42
41,118,015
14
2016-12-13 09:51:01
390,363
2016-12-13 11:45:17
https://stackoverflow.com/q/41117875
https://stackoverflow.com/a/41118015
<p>Since <code>git pull</code> is basically <code>git fetch</code> + <code>git merge</code> and you already did <code>fetch</code> and can't do it again while offline, you just need to do <code>git merge origin/develop</code>.</p> <p>Alternatively you can do <code>git reset --hard origin/develop</code> which will work...
<p>Since <code>git pull</code> is basically <code>git fetch</code> + <code>git merge</code> and you already did <code>fetch</code> and can't do it again while offline, you just need to do <code>git merge origin/develop</code>.</p> <p>Alternatively you can do <code>git reset --hard origin/develop</code> which will work...
119, 2162
git, offline
<h1>How to fast forward a branch when being offline</h1> <p>How do I fast forward a branch, when I <code>git fetch</code>ed during I was online and now I'm offline and want to fast forward to the state I fetched earlier.</p> <p>For example I'm offline and do the following:</p> <pre><code>$ git checkout develop Switch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,200
git
# How to fast forward a branch when being offline How do I fast forward a branch, when I `git fetch`ed during I was online and now I'm offline and want to fast forward to the state I fetched earlier. For example I'm offline and do the following: ``` $ git checkout develop Switched to branch 'develop' Your branch is ...
Since `git pull` is basically `git fetch` + `git merge` and you already did `fetch` and can't do it again while offline, you just need to do `git merge origin/develop`. Alternatively you can do `git reset --hard origin/develop` which will work even if there is no fast-forward. Edit: More options. Another way is to do...
36006054
Why does git update-ref accepts non-refs/ references?
15
2016-03-15 08:32:21
<p>While commands like "git log" will happily accept different expressions for the same ref, e.g.</p> <pre><code>refs/heads/master heads/master master </code></pre> <p>this is not true for "git update-ref". For example</p> <pre><code>git update-ref master HEAD^ </code></pre> <p>is not the same as</p> <pre><code>gi...
11,402
2,910,279
2024-12-07 18:00:37
36,008,283
14
2016-03-15 10:13:07
26,396
2016-03-15 13:00:38
https://stackoverflow.com/q/36006054
https://stackoverflow.com/a/36008283
<h2>tl;dr</h2> <p>The main reason why <code>git log</code> and <code>git update-ref</code> behave differently is because <code>git-log</code> is a <em>high-level</em> command – and therefore designed to be user-friendly – while <code>git-update-ref</code> is a <em>low-level</em> command meant to be used in scripts.</p...
<h2>tl;dr</h2> <p>The main reason why <code>git log</code> and <code>git update-ref</code> behave differently is because <code>git-log</code> is a <em>high-level</em> command – and therefore designed to be user-friendly – while <code>git-update-ref</code> is a <em>low-level</em> command meant to be used in scripts.</p...
119, 5036, 106016
git, git-plumbing, reference
<h1>Why does git update-ref accepts non-refs/ references?</h1> <p>While commands like "git log" will happily accept different expressions for the same ref, e.g.</p> <pre><code>refs/heads/master heads/master master </code></pre> <p>this is not true for "git update-ref". For example</p> <pre><code>git update-ref maste...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,201
git
# Why does git update-ref accepts non-refs/ references? While commands like "git log" will happily accept different expressions for the same ref, e.g. ``` refs/heads/master heads/master master ``` this is not true for "git update-ref". For example ``` git update-ref master HEAD^ ``` is not the same as ``` git upd...
## tl;dr The main reason why `git log` and `git update-ref` behave differently is because `git-log` is a *high-level* command – and therefore designed to be user-friendly – while `git-update-ref` is a *low-level* command meant to be used in scripts. ## Porcelain vs. Plumbing In Git parlance, high-level commands are ...
31571146
When you do git add on the same file multiple times, is the save done incrementally?
15
2015-07-22 18:26:14
<p>I am not clear reading the documentation, about how multiple add of a file would work in Git.</p> <p>I would like to make changes in various stage; but I don't want to commit every time; so I thought that I can make changes, use git add, and then make more changes, until I am ready to do a git commit.</p> <p>Readi...
8,661
null
2018-04-06 13:40:37
31,571,195
14
2015-07-22 18:28:43
1,983,957
2018-04-06 13:40:37
https://stackoverflow.com/q/31571146
https://stackoverflow.com/a/31571195
<pre><code>$ git add </code></pre> <p>Does not work in the incremental way you think or would like it to. Commits should be small enough to explain what work was done but big enough that you are not committing constantly.</p> <p>When you run git add, the files added are then staged for committing, so any other change...
<pre><code>$ git add </code></pre> <p>Does not work in the incremental way you think or would like it to. Commits should be small enough to explain what work was done but big enough that you are not committing constantly.</p> <p>When you run git add, the files added are then staged for committing, so any other change...
119
git
<h1>When you do git add on the same file multiple times, is the save done incrementally?</h1> <p>I am not clear reading the documentation, about how multiple add of a file would work in Git.</p> <p>I would like to make changes in various stage; but I don't want to commit every time; so I thought that I can make change...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,202
git
# When you do git add on the same file multiple times, is the save done incrementally? I am not clear reading the documentation, about how multiple add of a file would work in Git. I would like to make changes in various stage; but I don't want to commit every time; so I thought that I can make changes, use git add, ...
``` $ git add ``` Does not work in the incremental way you think or would like it to. Commits should be small enough to explain what work was done but big enough that you are not committing constantly. When you run git add, the files added are then staged for committing, so any other changes made must again be added....
16960567
Access Git repo via SSH tunnel
15
2013-06-06 11:08:13
<p>I have access to an SSH account that can access a GIT server and am able to clone/push/pull the repo in this SSH login. However I cannot access this repo from elsewhere.</p> <p>On the SSH account I use,</p> <pre><code>git clone git@gitserver:proj/myrepo.git </code></pre> <p>to clone the repo.</p> <p>I tried sett...
39,567
2,104,070
2013-06-06 19:54:31
16,970,929
14
2013-06-06 19:49:06
1,157,237
2013-06-06 19:54:31
https://stackoverflow.com/q/16960567
https://stackoverflow.com/a/16970929
<p>When you do this:</p> <pre><code>git clone git@gitserver:proj/myrepo.git </code></pre> <p>an ssh client is starting on the local host ('sshserver') and authenticating with 'gitserver' using public key authentication. If you get prompted for a password for user 'git', that means public key authentication has faile...
<p>When you do this:</p> <pre><code>git clone git@gitserver:proj/myrepo.git </code></pre> <p>an ssh client is starting on the local host ('sshserver') and authenticating with 'gitserver' using public key authentication. If you get prompted for a password for user 'git', that means public key authentication has faile...
119, 386, 46742
git, ssh, ssh-tunnel
<h1>Access Git repo via SSH tunnel</h1> <p>I have access to an SSH account that can access a GIT server and am able to clone/push/pull the repo in this SSH login. However I cannot access this repo from elsewhere.</p> <p>On the SSH account I use,</p> <pre><code>git clone git@gitserver:proj/myrepo.git </code></pre> <p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,205
git
# Access Git repo via SSH tunnel I have access to an SSH account that can access a GIT server and am able to clone/push/pull the repo in this SSH login. However I cannot access this repo from elsewhere. On the SSH account I use, ``` git clone git@gitserver:proj/myrepo.git ``` to clone the repo. I tried setting up ...
When you do this: ``` git clone git@gitserver:proj/myrepo.git ``` an ssh client is starting on the local host ('sshserver') and authenticating with 'gitserver' using public key authentication. If you get prompted for a password for user 'git', that means public key authentication has failed, and ssh is falling throug...
15549514
Git undo partial changes to a file
15
2013-03-21 13:54:51
<p>How do I undo a part of the changes applied to a file that happened a while ago. I have the following commits and the accidental changes happened between <code>A</code> and <code>B</code> to <code>file.txt</code>:</p> <pre><code>...--A--B--... </code></pre> <p>I have a diff patch of the file in <code>file.txt-B-A.p...
6,744
174,541
2023-09-03 18:29:48
15,551,789
14
2013-03-21 15:33:59
845,716
2013-03-21 15:33:59
https://stackoverflow.com/q/15549514
https://stackoverflow.com/a/15551789
<p>There's another way to do this that doesn't require the patch file at all.</p> <p>The problem happened going from <code>A</code> to <code>B</code>, so first revert the changes in <code>B</code> but don't automatically commit.</p> <pre><code>$ git revert --no-commit &lt;commit hash of B&gt; </code></pre> <p>The ch...
<p>There's another way to do this that doesn't require the patch file at all.</p> <p>The problem happened going from <code>A</code> to <code>B</code>, so first revert the changes in <code>B</code> but don't automatically commit.</p> <pre><code>$ git revert --no-commit &lt;commit hash of B&gt; </code></pre> <p>The ch...
119, 717, 5766
git, merge, undo
<h1>Git undo partial changes to a file</h1> <p>How do I undo a part of the changes applied to a file that happened a while ago. I have the following commits and the accidental changes happened between <code>A</code> and <code>B</code> to <code>file.txt</code>:</p> <pre><code>...--A--B--... </code></pre> <p>I have a di...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,206
git
# Git undo partial changes to a file How do I undo a part of the changes applied to a file that happened a while ago. I have the following commits and the accidental changes happened between `A` and `B` to `file.txt`: ``` ...--A--B--... ``` I have a diff patch of the file in `file.txt-B-A.patch` which reverts **all*...
There's another way to do this that doesn't require the patch file at all. The problem happened going from `A` to `B`, so first revert the changes in `B` but don't automatically commit. ``` $ git revert --no-commit <commit hash of B> ``` The changes that `git revert` would do are staged. Unstage them. ``` $ git res...
10568641
git: error: src refspec master does not match any
15
2012-05-13 01:16:29
<p>After cloning git repository to directory "hggit" and setting the remote origin with</p> <pre><code>mbm:hggit my name$ git remote add origin git@code.getpantheon.com:"mystringhere" </code></pre> <p>After editing files I committed the changes (while located in a sub-dir) with</p> <pre><code>mbm:handelgroup michael...
64,397
1,088,244
2014-01-07 12:03:44
10,570,851
14
2012-05-13 09:59:14
6,309
2014-01-07 12:03:44
https://stackoverflow.com/q/10568641
https://stackoverflow.com/a/10570851
<p>If <code>git status</code> does indicate that you do have an active master branch (since you did make a first commit after all), check if you made any typo when defining your remote: see "<a href="https://stackoverflow.com/a/10080621/6309">Push origin master error on new repository</a>":</p> <pre><code>git remote r...
<p>If <code>git status</code> does indicate that you do have an active master branch (since you did make a first commit after all), check if you made any typo when defining your remote: see "<a href="https://stackoverflow.com/a/10080621/6309">Push origin master error on new repository</a>":</p> <pre><code>git remote r...
119
git
<h1>git: error: src refspec master does not match any</h1> <p>After cloning git repository to directory "hggit" and setting the remote origin with</p> <pre><code>mbm:hggit my name$ git remote add origin git@code.getpantheon.com:"mystringhere" </code></pre> <p>After editing files I committed the changes (while located...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,207
git
# git: error: src refspec master does not match any After cloning git repository to directory "hggit" and setting the remote origin with ``` mbm:hggit my name$ git remote add origin git@code.getpantheon.com:"mystringhere" ``` After editing files I committed the changes (while located in a sub-dir) with ``` mbm:hand...
If `git status` does indicate that you do have an active master branch (since you did make a first commit after all), check if you made any typo when defining your remote: see "[Push origin master error on new repository](https://stackoverflow.com/a/10080621/6309)": ``` git remote rm origin ``` > Then I recreated the...
9805980
"Unable to determine upstream SVN information from working tree history"
15
2012-03-21 13:50:32
<p>I'm trying to use the GCC git mirror, documented <a href="http://gcc.gnu.org/wiki/GitMirror" rel="noreferrer">here</a>.</p> <p>Some time ago, I cloned the git repository:</p> <pre><code>git clone git://gcc.gnu.org/git/gcc.git </code></pre> <p>Added the git-svn stuff:</p> <pre><code>git svn init -Ttrunk --prefix=...
17,560
1,057,909
2013-10-04 05:34:33
9,847,545
14
2012-03-23 23:01:16
839,436
2012-03-23 23:17:40
https://stackoverflow.com/q/9805980
https://stackoverflow.com/a/9847545
<p>You should be able to do this with a graft. Grafting is designed to be used for bringing in legacy repositories is my understanding. It lets you <em>manually</em> tell git that some ref has a common parent.</p> <p>As mentioned in the comments, there may be a simpler solution. This would work if all else failed t...
<p>You should be able to do this with a graft. Grafting is designed to be used for bringing in legacy repositories is my understanding. It lets you <em>manually</em> tell git that some ref has a common parent.</p> <p>As mentioned in the comments, there may be a simpler solution. This would work if all else failed t...
119, 6452
git, git-svn
<h1>"Unable to determine upstream SVN information from working tree history"</h1> <p>I'm trying to use the GCC git mirror, documented <a href="http://gcc.gnu.org/wiki/GitMirror" rel="noreferrer">here</a>.</p> <p>Some time ago, I cloned the git repository:</p> <pre><code>git clone git://gcc.gnu.org/git/gcc.git </code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,208
git
# "Unable to determine upstream SVN information from working tree history" I'm trying to use the GCC git mirror, documented [here](http://gcc.gnu.org/wiki/GitMirror). Some time ago, I cloned the git repository: ``` git clone git://gcc.gnu.org/git/gcc.git ``` Added the git-svn stuff: ``` git svn init -Ttrunk --pref...
You should be able to do this with a graft. Grafting is designed to be used for bringing in legacy repositories is my understanding. It lets you *manually* tell git that some ref has a common parent. As mentioned in the comments, there may be a simpler solution. This would work if all else failed though. You'd pull d...
6938142
How to get Maven release to clone git submodules?
15
2011-08-04 08:13:19
<p>I've got a Maven project with some git submodules linked. Everything works fine until I do a release:prepare or :perform, the clean checkout these targets perform does not contain the submodules (or in other words, git clone is not recursive). I could not find a proper way to configure Maven to call git clone with t...
8,733
68,665
2023-05-03 18:48:24
7,446,233
14
2011-09-16 14:30:42
644,326
2023-05-03 18:48:24
https://stackoverflow.com/q/6938142
https://stackoverflow.com/a/7446233
<p>I just added the following plugin:</p> <pre><code>&lt;!-- This is a workaround to get submodules working with the maven release plugin --&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.1&lt;/version&gt; &lt;e...
<p>I just added the following plugin:</p> <pre><code>&lt;!-- This is a workaround to get submodules working with the maven release plugin --&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.1&lt;/version&gt; &lt;e...
119, 41127, 41612
git, git-submodules, maven
<h1>How to get Maven release to clone git submodules?</h1> <p>I've got a Maven project with some git submodules linked. Everything works fine until I do a release:prepare or :perform, the clean checkout these targets perform does not contain the submodules (or in other words, git clone is not recursive). I could not fi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,209
git
# How to get Maven release to clone git submodules? I've got a Maven project with some git submodules linked. Everything works fine until I do a release:prepare or :perform, the clean checkout these targets perform does not contain the submodules (or in other words, git clone is not recursive). I could not find a prop...
I just added the following plugin: ``` <!-- This is a workaround to get submodules working with the maven release plugin --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions> <execution> <phase>initialize</ph...
5632520
apparently same commits give different sha1, why?
15
2011-04-12 08:41:10
<p>After re-write of a subtree history from a repository with a script of mine, I compared it with what would do a <code>git filter-branch ...</code> on that same subtree. I see that initial commits have different sha1 although I expected them to be identical (consequence of this is that all commits from both histories...
4,302
495,026
2014-07-30 17:12:40
5,632,680
14
2011-04-12 08:55:08
5,353
2014-07-30 17:12:40
https://stackoverflow.com/q/5632520
https://stackoverflow.com/a/5632680
<p>Git's inputs to a commit hash include metadata such as the SHA1 of the tree, the SHA1 of the parent, the commiter's name, email and commit date, and the author's name, email and commit date. So when you rewrote history, the commiter commit date and the tree (since you did a <code>filter-branch</code>) have probably ...
<p>Git's inputs to a commit hash include metadata such as the SHA1 of the tree, the SHA1 of the parent, the commiter's name, email and commit date, and the author's name, email and commit date. So when you rewrote history, the commiter commit date and the tree (since you did a <code>filter-branch</code>) have probably ...
119, 3190, 5597
commit, git, sha1
<h1>apparently same commits give different sha1, why?</h1> <p>After re-write of a subtree history from a repository with a script of mine, I compared it with what would do a <code>git filter-branch ...</code> on that same subtree. I see that initial commits have different sha1 although I expected them to be identical (...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,210
git
# apparently same commits give different sha1, why? After re-write of a subtree history from a repository with a script of mine, I compared it with what would do a `git filter-branch ...` on that same subtree. I see that initial commits have different sha1 although I expected them to be identical (consequence of this ...
Git's inputs to a commit hash include metadata such as the SHA1 of the tree, the SHA1 of the parent, the commiter's name, email and commit date, and the author's name, email and commit date. So when you rewrote history, the commiter commit date and the tree (since you did a `filter-branch`) have probably changed, hence...
4799382
Is there any way to incrementally build commit messages in git?
15
2011-01-25 22:04:18
<p>I'm wondering if it is possible to build git commit messages incrementally, documenting what I'm doing as I make code changes:</p> <ol> <li>Check out and begin work</li> <li>Enter commit message title (i.e. summary)</li> <li>Make a code change</li> <li>Update my commit message to describe change</li> <li>Repeat 3 a...
2,623
263,607
2011-01-25 22:17:39
4,799,424
14
2011-01-25 22:10:07
28,804
2011-01-25 22:10:07
https://stackoverflow.com/q/4799382
https://stackoverflow.com/a/4799424
<p><code>git commit</code> can take a commit message from a file using the <code>-F</code> option. So, you can do something like this:</p> <pre><code># Do some work $ echo 'Did some work' &gt; commit-msg.txt # Do some more work $ echo 'Did some more work' &gt;&gt; commit-msg.txt $ git commit -F commit-msg.txt </code><...
<p><code>git commit</code> can take a commit message from a file using the <code>-F</code> option. So, you can do something like this:</p> <pre><code># Do some work $ echo 'Did some work' &gt; commit-msg.txt # Do some more work $ echo 'Did some more work' &gt;&gt; commit-msg.txt $ git commit -F commit-msg.txt </code><...
119, 1863, 5597
commit, git, message
<h1>Is there any way to incrementally build commit messages in git?</h1> <p>I'm wondering if it is possible to build git commit messages incrementally, documenting what I'm doing as I make code changes:</p> <ol> <li>Check out and begin work</li> <li>Enter commit message title (i.e. summary)</li> <li>Make a code change...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,211
git
# Is there any way to incrementally build commit messages in git? I'm wondering if it is possible to build git commit messages incrementally, documenting what I'm doing as I make code changes: 1. Check out and begin work 2. Enter commit message title (i.e. summary) 3. Make a code change 4. Update my commit message to...
`git commit` can take a commit message from a file using the `-F` option. So, you can do something like this: ``` # Do some work $ echo 'Did some work' > commit-msg.txt # Do some more work $ echo 'Did some more work' >> commit-msg.txt $ git commit -F commit-msg.txt ```
3913736
Git repository with git directory stored elsewhere
15
2010-10-12 10:37:27
<p>I'm sorry if this is a duplicate, I've searched google and SO and couldn't find anything similar since it's a fairly generic set of words to search for!</p> <p>What I want is to have the .git directory be outside of the working tree.</p> <p>I need to do this because it's a 'stealth' git repository inside a project...
4,045
40,834
2010-10-21 13:22:24
3,914,003
14
2010-10-12 11:10:42
19,563
2010-10-12 11:10:42
https://stackoverflow.com/q/3913736
https://stackoverflow.com/a/3914003
<p>You can specify the path to the git repository explicitly with the <code>--git-dir</code> global option for all git commands. When you use this option with <code>init</code> it usually creates a bare repository but if you supply <code>--work-tree</code> as well you can initialize a non-bare repository with a 'detach...
<p>You can specify the path to the git repository explicitly with the <code>--git-dir</code> global option for all git commands. When you use this option with <code>init</code> it usually creates a bare repository but if you supply <code>--work-tree</code> as well you can initialize a non-bare repository with a 'detach...
119
git
<h1>Git repository with git directory stored elsewhere</h1> <p>I'm sorry if this is a duplicate, I've searched google and SO and couldn't find anything similar since it's a fairly generic set of words to search for!</p> <p>What I want is to have the .git directory be outside of the working tree.</p> <p>I need to do t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,212
git
# Git repository with git directory stored elsewhere I'm sorry if this is a duplicate, I've searched google and SO and couldn't find anything similar since it's a fairly generic set of words to search for! What I want is to have the .git directory be outside of the working tree. I need to do this because it's a 'ste...
You can specify the path to the git repository explicitly with the `--git-dir` global option for all git commands. When you use this option with `init` it usually creates a bare repository but if you supply `--work-tree` as well you can initialize a non-bare repository with a 'detached' working tree. ``` git --git-dir...
61263083
How to query git log for Co-Authored-By
14
2020-04-17 02:17:46
<p>If I want to find commits authored by Joe Blo, easy:</p> <pre><code>git log --author=joe.blo@x.com </code></pre> <p>But what if the commit was created as follows:</p> <pre><code>git commit -m "Our awesome code changes. &gt; &gt; Co-authored-by: Joe Blo &lt;joe.blo@x.com&gt; Co-authored-by: Henry Chilinsky &lt;hen...
3,687
441,960
2023-03-08 13:01:33
61,264,586
14
2020-04-17 05:17:10
6,309
2020-04-17 05:17:10
https://stackoverflow.com/q/61263083
https://stackoverflow.com/a/61264586
<p>You could use the <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem" rel="noreferrer">trailer options</a>, because <code>Co-authored-by</code> is a trailer in a commit message.</p> <pre><code>git log --format="%h %s %(trailers:key=Co-authored-by)" </code></pre> <p>But you will...
<p>You could use the <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem" rel="noreferrer">trailer options</a>, because <code>Co-authored-by</code> is a trailer in a commit message.</p> <pre><code>git log --format="%h %s %(trailers:key=Co-authored-by)" </code></pre> <p>But you will...
119
git
<h1>How to query git log for Co-Authored-By</h1> <p>If I want to find commits authored by Joe Blo, easy:</p> <pre><code>git log --author=joe.blo@x.com </code></pre> <p>But what if the commit was created as follows:</p> <pre><code>git commit -m "Our awesome code changes. &gt; &gt; Co-authored-by: Joe Blo &lt;joe.blo@...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,214
git
# How to query git log for Co-Authored-By If I want to find commits authored by Joe Blo, easy: ``` git log --author=joe.blo@x.com ``` But what if the commit was created as follows: ``` git commit -m "Our awesome code changes. > > Co-authored-by: Joe Blo <joe.blo@x.com> Co-authored-by: Henry Chilinsky <henry@example...
You could use the [trailer options](https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem), because `Co-authored-by` is a trailer in a commit message. ``` git log --format="%h %s %(trailers:key=Co-authored-by)" ``` But you will need to grep the result for Joe. `valueonly` would filter on th...
55336399
Rebase without removing old branch
14
2019-03-25 11:05:46
<p>I have the following situation in Git:</p> <pre><code>A--B--C--D--E--F--G \--H--I </code></pre> <p>I want to rebase the branch, but keep the original branch. So I want this:</p> <pre><code>A--B--C--D--E--F--G \--H--I \--H'--I' </code></pre> <p>The reason is that it's possible that my rebased br...
4,052
15,349
2019-04-09 19:33:03
55,336,422
14
2019-03-25 11:07:17
1,057,485
2019-03-26 22:10:22
https://stackoverflow.com/q/55336399
https://stackoverflow.com/a/55336422
<p>Just create a new branch an work on it.</p> <pre><code>git checkout your-old-branch git checkout -b to-be-rebased git rebase master </code></pre> <p>and work on <code>to-be-rebased</code> until you have something workable.</p> <p>So <code>your-old-branch</code> still points to the same exact commit, unaffected.</...
<p>Just create a new branch an work on it.</p> <pre><code>git checkout your-old-branch git checkout -b to-be-rebased git rebase master </code></pre> <p>and work on <code>to-be-rebased</code> until you have something workable.</p> <p>So <code>your-old-branch</code> still points to the same exact commit, unaffected.</...
119, 8974, 29934
git, git-rebase, rebase
<h1>Rebase without removing old branch</h1> <p>I have the following situation in Git:</p> <pre><code>A--B--C--D--E--F--G \--H--I </code></pre> <p>I want to rebase the branch, but keep the original branch. So I want this:</p> <pre><code>A--B--C--D--E--F--G \--H--I \--H'--I' </code></pre> <p>The rea...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,215
git
# Rebase without removing old branch I have the following situation in Git: ``` A--B--C--D--E--F--G \--H--I ``` I want to rebase the branch, but keep the original branch. So I want this: ``` A--B--C--D--E--F--G \--H--I \--H'--I' ``` The reason is that it's possible that my rebased branch will bre...
Just create a new branch an work on it. ``` git checkout your-old-branch git checkout -b to-be-rebased git rebase master ``` and work on `to-be-rebased` until you have something workable. So `your-old-branch` still points to the same exact commit, unaffected. --- ...and the two first checkout steps can be combined...
39423122
Python Git diff parser
14
2016-09-10 06:04:16
<p>I would like to parse git diff with Python code and I am interested to get following information from diff parser:</p> <ol> <li>Content of deleted/added lines and also line number.</li> <li>File name.</li> <li>Status of file whether it is deleted, renamed or added.</li> </ol> <p>I am using <a href="https://pypi.pyth...
19,835
4,530,806
2023-11-09 23:27:33
39,909,397
14
2016-10-07 04:29:09
4,530,806
2023-11-09 23:27:33
https://stackoverflow.com/q/39423122
https://stackoverflow.com/a/39909397
<p><strong>Update</strong>:<br /> I found my old answer is not working anymore. Here is the new solution:<br /> For this solution, you need <a href="https://pypi.org/project/GitPython/" rel="nofollow noreferrer">git</a> and <a href="https://pypi.org/project/unidiff/" rel="nofollow noreferrer">unidiff</a> packages.</p> ...
<p><strong>Update</strong>:<br /> I found my old answer is not working anymore. Here is the new solution:<br /> For this solution, you need <a href="https://pypi.org/project/GitPython/" rel="nofollow noreferrer">git</a> and <a href="https://pypi.org/project/unidiff/" rel="nofollow noreferrer">unidiff</a> packages.</p> ...
16, 119, 1357, 61013
git, gitpython, parsing, python
<h1>Python Git diff parser</h1> <p>I would like to parse git diff with Python code and I am interested to get following information from diff parser:</p> <ol> <li>Content of deleted/added lines and also line number.</li> <li>File name.</li> <li>Status of file whether it is deleted, renamed or added.</li> </ol> <p>I am ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,217
git
# Python Git diff parser I would like to parse git diff with Python code and I am interested to get following information from diff parser: 1. Content of deleted/added lines and also line number. 2. File name. 3. Status of file whether it is deleted, renamed or added. I am using [unidiff 0.5.2](https://pypi.python.o...
**Update**: I found my old answer is not working anymore. Here is the new solution: For this solution, you need [git](https://pypi.org/project/GitPython/) and [unidiff](https://pypi.org/project/unidiff/) packages. ``` import git from unidiff import PatchSet from cStringIO import StringIO commit_sha1 = 'commit_sh...
33874166
Git cloning a repository that is already a clone
14
2015-11-23 15:02:22
<p>Are there any ill side-effects to do a <code>git clone</code> of a repository that is already clone of another remote repository? </p>
18,003
1,205,019
2019-11-09 21:07:44
33,874,960
14
2015-11-23 15:42:49
720,999
2015-11-23 16:50:38
https://stackoverflow.com/q/33874166
https://stackoverflow.com/a/33874960
<p>There's no side effects but you should understand exactly what happens when you clone a repository.</p> <h3>Some theory</h3> <p>The "problem" is that when you clone a repository "the normal way"&mdash;that is, without any funky knobs adjusted when calling <code>git clone</code>&mdash;you <em>do not</em> end up wit...
<p>There's no side effects but you should understand exactly what happens when you clone a repository.</p> <h3>Some theory</h3> <p>The "problem" is that when you clone a repository "the normal way"&mdash;that is, without any funky knobs adjusted when calling <code>git clone</code>&mdash;you <em>do not</em> end up wit...
119, 34099
git, git-clone
<h1>Git cloning a repository that is already a clone</h1> <p>Are there any ill side-effects to do a <code>git clone</code> of a repository that is already clone of another remote repository? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,219
git
# Git cloning a repository that is already a clone Are there any ill side-effects to do a `git clone` of a repository that is already clone of another remote repository?
There's no side effects but you should understand exactly what happens when you clone a repository. ### Some theory The "problem" is that when you clone a repository "the normal way"—that is, without any funky knobs adjusted when calling `git clone`—you *do not* end up with a repository which is *the same* as the sou...
33793230
Merge branch without deleting it in git
14
2015-11-19 00:33:55
<p>Can I merge a branch without deleting it?</p> <p>If I have branch "personal-work-in-progress", and a branch "feature/ABC-123" that is five commits ahead of it, is it possible to merge the five commits from feature/ABC-123 into personal-work-in-progress without deleting the feature/ABC-123 branch?</p> <p>I know doi...
24,971
38,765
2015-11-19 01:22:39
33,793,258
14
2015-11-19 00:37:39
2,148,468
2015-11-19 00:37:39
https://stackoverflow.com/q/33793230
https://stackoverflow.com/a/33793258
<p>Try this</p> <pre><code>git merge branch_name </code></pre> <p><a href="https://www.atlassian.com/git/tutorials/using-branches/git-merge" rel="noreferrer">https://www.atlassian.com/git/tutorials/using-branches/git-merge</a></p>
<p>Try this</p> <pre><code>git merge branch_name </code></pre> <p><a href="https://www.atlassian.com/git/tutorials/using-branches/git-merge" rel="noreferrer">https://www.atlassian.com/git/tutorials/using-branches/git-merge</a></p>
119, 28897
git, git-merge
<h1>Merge branch without deleting it in git</h1> <p>Can I merge a branch without deleting it?</p> <p>If I have branch "personal-work-in-progress", and a branch "feature/ABC-123" that is five commits ahead of it, is it possible to merge the five commits from feature/ABC-123 into personal-work-in-progress without deleti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,220
git
# Merge branch without deleting it in git Can I merge a branch without deleting it? If I have branch "personal-work-in-progress", and a branch "feature/ABC-123" that is five commits ahead of it, is it possible to merge the five commits from feature/ABC-123 into personal-work-in-progress without deleting the feature/A...
Try this ``` git merge branch_name ``` <https://www.atlassian.com/git/tutorials/using-branches/git-merge>
26600506
Git: restore my changes which were amended to merge commit
14
2014-10-28 03:37:34
<p>I accidentally amended merge commit instead of creating new one. Now I don't know how to extract the changes to normal commit which I can push. The changes will show up in gitk, but will not appear in format-patch. Please, help.</p>
1,942
90,096
2021-02-18 22:05:21
26,615,002
14
2014-10-28 17:44:34
4,021,077
2015-06-16 20:30:23
https://stackoverflow.com/q/26600506
https://stackoverflow.com/a/26615002
<p>You have 2 SHAs that are of interest here - the original merge commit, and the amended merge commit. What you want to do is <code>git reset</code> your <code>HEAD</code> to the original merge commit, while preserving your index and working directory. You can then create a new commit hanging off the merge commit.</...
<p>You have 2 SHAs that are of interest here - the original merge commit, and the amended merge commit. What you want to do is <code>git reset</code> your <code>HEAD</code> to the original merge commit, while preserving your index and working directory. You can then create a new commit hanging off the merge commit.</...
119, 53850
git, git-commit
<h1>Git: restore my changes which were amended to merge commit</h1> <p>I accidentally amended merge commit instead of creating new one. Now I don't know how to extract the changes to normal commit which I can push. The changes will show up in gitk, but will not appear in format-patch. Please, help.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,221
git
# Git: restore my changes which were amended to merge commit I accidentally amended merge commit instead of creating new one. Now I don't know how to extract the changes to normal commit which I can push. The changes will show up in gitk, but will not appear in format-patch. Please, help.
You have 2 SHAs that are of interest here - the original merge commit, and the amended merge commit. What you want to do is `git reset` your `HEAD` to the original merge commit, while preserving your index and working directory. You can then create a new commit hanging off the merge commit. Use `git reflog` to find ...
17845192
Avoid the effects of a revert commit in another Git branch while merging
14
2013-07-24 21:32:14
<p>Working with git flow. We have a co-worker who is not familiar with Git that accidentally merged develop into master yesterday. </p> <p>Develop has quite a few features that are launching with our next release, requiring a revert on the merge. This has created a commit which undoes all of the changes. When we merge...
9,113
494,280
2018-07-03 18:40:45
17,847,028
14
2013-07-25 00:24:59
null
2014-04-28 16:06:14
https://stackoverflow.com/q/17845192
https://stackoverflow.com/a/17847028
<h3>Option 1: Hard reset and force push</h3> <p>If it's possible to do a non-fast-forward forced-update to your <code>master</code> branch in your upstream repository, then instead of reverting the merge of <code>develop</code> into <code>master</code>, you could simply do a hard reset of <code>master</code>:</p> <pr...
<h3>Option 1: Hard reset and force push</h3> <p>If it's possible to do a non-fast-forward forced-update to your <code>master</code> branch in your upstream repository, then instead of reverting the merge of <code>develop</code> into <code>master</code>, you could simply do a hard reset of <code>master</code>:</p> <pr...
119, 34403, 64339
git, git-flow, git-revert
<h1>Avoid the effects of a revert commit in another Git branch while merging</h1> <p>Working with git flow. We have a co-worker who is not familiar with Git that accidentally merged develop into master yesterday. </p> <p>Develop has quite a few features that are launching with our next release, requiring a revert on t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,222
git
# Avoid the effects of a revert commit in another Git branch while merging Working with git flow. We have a co-worker who is not familiar with Git that accidentally merged develop into master yesterday. Develop has quite a few features that are launching with our next release, requiring a revert on the merge. This ha...
### Option 1: Hard reset and force push If it's possible to do a non-fast-forward forced-update to your `master` branch in your upstream repository, then instead of reverting the merge of `develop` into `master`, you could simply do a hard reset of `master`: ``` # On master branch, do a hard reset back to the commit ...
17558886
Temporarily remove feature from a Git branch
14
2013-07-09 21:49:06
<p>We use git to manage our app's code repository, and have a situation that I have yet to encounter, but I imagine is very common.</p> <p>We would like to temporarily remove a feature, and then add it back in at some point in the future. I am trying to imagine the branching structure that would support this, or if we...
3,666
357,801
2013-07-10 04:25:47
17,562,205
14
2013-07-10 03:56:22
null
2013-07-10 04:25:47
https://stackoverflow.com/q/17558886
https://stackoverflow.com/a/17562205
<p>One way you can temporarily remove your feature that predates your Git repo history is to make a commit that removes the feature. Then when you want to add the feature back in, simply <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html">revert the commit</a> that took it out. This will do a r...
<p>One way you can temporarily remove your feature that predates your Git repo history is to make a commit that removes the feature. Then when you want to add the feature back in, simply <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html">revert the commit</a> that took it out. This will do a r...
119
git
<h1>Temporarily remove feature from a Git branch</h1> <p>We use git to manage our app's code repository, and have a situation that I have yet to encounter, but I imagine is very common.</p> <p>We would like to temporarily remove a feature, and then add it back in at some point in the future. I am trying to imagine the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,223
git
# Temporarily remove feature from a Git branch We use git to manage our app's code repository, and have a situation that I have yet to encounter, but I imagine is very common. We would like to temporarily remove a feature, and then add it back in at some point in the future. I am trying to imagine the branching struc...
One way you can temporarily remove your feature that predates your Git repo history is to make a commit that removes the feature. Then when you want to add the feature back in, simply [revert the commit](https://www.kernel.org/pub/software/scm/git/docs/git-revert.html) that took it out. This will do a reverse patch, me...
14609620
So Visual Studio officially supports Git now. What does that mean?
14
2013-01-30 17:05:13
<p>I just read an extremely interesting <a href="http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/30/getting-started-with-git-in-visual-studio-and-team-foundation-service.aspx">article</a> that apparently as of this past Visual Studio 2012 update, it now has official Git support built in. </p> <p>My question is...
3,107
69,742
2014-01-01 07:55:17
14,609,842
14
2013-01-30 17:16:30
729,881
2014-01-01 07:55:17
https://stackoverflow.com/q/14609620
https://stackoverflow.com/a/14609842
<p><a href="http://tfs.visualstudio.com/" rel="nofollow">Visual Studio Online</a> hosts git repositories and provide integration to TFS work item tracking and builds. We store this information in a proper git repository - it's not a transparent <strong><a href="http://gittf.codeplex.com/" rel="nofollow"><code>git-tf</...
<p><a href="http://tfs.visualstudio.com/" rel="nofollow">Visual Studio Online</a> hosts git repositories and provide integration to TFS work item tracking and builds. We store this information in a proper git repository - it's not a transparent <strong><a href="http://gittf.codeplex.com/" rel="nofollow"><code>git-tf</...
119, 456, 733, 33953, 80825
git, tfs, version-control, visual-studio, visual-studio-2012
<h1>So Visual Studio officially supports Git now. What does that mean?</h1> <p>I just read an extremely interesting <a href="http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/30/getting-started-with-git-in-visual-studio-and-team-foundation-service.aspx">article</a> that apparently as of this past Visual Studio 20...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,224
git
# So Visual Studio officially supports Git now. What does that mean? I just read an extremely interesting [article](http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/30/getting-started-with-git-in-visual-studio-and-team-foundation-service.aspx) that apparently as of this past Visual Studio 2012 update, it now ha...
[Visual Studio Online](http://tfs.visualstudio.com/) hosts git repositories and provide integration to TFS work item tracking and builds. We store this information in a proper git repository - it's not a transparent **[`git-tf`](http://gittf.codeplex.com/)** bridge. Instead, we store git references and objects, althoug...
8309304
What is best practice for keeping secrets out of a git repository?
14
2011-11-29 10:34:01
<p><strong>Problem</strong></p> <p>Consider this file tree as my development repository.</p> <pre> - foo/ - .git/ - [...] - bar/ - backupclient.py - supersecretstoragecredentials.ini </pre> <p>For development, <code>supersecretstoragecredentials.ini</code> needs to be filled in with valid credent...
4,558
202,522
2024-09-11 00:02:34
8,309,450
14
2011-11-29 10:45:40
1,385,252
2024-09-11 00:02:34
https://stackoverflow.com/q/8309304
https://stackoverflow.com/a/8309450
<p>Check in the <code>supersecretstoragecredentials.ini</code> file with some placeholder values and then</p> <pre><code>git update-index --assume-unchanged supersecretstoragecredentials.ini </code></pre> <p>Git will not track future changes to this file.</p> <p>You can reset this using</p> <pre><code>git update-index ...
<p>Check in the <code>supersecretstoragecredentials.ini</code> file with some placeholder values and then</p> <pre><code>git update-index --assume-unchanged supersecretstoragecredentials.ini </code></pre> <p>Git will not track future changes to this file.</p> <p>You can reset this using</p> <pre><code>git update-index ...
81, 119, 456
git, version-control, versioning
<h1>What is best practice for keeping secrets out of a git repository?</h1> <p><strong>Problem</strong></p> <p>Consider this file tree as my development repository.</p> <pre> - foo/ - .git/ - [...] - bar/ - backupclient.py - supersecretstoragecredentials.ini </pre> <p>For development, <code>super...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,226
git
# What is best practice for keeping secrets out of a git repository? **Problem** Consider this file tree as my development repository. ``` - foo/ - .git/ - [...] - bar/ - backupclient.py - supersecretstoragecredentials.ini ``` For development, `supersecretstoragecredentials.ini` needs to be fill...
Check in the `supersecretstoragecredentials.ini` file with some placeholder values and then ``` git update-index --assume-unchanged supersecretstoragecredentials.ini ``` Git will not track future changes to this file. You can reset this using ``` git update-index --no-assume-unchanged supersecretstoragecredentials....
6327276
parsing git log output, preferably as xml
14
2011-06-13 06:31:16
<p>I want to parse the output from git log. My current tool does this for svn by parsing the --xml option that svn log has. I can't seem to figure out how to output git log as xml. If xml is not an option, what is the best way to parse this output? I would really like to avoid parsing it as raw text, looking for "a...
8,024
202,431
2011-06-13 06:39:52
6,327,321
14
2011-06-13 06:39:52
635,608
2011-06-13 06:39:52
https://stackoverflow.com/q/6327276
https://stackoverflow.com/a/6327321
<p>You could build your own simple xml output by using the formatting options.</p> <pre><code>git log --pretty=format:"&lt;entry&gt;&lt;author&gt;%an&lt;/author&gt;&lt;commit_date&gt;%cd&lt;/commit_date&gt;&lt;message_body&gt;%b&lt;/message_body&gt;&lt;/entry&gt;" </code></pre> <p>Just add whatever fields you want. (...
<p>You could build your own simple xml output by using the formatting options.</p> <pre><code>git log --pretty=format:"&lt;entry&gt;&lt;author&gt;%an&lt;/author&gt;&lt;commit_date&gt;%cd&lt;/commit_date&gt;&lt;message_body&gt;%b&lt;/message_body&gt;&lt;/entry&gt;" </code></pre> <p>Just add whatever fields you want. (...
19, 119, 942
git, logging, xml
<h1>parsing git log output, preferably as xml</h1> <p>I want to parse the output from git log. My current tool does this for svn by parsing the --xml option that svn log has. I can't seem to figure out how to output git log as xml. If xml is not an option, what is the best way to parse this output? I would really l...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,227
git
# parsing git log output, preferably as xml I want to parse the output from git log. My current tool does this for svn by parsing the --xml option that svn log has. I can't seem to figure out how to output git log as xml. If xml is not an option, what is the best way to parse this output? I would really like to avoid ...
You could build your own simple xml output by using the formatting options. ``` git log --pretty=format:"<entry><author>%an</author><commit_date>%cd</commit_date><message_body>%b</message_body></entry>" ``` Just add whatever fields you want. (You'll need to script a bit if you want proper xml header etc.) See [`man ...
4963261
can i rebase old commits?
14
2011-02-10 22:00:56
<p>I have just started using git. Rebase is great stuff. I should have used it in a specific earlier case.</p> <p>is there a perfectly acceptable way to rebase old commits for the sake of clear commits?</p>
13,476
252,428
2013-02-21 08:02:13
4,963,380
14
2011-02-10 22:16:42
25,848
2013-02-21 08:02:13
https://stackoverflow.com/q/4963261
https://stackoverflow.com/a/4963380
<p>You should positively only do this for commits that have not been pushed upstream. That said, I find it easiest to use <code>git rebase -i &lt;commit&gt;</code> where <code>&lt;commit&gt;</code> is the id of a commit that is at least as old as the newest one you do not want to mess with. When your editor pops up, it...
<p>You should positively only do this for commits that have not been pushed upstream. That said, I find it easiest to use <code>git rebase -i &lt;commit&gt;</code> where <code>&lt;commit&gt;</code> is the id of a commit that is at least as old as the newest one you do not want to mess with. When your editor pops up, it...
119, 8974
git, rebase
<h1>can i rebase old commits?</h1> <p>I have just started using git. Rebase is great stuff. I should have used it in a specific earlier case.</p> <p>is there a perfectly acceptable way to rebase old commits for the sake of clear commits?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,228
git
# can i rebase old commits? I have just started using git. Rebase is great stuff. I should have used it in a specific earlier case. is there a perfectly acceptable way to rebase old commits for the sake of clear commits?
You should positively only do this for commits that have not been pushed upstream. That said, I find it easiest to use `git rebase -i <commit>` where `<commit>` is the id of a commit that is at least as old as the newest one you do not want to mess with. When your editor pops up, it will contain instructions about how ...
4562960
How to move some last Git commits currently on a branch, onto another branch?
14
2010-12-30 13:30:45
<p>I have a repository where I had been working on <code>master</code> branch having last added some 10 or so commits which I now wish were on another branch, as they describe work that I now consider experimental (I am still learning good Git practices).</p> <p>In light of this consideration, I would now like to have...
3,565
254,343
2019-10-06 06:45:31
4,563,090
14
2010-12-30 13:49:20
12,274
2010-12-30 13:49:20
https://stackoverflow.com/q/4562960
https://stackoverflow.com/a/4563090
<pre><code>git checkout master git branch feature-Z git reset &lt;commit_id&gt; </code></pre> <p>where commit_id is an identifier of that last X commit before b branches off.</p>
<pre><code>git checkout master git branch feature-Z git reset &lt;commit_id&gt; </code></pre> <p>where commit_id is an identifier of that last X commit before b branches off.</p>
119, 53847
branching-and-merging, git
<h1>How to move some last Git commits currently on a branch, onto another branch?</h1> <p>I have a repository where I had been working on <code>master</code> branch having last added some 10 or so commits which I now wish were on another branch, as they describe work that I now consider experimental (I am still learnin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,229
git
# How to move some last Git commits currently on a branch, onto another branch? I have a repository where I had been working on `master` branch having last added some 10 or so commits which I now wish were on another branch, as they describe work that I now consider experimental (I am still learning good Git practices...
``` git checkout master git branch feature-Z git reset <commit_id> ``` where commit_id is an identifier of that last X commit before b branches off.
2127142
git: Simple solution for pushing between working copies
14
2010-01-24 13:08:30
<p><b>What I want to do:</b> On my (ssh remotely accessible) university machine I work on a project which I have put under git source control (<code>git init</code>, then <code>git commit -a</code> after every change, all works fine). Now I want to want to work on that project on my private machine at home. Should be e...
3,774
87,698
2019-08-31 12:24:54
2,127,195
14
2010-01-24 13:27:34
19,563
2013-08-29 15:25:16
https://stackoverflow.com/q/2127142
https://stackoverflow.com/a/2127195
<p>You really shouldn't push to the checked out branch as it effectively pulls the rug from under the remote working copy. It's then difficult to work out if the working tree is modified because the branch head has moved or if there were also local changes which would be lost by a <code>reset --hard</code>.</p> <p>The...
<p>You really shouldn't push to the checked out branch as it effectively pulls the rug from under the remote working copy. It's then difficult to work out if the working tree is modified because the branch head has moved or if there were also local changes which would be lost by a <code>reset --hard</code>.</p> <p>The...
119, 3346, 7330, 28898
dvcs, git, git-push, repository
<h1>git: Simple solution for pushing between working copies</h1> <p><b>What I want to do:</b> On my (ssh remotely accessible) university machine I work on a project which I have put under git source control (<code>git init</code>, then <code>git commit -a</code> after every change, all works fine). Now I want to want t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,230
git
# git: Simple solution for pushing between working copies **What I want to do:** On my (ssh remotely accessible) university machine I work on a project which I have put under git source control (`git init`, then `git commit -a` after every change, all works fine). Now I want to want to work on that project on my priva...
You really shouldn't push to the checked out branch as it effectively pulls the rug from under the remote working copy. It's then difficult to work out if the working tree is modified because the branch head has moved or if there were also local changes which would be lost by a `reset --hard`. The simplest thing to do...
17792768
How do I get the interdiff between these two git commits?
13
2013-07-22 16:30:01
<p>I'm trying to view the difference between two revisions of the same commit in git. A diff of the diffs, basically. From what I've read so far, this is known as the "interdiff". I've read several tutorials on how to create interdiffs of git patches, but I haven't been able to get these methods to work in my particula...
3,884
1,157,054
2023-02-06 11:19:43
52,278,675
14
2018-09-11 14:49:44
1,157,054
2023-02-06 11:19:43
https://stackoverflow.com/q/17792768
https://stackoverflow.com/a/52278675
<p>Git 2.19 introduces a new command, <a href="https://git-scm.com/docs/git-range-diff" rel="nofollow noreferrer"><code>git range-diff</code></a> which does this:</p> <blockquote> <p>git-range-diff - Compare two commit ranges (e.g. two versions of a branch)</p> <pre><code>git range-diff [--color=[&lt;when&gt;]] [--no-c...
<p>Git 2.19 introduces a new command, <a href="https://git-scm.com/docs/git-range-diff" rel="nofollow noreferrer"><code>git range-diff</code></a> which does this:</p> <blockquote> <p>git-range-diff - Compare two commit ranges (e.g. two versions of a branch)</p> <pre><code>git range-diff [--color=[&lt;when&gt;]] [--no-c...
119
git
<h1>How do I get the interdiff between these two git commits?</h1> <p>I'm trying to view the difference between two revisions of the same commit in git. A diff of the diffs, basically. From what I've read so far, this is known as the "interdiff". I've read several tutorials on how to create interdiffs of git patches, b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,233
git
# How do I get the interdiff between these two git commits? I'm trying to view the difference between two revisions of the same commit in git. A diff of the diffs, basically. From what I've read so far, this is known as the "interdiff". I've read several tutorials on how to create interdiffs of git patches, but I have...
Git 2.19 introduces a new command, [`git range-diff`](https://git-scm.com/docs/git-range-diff) which does this: > git-range-diff - Compare two commit ranges (e.g. two versions of a branch) > > ``` > git range-diff [--color=[<when>]] [--no-color] [<diff-options>] [--no-dual-color] > [--creation-factor=<f...
51598845
Git merge only the diff between two branches
13
2018-07-30 16:52:34
<p>Say I have <code>branchA</code> with the latest features and then I have the <code>branchB</code>which has the hotfixes not yet sync into <code>branchA</code>.</p> <p>What I want to do is merged all hotfixes into that latest features (<code>branchA</code>) but only the diff. I saw that <code>git log branchA..branch...
8,888
3,974,048
2021-03-23 23:47:44
51,599,084
14
2018-07-30 17:08:57
2,317,875
2018-07-30 17:08:57
https://stackoverflow.com/q/51598845
https://stackoverflow.com/a/51599084
<p>You're very close. You can do it as a patch:</p> <pre><code>git diff branchA..branchB &gt; mypatch.patch </code></pre> <p>Then apply the patch to the desired branch:</p> <pre><code>git apply mypatch.patch </code></pre>
<p>You're very close. You can do it as a patch:</p> <pre><code>git diff branchA..branchB &gt; mypatch.patch </code></pre> <p>Then apply the patch to the desired branch:</p> <pre><code>git apply mypatch.patch </code></pre>
119
git
<h1>Git merge only the diff between two branches</h1> <p>Say I have <code>branchA</code> with the latest features and then I have the <code>branchB</code>which has the hotfixes not yet sync into <code>branchA</code>.</p> <p>What I want to do is merged all hotfixes into that latest features (<code>branchA</code>) but o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,234
git
# Git merge only the diff between two branches Say I have `branchA` with the latest features and then I have the `branchB`which has the hotfixes not yet sync into `branchA`. What I want to do is merged all hotfixes into that latest features (`branchA`) but only the diff. I saw that `git log branchA..branchB` actually...
You're very close. You can do it as a patch: ``` git diff branchA..branchB > mypatch.patch ``` Then apply the patch to the desired branch: ``` git apply mypatch.patch ```
49366387
Why extra changes in git cherry-pick conflict?
13
2018-03-19 15:17:22
<p>For <code>git cherry-pick</code> resulting in a conflict, why does Git suggest more changes than just from the given commit?</p> <p>Example:</p> <pre><code>-bash-4.2$ git init Initialized empty Git repository in /home/pfusik/cp-so/.git/ -bash-4.2$ echo one &gt;f -bash-4.2$ git add f -bash-4.2$ git commit -m "one" ...
3,336
2,032,514
2018-03-19 17:35:52
49,369,115
14
2018-03-19 17:35:52
1,256,452
2018-03-19 17:35:52
https://stackoverflow.com/q/49366387
https://stackoverflow.com/a/49369115
<p>Before we get any further, let's draw the commit graph:</p> <pre><code>A &lt;-- master (HEAD) \ B--C--D--E &lt;-- foo </code></pre> <p>or, so that you can compare, here's the way Git draws it:</p> <pre><code>$ git log --all --decorate --oneline --graph * 7c29363 (foo) five * a35e919 four * ee70402 three * ...
<p>Before we get any further, let's draw the commit graph:</p> <pre><code>A &lt;-- master (HEAD) \ B--C--D--E &lt;-- foo </code></pre> <p>or, so that you can compare, here's the way Git draws it:</p> <pre><code>$ git log --all --decorate --oneline --graph * 7c29363 (foo) five * a35e919 four * ee70402 three * ...
119, 78810
git, git-cherry-pick
<h1>Why extra changes in git cherry-pick conflict?</h1> <p>For <code>git cherry-pick</code> resulting in a conflict, why does Git suggest more changes than just from the given commit?</p> <p>Example:</p> <pre><code>-bash-4.2$ git init Initialized empty Git repository in /home/pfusik/cp-so/.git/ -bash-4.2$ echo one &g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,235
git
# Why extra changes in git cherry-pick conflict? For `git cherry-pick` resulting in a conflict, why does Git suggest more changes than just from the given commit? Example: ``` -bash-4.2$ git init Initialized empty Git repository in /home/pfusik/cp-so/.git/ -bash-4.2$ echo one >f -bash-4.2$ git add f -bash-4.2$ git c...
Before we get any further, let's draw the commit graph: ``` A <-- master (HEAD) \ B--C--D--E <-- foo ``` or, so that you can compare, here's the way Git draws it: ``` $ git log --all --decorate --oneline --graph * 7c29363 (foo) five * a35e919 four * ee70402 three * 9a179e6 two * d443a2a (HEAD -> master) one `...
42390650
How to annotate an existing tag in git
13
2017-02-22 11:53:27
<p>I created a tag but didn't use -m option, so my tag is not associated with a message (is not annotated). How can I add a message to this already created tag?</p>
5,094
3,915,143
2017-02-22 11:56:13
42,390,719
14
2017-02-22 11:56:13
2,246,084
2017-02-22 11:56:13
https://stackoverflow.com/q/42390650
https://stackoverflow.com/a/42390719
<p>As described in <a href="https://stackoverflow.com/questions/8044583/how-can-i-move-a-tag-on-a-git-branch-to-a-different-commit">this question</a>, you can override a tag with the force option. (<code>-f</code> or <code>--force</code>).</p> <p>Create a tag with the same name as the tag you want to override, add you...
<p>As described in <a href="https://stackoverflow.com/questions/8044583/how-can-i-move-a-tag-on-a-git-branch-to-a-different-commit">this question</a>, you can override a tag with the force option. (<code>-f</code> or <code>--force</code>).</p> <p>Create a tag with the same name as the tag you want to override, add you...
119
git
<h1>How to annotate an existing tag in git</h1> <p>I created a tag but didn't use -m option, so my tag is not associated with a message (is not annotated). How can I add a message to this already created tag?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,237
git
# How to annotate an existing tag in git I created a tag but didn't use -m option, so my tag is not associated with a message (is not annotated). How can I add a message to this already created tag?
As described in [this question](https://stackoverflow.com/questions/8044583/how-can-i-move-a-tag-on-a-git-branch-to-a-different-commit), you can override a tag with the force option. (`-f` or `--force`). Create a tag with the same name as the tag you want to override, add your `-m` option, and add the force option. I...
41771089
Trigger `git prune` automatically on `git pull`?
13
2017-01-20 19:33:55
<p>On my local copy of a company-wide repository (where I make lots of short-lived branches and <code>git rebase</code> very very often, and where many other people are also pushing short-lived branches to the <code>origin</code> I'm pulling from), I regularly have the following conversation with git.</p> <pre><code>(...
18,672
1,424,877
2017-01-20 21:37:46
41,771,616
14
2017-01-20 20:11:23
1,256,452
2017-01-20 21:37:46
https://stackoverflow.com/q/41771089
https://stackoverflow.com/a/41771616
<p>The problem is most likely that you generate loose objects fast enough to, in effect, overrun <a href="https://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer">the default <code>git gc</code> protection time of <code>2.weeks.ago</code></a>:</p> <blockquote> <p><code>--prune=&lt;date&gt;</cod...
<p>The problem is most likely that you generate loose objects fast enough to, in effect, overrun <a href="https://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer">the default <code>git gc</code> protection time of <code>2.weeks.ago</code></a>:</p> <blockquote> <p><code>--prune=&lt;date&gt;</cod...
119
git
<h1>Trigger `git prune` automatically on `git pull`?</h1> <p>On my local copy of a company-wide repository (where I make lots of short-lived branches and <code>git rebase</code> very very often, and where many other people are also pushing short-lived branches to the <code>origin</code> I'm pulling from), I regularly h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,238
git
# Trigger `git prune` automatically on `git pull`? On my local copy of a company-wide repository (where I make lots of short-lived branches and `git rebase` very very often, and where many other people are also pushing short-lived branches to the `origin` I'm pulling from), I regularly have the following conversation ...
The problem is most likely that you generate loose objects fast enough to, in effect, overrun [the default `git gc` protection time of `2.weeks.ago`](https://www.kernel.org/pub/software/scm/git/docs/git-gc.html): > `--prune=<date>` >        Prune loose objects older than date (default is 2 weeks ago, > overridable b...
39272468
How can I use GitKraken on a private network?
13
2016-09-01 13:12:25
<p>I've been using GitKraken on Windows for various projects and now I have to do some development on a private network (no internet access). But when I start the application it asks me to create an account. I can't do that on this network.</p> <p>How can I configure GitKraken on this network without creating an accou...
19,635
6,783,443
2019-06-12 06:25:28
41,542,549
14
2017-01-09 06:58:28
4,392,962
2017-01-09 06:58:28
https://stackoverflow.com/q/39272468
https://stackoverflow.com/a/41542549
<p>You need to take (for Windows): <code>...\user\AppData\Roaming\.gitkraken</code> and <code>...\user\AppData\Roaming\GitKraken</code> from machine with internet access and place it to machine with a private network. </p>
<p>You need to take (for Windows): <code>...\user\AppData\Roaming\.gitkraken</code> and <code>...\user\AppData\Roaming\GitKraken</code> from machine with internet access and place it to machine with a private network. </p>
119628
gitkraken
<h1>How can I use GitKraken on a private network?</h1> <p>I've been using GitKraken on Windows for various projects and now I have to do some development on a private network (no internet access). But when I start the application it asks me to create an account. I can't do that on this network.</p> <p>How can I config...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,239
git
# How can I use GitKraken on a private network? I've been using GitKraken on Windows for various projects and now I have to do some development on a private network (no internet access). But when I start the application it asks me to create an account. I can't do that on this network. How can I configure GitKraken on...
You need to take (for Windows): `...\user\AppData\Roaming\.gitkraken` and `...\user\AppData\Roaming\GitKraken` from machine with internet access and place it to machine with a private network.
35714287
Does "pure git" have the concept of a pull request?
13
2016-03-01 03:49:17
<p>Of course, there's <code>git pull</code>, but is there a formalized method (i.e. not an ad hoc method such as sending an email) of making a pull request in "pure" git?</p>
2,212
116
2016-05-08 21:25:07
35,714,517
14
2016-03-01 04:12:52
1,755,598
2016-03-01 04:32:53
https://stackoverflow.com/q/35714287
https://stackoverflow.com/a/35714517
<p>The answer is yes.</p> <p>The <code>pull request</code> is based upon git internal feature name : <code>request-pull</code></p> <h3><code>git request-pull</code></h3> <p>Here are the doc for this feature</p> <ul> <li><a href="https://git-scm.com/docs/git-request-pull" rel="noreferrer">https://git-scm.com/docs/git-re...
<p>The answer is yes.</p> <p>The <code>pull request</code> is based upon git internal feature name : <code>request-pull</code></p> <h3><code>git request-pull</code></h3> <p>Here are the doc for this feature</p> <ul> <li><a href="https://git-scm.com/docs/git-request-pull" rel="noreferrer">https://git-scm.com/docs/git-re...
119, 456, 28896, 64512
git, git-pull, pull-request, version-control
<h1>Does "pure git" have the concept of a pull request?</h1> <p>Of course, there's <code>git pull</code>, but is there a formalized method (i.e. not an ad hoc method such as sending an email) of making a pull request in "pure" git?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,240
git
# Does "pure git" have the concept of a pull request? Of course, there's `git pull`, but is there a formalized method (i.e. not an ad hoc method such as sending an email) of making a pull request in "pure" git?
The answer is yes. The `pull request` is based upon git internal feature name : `request-pull` ### `git request-pull` Here are the doc for this feature - <https://git-scm.com/docs/git-request-pull> - <https://www.kernel.org/pub/software/scm/git/docs/git-request-pull.html> Based upon this concept the `pull request`...
34985437
How to use gitk with msys2?
13
2016-01-25 04:59:39
<p>I am using MSYS2 in Windows 10. <code>git</code> works fine, however <code>gitk</code> gives the error:</p> <pre><code>/usr/bin/gitk: line 3: exec: wish: not found </code></pre> <p>Some googling suggested this may be because TK is not installed, however I tried:</p> <pre><code>pacman -S tk </code></pre> <p>which...
4,412
1,505,939
2016-04-28 14:26:40
34,987,903
14
2016-01-25 08:17:57
28,128
2016-04-28 14:26:40
https://stackoverflow.com/q/34985437
https://stackoverflow.com/a/34987903
<p>Try running the 64-bit MinGW shell (one of the three environments provided by MSYS2), installing the package <code>mingw-w64-x86_64-tk</code>, and then running <code>gitk</code>.</p> <p>Gitk works on my system, and <code>wish</code> is provided <code>/mingw64/bin/wish.exe</code>.</p>
<p>Try running the 64-bit MinGW shell (one of the three environments provided by MSYS2), installing the package <code>mingw-w64-x86_64-tk</code>, and then running <code>gitk</code>.</p> <p>Gitk works on my system, and <code>wish</code> is provided <code>/mingw64/bin/wish.exe</code>.</p>
64, 119, 105819
git, msys2, windows
<h1>How to use gitk with msys2?</h1> <p>I am using MSYS2 in Windows 10. <code>git</code> works fine, however <code>gitk</code> gives the error:</p> <pre><code>/usr/bin/gitk: line 3: exec: wish: not found </code></pre> <p>Some googling suggested this may be because TK is not installed, however I tried:</p> <pre><code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,241
git
# How to use gitk with msys2? I am using MSYS2 in Windows 10. `git` works fine, however `gitk` gives the error: ``` /usr/bin/gitk: line 3: exec: wish: not found ``` Some googling suggested this may be because TK is not installed, however I tried: ``` pacman -S tk ``` which gave the error: ``` error: target not fo...
Try running the 64-bit MinGW shell (one of the three environments provided by MSYS2), installing the package `mingw-w64-x86_64-tk`, and then running `gitk`. Gitk works on my system, and `wish` is provided `/mingw64/bin/wish.exe`.
28624847
Turn off fast-forward merging for regular merge, but not for pull
13
2015-02-20 08:48:28
<p>I want git to always make merge commits (<code>--no-ff</code>) when I use <code>git merge</code>, but keep the default behavior (<code>--ff</code>) for <code>git pull</code>. Is this possible (with configs)?</p>
31,483
1,463,246
2015-04-02 18:54:59
28,625,038
14
2015-02-20 08:59:35
6,309
2015-04-02 18:54:59
https://stackoverflow.com/q/28624847
https://stackoverflow.com/a/28625038
<p>The two configs which might help are:</p> <pre><code>merge.ff </code></pre> <p>(From <a href="http://git-scm.com/docs/git-merge" rel="noreferrer"><code>git merge</code> man page</a>): When set to <code>false</code>, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the <...
<p>The two configs which might help are:</p> <pre><code>merge.ff </code></pre> <p>(From <a href="http://git-scm.com/docs/git-merge" rel="noreferrer"><code>git merge</code> man page</a>): When set to <code>false</code>, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the <...
119, 28897, 52842
fast-forward, git, git-merge
<h1>Turn off fast-forward merging for regular merge, but not for pull</h1> <p>I want git to always make merge commits (<code>--no-ff</code>) when I use <code>git merge</code>, but keep the default behavior (<code>--ff</code>) for <code>git pull</code>. Is this possible (with configs)?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,243
git
# Turn off fast-forward merging for regular merge, but not for pull I want git to always make merge commits (`--no-ff`) when I use `git merge`, but keep the default behavior (`--ff`) for `git pull`. Is this possible (with configs)?
The two configs which might help are: ``` merge.ff ``` (From [`git merge` man page](http://git-scm.com/docs/git-merge)): When set to `false`, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the `--no-ff` option from the command line). ``` pull.ff ``` (from the [`git conf...
20801238
Git checkout repository from N days ago
13
2013-12-27 13:04:39
<p>How can I check out a git repository using time notation such as "3 days ago", "12 months ago", etc?</p> <p>Note <a href="https://stackoverflow.com/questions/4052854/how-do-i-check-out-what-was-in-my-git-repository-n-days-ago">this related question</a> only concerns the local repo, but I want to inspect the remote ...
2,967
18,706
2017-11-10 15:29:39
20,801,396
14
2013-12-27 13:15:02
236,872
2013-12-27 18:22:41
https://stackoverflow.com/q/20801238
https://stackoverflow.com/a/20801396
<p><a href="https://stackoverflow.com/questions/6990484/git-checkout-by-date">git checkout by date</a> gives me</p> <pre><code>git checkout `git rev-list -n 1 --before="3 days ago" master` </code></pre>
<p><a href="https://stackoverflow.com/questions/6990484/git-checkout-by-date">git checkout by date</a> gives me</p> <pre><code>git checkout `git rev-list -n 1 --before="3 days ago" master` </code></pre>
119, 5002, 37230
date, git, git-checkout
<h1>Git checkout repository from N days ago</h1> <p>How can I check out a git repository using time notation such as "3 days ago", "12 months ago", etc?</p> <p>Note <a href="https://stackoverflow.com/questions/4052854/how-do-i-check-out-what-was-in-my-git-repository-n-days-ago">this related question</a> only concerns ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,245
git
# Git checkout repository from N days ago How can I check out a git repository using time notation such as "3 days ago", "12 months ago", etc? Note [this related question](https://stackoverflow.com/questions/4052854/how-do-i-check-out-what-was-in-my-git-repository-n-days-ago) only concerns the local repo, but I want ...
[git checkout by date](https://stackoverflow.com/questions/6990484/git-checkout-by-date) gives me ``` git checkout `git rev-list -n 1 --before="3 days ago" master` ```
19895831
How do I revert a pushed commit back to being unstaged?
13
2013-11-10 22:06:37
<p>I tried searching for an answer to this, but haven't found anything that matches quite like this problem. Feel free to link me to an answer if there is one already out there.</p> <p>What I did was commit and push a large number of changes as one commit. I didn't merge that push into master though. I now want to ...
13,687
2,940,050
2013-11-10 22:16:57
19,895,914
14
2013-11-10 22:15:02
394,167
2013-11-10 22:15:02
https://stackoverflow.com/q/19895831
https://stackoverflow.com/a/19895914
<p>If this is a shared repository and if there is a chance that anybody has already pulled your commits, then don't try to modify your history. If somebody else has already pulled your commits then you'll be fighting a losing battle to reconcile any additional commits that have been made to your errant branch.</p> <p>...
<p>If this is a shared repository and if there is a chance that anybody has already pulled your commits, then don't try to modify your history. If somebody else has already pulled your commits then you'll be fighting a losing battle to reconcile any additional commits that have been made to your errant branch.</p> <p>...
119, 5597, 12309, 71398
commit, git, revert, unstage
<h1>How do I revert a pushed commit back to being unstaged?</h1> <p>I tried searching for an answer to this, but haven't found anything that matches quite like this problem. Feel free to link me to an answer if there is one already out there.</p> <p>What I did was commit and push a large number of changes as one comm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,246
git
# How do I revert a pushed commit back to being unstaged? I tried searching for an answer to this, but haven't found anything that matches quite like this problem. Feel free to link me to an answer if there is one already out there. What I did was commit and push a large number of changes as one commit. I didn't merg...
If this is a shared repository and if there is a chance that anybody has already pulled your commits, then don't try to modify your history. If somebody else has already pulled your commits then you'll be fighting a losing battle to reconcile any additional commits that have been made to your errant branch. If this is...
19064002
git: Show message of last commit in commit template
13
2013-09-28 06:19:05
<p><code>git commit</code> opens the text editor and displays some information about the changes to be committed:</p> <pre><code># Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use ...
1,206
1,472,610
2017-07-31 05:35:23
19,064,160
14
2013-09-28 06:41:56
307,310
2017-07-31 05:35:23
https://stackoverflow.com/q/19064002
https://stackoverflow.com/a/19064160
<p>This will use git <code>hooks</code>. </p> <ul> <li>In your project root directory navigate to <code>.git/hooks/</code> </li> <li>Now create the file <code>prepare-commit-msg</code></li> <li>Add the following bit of code:</li> </ul> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh ORIG_MSG_FILE="$1" # ...
<p>This will use git <code>hooks</code>. </p> <ul> <li>In your project root directory navigate to <code>.git/hooks/</code> </li> <li>Now create the file <code>prepare-commit-msg</code></li> <li>Add the following bit of code:</li> </ul> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh ORIG_MSG_FILE="$1" # ...
119
git
<h1>git: Show message of last commit in commit template</h1> <p><code>git commit</code> opens the text editor and displays some information about the changes to be committed:</p> <pre><code># Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,247
git
# git: Show message of last commit in commit template `git commit` opens the text editor and displays some information about the changes to be committed: ``` # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Chan...
This will use git `hooks`. - In your project root directory navigate to `.git/hooks/` - Now create the file `prepare-commit-msg` - Add the following bit of code: ``` #!/bin/sh ORIG_MSG_FILE="$1" # Grab the current template TEMP=`mktemp /tmp/git-msg-XXXXX` # Create a temp file trap "rm -f $TEMP" exit # Remove temp fi...
11673117
Git: If I push a new branch to origin, how to make it tracking automatically
13
2012-07-26 15:47:27
<p>I created a new local branch and pushed it with</p> <pre><code>git push origin my-branch </code></pre> <p>How can I automatically set up my local branch to tag the just created remote branch?</p> <p>Or do I always need</p> <pre><code>git branch --set-upstream my-branch origin/my-branch </code></pre>
1,243
288,568
2012-07-26 15:51:10
11,673,190
14
2012-07-26 15:51:10
105,672
2012-07-26 15:51:10
https://stackoverflow.com/q/11673117
https://stackoverflow.com/a/11673190
<p>You can use <code>git push -u origin my-branch</code>. This will set-up everything for argument-less push/pull.</p>
<p>You can use <code>git push -u origin my-branch</code>. This will set-up everything for argument-less push/pull.</p>
119
git
<h1>Git: If I push a new branch to origin, how to make it tracking automatically</h1> <p>I created a new local branch and pushed it with</p> <pre><code>git push origin my-branch </code></pre> <p>How can I automatically set up my local branch to tag the just created remote branch?</p> <p>Or do I always need</p> <pre...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,248
git
# Git: If I push a new branch to origin, how to make it tracking automatically I created a new local branch and pushed it with ``` git push origin my-branch ``` How can I automatically set up my local branch to tag the just created remote branch? Or do I always need ``` git branch --set-upstream my-branch origin/...
You can use `git push -u origin my-branch`. This will set-up everything for argument-less push/pull.
8772328
Git switching between commits
13
2012-01-07 19:19:26
<p>I read on here and searched a lot but didn't find the answer, so Is there a way to switch between commits like you do with branches.Let's say I have these commits: <code>a;b;c</code> where <code>c</code> is my last commit, can I switch back to commit <code>a</code>? Or you have to do a <code>git diff</code> and modi...
7,399
58,839
2012-01-08 08:54:47
8,772,349
14
2012-01-07 19:21:55
116,908
2012-01-07 19:29:17
https://stackoverflow.com/q/8772328
https://stackoverflow.com/a/8772349
<p>Just type <code>git checkout a</code>. Or perhaps more usefully, <code>git checkout -b mybranch a</code>, to checkout <code>a</code> as a new branch <code>mybranch</code>.</p> <p>If you want to revert <code>b</code> and <code>c</code>, you can use <code>git revert</code>, or to remove them entirely from your curre...
<p>Just type <code>git checkout a</code>. Or perhaps more usefully, <code>git checkout -b mybranch a</code>, to checkout <code>a</code> as a new branch <code>mybranch</code>.</p> <p>If you want to revert <code>b</code> and <code>c</code>, you can use <code>git revert</code>, or to remove them entirely from your curre...
119, 456
git, version-control
<h1>Git switching between commits</h1> <p>I read on here and searched a lot but didn't find the answer, so Is there a way to switch between commits like you do with branches.Let's say I have these commits: <code>a;b;c</code> where <code>c</code> is my last commit, can I switch back to commit <code>a</code>? Or you have...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,249
git
# Git switching between commits I read on here and searched a lot but didn't find the answer, so Is there a way to switch between commits like you do with branches.Let's say I have these commits: `a;b;c` where `c` is my last commit, can I switch back to commit `a`? Or you have to do a `git diff` and modify the files m...
Just type `git checkout a`. Or perhaps more usefully, `git checkout -b mybranch a`, to checkout `a` as a new branch `mybranch`. If you want to revert `b` and `c`, you can use `git revert`, or to remove them entirely from your current branch's history, you could `git rebase -i a` and throw them out. Even if you were g...
6775242
How can I recover from "fatal: Out of memory? mmap failed: Cannot allocate memory" in Git?
13
2011-07-21 11:23:26
<p>Let me start with some context:</p> <p>I had to upgrade a crucial Magento webshop to a new version. To be sure all existing code would still work after the upgrade and make some post-upgrade changes I made a Git repository from the entire Magento installation (excluding obvious content like the 4.5GB of images, ./v...
22,557
813,718
2011-07-25 05:55:24
6,812,201
14
2011-07-25 05:49:58
712,605
2011-07-25 05:55:24
https://stackoverflow.com/q/6775242
https://stackoverflow.com/a/6812201
<p>The error you're getting comes from the large files in your repository. Git is trying to put the entire contents of the file in memory, which makes it croak.</p> <h3>Try Upgrading Git</h3> <p>Git 1.7.6 was released last month and has this lovely bit in its release notes:</p> <blockquote> <p>Adding a file large...
<p>The error you're getting comes from the large files in your repository. Git is trying to put the entire contents of the file in memory, which makes it croak.</p> <h3>Try Upgrading Git</h3> <p>Git 1.7.6 was released last month and has this lovely bit in its release notes:</p> <blockquote> <p>Adding a file large...
119, 53847
branching-and-merging, git
<h1>How can I recover from "fatal: Out of memory? mmap failed: Cannot allocate memory" in Git?</h1> <p>Let me start with some context:</p> <p>I had to upgrade a crucial Magento webshop to a new version. To be sure all existing code would still work after the upgrade and make some post-upgrade changes I made a Git repo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,250
git
# How can I recover from "fatal: Out of memory? mmap failed: Cannot allocate memory" in Git? Let me start with some context: I had to upgrade a crucial Magento webshop to a new version. To be sure all existing code would still work after the upgrade and make some post-upgrade changes I made a Git repository from the ...
The error you're getting comes from the large files in your repository. Git is trying to put the entire contents of the file in memory, which makes it croak. ### Try Upgrading Git Git 1.7.6 was released last month and has this lovely bit in its release notes: > Adding a file larger than core.bigfilethreshold (defaul...
6024712
Heroku not updating css for rails app
13
2011-05-16 23:48:32
<p>I'm having trouble updating my rails app on heroku. I've gotten my app up but I tried to change my application.css file in /public/stylesheets/ but whenever I try to push to heroku, the CSS never changes. I tested these changes locally and they work just fine, I just can't figure out how to push them to heroku. I...
9,818
756,528
2019-07-18 19:22:13
6,025,204
14
2011-05-17 01:03:05
363,881
2011-05-17 01:03:05
https://stackoverflow.com/q/6024712
https://stackoverflow.com/a/6025204
<p>Remember that you have to commit the changes locally before you can push them.</p> <p>If you do a <code>git status</code>, it should be clean.</p> <p>If it's not (my prediction):</p> <pre><code>git commit -am "Your commit message" git push heroku master </code></pre>
<p>Remember that you have to commit the changes locally before you can push them.</p> <p>If you do a <code>git status</code>, it should be clean.</p> <p>If it's not (my prediction):</p> <pre><code>git commit -am "Your commit message" git push heroku master </code></pre>
119, 4984, 8279
git, heroku, ruby-on-rails
<h1>Heroku not updating css for rails app</h1> <p>I'm having trouble updating my rails app on heroku. I've gotten my app up but I tried to change my application.css file in /public/stylesheets/ but whenever I try to push to heroku, the CSS never changes. I tested these changes locally and they work just fine, I just ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,251
git
# Heroku not updating css for rails app I'm having trouble updating my rails app on heroku. I've gotten my app up but I tried to change my application.css file in /public/stylesheets/ but whenever I try to push to heroku, the CSS never changes. I tested these changes locally and they work just fine, I just can't figur...
Remember that you have to commit the changes locally before you can push them. If you do a `git status`, it should be clean. If it's not (my prediction): ``` git commit -am "Your commit message" git push heroku master ```
5817316
"git add" equivalent in svn?
13
2011-04-28 10:40:39
<p>To commit some changes to a git repo I must add it to the staged state first. If I don't add a file to commit it will not go to the repo.</p> <p>But in SVN, apparently, there is no such staging state. And every change I made to my working copy goes to the repo with next svn commit. How can I prevent some locally ch...
2,922
99,024
2020-11-06 00:25:04
5,817,346
14
2011-04-28 10:44:02
893
2011-04-28 10:44:02
https://stackoverflow.com/q/5817316
https://stackoverflow.com/a/5817346
<p>The <code>svn commit</code> command takes optional filename parameters that limit the set of files to commit:</p> <pre><code>svn commit -m "my commit" file1.txt file2.txt </code></pre> <p>You can also use the <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.changelist.html" rel="noreferrer">"changelist" f...
<p>The <code>svn commit</code> command takes optional filename parameters that limit the set of files to commit:</p> <pre><code>svn commit -m "my commit" file1.txt file2.txt </code></pre> <p>You can also use the <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.changelist.html" rel="noreferrer">"changelist" f...
63, 119
git, svn
<h1>"git add" equivalent in svn?</h1> <p>To commit some changes to a git repo I must add it to the staged state first. If I don't add a file to commit it will not go to the repo.</p> <p>But in SVN, apparently, there is no such staging state. And every change I made to my working copy goes to the repo with next svn com...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,252
git
# "git add" equivalent in svn? To commit some changes to a git repo I must add it to the staged state first. If I don't add a file to commit it will not go to the repo. But in SVN, apparently, there is no such staging state. And every change I made to my working copy goes to the repo with next svn commit. How can I p...
The `svn commit` command takes optional filename parameters that limit the set of files to commit: ``` svn commit -m "my commit" file1.txt file2.txt ``` You can also use the ["changelist" feature](http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.changelist.html) to group one or more files into a changelist, which can...
4205589
In a git post-commit hook how do I get a list of the files that were changed?
13
2010-11-17 14:52:16
<p>Trying to figure out how long time was spent in a commit in a Git post-commit hook.</p> <p>I've got a post-commit git hook that submits information over an API about the commit. What I want to do is figure out how long time was spent on the commit. Roughly. </p> <p>My assumption is that a rough value can be figure...
6,843
205,832
2024-03-24 13:24:16
4,206,210
14
2010-11-17 15:49:49
19,750
2010-11-17 15:49:49
https://stackoverflow.com/q/4205589
https://stackoverflow.com/a/4206210
<p>When writing scripts around git, you should try to stick to the <a href="http://www.kernel.org/pub/software/scm/git/docs/#_low_level_commands_plumbing" rel="noreferrer">plumbing commands</a> — their format is less likely to change and easier to parse. Here is a command which outputs the names of the paths which chan...
<p>When writing scripts around git, you should try to stick to the <a href="http://www.kernel.org/pub/software/scm/git/docs/#_low_level_commands_plumbing" rel="noreferrer">plumbing commands</a> — their format is less likely to change and easier to parse. Here is a command which outputs the names of the paths which chan...
119, 43087
git, githooks
<h1>In a git post-commit hook how do I get a list of the files that were changed?</h1> <p>Trying to figure out how long time was spent in a commit in a Git post-commit hook.</p> <p>I've got a post-commit git hook that submits information over an API about the commit. What I want to do is figure out how long time was s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,253
git
# In a git post-commit hook how do I get a list of the files that were changed? Trying to figure out how long time was spent in a commit in a Git post-commit hook. I've got a post-commit git hook that submits information over an API about the commit. What I want to do is figure out how long time was spent on the comm...
When writing scripts around git, you should try to stick to the [plumbing commands](http://www.kernel.org/pub/software/scm/git/docs/#_low_level_commands_plumbing) — their format is less likely to change and easier to parse. Here is a command which outputs the names of the paths which changed in a commit: ``` git diff-...
3758703
How to set a timeout for "git push" and "git pull"?
13
2010-09-21 08:57:17
<p>all questions I found want to avoid timeouts in git push/pull. In my case I want to force them. My push + pulls are all going over ssh to remote machines that might be unavailable at some point in time. For example, I have a script that pushes to two remote public repos. I don't want that this script hangs forever w...
11,557
42,645
2024-05-16 18:45:04
3,765,637
14
2010-09-22 01:10:11
9,410
2010-09-22 01:10:11
https://stackoverflow.com/q/3758703
https://stackoverflow.com/a/3765637
<p>I don’t think you can do an automatic fail-over with built-in features. But since Git just uses SSH underneath, it should work to add a <code>ConnectTimeout</code> option for the machines in question in your <code>.ssh/config</code>. Cf. <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config" rel="noreferr...
<p>I don’t think you can do an automatic fail-over with built-in features. But since Git just uses SSH underneath, it should work to add a <code>ConnectTimeout</code> option for the machines in question in your <code>.ssh/config</code>. Cf. <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config" rel="noreferr...
119
git
<h1>How to set a timeout for "git push" and "git pull"?</h1> <p>all questions I found want to avoid timeouts in git push/pull. In my case I want to force them. My push + pulls are all going over ssh to remote machines that might be unavailable at some point in time. For example, I have a script that pushes to two remot...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,254
git
# How to set a timeout for "git push" and "git pull"? all questions I found want to avoid timeouts in git push/pull. In my case I want to force them. My push + pulls are all going over ssh to remote machines that might be unavailable at some point in time. For example, I have a script that pushes to two remote public ...
I don’t think you can do an automatic fail-over with built-in features. But since Git just uses SSH underneath, it should work to add a `ConnectTimeout` option for the machines in question in your `.ssh/config`. Cf. [`man ssh_config`](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config). Then something like `git pu...
3673537
When should I use git add?
13
2010-09-09 03:21:35
<p>I'm finding myself using it each time before a commit. Is it right? If so, it should be the same command...</p>
10,242
157,519
2015-12-09 22:40:56
3,673,547
14
2010-09-09 03:24:09
126,042
2015-12-09 22:40:56
https://stackoverflow.com/q/3673537
https://stackoverflow.com/a/3673547
<p>There's <code>git commit -a</code> which is <em>like</em> <code>git add -u</code> -- it adds all modified files, but it does not add untracked files, in contrast to <code>git add .</code>, which adds both tracked and untracked files (not including deletions), provided that they contain modifications.</p> <p>See <a ...
<p>There's <code>git commit -a</code> which is <em>like</em> <code>git add -u</code> -- it adds all modified files, but it does not add untracked files, in contrast to <code>git add .</code>, which adds both tracked and untracked files (not including deletions), provided that they contain modifications.</p> <p>See <a ...
119
git
<h1>When should I use git add?</h1> <p>I'm finding myself using it each time before a commit. Is it right? If so, it should be the same command...</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,255
git
# When should I use git add? I'm finding myself using it each time before a commit. Is it right? If so, it should be the same command...
There's `git commit -a` which is *like* `git add -u` -- it adds all modified files, but it does not add untracked files, in contrast to `git add .`, which adds both tracked and untracked files (not including deletions), provided that they contain modifications. See [Difference between "git add -A" and "git add ."](htt...
73053721
Azure Devops pipelines to trigger ONLY on Merge
12
2022-07-20 14:43:46
<p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p> <p>Now I have :</p> <pre><code>trigger: branches: include: - DEV steps: - script: FOO </code></pre> <p>But this runs EVERY time there is a change on the DEV branch and I would like to avoid that.</p> <p...
25,464
13,158,839
2025-05-19 10:39:38
73,106,353
14
2022-07-25 08:46:10
7,460,777
2022-07-27 08:06:10
https://stackoverflow.com/q/73053721
https://stackoverflow.com/a/73106353
<blockquote> <p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p> </blockquote> <p>There is no such out of box way to achieve this at this moment.</p> <p>We could only set the CI trigger on the target branch, but we could set the condotion for the pipeline to avo...
<blockquote> <p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p> </blockquote> <p>There is no such out of box way to achieve this at this moment.</p> <p>We could only set the CI trigger on the target branch, but we could set the condotion for the pipeline to avo...
2844, 28897, 116537, 119596, 150971
azure-devops, azure-pipelines, cicd, git-merge, pipeline
<h1>Azure Devops pipelines to trigger ONLY on Merge</h1> <p>I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge.</p> <p>Now I have :</p> <pre><code>trigger: branches: include: - DEV steps: - script: FOO </code></pre> <p>But this runs EVERY time there is a change...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,256
git
# Azure Devops pipelines to trigger ONLY on Merge I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge. Now I have : ``` trigger: branches: include: - DEV steps: - script: FOO ``` But this runs EVERY time there is a change on the DEV branch and I would like t...
> I'm looking on a way to trigger a Azure pipeline ONLY on successful (or attempted) pull request merge. There is no such out of box way to achieve this at this moment. We could only set the CI trigger on the target branch, but we could set the condotion for the pipeline to avoid build any task: ``` and(succeeded(),...
72270892
Git versioning with setuptools in pyproject.toml
12
2022-05-17 08:47:08
<p>I'm trying to build a few packages with an automatic versioning set by <code>setuptools-git-versioning</code>. Unfortunately, even following the documentation and the very few resources online, I can't manage to make this versioning work.</p> <p><code>pyproject.toml:</code></p> <pre class="lang-ini prettyprint-overr...
13,204
10,648,704
2024-08-01 15:32:41
73,058,153
14
2022-07-20 21:10:27
2,132,169
2024-02-04 08:54:01
https://stackoverflow.com/q/72270892
https://stackoverflow.com/a/73058153
<p>According to the <a href="https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table" rel="nofollow noreferrer">PyPa documentation</a> when <code>version</code> is defined statically it can't be changed by a tool (i.e. setuptools-git-versioning in this case). T...
<p>According to the <a href="https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table" rel="nofollow noreferrer">PyPa documentation</a> when <code>version</code> is defined statically it can't be changed by a tool (i.e. setuptools-git-versioning in this case). T...
11066, 60010, 110771, 140954
gitversion, pyproject.toml, python-3.x, setuptools
<h1>Git versioning with setuptools in pyproject.toml</h1> <p>I'm trying to build a few packages with an automatic versioning set by <code>setuptools-git-versioning</code>. Unfortunately, even following the documentation and the very few resources online, I can't manage to make this versioning work.</p> <p><code>pyproje...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,257
git
# Git versioning with setuptools in pyproject.toml I'm trying to build a few packages with an automatic versioning set by `setuptools-git-versioning`. Unfortunately, even following the documentation and the very few resources online, I can't manage to make this versioning work. `pyproject.toml:` ``` [build-system] r...
According to the [PyPa documentation](https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table) when `version` is defined statically it can't be changed by a tool (i.e. setuptools-git-versioning in this case). The other option is to use [dynamic](https://packagi...
67266149
error: could not lock config file /etc/gitconfig: Permission denied
12
2021-04-26 11:54:09
<p>I am relatively new to the Ubuntu OS and Git.</p> <p>I have installed Git on Ubuntu 20.04 by following the instruction mentioned in the following link</p> <p><a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noreferrer">Getting Started Installing Git</a></p> <p>As mention in the <a href="h...
68,668
1,669,173
2023-02-25 07:59:31
67,270,926
14
2021-04-26 17:08:36
7,976,758
2021-04-26 17:08:36
https://stackoverflow.com/q/67266149
https://stackoverflow.com/a/67270926
<p>Files under <code>/etc/</code> belong to root and must be edited with root privileges:</p> <pre><code>sudo git config --system user.name &quot;My Name&quot; </code></pre> <p>But you're trying to set you personal configuration in the system config. My advice is: don't do that, use your global user config:</p> <pre><c...
<p>Files under <code>/etc/</code> belong to root and must be edited with root privileges:</p> <pre><code>sudo git config --system user.name &quot;My Name&quot; </code></pre> <p>But you're trying to set you personal configuration in the system config. My advice is: don't do that, use your global user config:</p> <pre><c...
119, 549, 32868
git, git-config, ubuntu
<h1>error: could not lock config file /etc/gitconfig: Permission denied</h1> <p>I am relatively new to the Ubuntu OS and Git.</p> <p>I have installed Git on Ubuntu 20.04 by following the instruction mentioned in the following link</p> <p><a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noref...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,260
git
# error: could not lock config file /etc/gitconfig: Permission denied I am relatively new to the Ubuntu OS and Git. I have installed Git on Ubuntu 20.04 by following the instruction mentioned in the following link [Getting Started Installing Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) As men...
Files under `/etc/` belong to root and must be edited with root privileges: ``` sudo git config --system user.name "My Name" ``` But you're trying to set you personal configuration in the system config. My advice is: don't do that, use your global user config: ``` git config --global user.name "My Name" ```
22764951
How do I update a git submodule without checking it out
12
2014-03-31 14:56:49
<p>I am using a git submodule in a very <a href="https://github.com/davidhalter/jedi-vim" rel="noreferrer">usual way</a>. The way how people typically update a submodule is by checking it out, pulling something in the submodule and then commiting outside.</p> <p>Now, I typically don't develop those modules in the same...
5,153
552,671
2022-06-09 07:27:38
64,950,161
14
2020-11-22 02:37:38
1,970,012
2020-11-22 02:37:38
https://stackoverflow.com/q/22764951
https://stackoverflow.com/a/64950161
<p>you can do with this, as follows:</p> <pre><code>git update-index --add --cacheinfo mode,sha1,submodule_path </code></pre> <p>the <code>mode</code> value can get from <code>git ls-files --stage submodule_path</code></p> <p><a href="https://git-scm.com/docs/git-update-index" rel="noreferrer">git update-index</a> re...
<p>you can do with this, as follows:</p> <pre><code>git update-index --add --cacheinfo mode,sha1,submodule_path </code></pre> <p>the <code>mode</code> value can get from <code>git ls-files --stage submodule_path</code></p> <p><a href="https://git-scm.com/docs/git-update-index" rel="noreferrer">git update-index</a> re...
119, 41612
git, git-submodules
<h1>How do I update a git submodule without checking it out</h1> <p>I am using a git submodule in a very <a href="https://github.com/davidhalter/jedi-vim" rel="noreferrer">usual way</a>. The way how people typically update a submodule is by checking it out, pulling something in the submodule and then commiting outside....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,261
git
# How do I update a git submodule without checking it out I am using a git submodule in a very [usual way](https://github.com/davidhalter/jedi-vim). The way how people typically update a submodule is by checking it out, pulling something in the submodule and then commiting outside. Now, I typically don't develop thos...
you can do with this, as follows: ``` git update-index --add --cacheinfo mode,sha1,submodule_path ``` the `mode` value can get from `git ls-files --stage submodule_path` [git update-index](https://git-scm.com/docs/git-update-index) reference
46376966
How to get sha of current git commit from R
12
2017-09-23 07:01:04
<p>Is there a way to get SHA of current GIT commit from R? I need to access it via a function call (not as a hard string). </p> <p>I have adapted GIT as version control system for analysis, and want to print the SHA on footnote of my intermediate reports (my working drafts, in pdf format, get a life of their own and i...
3,798
7,756,889
2022-01-26 18:26:39
46,377,001
14
2017-09-23 07:06:17
4,323
2017-09-23 10:52:35
https://stackoverflow.com/q/46376966
https://stackoverflow.com/a/46377001
<p>You'll need to invoke the <code>git rev-parse</code> command as explained here: <a href="https://stackoverflow.com/questions/949314/how-to-retrieve-the-hash-for-the-current-commit-in-git">How to retrieve the hash for the current commit in Git?</a></p> <p>You can do it using <code>system()</code>:</p> <p><a href="h...
<p>You'll need to invoke the <code>git rev-parse</code> command as explained here: <a href="https://stackoverflow.com/questions/949314/how-to-retrieve-the-hash-for-the-current-commit-in-git">How to retrieve the hash for the current commit in Git?</a></p> <p>You can do it using <code>system()</code>:</p> <p><a href="h...
119, 4452, 10188, 67746, 83308
git, r, r-markdown, rstudio, sha
<h1>How to get sha of current git commit from R</h1> <p>Is there a way to get SHA of current GIT commit from R? I need to access it via a function call (not as a hard string). </p> <p>I have adapted GIT as version control system for analysis, and want to print the SHA on footnote of my intermediate reports (my working...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,264
git
# How to get sha of current git commit from R Is there a way to get SHA of current GIT commit from R? I need to access it via a function call (not as a hard string). I have adapted GIT as version control system for analysis, and want to print the SHA on footnote of my intermediate reports (my working drafts, in pdf f...
You'll need to invoke the `git rev-parse` command as explained here: [How to retrieve the hash for the current commit in Git?](https://stackoverflow.com/questions/949314/how-to-retrieve-the-hash-for-the-current-commit-in-git) You can do it using `system()`: <https://stat.ethz.ch/R-manual/R-devel/library/base/html/sys...