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
6037707
GIT : "git-upload-pack: command not found" while pushing to remote server
11
2011-05-17 22:04:14
<p>So I'm using GIT, trying to push code to my remote server.</p> <ul> <li>on a shared unix hosting, and I'm not allowed to have my own environment variables (blocked for SSH accounts) and no sudo access.</li> <li>managed to install git successfully in my /home/</li> <li>trying to push code to the server returns : bas...
7,579
443,363
2011-05-18 04:46:19
6,039,982
15
2011-05-18 04:46:19
193,688
2011-05-18 04:46:19
https://stackoverflow.com/q/6037707
https://stackoverflow.com/a/6039982
<p>If you can not adjust the effective PATH on the remote side<sup>1</sup>, then you will have to specify the location of the programs from your local side.</p> <p>As you found, <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a> can be given <code>-u /path/to/git-upload-pack</code>...
<p>If you can not adjust the effective PATH on the remote side<sup>1</sup>, then you will have to specify the location of the programs from your local side.</p> <p>As you found, <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a> can be given <code>-u /path/to/git-upload-pack</code>...
34, 119, 386, 456
git, ssh, unix, version-control
<h1>GIT : "git-upload-pack: command not found" while pushing to remote server</h1> <p>So I'm using GIT, trying to push code to my remote server.</p> <ul> <li>on a shared unix hosting, and I'm not allowed to have my own environment variables (blocked for SSH accounts) and no sudo access.</li> <li>managed to install git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,958
git
# GIT : "git-upload-pack: command not found" while pushing to remote server So I'm using GIT, trying to push code to my remote server. - on a shared unix hosting, and I'm not allowed to have my own environment variables (blocked for SSH accounts) and no sudo access. - managed to install git successfully in my /home/ ...
If you can not adjust the effective PATH on the remote side1, then you will have to specify the location of the programs from your local side. As you found, [`git clone`](http://git-scm.com/docs/git-clone) can be given `-u /path/to/git-upload-pack` (or `--upload-pack /path/to/git-upload-pack`). [`git fetch`](http://w...
733057
Can git work via ssh port forwarding?
11
2009-04-09 06:33:32
<p>My situation is, I can ssh to ComputerB (Code repos) where git repos is put. But my local connection is too slow to clone the code. And I can ssh to another machine (ComputerA) which is faster, so I want to clone the code through ComputerA.</p> <p>This is what I did:</p> <pre><code> ssh tunnel ...
23,383
34,924
2012-09-11 15:42:37
733,068
15
2009-04-09 06:38:04
69,755
2009-04-09 06:38:04
https://stackoverflow.com/q/733057
https://stackoverflow.com/a/733068
<p>How will going through two connections make your connection faster?</p> <p>Anyhow, you should be able to do:</p> <pre><code>git clone git+ssh://localhost:1234/repos local_repos </code></pre>
<p>How will going through two connections make your connection faster?</p> <p>Anyhow, you should be able to do:</p> <pre><code>git clone git+ssh://localhost:1234/repos local_repos </code></pre>
119, 386
git, ssh
<h1>Can git work via ssh port forwarding?</h1> <p>My situation is, I can ssh to ComputerB (Code repos) where git repos is put. But my local connection is too slow to clone the code. And I can ssh to another machine (ComputerA) which is faster, so I want to clone the code through ComputerA.</p> <p>This is what I did:</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,959
git
# Can git work via ssh port forwarding? My situation is, I can ssh to ComputerB (Code repos) where git repos is put. But my local connection is too slow to clone the code. And I can ssh to another machine (ComputerA) which is faster, so I want to clone the code through ComputerA. This is what I did: ``` s...
How will going through two connections make your connection faster? Anyhow, you should be able to do: ``` git clone git+ssh://localhost:1234/repos local_repos ```
73239997
files in .gitignore still show up when doing git status
10
2022-08-04 17:21:03
<p>In my <code>.gitignore</code> (which is in the root of my project repo - the same directory that the hidden <code>.git</code> directory is in) I have just one line:</p> <pre><code>config.php </code></pre> <p>When I do <code>git status</code> it shows unstaged changes to that file (in the root directory), which I wou...
11,720
569,976
2022-08-04 18:47:08
73,240,929
15
2022-08-04 18:47:08
1,256,452
2022-08-04 18:47:08
https://stackoverflow.com/q/73239997
https://stackoverflow.com/a/73240929
<p><em>In general</em> what this means is that <code>config.php</code> is <em>already tracked</em>. A tracked file is never ignored. (In some specific cases, it means your <code>.gitignore</code> file is encoded in UTF-16 or similar, in which case, fix that first, then check again.)</p> <p>It's <em>extremely importan...
<p><em>In general</em> what this means is that <code>config.php</code> is <em>already tracked</em>. A tracked file is never ignored. (In some specific cases, it means your <code>.gitignore</code> file is encoded in UTF-16 or similar, in which case, fix that first, then check again.)</p> <p>It's <em>extremely importan...
119, 25056
git, gitignore
<h1>files in .gitignore still show up when doing git status</h1> <p>In my <code>.gitignore</code> (which is in the root of my project repo - the same directory that the hidden <code>.git</code> directory is in) I have just one line:</p> <pre><code>config.php </code></pre> <p>When I do <code>git status</code> it shows u...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,961
git
# files in .gitignore still show up when doing git status In my `.gitignore` (which is in the root of my project repo - the same directory that the hidden `.git` directory is in) I have just one line: ``` config.php ``` When I do `git status` it shows unstaged changes to that file (in the root directory), which I wo...
*In general* what this means is that `config.php` is *already tracked*. A tracked file is never ignored. (In some specific cases, it means your `.gitignore` file is encoded in UTF-16 or similar, in which case, fix that first, then check again.) It's *extremely important* to understand *exactly* what a tracked file is,...
71252026
How do I use "zealous diff3" with git? And what are the pros and cons?
10
2022-02-24 12:32:24
<p>I just read the <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.35.0.txt" rel="noreferrer">release notes for Git 2.35.0</a> (note 2.35.1 is already available though).</p> <p>In those release notes, I saw that:</p> <blockquote> <ul> <li>&quot;Zealous diff3&quot; style of merge confl...
4,526
1,593,077
2022-02-24 15:08:38
71,254,097
15
2022-02-24 15:08:38
1,256,452
2022-02-24 15:08:38
https://stackoverflow.com/q/71252026
https://stackoverflow.com/a/71254097
<p>The new &quot;zealous diff3&quot; style is:</p> <pre><code>merge.conflictStyle = zdiff3 </code></pre> <p>which you'd set with:</p> <pre><code>git config --global merge.conflictStyle zdiff3 </code></pre> <p>for instance (assuming you want this in your per-user configuration).</p> <p>The default style is <code>merge</...
<p>The new &quot;zealous diff3&quot; style is:</p> <pre><code>merge.conflictStyle = zdiff3 </code></pre> <p>which you'd set with:</p> <pre><code>git config --global merge.conflictStyle zdiff3 </code></pre> <p>for instance (assuming you want this in your per-user configuration).</p> <p>The default style is <code>merge</...
119, 606, 30103, 32868
diff, diff3, git, git-config
<h1>How do I use "zealous diff3" with git? And what are the pros and cons?</h1> <p>I just read the <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.35.0.txt" rel="noreferrer">release notes for Git 2.35.0</a> (note 2.35.1 is already available though).</p> <p>In those release notes, I sa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,962
git
# How do I use "zealous diff3" with git? And what are the pros and cons? I just read the [release notes for Git 2.35.0](https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.35.0.txt) (note 2.35.1 is already available though). In those release notes, I saw that: > - "Zealous diff3" style of merge...
The new "zealous diff3" style is: ``` merge.conflictStyle = zdiff3 ``` which you'd set with: ``` git config --global merge.conflictStyle zdiff3 ``` for instance (assuming you want this in your per-user configuration). The default style is `merge`: ``` Here are lines that are either unchanged from the common ances...
43881807
How to tell git to ignore global config
10
2017-05-10 00:30:22
<p><a href="https://git-scm.com/docs/git-config#git-config---global" rel="noreferrer">The Git docs</a> talk about the default global git config file locations (<code>$XDG_CONFIG_HOME/git/config</code> or <code>~/.gitconfig</code>), but don't offer a way to tell a git command to ignore that file.</p> <p>I'm looking for...
4,780
2,799,191
2022-07-04 06:04:41
67,512,433
15
2021-05-13 00:10:43
6,309
2022-07-04 06:04:41
https://stackoverflow.com/q/43881807
https://stackoverflow.com/a/67512433
<p>Another approach, with Git 2.32 (Q2 2021), is to use the new <code>GIT_CONFIG_SYSTEM</code>:</p> <p>Git 2.32 replaces <code>GIT_CONFIG_NOSYSTEM</code> mechanism to decline from reading the system-wide configuration file with <strong><code>GIT_CONFIG_SYSTEM</code> that lets users specify from which file to read the s...
<p>Another approach, with Git 2.32 (Q2 2021), is to use the new <code>GIT_CONFIG_SYSTEM</code>:</p> <p>Git 2.32 replaces <code>GIT_CONFIG_NOSYSTEM</code> mechanism to decline from reading the system-wide configuration file with <strong><code>GIT_CONFIG_SYSTEM</code> that lets users specify from which file to read the s...
119
git
<h1>How to tell git to ignore global config</h1> <p><a href="https://git-scm.com/docs/git-config#git-config---global" rel="noreferrer">The Git docs</a> talk about the default global git config file locations (<code>$XDG_CONFIG_HOME/git/config</code> or <code>~/.gitconfig</code>), but don't offer a way to tell a git com...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,965
git
# How to tell git to ignore global config [The Git docs](https://git-scm.com/docs/git-config#git-config---global) talk about the default global git config file locations (`$XDG_CONFIG_HOME/git/config` or `~/.gitconfig`), but don't offer a way to tell a git command to ignore that file. I'm looking for an environment v...
Another approach, with Git 2.32 (Q2 2021), is to use the new `GIT_CONFIG_SYSTEM`: Git 2.32 replaces `GIT_CONFIG_NOSYSTEM` mechanism to decline from reading the system-wide configuration file with **`GIT_CONFIG_SYSTEM` that lets users specify from which file to read the system-wide configuration (setting it to an empty...
59673082
How to import local git repository to github?
10
2020-01-09 22:33:26
<p>I have a local git repository with already commited code. Now I want to import the repository to github preserving its commits. What I did so far:</p> <p>I've created a new repository on github.</p> <p>I've added that as a remote in my local repository:</p> <pre><code>git remote add origin https://github.com/... ...
11,124
1,785,730
2022-07-14 12:09:30
59,673,153
15
2020-01-09 22:40:34
1,440,565
2020-01-09 23:16:00
https://stackoverflow.com/q/59673082
https://stackoverflow.com/a/59673153
<p>It sounds like you created a GitHub repository with a README file or LICENSE file. GitHub offers to create these for you, but in your case you shouldn't. I suggest that you delete your GitHub repository and create a new completely empty one. Then go through the same procedure that you already did:</p> <pre><code>gi...
<p>It sounds like you created a GitHub repository with a README file or LICENSE file. GitHub offers to create these for you, but in your case you shouldn't. I suggest that you delete your GitHub repository and create a new completely empty one. Then go through the same procedure that you already did:</p> <pre><code>gi...
119
git
<h1>How to import local git repository to github?</h1> <p>I have a local git repository with already commited code. Now I want to import the repository to github preserving its commits. What I did so far:</p> <p>I've created a new repository on github.</p> <p>I've added that as a remote in my local repository:</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,967
git
# How to import local git repository to github? I have a local git repository with already commited code. Now I want to import the repository to github preserving its commits. What I did so far: I've created a new repository on github. I've added that as a remote in my local repository: ``` git remote add origin ht...
It sounds like you created a GitHub repository with a README file or LICENSE file. GitHub offers to create these for you, but in your case you shouldn't. I suggest that you delete your GitHub repository and create a new completely empty one. Then go through the same procedure that you already did: ``` git remote add o...
52691885
how to unstage a renamed file in git index?
10
2018-10-07 19:03:33
<p>I'm always using <code>git checkout &lt;file&gt;</code> to unstage uncommited changes, however I can't seem to do this when files were renamed.</p> <p>git just can't pickup the file I want to unstaged, tried this with no luck:</p> <pre><code>git checkout &lt;oldfilename&gt; </code></pre> <p>and</p> <pre><code>gi...
5,411
5,916,465
2018-10-08 15:05:43
52,691,939
15
2018-10-07 19:10:48
2,234,742
2018-10-07 19:10:48
https://stackoverflow.com/q/52691885
https://stackoverflow.com/a/52691939
<p>Use <code>git reset -- newfilename</code> to unstage the renamed file.</p> <p>If instead of unstaging you are looking to rename the file back, use <code>git mv newfilename oldfilename</code>.</p>
<p>Use <code>git reset -- newfilename</code> to unstage the renamed file.</p> <p>If instead of unstaging you are looking to rename the file back, use <code>git mv newfilename oldfilename</code>.</p>
119
git
<h1>how to unstage a renamed file in git index?</h1> <p>I'm always using <code>git checkout &lt;file&gt;</code> to unstage uncommited changes, however I can't seem to do this when files were renamed.</p> <p>git just can't pickup the file I want to unstaged, tried this with no luck:</p> <pre><code>git checkout &lt;old...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,970
git
# how to unstage a renamed file in git index? I'm always using `git checkout <file>` to unstage uncommited changes, however I can't seem to do this when files were renamed. git just can't pickup the file I want to unstaged, tried this with no luck: ``` git checkout <oldfilename> ``` and ``` git checkout <newfilena...
Use `git reset -- newfilename` to unstage the renamed file. If instead of unstaging you are looking to rename the file back, use `git mv newfilename oldfilename`.
48316346
gitea and jenkins webhook
10
2018-01-18 07:58:14
<p>I am testing out Gitea and would like to it to trigger a Jenkins build, pretty basic use case. I understand that there is the existing GOGs webhook pluging that can be used, but recently also found out that there is a Gitea plugin for Jenkins as well.</p> <p>In GOGS case you would call Jenkins via: <a href="ht...
33,863
6,219,373
2021-11-23 08:47:39
50,231,224
15
2018-05-08 10:16:12
2,942,664
2019-03-24 15:53:20
https://stackoverflow.com/q/48316346
https://stackoverflow.com/a/50231224
<p>I have managed to successfully configure a Jenkins/Gitea combo using relatively recent versions (I use official alpine-based docker containers for both). I used <a href="https://github.com/go-gitea/gitea/issues/3724" rel="noreferrer">this Gitea issue</a> as a guide. I didn't use the Gogs plugin in Jenkins, only the ...
<p>I have managed to successfully configure a Jenkins/Gitea combo using relatively recent versions (I use official alpine-based docker containers for both). I used <a href="https://github.com/go-gitea/gitea/issues/3724" rel="noreferrer">this Gitea issue</a> as a guide. I didn't use the Gogs plugin in Jenkins, only the ...
64999, 76768, 126582, 128429
gitea, jenkins, jenkins-blueocean, jenkins-plugins
<h1>gitea and jenkins webhook</h1> <p>I am testing out Gitea and would like to it to trigger a Jenkins build, pretty basic use case. I understand that there is the existing GOGs webhook pluging that can be used, but recently also found out that there is a Gitea plugin for Jenkins as well.</p> <p>In GOGS case you woul...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,972
git
# gitea and jenkins webhook I am testing out Gitea and would like to it to trigger a Jenkins build, pretty basic use case. I understand that there is the existing GOGs webhook pluging that can be used, but recently also found out that there is a Gitea plugin for Jenkins as well. In GOGS case you would call Jenkins vi...
I have managed to successfully configure a Jenkins/Gitea combo using relatively recent versions (I use official alpine-based docker containers for both). I used [this Gitea issue](https://github.com/go-gitea/gitea/issues/3724) as a guide. I didn't use the Gogs plugin in Jenkins, only the Gitea plugin. I also don't use ...
43690977
Commit a large number of files in RStudio using GIT panel
10
2017-04-29 01:39:09
<p>In RStudio, if you are dealing with a directory that contains a large number of files, and you want to commit and push the recent changes (that you made on all of them) to your repository, the GUI Git component gets super slow and practically doesn't work. Any idea?</p>
2,710
3,625,770
2025-04-16 00:07:04
43,691,026
15
2017-04-29 01:50:34
3,625,770
2017-04-29 01:50:34
https://stackoverflow.com/q/43690977
https://stackoverflow.com/a/43691026
<p>Of course you can ignore the GUI and stick to the command-line Git forever, but if you don't want, a quick jump to the command-line git would solve this problem for now.</p> <p>The temporary solution that I found is as follows:</p> <ol> <li>Click on the <strong>blue-gear icon</strong> on the GIT panel, inside RStu...
<p>Of course you can ignore the GUI and stick to the command-line Git forever, but if you don't want, a quick jump to the command-line git would solve this problem for now.</p> <p>The temporary solution that I found is as follows:</p> <ol> <li>Click on the <strong>blue-gear icon</strong> on the GIT panel, inside RStu...
119, 4452, 28898, 53850, 67746
git, git-commit, git-push, r, rstudio
<h1>Commit a large number of files in RStudio using GIT panel</h1> <p>In RStudio, if you are dealing with a directory that contains a large number of files, and you want to commit and push the recent changes (that you made on all of them) to your repository, the GUI Git component gets super slow and practically doesn't...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,974
git
# Commit a large number of files in RStudio using GIT panel In RStudio, if you are dealing with a directory that contains a large number of files, and you want to commit and push the recent changes (that you made on all of them) to your repository, the GUI Git component gets super slow and practically doesn't work. An...
Of course you can ignore the GUI and stick to the command-line Git forever, but if you don't want, a quick jump to the command-line git would solve this problem for now. The temporary solution that I found is as follows: 1. Click on the **blue-gear icon** on the GIT panel, inside RStudio. 2. Select **Shell** (a termi...
35844366
Is the a shorter way of writing git diff HEAD^ HEAD?
10
2016-03-07 12:57:55
<p>I find myself typing this pretty often, like when I made some change, committed it, and then either need to look up something I did there to figure out what to do next, or make sure I didn't add anything unintended to the commit before pushing it to a remote.</p> <p>Admittedly, <code>diff HEAD^ HEAD</code> is fast ...
1,669
745,903
2020-02-27 03:10:28
35,844,416
15
2016-03-07 12:59:55
1,956,010
2016-03-07 13:18:17
https://stackoverflow.com/q/35844366
https://stackoverflow.com/a/35844416
<p>Try <a href="https://git-scm.com/docs/git-show" rel="noreferrer"><code>git show</code></a>. Without other options, it shows a diff of the latest commit.</p> <p><code>git show $something</code> shows the content of <code>$something</code> in a user-friendly way. When <code>$something</code> refers to a file, <code>g...
<p>Try <a href="https://git-scm.com/docs/git-show" rel="noreferrer"><code>git show</code></a>. Without other options, it shows a diff of the latest commit.</p> <p><code>git show $something</code> shows the content of <code>$something</code> in a user-friendly way. When <code>$something</code> refers to a file, <code>g...
119, 9033
git, git-diff
<h1>Is the a shorter way of writing git diff HEAD^ HEAD?</h1> <p>I find myself typing this pretty often, like when I made some change, committed it, and then either need to look up something I did there to figure out what to do next, or make sure I didn't add anything unintended to the commit before pushing it to a rem...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,975
git
# Is the a shorter way of writing git diff HEAD^ HEAD? I find myself typing this pretty often, like when I made some change, committed it, and then either need to look up something I did there to figure out what to do next, or make sure I didn't add anything unintended to the commit before pushing it to a remote. Adm...
Try [`git show`](https://git-scm.com/docs/git-show). Without other options, it shows a diff of the latest commit. `git show $something` shows the content of `$something` in a user-friendly way. When `$something` refers to a file, `git show` will display the file's content. When it refers to a commit, Git shows the com...
32990720
The Repository is Locked - Error while trying to commit into source control
10
2015-10-07 11:13:32
<p>I was trying to commit files into my source control (Git) as usual, using Xcode 7.0.1 and from a point onwards I keep getting this message, disallowing me to commit changes into my source control:</p> <p><a href="https://i.sstatic.net/gGGLu.png" rel="noreferrer"><img src="https://i.sstatic.net/gGGLu.png" alt="The R...
13,941
3,249,270
2020-06-18 05:24:53
33,406,722
15
2015-10-29 05:41:19
4,173,482
2015-10-29 10:10:53
https://stackoverflow.com/q/32990720
https://stackoverflow.com/a/33406722
<p>It's just a common issue faced if two or more git operations are done by your system and that generates a lock file. </p> <p>All you need to do is:</p> <ol> <li>Close Xcode</li> <li>Open the .git folder in your xcode project folder. The folder is hidden, so you would need to either use terminal to open the directo...
<p>It's just a common issue faced if two or more git operations are done by your system and that generates a lock file. </p> <p>All you need to do is:</p> <ol> <li>Close Xcode</li> <li>Open the .git folder in your xcode project folder. The folder is hidden, so you would need to either use terminal to open the directo...
119, 456, 908, 5597
commit, git, version-control, xcode
<h1>The Repository is Locked - Error while trying to commit into source control</h1> <p>I was trying to commit files into my source control (Git) as usual, using Xcode 7.0.1 and from a point onwards I keep getting this message, disallowing me to commit changes into my source control:</p> <p><a href="https://i.sstatic....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,978
git
# The Repository is Locked - Error while trying to commit into source control I was trying to commit files into my source control (Git) as usual, using Xcode 7.0.1 and from a point onwards I keep getting this message, disallowing me to commit changes into my source control: [![The Repository is Locked](https://i.ssta...
It's just a common issue faced if two or more git operations are done by your system and that generates a lock file. All you need to do is: 1. Close Xcode 2. Open the .git folder in your xcode project folder. The folder is hidden, so you would need to either use terminal to open the directory or the "Go to Folder" op...
27257761
Local and remote branch name is same still getting "The upstream branch of your current branch does not match the name of your current branch "
10
2014-12-02 19:52:29
<p>When I do git branch I get that I am on branch v0.2.</p> <pre><code> git branch v0.1 * v0.2 </code></pre> <p>But when I do git push it says "The upstream branch of your current branch does not match the name of your current branch "</p> <pre><code>git push fatal: The upstream branch of your current branch does...
10,673
3,311,616
2014-12-03 00:51:05
27,261,804
15
2014-12-03 00:51:05
4,231,110
2014-12-03 00:51:05
https://stackoverflow.com/q/27257761
https://stackoverflow.com/a/27261804
<p>Git keeps track of which local branch goes with which remote branch. When you renamed the remote branch, git <strong>lost track</strong> of which remote goes with your local <code>v0.2</code> branch. You can fix this using the <code>--set-upstream-to</code> or <code>-u</code> flag for the branch command.</p> <pre><...
<p>Git keeps track of which local branch goes with which remote branch. When you renamed the remote branch, git <strong>lost track</strong> of which remote goes with your local <code>v0.2</code> branch. You can fix this using the <code>--set-upstream-to</code> or <code>-u</code> flag for the branch command.</p> <pre><...
119
git
<h1>Local and remote branch name is same still getting "The upstream branch of your current branch does not match the name of your current branch "</h1> <p>When I do git branch I get that I am on branch v0.2.</p> <pre><code> git branch v0.1 * v0.2 </code></pre> <p>But when I do git push it says "The upstream branch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,981
git
# Local and remote branch name is same still getting "The upstream branch of your current branch does not match the name of your current branch " When I do git branch I get that I am on branch v0.2. ``` git branch v0.1 * v0.2 ``` But when I do git push it says "The upstream branch of your current branch does not ...
Git keeps track of which local branch goes with which remote branch. When you renamed the remote branch, git **lost track** of which remote goes with your local `v0.2` branch. You can fix this using the `--set-upstream-to` or `-u` flag for the branch command. ``` git checkout v0.2 git branch -u origin/v0.2 ``` Now wh...
26855990
Is there a way to do "git checkout" and *force* the argument to be interpreted as a branch name?
10
2014-11-11 01:24:40
<p>You type the command "git checkout foo".</p> <p>If there is a branch called "foo" yet no file by that name, it switches to the branch -- and if there is a file by that name and no such branch, it updates the file "foo".</p> <p>But I wonder --- is there a way to enter the command so that Git will unconditionally in...
20,749
3,080,003
2022-10-12 07:51:36
26,856,123
15
2014-11-11 01:40:33
20,371
2014-11-11 01:40:33
https://stackoverflow.com/q/26855990
https://stackoverflow.com/a/26856123
<p>Yes, from the reference, there is this usage:</p> <pre><code>git checkout [-f|--ours|--theirs|-m|--conflict=&lt;style&gt;] [&lt;tree-ish&gt;] [--] &lt;paths&gt;… </code></pre> <p>In your case, that boils down to:</p> <pre><code>git checkout foo -- </code></pre> <p>Here, <code>foo</code> corresponds to <code>&lt;...
<p>Yes, from the reference, there is this usage:</p> <pre><code>git checkout [-f|--ours|--theirs|-m|--conflict=&lt;style&gt;] [&lt;tree-ish&gt;] [--] &lt;paths&gt;… </code></pre> <p>In your case, that boils down to:</p> <pre><code>git checkout foo -- </code></pre> <p>Here, <code>foo</code> corresponds to <code>&lt;...
119, 37230
git, git-checkout
<h1>Is there a way to do "git checkout" and *force* the argument to be interpreted as a branch name?</h1> <p>You type the command "git checkout foo".</p> <p>If there is a branch called "foo" yet no file by that name, it switches to the branch -- and if there is a file by that name and no such branch, it updates the fi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,982
git
# Is there a way to do "git checkout" and *force* the argument to be interpreted as a branch name? You type the command "git checkout foo". If there is a branch called "foo" yet no file by that name, it switches to the branch -- and if there is a file by that name and no such branch, it updates the file "foo". But I...
Yes, from the reference, there is this usage: ``` git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>… ``` In your case, that boils down to: ``` git checkout foo -- ``` Here, `foo` corresponds to `<tree-ish>` and `--` says that anything after this is referring to file names. So, if you...
26370185
How do criss-cross merges arise in Git?
10
2014-10-14 20:57:31
<p>I have been going through the, "git merge-base", man page and I can't understand how multiple merge bases develop. Specifically, I'm hung up on the following illustration in the man page:</p> <pre><code>When the history involves criss-cross merges, there can be more than one best common ancestor for two commits. Fo...
7,339
1,650,542
2018-11-06 16:20:20
26,371,211
15
2014-10-14 22:06:53
2,541,573
2018-06-15 10:36:53
https://stackoverflow.com/q/26370185
https://stackoverflow.com/a/26371211
<blockquote> <p>I just can't understand how such a situation could be created. I have attempted to recreate this criss-cross merge situation between branches using a test repository but I cannot replicate it. In all cases, I always wind up with 1 merge commit to which both A and B point to (instead of A and B pointing ...
<blockquote> <p>I just can't understand how such a situation could be created. I have attempted to recreate this criss-cross merge situation between branches using a test repository but I cannot replicate it. In all cases, I always wind up with 1 merge commit to which both A and B point to (instead of A and B pointing ...
119, 28897, 60677
git, git-merge, least-common-ancestor
<h1>How do criss-cross merges arise in Git?</h1> <p>I have been going through the, "git merge-base", man page and I can't understand how multiple merge bases develop. Specifically, I'm hung up on the following illustration in the man page:</p> <pre><code>When the history involves criss-cross merges, there can be more ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,983
git
# How do criss-cross merges arise in Git? I have been going through the, "git merge-base", man page and I can't understand how multiple merge bases develop. Specifically, I'm hung up on the following illustration in the man page: ``` When the history involves criss-cross merges, there can be more than one best common...
> I just can't understand how such a situation could be created. I have attempted to recreate this criss-cross merge situation between branches using a test repository but I cannot replicate it. In all cases, I always wind up with 1 merge commit to which both A and B point to (instead of A and B pointing to independent...
26235434
Alias "git git" to just "git"?
10
2014-10-07 11:56:31
<p>Every now and then I wind up typing "<code>git</code>" then think of something else, then type e.g., "<code>git checkout master</code>". Of course, this leaves me with</p> <pre><code>$ git git checkout master git: 'git' is not a git command. See 'git --help'. Did you mean this? init $ </code></pre> <p>Is ther...
216
874,660
2022-08-12 10:17:32
26,235,435
15
2014-10-07 11:56:31
874,660
2022-08-12 10:17:32
https://stackoverflow.com/q/26235434
https://stackoverflow.com/a/26235435
<p>I figured out the answer:</p> <p>Add this alias to your <code>~/.gitconfig</code>:</p> <pre><code>[alias] git = &quot;!git&quot; </code></pre> <p><strong>Old answer for posterity</strong></p> <p>Rather than alias, you just need to have script named <code>git-git</code> in your path with the contents:</p> <pre><c...
<p>I figured out the answer:</p> <p>Add this alias to your <code>~/.gitconfig</code>:</p> <pre><code>[alias] git = &quot;!git&quot; </code></pre> <p><strong>Old answer for posterity</strong></p> <p>Rather than alias, you just need to have script named <code>git-git</code> in your path with the contents:</p> <pre><c...
119
git
<h1>Alias "git git" to just "git"?</h1> <p>Every now and then I wind up typing "<code>git</code>" then think of something else, then type e.g., "<code>git checkout master</code>". Of course, this leaves me with</p> <pre><code>$ git git checkout master git: 'git' is not a git command. See 'git --help'. Did you mean th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,984
git
# Alias "git git" to just "git"? Every now and then I wind up typing "`git`" then think of something else, then type e.g., "`git checkout master`". Of course, this leaves me with ``` $ git git checkout master git: 'git' is not a git command. See 'git --help'. Did you mean this? init $ ``` Is there a way to crea...
I figured out the answer: Add this alias to your `~/.gitconfig`: ``` [alias] git = "!git" ``` **Old answer for posterity** Rather than alias, you just need to have script named `git-git` in your path with the contents: ``` #!/bin/bash git "$@" ``` so when you say "`git git`", git looks for `git-git`, and pass...
23017183
.gitignore not working for file in subdirectory
10
2014-04-11 15:51:29
<p>This is the content of my .gitignore file, which is at the root of my repository:</p> <pre><code># grails stuff to ignore target *.iml *.ipr .idea *.log *.swp # vi swap files .DS_Store # OS X Finder cache files # cocoapods stuff to ignore Pods Podfile.lock </code></pre> <p>The <code>.DS_Store</code> file in my...
18,136
1,085,556
2022-12-20 19:00:35
23,017,643
15
2014-04-11 16:13:20
1,860,929
2014-04-11 20:10:44
https://stackoverflow.com/q/23017183
https://stackoverflow.com/a/23017643
<p>Well, I think it is happening because of the extra space in the ignore rule, due to the comment you've added just afterwards and because of them the pattern mismatches. Verified on <code>git version 1.8.3.2</code>, <code>Ubuntu 13.10</code></p> <p>The following entry in <code>.gitignore</code> works all right (with...
<p>Well, I think it is happening because of the extra space in the ignore rule, due to the comment you've added just afterwards and because of them the pattern mismatches. Verified on <code>git version 1.8.3.2</code>, <code>Ubuntu 13.10</code></p> <p>The following entry in <code>.gitignore</code> works all right (with...
119, 369, 25056
git, gitignore, macos
<h1>.gitignore not working for file in subdirectory</h1> <p>This is the content of my .gitignore file, which is at the root of my repository:</p> <pre><code># grails stuff to ignore target *.iml *.ipr .idea *.log *.swp # vi swap files .DS_Store # OS X Finder cache files # cocoapods stuff to ignore Pods Podfile.loc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,985
git
# .gitignore not working for file in subdirectory This is the content of my .gitignore file, which is at the root of my repository: ``` # grails stuff to ignore target *.iml *.ipr .idea *.log *.swp # vi swap files .DS_Store # OS X Finder cache files # cocoapods stuff to ignore Pods Podfile.lock ``` The `.DS_Stor...
Well, I think it is happening because of the extra space in the ignore rule, due to the comment you've added just afterwards and because of them the pattern mismatches. Verified on `git version 1.8.3.2`, `Ubuntu 13.10` The following entry in `.gitignore` works all right (without any extra space) ``` .DS_Store ``` Wh...
15592933
How to grep search in modified files of working directory which are not yet been staged(indexed)?
10
2013-03-23 22:39:56
<p>It seems <code>git grep</code> doesn't have any option to search only in working directory modified files prior to indexing those files. is there any native git command for this purpose or should I use a combo git/linux commands?</p>
1,526
184,176
2013-03-24 00:03:54
15,593,439
15
2013-03-23 23:50:58
184,176
2013-03-24 00:03:54
https://stackoverflow.com/q/15592933
https://stackoverflow.com/a/15593439
<p>by using linux <code>grep</code> and <code>git ls-files</code>:</p> <pre class="lang-bsh prettyprint-override"><code>$ grep -s "search pattern" $(git ls-files -m) </code></pre> <p>note 1: grep's <code>-s</code> option is provided for <code>Suppress error messages about nonexistent or unreadable files</code> beca...
<p>by using linux <code>grep</code> and <code>git ls-files</code>:</p> <pre class="lang-bsh prettyprint-override"><code>$ grep -s "search pattern" $(git ls-files -m) </code></pre> <p>note 1: grep's <code>-s</code> option is provided for <code>Suppress error messages about nonexistent or unreadable files</code> beca...
119
git
<h1>How to grep search in modified files of working directory which are not yet been staged(indexed)?</h1> <p>It seems <code>git grep</code> doesn't have any option to search only in working directory modified files prior to indexing those files. is there any native git command for this purpose or should I use a combo ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,986
git
# How to grep search in modified files of working directory which are not yet been staged(indexed)? It seems `git grep` doesn't have any option to search only in working directory modified files prior to indexing those files. is there any native git command for this purpose or should I use a combo git/linux commands?
by using linux `grep` and `git ls-files`: ``` $ grep -s "search pattern" $(git ls-files -m) ``` note 1: grep's `-s` option is provided for `Suppress error messages about nonexistent or unreadable files` because `git ls-files -m` lists deleted files too which causes `grep` give `"No such file or directory"` error when...
11910228
Cannot push, pull or merge git. "Working copy has uncommited changes"
10
2012-08-10 22:50:38
<p>I have recently set up a git repository on bitbucket, and have added an old project onto it. I have committed and pushed a change as a test, but now I face this problem.</p> <p>Each time I try to Pull, Push, or Merge I get this error message:</p> <p><img src="https://i.sstatic.net/9nSBg.png" alt="The working copy ...
17,807
1,265,071
2015-05-13 02:30:45
15,107,498
15
2013-02-27 08:39:12
1,217,895
2014-07-31 15:08:48
https://stackoverflow.com/q/11910228
https://stackoverflow.com/a/15107498
<p>Step 1: </p> <pre><code>git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate </code></pre> <p>Step 2:</p> <pre><code>git commit -m "Removed file that shouldn't be tracked" </code></pre>
<p>Step 1: </p> <pre><code>git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate </code></pre> <p>Step 2:</p> <pre><code>git commit -m "Removed file that shouldn't be tracked" </code></pre>
119, 908, 7330, 8337, 58338
bitbucket, git, ios, repository, xcode
<h1>Cannot push, pull or merge git. "Working copy has uncommited changes"</h1> <p>I have recently set up a git repository on bitbucket, and have added an old project onto it. I have committed and pushed a change as a test, but now I face this problem.</p> <p>Each time I try to Pull, Push, or Merge I get this error mes...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,987
git
# Cannot push, pull or merge git. "Working copy has uncommited changes" I have recently set up a git repository on bitbucket, and have added an old project onto it. I have committed and pushed a change as a test, but now I face this problem. Each time I try to Pull, Push, or Merge I get this error message: ![The wor...
Step 1: ``` git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate ``` Step 2: ``` git commit -m "Removed file that shouldn't be tracked" ```
15028580
filter-branch --index-filter always failing with "fatal: bad source"
10
2013-02-22 16:17:56
<p>So, I am trying to rename a folder in my repository using <code>git filter-branch --index-filter</code>, but I always end up with a "fatal: bad source" error.</p> <p>The problem is easily demonstrated on a test repository using a file instead of a folder.</p> <p>Preparation:</p> <pre><code>$ git init $ echo whate...
4,437
572,644
2014-05-24 05:05:15
15,029,691
15
2013-02-22 17:14:25
572,644
2014-05-24 05:05:15
https://stackoverflow.com/q/15028580
https://stackoverflow.com/a/15029691
<p>As twalberg points out in his answer, git mv doesn't just access the index, it also access the disk. That's probably the reason why it doesn't work.</p> <p>I didn't want to use the slow <code>--tree-filter</code> so I tried to change the sample from the <code>git filter-branch</code> man page that shows how to move...
<p>As twalberg points out in his answer, git mv doesn't just access the index, it also access the disk. That's probably the reason why it doesn't work.</p> <p>I didn't want to use the slow <code>--tree-filter</code> so I tried to change the sample from the <code>git filter-branch</code> man page that shows how to move...
119
git
<h1>filter-branch --index-filter always failing with "fatal: bad source"</h1> <p>So, I am trying to rename a folder in my repository using <code>git filter-branch --index-filter</code>, but I always end up with a "fatal: bad source" error.</p> <p>The problem is easily demonstrated on a test repository using a file ins...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,988
git
# filter-branch --index-filter always failing with "fatal: bad source" So, I am trying to rename a folder in my repository using `git filter-branch --index-filter`, but I always end up with a "fatal: bad source" error. The problem is easily demonstrated on a test repository using a file instead of a folder. Preparat...
As twalberg points out in his answer, git mv doesn't just access the index, it also access the disk. That's probably the reason why it doesn't work. I didn't want to use the slow `--tree-filter` so I tried to change the sample from the `git filter-branch` man page that shows how to move the complete repository into a ...
9796328
git, how to I go back to origin master after pulling a branch
10
2012-03-20 23:01:00
<p>This has to be a FAQ, but I can't find it googling.</p> <p>Another person created a branch, commit'd to it, and pushed it to github using git push origin newbranch</p> <p>I successfully pulled it down using</p> <pre><code>git pull origin newbranch </code></pre> <p>Now, I want to go back to the origin master vers...
29,810
244,246
2018-08-03 07:29:44
9,796,504
15
2012-03-20 23:21:39
106,205
2012-03-21 05:47:20
https://stackoverflow.com/q/9796328
https://stackoverflow.com/a/9796504
<p>This should work to do what you need:</p> <pre><code>git checkout origin/master </code></pre>
<p>This should work to do what you need:</p> <pre><code>git checkout origin/master </code></pre>
119
git
<h1>git, how to I go back to origin master after pulling a branch</h1> <p>This has to be a FAQ, but I can't find it googling.</p> <p>Another person created a branch, commit'd to it, and pushed it to github using git push origin newbranch</p> <p>I successfully pulled it down using</p> <pre><code>git pull origin newbr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,989
git
# git, how to I go back to origin master after pulling a branch This has to be a FAQ, but I can't find it googling. Another person created a branch, commit'd to it, and pushed it to github using git push origin newbranch I successfully pulled it down using ``` git pull origin newbranch ``` Now, I want to go back t...
This should work to do what you need: ``` git checkout origin/master ```
8956522
git commit auto add new folders or files?
10
2012-01-21 20:42:15
<p>Is it possible to have <code>git commit</code> also add new files and directories? </p> <p>It seems a lot of needless typing in the long run to have to type <code>git add .</code> then <code>git commit</code> </p> <p>(That, and I have a tendency to often forget to call <code>git add .</code> resulting in versions ...
6,993
357,189
2017-04-13 18:28:18
8,956,546
15
2012-01-21 20:45:15
782,822
2017-04-13 18:28:18
https://stackoverflow.com/q/8956522
https://stackoverflow.com/a/8956546
<p>As long as I am informed right there is no such command (It could be dangerous when you have debug-files containing passwords), but if you want to simulate you could add this alias to your git config:</p> <pre><code>git config --global alias.commitx "!git add . &amp;&amp; git commit" </code></pre> <p>Using <code>g...
<p>As long as I am informed right there is no such command (It could be dangerous when you have debug-files containing passwords), but if you want to simulate you could add this alias to your git config:</p> <pre><code>git config --global alias.commitx "!git add . &amp;&amp; git commit" </code></pre> <p>Using <code>g...
119
git
<h1>git commit auto add new folders or files?</h1> <p>Is it possible to have <code>git commit</code> also add new files and directories? </p> <p>It seems a lot of needless typing in the long run to have to type <code>git add .</code> then <code>git commit</code> </p> <p>(That, and I have a tendency to often forget to...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,990
git
# git commit auto add new folders or files? Is it possible to have `git commit` also add new files and directories? It seems a lot of needless typing in the long run to have to type `git add .` then `git commit` (That, and I have a tendency to often forget to call `git add .` resulting in versions with missing direc...
As long as I am informed right there is no such command (It could be dangerous when you have debug-files containing passwords), but if you want to simulate you could add this alias to your git config: ``` git config --global alias.commitx "!git add . && git commit" ``` Using `git commitx` will now run `git add .` fol...
7201720
How to delete a blob from a Git repo
10
2011-08-26 08:06:28
<p>I accidentally added a database dump (over 1 GB) to my repository, pushed it and noticed this few days later.</p> <p>I used <code>git filter-branch</code> to delete the file, expired reflog and ran <code>git gc</code> to prune unused objects, but the database dump blob is still in the repository. I used <em><a href...
10,436
1,307,988
2021-08-31 01:20:00
7,201,842
15
2011-08-26 08:18:28
465,223
2011-08-26 08:18:28
https://stackoverflow.com/q/7201720
https://stackoverflow.com/a/7201842
<p>Which command did you call exactly when running git gc?</p> <p>Note the manpage of git gc:</p> <blockquote> <p>The optional configuration variable gc.pruneExpire controls how old the unreferenced loose objects have to be before they are pruned. The default is "2 weeks ago"</p> </blockquote> <p>So if your blob i...
<p>Which command did you call exactly when running git gc?</p> <p>Note the manpage of git gc:</p> <blockquote> <p>The optional configuration variable gc.pruneExpire controls how old the unreferenced loose objects have to be before they are pruned. The default is "2 weeks ago"</p> </blockquote> <p>So if your blob i...
119, 456
git, version-control
<h1>How to delete a blob from a Git repo</h1> <p>I accidentally added a database dump (over 1 GB) to my repository, pushed it and noticed this few days later.</p> <p>I used <code>git filter-branch</code> to delete the file, expired reflog and ran <code>git gc</code> to prune unused objects, but the database dump blob i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,991
git
# How to delete a blob from a Git repo I accidentally added a database dump (over 1 GB) to my repository, pushed it and noticed this few days later. I used `git filter-branch` to delete the file, expired reflog and ran `git gc` to prune unused objects, but the database dump blob is still in the repository. I used *[W...
Which command did you call exactly when running git gc? Note the manpage of git gc: > The optional configuration variable gc.pruneExpire controls how old the unreferenced loose objects have to be before they are pruned. The default is "2 weeks ago" So if your blob is younger than 14 days, you have to call ``` git g...
6072311
How do I check git log for a "fast-forward" merge?
10
2011-05-20 13:04:38
<p>In the following example, is there a way to know a merge happened? Looking at git log, I can't tell I merged.</p> <pre><code># setup example directory $ mkdir test $ cd test $ git init $ touch a $ git add a $ git commit -m "1" # switch to different branch $ git checkout -b topic $ touch b $ git add b $ git commit...
7,227
533,212
2012-08-05 04:15:02
6,072,375
15
2011-05-20 13:09:38
223,092
2011-05-20 13:15:32
https://stackoverflow.com/q/6072311
https://stackoverflow.com/a/6072375
<p>In that instance, git has spotted that it's possible to do a so-called "fast-forward" merge, since the branch you're merging in already contains everything in the current branch - it doesn't need to create a new commit in the commit graph to join the two branches.</p> <p>If you don't like that behaviour, and want c...
<p>In that instance, git has spotted that it's possible to do a so-called "fast-forward" merge, since the branch you're merging in already contains everything in the current branch - it doesn't need to create a new commit in the commit graph to join the two branches.</p> <p>If you don't like that behaviour, and want c...
119
git
<h1>How do I check git log for a "fast-forward" merge?</h1> <p>In the following example, is there a way to know a merge happened? Looking at git log, I can't tell I merged.</p> <pre><code># setup example directory $ mkdir test $ cd test $ git init $ touch a $ git add a $ git commit -m "1" # switch to different branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,992
git
# How do I check git log for a "fast-forward" merge? In the following example, is there a way to know a merge happened? Looking at git log, I can't tell I merged. ``` # setup example directory $ mkdir test $ cd test $ git init $ touch a $ git add a $ git commit -m "1" # switch to different branch $ git checkout -b t...
In that instance, git has spotted that it's possible to do a so-called "fast-forward" merge, since the branch you're merging in already contains everything in the current branch - it doesn't need to create a new commit in the commit graph to join the two branches. If you don't like that behaviour, and want create a me...
2925884
Managing .git file size
10
2010-05-28 00:09:31
<p>My .git file has grown to 229Mb and I wondering what the best way to cut down the size is. I know about git gc and have been using it a fair amount. I'm not totally sure about how git works, but I know that there is packaged information in there that I no longer need. Like, I know I no longer need the first five ...
6,077
323,636
2014-12-03 18:03:41
2,926,181
15
2010-05-28 01:45:02
268,330
2010-05-28 01:45:02
https://stackoverflow.com/q/2925884
https://stackoverflow.com/a/2926181
<p>If you want to keep your (reachable) commit history intact, then expire, repack, prune, and garbage collect:</p> <pre><code>git reflog expire --expire=0 --all git repack -ad git prune git gc </code></pre> <p>This should be the minimal size you can get your repo <em>and</em> keep your commit history.</p> <p>If no...
<p>If you want to keep your (reachable) commit history intact, then expire, repack, prune, and garbage collect:</p> <pre><code>git reflog expire --expire=0 --all git repack -ad git prune git gc </code></pre> <p>This should be the minimal size you can get your repo <em>and</em> keep your commit history.</p> <p>If no...
119
git
<h1>Managing .git file size</h1> <p>My .git file has grown to 229Mb and I wondering what the best way to cut down the size is. I know about git gc and have been using it a fair amount. I'm not totally sure about how git works, but I know that there is packaged information in there that I no longer need. Like, I know...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,993
git
# Managing .git file size My .git file has grown to 229Mb and I wondering what the best way to cut down the size is. I know about git gc and have been using it a fair amount. I'm not totally sure about how git works, but I know that there is packaged information in there that I no longer need. Like, I know I no longer...
If you want to keep your (reachable) commit history intact, then expire, repack, prune, and garbage collect: ``` git reflog expire --expire=0 --all git repack -ad git prune git gc ``` This should be the minimal size you can get your repo *and* keep your commit history. If not, i.e., you want or do not mind starting...
70039701
Git submodule update gets stuck at old commit
9
2021-11-19 18:59:46
<p>Ok this one is driving me crazy. I tried committing/pushing/updating a parent repository with a file from its submodule open in another program (a XLS spreadsheet). The operation &quot;succeeded&quot; with only a <code>Couldn't unlink old somefile.xls</code> warning.</p> <p>Now I'm trying to <code>git submodule upda...
7,040
12,733,629
2021-11-20 02:27:04
70,042,798
15
2021-11-20 02:27:04
1,256,452
2021-11-20 02:27:04
https://stackoverflow.com/q/70039701
https://stackoverflow.com/a/70042798
<p>Your mistake here lies in thinking that submodules should work. 😀</p> <p>OK, to be fair to submodules and Git, let's make that: should work <em>automatically</em>. Submodules <em>can</em> be made to work, but it's painful. (This is why some call them <em>sob</em>-modules.)</p> <p>The root of the problem is that a...
<p>Your mistake here lies in thinking that submodules should work. 😀</p> <p>OK, to be fair to submodules and Git, let's make that: should work <em>automatically</em>. Submodules <em>can</em> be made to work, but it's painful. (This is why some call them <em>sob</em>-modules.)</p> <p>The root of the problem is that a...
119, 41612
git, git-submodules
<h1>Git submodule update gets stuck at old commit</h1> <p>Ok this one is driving me crazy. I tried committing/pushing/updating a parent repository with a file from its submodule open in another program (a XLS spreadsheet). The operation &quot;succeeded&quot; with only a <code>Couldn't unlink old somefile.xls</code> war...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,997
git
# Git submodule update gets stuck at old commit Ok this one is driving me crazy. I tried committing/pushing/updating a parent repository with a file from its submodule open in another program (a XLS spreadsheet). The operation "succeeded" with only a `Couldn't unlink old somefile.xls` warning. Now I'm trying to `git ...
Your mistake here lies in thinking that submodules should work. 😀 OK, to be fair to submodules and Git, let's make that: should work *automatically*. Submodules *can* be made to work, but it's painful. (This is why some call them *sob*-modules.) The root of the problem is that a submodule *is* some *other Git reposi...
56987596
How to prevent direct commits to master branch using husky?
9
2019-07-11 10:54:00
<p>I am using husky to run git hooks.</p> <pre><code>"husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } </code></pre> <p>I want to prevent direct commits to master branch. It should allow the master branch to be updated only by merge requests.</p> <p>I came across following code...
5,921
2,094,106
2020-09-25 08:59:07
64,060,996
15
2020-09-25 08:59:07
1,566,294
2020-09-25 08:59:07
https://stackoverflow.com/q/56987596
https://stackoverflow.com/a/64060996
<p>I created a file with the content provided from OP.</p> <p>file: hooks/pre-commit</p> <pre><code>#!/bin/sh branch=&quot;$(git rev-parse --abbrev-ref HEAD)&quot; if [ &quot;$branch&quot; = &quot;master&quot; ]; then echo &quot;You can't commit directly to master branch&quot; exit 1 fi </code></pre> <p>Then I ad...
<p>I created a file with the content provided from OP.</p> <p>file: hooks/pre-commit</p> <pre><code>#!/bin/sh branch=&quot;$(git rev-parse --abbrev-ref HEAD)&quot; if [ &quot;$branch&quot; = &quot;master&quot; ]; then echo &quot;You can't commit directly to master branch&quot; exit 1 fi </code></pre> <p>Then I ad...
119, 130301
git, git-husky
<h1>How to prevent direct commits to master branch using husky?</h1> <p>I am using husky to run git hooks.</p> <pre><code>"husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } </code></pre> <p>I want to prevent direct commits to master branch. It should allow the master branch to be...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,999
git
# How to prevent direct commits to master branch using husky? I am using husky to run git hooks. ``` "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } ``` I want to prevent direct commits to master branch. It should allow the master branch to be updated only by merge requests. ...
I created a file with the content provided from OP. file: hooks/pre-commit ``` #!/bin/sh branch="$(git rev-parse --abbrev-ref HEAD)" if [ "$branch" = "master" ]; then echo "You can't commit directly to master branch" exit 1 fi ``` Then I added an entry to husky pre-commit field in package.json ``` "husky": ...
47929881
Git: fatal: fsync error on 'sha1 file': Bad file descriptor
9
2017-12-21 17:23:02
<p>I'm using VS Code with Git - it's in portable location C:\_DEV\bin\git and is also added to Windows PATH so it works just fine with no remotes.</p> <p>I have a OneDrive <em>_GIT</em> folder where I have some of my "remote" repositories, that sync between 2 devices (sometimes, I have it there mainly for backup purpo...
26,531
1,415,168
2020-11-02 18:36:11
48,251,872
15
2018-01-14 16:49:13
750,989
2018-01-14 16:49:13
https://stackoverflow.com/q/47929881
https://stackoverflow.com/a/48251872
<p>Thanks to @edward-thomson.<br> I had same problem on my PC, where i mapped a folder under my homedrive to E:</p> <pre><code>C:\Users\myuserid\E-Folder\SomeGitProject </code></pre> <p>by sharing the folder, so i could shortcut it to </p> <pre><code>E:\SomeGitProject </code></pre> <p>Solution was to use the full p...
<p>Thanks to @edward-thomson.<br> I had same problem on my PC, where i mapped a folder under my homedrive to E:</p> <pre><code>C:\Users\myuserid\E-Folder\SomeGitProject </code></pre> <p>by sharing the folder, so i could shortcut it to </p> <pre><code>E:\SomeGitProject </code></pre> <p>Solution was to use the full p...
64, 119
git, windows
<h1>Git: fatal: fsync error on 'sha1 file': Bad file descriptor</h1> <p>I'm using VS Code with Git - it's in portable location C:\_DEV\bin\git and is also added to Windows PATH so it works just fine with no remotes.</p> <p>I have a OneDrive <em>_GIT</em> folder where I have some of my "remote" repositories, that sync ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,002
git
# Git: fatal: fsync error on 'sha1 file': Bad file descriptor I'm using VS Code with Git - it's in portable location C:\_DEV\bin\git and is also added to Windows PATH so it works just fine with no remotes. I have a OneDrive *_GIT* folder where I have some of my "remote" repositories, that sync between 2 devices (some...
Thanks to @edward-thomson. I had same problem on my PC, where i mapped a folder under my homedrive to E: ``` C:\Users\myuserid\E-Folder\SomeGitProject ``` by sharing the folder, so i could shortcut it to ``` E:\SomeGitProject ``` Solution was to use the full path in CMD or use the shortcut to homedrive from git b...
44362275
Git branch is still on same line as master
9
2017-06-05 05:34:40
<p>I am getting something unexpected happening in the git tree. I have created a branch off of master, however while I am performing commits on the new branch it appears as though these are taking place in the same code line as master...</p> <p><a href="https://i.sstatic.net/SCi1Z.png" rel="noreferrer"><img src="https...
3,952
1,367,229
2017-08-08 07:54:45
44,362,643
15
2017-06-05 06:05:00
1,372,145
2017-06-05 06:11:23
https://stackoverflow.com/q/44362275
https://stackoverflow.com/a/44362643
<p>It seems that you are a bit mistaken on how git works (which is normal because you said you are new to git)</p> <p>Each branch does not necessarily get it's own line. If your branch <code>Sprint_15</code> has it's base as <code>master</code> and <code>Sprint_15</code> is any number of commits ahead of <code>master<...
<p>It seems that you are a bit mistaken on how git works (which is normal because you said you are new to git)</p> <p>Each branch does not necessarily get it's own line. If your branch <code>Sprint_15</code> has it's base as <code>master</code> and <code>Sprint_15</code> is any number of commits ahead of <code>master<...
119, 1879, 40701, 64339, 64464
branch, branching-strategy, feature-branch, git, git-flow
<h1>Git branch is still on same line as master</h1> <p>I am getting something unexpected happening in the git tree. I have created a branch off of master, however while I am performing commits on the new branch it appears as though these are taking place in the same code line as master...</p> <p><a href="https://i.sst...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,005
git
# Git branch is still on same line as master I am getting something unexpected happening in the git tree. I have created a branch off of master, however while I am performing commits on the new branch it appears as though these are taking place in the same code line as master... [![enter image description here](https...
It seems that you are a bit mistaken on how git works (which is normal because you said you are new to git) Each branch does not necessarily get it's own line. If your branch `Sprint_15` has it's base as `master` and `Sprint_15` is any number of commits ahead of `master` then they will share the same line. As soon as ...
44162174
Git : Move staged changes to different or new branch
9
2017-05-24 15:03:25
<p>I can currently do it by following these three steps</p> <ol> <li>Unstage by using <code>git reset HEAD &lt;file&gt;...</code></li> <li>checkout to the branch <code>git checkout [-b] &lt;branchname&gt;</code></li> <li>Stage again <code>git add &lt;file&gt;...</code></li> </ol> <p>Is there a better way of moving th...
12,727
2,455,546
2017-05-24 21:02:10
44,166,981
15
2017-05-24 19:28:10
1,256,452
2017-05-24 21:02:10
https://stackoverflow.com/q/44162174
https://stackoverflow.com/a/44166981
<p><a href="https://stackoverflow.com/a/44162267/1256452">Edmundo's answer</a> is the right one, but it could use some details about <em>why</em> it's the right one.</p> <p>There are two cases of interest here:</p> <ul> <li><p>Making a <em>new</em> branch that starts from the commit where you are now is trivially eas...
<p><a href="https://stackoverflow.com/a/44162267/1256452">Edmundo's answer</a> is the right one, but it could use some details about <em>why</em> it's the right one.</p> <p>There are two cases of interest here:</p> <ul> <li><p>Making a <em>new</em> branch that starts from the commit where you are now is trivially eas...
119
git
<h1>Git : Move staged changes to different or new branch</h1> <p>I can currently do it by following these three steps</p> <ol> <li>Unstage by using <code>git reset HEAD &lt;file&gt;...</code></li> <li>checkout to the branch <code>git checkout [-b] &lt;branchname&gt;</code></li> <li>Stage again <code>git add &lt;file&g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,007
git
# Git : Move staged changes to different or new branch I can currently do it by following these three steps 1. Unstage by using `git reset HEAD <file>...` 2. checkout to the branch `git checkout [-b] <branchname>` 3. Stage again `git add <file>...` Is there a better way of moving the staged changes?
[Edmundo's answer](https://stackoverflow.com/a/44162267/1256452) is the right one, but it could use some details about *why* it's the right one. There are two cases of interest here: - Making a *new* branch that starts from the commit where you are now is trivially easy: ``` $ git checkout -b newbranch ... con...
31624989
Git didn't recognize rename of a file
9
2015-07-25 09:24:04
<p>I renamed one Java source file from <em>Multiplechoice.java</em> to <em>MultipleChoice.java</em>.</p> <p>Unfortunately Git didn't recognize this change. So when someone clones or pulls my repository he or she will have to do the renaming manually, because otherwise the project can't build because this class is used ...
4,239
1,496,702
2021-05-26 19:42:09
31,625,007
15
2015-07-25 09:26:10
218,152
2021-04-23 16:49:23
https://stackoverflow.com/q/31624989
https://stackoverflow.com/a/31625007
<p>Use the Git <strong>move</strong> function:</p> <pre><code>git mv &quot;Multiplechoice.java&quot; &quot;MultipleChoice.java&quot; </code></pre>
<p>Use the Git <strong>move</strong> function:</p> <pre><code>git mv &quot;Multiplechoice.java&quot; &quot;MultipleChoice.java&quot; </code></pre>
119
git
<h1>Git didn't recognize rename of a file</h1> <p>I renamed one Java source file from <em>Multiplechoice.java</em> to <em>MultipleChoice.java</em>.</p> <p>Unfortunately Git didn't recognize this change. So when someone clones or pulls my repository he or she will have to do the renaming manually, because otherwise the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,010
git
# Git didn't recognize rename of a file I renamed one Java source file from *Multiplechoice.java* to *MultipleChoice.java*. Unfortunately Git didn't recognize this change. So when someone clones or pulls my repository he or she will have to do the renaming manually, because otherwise the project can't build because t...
Use the Git **move** function: ``` git mv "Multiplechoice.java" "MultipleChoice.java" ```
22382436
Deleting a local commit?
9
2014-03-13 14:53:29
<p>I have 3 commits (I am currently only using GIT on my local machine).</p> <p>If I delete commit 2, will it affect any of the changes in commit 3 as commit 3 was followed on from commit 2?</p> <p>I was planning on using:</p> <pre><code>git reset --hard &lt;commit 2 id here&gt; </code></pre>
22,516
364,312
2021-03-03 14:21:27
22,382,744
15
2014-03-13 15:04:18
1,860,309
2014-03-13 15:04:18
https://stackoverflow.com/q/22382436
https://stackoverflow.com/a/22382744
<p>The command</p> <pre><code>git reset --hard &lt;commit 2 id here&gt; </code></pre> <p>doesn't delete commit 2. This will just put your current branch on the commit 2. If no other branches point to the commit 3 you may loose it during garbage collection.</p> <p>What you need is interactive rebase:</p> <pre><code>...
<p>The command</p> <pre><code>git reset --hard &lt;commit 2 id here&gt; </code></pre> <p>doesn't delete commit 2. This will just put your current branch on the commit 2. If no other branches point to the commit 3 you may loose it during garbage collection.</p> <p>What you need is interactive rebase:</p> <pre><code>...
119
git
<h1>Deleting a local commit?</h1> <p>I have 3 commits (I am currently only using GIT on my local machine).</p> <p>If I delete commit 2, will it affect any of the changes in commit 3 as commit 3 was followed on from commit 2?</p> <p>I was planning on using:</p> <pre><code>git reset --hard &lt;commit 2 id here&gt; </c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,012
git
# Deleting a local commit? I have 3 commits (I am currently only using GIT on my local machine). If I delete commit 2, will it affect any of the changes in commit 3 as commit 3 was followed on from commit 2? I was planning on using: ``` git reset --hard <commit 2 id here> ```
The command ``` git reset --hard <commit 2 id here> ``` doesn't delete commit 2. This will just put your current branch on the commit 2. If no other branches point to the commit 3 you may loose it during garbage collection. What you need is interactive rebase: ``` git rebase -i HEAD~2 ``` Then you will get editor ...
21516123
switch to another branch without committing
9
2014-02-02 20:55:30
<p>I am working on a feature branch and have not finished the work there - Now I need to change to a different branch to fix something</p> <p>for example</p> <pre><code>feat1 - 6+ files changed </code></pre> <p>When I checkout to feat2 branch, after <code>git add .</code> in feat1, git seems to carry over the staged...
2,551
972,789
2014-02-02 21:17:19
21,516,146
15
2014-02-02 20:56:54
354,577
2014-02-02 21:02:18
https://stackoverflow.com/q/21516123
https://stackoverflow.com/a/21516146
<p><a href="http://git-scm.com/docs/git-stash">Stash</a> them:</p> <pre><code>$ git stash save -u "Some logical description of the changes" $ git stash list stash@{0}: Some logical description of the changes $ git checkout other-branch </code></pre> <p>When you're done, you can use <code>git stash apply</code> to app...
<p><a href="http://git-scm.com/docs/git-stash">Stash</a> them:</p> <pre><code>$ git stash save -u "Some logical description of the changes" $ git stash list stash@{0}: Some logical description of the changes $ git checkout other-branch </code></pre> <p>When you're done, you can use <code>git stash apply</code> to app...
119
git
<h1>switch to another branch without committing</h1> <p>I am working on a feature branch and have not finished the work there - Now I need to change to a different branch to fix something</p> <p>for example</p> <pre><code>feat1 - 6+ files changed </code></pre> <p>When I checkout to feat2 branch, after <code>git add ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,013
git
# switch to another branch without committing I am working on a feature branch and have not finished the work there - Now I need to change to a different branch to fix something for example ``` feat1 - 6+ files changed ``` When I checkout to feat2 branch, after `git add .` in feat1, git seems to carry over the stag...
[Stash](http://git-scm.com/docs/git-stash) them: ``` $ git stash save -u "Some logical description of the changes" $ git stash list stash@{0}: Some logical description of the changes $ git checkout other-branch ``` When you're done, you can use `git stash apply` to apply the changes in your stash and keep the stash a...
20931956
Why does my WEBrick server get killed?
9
2014-01-05 09:22:52
<p>I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this.</p> <p>Example Console Ouput:</p> <pre><code>user@machinename:~/git/app$ rails s ...
2,273
240,539
2014-02-08 04:30:06
21,012,031
15
2014-01-09 05:09:52
375,960
2014-01-09 05:09:52
https://stackoverflow.com/q/20931956
https://stackoverflow.com/a/21012031
<p>It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy.</p> <p>Here's an article walking you through adding a swapfile:</p> <pre><code>https://www.digitalocean.com/community/...
<p>It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy.</p> <p>Here's an article walking you through adding a swapfile:</p> <pre><code>https://www.digitalocean.com/community/...
549, 4984, 17851, 64108, 97102
digital-ocean, ruby-on-rails, ruby-on-rails-3, ubuntu, webrick
<h1>Why does my WEBrick server get killed?</h1> <p>I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this.</p> <p>Example Console Ouput:</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,014
git
# Why does my WEBrick server get killed? I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this. Example Console Ouput: ``` user@machinenam...
It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy. Here's an article walking you through adding a swapfile: ``` https://www.digitalocean.com/community/articles/how-to-add-swap...
18622920
Completely replace Fork with origin (github)
9
2013-09-04 20:12:05
<p>Is there clever workflow to create a pull_request branch on a fork that is diverged from an upstream repo, so that the pull_request branch always perfectly matches the upstream "master"? </p> <p>That is, </p> <p>1) I have a fork which has diverged considerably from the parent remote.</p> <p>2) I want to keep my ...
2,449
350,542
2019-05-05 15:54:53
18,628,581
15
2013-09-05 05:41:01
null
2013-09-05 05:46:09
https://stackoverflow.com/q/18622920
https://stackoverflow.com/a/18628581
<p>First of all, you shouldn't be modifying your local <code>master</code> branch, you should only be creating feature branches. If you keep your local <code>master</code> unmodified, then you can fetch the latest changes from the upstream repo:</p> <pre class="lang-bash prettyprint-override"><code>git remote add upst...
<p>First of all, you shouldn't be modifying your local <code>master</code> branch, you should only be creating feature branches. If you keep your local <code>master</code> unmodified, then you can fetch the latest changes from the upstream repo:</p> <pre class="lang-bash prettyprint-override"><code>git remote add upst...
119, 64512
git, pull-request
<h1>Completely replace Fork with origin (github)</h1> <p>Is there clever workflow to create a pull_request branch on a fork that is diverged from an upstream repo, so that the pull_request branch always perfectly matches the upstream "master"? </p> <p>That is, </p> <p>1) I have a fork which has diverged considerably...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,015
git
# Completely replace Fork with origin (github) Is there clever workflow to create a pull_request branch on a fork that is diverged from an upstream repo, so that the pull_request branch always perfectly matches the upstream "master"? That is, 1) I have a fork which has diverged considerably from the parent remote. ...
First of all, you shouldn't be modifying your local `master` branch, you should only be creating feature branches. If you keep your local `master` unmodified, then you can fetch the latest changes from the upstream repo: ``` git remote add upstream <url-for-upstream-repo> git fetch upstream ``` Now your remote-tracki...
14819084
Can't open ssh/authorized_keys of user
9
2013-02-11 19:07:01
<p>I know this may be trivial for some of you.</p> <p>I'm not a linux expert, and I'm trying to play around with git. To do so I wanted to try to add my public SSH key to the <code>~/.ssh/authorized_keys</code> of my user git.</p> <p>the problem though is that when I login with putty into my server with the git user,...
30,502
1,056,832
2016-03-21 16:05:59
14,820,498
15
2013-02-11 20:42:37
263,871
2013-02-11 20:42:37
https://stackoverflow.com/q/14819084
https://stackoverflow.com/a/14820498
<p>Sounds like you're almost there! I'm not sure exactly what you have and haven't done though, so I'll explain the whole process.</p> <p>First, I'm guessing (because you're using puTTY) that your computer runs Windows? If so, first you'll need to install Git for Windows, which you can download from the <a href="http:...
<p>Sounds like you're almost there! I'm not sure exactly what you have and haven't done though, so I'll explain the whole process.</p> <p>First, I'm guessing (because you're using puTTY) that your computer runs Windows? If so, first you'll need to install Git for Windows, which you can download from the <a href="http:...
119, 386, 51877
authorized-keys, git, ssh
<h1>Can't open ssh/authorized_keys of user</h1> <p>I know this may be trivial for some of you.</p> <p>I'm not a linux expert, and I'm trying to play around with git. To do so I wanted to try to add my public SSH key to the <code>~/.ssh/authorized_keys</code> of my user git.</p> <p>the problem though is that when I lo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,016
git
# Can't open ssh/authorized_keys of user I know this may be trivial for some of you. I'm not a linux expert, and I'm trying to play around with git. To do so I wanted to try to add my public SSH key to the `~/.ssh/authorized_keys` of my user git. the problem though is that when I login with putty into my server with...
Sounds like you're almost there! I'm not sure exactly what you have and haven't done though, so I'll explain the whole process. First, I'm guessing (because you're using puTTY) that your computer runs Windows? If so, first you'll need to install Git for Windows, which you can download from the [official Git website](h...
14462129
git diff shows ^M with color ui true
9
2013-01-22 15:30:44
<p>I modified my <code>.gitconfig</code> in such a way that I have some colors when performing <code>git diff</code>:</p> <pre><code>$ cat .gitconfig [color] ui = true </code></pre> <p>I'm working on an ubuntu machine and I edited some code using VIM. After editing a file a execute <code>git diff</code>, once with a...
16,898
1,141,095
2017-11-21 10:50:59
14,462,991
15
2013-01-22 16:12:39
513,198
2013-01-22 16:12:39
https://stackoverflow.com/q/14462129
https://stackoverflow.com/a/14462991
<p>It is probably an encoding issue. The 'git diff' command is executing Vim thinking that the file format is Dos.</p> <p>When you are using any other command, it is correctly recognized as a Unix file.</p> <p>Can you try : <code>:set fileformat=unix</code> in your git diff window ?</p> <p>I am not really sure this...
<p>It is probably an encoding issue. The 'git diff' command is executing Vim thinking that the file format is Dos.</p> <p>When you are using any other command, it is correctly recognized as a Unix file.</p> <p>Can you try : <code>:set fileformat=unix</code> in your git diff window ?</p> <p>I am not really sure this...
119, 370
git, vim
<h1>git diff shows ^M with color ui true</h1> <p>I modified my <code>.gitconfig</code> in such a way that I have some colors when performing <code>git diff</code>:</p> <pre><code>$ cat .gitconfig [color] ui = true </code></pre> <p>I'm working on an ubuntu machine and I edited some code using VIM. After editing a fil...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,017
git
# git diff shows ^M with color ui true I modified my `.gitconfig` in such a way that I have some colors when performing `git diff`: ``` $ cat .gitconfig [color] ui = true ``` I'm working on an ubuntu machine and I edited some code using VIM. After editing a file a execute `git diff`, once with and once without `ui=...
It is probably an encoding issue. The 'git diff' command is executing Vim thinking that the file format is Dos. When you are using any other command, it is correctly recognized as a Unix file. Can you try : `:set fileformat=unix` in your git diff window ? I am not really sure this is the root cause, because I don't ...
7461715
In which file does git store commit history?
9
2011-09-18 13:14:04
<p>I want to read from the file where git stores commit history to store each commit information in my project's DB and display all histories in my project view.</p>
19,474
825,437
2024-08-17 07:09:55
7,462,021
15
2011-09-18 14:14:20
223,092
2011-09-18 14:14:20
https://stackoverflow.com/q/7461715
https://stackoverflow.com/a/7462021
<p>There's no single file you can interrogate to get the commit history. There are plenty of good explanations of git's object model (e.g. <a href="http://eagain.net/articles/git-for-computer-scientists/">git for computer scientists</a>, <a href="http://progit.org/book/ch9-2.html">Pro Git</a>, <a href="http://book.git...
<p>There's no single file you can interrogate to get the commit history. There are plenty of good explanations of git's object model (e.g. <a href="http://eagain.net/articles/git-for-computer-scientists/">git for computer scientists</a>, <a href="http://progit.org/book/ch9-2.html">Pro Git</a>, <a href="http://book.git...
119
git
<h1>In which file does git store commit history?</h1> <p>I want to read from the file where git stores commit history to store each commit information in my project's DB and display all histories in my project view.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,019
git
# In which file does git store commit history? I want to read from the file where git stores commit history to store each commit information in my project's DB and display all histories in my project view.
There's no single file you can interrogate to get the commit history. There are plenty of good explanations of git's object model (e.g. [git for computer scientists](http://eagain.net/articles/git-for-computer-scientists/), [Pro Git](http://progit.org/book/ch9-2.html), [the git community book](http://book.git-scm.com/1...
4367891
Add a new subversion remote into existing Git repository
9
2010-12-06 15:23:29
<p>I have a git repository fully tracking a remote SVN repo. Now I need to add a new branch that will be tracking a directory in a completely different SVN repo.</p> <p>Is that possible?</p>
7,398
211,659
2015-01-28 11:09:51
4,370,192
15
2010-12-06 19:34:15
229,753
2010-12-06 19:34:15
https://stackoverflow.com/q/4367891
https://stackoverflow.com/a/4370192
<p>It is. <code>git svn init</code> only edits the default svn remote, you'll have to edit the config file.</p> <p>Look in <code>.git/config</code>, copy and alter the existing svn-remote section, and run <code>git svn fetch</code>. For example:</p> <pre><code>[svn-remote "svn2"] url = http://bzzz.googlecode....
<p>It is. <code>git svn init</code> only edits the default svn remote, you'll have to edit the config file.</p> <p>Look in <code>.git/config</code>, copy and alter the existing svn-remote section, and run <code>git svn fetch</code>. For example:</p> <pre><code>[svn-remote "svn2"] url = http://bzzz.googlecode....
63, 119
git, svn
<h1>Add a new subversion remote into existing Git repository</h1> <p>I have a git repository fully tracking a remote SVN repo. Now I need to add a new branch that will be tracking a directory in a completely different SVN repo.</p> <p>Is that possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,020
git
# Add a new subversion remote into existing Git repository I have a git repository fully tracking a remote SVN repo. Now I need to add a new branch that will be tracking a directory in a completely different SVN repo. Is that possible?
It is. `git svn init` only edits the default svn remote, you'll have to edit the config file. Look in `.git/config`, copy and alter the existing svn-remote section, and run `git svn fetch`. For example: ``` [svn-remote "svn2"] url = http://bzzz.googlecode.com/svn fetch = trunk:refs/remotes/svn2/trunk ...
61055041
git cherry-pick built in option to keep original committer & author
8
2020-04-06 07:40:37
<p>Is there a built in option in git cherry-pick to keep the original Author &amp; Committer? without using a script , especially needed when cherry-picking multiple commits.</p> <p>i have found this <a href="https://gist.github.com/dusenberrymw/c2cd64acb35e467100d86b385c71ff60" rel="noreferrer">script</a> or <a href=...
14,997
2,982,109
2025-06-21 18:42:35
61,063,944
15
2020-04-06 16:01:56
1,256,452
2020-04-06 16:01:56
https://stackoverflow.com/q/61055041
https://stackoverflow.com/a/61063944
<p>Cherry-picking keeps the author by default anyway so there is nothing to do here.</p> <p>None of these commands let you keep the committer, but the committer name and email address come from your configuration, where you can lie if you wish, so:</p> <pre><code>git -c user.name=bogus -c user.email=lie@example.com c...
<p>Cherry-picking keeps the author by default anyway so there is nothing to do here.</p> <p>None of these commands let you keep the committer, but the committer name and email address come from your configuration, where you can lie if you wish, so:</p> <pre><code>git -c user.name=bogus -c user.email=lie@example.com c...
119, 78810
git, git-cherry-pick
<h1>git cherry-pick built in option to keep original committer & author</h1> <p>Is there a built in option in git cherry-pick to keep the original Author &amp; Committer? without using a script , especially needed when cherry-picking multiple commits.</p> <p>i have found this <a href="https://gist.github.com/dusenberr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,022
git
# git cherry-pick built in option to keep original committer & author Is there a built in option in git cherry-pick to keep the original Author & Committer? without using a script , especially needed when cherry-picking multiple commits. i have found this [script](https://gist.github.com/dusenberrymw/c2cd64acb35e4671...
Cherry-picking keeps the author by default anyway so there is nothing to do here. None of these commands let you keep the committer, but the committer name and email address come from your configuration, where you can lie if you wish, so: ``` git -c user.name=bogus -c user.email=lie@example.com cherry-pick <hash> ```...
57100070
Sanitizing output and formatting Jupyter notebooks files during git commits
8
2019-07-18 17:45:54
<p>I'm tying to write git hook that automatically sanitizes Jupyter Notebook outputes files using <a href="https://github.com/kynan/nbstripout" rel="noreferrer">nbstripout</a> (you can see it as a source file formater).</p> <p>That's needed because notebooks outputs can disclose confidential information that must not b...
2,867
779,570
2020-08-13 08:03:40
60,859,698
15
2020-03-26 01:16:39
8,705,432
2020-03-26 01:16:39
https://stackoverflow.com/q/57100070
https://stackoverflow.com/a/60859698
<p>What you're looking for is a smudge/clean filter. This is a way that you can have Git automatically convert files between the version that's checked in (the clean version) and the version in the working tree (the smudged version).</p> <p>In your case, you'd want to set your smudge filter to <code>cat</code> (becau...
<p>What you're looking for is a smudge/clean filter. This is a way that you can have Git automatically convert files between the version that's checked in (the clean version) and the version in the working tree (the smudged version).</p> <p>In your case, you'd want to set your smudge filter to <code>cat</code> (becau...
119, 8337, 43087, 116342
bitbucket, git, githooks, jupyter-notebook
<h1>Sanitizing output and formatting Jupyter notebooks files during git commits</h1> <p>I'm tying to write git hook that automatically sanitizes Jupyter Notebook outputes files using <a href="https://github.com/kynan/nbstripout" rel="noreferrer">nbstripout</a> (you can see it as a source file formater).</p> <p>That's n...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,023
git
# Sanitizing output and formatting Jupyter notebooks files during git commits I'm tying to write git hook that automatically sanitizes Jupyter Notebook outputes files using [nbstripout](https://github.com/kynan/nbstripout) (you can see it as a source file formater). That's needed because notebooks outputs can disclos...
What you're looking for is a smudge/clean filter. This is a way that you can have Git automatically convert files between the version that's checked in (the clean version) and the version in the working tree (the smudged version). In your case, you'd want to set your smudge filter to `cat` (because you don't want to m...
58291315
using "git submodule foreach" can you skip a list of submodules?
8
2019-10-08 17:30:31
<p>lets say I have 10 submoules:</p> <pre><code>module/1 module/2 module/3 module/4 module/5 module/6 module/7 module/8 module/9 module/10 </code></pre> <p>where <code>module/</code> is the top-level repo.</p> <p>I want to do <code>git submodule foreach 'git status'</code>, but I don't want to do it for submodules 4...
7,340
2,298,137
2023-09-11 12:24:38
58,292,036
15
2019-10-08 18:23:52
1,290,731
2022-03-28 16:02:44
https://stackoverflow.com/q/58291315
https://stackoverflow.com/a/58292036
<p>As the docs say, foreach executes shell commands,</p> <blockquote> <pre><code>foreach [--recursive] &lt;command&gt; Evaluates an arbitrary shell command in each checked out submodule. The command has access to the variables $name, $sm_path, $displaypath, $sha1 and $toplevel </code></pre> </blockquote> <...
<p>As the docs say, foreach executes shell commands,</p> <blockquote> <pre><code>foreach [--recursive] &lt;command&gt; Evaluates an arbitrary shell command in each checked out submodule. The command has access to the variables $name, $sm_path, $displaypath, $sha1 and $toplevel </code></pre> </blockquote> <...
58, 119, 631, 41612
foreach, git, git-submodules, linux
<h1>using "git submodule foreach" can you skip a list of submodules?</h1> <p>lets say I have 10 submoules:</p> <pre><code>module/1 module/2 module/3 module/4 module/5 module/6 module/7 module/8 module/9 module/10 </code></pre> <p>where <code>module/</code> is the top-level repo.</p> <p>I want to do <code>git submodu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,024
git
# using "git submodule foreach" can you skip a list of submodules? lets say I have 10 submoules: ``` module/1 module/2 module/3 module/4 module/5 module/6 module/7 module/8 module/9 module/10 ``` where `module/` is the top-level repo. I want to do `git submodule foreach 'git status'`, but I don't want to do it for ...
As the docs say, foreach executes shell commands, > ``` > foreach [--recursive] <command> > Evaluates an arbitrary shell command in each checked out submodule. The > command has access to the variables $name, $sm_path, $displaypath, $sha1 > and $toplevel > ``` so use the shell: ``` git submodule foreac...
54381620
Error when trying to run `flutter upgrade`
8
2019-01-26 18:48:50
<p>I am trying to both upgrade my Flutter SDK and also change my Flutter channel to <code>master</code>, but I encounter the following error:</p> <pre><code>git: error: Your local changes to the following files would be overwritten by checkout: git: examples/catalog/android/build.gradle git: examples/catalog/and...
12,308
10,358,967
2021-10-12 11:04:05
54,382,569
15
2019-01-26 20:44:54
6,509,751
2019-10-04 18:33:41
https://stackoverflow.com/q/54381620
https://stackoverflow.com/a/54382569
<p>This occurs because the files have been changed locally. This means that the version you have on your machine is different from the one on GitHub.</p> <p>The easiest way to fix this is using <code>--force</code>:</p> <pre><code>flutter upgrade --force </code></pre> <p>This will <em>override</em> any of the mismat...
<p>This occurs because the files have been changed locally. This means that the version you have on your machine is different from the one on GitHub.</p> <p>The easiest way to fix this is using <code>--force</code>:</p> <pre><code>flutter upgrade --force </code></pre> <p>This will <em>override</em> any of the mismat...
119, 115695
flutter, git
<h1>Error when trying to run `flutter upgrade`</h1> <p>I am trying to both upgrade my Flutter SDK and also change my Flutter channel to <code>master</code>, but I encounter the following error:</p> <pre><code>git: error: Your local changes to the following files would be overwritten by checkout: git: examples/catal...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,025
git
# Error when trying to run `flutter upgrade` I am trying to both upgrade my Flutter SDK and also change my Flutter channel to `master`, but I encounter the following error: ``` git: error: Your local changes to the following files would be overwritten by checkout: git: examples/catalog/android/build.gradle git: ...
This occurs because the files have been changed locally. This means that the version you have on your machine is different from the one on GitHub. The easiest way to fix this is using `--force`: ``` flutter upgrade --force ``` This will *override* any of the mismatched files. Make sure that you have no progress that...
53695232
git: Split existing repository into submodules
8
2018-12-09 18:10:05
<p>I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.</p> <p>It's a Java maven project. Currently, everything is in one maven project and one repository. My goal is to achieve something like this:</p> <p>The root repository should contain the main pom.xml,...
8,555
10,198,627
2020-04-11 07:53:45
53,695,584
15
2018-12-09 18:51:35
1,755,598
2020-04-11 07:53:45
https://stackoverflow.com/q/53695232
https://stackoverflow.com/a/53695584
<blockquote> <p>I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.</p> </blockquote> <p>Thats exactly what u need to do. Split the "main" into branches with <code>git subtree split &lt;path&gt; -b &lt;branch&gt;</code> and then add remote for each submodu...
<blockquote> <p>I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.</p> </blockquote> <p>Thats exactly what u need to do. Split the "main" into branches with <code>git subtree split &lt;path&gt; -b &lt;branch&gt;</code> and then add remote for each submodu...
17, 119, 41127, 41612
git, git-submodules, java, maven
<h1>git: Split existing repository into submodules</h1> <p>I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.</p> <p>It's a Java maven project. Currently, everything is in one maven project and one repository. My goal is to achieve something like this:</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,026
git
# git: Split existing repository into submodules I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules. It's a Java maven project. Currently, everything is in one maven project and one repository. My goal is to achieve something like this: The root repository...
> I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules. Thats exactly what u need to do. Split the "main" into branches with `git subtree split <path> -b <branch>` and then add remote for each submodule and push the branch to the remote. ``` # split the "main...
46630258
Git: Average and total lines changed in a date range
8
2017-10-08 10:51:58
<p>In git, for a given date range and a given user, I'd like to find out:</p> <p>1 - The total lines changed.</p> <p>2 - The average lines changed per day.</p> <p><strong>Note</strong>: This question is <strong>not</strong> a duplicate of <a href="https://stackoverflow.com/questions/1265040/how-to-count-total-lines-...
5,044
8,668,315
2017-10-08 17:57:33
46,630,914
15
2017-10-08 12:05:14
3,812,472
2017-10-08 12:05:14
https://stackoverflow.com/q/46630258
https://stackoverflow.com/a/46630914
<p>For instance</p> <p><code>git log --since=2017-01-01 --until=2017-06-01 --author="Jim" --format= --numstat | awk '{s+=$1; s+=$2} END {print s}' </code></p> <p>gives me the sum of <em>insertions</em> and <em>deletions</em> for that timespan and author. For the average, <a href="https://unix.stackexchange.com/questi...
<p>For instance</p> <p><code>git log --since=2017-01-01 --until=2017-06-01 --author="Jim" --format= --numstat | awk '{s+=$1; s+=$2} END {print s}' </code></p> <p>gives me the sum of <em>insertions</em> and <em>deletions</em> for that timespan and author. For the average, <a href="https://unix.stackexchange.com/questi...
119
git
<h1>Git: Average and total lines changed in a date range</h1> <p>In git, for a given date range and a given user, I'd like to find out:</p> <p>1 - The total lines changed.</p> <p>2 - The average lines changed per day.</p> <p><strong>Note</strong>: This question is <strong>not</strong> a duplicate of <a href="https:/...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,028
git
# Git: Average and total lines changed in a date range In git, for a given date range and a given user, I'd like to find out: 1 - The total lines changed. 2 - The average lines changed per day. **Note**: This question is **not** a duplicate of [How to count total lines changed by a specific author in a git reposito...
For instance `git log --since=2017-01-01 --until=2017-06-01 --author="Jim" --format= --numstat | awk '{s+=$1; s+=$2} END {print s}'` gives me the sum of *insertions* and *deletions* for that timespan and author. For the average, [this answer on unix.stackexchange](https://unix.stackexchange.com/questions/24626/quickl...
42945700
How to interactively checkout a file from one branch to another in Git
8
2017-03-22 07:53:59
<p>I have two branches in my repo from which I keep editing back and forth and merging changes of one into another. But before merging I like to check what changes are being merged and what is being replaced with what, but there are few files in demo and master which are inherently different from each other and they wi...
9,698
3,320,962
2017-03-22 08:08:19
42,945,956
15
2017-03-22 08:08:19
216,074
2017-03-22 08:08:19
https://stackoverflow.com/q/42945700
https://stackoverflow.com/a/42945956
<p>Most Git commands that interact with the working directory allow you to restrict the command to a certain path. This is often done at the end of the command, indicated by a separating <code>--</code>. Many commands also accept a path without that separator but it’s necessary sometimes in order to avoid disambiguity ...
<p>Most Git commands that interact with the working directory allow you to restrict the command to a certain path. This is often done at the end of the command, indicated by a separating <code>--</code>. Many commands also accept a path without that separator but it’s necessary sometimes in order to avoid disambiguity ...
119, 37230
git, git-checkout
<h1>How to interactively checkout a file from one branch to another in Git</h1> <p>I have two branches in my repo from which I keep editing back and forth and merging changes of one into another. But before merging I like to check what changes are being merged and what is being replaced with what, but there are few fil...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,029
git
# How to interactively checkout a file from one branch to another in Git I have two branches in my repo from which I keep editing back and forth and merging changes of one into another. But before merging I like to check what changes are being merged and what is being replaced with what, but there are few files in dem...
Most Git commands that interact with the working directory allow you to restrict the command to a certain path. This is often done at the end of the command, indicated by a separating `--`. Many commands also accept a path without that separator but it’s necessary sometimes in order to avoid disambiguity between paths ...
25770118
How to get the last person who modified a file in Git?
8
2014-09-10 16:05:37
<p>Can I find out who modified given file last?</p> <p>Can I also find out a list of changesets which affected a given file?</p>
13,700
100,516
2024-01-22 21:48:21
25,770,190
15
2014-09-10 16:09:00
2,112,633
2014-09-10 16:09:00
https://stackoverflow.com/q/25770118
https://stackoverflow.com/a/25770190
<p>This command should give you all the commits that changed this file with the diff. You can also see who made this commit.</p> <pre><code>git log -p &lt;filepath&gt; </code></pre>
<p>This command should give you all the commits that changed this file with the diff. You can also see who made this commit.</p> <pre><code>git log -p &lt;filepath&gt; </code></pre>
119
git
<h1>How to get the last person who modified a file in Git?</h1> <p>Can I find out who modified given file last?</p> <p>Can I also find out a list of changesets which affected a given file?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,032
git
# How to get the last person who modified a file in Git? Can I find out who modified given file last? Can I also find out a list of changesets which affected a given file?
This command should give you all the commits that changed this file with the diff. You can also see who made this commit. ``` git log -p <filepath> ```
25700179
How do I determine file encoding?
8
2014-09-06 12:20:29
<p>Is there a <code>git</code> command that returns file encoding like <code>file</code> in Linux? That completely describes my problem. I tried searching Google but found nothing.</p>
22,246
1,705,662
2022-04-26 15:58:00
25,700,274
15
2014-09-06 12:31:17
6,309
2022-04-26 15:58:00
https://stackoverflow.com/q/25700179
https://stackoverflow.com/a/25700274
<p>Git itself has no idea of the encoding of a file (stored as a blob, meaning as an arbitrary binary data).<br /> See &quot;<a href="http://web.archive.org/web/20201023205409/http://www.gitguys.com/topics/what-is-the-format-of-a-git-blob/" rel="noreferrer">What is the format of a git “blob”?</a>&quot;.</p> <p>The comm...
<p>Git itself has no idea of the encoding of a file (stored as a blob, meaning as an arbitrary binary data).<br /> See &quot;<a href="http://web.archive.org/web/20201023205409/http://www.gitguys.com/topics/what-is-the-format-of-a-git-blob/" rel="noreferrer">What is the format of a git “blob”?</a>&quot;.</p> <p>The comm...
119, 1124
encoding, git
<h1>How do I determine file encoding?</h1> <p>Is there a <code>git</code> command that returns file encoding like <code>file</code> in Linux? That completely describes my problem. I tried searching Google but found nothing.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,033
git
# How do I determine file encoding? Is there a `git` command that returns file encoding like `file` in Linux? That completely describes my problem. I tried searching Google but found nothing.
Git itself has no idea of the encoding of a file (stored as a blob, meaning as an arbitrary binary data). See "[What is the format of a git “blob”?](http://web.archive.org/web/20201023205409/http://www.gitguys.com/topics/what-is-the-format-of-a-git-blob/)". The command file can still be used after a `git checkout`. ...
22762084
How do I undo a heroku create that was run over existing app?
8
2014-03-31 12:54:37
<p>I have been using heroku for deploying my app for a while. I'm at the point where I want to create a new environment for staging. Hoping to solicit usage instructions, I ran <code>heroku create</code>. It turns out this is all that is needed to create an app:</p> <pre><code>Creating sleepy-chamber-3162... done, ...
4,387
1,484,957
2014-05-07 19:04:34
22,766,570
15
2014-03-31 16:06:19
1,484,957
2014-05-07 19:04:34
https://stackoverflow.com/q/22762084
https://stackoverflow.com/a/22766570
<p>It seems like <code>heroku create</code> creates the new app, but doesn't affect any of the app's files, git metadata, or even default remote paths.</p> <pre><code>heroku apps:destroy -a sleepy-chamber-3162 </code></pre> <p>seems to be sufficient to undo the create.</p>
<p>It seems like <code>heroku create</code> creates the new app, but doesn't affect any of the app's files, git metadata, or even default remote paths.</p> <pre><code>heroku apps:destroy -a sleepy-chamber-3162 </code></pre> <p>seems to be sufficient to undo the create.</p>
119, 8279
git, heroku
<h1>How do I undo a heroku create that was run over existing app?</h1> <p>I have been using heroku for deploying my app for a while. I'm at the point where I want to create a new environment for staging. Hoping to solicit usage instructions, I ran <code>heroku create</code>. It turns out this is all that is needed t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,034
git
# How do I undo a heroku create that was run over existing app? I have been using heroku for deploying my app for a while. I'm at the point where I want to create a new environment for staging. Hoping to solicit usage instructions, I ran `heroku create`. It turns out this is all that is needed to create an app: ``` C...
It seems like `heroku create` creates the new app, but doesn't affect any of the app's files, git metadata, or even default remote paths. ``` heroku apps:destroy -a sleepy-chamber-3162 ``` seems to be sufficient to undo the create.
15694034
Why is my .git file huge?
8
2013-03-28 23:37:20
<p>I accidentally added and committed some very large (100MB+) PSD files in a git directory. I made a bunch of edits to those files while they were in the directory, but then realized they shouldn't be there and removed them from the directory.</p> <p>I then ran:</p> <pre><code>git add --all &amp;&amp; git commit -m ...
11,346
165,673
2016-08-24 01:07:59
15,696,584
15
2013-03-29 02:49:01
1,965,396
2016-08-24 01:07:59
https://stackoverflow.com/q/15694034
https://stackoverflow.com/a/15696584
<p>Your .git folder is really big because the PSDs files are still present in the repository. To remove them, you need to modify the history using <code>git filter-branch</code>. <a href="https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html" rel="noreferrer">Here</a> explains how to use this command....
<p>Your .git folder is really big because the PSDs files are still present in the repository. To remove them, you need to modify the history using <code>git filter-branch</code>. <a href="https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html" rel="noreferrer">Here</a> explains how to use this command....
119, 91259
git, git-rewrite-history
<h1>Why is my .git file huge?</h1> <p>I accidentally added and committed some very large (100MB+) PSD files in a git directory. I made a bunch of edits to those files while they were in the directory, but then realized they shouldn't be there and removed them from the directory.</p> <p>I then ran:</p> <pre><code>git ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,035
git
# Why is my .git file huge? I accidentally added and committed some very large (100MB+) PSD files in a git directory. I made a bunch of edits to those files while they were in the directory, but then realized they shouldn't be there and removed them from the directory. I then ran: ``` git add --all && git commit -m ...
Your .git folder is really big because the PSDs files are still present in the repository. To remove them, you need to modify the history using `git filter-branch`. [Here](https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html) explains how to use this command. After, you will need to clean the reposit...
14875658
How to use git-svn clone to only get the HEAD revision from a Subversion repository?
8
2013-02-14 13:12:26
<p>How to use <code>git svn clone</code> to only get the HEAD revision from a Subversion repository?</p> <p>I been trying </p> <pre><code>git svn clone -s http://svn/java/&lt;projectname&gt; </code></pre> <p>but I been getting a lot of empty directory and I tried everything. So know I would like to do a clone of jus...
11,331
2,005,684
2015-07-08 06:37:57
14,877,570
15
2013-02-14 14:55:33
1,126,841
2013-02-14 14:55:33
https://stackoverflow.com/q/14875658
https://stackoverflow.com/a/14877570
<p>I think this is what you want:</p> <pre><code>git svn clone -s -r HEAD http://svn/java/&lt;projectname&gt; </code></pre> <p>You can also specify a range with <code>-r 2039:HEAD</code> if, for example, you want all the revisions from 2039 up to the latest. You might do this if it's really the history prior to 2039 ...
<p>I think this is what you want:</p> <pre><code>git svn clone -s -r HEAD http://svn/java/&lt;projectname&gt; </code></pre> <p>You can also specify a range with <code>-r 2039:HEAD</code> if, for example, you want all the revisions from 2039 up to the latest. You might do this if it's really the history prior to 2039 ...
119, 6452
git, git-svn
<h1>How to use git-svn clone to only get the HEAD revision from a Subversion repository?</h1> <p>How to use <code>git svn clone</code> to only get the HEAD revision from a Subversion repository?</p> <p>I been trying </p> <pre><code>git svn clone -s http://svn/java/&lt;projectname&gt; </code></pre> <p>but I been gett...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,036
git
# How to use git-svn clone to only get the HEAD revision from a Subversion repository? How to use `git svn clone` to only get the HEAD revision from a Subversion repository? I been trying ``` git svn clone -s http://svn/java/<projectname> ``` but I been getting a lot of empty directory and I tried everything. So kn...
I think this is what you want: ``` git svn clone -s -r HEAD http://svn/java/<projectname> ``` You can also specify a range with `-r 2039:HEAD` if, for example, you want all the revisions from 2039 up to the latest. You might do this if it's really the history prior to 2039 that you object to, rather than everything p...
3459744
Vim using non-standard configuration when called from `git commit`?
8
2010-08-11 15:01:18
<p>I've noticed that git seems to use different vim settings any time I'm writing a commit message. I have the <code>git+svn</code> install off Macports, and I've checked the <code>$MYVIMRC</code> variable: it's set to the correct file. Still, every time I go to commit a message I have a restriction on 80 characters pe...
2,918
68,589
2012-04-27 21:45:18
3,459,945
15
2010-08-11 15:19:39
119,963
2010-08-11 15:42:30
https://stackoverflow.com/q/3459744
https://stackoverflow.com/a/3459945
<p>That's not a bug, it's a feature!</p> <p>Vim knows about a lot of filetypes - including git commits (and interactive rebases, and config...). There are syntax definitions and ftplugins (filetype-activated plugins) for each of these. One of the settings in the commit ftplugin is <code>textwidth=72</code>. This is do...
<p>That's not a bug, it's a feature!</p> <p>Vim knows about a lot of filetypes - including git commits (and interactive rebases, and config...). There are syntax definitions and ftplugins (filetype-activated plugins) for each of these. One of the settings in the commit ftplugin is <code>textwidth=72</code>. This is do...
119, 370
git, vim
<h1>Vim using non-standard configuration when called from `git commit`?</h1> <p>I've noticed that git seems to use different vim settings any time I'm writing a commit message. I have the <code>git+svn</code> install off Macports, and I've checked the <code>$MYVIMRC</code> variable: it's set to the correct file. Still,...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,041
git
# Vim using non-standard configuration when called from `git commit`? I've noticed that git seems to use different vim settings any time I'm writing a commit message. I have the `git+svn` install off Macports, and I've checked the `$MYVIMRC` variable: it's set to the correct file. Still, every time I go to commit a me...
That's not a bug, it's a feature! Vim knows about a lot of filetypes - including git commits (and interactive rebases, and config...). There are syntax definitions and ftplugins (filetype-activated plugins) for each of these. One of the settings in the commit ftplugin is `textwidth=72`. This is done so that the output...
3191400
pushing to a git repository does not work
8
2010-07-07 01:54:03
<p>I am just starting out with GIT (i'm coming from cvs) and would like to set up something akin to cvs/svn with Git. I performed the following steps:</p> <pre><code>cd o:/repository git init cd &lt;working directory&gt; git clone o:/repository </code></pre> <p>i now created a file called file.txt with some content...
14,387
329,737
2021-09-15 16:19:48
3,191,584
15
2010-07-07 02:53:44
372,694
2010-07-07 11:39:00
https://stackoverflow.com/q/3191400
https://stackoverflow.com/a/3191584
<p>This happened to us a few weeks ago. It means that you have a working directory checked out in your origin repository and you cannot push to overwrite.</p> <p>at the origin you need to bare the repository. I don't know of a way to do it with one command. What I did (at the origin repository)</p> <pre><code>&gt;...
<p>This happened to us a few weeks ago. It means that you have a working directory checked out in your origin repository and you cannot push to overwrite.</p> <p>at the origin you need to bare the repository. I don't know of a way to do it with one command. What I did (at the origin repository)</p> <pre><code>&gt;...
81, 119, 456
git, version-control, versioning
<h1>pushing to a git repository does not work</h1> <p>I am just starting out with GIT (i'm coming from cvs) and would like to set up something akin to cvs/svn with Git. I performed the following steps:</p> <pre><code>cd o:/repository git init cd &lt;working directory&gt; git clone o:/repository </code></pre> <p>i n...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,042
git
# pushing to a git repository does not work I am just starting out with GIT (i'm coming from cvs) and would like to set up something akin to cvs/svn with Git. I performed the following steps: ``` cd o:/repository git init cd <working directory> git clone o:/repository ``` i now created a file called file.txt with s...
This happened to us a few weeks ago. It means that you have a working directory checked out in your origin repository and you cannot push to overwrite. at the origin you need to bare the repository. I don't know of a way to do it with one command. What I did (at the origin repository) ``` > mv repository repository.o...
2211689
Create Eclipse Project from Android Git
8
2010-02-06 02:02:23
<p>I've downloaded one of the open source Android Applications (the music application) from the Android git, and I'm trying to create a new project from the source. Creating a new project using that existing source doesn't work giving me an "invalid description error". Any help?</p>
14,406
118,241
2015-06-21 20:52:00
2,212,803
15
2010-02-06 10:30:08
6,309
2015-06-21 20:52:00
https://stackoverflow.com/q/2211689
https://stackoverflow.com/a/2212803
<p>You must be referring to the error message "<strong><code>invalid project description</code></strong>".</p> <p>See <a href="http://groups.google.com/group/android-beginners/browse_thread/thread/13cb9892c027d0e7" rel="nofollow noreferrer">this thread</a> (relevant extracts below, with emphasis mine):</p> <p>If you ...
<p>You must be referring to the error message "<strong><code>invalid project description</code></strong>".</p> <p>See <a href="http://groups.google.com/group/android-beginners/browse_thread/thread/13cb9892c027d0e7" rel="nofollow noreferrer">this thread</a> (relevant extracts below, with emphasis mine):</p> <p>If you ...
17, 53, 119, 1386
android, eclipse, git, java
<h1>Create Eclipse Project from Android Git</h1> <p>I've downloaded one of the open source Android Applications (the music application) from the Android git, and I'm trying to create a new project from the source. Creating a new project using that existing source doesn't work giving me an "invalid description error". A...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,043
git
# Create Eclipse Project from Android Git I've downloaded one of the open source Android Applications (the music application) from the Android git, and I'm trying to create a new project from the source. Creating a new project using that existing source doesn't work giving me an "invalid description error". Any help?
You must be referring to the error message "**`invalid project description`**". See [this thread](http://groups.google.com/group/android-beginners/browse_thread/thread/13cb9892c027d0e7) (relevant extracts below, with emphasis mine): If you see a .project in the application you downloaded, you can try a `"File" + "Imp...
65400300
Should .csproj files be added to .gitignore?
7
2020-12-21 21:42:13
<p>I'm wondering if adding <code>.csproj</code> files in the git history is really useful / best / bad practice</p> <p>(Currently, I'm using git for private repositories)</p> <p>Thanks!</p>
10,318
7,941,088
2020-12-21 22:13:10
65,400,320
15
2020-12-21 21:43:47
16,012
2020-12-21 22:01:33
https://stackoverflow.com/q/65400300
https://stackoverflow.com/a/65400320
<p><strong>Short answer:</strong> You definitely need <code>.csproj</code> files in your <code>git</code> history.</p> <p><strong>Long answer:</strong> Here's how to answer a question like that. Make a copy of your solution folder. Delete any files you wonder if they should be included in the <code>git</code> history....
<p><strong>Short answer:</strong> You definitely need <code>.csproj</code> files in your <code>git</code> history.</p> <p><strong>Long answer:</strong> Here's how to answer a question like that. Make a copy of your solution folder. Delete any files you wonder if they should be included in the <code>git</code> history....
9, 119, 33953
c#, git, visual-studio
<h1>Should .csproj files be added to .gitignore?</h1> <p>I'm wondering if adding <code>.csproj</code> files in the git history is really useful / best / bad practice</p> <p>(Currently, I'm using git for private repositories)</p> <p>Thanks!</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,045
git
# Should .csproj files be added to .gitignore? I'm wondering if adding `.csproj` files in the git history is really useful / best / bad practice (Currently, I'm using git for private repositories) Thanks!
**Short answer:** You definitely need `.csproj` files in your `git` history. **Long answer:** Here's how to answer a question like that. Make a copy of your solution folder. Delete any files you wonder if they should be included in the `git` history. Try to build and run your code. If you can't, that means they are ne...
59323893
Git: Find how many lines came from which author
7
2019-12-13 13:50:21
<p>For a particular file, it is possible to see which author last modified each line in a file (git blame etc). I want to do this at a project level, either by specifying author name or the total for all authors that contributed to the repo.</p> <p>I understand that git blame only shows who last edited a line, so if s...
3,998
3,551,365
2023-09-16 11:10:39
59,324,458
15
2019-12-13 14:23:36
6,330,106
2019-12-13 14:23:36
https://stackoverflow.com/q/59323893
https://stackoverflow.com/a/59324458
<p>List all the files of a revision:</p> <pre><code>git ls-tree -r $revision </code></pre> <p>Run <code>git blame</code> against the files one by one:</p> <pre><code>git blame --line-porcelain $file </code></pre> <p>Print only the authors:</p> <pre><code>grep '^author ' </code></pre> <p>Count the occurrence numbe...
<p>List all the files of a revision:</p> <pre><code>git ls-tree -r $revision </code></pre> <p>Run <code>git blame</code> against the files one by one:</p> <pre><code>git blame --line-porcelain $file </code></pre> <p>Print only the authors:</p> <pre><code>grep '^author ' </code></pre> <p>Count the occurrence numbe...
119
git
<h1>Git: Find how many lines came from which author</h1> <p>For a particular file, it is possible to see which author last modified each line in a file (git blame etc). I want to do this at a project level, either by specifying author name or the total for all authors that contributed to the repo.</p> <p>I understand ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,046
git
# Git: Find how many lines came from which author For a particular file, it is possible to see which author last modified each line in a file (git blame etc). I want to do this at a project level, either by specifying author name or the total for all authors that contributed to the repo. I understand that git blame o...
List all the files of a revision: ``` git ls-tree -r $revision ``` Run `git blame` against the files one by one: ``` git blame --line-porcelain $file ``` Print only the authors: ``` grep '^author ' ``` Count the occurrence number of each author, and print the name and the number: ``` awk '{a[$0]+=1} END{for(i in...
58704510
How to get whole git history afterwards "git clone --depth=1"?
7
2019-11-05 04:27:40
<p>One of my git repo was huge, containing huge assets to previous commits. </p> <p>Somehow I was able to clone repo(made runnable) using <code>git clone &lt;repo&gt; --depth=1</code>.</p> <p>I want to get all the previous commits on same local repo.</p> <p>Thank You.</p>
4,004
7,099,944
2019-11-05 06:49:48
58,704,543
15
2019-11-05 04:31:46
581,076
2019-11-05 06:49:48
https://stackoverflow.com/q/58704510
https://stackoverflow.com/a/58704543
<p><code>git pull --unshallow</code> should do it.</p> <p><em>From (<a href="https://git-scm.com/docs/git-pull" rel="noreferrer">git-scm</a>)</em></p> <blockquote> <p><code>--unshallow</code></p> <p>If the source repository is complete, convert a shallow repository to a >complete one, removing all the limitati...
<p><code>git pull --unshallow</code> should do it.</p> <p><em>From (<a href="https://git-scm.com/docs/git-pull" rel="noreferrer">git-scm</a>)</em></p> <blockquote> <p><code>--unshallow</code></p> <p>If the source repository is complete, convert a shallow repository to a >complete one, removing all the limitati...
119, 53850
git, git-commit
<h1>How to get whole git history afterwards "git clone --depth=1"?</h1> <p>One of my git repo was huge, containing huge assets to previous commits. </p> <p>Somehow I was able to clone repo(made runnable) using <code>git clone &lt;repo&gt; --depth=1</code>.</p> <p>I want to get all the previous commits on same local r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,047
git
# How to get whole git history afterwards "git clone --depth=1"? One of my git repo was huge, containing huge assets to previous commits. Somehow I was able to clone repo(made runnable) using `git clone <repo> --depth=1`. I want to get all the previous commits on same local repo. Thank You.
`git pull --unshallow` should do it. *From ([git-scm](https://git-scm.com/docs/git-pull))* > `--unshallow` > > If the source repository is complete, convert a shallow repository to a >complete one, removing all the limitations imposed by shallow repositories. > > If the source repository is shallow, fetch as much as ...
45233374
Merging 2 branches in one of the two or in a new branch
7
2017-07-21 08:57:34
<p>Lets say I am on a branch <code>test-a</code> and I create two new branches from <code>a</code> and do some individual commits to each one(to different files in each branch):</p> <pre><code>#in branch test-a $git checkout test-a #creating branch test-b and push a commit $git checkout -b test-b $git commit -a -m "i...
13,464
4,157,666
2017-07-21 09:09:56
45,233,475
15
2017-07-21 09:02:15
4,725,756
2017-07-21 09:09:56
https://stackoverflow.com/q/45233374
https://stackoverflow.com/a/45233475
<p>If you want the changes in a separate branch, then just fork out a new one from one of them, and the merge the another.</p> <pre><code>git checkout test-b git checkout -b test-b-c git merge test-c </code></pre> <p>Otherwise, if you don't mind updating the existing branches, the way you have merged would work too. ...
<p>If you want the changes in a separate branch, then just fork out a new one from one of them, and the merge the another.</p> <pre><code>git checkout test-b git checkout -b test-b-c git merge test-c </code></pre> <p>Otherwise, if you don't mind updating the existing branches, the way you have merged would work too. ...
119, 717
git, merge
<h1>Merging 2 branches in one of the two or in a new branch</h1> <p>Lets say I am on a branch <code>test-a</code> and I create two new branches from <code>a</code> and do some individual commits to each one(to different files in each branch):</p> <pre><code>#in branch test-a $git checkout test-a #creating branch test...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,051
git
# Merging 2 branches in one of the two or in a new branch Lets say I am on a branch `test-a` and I create two new branches from `a` and do some individual commits to each one(to different files in each branch): ``` #in branch test-a $git checkout test-a #creating branch test-b and push a commit $git checkout -b test...
If you want the changes in a separate branch, then just fork out a new one from one of them, and the merge the another. ``` git checkout test-b git checkout -b test-b-c git merge test-c ``` Otherwise, if you don't mind updating the existing branches, the way you have merged would work too. As an additional pointer, i...
36803814
git will not merge - says 'Already up-to-date.' when it's not
7
2016-04-22 21:47:30
<p>I have a git issue I've never encountered before. </p> <p>I have 2 branches that have 2 files that differ.<br> If I merge one into the other (in either direction) it says 'Already up-to-date.' </p> <p>Why does it think they are up to date, and how can I get it to merge? </p> <p>I read this post <a href="https://s...
12,659
1,293,193
2016-04-22 23:18:11
36,804,024
15
2016-04-22 22:05:25
1,256,452
2016-04-22 23:18:11
https://stackoverflow.com/q/36803814
https://stackoverflow.com/a/36804024
<h2>Large edit: you probably want rebase.</h2> <p>I'm putting the rebase section at the top, but you may want to read the rest first.</p> <h3>Rebasing</h3> <p>One of the most useful things in git is to cherry-pick an entire "branchlet" (a string of commits ending in a branch tip) to, in effect, <em>move</em> them. ...
<h2>Large edit: you probably want rebase.</h2> <p>I'm putting the rebase section at the top, but you may want to read the rest first.</p> <h3>Rebasing</h3> <p>One of the most useful things in git is to cherry-pick an entire "branchlet" (a string of commits ending in a branch tip) to, in effect, <em>move</em> them. ...
119
git
<h1>git will not merge - says 'Already up-to-date.' when it's not</h1> <p>I have a git issue I've never encountered before. </p> <p>I have 2 branches that have 2 files that differ.<br> If I merge one into the other (in either direction) it says 'Already up-to-date.' </p> <p>Why does it think they are up to date, and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,054
git
# git will not merge - says 'Already up-to-date.' when it's not I have a git issue I've never encountered before. I have 2 branches that have 2 files that differ. If I merge one into the other (in either direction) it says 'Already up-to-date.' Why does it think they are up to date, and how can I get it to merge? ...
## Large edit: you probably want rebase. I'm putting the rebase section at the top, but you may want to read the rest first. ### Rebasing One of the most useful things in git is to cherry-pick an entire "branchlet" (a string of commits ending in a branch tip) to, in effect, *move* them. That is, assuming you are now...
35853279
git gc - fatal: bad object refs/remotes/Icon
7
2016-03-07 20:23:06
<p>My <code>git gc</code> is giving me errors:</p> <pre><code>error: bad ref for Icon fatal: bad object refs/remotes/Icon error: failed to run repack </code></pre> <p>I know those <code>Icon</code> files are connected with OS X's auto-created files. I have added them to <code>.gitignore</code>. </p> <p>But they cou...
4,207
5,913,922
2023-06-06 10:22:52
35,853,891
15
2016-03-07 20:58:40
5,913,922
2016-03-07 20:58:40
https://stackoverflow.com/q/35853279
https://stackoverflow.com/a/35853891
<p>Solved it.</p> <p>Apparently OS X just created those files in <code>ref</code> folder and <code>git</code> was looking for them.</p> <p>So I have used a command to find and recursively delete all <code>Icon</code> files:</p> <pre><code>find . -name "Icon?" -print0 | xargs -0 rm -rf </code></pre> <p>Source: <a hr...
<p>Solved it.</p> <p>Apparently OS X just created those files in <code>ref</code> folder and <code>git</code> was looking for them.</p> <p>So I have used a command to find and recursively delete all <code>Icon</code> files:</p> <pre><code>find . -name "Icon?" -print0 | xargs -0 rm -rf </code></pre> <p>Source: <a hr...
119, 456, 1850, 115976
garbage-collection, git, sourcetree, version-control
<h1>git gc - fatal: bad object refs/remotes/Icon</h1> <p>My <code>git gc</code> is giving me errors:</p> <pre><code>error: bad ref for Icon fatal: bad object refs/remotes/Icon error: failed to run repack </code></pre> <p>I know those <code>Icon</code> files are connected with OS X's auto-created files. I have added ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,055
git
# git gc - fatal: bad object refs/remotes/Icon My `git gc` is giving me errors: ``` error: bad ref for Icon fatal: bad object refs/remotes/Icon error: failed to run repack ``` I know those `Icon` files are connected with OS X's auto-created files. I have added them to `.gitignore`. But they could have been committe...
Solved it. Apparently OS X just created those files in `ref` folder and `git` was looking for them. So I have used a command to find and recursively delete all `Icon` files: ``` find . -name "Icon?" -print0 | xargs -0 rm -rf ``` Source: [Recursively Remove Icon? in Mac OSX.sh](https://gist.github.com/codystebbins/5...
34766123
Signing commit with OpenPGP subkey fails
7
2016-01-13 11:58:04
<p>I would like to use one of my GPS (2) subkeys for signing commits/tags in Git I.e., my freshly created RSA4096 signing-only key with the long ID B0##...</p> <pre><code>sec# ed25519/9F############## 2016-01-07 [expires: 2023-01-05] Key fingerprint = FC08 HEX HEX HEX uid [ultimate] MY NAME &lt;MY....
3,994
2,659,959
2019-12-15 00:07:54
34,767,663
15
2016-01-13 13:12:52
695,343
2016-01-13 13:12:52
https://stackoverflow.com/q/34766123
https://stackoverflow.com/a/34767663
<p>Git uses <code>gpg</code> by default, which is GnuPG 1 on most systems and does not support elliptic curve cryptography. As your primary key is an elliptic curve key, GnuPG 1 cannot use the key at all. You will be able to observe the same when trying to use the key with GnuPG (<code>gpg --default-key key-id --sign</...
<p>Git uses <code>gpg</code> by default, which is GnuPG 1 on most systems and does not support elliptic curve cryptography. As your primary key is an elliptic curve key, GnuPG 1 cannot use the key at all. You will be able to observe the same when trying to use the key with GnuPG (<code>gpg --default-key key-id --sign</...
119, 6735
git, gnupg
<h1>Signing commit with OpenPGP subkey fails</h1> <p>I would like to use one of my GPS (2) subkeys for signing commits/tags in Git I.e., my freshly created RSA4096 signing-only key with the long ID B0##...</p> <pre><code>sec# ed25519/9F############## 2016-01-07 [expires: 2023-01-05] Key fingerprint = FC08 HEX HEX H...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,056
git
# Signing commit with OpenPGP subkey fails I would like to use one of my GPS (2) subkeys for signing commits/tags in Git I.e., my freshly created RSA4096 signing-only key with the long ID B0##... ``` sec# ed25519/9F############## 2016-01-07 [expires: 2023-01-05] Key fingerprint = FC08 HEX HEX HEX uid ...
Git uses `gpg` by default, which is GnuPG 1 on most systems and does not support elliptic curve cryptography. As your primary key is an elliptic curve key, GnuPG 1 cannot use the key at all. You will be able to observe the same when trying to use the key with GnuPG (`gpg --default-key key-id --sign`). Configure Git to...
30643119
Git checkout -- recover lost files
7
2015-06-04 11:51:48
<p>I accidentaly deleted local file changes on git repository. They were NOT commited or even pushed.</p> <p>What I did: <strong>git status</strong> (then files not staged for commit showed and I accidentaly removed whole folder called "smdr" by this comand): <strong>git checkout -- smdr</strong></p> <p>Then files c...
25,009
null
2023-09-22 07:53:23
30,643,818
15
2015-06-04 12:26:58
4,830,165
2015-06-04 12:26:58
https://stackoverflow.com/q/30643119
https://stackoverflow.com/a/30643818
<p>You can't with Git. The files were not committed so they are not in history. You just got the (inexistant) version in the index with <code>git checkout</code>.</p> <p>Your only hope is your backup system.</p>
<p>You can't with Git. The files were not committed so they are not in history. You just got the (inexistant) version in the index with <code>git checkout</code>.</p> <p>Your only hope is your backup system.</p>
119, 5766, 6923, 37230
git, git-checkout, local, undo
<h1>Git checkout -- recover lost files</h1> <p>I accidentaly deleted local file changes on git repository. They were NOT commited or even pushed.</p> <p>What I did: <strong>git status</strong> (then files not staged for commit showed and I accidentaly removed whole folder called "smdr" by this comand): <strong>git ch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,058
git
# Git checkout -- recover lost files I accidentaly deleted local file changes on git repository. They were NOT commited or even pushed. What I did: **git status** (then files not staged for commit showed and I accidentaly removed whole folder called "smdr" by this comand): **git checkout -- smdr** Then files changes...
You can't with Git. The files were not committed so they are not in history. You just got the (inexistant) version in the index with `git checkout`. Your only hope is your backup system.
29480316
Git status says up-to-date with remote even though it's not
7
2015-04-06 21:54:13
<p>We have a Git repository hosted on a shared network drive that multiple co-workers access. I'll call this the &quot;central repository&quot;. Employees clone this repository to their local machines, make changes, and then push changes back up.</p> <p>We've noticed that if someone pushes a change to the central repos...
3,947
172,350
2020-11-13 21:06:00
29,480,358
15
2015-04-06 21:56:55
2,462,524
2020-11-13 21:06:00
https://stackoverflow.com/q/29480316
https://stackoverflow.com/a/29480358
<p>You have to call <code>git fetch</code> to get updates from the remote repository to your local repository, but without changing your current branch position. After that, <code>git status</code> will show proper results.</p>
<p>You have to call <code>git fetch</code> to get updates from the remote repository to your local repository, but without changing your current branch position. After that, <code>git status</code> will show proper results.</p>
119, 54839
git, git-status
<h1>Git status says up-to-date with remote even though it's not</h1> <p>We have a Git repository hosted on a shared network drive that multiple co-workers access. I'll call this the &quot;central repository&quot;. Employees clone this repository to their local machines, make changes, and then push changes back up.</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,060
git
# Git status says up-to-date with remote even though it's not We have a Git repository hosted on a shared network drive that multiple co-workers access. I'll call this the "central repository". Employees clone this repository to their local machines, make changes, and then push changes back up. We've noticed that if ...
You have to call `git fetch` to get updates from the remote repository to your local repository, but without changing your current branch position. After that, `git status` will show proper results.
23334925
Sync local git repo with remote in one shot discarding local changes/commits
7
2014-04-28 07:24:14
<p>I'm a not a git expert so this might look like a silly question.</p> <p>I have local and remote repositories, I want to sync my local with the remote repository. I have many local changes, stashed changes, and few commits which are not yet pushed to remote.</p> <p>One way can be to remove all local changes(using <...
29,994
1,610,034
2024-02-26 10:07:18
23,336,229
15
2014-04-28 08:34:20
6,309
2014-04-28 08:34:20
https://stackoverflow.com/q/23334925
https://stackoverflow.com/a/23336229
<p>As commented, a <code>git reset --hard origin/master</code> would reset your <code>master</code> to upstream.</p> <p>But: your current master (with its local commit) would be "lost" (at least, no longer visible).</p> <p>So <em>one</em> step isn't the best approach.</p> <p>I would recommend something like:</p> <p...
<p>As commented, a <code>git reset --hard origin/master</code> would reset your <code>master</code> to upstream.</p> <p>But: your current master (with its local commit) would be "lost" (at least, no longer visible).</p> <p>So <em>one</em> step isn't the best approach.</p> <p>I would recommend something like:</p> <p...
119, 456
git, version-control
<h1>Sync local git repo with remote in one shot discarding local changes/commits</h1> <p>I'm a not a git expert so this might look like a silly question.</p> <p>I have local and remote repositories, I want to sync my local with the remote repository. I have many local changes, stashed changes, and few commits which ar...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,062
git
# Sync local git repo with remote in one shot discarding local changes/commits I'm a not a git expert so this might look like a silly question. I have local and remote repositories, I want to sync my local with the remote repository. I have many local changes, stashed changes, and few commits which are not yet pushed...
As commented, a `git reset --hard origin/master` would reset your `master` to upstream. But: your current master (with its local commit) would be "lost" (at least, no longer visible). So *one* step isn't the best approach. I would recommend something like: ``` git checkout master git fetch origin git branch tmp git...
7620072
Git, Mac OS X and accented characters
7
2011-10-01 11:57:28
<p>On MacOSX with Git, there is a problem with different UTF8 representations of filename encodings. (Similar problems also exists in SVN.)</p> <p>There is a patch for this <a href="http://lists-archives.org/git/719832-git-mac-os-x-and-german-special-characters.html" rel="nofollow">here</a>.</p> <p>I wonder if there ...
2,836
133,374
2013-09-20 07:19:51
15,553,693
15
2013-03-21 17:02:37
2,196,172
2013-07-06 22:59:52
https://stackoverflow.com/q/7620072
https://stackoverflow.com/a/15553693
<p>Enable <code>core.precomposeunicode</code> on the Mac</p> <pre><code>git config --global core.precomposeunicode true </code></pre> <p>Then reclone the repository. For this to work, you need to have at least Git 1.7.12, which is bundled with Xcode 4.6.</p> <p>That's it.</p>
<p>Enable <code>core.precomposeunicode</code> on the Mac</p> <pre><code>git config --global core.precomposeunicode true </code></pre> <p>Then reclone the repository. For this to work, you need to have at least Git 1.7.12, which is bundled with Xcode 4.6.</p> <p>That's it.</p>
119, 369, 8944
git, macos, utf-8
<h1>Git, Mac OS X and accented characters</h1> <p>On MacOSX with Git, there is a problem with different UTF8 representations of filename encodings. (Similar problems also exists in SVN.)</p> <p>There is a patch for this <a href="http://lists-archives.org/git/719832-git-mac-os-x-and-german-special-characters.html" rel=...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,063
git
# Git, Mac OS X and accented characters On MacOSX with Git, there is a problem with different UTF8 representations of filename encodings. (Similar problems also exists in SVN.) There is a patch for this [here](http://lists-archives.org/git/719832-git-mac-os-x-and-german-special-characters.html). I wonder if there is...
Enable `core.precomposeunicode` on the Mac ``` git config --global core.precomposeunicode true ``` Then reclone the repository. For this to work, you need to have at least Git 1.7.12, which is bundled with Xcode 4.6. That's it.
7927475
PHP: Format Latitude and Longitude with degrees, minuets and seconds
7
2011-10-28 09:31:27
<p>How can I convert this:</p> <pre><code>26.72773551940918 </code></pre> <p>Into something like this:</p> <pre><code>22°12'42"N </code></pre> <p>The trick here is that the coordinates are, actually Latitude and Longitude, I just need to format them correctly.</p>
20,848
895,511
2015-01-06 23:32:44
7,927,527
15
2011-10-28 09:36:40
571,353
2011-10-28 09:36:40
https://stackoverflow.com/q/7927475
https://stackoverflow.com/a/7927527
<p>You can find functions to do that <a href="http://www.web-max.ca/PHP/misc_6.php">here</a></p> <pre><code>&lt;?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec...
<p>You can find functions to do that <a href="http://www.web-max.ca/PHP/misc_6.php">here</a></p> <pre><code>&lt;?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec...
5, 20301, 24852
coordinates, latitude-longitude, php
<h1>PHP: Format Latitude and Longitude with degrees, minuets and seconds</h1> <p>How can I convert this:</p> <pre><code>26.72773551940918 </code></pre> <p>Into something like this:</p> <pre><code>22°12'42"N </code></pre> <p>The trick here is that the coordinates are, actually Latitude and Longitude, I just need to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,064
git
# PHP: Format Latitude and Longitude with degrees, minuets and seconds How can I convert this: ``` 26.72773551940918 ``` Into something like this: ``` 22°12'42"N ``` The trick here is that the coordinates are, actually Latitude and Longitude, I just need to format them correctly.
You can find functions to do that [here](http://www.web-max.ca/PHP/misc_6.php) ``` <?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec) { // Converts decimal lon...
7926586
Is it possible to make Git aware of SVN revisions?
7
2011-10-28 07:59:16
<p>When using git-svn, Git associates SVN revision with individual commits.</p> <p>Most of other team members quote SVN revisions when they want their code reviewed. Is it possible to some how make Git 'aware' of the SVN revisions and implicitly convert them to Git hashes? Or perhaps is there a way to expose the map...
844
68,862
2016-09-30 10:26:30
7,927,166
15
2011-10-28 09:01:48
850,181
2011-10-28 09:01:48
https://stackoverflow.com/q/7926586
https://stackoverflow.com/a/7927166
<p>The git-svn tool has a conversion option to find the git object if by a SVN revision, or the other way around. This option can be used as follows:</p> <pre><code>git svn find-rev rSVNID </code></pre> <p>Thus, your diff command could be:</p> <pre><code>git diff $(git svn find-rev r12000) e0a4f09 </code></pre> <p>...
<p>The git-svn tool has a conversion option to find the git object if by a SVN revision, or the other way around. This option can be used as follows:</p> <pre><code>git svn find-rev rSVNID </code></pre> <p>Thus, your diff command could be:</p> <pre><code>git diff $(git svn find-rev r12000) e0a4f09 </code></pre> <p>...
63, 119, 6452
git, git-svn, svn
<h1>Is it possible to make Git aware of SVN revisions?</h1> <p>When using git-svn, Git associates SVN revision with individual commits.</p> <p>Most of other team members quote SVN revisions when they want their code reviewed. Is it possible to some how make Git 'aware' of the SVN revisions and implicitly convert them...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,065
git
# Is it possible to make Git aware of SVN revisions? When using git-svn, Git associates SVN revision with individual commits. Most of other team members quote SVN revisions when they want their code reviewed. Is it possible to some how make Git 'aware' of the SVN revisions and implicitly convert them to Git hashes? O...
The git-svn tool has a conversion option to find the git object if by a SVN revision, or the other way around. This option can be used as follows: ``` git svn find-rev rSVNID ``` Thus, your diff command could be: ``` git diff $(git svn find-rev r12000) e0a4f09 ``` As opposed to the other answer, this should also wo...
7798142
error combining git repositories into subdirs
7
2011-10-17 18:49:16
<p>I have looked at several threads addressing this. </p> <p><a href="https://stackoverflow.com/questions/277029/combining-multiple-git-repositories">Combining multiple git repositories</a></p> <p><a href="https://stackoverflow.com/questions/3369591/combining-multiple-git-repositories-having-a-space-in-their-name">Co...
2,681
550,852
2011-10-18 03:18:17
7,802,021
15
2011-10-18 03:18:17
550,852
2011-10-18 03:18:17
https://stackoverflow.com/q/7798142
https://stackoverflow.com/a/7802021
<p>There were a couple problems.</p> <p><strong>1) git filter-branch --index filter was not using the '...' properly.</strong></p> <p>I am not sure why this is, a bug with git-filter, an environment problem? who knows. But I was able to fix it by moving everything out of the '...' and putting it into a script file. I...
<p>There were a couple problems.</p> <p><strong>1) git filter-branch --index filter was not using the '...' properly.</strong></p> <p>I am not sure why this is, a bug with git-filter, an environment problem? who knows. But I was able to fix it by moving everything out of the '...' and putting it into a script file. I...
119, 1318
git, history
<h1>error combining git repositories into subdirs</h1> <p>I have looked at several threads addressing this. </p> <p><a href="https://stackoverflow.com/questions/277029/combining-multiple-git-repositories">Combining multiple git repositories</a></p> <p><a href="https://stackoverflow.com/questions/3369591/combining-mul...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,066
git
# error combining git repositories into subdirs I have looked at several threads addressing this. [Combining multiple git repositories](https://stackoverflow.com/questions/277029/combining-multiple-git-repositories) [Combining multiple git repositories having a space in their name](https://stackoverflow.com/question...
There were a couple problems. **1) git filter-branch --index filter was not using the '...' properly.** I am not sure why this is, a bug with git-filter, an environment problem? who knows. But I was able to fix it by moving everything out of the '...' and putting it into a script file. I then called the script inside...
4313618
convert latitude and longitude to northing and easting in java?
7
2010-11-30 12:15:26
<p>how to convert latitude and longitude to northing and easting in Java?</p>
8,618
505,854
2022-01-26 18:51:34
4,313,695
15
2010-11-30 12:24:00
21,234
2011-07-19 17:29:12
https://stackoverflow.com/q/4313618
https://stackoverflow.com/a/4313695
<p>I'm assuming you mean UK OSGB easting and northings. The trigonometry behind this one is hilarious, but you can use the <a href="http://www.jstott.me.uk/jcoord/">JCoord</a> library for this, it makes it easy (if quite CPU intensive).</p> <hr> <p>To follow up on @DD's comments below, there is a gotcha with JCoord, ...
<p>I'm assuming you mean UK OSGB easting and northings. The trigonometry behind this one is hilarious, but you can use the <a href="http://www.jstott.me.uk/jcoord/">JCoord</a> library for this, it makes it easy (if quite CPU intensive).</p> <hr> <p>To follow up on @DD's comments below, there is a gotcha with JCoord, ...
17, 20301
java, latitude-longitude
<h1>convert latitude and longitude to northing and easting in java?</h1> <p>how to convert latitude and longitude to northing and easting in Java?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,068
git
# convert latitude and longitude to northing and easting in java? how to convert latitude and longitude to northing and easting in Java?
I'm assuming you mean UK OSGB easting and northings. The trigonometry behind this one is hilarious, but you can use the [JCoord](http://www.jstott.me.uk/jcoord/) library for this, it makes it easy (if quite CPU intensive). --- To follow up on @DD's comments below, there is a gotcha with JCoord, in that you have to ma...
3690049
Rewriting Git History: How do I remove a sign-off?
7
2010-09-11 06:21:19
<p>When rewriting a Git repository's history, how do you remove sign-offs (as created by <code>git commit -s</code> or <code>git commit --signoff</code>)?</p> <p><code>git filter-branch</code>'s <code>commit-filter</code> seems to only support the variables used by <code>git commit-tree</code>:</p> <pre><code>GIT_AUT...
7,316
58,781
2010-09-11 18:48:35
3,690,063
15
2010-09-11 06:28:36
69,755
2010-09-11 06:28:36
https://stackoverflow.com/q/3690049
https://stackoverflow.com/a/3690063
<p>Sign offs are just part of the message body. So, you'll want to use <code>git filter-branch --msg-filter</code> to run a command to find lines starting with <code>Signed-off-by:</code> and remove them.</p> <p>Something like</p> <pre><code>git filter-branch --msg-filter "sed /^Signed-off-by:/d" </code></pre> <p>sh...
<p>Sign offs are just part of the message body. So, you'll want to use <code>git filter-branch --msg-filter</code> to run a command to find lines starting with <code>Signed-off-by:</code> and remove them.</p> <p>Something like</p> <pre><code>git filter-branch --msg-filter "sed /^Signed-off-by:/d" </code></pre> <p>sh...
119
git
<h1>Rewriting Git History: How do I remove a sign-off?</h1> <p>When rewriting a Git repository's history, how do you remove sign-offs (as created by <code>git commit -s</code> or <code>git commit --signoff</code>)?</p> <p><code>git filter-branch</code>'s <code>commit-filter</code> seems to only support the variables u...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,069
git
# Rewriting Git History: How do I remove a sign-off? When rewriting a Git repository's history, how do you remove sign-offs (as created by `git commit -s` or `git commit --signoff`)? `git filter-branch`'s `commit-filter` seems to only support the variables used by `git commit-tree`: ``` GIT_AUTHOR_NAME GIT_AUTHOR_EM...
Sign offs are just part of the message body. So, you'll want to use `git filter-branch --msg-filter` to run a command to find lines starting with `Signed-off-by:` and remove them. Something like ``` git filter-branch --msg-filter "sed /^Signed-off-by:/d" ``` should do the trick.
51878517
npm scripts/package.json - run only if currently on git master branch
6
2018-08-16 13:42:00
<p>I'm trying to make a script that will only run if master is the currently checked out branch...</p> <p>I managed getting the branch name with:</p> <pre><code>git rev-parse --symbolic-full-name --abbrev-ref HEAD </code></pre> <p>but putting that in a script, checking its value and doing one thing or other based on...
5,006
2,701,612
2020-06-19 12:42:27
51,892,782
15
2018-08-17 09:52:25
1,611,459
2018-08-17 09:52:25
https://stackoverflow.com/q/51878517
https://stackoverflow.com/a/51892782
<p>The following will work successfully:</p> <p><strong>npm-script:</strong></p> <pre class="lang-js prettyprint-override"><code>"scripts": { "foo": "branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); if [[ $branch == \"master\" ]]; then echo \"yes\"; else echo \"no\"; fi;" }, </code></pre> <p><strong...
<p>The following will work successfully:</p> <p><strong>npm-script:</strong></p> <pre class="lang-js prettyprint-override"><code>"scripts": { "foo": "branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); if [[ $branch == \"master\" ]]; then echo \"yes\"; else echo \"no\"; fi;" }, </code></pre> <p><strong...
119, 61387, 122330
git, npm, npm-scripts
<h1>npm scripts/package.json - run only if currently on git master branch</h1> <p>I'm trying to make a script that will only run if master is the currently checked out branch...</p> <p>I managed getting the branch name with:</p> <pre><code>git rev-parse --symbolic-full-name --abbrev-ref HEAD </code></pre> <p>but put...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,071
git
# npm scripts/package.json - run only if currently on git master branch I'm trying to make a script that will only run if master is the currently checked out branch... I managed getting the branch name with: ``` git rev-parse --symbolic-full-name --abbrev-ref HEAD ``` but putting that in a script, checking its valu...
The following will work successfully: **npm-script:** ``` "scripts": { "foo": "branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); if [[ $branch == \"master\" ]]; then echo \"yes\"; else echo \"no\"; fi;" }, ``` **Explanation:** - The `git` command is wrapped in `$()` - which is known as [command subs...
40698651
How to split every commit by file?
6
2016-11-19 22:33:13
<p>I know how to manually split a commit using <code>git rebase -i</code>, but how can I automatically split every commit in a branch by file? </p> <p>For instance, commit <code>A</code> modified 3 files, f1, f2 and f3. After the split, there are 3 commits A-f1, A-f2 and A-f3.</p> <p>I want to do this to make a major...
2,063
3,439,945
2020-06-23 15:53:08
44,269,268
15
2017-05-30 18:19:31
380,229
2020-06-23 15:53:08
https://stackoverflow.com/q/40698651
https://stackoverflow.com/a/44269268
<h2>The Script</h2> <p>The following script splits <code>HEAD</code> by file:</p> <pre class="lang-shell prettyprint-override"><code>#!/usr/bin/env bash set -e SHA=$(git rev-parse --short HEAD) # Change to repo root directory cd $(git rev-parse --show-toplevel) git reset HEAD^ git diff-tree --no-commit-id --name-on...
<h2>The Script</h2> <p>The following script splits <code>HEAD</code> by file:</p> <pre class="lang-shell prettyprint-override"><code>#!/usr/bin/env bash set -e SHA=$(git rev-parse --short HEAD) # Change to repo root directory cd $(git rev-parse --show-toplevel) git reset HEAD^ git diff-tree --no-commit-id --name-on...
119, 29934, 91259
git, git-rebase, git-rewrite-history
<h1>How to split every commit by file?</h1> <p>I know how to manually split a commit using <code>git rebase -i</code>, but how can I automatically split every commit in a branch by file? </p> <p>For instance, commit <code>A</code> modified 3 files, f1, f2 and f3. After the split, there are 3 commits A-f1, A-f2 and A-f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,072
git
# How to split every commit by file? I know how to manually split a commit using `git rebase -i`, but how can I automatically split every commit in a branch by file? For instance, commit `A` modified 3 files, f1, f2 and f3. After the split, there are 3 commits A-f1, A-f2 and A-f3. I want to do this to make a major r...
## The Script The following script splits `HEAD` by file: ``` #!/usr/bin/env bash set -e SHA=$(git rev-parse --short HEAD) # Change to repo root directory cd $(git rev-parse --show-toplevel) git reset HEAD^ git diff-tree --no-commit-id --name-only -r $SHA | while read -r f; do git add "$f" GIT_EDITOR="echo '0...
35602681
Can git log pretty format preserve new lines in subject?
6
2016-02-24 12:48:50
<p>I'm using this command in a python script to generate an xml file that is later processed by our CI-system:</p> <pre><code>git log -1 --date=iso --pretty=format:"&lt;logentry revision=\"%h\" scm=\"git\"&gt;%n&lt;author&gt;%an&lt;/author&gt;%n&lt;date&gt;%ad&lt;/date&gt;%n&lt;msg&gt;%s&lt;/msg&gt;%n" </code></pre> ...
2,760
1,022,179
2016-02-24 13:04:47
35,603,023
15
2016-02-24 13:04:47
354,577
2016-02-24 13:04:47
https://stackoverflow.com/q/35602681
https://stackoverflow.com/a/35603023
<p>The <a href="http://git-scm.com/docs/git-log" rel="noreferrer">documentation for <code>git log</code></a> tells us that <code>%s</code> is for the <em>subject</em>, which is built from the <a href="http://git-scm.com/docs/git-commit" rel="noreferrer">commit message's <em>title</em></a> (emphasis mine):</p> <blockqu...
<p>The <a href="http://git-scm.com/docs/git-log" rel="noreferrer">documentation for <code>git log</code></a> tells us that <code>%s</code> is for the <em>subject</em>, which is built from the <a href="http://git-scm.com/docs/git-commit" rel="noreferrer">commit message's <em>title</em></a> (emphasis mine):</p> <blockqu...
16, 119
git, python
<h1>Can git log pretty format preserve new lines in subject?</h1> <p>I'm using this command in a python script to generate an xml file that is later processed by our CI-system:</p> <pre><code>git log -1 --date=iso --pretty=format:"&lt;logentry revision=\"%h\" scm=\"git\"&gt;%n&lt;author&gt;%an&lt;/author&gt;%n&lt;date...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,073
git
# Can git log pretty format preserve new lines in subject? I'm using this command in a python script to generate an xml file that is later processed by our CI-system: ``` git log -1 --date=iso --pretty=format:"<logentry revision=\"%h\" scm=\"git\">%n<author>%an</author>%n<date>%ad</date>%n<msg>%s</msg>%n" ``` It pro...
The [documentation for `git log`](http://git-scm.com/docs/git-log) tells us that `%s` is for the *subject*, which is built from the [commit message's *title*](http://git-scm.com/docs/git-commit) (emphasis mine): > Though not required, it’s a good idea to begin the commit message with a single short (less than 50 chara...
33367269
How to interactively add untracked file in Git?
6
2015-10-27 11:50:57
<p>I often use <code>git add -p</code> to commit files in pieces in Git, but that doesn't work for untracked files:</p> <pre><code>$ git add -p file No changes. </code></pre> <p>How can I add this file, but not stage all of it?</p> <p>I want to add only part of it and commit and leave the rest unstaged.</p>
1,467
2,424,184
2015-10-27 11:50:57
33,367,270
15
2015-10-27 11:50:57
2,424,184
2015-10-27 11:50:57
https://stackoverflow.com/q/33367269
https://stackoverflow.com/a/33367270
<p>You can do this in two steps:</p> <ol> <li><code>git add -N file</code></li> </ol> <p>From the <a href="http://linux.die.net/man/1/git-add" rel="noreferrer">man page</a>:</p> <blockquote> <p><code>-N, --intent-to-add</code> Record only the fact that the path will be added later. An entry for the path is p...
<p>You can do this in two steps:</p> <ol> <li><code>git add -N file</code></li> </ol> <p>From the <a href="http://linux.die.net/man/1/git-add" rel="noreferrer">man page</a>:</p> <blockquote> <p><code>-N, --intent-to-add</code> Record only the fact that the path will be added later. An entry for the path is p...
119, 456, 4063
git, interactive, version-control
<h1>How to interactively add untracked file in Git?</h1> <p>I often use <code>git add -p</code> to commit files in pieces in Git, but that doesn't work for untracked files:</p> <pre><code>$ git add -p file No changes. </code></pre> <p>How can I add this file, but not stage all of it?</p> <p>I want to add only part o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,075
git
# How to interactively add untracked file in Git? I often use `git add -p` to commit files in pieces in Git, but that doesn't work for untracked files: ``` $ git add -p file No changes. ``` How can I add this file, but not stage all of it? I want to add only part of it and commit and leave the rest unstaged.
You can do this in two steps: 1. `git add -N file` From the [man page](http://linux.die.net/man/1/git-add): > `-N, --intent-to-add` > Record only the fact that the path will be added later. An entry for the path is placed in the index with no content. This is useful > for, among other things, showing the unstaged co...
31562040
Git rebase -i does nothing
6
2015-07-22 11:39:18
<p>I'm having some trouble with <code>git rebase -i</code> not working as I expect from reading various pieces of online documentation and tutorials.</p> <p>I'm trying to squash my last four commits into one. Imagine a branch <code>dev</code> with remote <code>origin/dev</code> and commits</p> <pre><code>A -&gt; B -&...
3,588
1,617,331
2015-07-22 12:10:04
31,562,745
15
2015-07-22 12:10:04
1,617,331
2015-07-22 12:10:04
https://stackoverflow.com/q/31562040
https://stackoverflow.com/a/31562745
<p>Ok, I found the answer: it <em>was</em> my git config after all.</p> <p>After installing Github's Atom yesterday I'd followed instructions at <a href="http://blog.atom.io/2014/03/13/git-integration.html" rel="noreferrer">http://blog.atom.io/2014/03/13/git-integration.html</a>, namely:</p> <pre><code>git config --g...
<p>Ok, I found the answer: it <em>was</em> my git config after all.</p> <p>After installing Github's Atom yesterday I'd followed instructions at <a href="http://blog.atom.io/2014/03/13/git-integration.html" rel="noreferrer">http://blog.atom.io/2014/03/13/git-integration.html</a>, namely:</p> <pre><code>git config --g...
119, 8974, 42532
git, rebase, squash
<h1>Git rebase -i does nothing</h1> <p>I'm having some trouble with <code>git rebase -i</code> not working as I expect from reading various pieces of online documentation and tutorials.</p> <p>I'm trying to squash my last four commits into one. Imagine a branch <code>dev</code> with remote <code>origin/dev</code> and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,076
git
# Git rebase -i does nothing I'm having some trouble with `git rebase -i` not working as I expect from reading various pieces of online documentation and tutorials. I'm trying to squash my last four commits into one. Imagine a branch `dev` with remote `origin/dev` and commits ``` A -> B -> C -> D -> E │ ...
Ok, I found the answer: it *was* my git config after all. After installing Github's Atom yesterday I'd followed instructions at <http://blog.atom.io/2014/03/13/git-integration.html>, namely: ``` git config --global core.editor "atom --wait" ``` What was happening is that everytime I tried to rebase Atom opened then ...
28833983
Using meld as difftool for git but listing all files in one window
6
2015-03-03 14:13:13
<p>I want to use meld as my diff tool for git.</p> <p>If I configure my <code>.gitconfig</code> like this :</p> <pre><code>[difftool] prompt = false [diff] tool = meld </code></pre> <p>and run command : <code>$ git difftool</code><br> then git open a meld window for each file which have changes.</p> <p>But ...
11,533
1,456,391
2016-10-07 20:17:36
28,961,291
15
2015-03-10 10:28:47
1,456,391
2015-03-10 10:28:47
https://stackoverflow.com/q/28833983
https://stackoverflow.com/a/28961291
<p>I fixed my problem by removing meld and use a new version (3.12.3) of it:<br> <code>sudo apt-get remove meld</code></p> <p>Now my <code>.gitconfig</code> is like : </p> <pre><code>[difftool] prompt = false [diff] tool = meld guitool = meld [difftool "meld"] path = /home/me/App/meld/meld-3.12.3/b...
<p>I fixed my problem by removing meld and use a new version (3.12.3) of it:<br> <code>sudo apt-get remove meld</code></p> <p>Now my <code>.gitconfig</code> is like : </p> <pre><code>[difftool] prompt = false [diff] tool = meld guitool = meld [difftool "meld"] path = /home/me/App/meld/meld-3.12.3/b...
119, 13630, 32868, 33608, 105625
difftool, git, git-config, git-difftool, meld
<h1>Using meld as difftool for git but listing all files in one window</h1> <p>I want to use meld as my diff tool for git.</p> <p>If I configure my <code>.gitconfig</code> like this :</p> <pre><code>[difftool] prompt = false [diff] tool = meld </code></pre> <p>and run command : <code>$ git difftool</code><br...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,077
git
# Using meld as difftool for git but listing all files in one window I want to use meld as my diff tool for git. If I configure my `.gitconfig` like this : ``` [difftool] prompt = false [diff] tool = meld ``` and run command : `$ git difftool` then git open a meld window for each file which have changes. ...
I fixed my problem by removing meld and use a new version (3.12.3) of it: `sudo apt-get remove meld` Now my `.gitconfig` is like : ``` [difftool] prompt = false [diff] tool = meld guitool = meld [difftool "meld"] path = /home/me/App/meld/meld-3.12.3/bin/meld ``` And the result from the folowing c...
27317994
How do I ignore .DS_Store in my untracked files?
6
2014-12-05 14:23:13
<p>I am new to Git, and every time I work with it, I always get this annoying <code>.DS_Store</code> in my untracked files. I am assuming that is where my working directory is. </p> <p>I have tried searching the answer on Stack Overflow, but only found the answer on how to remove it from the repository, not from the l...
21,477
2,551,261
2014-12-05 15:48:11
27,318,173
15
2014-12-05 14:33:38
2,422,776
2014-12-05 14:33:38
https://stackoverflow.com/q/27317994
https://stackoverflow.com/a/27318173
<p>You could create a <code>.gitignore</code> file. This file tells git which file (changes) it should ignore, so they won't appear in <code>git status</code>, <code>git diff</code> etc. call.</p> <p><code>.gitignore</code> is a simple text file. Just create it in a text editor (or edit it if you already have one), an...
<p>You could create a <code>.gitignore</code> file. This file tells git which file (changes) it should ignore, so they won't appear in <code>git status</code>, <code>git diff</code> etc. call.</p> <p><code>.gitignore</code> is a simple text file. Just create it in a text editor (or edit it if you already have one), an...
119, 25056
git, gitignore
<h1>How do I ignore .DS_Store in my untracked files?</h1> <p>I am new to Git, and every time I work with it, I always get this annoying <code>.DS_Store</code> in my untracked files. I am assuming that is where my working directory is. </p> <p>I have tried searching the answer on Stack Overflow, but only found the answ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,078
git
# How do I ignore .DS_Store in my untracked files? I am new to Git, and every time I work with it, I always get this annoying `.DS_Store` in my untracked files. I am assuming that is where my working directory is. I have tried searching the answer on Stack Overflow, but only found the answer on how to remove it from ...
You could create a `.gitignore` file. This file tells git which file (changes) it should ignore, so they won't appear in `git status`, `git diff` etc. call. `.gitignore` is a simple text file. Just create it in a text editor (or edit it if you already have one), and add this line: ``` .DS_Store ``` Then, you should ...
15884297
How to push your local master branch to Heroku when you've already pushed a feature branch?
6
2013-04-08 16:29:49
<p>To try out a feature branch, I pushed it to Heroku's master (since that's the only branch it uses for your website), i.e. I did:</p> <pre><code>git push heroku feature-foo:master </code></pre> <p>Meanwhile, I made some commits to my local master branch. Now I want to push my local master back out to Heroku, but am...
2,171
848,235
2016-11-19 18:04:22
15,884,879
15
2013-04-08 17:03:48
848,235
2013-04-08 17:03:48
https://stackoverflow.com/q/15884297
https://stackoverflow.com/a/15884879
<p>The answer turns out to be simple. Do a forced push, i.e.</p> <pre><code>git push -f heroku master </code></pre>
<p>The answer turns out to be simple. Do a forced push, i.e.</p> <pre><code>git push -f heroku master </code></pre>
119, 8279
git, heroku
<h1>How to push your local master branch to Heroku when you've already pushed a feature branch?</h1> <p>To try out a feature branch, I pushed it to Heroku's master (since that's the only branch it uses for your website), i.e. I did:</p> <pre><code>git push heroku feature-foo:master </code></pre> <p>Meanwhile, I made ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,080
git
# How to push your local master branch to Heroku when you've already pushed a feature branch? To try out a feature branch, I pushed it to Heroku's master (since that's the only branch it uses for your website), i.e. I did: ``` git push heroku feature-foo:master ``` Meanwhile, I made some commits to my local master b...
The answer turns out to be simple. Do a forced push, i.e. ``` git push -f heroku master ```
9785829
Git rebase -i not in terminal / only works with sudo
6
2012-03-20 11:24:12
<p>I simply want to edit some commits with <code>git rebase -i HEAD~2</code> inside the current branch. I use Ubuntu 10.10 and had to install gvim first to make the command work. Afterwards, the command opens a gvim window with the normal rebase content. But when I want to save the file gvim says </p> <blockquote> <...
4,038
905,686
2016-01-15 06:28:45
11,031,154
15
2012-06-14 10:24:14
905,686
2013-09-20 15:19:37
https://stackoverflow.com/q/9785829
https://stackoverflow.com/a/11031154
<p>My solution was:</p> <p>Run</p> <pre><code>$ git config --global core.editor "gvim -f" </code></pre> <p>First, I thought it was because my repository was on an ntfs drive so the file permissions wouldn´t work correctly. But even after mounting the drive with correct file permissions the problem stayed the same. S...
<p>My solution was:</p> <p>Run</p> <pre><code>$ git config --global core.editor "gvim -f" </code></pre> <p>First, I thought it was because my repository was on an ntfs drive so the file permissions wouldn´t work correctly. But even after mounting the drive with correct file permissions the problem stayed the same. S...
119, 370, 549, 29934
git, git-rebase, ubuntu, vim
<h1>Git rebase -i not in terminal / only works with sudo</h1> <p>I simply want to edit some commits with <code>git rebase -i HEAD~2</code> inside the current branch. I use Ubuntu 10.10 and had to install gvim first to make the command work. Afterwards, the command opens a gvim window with the normal rebase content. But...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,083
git
# Git rebase -i not in terminal / only works with sudo I simply want to edit some commits with `git rebase -i HEAD~2` inside the current branch. I use Ubuntu 10.10 and had to install gvim first to make the command work. Afterwards, the command opens a gvim window with the normal rebase content. But when I want to save...
My solution was: Run ``` $ git config --global core.editor "gvim -f" ``` First, I thought it was because my repository was on an ntfs drive so the file permissions wouldn´t work correctly. But even after mounting the drive with correct file permissions the problem stayed the same. Starting *vim* with the `-f` option...
10605068
How do I stop pushing to multiple remote branches in git? (aka, How do I untrack remote git branches?)
6
2012-05-15 16:30:11
<p>Tried to use what's <a href="https://stackoverflow.com/q/3046436/1028230">here</a>, but that doesn't solve things for me.</p> <p>I've got a local repo in git, cloned from a remote repo, <code>development</code>. I branch locally to play around with a new feature in a branch called <code>newBranchName</code> and ca...
3,761
1,028,230
2012-05-15 20:38:52
10,605,373
15
2012-05-15 16:50:30
761,202
2012-05-15 20:38:52
https://stackoverflow.com/q/10605068
https://stackoverflow.com/a/10605373
<p><strong>Only push the branch you're on</strong></p> <p>By default, git will push all of your tracking branches whenever you issue a git push with no arguments. to make it <em>only</em> push the branch you're on</p> <pre><code>git config push.default upstream # git 1.7.10 git config push.default tracking # older ve...
<p><strong>Only push the branch you're on</strong></p> <p>By default, git will push all of your tracking branches whenever you issue a git push with no arguments. to make it <em>only</em> push the branch you're on</p> <pre><code>git config push.default upstream # git 1.7.10 git config push.default tracking # older ve...
119, 31678, 76220
git, git-branch, remote-branch
<h1>How do I stop pushing to multiple remote branches in git? (aka, How do I untrack remote git branches?)</h1> <p>Tried to use what's <a href="https://stackoverflow.com/q/3046436/1028230">here</a>, but that doesn't solve things for me.</p> <p>I've got a local repo in git, cloned from a remote repo, <code>development<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,084
git
# How do I stop pushing to multiple remote branches in git? (aka, How do I untrack remote git branches?) Tried to use what's [here](https://stackoverflow.com/q/3046436/1028230), but that doesn't solve things for me. I've got a local repo in git, cloned from a remote repo, `development`. I branch locally to play aroun...
**Only push the branch you're on** By default, git will push all of your tracking branches whenever you issue a git push with no arguments. to make it *only* push the branch you're on ``` git config push.default upstream # git 1.7.10 git config push.default tracking # older vesions use "tracking" instead of "upstream...
43541167
How do you undo "Discard all changes" in VS Code/Git
112
2017-04-21 11:07:37
<p>I fear I already know the answer but here goes anyway.. I accidentally clicked &quot;Discard All Changes&quot; in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. Is there any way I can get my work back? Right now my working d...
211,534
1,026,622
2024-02-05 06:22:47
43,560,079
14
2017-04-22 13:55:20
6,936,103
2018-10-11 10:47:26
https://stackoverflow.com/q/43541167
https://stackoverflow.com/a/43560079
<p>Summary: Your work is lost, and cannot be restored.</p> <p>The <strong>Clean All</strong> (discard all changes) option in VS code essentially executes: </p> <pre><code>git clean -fd git checkout -- . </code></pre> <p>So it is git's hands whether <code>git clean -fd</code> can undo discarding uncommitted changes. ...
<p>Summary: Your work is lost, and cannot be restored.</p> <p>The <strong>Clean All</strong> (discard all changes) option in VS code essentially executes: </p> <pre><code>git clean -fd git checkout -- . </code></pre> <p>So it is git's hands whether <code>git clean -fd</code> can undo discarding uncommitted changes. ...
119, 456, 111608
git, version-control, visual-studio-code
<h1>How do you undo "Discard all changes" in VS Code/Git</h1> <p>I fear I already know the answer but here goes anyway.. I accidentally clicked &quot;Discard All Changes&quot; in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,087
git
# How do you undo "Discard all changes" in VS Code/Git I fear I already know the answer but here goes anyway.. I accidentally clicked "Discard All Changes" in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. Is there any way I c...
Summary: Your work is lost, and cannot be restored. The **Clean All** (discard all changes) option in VS code essentially executes: ``` git clean -fd git checkout -- . ``` So it is git's hands whether `git clean -fd` can undo discarding uncommitted changes. Unfortunately the changes are not stored in git since it no...
5587626
Git merging within a line
53
2011-04-07 21:02:44
<p><strong>Preamble</strong></p> <p>I'm using git as a version control system for a paper that my lab is writing, in LaTeX. There are several people collaborating.</p> <p>I'm running into git being stubborn about how it merges. Let's say two people have made single-word changes to a line, and then attempt to merge th...
6,151
677,748
2011-10-17 23:42:14
7,781,031
14
2011-10-15 22:19:22
697,611
2011-10-17 23:42:14
https://stackoverflow.com/q/5587626
https://stackoverflow.com/a/7781031
<p>Here's a solution in the same vein as sehe's, with a few changes which hopefully will address your comments:</p> <ul> <li>This solution considers merging by <em>sentence</em> rather than by word, as you had been doing by hand, only now, the user will see a single line per paragraph, but git will see paragraphs brok...
<p>Here's a solution in the same vein as sehe's, with a few changes which hopefully will address your comments:</p> <ul> <li>This solution considers merging by <em>sentence</em> rather than by word, as you had been doing by hand, only now, the user will see a single line per paragraph, but git will see paragraphs brok...
119, 456, 1704
git, latex, version-control
<h1>Git merging within a line</h1> <p><strong>Preamble</strong></p> <p>I'm using git as a version control system for a paper that my lab is writing, in LaTeX. There are several people collaborating.</p> <p>I'm running into git being stubborn about how it merges. Let's say two people have made single-word changes to a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,091
git
# Git merging within a line **Preamble** I'm using git as a version control system for a paper that my lab is writing, in LaTeX. There are several people collaborating. I'm running into git being stubborn about how it merges. Let's say two people have made single-word changes to a line, and then attempt to merge the...
Here's a solution in the same vein as sehe's, with a few changes which hopefully will address your comments: - This solution considers merging by *sentence* rather than by word, as you had been doing by hand, only now, the user will see a single line per paragraph, but git will see paragraphs broken into sentences. Th...
2874318
Quantifying the amount of change in a git diff?
53
2010-05-20 13:50:00
<p>I use git for a slightly unusual purpose--it stores my text as I write fiction. (I know, I know...geeky.)</p> <p>I am trying to keep track of productivity, and want to measure the degree of difference between subsequent commits. The writer's proxy for "work" is "words written", at least during the creation stage. I...
10,292
93,200
2024-09-17 15:51:37
2,874,426
14
2010-05-20 14:02:31
111,777
2024-09-17 15:47:42
https://stackoverflow.com/q/2874318
https://stackoverflow.com/a/2874426
<p><a href="http://www.gnu.org/software/wdiff/" rel="nofollow noreferrer">wdiff</a> does word-by-word comparison. Git can be configured to use an external program to do the diffing. Based on those two facts and <a href="http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy" rel="nofollow noreferrer">this blog...
<p><a href="http://www.gnu.org/software/wdiff/" rel="nofollow noreferrer">wdiff</a> does word-by-word comparison. Git can be configured to use an external program to do the diffing. Based on those two facts and <a href="http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy" rel="nofollow noreferrer">this blog...
119, 38429
git, word-count
<h1>Quantifying the amount of change in a git diff?</h1> <p>I use git for a slightly unusual purpose--it stores my text as I write fiction. (I know, I know...geeky.)</p> <p>I am trying to keep track of productivity, and want to measure the degree of difference between subsequent commits. The writer's proxy for "work" ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,092
git
# Quantifying the amount of change in a git diff? I use git for a slightly unusual purpose--it stores my text as I write fiction. (I know, I know...geeky.) I am trying to keep track of productivity, and want to measure the degree of difference between subsequent commits. The writer's proxy for "work" is "words writte...
[wdiff](http://www.gnu.org/software/wdiff/) does word-by-word comparison. Git can be configured to use an external program to do the diffing. Based on those two facts and [this blog post](http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy), the following should do roughly what you want. Create a script to...
6445148
git fatal:No tags can describe <sha1 number>
45
2011-06-22 19:05:49
<p>I am using tags by applying them to nightly builds. Then later, I want to use the output of <code>describe --tags --match &lt;latest tag&gt;</code> to tell me how far from the nightly build my images are. This is for QA testing.</p> <p>I just ran into an error in a clone that is older than the current tag. I ran...
48,166
561,638
2024-03-06 05:21:56
6,445,255
14
2011-06-22 19:15:31
11,343
2014-11-27 08:52:23
https://stackoverflow.com/q/6445148
https://stackoverflow.com/a/6445255
<p>It happens because you only fetch the tag, not the commit history of the tag. <code>git describe</code> uses this history, which is why it has an error.</p> <p>The only workaround is to fetch repo's history containing the tag you're interested in, using <code>git fetch &lt;remote-name&gt;</code>.</p>
<p>It happens because you only fetch the tag, not the commit history of the tag. <code>git describe</code> uses this history, which is why it has an error.</p> <p>The only workaround is to fetch repo's history containing the tag you're interested in, using <code>git fetch &lt;remote-name&gt;</code>.</p>
115, 119, 5597
commit, git, tags
<h1>git fatal:No tags can describe <sha1 number></h1> <p>I am using tags by applying them to nightly builds. Then later, I want to use the output of <code>describe --tags --match &lt;latest tag&gt;</code> to tell me how far from the nightly build my images are. This is for QA testing.</p> <p>I just ran into an error...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,094
git
# git fatal:No tags can describe I am using tags by applying them to nightly builds. Then later, I want to use the output of `describe --tags --match <latest tag>` to tell me how far from the nightly build my images are. This is for QA testing. I just ran into an error in a clone that is older than the current tag. I...
It happens because you only fetch the tag, not the commit history of the tag. `git describe` uses this history, which is why it has an error. The only workaround is to fetch repo's history containing the tag you're interested in, using `git fetch <remote-name>`.
878554
Why do I sometimes see an "Entry 'filename' not uptodate. Cannot merge." after a 'git reset --hard' and a 'git pull'?
44
2009-05-18 16:24:31
<p>Occasionally, when I do the following...</p> <pre><code>git reset --hard HEAD is now at 0123abde comment is here</code></pre> <pre><code>git pull Updating 0123abde..456789fa</code></pre> <p>I get the error...</p> <pre><code>error: Entry 'filename' not uptodate. Cannot merge.</code></pre> <p>The only workaround ...
48,017
108,881
2025-04-10 07:37:45
878,742
14
2009-05-18 17:04:31
6,309
2021-02-07 00:14:49
https://stackoverflow.com/q/878554
https://stackoverflow.com/a/878742
<p>The general idea behind &quot;<a href="http://git.or.cz/gitwiki/GitFaq#head-a188936efde5885e0ff8540c5be897e8029047f7" rel="nofollow noreferrer"><code>Entry 'filename' not uptodate. Cannot merge.</code></a>&quot; is:</p> <blockquote> <p>You have changes to files in your working directory that will be overwritten, rem...
<p>The general idea behind &quot;<a href="http://git.or.cz/gitwiki/GitFaq#head-a188936efde5885e0ff8540c5be897e8029047f7" rel="nofollow noreferrer"><code>Entry 'filename' not uptodate. Cannot merge.</code></a>&quot; is:</p> <blockquote> <p>You have changes to files in your working directory that will be overwritten, rem...
119, 717, 4860, 12626
git, merge, pull, reset
<h1>Why do I sometimes see an "Entry 'filename' not uptodate. Cannot merge." after a 'git reset --hard' and a 'git pull'?</h1> <p>Occasionally, when I do the following...</p> <pre><code>git reset --hard HEAD is now at 0123abde comment is here</code></pre> <pre><code>git pull Updating 0123abde..456789fa</code></pre> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,095
git
# Why do I sometimes see an "Entry 'filename' not uptodate. Cannot merge." after a 'git reset --hard' and a 'git pull'? Occasionally, when I do the following... ``` git reset --hard HEAD is now at 0123abde comment is here ``` ``` git pull Updating 0123abde..456789fa ``` I get the error... ``` error: Entry 'filenam...
The general idea behind "[`Entry 'filename' not uptodate. Cannot merge.`](http://git.or.cz/gitwiki/GitFaq#head-a188936efde5885e0ff8540c5be897e8029047f7)" is: > You have changes to files in your working directory that will be overwritten, removed or otherwise lost if the checkout and change to the new branch were to pr...
58541260
Difference between git-lfs and dvc
40
2019-10-24 12:19:46
<p>What is the difference between these two? We used git-lfs in my previous job and we are starting to use dvc alongside git in my current one. They both place some kind of index instead of file and can be downloaded on demand. Has dvc some improvements over the former one?</p>
14,456
2,576,311
2023-01-30 07:52:49
58,542,946
14
2019-10-24 13:54:37
10,614,328
2019-10-24 13:54:37
https://stackoverflow.com/q/58541260
https://stackoverflow.com/a/58542946
<p>DVC is a better replacement for <code>git-lfs</code>. </p> <p>Unlike git-lfs, DVC doesn't require installing a dedicated server; It can be used on-premises (NAS, SSH, for example) or with any major cloud provider (S3, Google Cloud, Azure).</p> <p>For more information: <a href="https://dvc.org/doc/use-cases/data-an...
<p>DVC is a better replacement for <code>git-lfs</code>. </p> <p>Unlike git-lfs, DVC doesn't require installing a dedicated server; It can be used on-premises (NAS, SSH, for example) or with any major cloud provider (S3, Google Cloud, Azure).</p> <p>For more information: <a href="https://dvc.org/doc/use-cases/data-an...
119, 115244, 135199
dvc, git, git-lfs
<h1>Difference between git-lfs and dvc</h1> <p>What is the difference between these two? We used git-lfs in my previous job and we are starting to use dvc alongside git in my current one. They both place some kind of index instead of file and can be downloaded on demand. Has dvc some improvements over the former one?</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,096
git
# Difference between git-lfs and dvc What is the difference between these two? We used git-lfs in my previous job and we are starting to use dvc alongside git in my current one. They both place some kind of index instead of file and can be downloaded on demand. Has dvc some improvements over the former one?
DVC is a better replacement for `git-lfs`. Unlike git-lfs, DVC doesn't require installing a dedicated server; It can be used on-premises (NAS, SSH, for example) or with any major cloud provider (S3, Google Cloud, Azure). For more information: <https://dvc.org/doc/use-cases/data-and-model-files-versioning>
29198289
With git rebase, is there a way to reword commit messages in the git-rebase-todo using the default commands?
40
2015-03-22 18:39:46
<p>Suppose I run <code>git rebase -i HEAD~3</code></p> <pre><code>pick 6b24464 foo pick a681432 Foo pick 8ccba08 foo foo # Rebase 960c384..8ccba08 onto 960c384 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use...
15,968
4,249,424
2022-02-04 14:22:55
29,198,390
14
2015-03-22 18:47:54
1,290,438
2022-02-04 14:22:55
https://stackoverflow.com/q/29198289
https://stackoverflow.com/a/29198390
<p>I do not believe that can be done, because when you do a <code>git rebase -i</code> you get only the first line of each commit message, not the full commit message.</p> <p>As a convention, a commit message should have the first line be only a summary, and have more details about the change in the following lines. <a...
<p>I do not believe that can be done, because when you do a <code>git rebase -i</code> you get only the first line of each commit message, not the full commit message.</p> <p>As a convention, a commit message should have the first line be only a summary, and have more details about the change in the following lines. <a...
119, 29934
git, git-rebase
<h1>With git rebase, is there a way to reword commit messages in the git-rebase-todo using the default commands?</h1> <p>Suppose I run <code>git rebase -i HEAD~3</code></p> <pre><code>pick 6b24464 foo pick a681432 Foo pick 8ccba08 foo foo # Rebase 960c384..8ccba08 onto 960c384 # # Commands: # p, pick = use commit # ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,097
git
# With git rebase, is there a way to reword commit messages in the git-rebase-todo using the default commands? Suppose I run `git rebase -i HEAD~3` ``` pick 6b24464 foo pick a681432 Foo pick 8ccba08 foo foo # Rebase 960c384..8ccba08 onto 960c384 # # Commands: # p, pick = use commit # r, reword = use commit, but ed...
I do not believe that can be done, because when you do a `git rebase -i` you get only the first line of each commit message, not the full commit message. As a convention, a commit message should have the first line be only a summary, and have more details about the change in the following lines. [Here's Linus Torvalds...
41803083
How to perform a three-way diff in Git without merging?
36
2017-01-23 09:37:19
<p>I want to perform a three-way diff between two git branches with a common merge base, and view it with kdiff3.</p> <p>I've found lots of guidance on SO (and a few very similar questions (<a href="https://stackoverflow.com/q/26301307/3380131">1</a>, <a href="https://stackoverflow.com/q/3635788/3380131">2</a>, <a hre...
15,278
3,380,131
2019-07-06 19:49:55
41,886,622
14
2017-01-27 03:37:33
1,290,731
2017-01-27 03:37:33
https://stackoverflow.com/q/41803083
https://stackoverflow.com/a/41886622
<blockquote> <p>I want to be able to perform this diff <em>before</em> merging, including on files without merge conflicts.</p> </blockquote> <p>You just have to set up the index as you like, you never have to commit results. The way to set up for exactly what was asked, straight diffs-since-base with no merge prep...
<blockquote> <p>I want to be able to perform this diff <em>before</em> merging, including on files without merge conflicts.</p> </blockquote> <p>You just have to set up the index as you like, you never have to commit results. The way to set up for exactly what was asked, straight diffs-since-base with no merge prep...
119, 456, 606, 717
diff, git, merge, version-control
<h1>How to perform a three-way diff in Git without merging?</h1> <p>I want to perform a three-way diff between two git branches with a common merge base, and view it with kdiff3.</p> <p>I've found lots of guidance on SO (and a few very similar questions (<a href="https://stackoverflow.com/q/26301307/3380131">1</a>, <a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,098
git
# How to perform a three-way diff in Git without merging? I want to perform a three-way diff between two git branches with a common merge base, and view it with kdiff3. I've found lots of guidance on SO (and a few very similar questions ([1](https://stackoverflow.com/q/26301307/3380131), [2](https://stackoverflow.com...
> I want to be able to perform this diff *before* merging, including on files without merge conflicts. You just have to set up the index as you like, you never have to commit results. The way to set up for exactly what was asked, straight diffs-since-base with no merge prep, is ``` git merge -s ours --no-ff --no-comm...
11202069
Git flow branching for fixing a bug
34
2012-06-26 06:50:22
<p>I have been using git flow for a while. I was searching for branching model for fixing issues and bugs found in the develop branch. I know we could use hotfix but it is for master branch, or quick bug fixes for the production.</p> <p>Fixing a bug on development is not a feature. I could always reinitialize git flow...
28,080
387,358
2018-11-17 05:48:30
46,923,262
14
2017-10-25 03:02:20
629,222
2018-11-17 05:48:30
https://stackoverflow.com/q/11202069
https://stackoverflow.com/a/46923262
<p><code>git-flow-avh</code> is what you want</p> <p><strong>For osx:</strong></p> <ul> <li><code>brew uninstall git-flow #remove your current</code></li> <li><code>brew install git-flow-avh #add the update</code></li> </ul> <p><strong>Within project folder:</strong></p> <ul> <li><code>git init</code></li> <li>you ...
<p><code>git-flow-avh</code> is what you want</p> <p><strong>For osx:</strong></p> <ul> <li><code>brew uninstall git-flow #remove your current</code></li> <li><code>brew install git-flow-avh #add the update</code></li> </ul> <p><strong>Within project folder:</strong></p> <ul> <li><code>git init</code></li> <li>you ...
119, 64339
git, git-flow
<h1>Git flow branching for fixing a bug</h1> <p>I have been using git flow for a while. I was searching for branching model for fixing issues and bugs found in the develop branch. I know we could use hotfix but it is for master branch, or quick bug fixes for the production.</p> <p>Fixing a bug on development is not a ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,100
git
# Git flow branching for fixing a bug I have been using git flow for a while. I was searching for branching model for fixing issues and bugs found in the develop branch. I know we could use hotfix but it is for master branch, or quick bug fixes for the production. Fixing a bug on development is not a feature. I could...
`git-flow-avh` is what you want **For osx:** - `brew uninstall git-flow #remove your current` - `brew install git-flow-avh #add the update` **Within project folder:** - `git init` - you should see amongst prompts - `Bugfix branches? [bugfix/]` which would not have been a prompt with standard `git-flow` - start a ne...
16721183
How do I make git show diff when rewording a commit message during rebase -i?
32
2013-05-23 18:20:22
<p>I always use <code>git commit --verbose</code>. Is there an equivalent option/setting that will make git show me the diff when I'm rewording a commit message during <code>git rebase --interactive</code>?</p>
3,320
156,060
2024-06-17 12:32:28
16,749,303
14
2013-05-25 11:56:29
589,329
2023-04-04 18:46:47
https://stackoverflow.com/q/16721183
https://stackoverflow.com/a/16749303
<p>According to your answers in the comments, executing <code>git diff HEAD^</code> will not help you, except if you only want to reword the last commit.</p> <p>But in this case a rebase is the wrong tool anyway. Instead you can simply do <code>git commit --amend --verbose</code> without changes in the index and then e...
<p>According to your answers in the comments, executing <code>git diff HEAD^</code> will not help you, except if you only want to reword the last commit.</p> <p>But in this case a rebase is the wrong tool anyway. Instead you can simply do <code>git commit --amend --verbose</code> without changes in the index and then e...
119, 8974
git, rebase
<h1>How do I make git show diff when rewording a commit message during rebase -i?</h1> <p>I always use <code>git commit --verbose</code>. Is there an equivalent option/setting that will make git show me the diff when I'm rewording a commit message during <code>git rebase --interactive</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,101
git
# How do I make git show diff when rewording a commit message during rebase -i? I always use `git commit --verbose`. Is there an equivalent option/setting that will make git show me the diff when I'm rewording a commit message during `git rebase --interactive`?
According to your answers in the comments, executing `git diff HEAD^` will not help you, except if you only want to reword the last commit. But in this case a rebase is the wrong tool anyway. Instead you can simply do `git commit --amend --verbose` without changes in the index and then edit the commit message, having ...
5514739
Best Practice for Git Repositories with multiple projects in traditional n-tier design
32
2011-04-01 14:26:07
<p>I'm making the switch from a centralized SCM system to GIT. OK, I'll admit which one, it is Visual SourceSafe. So in addition to getting over the learning curve of Git commands and workflow, the biggest issue I'm currently facing is how to migrate our current repository over to Git in regards to single or some fla...
26,531
166,231
2022-09-08 03:14:43
5,582,827
14
2011-04-07 14:36:54
165,017
2011-04-07 14:36:54
https://stackoverflow.com/q/5514739
https://stackoverflow.com/a/5582827
<p>The reason most people advise to do separate repositories is because it separates out changes and change sets. If someone makes a change to the client projects (which you say doesn't really effect others), there is no reason for someone to update the entire code base. They can simply just get the changes from the ...
<p>The reason most people advise to do separate repositories is because it separates out changes and change sets. If someone makes a change to the client projects (which you say doesn't really effect others), there is no reason for someone to update the entire code base. They can simply just get the changes from the ...
119, 3678, 7330, 8951, 33953
git, repository, repository-design, visual-sourcesafe, visual-studio
<h1>Best Practice for Git Repositories with multiple projects in traditional n-tier design</h1> <p>I'm making the switch from a centralized SCM system to GIT. OK, I'll admit which one, it is Visual SourceSafe. So in addition to getting over the learning curve of Git commands and workflow, the biggest issue I'm curren...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,102
git
# Best Practice for Git Repositories with multiple projects in traditional n-tier design I'm making the switch from a centralized SCM system to GIT. OK, I'll admit which one, it is Visual SourceSafe. So in addition to getting over the learning curve of Git commands and workflow, the biggest issue I'm currently facing ...
The reason most people advise to do separate repositories is because it separates out changes and change sets. If someone makes a change to the client projects (which you say doesn't really effect others), there is no reason for someone to update the entire code base. They can simply just get the changes from the proje...
7694467
Resolving Git merge conflicts
31
2011-10-08 02:49:05
<p>A Git repository has been cloned on several developers' local machines. Some changes have been made to the code in the repository. We're now getting the error:</p> <pre><code>error: Your local changes to the following files would be overwritten by merge: public_html/sites/file public_html/sites/fil...
59,154
559,882
2015-07-09 08:01:49
7,694,596
14
2011-10-08 03:24:16
983,311
2013-01-22 13:18:50
https://stackoverflow.com/q/7694467
https://stackoverflow.com/a/7694596
<p><code>git stash</code> is perfectly legitimate, though as Greg said, for some reason fixing the conflicts can get strange. But they are still fixable, you won't actually fubar anything. The command as I know to re-apply the stash is <code>git stash apply</code>, though <code>pop</code> may be an alternative that I'm...
<p><code>git stash</code> is perfectly legitimate, though as Greg said, for some reason fixing the conflicts can get strange. But they are still fixable, you won't actually fubar anything. The command as I know to re-apply the stash is <code>git stash apply</code>, though <code>pop</code> may be an alternative that I'm...
119, 13091
git, git-stash
<h1>Resolving Git merge conflicts</h1> <p>A Git repository has been cloned on several developers' local machines. Some changes have been made to the code in the repository. We're now getting the error:</p> <pre><code>error: Your local changes to the following files would be overwritten by merge: public_html/s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,103
git
# Resolving Git merge conflicts A Git repository has been cloned on several developers' local machines. Some changes have been made to the code in the repository. We're now getting the error: ``` error: Your local changes to the following files would be overwritten by merge: public_html/sites/file pu...
`git stash` is perfectly legitimate, though as Greg said, for some reason fixing the conflicts can get strange. But they are still fixable, you won't actually fubar anything. The command as I know to re-apply the stash is `git stash apply`, though `pop` may be an alternative that I'm not aware of (or it could do someth...
30663402
How to `git add` non-recursively?
29
2015-06-05 09:47:29
<p>When I <code>git add</code> a folder, the whole content and all subfolders are staged automatically. In case the folder contains subfolders which I do not want to commit, I have to unstage them manually and add them to <code>.gitignore</code> afterwards. The explicit unstaging feels like I'm doing something wrong he...
10,299
1,804,173
2020-04-12 22:38:59
30,664,697
14
2015-06-05 10:51:19
279,627
2016-06-08 15:34:52
https://stackoverflow.com/q/30663402
https://stackoverflow.com/a/30664697
<p>Adding a whole complex directory hierarchy is an unusual thing to do (and certainly not something that happens as part of the usual git development workflow), so git doesn't have a special feature for it. You can always use an external tool to assemble a list of files you want to add and feed that list to <code>git...
<p>Adding a whole complex directory hierarchy is an unusual thing to do (and certainly not something that happens as part of the usual git development workflow), so git doesn't have a special feature for it. You can always use an external tool to assemble a list of files you want to add and feed that list to <code>git...
63, 119, 578
git, recursion, svn
<h1>How to `git add` non-recursively?</h1> <p>When I <code>git add</code> a folder, the whole content and all subfolders are staged automatically. In case the folder contains subfolders which I do not want to commit, I have to unstage them manually and add them to <code>.gitignore</code> afterwards. The explicit unstag...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,106
git
# How to `git add` non-recursively? When I `git add` a folder, the whole content and all subfolders are staged automatically. In case the folder contains subfolders which I do not want to commit, I have to unstage them manually and add them to `.gitignore` afterwards. The explicit unstaging feels like I'm doing someth...
Adding a whole complex directory hierarchy is an unusual thing to do (and certainly not something that happens as part of the usual git development workflow), so git doesn't have a special feature for it. You can always use an external tool to assemble a list of files you want to add and feed that list to `git add`, e....
17357369
The way to "reinit" repository
29
2013-06-28 04:47:49
<p>I've made kind of a big refactoring in my project: I renamed files, removed, added... Besides, I added some folders in .gitignore. However, I've already made a commit to a remote repository before refactoring.</p> <p>Is there any to make git "reinit" for my repository? If there is not, what should I do?</p> <p><st...
75,925
1,708,058
2024-06-05 10:24:44
17,357,497
14
2013-06-28 04:59:58
46,194
2013-06-28 07:25:33
https://stackoverflow.com/q/17357369
https://stackoverflow.com/a/17357497
<p><strong>UPDATE</strong></p> <p>If you have deleted the <code>.git</code> folder (not a great idea), you can create a new clone of the repo and move your stuff to that, and continue there. Something like this</p> <pre><code>cd .. git clone &lt;remote-repo-url&gt; new-repo rm -rf new-repo/* ...
<p><strong>UPDATE</strong></p> <p>If you have deleted the <code>.git</code> folder (not a great idea), you can create a new clone of the repo and move your stuff to that, and continue there. Something like this</p> <pre><code>cd .. git clone &lt;remote-repo-url&gt; new-repo rm -rf new-repo/* ...
119
git
<h1>The way to "reinit" repository</h1> <p>I've made kind of a big refactoring in my project: I renamed files, removed, added... Besides, I added some folders in .gitignore. However, I've already made a commit to a remote repository before refactoring.</p> <p>Is there any to make git "reinit" for my repository? If the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,107
git
# The way to "reinit" repository I've made kind of a big refactoring in my project: I renamed files, removed, added... Besides, I added some folders in .gitignore. However, I've already made a commit to a remote repository before refactoring. Is there any to make git "reinit" for my repository? If there is not, what ...
**UPDATE** If you have deleted the `.git` folder (not a great idea), you can create a new clone of the repo and move your stuff to that, and continue there. Something like this ``` cd .. git clone <remote-repo-url> new-repo rm -rf new-repo/* // this will not remove new-repo/.git cp -f <origin...
2916958
git rebase onto remote updates
29
2010-05-26 21:29:06
<p>I work with a small team that uses git for source code management. Recently, we have been doing topic branches to keep track of features then merging them into master locally then pushing them to a central git repository on a remote server. This works great when no changes have been made in master: I create my to...
30,609
123,486
2013-11-11 14:38:59
4,476,863
14
2010-12-18 05:57:42
123,486
2010-12-18 05:57:42
https://stackoverflow.com/q/2916958
https://stackoverflow.com/a/4476863
<p>I have found, over time, my favorite solution is:</p> <pre><code>git checkout topic # make [n] commits git rebase -i HEAD~[n] #clean up time git checkout master git pull --rebase git checkout topic git rebase master git checkout master git merge topic git push origin </code></pre>
<p>I have found, over time, my favorite solution is:</p> <pre><code>git checkout topic # make [n] commits git rebase -i HEAD~[n] #clean up time git checkout master git pull --rebase git checkout topic git rebase master git checkout master git merge topic git push origin </code></pre>
119, 29934, 41346
git, git-rebase, git-remote
<h1>git rebase onto remote updates</h1> <p>I work with a small team that uses git for source code management. Recently, we have been doing topic branches to keep track of features then merging them into master locally then pushing them to a central git repository on a remote server. This works great when no changes h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,108
git
# git rebase onto remote updates I work with a small team that uses git for source code management. Recently, we have been doing topic branches to keep track of features then merging them into master locally then pushing them to a central git repository on a remote server. This works great when no changes have been ma...
I have found, over time, my favorite solution is: ``` git checkout topic # make [n] commits git rebase -i HEAD~[n] #clean up time git checkout master git pull --rebase git checkout topic git rebase master git checkout master git merge topic git push origin ```
9772598
Backport changes from renamed file
28
2012-03-19 15:07:05
<p>I have two branches: trunk, production. I have found a problem in trunk, made fix and committed it, pushed it. Now it was tested and I need do merge changes into the production branch as a hot-fix. I try to use the cherry-pick. However it doesn't work because a changed file(s) in the fix was renamed in the trunk ear...
5,884
438,742
2017-06-07 07:38:09
9,773,560
14
2012-03-19 16:02:24
305,973
2012-03-19 16:02:24
https://stackoverflow.com/q/9772598
https://stackoverflow.com/a/9773560
<p>I'd use good old patch for this:</p> <pre><code>git show COMMIT_ID -- old/file/name.txt | patch new/file/name.txt </code></pre>
<p>I'd use good old patch for this:</p> <pre><code>git show COMMIT_ID -- old/file/name.txt | patch new/file/name.txt </code></pre>
119, 36489
cherry-pick, git
<h1>Backport changes from renamed file</h1> <p>I have two branches: trunk, production. I have found a problem in trunk, made fix and committed it, pushed it. Now it was tested and I need do merge changes into the production branch as a hot-fix. I try to use the cherry-pick. However it doesn't work because a changed fil...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,112
git
# Backport changes from renamed file I have two branches: trunk, production. I have found a problem in trunk, made fix and committed it, pushed it. Now it was tested and I need do merge changes into the production branch as a hot-fix. I try to use the cherry-pick. However it doesn't work because a changed file(s) in t...
I'd use good old patch for this: ``` git show COMMIT_ID -- old/file/name.txt | patch new/file/name.txt ```
4582849
Git responds with 'error in sideband demultiplexer'
28
2011-01-03 07:55:35
<p>I have two servers set up (as far as I know) exactly the same. On one of them, committing with git has always been fine, however on the second one, I've started getting this error:</p> <blockquote> <p>fatal: The remote end hung up unexpectedly<br> error: error in sideband demultiplexer</p> </blockquote> <p>Eve...
25,664
532,182
2020-11-08 16:54:38
4,582,965
14
2011-01-03 08:15:56
6,309
2020-11-08 16:54:38
https://stackoverflow.com/q/4582849
https://stackoverflow.com/a/4582965
<p>On this <a href="https://web.archive.org/web/20101017020019/http://support.github.com/discussions/repos/2384-broken-repository-error-in-sideband-demultiplexer" rel="nofollow noreferrer">GitHub support thread</a>, this kind of error seems to be related to a <a href="http://help.github.com/egit-corruption/" rel="nofol...
<p>On this <a href="https://web.archive.org/web/20101017020019/http://support.github.com/discussions/repos/2384-broken-repository-error-in-sideband-demultiplexer" rel="nofollow noreferrer">GitHub support thread</a>, this kind of error seems to be related to a <a href="http://help.github.com/egit-corruption/" rel="nofol...
119, 10816
corruption, git
<h1>Git responds with 'error in sideband demultiplexer'</h1> <p>I have two servers set up (as far as I know) exactly the same. On one of them, committing with git has always been fine, however on the second one, I've started getting this error:</p> <blockquote> <p>fatal: The remote end hung up unexpectedly<br> err...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,113
git
# Git responds with 'error in sideband demultiplexer' I have two servers set up (as far as I know) exactly the same. On one of them, committing with git has always been fine, however on the second one, I've started getting this error: > fatal: The remote end hung up unexpectedly > error: error in sideband demultipl...
On this [GitHub support thread](https://web.archive.org/web/20101017020019/http://support.github.com/discussions/repos/2384-broken-repository-error-in-sideband-demultiplexer), this kind of error seems to be related to a [repository corruption](http://help.github.com/egit-corruption/) of some kind. The issue was fixed ...
19407664
The String 'Head' does not represent a revision number
27
2013-10-16 15:34:42
<p>I'm using Git. I made some changes to a branch that I created and then I committed some changes. But now, when I try to commit code, I get the following message:</p> <blockquote> <p>Warning: not all local changes may be shown due to an error: The string 'HEAD' does not represent a revision number.</p> </blockqu...
7,649
297,127
2020-02-12 15:54:40
20,046,674
14
2013-11-18 11:30:33
1,293,839
2013-11-18 11:30:33
https://stackoverflow.com/q/19407664
https://stackoverflow.com/a/20046674
<p>I also got this problem and I resolved it by <code>git reset</code> from git bash.</p>
<p>I also got this problem and I resolved it by <code>git reset</code> from git bash.</p>
119, 8945
git, intellij-idea
<h1>The String 'Head' does not represent a revision number</h1> <p>I'm using Git. I made some changes to a branch that I created and then I committed some changes. But now, when I try to commit code, I get the following message:</p> <blockquote> <p>Warning: not all local changes may be shown due to an error: The s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,115
git
# The String 'Head' does not represent a revision number I'm using Git. I made some changes to a branch that I created and then I committed some changes. But now, when I try to commit code, I get the following message: > Warning: not all local changes may be shown due to an error: The > string 'HEAD' does not represe...
I also got this problem and I resolved it by `git reset` from git bash.
59399621
Is there a way to instruct Visual Studio Code to skip git commit hooks (i.e., to supply the -n argument)?
26
2019-12-18 20:33:47
<p>I would like to be able to install a pre-commit hook, but also to be able to commit under certain circumstances (e.g., WIP) even when the hook fails. I can do this easily from the command line, using <code>git commit --no-verify</code> (<code>git commit -n</code>). But I can't find anything that allows me to affect ...
21,956
252,858
2022-05-06 20:50:26
59,403,776
14
2019-12-19 05:32:41
6,309
2020-11-28 14:11:08
https://stackoverflow.com/q/59399621
https://stackoverflow.com/a/59403776
<blockquote> <p>Is there a way to instruct Visual Studio Code to skip <code>git commit</code> hooks (i.e., to supply the <code>-n</code> argument)?</p> </blockquote> <p>Update Sept 2020: there is, with VSCode 1.50 (Sept 2020), which adds the missing option for <code>git commit</code> in VSCode.</p> <p>See <a href="http...
<blockquote> <p>Is there a way to instruct Visual Studio Code to skip <code>git commit</code> hooks (i.e., to supply the <code>-n</code> argument)?</p> </blockquote> <p>Update Sept 2020: there is, with VSCode 1.50 (Sept 2020), which adds the missing option for <code>git commit</code> in VSCode.</p> <p>See <a href="http...
119, 111608
git, visual-studio-code
<h1>Is there a way to instruct Visual Studio Code to skip git commit hooks (i.e., to supply the -n argument)?</h1> <p>I would like to be able to install a pre-commit hook, but also to be able to commit under certain circumstances (e.g., WIP) even when the hook fails. I can do this easily from the command line, using <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,118
git
# Is there a way to instruct Visual Studio Code to skip git commit hooks (i.e., to supply the -n argument)? I would like to be able to install a pre-commit hook, but also to be able to commit under certain circumstances (e.g., WIP) even when the hook fails. I can do this easily from the command line, using `git commit...
> Is there a way to instruct Visual Studio Code to skip `git commit` hooks (i.e., to supply the `-n` argument)? Update Sept 2020: there is, with VSCode 1.50 (Sept 2020), which adds the missing option for `git commit` in VSCode. See [PR 106335](https://github.com/microsoft/vscode/pull/106335): Adds commands for `--no-...
40547105
Visual Studio Solution from multiple Git repositories
26
2016-11-11 11:32:11
<p>We have two different repositories on Git which need to come together to form the solution in Visual Studio.</p> <p>Files under each project may be from the two different repositories. I need to make sure that when I make changes, it updates the changes in the correct repository (that is, the other repository should...
12,055
2,463,304
2024-06-24 20:59:24
40,581,399
14
2016-11-14 03:17:08
6,936,103
2021-12-16 09:49:19
https://stackoverflow.com/q/40547105
https://stackoverflow.com/a/40581399
<p>You can use submodules to realize it. Treat one repository as mainRepo and the other as subRepo.</p> <ol> <li>Based in the mainRepo and add the subRepo in it, use <code>git submodule add subRepo’s_URL</code></li> <li>Just make changes on files you want. You don’t need to pay attention to which repository the files a...
<p>You can use submodules to realize it. Treat one repository as mainRepo and the other as subRepo.</p> <ol> <li>Based in the mainRepo and add the subRepo in it, use <code>git submodule add subRepo’s_URL</code></li> <li>Just make changes on files you want. You don’t need to pay attention to which repository the files a...
119, 456, 33953, 36361
git, solution-explorer, version-control, visual-studio
<h1>Visual Studio Solution from multiple Git repositories</h1> <p>We have two different repositories on Git which need to come together to form the solution in Visual Studio.</p> <p>Files under each project may be from the two different repositories. I need to make sure that when I make changes, it updates the changes ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,120
git
# Visual Studio Solution from multiple Git repositories We have two different repositories on Git which need to come together to form the solution in Visual Studio. Files under each project may be from the two different repositories. I need to make sure that when I make changes, it updates the changes in the correct ...
You can use submodules to realize it. Treat one repository as mainRepo and the other as subRepo. 1. Based in the mainRepo and add the subRepo in it, use `git submodule add subRepo’s_URL` 2. Just make changes on files you want. You don’t need to pay attention to which repository the files are from 3. In the local mainR...
39789921
What flavor of regex does git use
26
2016-09-30 10:57:39
<p>I'm trying to use the git diff --word-diff-regex= command and it seems to reject any types of lookaheads and lookbehinds. I'm having trouble pinning down what flavor of regex git uses. For example </p> <pre><code>git diff --word-diff-regex='([.\w]+)(?!&gt;)' </code></pre> <p>Comes back as an invalid regular expres...
6,529
2,172,412
2023-01-17 00:52:10
39,790,343
14
2016-09-30 11:20:46
1,256,452
2023-01-17 00:52:10
https://stackoverflow.com/q/39789921
https://stackoverflow.com/a/39790343
<p>The Git source uses <code>regcomp</code> and <code>regexec</code>, which are defined by POSIX 1003.2. The <a href="https://github.com/git/git/blob/v2.39.0/diff.c#L2212" rel="nofollow noreferrer">code to compile a diff regexp</a> is:</p> <pre><code> if (regcomp(ecbdata-&gt;diff_words-&gt;word_regex, ...
<p>The Git source uses <code>regcomp</code> and <code>regexec</code>, which are defined by POSIX 1003.2. The <a href="https://github.com/git/git/blob/v2.39.0/diff.c#L2212" rel="nofollow noreferrer">code to compile a diff regexp</a> is:</p> <pre><code> if (regcomp(ecbdata-&gt;diff_words-&gt;word_regex, ...
18, 119, 9033
git, git-diff, regex
<h1>What flavor of regex does git use</h1> <p>I'm trying to use the git diff --word-diff-regex= command and it seems to reject any types of lookaheads and lookbehinds. I'm having trouble pinning down what flavor of regex git uses. For example </p> <pre><code>git diff --word-diff-regex='([.\w]+)(?!&gt;)' </code></pre> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,121
git
# What flavor of regex does git use I'm trying to use the git diff --word-diff-regex= command and it seems to reject any types of lookaheads and lookbehinds. I'm having trouble pinning down what flavor of regex git uses. For example ``` git diff --word-diff-regex='([.\w]+)(?!>)' ``` Comes back as an invalid regular ...
The Git source uses `regcomp` and `regexec`, which are defined by POSIX 1003.2. The [code to compile a diff regexp](https://github.com/git/git/blob/v2.39.0/diff.c#L2212) is: ``` if (regcomp(ecbdata->diff_words->word_regex, o->word_regex, REG_EXTENDED | REG_NE...