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
9688867
Git pull not pulling everything
81
2012-03-13 17:19:54
<p>I have a server where there's some config that I don't properly know where i just git pull and it gets what is in a github repo, then restart it in order to deploy.</p> <p>The thing is, there's a commit which isn't my latest, that isn't really on my server. The files aren't in .gitignore. How do I assure that a pul...
231,863
1,139,353
2024-03-10 05:41:43
9,695,141
222
2012-03-14 02:30:24
148,870
2012-03-14 02:30:24
https://stackoverflow.com/q/9688867
https://stackoverflow.com/a/9695141
<p>If you always want your server version to reflect a commit from your repo, it's probably better to use <code>git reset</code> instead of <code>git pull</code> - that way you never invoke merge functionality, but instead set all of the files to exactly what they are in the commit you reset to. For example:</p> <pre>...
<p>If you always want your server version to reflect a commit from your repo, it's probably better to use <code>git reset</code> instead of <code>git pull</code> - that way you never invoke merge functionality, but instead set all of the files to exactly what they are in the commit you reset to. For example:</p> <pre>...
119
git
<h1>Git pull not pulling everything</h1> <p>I have a server where there's some config that I don't properly know where i just git pull and it gets what is in a github repo, then restart it in order to deploy.</p> <p>The thing is, there's a commit which isn't my latest, that isn't really on my server. The files aren't ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,980
git
# Git pull not pulling everything I have a server where there's some config that I don't properly know where i just git pull and it gets what is in a github repo, then restart it in order to deploy. The thing is, there's a commit which isn't my latest, that isn't really on my server. The files aren't in .gitignore. H...
If you always want your server version to reflect a commit from your repo, it's probably better to use `git reset` instead of `git pull` - that way you never invoke merge functionality, but instead set all of the files to exactly what they are in the commit you reset to. For example: ``` git fetch origin master git re...
3685001
How to fix "corrupted" interactive rebase?
455
2010-09-10 13:37:24
<p>I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the <a href="https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit">following instructions</a>. Before running the "git commit --amend" (and after the git rebase --interactive) I decided ...
224,322
66,988
2024-02-18 22:29:15
3,687,435
221
2010-09-10 18:47:30
44,733
2010-09-10 19:00:11
https://stackoverflow.com/q/3685001
https://stackoverflow.com/a/3687435
<p>It looks like Git tried to remove the <code>.git/rebase-merge</code> directory but wasn't able to remove it completely. Have you tried copying that folder away? Also copy away the <code>.git/rebase-apply</code> folder if that is present.</p>
<p>It looks like Git tried to remove the <code>.git/rebase-merge</code> directory but wasn't able to remove it completely. Have you tried copying that folder away? Also copy away the <code>.git/rebase-apply</code> folder if that is present.</p>
119, 21628, 29934
git, git-rebase, msysgit
<h1>How to fix "corrupted" interactive rebase?</h1> <p>I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the <a href="https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit">following instructions</a>. Before running the "git commit --amend"...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,981
git
# How to fix "corrupted" interactive rebase? I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the [following instructions](https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit). Before running the "git commit --amend" (and after the git ...
It looks like Git tried to remove the `.git/rebase-merge` directory but wasn't able to remove it completely. Have you tried copying that folder away? Also copy away the `.git/rebase-apply` folder if that is present.
22984262
"Cannot update paths and switch to branch at the same time"
210
2014-04-10 09:40:32
<p>I sometimes use the <code>checkout -b</code> option to create a new branch, check it out at the same time and set up tracking in one command.</p> <p>In a new environment, I get this error:</p> <pre><code>$ git checkout -b test --track origin/master fatal: Cannot update paths and switch to branch 'test' at the same...
193,414
1,207,049
2022-11-28 22:36:27
22,987,503
221
2014-04-10 12:04:50
6,309
2019-12-29 17:17:02
https://stackoverflow.com/q/22984262
https://stackoverflow.com/a/22987503
<blockquote> <p>'<code>origin/master</code>' which can not be resolved as commit</p> </blockquote> <p>Strange: you need to check your remotes:</p> <pre><code>git remote -v </code></pre> <p>And make sure <code>origin</code> is fetched:</p> <pre><code>git fetch origin </code></pre> <p>Then:</p> <pre><code>git bra...
<blockquote> <p>'<code>origin/master</code>' which can not be resolved as commit</p> </blockquote> <p>Strange: you need to check your remotes:</p> <pre><code>git remote -v </code></pre> <p>And make sure <code>origin</code> is fetched:</p> <pre><code>git fetch origin </code></pre> <p>Then:</p> <pre><code>git bra...
119, 37230
git, git-checkout
<h1>"Cannot update paths and switch to branch at the same time"</h1> <p>I sometimes use the <code>checkout -b</code> option to create a new branch, check it out at the same time and set up tracking in one command.</p> <p>In a new environment, I get this error:</p> <pre><code>$ git checkout -b test --track origin/mast...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,983
git
# "Cannot update paths and switch to branch at the same time" I sometimes use the `checkout -b` option to create a new branch, check it out at the same time and set up tracking in one command. In a new environment, I get this error: ``` $ git checkout -b test --track origin/master fatal: Cannot update paths and swit...
> '`origin/master`' which can not be resolved as commit Strange: you need to check your remotes: ``` git remote -v ``` And make sure `origin` is fetched: ``` git fetch origin ``` Then: ``` git branch -avv ``` (to see if you do have fetched an `origin/master` branch) Finally, use [`git switch`](https://git-scm.c...
37814286
How to manage the version number in Git?
123
2016-06-14 14:04:08
<p>Let's imagine the <a href="http://xkcd.com/1692/" rel="noreferrer">blerp</a> command line tool maintained on <a href="/questions/tagged/git" class="post-tag" title="show questions tagged &#39;git&#39;" rel="tag" aria-labelledby="git-container">git</a>. This tool has the (hidden) <code>--version</code> option which r...
214,263
2,612,235
2022-09-16 18:43:25
46,434,732
221
2017-09-26 19:53:39
5,919,760
2022-09-02 17:16:50
https://stackoverflow.com/q/37814286
https://stackoverflow.com/a/46434732
<p><a href="https://stackoverflow.com/a/37874569">Alexey Kiselev</a> and <a href="https://stackoverflow.com/a/37815595">Dario</a> already hinted towards the answer, but I will try to explain it in detail.</p> <h3>Versioning Schemes</h3> <p>There are two types of versioning schemes:</p> <ol> <li>Internal version number:...
<p><a href="https://stackoverflow.com/a/37874569">Alexey Kiselev</a> and <a href="https://stackoverflow.com/a/37815595">Dario</a> already hinted towards the answer, but I will try to explain it in detail.</p> <h3>Versioning Schemes</h3> <p>There are two types of versioning schemes:</p> <ol> <li>Internal version number:...
81, 119, 456
git, version-control, versioning
<h1>How to manage the version number in Git?</h1> <p>Let's imagine the <a href="http://xkcd.com/1692/" rel="noreferrer">blerp</a> command line tool maintained on <a href="/questions/tagged/git" class="post-tag" title="show questions tagged &#39;git&#39;" rel="tag" aria-labelledby="git-container">git</a>. This tool has ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,984
git
# How to manage the version number in Git? Let's imagine the [blerp](http://xkcd.com/1692/) command line tool maintained on [git](/questions/tagged/git "show questions tagged 'git'"). This tool has the (hidden) `--version` option which returns its [version](https://en.wikipedia.org/wiki/Software_versioning) (let's say...
[Alexey Kiselev](https://stackoverflow.com/a/37874569) and [Dario](https://stackoverflow.com/a/37815595) already hinted towards the answer, but I will try to explain it in detail. ### Versioning Schemes There are two types of versioning schemes: 1. Internal version number: This can be incremented many times in a day...
25411366
git repo says it's up-to-date after pull but files are not updated
79
2014-08-20 17:53:41
<p>I have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment.</p> <p>After I have tested changes in the dev repo I push them to the bare repo and they are auto pulled down into the prod repo on a cronjob ...
188,101
3,485,899
2024-01-26 21:59:45
25,411,645
221
2014-08-20 18:10:08
1,512,743
2023-08-16 12:12:42
https://stackoverflow.com/q/25411366
https://stackoverflow.com/a/25411645
<p>Try this:</p> <pre><code> git fetch --all git reset --hard origin/master </code></pre> <p>Explanation:</p> <p><code>git fetch</code> downloads the latest from remote without trying to merge or rebase anything.</p>
<p>Try this:</p> <pre><code> git fetch --all git reset --hard origin/master </code></pre> <p>Explanation:</p> <p><code>git fetch</code> downloads the latest from remote without trying to merge or rebase anything.</p>
119, 7330, 27128
checkin, git, repository
<h1>git repo says it's up-to-date after pull but files are not updated</h1> <p>I have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment.</p> <p>After I have tested changes in the dev repo I push them to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,985
git
# git repo says it's up-to-date after pull but files are not updated I have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment. After I have tested changes in the dev repo I push them to the bare repo an...
Try this: ``` git fetch --all git reset --hard origin/master ``` Explanation: `git fetch` downloads the latest from remote without trying to merge or rebase anything.
28633956
Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?
134
2015-02-20 16:42:52
<p><strong>Note</strong>: I <strong>don't</strong> think this is a duplicate of <a href="https://stackoverflow.com/questions/8633981/what-does-auto-packing-the-repository-for-optimum-performance-mean">this question</a>, which is talking about a non-background pack which <em>hangs</em> git <em>with a subtly different er...
65,209
27,641
2017-01-20 11:07:18
28,634,671
220
2015-02-20 17:21:45
27,641
2017-01-20 11:07:18
https://stackoverflow.com/q/28633956
https://stackoverflow.com/a/28634671
<p>I found the solution from the second comment you provided, Trengot, thanks. It turns out that I had some dangling blobs, which were in <code>.git/objects/17</code> and hence triggering the packing:</p> <pre><code>$ git fsck dangling blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977 dangling blob dbff2d073741f9775c815d4...
<p>I found the solution from the second comment you provided, Trengot, thanks. It turns out that I had some dangling blobs, which were in <code>.git/objects/17</code> and hence triggering the packing:</p> <pre><code>$ git fsck dangling blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977 dangling blob dbff2d073741f9775c815d4...
119, 8568, 15292
background-process, git, packing
<h1>Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?</h1> <p><strong>Note</strong>: I <strong>don't</strong> think this is a duplicate of <a href="https://stackoverflow.com/questions/8633981/what-does-auto-packing-the-repository-for-optimum-performance-mean">this qu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,986
git
# Why does git keep telling me it's "Auto packing the repository in background for optimum performance"? **Note**: I **don't** think this is a duplicate of [this question](https://stackoverflow.com/questions/8633981/what-does-auto-packing-the-repository-for-optimum-performance-mean), which is talking about a non-backg...
I found the solution from the second comment you provided, Trengot, thanks. It turns out that I had some dangling blobs, which were in `.git/objects/17` and hence triggering the packing: ``` $ git fsck dangling blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977 dangling blob dbff2d073741f9775c815d4a3c623736af224dad danglin...
9670745
How to restore a whole directory from history of git repository?
131
2012-03-12 16:17:15
<p>I would like to restore a whole directory (recursively) from the history of my git repository.</p> <p>There is only 1 branch (master).</p> <p>I know the commit where errors were included.</p> <p>Can I use the sha1 hash of the parent commit to restore the state of the directory as it was before the errors were inc...
106,592
999,596
2022-12-01 20:10:05
9,671,161
220
2012-03-12 16:41:48
592,540
2020-08-11 15:51:22
https://stackoverflow.com/q/9670745
https://stackoverflow.com/a/9671161
<p>try adding '--' between revisions and paths:</p> <pre><code>git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 -- path/to/the/folder/ </code></pre> <p>And if you want to recover a directory from the previous commit, you can replace the commit hash by HEAD~1, for example:</p> <pre><code>git checkout HEAD~1 -- pat...
<p>try adding '--' between revisions and paths:</p> <pre><code>git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 -- path/to/the/folder/ </code></pre> <p>And if you want to recover a directory from the previous commit, you can replace the commit hash by HEAD~1, for example:</p> <pre><code>git checkout HEAD~1 -- pat...
119
git
<h1>How to restore a whole directory from history of git repository?</h1> <p>I would like to restore a whole directory (recursively) from the history of my git repository.</p> <p>There is only 1 branch (master).</p> <p>I know the commit where errors were included.</p> <p>Can I use the sha1 hash of the parent commit ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,987
git
# How to restore a whole directory from history of git repository? I would like to restore a whole directory (recursively) from the history of my git repository. There is only 1 branch (master). I know the commit where errors were included. Can I use the sha1 hash of the parent commit to restore the state of the di...
try adding '--' between revisions and paths: ``` git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 -- path/to/the/folder/ ``` And if you want to recover a directory from the previous commit, you can replace the commit hash by HEAD~1, for example: ``` git checkout HEAD~1 -- path/to/the/folder/ ```
4693588
What is a tracking branch?
267
2011-01-14 16:50:26
<p>Can someone explain a "tracking branch" as it applies to git?</p> <p>Here's the definition from <a href="https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches" rel="noreferrer">git-scm.com</a>:</p> <blockquote> <p>A 'tracking branch' in Git is a local branch that is connected to a remote branch. When ...
222,261
1,108
2025-02-14 13:35:48
4,693,780
219
2011-01-14 17:07:09
11,208
2022-06-22 16:06:12
https://stackoverflow.com/q/4693588
https://stackoverflow.com/a/4693780
<p>The <a href="http://git-scm.com/book" rel="noreferrer">ProGit book</a> has <a href="http://git-scm.com/book/en/Git-Branching-Remote-Branches#_tracking_branches" rel="noreferrer">a very good explanation</a>:</p> <p><strong>Tracking Branches</strong></p> <p>Checking out a local branch from a remote branch automaticall...
<p>The <a href="http://git-scm.com/book" rel="noreferrer">ProGit book</a> has <a href="http://git-scm.com/book/en/Git-Branching-Remote-Branches#_tracking_branches" rel="noreferrer">a very good explanation</a>:</p> <p><strong>Tracking Branches</strong></p> <p>Checking out a local branch from a remote branch automaticall...
119, 456, 1879
branch, git, version-control
<h1>What is a tracking branch?</h1> <p>Can someone explain a "tracking branch" as it applies to git?</p> <p>Here's the definition from <a href="https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches" rel="noreferrer">git-scm.com</a>:</p> <blockquote> <p>A 'tracking branch' in Git is a local branch that is c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,988
git
# What is a tracking branch? Can someone explain a "tracking branch" as it applies to git? Here's the definition from [git-scm.com](https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches): > A 'tracking branch' in Git is a local > branch that is connected to a remote > branch. When you push and pull on that > ...
The [ProGit book](http://git-scm.com/book) has [a very good explanation](http://git-scm.com/book/en/Git-Branching-Remote-Branches#_tracking_branches): **Tracking Branches** Checking out a local branch from a remote branch automatically creates what is called a tracking branch. Tracking branches are local branches tha...
277077
How can I find the location of origin/master in git, and how do I change it?
237
2008-11-10 04:50:26
<p>I recently moved a Rails project from Subversion to Git. I followed the tutorial here:<br /> <a href="https://web.archive.org/web/20081205195135/http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/" rel="nofollow noreferrer">Cleanly Migrate Your Subversion Re...
215,487
8,252
2025-07-21 00:48:43
277,186
219
2008-11-10 06:16:45
745
2012-04-04 10:26:29
https://stackoverflow.com/q/277077
https://stackoverflow.com/a/277186
<blockquote> <p><code>1.</code> Find out where Git thinks 'origin/master' is using <a href="http://schacon.github.com/git/git-remote.html#_commands" rel="noreferrer"><code>git-remote</code></a></p> </blockquote> <pre><code>git remote show origin </code></pre> <p>..which will return something like..</p> <pre><code>...
<blockquote> <p><code>1.</code> Find out where Git thinks 'origin/master' is using <a href="http://schacon.github.com/git/git-remote.html#_commands" rel="noreferrer"><code>git-remote</code></a></p> </blockquote> <pre><code>git remote show origin </code></pre> <p>..which will return something like..</p> <pre><code>...
119, 28898, 41346
git, git-push, git-remote
<h1>How can I find the location of origin/master in git, and how do I change it?</h1> <p>I recently moved a Rails project from Subversion to Git. I followed the tutorial here:<br /> <a href="https://web.archive.org/web/20081205195135/http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-reposit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,989
git
# How can I find the location of origin/master in git, and how do I change it? I recently moved a Rails project from Subversion to Git. I followed the tutorial here: [Cleanly Migrate Your Subversion Repository To a GIT Repository](https://web.archive.org/web/20081205195135/http://www.simplisticcomplexity.com/2008/03...
> `1.` Find out where Git thinks 'origin/master' is using [`git-remote`](http://schacon.github.com/git/git-remote.html#_commands) ``` git remote show origin ``` ..which will return something like.. ``` * remote origin URL: me@remote.example.com:~/something.git Remote branch merged with 'git pull' while on branch...
7853332
How to change Git log date formats
231
2011-10-21 17:56:17
<p>I am trying to display the last commit within Git, but I need the date in a special format.</p> <p>I know that the log pretty format <code>%ad</code> respects the <code>--date</code> format, but the only <code>--date</code> format I can find is "short". I want to know the others, and whether I can create a custom o...
203,902
636,786
2024-04-01 04:01:01
7,853,670
219
2011-10-21 18:26:18
273,075
2017-01-08 14:46:26
https://stackoverflow.com/q/7853332
https://stackoverflow.com/a/7853670
<p>The others are (from <code>git help log</code>):</p> <pre><code>--date=(relative|local|default|iso|rfc|short|raw) Only takes effect for dates shown in human-readable format, such as when using "--pretty". log.date config variable sets a default value for log command’s --date option. --date=relative shows da...
<p>The others are (from <code>git help log</code>):</p> <pre><code>--date=(relative|local|default|iso|rfc|short|raw) Only takes effect for dates shown in human-readable format, such as when using "--pretty". log.date config variable sets a default value for log command’s --date option. --date=relative shows da...
119, 1231
command-line, git
<h1>How to change Git log date formats</h1> <p>I am trying to display the last commit within Git, but I need the date in a special format.</p> <p>I know that the log pretty format <code>%ad</code> respects the <code>--date</code> format, but the only <code>--date</code> format I can find is "short". I want to know the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,990
git
# How to change Git log date formats I am trying to display the last commit within Git, but I need the date in a special format. I know that the log pretty format `%ad` respects the `--date` format, but the only `--date` format I can find is "short". I want to know the others, and whether I can create a custom one su...
The others are (from `git help log`): ``` --date=(relative|local|default|iso|rfc|short|raw) Only takes effect for dates shown in human-readable format, such as when using "--pretty". log.date config variable sets a default value for log command’s --date option. --date=relative shows dates relative to the curre...
24815952
Git pull from another repository
154
2014-07-18 01:17:13
<p>I have a repository called <code>Generic</code>, which is a generic application. I have forked it into a repository called <code>Acme</code>, which just builds upon the application stored <code>Generic</code> repository and adds Acme Co branding to it.</p> <p>If I make changes to the core functionality in <code>Gen...
146,327
1,775,780
2023-07-29 09:57:45
24,816,134
219
2014-07-18 01:45:28
3,295,442
2014-07-18 03:24:15
https://stackoverflow.com/q/24815952
https://stackoverflow.com/a/24816134
<p>Issue the following command in your <code>Acme</code> repo. It adds a new remote repository named <code>upstream</code> that points to the <code>Generic</code> repo.</p> <pre><code>git remote add upstream https://location/of/generic.git </code></pre> <p>You can then merge any changes made to <code>Generic</code> i...
<p>Issue the following command in your <code>Acme</code> repo. It adds a new remote repository named <code>upstream</code> that points to the <code>Generic</code> repo.</p> <pre><code>git remote add upstream https://location/of/generic.git </code></pre> <p>You can then merge any changes made to <code>Generic</code> i...
119, 456, 3346, 7330
dvcs, git, repository, version-control
<h1>Git pull from another repository</h1> <p>I have a repository called <code>Generic</code>, which is a generic application. I have forked it into a repository called <code>Acme</code>, which just builds upon the application stored <code>Generic</code> repository and adds Acme Co branding to it.</p> <p>If I make chan...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,991
git
# Git pull from another repository I have a repository called `Generic`, which is a generic application. I have forked it into a repository called `Acme`, which just builds upon the application stored `Generic` repository and adds Acme Co branding to it. If I make changes to the core functionality in `Generic`, I wan...
Issue the following command in your `Acme` repo. It adds a new remote repository named `upstream` that points to the `Generic` repo. ``` git remote add upstream https://location/of/generic.git ``` You can then merge any changes made to `Generic` into the current branch in `Acme` with the following command: ``` git p...
2316677
Can git automatically switch between spaces and tabs?
229
2010-02-23 08:26:04
<p>I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead.</p> <p>Is there a way for git to automatically convert between spaces and tabs (say, 4 spaces = 1 tab) on pushing/fetching? (similar to the CR/LF conversion)</p>
88,019
262,667
2021-12-15 23:30:30
2,318,063
218
2010-02-23 12:32:36
262,667
2014-08-22 10:29:14
https://stackoverflow.com/q/2316677
https://stackoverflow.com/a/2318063
<p>Here is the complete solution:</p> <p>In your repository, add a file <code>.git/info/attributes</code> which contains:</p> <pre><code>*.py filter=tabspace </code></pre> <p><strong>Linux/Unix</strong></p> <p>Now run the commands:</p> <pre><code>git config --global filter.tabspace.smudge 'unexpand --tabs=4 --fir...
<p>Here is the complete solution:</p> <p>In your repository, add a file <code>.git/info/attributes</code> which contains:</p> <pre><code>*.py filter=tabspace </code></pre> <p><strong>Linux/Unix</strong></p> <p>Now run the commands:</p> <pre><code>git config --global filter.tabspace.smudge 'unexpand --tabs=4 --fir...
119, 1177, 8194
git, indentation, tabs
<h1>Can git automatically switch between spaces and tabs?</h1> <p>I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead.</p> <p>Is there a way for git to automatically convert between spaces and tabs (say, 4 spaces = 1 tab) on pushing/fetching?...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,993
git
# Can git automatically switch between spaces and tabs? I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead. Is there a way for git to automatically convert between spaces and tabs (say, 4 spaces = 1 tab) on pushing/fetching? (similar to the...
Here is the complete solution: In your repository, add a file `.git/info/attributes` which contains: ``` *.py filter=tabspace ``` **Linux/Unix** Now run the commands: ``` git config --global filter.tabspace.smudge 'unexpand --tabs=4 --first-only' git config --global filter.tabspace.clean 'expand --tabs=4 --initia...
5288172
git replace local version with remote version
195
2011-03-13 07:52:55
<p>How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?</p>
271,660
140,877
2025-06-11 13:23:55
5,288,284
218
2011-03-13 08:22:46
262,667
2022-06-08 17:54:44
https://stackoverflow.com/q/5288172
https://stackoverflow.com/a/5288284
<p>This is the safest solution:</p> <pre><code>git stash </code></pre> <p>Now you can do whatever you want without fear of conflicts.</p> <p>For instance:</p> <pre><code>git checkout origin/master # or origin/main </code></pre> <p>If you want to include the remote changes in the master branch you can do:</p> <pre><co...
<p>This is the safest solution:</p> <pre><code>git stash </code></pre> <p>Now you can do whatever you want without fear of conflicts.</p> <p>For instance:</p> <pre><code>git checkout origin/master # or origin/main </code></pre> <p>If you want to include the remote changes in the master branch you can do:</p> <pre><co...
119
git
<h1>git replace local version with remote version</h1> <p>How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,994
git
# git replace local version with remote version How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?
This is the safest solution: ``` git stash ``` Now you can do whatever you want without fear of conflicts. For instance: ``` git checkout origin/master # or origin/main ``` If you want to include the remote changes in the master branch you can do: ``` git reset --hard origin/master # or origin/main ``` This w...
1331385
How can I see incoming commits in git?
182
2009-08-25 22:31:30
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/231211/using-git-how-do-i-find-modified-files-between-local-and-remote">Using Git how do I find modified files between local and remote</a> </p> </blockquote> <p>How can I see incoming commits in git? Or even ...
90,091
2,354
2024-10-25 02:23:08
1,331,753
218
2009-08-26 00:30:09
39,975
2009-08-26 00:30:09
https://stackoverflow.com/q/1331385
https://stackoverflow.com/a/1331753
<p><code>incoming</code> isn't quite a direct mapping in git because you can (and I often do) have multiple repos you're pulling from, and each repo has multiple branches.</p> <p>If there were an equivalent of hg's incoming command, it'd probably be this:</p> <pre><code>git fetch &amp;&amp; git log ..origin/master </...
<p><code>incoming</code> isn't quite a direct mapping in git because you can (and I often do) have multiple repos you're pulling from, and each repo has multiple branches.</p> <p>If there were an equivalent of hg's incoming command, it'd probably be this:</p> <pre><code>git fetch &amp;&amp; git log ..origin/master </...
119, 3346
dvcs, git
<h1>How can I see incoming commits in git?</h1> <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/231211/using-git-how-do-i-find-modified-files-between-local-and-remote">Using Git how do I find modified files between local and remote</a> </p> </blockquote> <p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,995
git
# How can I see incoming commits in git? > **Possible Duplicate:** > [Using Git how do I find modified files between local and remote](https://stackoverflow.com/questions/231211/using-git-how-do-i-find-modified-files-between-local-and-remote) How can I see incoming commits in git? Or even better, see what I just `g...
`incoming` isn't quite a direct mapping in git because you can (and I often do) have multiple repos you're pulling from, and each repo has multiple branches. If there were an equivalent of hg's incoming command, it'd probably be this: ``` git fetch && git log ..origin/master ``` That is, "go grab all of the stuff fr...
9059335
How can I get the parents of a merge commit in Git?
178
2012-01-30 04:25:50
<p>Some Git commands take the parent as a revision; others (such as <code>git revert</code>), as a parent number. How can I get the parents for both cases?</p> <p>I don’t want to use the graphical log command as that often requires scrolling down a long tree to find the second parent.</p>
119,119
165,495
2021-06-15 17:23:20
9,059,633
218
2012-01-30 05:12:17
119,963
2018-04-04 15:35:38
https://stackoverflow.com/q/9059335
https://stackoverflow.com/a/9059633
<p>Simple <code>git log &lt;hash&gt;</code> called for a merge commit shows abbreviated hashes of its parents:</p> <pre><code> $ git log -1 395f65d commit 395f65d438b13fb1fded88a330dc06c3b0951046 Merge: 9901923 d28790d ... </code></pre> <p><code>git</code> outputs parents according to their number: the first (left...
<p>Simple <code>git log &lt;hash&gt;</code> called for a merge commit shows abbreviated hashes of its parents:</p> <pre><code> $ git log -1 395f65d commit 395f65d438b13fb1fded88a330dc06c3b0951046 Merge: 9901923 d28790d ... </code></pre> <p><code>git</code> outputs parents according to their number: the first (left...
119, 717
git, merge
<h1>How can I get the parents of a merge commit in Git?</h1> <p>Some Git commands take the parent as a revision; others (such as <code>git revert</code>), as a parent number. How can I get the parents for both cases?</p> <p>I don’t want to use the graphical log command as that often requires scrolling down a long tree ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,996
git
# How can I get the parents of a merge commit in Git? Some Git commands take the parent as a revision; others (such as `git revert`), as a parent number. How can I get the parents for both cases? I don’t want to use the graphical log command as that often requires scrolling down a long tree to find the second parent.
Simple `git log <hash>` called for a merge commit shows abbreviated hashes of its parents: ``` $ git log -1 395f65d commit 395f65d438b13fb1fded88a330dc06c3b0951046 Merge: 9901923 d28790d ... ``` `git` outputs parents according to their number: the first (leftmost) hash is for the first parent, and so on. If all ...
13566200
How can I install from a git subdirectory with pip?
169
2012-11-26 13:49:53
<p>I have a git repository with many folders, one of them being a python module installable with pip, like this:</p> <pre><code>repo.git/ repo.git/folder1/ repo.git/folder2/ repo.git/mymodule/ repo.git/mymodule/__init__.py repo.git/mymodule/setup.py repo.git/mymodule/... </code></pre> <p>Right now I have to do the fo...
82,850
1,410,529
2023-12-06 23:45:18
19,516,714
218
2013-10-22 11:33:43
304,209
2023-08-08 17:53:10
https://stackoverflow.com/q/13566200
https://stackoverflow.com/a/19516714
<p>There is a <a href="https://github.com/pypa/pip/pull/1215" rel="noreferrer">pull request</a> regarding this feature, and it seems to have been merged to develop branch a month ago. The syntax is the <a href="https://github.com/pnasrat/pip/commit/abf27b5bd207024b35885fd1fddd7803b488a3d4" rel="noreferrer">following</a...
<p>There is a <a href="https://github.com/pypa/pip/pull/1215" rel="noreferrer">pull request</a> regarding this feature, and it seems to have been merged to develop branch a month ago. The syntax is the <a href="https://github.com/pnasrat/pip/commit/abf27b5bd207024b35885fd1fddd7803b488a3d4" rel="noreferrer">following</a...
16, 119, 5119
git, pip, python
<h1>How can I install from a git subdirectory with pip?</h1> <p>I have a git repository with many folders, one of them being a python module installable with pip, like this:</p> <pre><code>repo.git/ repo.git/folder1/ repo.git/folder2/ repo.git/mymodule/ repo.git/mymodule/__init__.py repo.git/mymodule/setup.py repo.git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,997
git
# How can I install from a git subdirectory with pip? I have a git repository with many folders, one of them being a python module installable with pip, like this: ``` repo.git/ repo.git/folder1/ repo.git/folder2/ repo.git/mymodule/ repo.git/mymodule/__init__.py repo.git/mymodule/setup.py repo.git/mymodule/... ``` R...
There is a [pull request](https://github.com/pypa/pip/pull/1215) regarding this feature, and it seems to have been merged to develop branch a month ago. The syntax is the [following](https://github.com/pnasrat/pip/commit/abf27b5bd207024b35885fd1fddd7803b488a3d4): ``` pip install -e "git+https://git.repo/some_repo.git#...
13043357
Git sign off previous commits?
153
2012-10-24 05:11:05
<p>I was wondering how to sign(<code>-s</code>) off previous commits that I have made in the past in git?</p> <p>CLARIFICATION: Git has confusingly <a href="https://medium.com/@MarkEmeis/git-commit-signoff-vs-signing-9f37ee272b14" rel="noreferrer">similarly named concepts</a> <code>git commit -s, --signoff</code> (lowe...
147,353
689,476
2023-05-18 09:27:30
15,667,644
218
2013-03-27 19:22:56
1,458,605
2022-11-10 17:26:09
https://stackoverflow.com/q/13043357
https://stackoverflow.com/a/15667644
<p>To signoff the previous commit, use amend option:</p> <pre><code>git commit --amend --signoff </code></pre> <p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.13.0.txt" rel="noreferrer">Git 2.13</a>, you can use the <code>--signoff</code> rebase option to specify range of commits to si...
<p>To signoff the previous commit, use amend option:</p> <pre><code>git commit --amend --signoff </code></pre> <p>Since <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.13.0.txt" rel="noreferrer">Git 2.13</a>, you can use the <code>--signoff</code> rebase option to specify range of commits to si...
119, 5254, 119594
git, git-sign, sign
<h1>Git sign off previous commits?</h1> <p>I was wondering how to sign(<code>-s</code>) off previous commits that I have made in the past in git?</p> <p>CLARIFICATION: Git has confusingly <a href="https://medium.com/@MarkEmeis/git-commit-signoff-vs-signing-9f37ee272b14" rel="noreferrer">similarly named concepts</a> <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,998
git
# Git sign off previous commits? I was wondering how to sign(`-s`) off previous commits that I have made in the past in git? CLARIFICATION: Git has confusingly [similarly named concepts](https://medium.com/@MarkEmeis/git-commit-signoff-vs-signing-9f37ee272b14) `git commit -s, --signoff` (lower case -s) and `git commi...
To signoff the previous commit, use amend option: ``` git commit --amend --signoff ``` Since [Git 2.13](https://github.com/git/git/blob/master/Documentation/RelNotes/2.13.0.txt), you can use the `--signoff` rebase option to specify range of commits to signoff (credits to [@sschuberth](https://stackoverflow.com/users/...
9185053
Git SVN error: a Git process crashed in the repository earlier
116
2012-02-07 22:33:57
<p>I was just trying to commit changes to the Git master. From what I have read, it seems that the idea is to delete the lock file. The message says:</p> <blockquote> <p>make sure no other Git processes are running and remove the file manually</p> </blockquote> <p>Perhaps someone knows, which file to remove and how...
110,528
1,094,338
2024-05-01 09:18:25
9,185,170
218
2012-02-07 22:44:55
14,660
2012-02-07 22:44:55
https://stackoverflow.com/q/9185053
https://stackoverflow.com/a/9185170
<p>The file in question is likely <code>.git/index.lock</code> and it <a href="http://git.661346.n2.nabble.com/Recovering-the-index-after-a-git-crash-td2267712.html" rel="noreferrer">should be safe to just remove it if you have no other git processes running</a>. Make sure a git-svn command isn't hanging.</p> <p>PS ...
<p>The file in question is likely <code>.git/index.lock</code> and it <a href="http://git.661346.n2.nabble.com/Recovering-the-index-after-a-git-crash-td2267712.html" rel="noreferrer">should be safe to just remove it if you have no other git processes running</a>. Make sure a git-svn command isn't hanging.</p> <p>PS ...
119, 6452
git, git-svn
<h1>Git SVN error: a Git process crashed in the repository earlier</h1> <p>I was just trying to commit changes to the Git master. From what I have read, it seems that the idea is to delete the lock file. The message says:</p> <blockquote> <p>make sure no other Git processes are running and remove the file manually</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
14,999
git
# Git SVN error: a Git process crashed in the repository earlier I was just trying to commit changes to the Git master. From what I have read, it seems that the idea is to delete the lock file. The message says: > make sure no other Git processes are running and remove the file manually Perhaps someone knows, which ...
The file in question is likely `.git/index.lock` and it [should be safe to just remove it if you have no other git processes running](http://git.661346.n2.nabble.com/Recovering-the-index-after-a-git-crash-td2267712.html). Make sure a git-svn command isn't hanging. PS My usual approach to fixing git-svn problems is to ...
32232655
go get results in 'terminal prompts disabled' error for GitHub private repo
471
2015-08-26 17:10:13
<p>I created the private repo examplesite/myprivaterepo using the GitHub UI from my browser.</p> <p>Then I went to my go directory (on the desktop) and cloned it:</p> <pre><code>$ cd $GOPATH $ go get github.com/examplesite/myprivaterepo </code></pre> <p>So far so good. Created the file <code>scheduler.go</code>, added ...
654,658
478,311
2024-10-24 15:25:31
60,323,360
217
2020-02-20 15:29:04
1,334,561
2022-12-24 00:36:48
https://stackoverflow.com/q/32232655
https://stackoverflow.com/a/60323360
<p>It complains because it needs to use <code>ssh</code> instead of <code>https</code> but your git is still configured with https. so basically as others mentioned previously you need to either enable prompts or to configure git to use <code>ssh</code> instead of <code>https</code>. a simple way to do this by running ...
<p>It complains because it needs to use <code>ssh</code> instead of <code>https</code> but your git is still configured with https. so basically as others mentioned previously you need to either enable prompts or to configure git to use <code>ssh</code> instead of <code>https</code>. a simple way to do this by running ...
119, 15627
git, go
<h1>go get results in 'terminal prompts disabled' error for GitHub private repo</h1> <p>I created the private repo examplesite/myprivaterepo using the GitHub UI from my browser.</p> <p>Then I went to my go directory (on the desktop) and cloned it:</p> <pre><code>$ cd $GOPATH $ go get github.com/examplesite/myprivaterep...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,000
git
# go get results in 'terminal prompts disabled' error for GitHub private repo I created the private repo examplesite/myprivaterepo using the GitHub UI from my browser. Then I went to my go directory (on the desktop) and cloned it: ``` $ cd $GOPATH $ go get github.com/examplesite/myprivaterepo ``` So far so good. Cr...
It complains because it needs to use `ssh` instead of `https` but your git is still configured with https. so basically as others mentioned previously you need to either enable prompts or to configure git to use `ssh` instead of `https`. a simple way to do this by running the following: ``` git config --global --add u...
5970879
git rebase: "error: cannot stat 'file': Permission denied"
397
2011-05-11 21:33:34
<p>I'm using git with Windows Terminal, and made a small commit followed by a large one. I decided to use <code>git rebase</code> to squash the two commits together before pushing them. (I've never done this before.)</p> <p>So I did:</p> <p><code>git rebase -i HEAD~2</code></p> <p>This gave me my editor, where I chos...
309,592
5,486
2025-07-02 07:51:47
5,970,967
217
2011-05-11 21:41:59
19,563
2011-05-11 21:41:59
https://stackoverflow.com/q/5970879
https://stackoverflow.com/a/5970967
<p>I've only ever seen this error on Windows and what it seems to mean is that something blocked git from modifying a file at the moment when it tried to a apply a patch.</p> <p>Windows tends to give processes exclusive access to files when it shouldn't really be necessary, in the past virus checkers have been one sou...
<p>I've only ever seen this error on Windows and what it seems to mean is that something blocked git from modifying a file at the moment when it tried to a apply a patch.</p> <p>Windows tends to give processes exclusive access to files when it shouldn't really be necessary, in the past virus checkers have been one sou...
119, 29934
git, git-rebase
<h1>git rebase: "error: cannot stat 'file': Permission denied"</h1> <p>I'm using git with Windows Terminal, and made a small commit followed by a large one. I decided to use <code>git rebase</code> to squash the two commits together before pushing them. (I've never done this before.)</p> <p>So I did:</p> <p><code>git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,001
git
# git rebase: "error: cannot stat 'file': Permission denied" I'm using git with Windows Terminal, and made a small commit followed by a large one. I decided to use `git rebase` to squash the two commits together before pushing them. (I've never done this before.) So I did: `git rebase -i HEAD~2` This gave me my edi...
I've only ever seen this error on Windows and what it seems to mean is that something blocked git from modifying a file at the moment when it tried to a apply a patch. Windows tends to give processes exclusive access to files when it shouldn't really be necessary, in the past virus checkers have been one source of sus...
2180270
Check if current directory is a Git repository
363
2010-02-01 21:40:43
<p>I am writing a series of scripts for Git management in zsh.</p> <p>How do I check if the current directory is a Git repository? (When I'm not in a Git repo, I don't want to execute a bunch of commands and get a bunch of <code>fatal: Not a git repository</code> responses).</p>
224,349
247,265
2025-07-24 18:52:14
2,180,367
217
2010-02-01 21:57:38
106,527
2020-04-15 05:26:22
https://stackoverflow.com/q/2180270
https://stackoverflow.com/a/2180367
<p>Copied from the bash completion file, the following is a naive way to do it</p> <pre><code># Copyright (C) 2006,2007 Shawn O. Pearce &lt;spearce@spearce.org&gt; # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). # Distributed under the GNU General Public License, version 2.0. if [ -d .git ]; the...
<p>Copied from the bash completion file, the following is a naive way to do it</p> <pre><code># Copyright (C) 2006,2007 Shawn O. Pearce &lt;spearce@spearce.org&gt; # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). # Distributed under the GNU General Public License, version 2.0. if [ -d .git ]; the...
119
git
<h1>Check if current directory is a Git repository</h1> <p>I am writing a series of scripts for Git management in zsh.</p> <p>How do I check if the current directory is a Git repository? (When I'm not in a Git repo, I don't want to execute a bunch of commands and get a bunch of <code>fatal: Not a git repository</code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,002
git
# Check if current directory is a Git repository I am writing a series of scripts for Git management in zsh. How do I check if the current directory is a Git repository? (When I'm not in a Git repo, I don't want to execute a bunch of commands and get a bunch of `fatal: Not a git repository` responses).
Copied from the bash completion file, the following is a naive way to do it ``` # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). # Distributed under the GNU General Public License, version 2.0. if [ -d .git ]; then echo .git; else ...
4783599
Rebasing a Git merge commit
288
2011-01-24 15:15:11
<p>Take the following case:</p> <p>I have some work in a topic branch and now I'm ready to merge back to master:</p> <pre><code>* eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 </code></pre> <p>I perform the merge from master, resolve the conflicts and now I have:</p> <pre><code>* 810...
211,821
525,545
2022-01-05 17:49:48
4,784,082
217
2011-01-24 16:01:03
394,487
2020-09-18 16:22:44
https://stackoverflow.com/q/4783599
https://stackoverflow.com/a/4784082
<p>There are two options here.</p> <p>One is to do an interactive rebase and edit the merge commit, redo the merge manually and continue the rebase.</p> <p>Another is to use the <code>--rebase-merges</code> option on <code>git rebase</code>, which is described as follows from the manual:</p> <blockquote> <p>By default,...
<p>There are two options here.</p> <p>One is to do an interactive rebase and edit the merge commit, redo the merge manually and continue the rebase.</p> <p>Another is to use the <code>--rebase-merges</code> option on <code>git rebase</code>, which is described as follows from the manual:</p> <blockquote> <p>By default,...
119, 717, 8974, 29934, 91259
git, git-rebase, git-rewrite-history, merge, rebase
<h1>Rebasing a Git merge commit</h1> <p>Take the following case:</p> <p>I have some work in a topic branch and now I'm ready to merge back to master:</p> <pre><code>* eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 </code></pre> <p>I perform the merge from master, resolve the conflicts a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,003
git
# Rebasing a Git merge commit Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: ``` * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 ``` I perform the merge from master, resolve the conflicts and now I have: ``` * 8101fe3 Merge...
There are two options here. One is to do an interactive rebase and edit the merge commit, redo the merge manually and continue the rebase. Another is to use the `--rebase-merges` option on `git rebase`, which is described as follows from the manual: > By default, a rebase will simply drop merge commits from the todo...
31278902
How to shallow clone a specific commit with depth 1?
191
2015-07-07 20:43:48
<p>Is it possible to shallow clone a specific commit in a repository, i.e. with depth 1? Something like</p> <pre><code>git clone http://myrepo.git 728a4d --depth 1 </code></pre> <p>to get the repository state as it is at the commit with SHA <code>728a4d...</code>?</p> <p>The motivation is to avoid having to clone th...
90,284
1,748,450
2026-01-01 10:23:35
43,136,160
217
2017-03-31 08:36:32
1,127,485
2026-01-01 10:23:35
https://stackoverflow.com/q/31278902
https://stackoverflow.com/a/43136160
<p>Starting with <a href="https://github.blog/open-source/git/highlights-from-git-2-49/" rel="nofollow noreferrer">Git 2.49.0</a>, there's a new <code>--revision</code> option for <code>git clone</code> &quot;which fetches history leading up to the specified revision, regardless of whether or not there is a branch or t...
<p>Starting with <a href="https://github.blog/open-source/git/highlights-from-git-2-49/" rel="nofollow noreferrer">Git 2.49.0</a>, there's a new <code>--revision</code> option for <code>git clone</code> &quot;which fetches history leading up to the specified revision, regardless of whether or not there is a branch or t...
119, 74346
git, shallow-clone
<h1>How to shallow clone a specific commit with depth 1?</h1> <p>Is it possible to shallow clone a specific commit in a repository, i.e. with depth 1? Something like</p> <pre><code>git clone http://myrepo.git 728a4d --depth 1 </code></pre> <p>to get the repository state as it is at the commit with SHA <code>728a4d......
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,004
git
# How to shallow clone a specific commit with depth 1? Is it possible to shallow clone a specific commit in a repository, i.e. with depth 1? Something like ``` git clone http://myrepo.git 728a4d --depth 1 ``` to get the repository state as it is at the commit with SHA `728a4d...`? The motivation is to avoid having ...
Starting with [Git 2.49.0](https://github.blog/open-source/git/highlights-from-git-2-49/), there's a new `--revision` option for `git clone` "which fetches history leading up to the specified revision, regardless of whether or not there is a branch or tag pointing at it". Together with `--depth 1` this should be a yet ...
1362952
Detail change after Git pull
138
2009-09-01 15:03:52
<p>After a Git pull, its output gives a summary on the change amount.</p> <p>How can I see each or some of the files detailed changes?</p> <p>Okay, here is my question to Jefromi:</p> <ol> <li><p>How do I know if I was pulling to master? All I did is "git pull".</p></li> <li><p>What does master point to and what is ...
52,845
156,458
2017-12-31 19:35:01
1,362,990
217
2009-09-01 15:09:03
119,963
2017-12-31 19:35:01
https://stackoverflow.com/q/1362952
https://stackoverflow.com/a/1362990
<p>Suppose you're pulling to master. You can refer to the previous position of <code>master</code> by <code>master@{1}</code> (or even <code>master@{10.minutes.ago}</code>; see the specifying revisions section of the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html" rel="noreferrer">git-rev-p...
<p>Suppose you're pulling to master. You can refer to the previous position of <code>master</code> by <code>master@{1}</code> (or even <code>master@{10.minutes.ago}</code>; see the specifying revisions section of the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html" rel="noreferrer">git-rev-p...
119, 28896
git, git-pull
<h1>Detail change after Git pull</h1> <p>After a Git pull, its output gives a summary on the change amount.</p> <p>How can I see each or some of the files detailed changes?</p> <p>Okay, here is my question to Jefromi:</p> <ol> <li><p>How do I know if I was pulling to master? All I did is "git pull".</p></li> <li><p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,007
git
# Detail change after Git pull After a Git pull, its output gives a summary on the change amount. How can I see each or some of the files detailed changes? Okay, here is my question to Jefromi: 1. How do I know if I was pulling to master? All I did is "git pull". 2. What does master point to and what is the differe...
Suppose you're pulling to master. You can refer to the previous position of `master` by `master@{1}` (or even `master@{10.minutes.ago}`; see the specifying revisions section of the [git-rev-parse man page](http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html)), so that you can do things like - See all of...
30239152
Specify extras_require with pip install -e
136
2015-05-14 13:51:50
<p>How can one manage to install extras_requires with pip when installing from a git repository ?</p> <p>I know that you can do <code>pip install project[extra]</code> when the project is on pypi.<br> And you have to do <code>pip install -e git+https://github.com/user/project.git#egg=project</code> for a git repo but ...
65,307
2,894,711
2026-01-12 14:40:12
30,239,714
217
2015-05-14 14:18:14
471,899
2023-06-30 21:35:12
https://stackoverflow.com/q/30239152
https://stackoverflow.com/a/30239714
<p>This should work, <a href="https://pip.pypa.io/en/stable/cli/pip_install/#examples" rel="noreferrer">per examples #6 and #7</a></p> <p>For remote repos:</p> <pre><code>pip install -e git+https://github.com/user/project.git#egg=project[extra] </code></pre> <p>And this for local ones (thanks to @Kurt-Bourbaki):</p> <p...
<p>This should work, <a href="https://pip.pypa.io/en/stable/cli/pip_install/#examples" rel="noreferrer">per examples #6 and #7</a></p> <p>For remote repos:</p> <pre><code>pip install -e git+https://github.com/user/project.git#egg=project[extra] </code></pre> <p>And this for local ones (thanks to @Kurt-Bourbaki):</p> <p...
16, 119, 5119
git, pip, python
<h1>Specify extras_require with pip install -e</h1> <p>How can one manage to install extras_requires with pip when installing from a git repository ?</p> <p>I know that you can do <code>pip install project[extra]</code> when the project is on pypi.<br> And you have to do <code>pip install -e git+https://github.com/use...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,008
git
# Specify extras_require with pip install -e How can one manage to install extras_requires with pip when installing from a git repository ? I know that you can do `pip install project[extra]` when the project is on pypi. And you have to do `pip install -e git+https://github.com/user/project.git#egg=project` for a g...
This should work, [per examples #6 and #7](https://pip.pypa.io/en/stable/cli/pip_install/#examples) For remote repos: ``` pip install -e git+https://github.com/user/project.git#egg=project[extra] ``` And this for local ones (thanks to @Kurt-Bourbaki): ``` pip install -e .[extra] ``` --- As per @Kurt-Bourbaki: If...
32661484
OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid
122
2015-09-18 21:42:34
<p>I get this error in Android Studio:</p> <blockquote> <p>Can't start Git: /usr/bin/git Probably the path to Git executable is not valid.</p> </blockquote> <p>It gives me an option to fix it, where it takes me to the area in Android Studio to set the path to git. I see it is set to </p> <blockquote> ...
101,724
3,935,156
2024-03-14 09:16:14
32,672,274
217
2015-09-19 19:20:09
2,556,220
2019-02-04 22:03:20
https://stackoverflow.com/q/32661484
https://stackoverflow.com/a/32672274
<p>You should run <code>sudo git --version</code> on your command line. It will ask you to agree to the git xcode license agreement, once done everything will work as before.</p>
<p>You should run <code>sudo git --version</code> on your command line. It will ask you to agree to the git xcode license agreement, once done everything will work as before.</p>
119, 369, 91905
android-studio, git, macos
<h1>OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid</h1> <p>I get this error in Android Studio:</p> <blockquote> <p>Can't start Git: /usr/bin/git Probably the path to Git executable is not valid.</p> </blockquote> <p>It gives me an option to fix it, where it takes ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,009
git
# OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid I get this error in Android Studio: > Can't start Git: /usr/bin/git > Probably the path to Git executable is not valid. It gives me an option to fix it, where it takes me to the area in Android Studio to set the path to git. I se...
You should run `sudo git --version` on your command line. It will ask you to agree to the git xcode license agreement, once done everything will work as before.
1486819
Which Git commit stats are easy to pull
108
2009-09-28 12:43:43
<p>Previously I have enjoyed TortoiseSvn's ability to generate simple commit stats for a given SVN repository. I wonder what is available in Git and am particularly interested in :</p> <ul> <li>Number of commits per user</li> <li>Number of lines changed per user</li> <li>activity over time (for instance aggregated wee...
82,902
109,305
2020-03-28 19:47:50
1,487,540
217
2009-09-28 15:01:35
825
2009-09-28 15:01:35
https://stackoverflow.com/q/1486819
https://stackoverflow.com/a/1487540
<p>Actually, git already has a command for this:</p> <pre><code>git shortlog </code></pre> <p>in your case, it sounds like you're interested in this form:</p> <pre><code>git shortlog -sne </code></pre> <p>See the <code>--help</code> for various options.</p> <p>You may also be interested in the <a href="http://gits...
<p>Actually, git already has a command for this:</p> <pre><code>git shortlog </code></pre> <p>in your case, it sounds like you're interested in this form:</p> <pre><code>git shortlog -sne </code></pre> <p>See the <code>--help</code> for various options.</p> <p>You may also be interested in the <a href="http://gits...
119, 402, 942, 19158
code-statistics, git, logging, statistics
<h1>Which Git commit stats are easy to pull</h1> <p>Previously I have enjoyed TortoiseSvn's ability to generate simple commit stats for a given SVN repository. I wonder what is available in Git and am particularly interested in :</p> <ul> <li>Number of commits per user</li> <li>Number of lines changed per user</li> <l...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,011
git
# Which Git commit stats are easy to pull Previously I have enjoyed TortoiseSvn's ability to generate simple commit stats for a given SVN repository. I wonder what is available in Git and am particularly interested in : - Number of commits per user - Number of lines changed per user - activity over time (for instance...
Actually, git already has a command for this: ``` git shortlog ``` in your case, it sounds like you're interested in this form: ``` git shortlog -sne ``` See the `--help` for various options. You may also be interested in the [GitStats project](http://gitstats.sourceforge.net/). They have a few examples, including...
28429819
! [rejected] master -> master (fetch first)
173
2015-02-10 10:51:30
<p>Is there a good way to explain how to resolve "<code>! [rejected] master -&gt; master (fetch first)'</code>" in Git?</p> <p>When I use this command <code>$ git push origin master</code> it display an error message.</p> <pre><code>! [rejected] master -&gt; master (fetch first) error: failed to push some re...
659,660
1,103,302
2024-05-30 15:29:34
28,429,887
216
2015-02-10 10:55:23
1,892,660
2017-09-17 12:16:14
https://stackoverflow.com/q/28429819
https://stackoverflow.com/a/28429887
<p>The answer is there, git is telling you to fetch first.</p> <p>Probably somebody else has pushed to master already, and your commit is behind. Therefore you have to fetch, merge the changeset, and then you'll be able to push again.</p> <p>If you don't (or even worse, if you force it by using the <code>--force</cod...
<p>The answer is there, git is telling you to fetch first.</p> <p>Probably somebody else has pushed to master already, and your commit is behind. Therefore you have to fetch, merge the changeset, and then you'll be able to push again.</p> <p>If you don't (or even worse, if you force it by using the <code>--force</cod...
119, 28898
git, git-push
<h1>! [rejected] master -> master (fetch first)</h1> <p>Is there a good way to explain how to resolve "<code>! [rejected] master -&gt; master (fetch first)'</code>" in Git?</p> <p>When I use this command <code>$ git push origin master</code> it display an error message.</p> <pre><code>! [rejected] master -&g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,013
git
# ! [rejected] master -> master (fetch first) Is there a good way to explain how to resolve "`! [rejected] master -> master (fetch first)'`" in Git? When I use this command `$ git push origin master` it display an error message. ``` ! [rejected] master -> master (fetch first) error: failed to push some refs t...
The answer is there, git is telling you to fetch first. Probably somebody else has pushed to master already, and your commit is behind. Therefore you have to fetch, merge the changeset, and then you'll be able to push again. If you don't (or even worse, if you force it by using the `--force` option), you can mess up ...
13867705
git grep by file extensions
136
2012-12-13 20:13:25
<p>I know that, if I wanted to grep for a pattern only on files with certain extensions, I could do this:</p> <pre><code>// searches recursively and matches case insensitively in only javascript files // for "res" from the current directory grep -iIr --include=*.js res ./ </code></pre> <p>I've been trying to search f...
50,681
696,130
2025-02-14 13:35:52
13,868,603
215
2012-12-13 21:16:09
19,563
2012-12-13 21:16:09
https://stackoverflow.com/q/13867705
https://stackoverflow.com/a/13868603
<p>Yes, for example:</p> <pre><code>git grep res -- '*.js' </code></pre>
<p>Yes, for example:</p> <pre><code>git grep res -- '*.js' </code></pre>
119, 1271, 1280
file-extension, git, grep
<h1>git grep by file extensions</h1> <p>I know that, if I wanted to grep for a pattern only on files with certain extensions, I could do this:</p> <pre><code>// searches recursively and matches case insensitively in only javascript files // for "res" from the current directory grep -iIr --include=*.js res ./ </code></...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,014
git
# git grep by file extensions I know that, if I wanted to grep for a pattern only on files with certain extensions, I could do this: ``` // searches recursively and matches case insensitively in only javascript files // for "res" from the current directory grep -iIr --include=*.js res ./ ``` I've been trying to sear...
Yes, for example: ``` git grep res -- '*.js' ```
8049612
Calculating distance between two geographic locations
87
2011-11-08 11:22:51
<p>please shed some light on this situation</p> <p>Right now i have two array having latitude and longitude of nearby places and also have the user location latiude and longiude now i want to calculate the distance between user location and nearby places and want to show them in listview.</p> <p>I know that there is ...
162,277
909,317
2023-03-31 03:18:13
8,050,255
215
2011-11-08 12:20:21
555,806
2020-11-29 14:42:32
https://stackoverflow.com/q/8049612
https://stackoverflow.com/a/8050255
<p><a href="http://developer.android.com/reference/android/location/Location.html" rel="noreferrer">http://developer.android.com/reference/android/location/Location.html</a></p> <p>Look into distanceTo</p> <blockquote> <p>Returns the approximate distance in meters between this location and the given location. Distance ...
<p><a href="http://developer.android.com/reference/android/location/Location.html" rel="noreferrer">http://developer.android.com/reference/android/location/Location.html</a></p> <p>Look into distanceTo</p> <blockquote> <p>Returns the approximate distance in meters between this location and the given location. Distance ...
1386, 1597, 6238, 20301
android, distance, latitude-longitude, location
<h1>Calculating distance between two geographic locations</h1> <p>please shed some light on this situation</p> <p>Right now i have two array having latitude and longitude of nearby places and also have the user location latiude and longiude now i want to calculate the distance between user location and nearby places a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,015
git
# Calculating distance between two geographic locations please shed some light on this situation Right now i have two array having latitude and longitude of nearby places and also have the user location latiude and longiude now i want to calculate the distance between user location and nearby places and want to show ...
<http://developer.android.com/reference/android/location/Location.html> Look into distanceTo > Returns the approximate distance in meters between this location and > the given location. Distance is defined using the WGS84 ellipsoid. or distanceBetween > Computes the approximate distance in meters between two locati...
23241052
What does git push origin HEAD mean?
177
2014-04-23 10:04:15
<p>I found, in the <a href="http://git-scm.com/docs/git-push" rel="noreferrer">official guide</a>:</p> <blockquote> <p><code>git push origin HEAD</code></p> <p>A handy way to push the current branch to the same name on the remote.</p> </blockquote> <p>However, the meaning of the command is not clear to me. Why does it ...
238,153
2,055,152
2020-12-08 08:03:43
23,241,152
214
2014-04-23 10:08:29
171,318
2014-04-23 10:08:29
https://stackoverflow.com/q/23241052
https://stackoverflow.com/a/23241152
<p><code>HEAD</code> points to the top of the current branch. <code>git</code> can obtain the branch name from that. So it's the same as:</p> <pre><code>git push origin CURRENT_BRANCH_NAME </code></pre> <p>but you don't have to remember/type the current branch name. Also it prevents you from pushing to the wrong remo...
<p><code>HEAD</code> points to the top of the current branch. <code>git</code> can obtain the branch name from that. So it's the same as:</p> <pre><code>git push origin CURRENT_BRANCH_NAME </code></pre> <p>but you don't have to remember/type the current branch name. Also it prevents you from pushing to the wrong remo...
119, 28898
git, git-push
<h1>What does git push origin HEAD mean?</h1> <p>I found, in the <a href="http://git-scm.com/docs/git-push" rel="noreferrer">official guide</a>:</p> <blockquote> <p><code>git push origin HEAD</code></p> <p>A handy way to push the current branch to the same name on the remote.</p> </blockquote> <p>However, the meaning o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,016
git
# What does git push origin HEAD mean? I found, in the [official guide](http://git-scm.com/docs/git-push): > `git push origin HEAD` > > A handy way to push the current branch to the > same name on the remote. However, the meaning of the command is not clear to me. Why does it have this effect? I haven't been able t...
`HEAD` points to the top of the current branch. `git` can obtain the branch name from that. So it's the same as: ``` git push origin CURRENT_BRANCH_NAME ``` but you don't have to remember/type the current branch name. Also it prevents you from pushing to the wrong remote branch by accident. If you want to push a dif...
4493936
Could I change my name and surname in all previous commits?
125
2010-12-20 21:04:07
<p>I would like to change my name, surname and email in my all commits, is it possible?</p>
45,473
549,162
2019-10-05 21:03:39
4,494,037
214
2010-12-20 21:16:52
19,750
2018-06-01 18:27:09
https://stackoverflow.com/q/4493936
https://stackoverflow.com/a/4494037
<p>Use <a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git-filter-branch</code></a>.</p> <pre><code>git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Josh Lee" ]; then export GIT_AUTHOR_NAME="Hobo Bob"; export GIT_AUTHOR_EMAIL=hobo@example.com; fi; git commit-tree "$@"' </cod...
<p>Use <a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git-filter-branch</code></a>.</p> <pre><code>git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Josh Lee" ]; then export GIT_AUTHOR_NAME="Hobo Bob"; export GIT_AUTHOR_EMAIL=hobo@example.com; fi; git commit-tree "$@"' </cod...
119, 46509
git, git-filter-branch
<h1>Could I change my name and surname in all previous commits?</h1> <p>I would like to change my name, surname and email in my all commits, is it possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,018
git
# Could I change my name and surname in all previous commits? I would like to change my name, surname and email in my all commits, is it possible?
Use [`git-filter-branch`](http://git-scm.com/docs/git-filter-branch). ``` git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Josh Lee" ]; then export GIT_AUTHOR_NAME="Hobo Bob"; export GIT_AUTHOR_EMAIL=hobo@example.com; fi; git commit-tree "$@"' ``` This only affects the author, not the committer (whic...
20381677
In a git merge conflict, what are the BACKUP, BASE, LOCAL, and REMOTE files that are generated?
189
2013-12-04 17:14:02
<p>I assume the LOCAL and REMOTE files are just what their name suggests, but what are BASE and BACKUP for?</p>
103,311
3,015,278
2024-04-16 07:55:05
20,382,333
213
2013-12-04 17:48:03
729,881
2013-12-04 17:48:03
https://stackoverflow.com/q/20381677
https://stackoverflow.com/a/20382333
<p>Git performs a three-way merge, finding the common ancestor (aka "merge base") of the two branches you are merging. When you invoke <code>git mergetool</code> on a conflict, it will produce these files suitable for feeding into a typical 3-way merge tool. Thus:</p> <ul> <li><code>foo.LOCAL</code>: the "ours" side...
<p>Git performs a three-way merge, finding the common ancestor (aka "merge base") of the two branches you are merging. When you invoke <code>git mergetool</code> on a conflict, it will produce these files suitable for feeding into a typical 3-way merge tool. Thus:</p> <ul> <li><code>foo.LOCAL</code>: the "ours" side...
119
git
<h1>In a git merge conflict, what are the BACKUP, BASE, LOCAL, and REMOTE files that are generated?</h1> <p>I assume the LOCAL and REMOTE files are just what their name suggests, but what are BASE and BACKUP for?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,019
git
# In a git merge conflict, what are the BACKUP, BASE, LOCAL, and REMOTE files that are generated? I assume the LOCAL and REMOTE files are just what their name suggests, but what are BASE and BACKUP for?
Git performs a three-way merge, finding the common ancestor (aka "merge base") of the two branches you are merging. When you invoke `git mergetool` on a conflict, it will produce these files suitable for feeding into a typical 3-way merge tool. Thus: - `foo.LOCAL`: the "ours" side of the conflict - ie, your branch (`H...
11835948
Git cherry pick vs rebase
182
2012-08-06 21:07:58
<p>I have recently started working with Git.</p> <p>Going over the <a href="http://git-scm.com/book" rel="noreferrer">Git book</a> online I found the following under the &quot;Git Rebase&quot; section:</p> <blockquote> <p>With the rebase command, you can take all the changes that were committed on one branch and replay...
118,682
494,143
2025-07-17 14:03:37
11,837,630
213
2012-08-07 00:08:03
720,999
2025-07-17 14:03:37
https://stackoverflow.com/q/11835948
https://stackoverflow.com/a/11837630
<p>Since the time <code>git cherry-pick</code> learned to be able to apply multiple commits, the distinction indeed became somewhat moot, but this is something to be called convergent evolution ;-)</p> <p>The true distinction lies in original intent to create both tools:</p> <ul> <li><p><code>git rebase</code>'s task i...
<p>Since the time <code>git cherry-pick</code> learned to be able to apply multiple commits, the distinction indeed became somewhat moot, but this is something to be called convergent evolution ;-)</p> <p>The true distinction lies in original intent to create both tools:</p> <ul> <li><p><code>git rebase</code>'s task i...
119, 456
git, version-control
<h1>Git cherry pick vs rebase</h1> <p>I have recently started working with Git.</p> <p>Going over the <a href="http://git-scm.com/book" rel="noreferrer">Git book</a> online I found the following under the &quot;Git Rebase&quot; section:</p> <blockquote> <p>With the rebase command, you can take all the changes that were...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,020
git
# Git cherry pick vs rebase I have recently started working with Git. Going over the [Git book](http://git-scm.com/book) online I found the following under the "Git Rebase" section: > With the rebase command, you can take all the changes that were > committed on one branch and replay them on another one. (Quoted fr...
Since the time `git cherry-pick` learned to be able to apply multiple commits, the distinction indeed became somewhat moot, but this is something to be called convergent evolution ;-) The true distinction lies in original intent to create both tools: - `git rebase`'s task is to forward-port a series of changes a deve...
23303549
What are commit-ish and tree-ish in Git?
159
2014-04-25 21:41:48
<h2>The Question</h2> <p>What are specific examples of commit-ish and tree-ish in Git?</p> <p>The Stack Overflow question <a href="https://stackoverflow.com/q/4044368/456814">"What does tree-ish mean in git?"</a> deals with tree-ish specifically, but I want to understand more about <strong><em>both</em></strong>.</p>...
46,434
null
2017-08-16 09:20:05
23,303,550
213
2014-04-25 21:41:48
null
2014-04-25 21:47:03
https://stackoverflow.com/q/23303549
https://stackoverflow.com/a/23303550
<h1>The Short Answer (TL;DR)</h1> <p>Here's a complete list of commit-ish and tree-ish identifiers (from <a href="https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions">the Git revisions documentation</a>):</p> <pre><code>-------------------------------------------------------------...
<h1>The Short Answer (TL;DR)</h1> <p>Here's a complete list of commit-ish and tree-ish identifiers (from <a href="https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions">the Git revisions documentation</a>):</p> <pre><code>-------------------------------------------------------------...
119
git
<h1>What are commit-ish and tree-ish in Git?</h1> <h2>The Question</h2> <p>What are specific examples of commit-ish and tree-ish in Git?</p> <p>The Stack Overflow question <a href="https://stackoverflow.com/q/4044368/456814">"What does tree-ish mean in git?"</a> deals with tree-ish specifically, but I want to underst...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,021
git
# What are commit-ish and tree-ish in Git? ## The Question What are specific examples of commit-ish and tree-ish in Git? The Stack Overflow question ["What does tree-ish mean in git?"](https://stackoverflow.com/q/4044368/456814) deals with tree-ish specifically, but I want to understand more about ***both***. ## Ba...
# The Short Answer (TL;DR) Here's a complete list of commit-ish and tree-ish identifiers (from [the Git revisions documentation](https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions)): ``` ---------------------------------------------------------------------- | Commit-ish/Tree-i...
13594344
Force Git to always choose the newer version during a merge?
116
2012-11-27 22:29:42
<p>Let's assume I <code>merge</code> git and there is a merge conflict.</p> <p>My question is: how can I force git to always choose the newer version of code in conflict so I won't need to resolve the conflict by hand?</p>
103,048
365,670
2021-08-08 21:44:06
13,594,416
213
2012-11-27 22:34:32
667,984
2012-11-27 22:34:32
https://stackoverflow.com/q/13594344
https://stackoverflow.com/a/13594416
<p>It is not exactly the "newer" version, but you can tell git to always prefer the version on the current branch using <code>git merge branch -X ours</code>, or to prefer the version of the branch being merged, using <code>git merge branch -X theirs</code>.</p> <p>From <code>man git-merge</code>:</p> <blockquote> ...
<p>It is not exactly the "newer" version, but you can tell git to always prefer the version on the current branch using <code>git merge branch -X ours</code>, or to prefer the version of the branch being merged, using <code>git merge branch -X theirs</code>.</p> <p>From <code>man git-merge</code>:</p> <blockquote> ...
119, 717, 3146
conflict, git, merge
<h1>Force Git to always choose the newer version during a merge?</h1> <p>Let's assume I <code>merge</code> git and there is a merge conflict.</p> <p>My question is: how can I force git to always choose the newer version of code in conflict so I won't need to resolve the conflict by hand?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,022
git
# Force Git to always choose the newer version during a merge? Let's assume I `merge` git and there is a merge conflict. My question is: how can I force git to always choose the newer version of code in conflict so I won't need to resolve the conflict by hand?
It is not exactly the "newer" version, but you can tell git to always prefer the version on the current branch using `git merge branch -X ours`, or to prefer the version of the branch being merged, using `git merge branch -X theirs`. From `man git-merge`: > **ours:** > > This option forces conflicting hunks to be aut...
11628418
Can't ignore .suo file
113
2012-07-24 09:58:09
<p>I'm trying to work using Git with a colleague, in an application written in C#.</p> <p>We have added the entry &quot;project1.suo&quot; to the .gitignore file but every time one of us has to commit the project, Git seems to tell us to commit the file &quot;project1.suo&quot; as well.</p> <p>We have tried many metho...
59,552
1,548,233
2024-01-10 10:00:43
11,629,271
213
2012-07-24 10:50:00
20,261
2012-07-24 10:50:00
https://stackoverflow.com/q/11628418
https://stackoverflow.com/a/11629271
<p>git doesn't ignore files that have been added to the repository. If you want to get it ignored, you have to delete the file from the repository:</p> <pre><code>git rm --cached project1.suo git commit -m "Delete suo file from repository" </code></pre> <p>This will delete the file from the repository, while it's sti...
<p>git doesn't ignore files that have been added to the repository. If you want to get it ignored, you have to delete the file from the repository:</p> <pre><code>git rm --cached project1.suo git commit -m "Delete suo file from repository" </code></pre> <p>This will delete the file from the repository, while it's sti...
119
git
<h1>Can't ignore .suo file</h1> <p>I'm trying to work using Git with a colleague, in an application written in C#.</p> <p>We have added the entry &quot;project1.suo&quot; to the .gitignore file but every time one of us has to commit the project, Git seems to tell us to commit the file &quot;project1.suo&quot; as well....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,023
git
# Can't ignore .suo file I'm trying to work using Git with a colleague, in an application written in C#. We have added the entry "project1.suo" to the .gitignore file but every time one of us has to commit the project, Git seems to tell us to commit the file "project1.suo" as well. We have tried many methods to add ...
git doesn't ignore files that have been added to the repository. If you want to get it ignored, you have to delete the file from the repository: ``` git rm --cached project1.suo git commit -m "Delete suo file from repository" ``` This will delete the file from the repository, while it's still on your harddrive.
2006265
Is there a standard naming convention for git tags?
321
2010-01-05 13:25:55
<p>I've seen a lot of projects using <code>v1.2.3</code> as the naming convention for tags in git. I've also seen some use <code>1.2.3</code>. Is there an officially endorsed style, or are there any good arguments for using either?</p>
144,083
18,180
2021-01-04 21:57:39
2,011,372
212
2010-01-06 06:50:22
244,510
2021-01-04 21:57:39
https://stackoverflow.com/q/2006265
https://stackoverflow.com/a/2011372
<p>Version 1.0.0 of <a href="http://semver.org/" rel="noreferrer">Semantic Versioning</a>, by Tom Preston-Werner of GitHub fame, had <a href="http://semver.org/spec/v1.0.0.html#tagging-specification-semvertag" rel="noreferrer">a sub-specification</a> addressing this:</p> <blockquote> <p><em>Tagging Specification</em> (...
<p>Version 1.0.0 of <a href="http://semver.org/" rel="noreferrer">Semantic Versioning</a>, by Tom Preston-Werner of GitHub fame, had <a href="http://semver.org/spec/v1.0.0.html#tagging-specification-semvertag" rel="noreferrer">a sub-specification</a> addressing this:</p> <blockquote> <p><em>Tagging Specification</em> (...
119, 60718
git, git-tag
<h1>Is there a standard naming convention for git tags?</h1> <p>I've seen a lot of projects using <code>v1.2.3</code> as the naming convention for tags in git. I've also seen some use <code>1.2.3</code>. Is there an officially endorsed style, or are there any good arguments for using either?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,025
git
# Is there a standard naming convention for git tags? I've seen a lot of projects using `v1.2.3` as the naming convention for tags in git. I've also seen some use `1.2.3`. Is there an officially endorsed style, or are there any good arguments for using either?
Version 1.0.0 of [Semantic Versioning](http://semver.org/), by Tom Preston-Werner of GitHub fame, had [a sub-specification](http://semver.org/spec/v1.0.0.html#tagging-specification-semvertag) addressing this: > *Tagging Specification* (SemVerTag) > > This sub-specification SHOULD be used if you use a version control s...
2514172
Listing each branch and its last revision's date in Git
204
2010-03-25 09:08:23
<p>I need to delete old and unmaintained branches from our remote repository. I'm trying to find a way with which to list the remote branches by their last modified date, and I can't.</p> <p>Is there an easy way to list remote branches this way?</p>
86,449
222,187
2025-01-28 11:03:58
2,514,279
212
2010-03-25 09:24:41
6,309
2022-03-14 15:08:10
https://stackoverflow.com/q/2514172
https://stackoverflow.com/a/2514279
<p><a href="http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches" rel="noreferrer">commandlinefu</a> has 2 interesting propositions:</p> <pre><code>for k in $(git branch | perl -pe s/^..//); do echo -e $(git show --pretty=format:&quot;%Cgreen%ci %Cblue%cr%Creset&q...
<p><a href="http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches" rel="noreferrer">commandlinefu</a> has 2 interesting propositions:</p> <pre><code>for k in $(git branch | perl -pe s/^..//); do echo -e $(git show --pretty=format:&quot;%Cgreen%ci %Cblue%cr%Creset&q...
119, 31678
git, remote-branch
<h1>Listing each branch and its last revision's date in Git</h1> <p>I need to delete old and unmaintained branches from our remote repository. I'm trying to find a way with which to list the remote branches by their last modified date, and I can't.</p> <p>Is there an easy way to list remote branches this way?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,026
git
# Listing each branch and its last revision's date in Git I need to delete old and unmaintained branches from our remote repository. I'm trying to find a way with which to list the remote branches by their last modified date, and I can't. Is there an easy way to list remote branches this way?
[commandlinefu](http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches) has 2 interesting propositions: ``` for k in $(git branch | perl -pe s/^..//); do echo -e $(git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1)\\t$k; done | sort -r ``` o...
6465699
Git push to wrong branch
144
2011-06-24 09:08:04
<p>Working with git, after some 'commit', and a couple of 'push', I realized that am using the wrong branch!</p> <p>Now I have to remove in some way my changes in <code>wrong_branch</code> and commit and push the changes in <code>right_branch</code></p> <p>What's the best (and simple) way to do that ?</p>
75,586
179,438
2022-12-24 10:53:35
6,465,798
212
2011-06-24 09:17:23
145,525
2011-06-24 09:17:23
https://stackoverflow.com/q/6465699
https://stackoverflow.com/a/6465798
<p>switch to that branch, check the <code>git log</code> and <code>git revert</code> those commits individually. Once you have done that, switch back to the desired branch and there you can then use <code>git cherry-pick</code> to pick specific commits from the git refs and merge it into the right branch.</p> <pre><co...
<p>switch to that branch, check the <code>git log</code> and <code>git revert</code> those commits individually. Once you have done that, switch back to the desired branch and there you can then use <code>git cherry-pick</code> to pick specific commits from the git refs and merge it into the right branch.</p> <pre><co...
119
git
<h1>Git push to wrong branch</h1> <p>Working with git, after some 'commit', and a couple of 'push', I realized that am using the wrong branch!</p> <p>Now I have to remove in some way my changes in <code>wrong_branch</code> and commit and push the changes in <code>right_branch</code></p> <p>What's the best (and simple) ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,028
git
# Git push to wrong branch Working with git, after some 'commit', and a couple of 'push', I realized that am using the wrong branch! Now I have to remove in some way my changes in `wrong_branch` and commit and push the changes in `right_branch` What's the best (and simple) way to do that ?
switch to that branch, check the `git log` and `git revert` those commits individually. Once you have done that, switch back to the desired branch and there you can then use `git cherry-pick` to pick specific commits from the git refs and merge it into the right branch. ``` git checkout wrong_branch git revert commits...
25464930
How can I remove an SSH key?
293
2014-08-23 18:13:15
<p>I currently have an old SSH key uploaded on a server. The problem is I lost my <code>~/.ssh</code> directory (with the original <code>id_rsa</code> and <code>id_rsa.pub</code> files).</p> <p>Consequently, I want to remove the old SSH key directly on the server and upload a new one.</p> <p>I tried the following comma...
968,914
1,364,743
2024-06-12 21:04:58
25,465,155
211
2014-08-23 18:37:15
6,309
2021-06-01 15:22:56
https://stackoverflow.com/q/25464930
https://stackoverflow.com/a/25465155
<p>Note that there are at least two bug reports for <code>ssh-add -d/-D</code> <em>not</em> removing keys:</p> <ul> <li>&quot;<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=472477" rel="noreferrer">Debian Bug report #472477: <code>ssh-add -D</code> does not remove SSH key from <code>gnome-keyring-daemon</co...
<p>Note that there are at least two bug reports for <code>ssh-add -d/-D</code> <em>not</em> removing keys:</p> <ul> <li>&quot;<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=472477" rel="noreferrer">Debian Bug report #472477: <code>ssh-add -D</code> does not remove SSH key from <code>gnome-keyring-daemon</co...
119, 386, 6452, 25308, 95669
git, git-svn, ssh, ssh-keygen, ssh-keys
<h1>How can I remove an SSH key?</h1> <p>I currently have an old SSH key uploaded on a server. The problem is I lost my <code>~/.ssh</code> directory (with the original <code>id_rsa</code> and <code>id_rsa.pub</code> files).</p> <p>Consequently, I want to remove the old SSH key directly on the server and upload a new o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,029
git
# How can I remove an SSH key? I currently have an old SSH key uploaded on a server. The problem is I lost my `~/.ssh` directory (with the original `id_rsa` and `id_rsa.pub` files). Consequently, I want to remove the old SSH key directly on the server and upload a new one. I tried the following command without succe...
Note that there are at least two bug reports for `ssh-add -d/-D` *not* removing keys: - "[Debian Bug report #472477: `ssh-add -D` does not remove SSH key from `gnome-keyring-daemon` memory](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=472477)" - "[Ubuntu: `ssh-add -D` deleting all identities does not work. Also, ...
18770545
Why is my Git Submodule HEAD detached from master?
271
2013-09-12 17:18:42
<p>I am using Git submodules. After pulling changes from server, many times my submodule head gets detached from master branch. </p> <p>Why does it happen?</p> <p>I have to always do:</p> <pre><code>git branch git checkout master </code></pre> <p>How can I make sure that my submodule is always pointing to master br...
214,607
988,830
2023-10-19 19:31:36
36,375,256
211
2016-04-02 15:38:02
1,318,830
2019-09-08 21:26:21
https://stackoverflow.com/q/18770545
https://stackoverflow.com/a/36375256
<p><strong>EDIT:</strong></p> <p><strong>See <a href="https://stackoverflow.com/users/5101148/simba">@Simba</a> <a href="https://stackoverflow.com/a/55570998/1318830">Answer</a> for valid solution</strong></p> <blockquote> <p><code>submodule.&lt;name&gt;.update</code> is what you want to change, see the <a href="ht...
<p><strong>EDIT:</strong></p> <p><strong>See <a href="https://stackoverflow.com/users/5101148/simba">@Simba</a> <a href="https://stackoverflow.com/a/55570998/1318830">Answer</a> for valid solution</strong></p> <blockquote> <p><code>submodule.&lt;name&gt;.update</code> is what you want to change, see the <a href="ht...
119, 41612
git, git-submodules
<h1>Why is my Git Submodule HEAD detached from master?</h1> <p>I am using Git submodules. After pulling changes from server, many times my submodule head gets detached from master branch. </p> <p>Why does it happen?</p> <p>I have to always do:</p> <pre><code>git branch git checkout master </code></pre> <p>How can I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,030
git
# Why is my Git Submodule HEAD detached from master? I am using Git submodules. After pulling changes from server, many times my submodule head gets detached from master branch. Why does it happen? I have to always do: ``` git branch git checkout master ``` How can I make sure that my submodule is always pointing ...
**EDIT:** **See [@Simba](https://stackoverflow.com/users/5101148/simba) [Answer](https://stackoverflow.com/a/55570998/1318830) for valid solution** > `submodule.<name>.update` is what you want to change, see the [docs](https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-update--init--remote-N--no-f...
14613540
Do Git tags only apply to the current branch?
257
2013-01-30 20:52:00
<p>I'm currently working with a repository that has multiple branches.</p> <p>When I create a tag, does that tag refer to the then-current branch?</p> <p>In other words: Whenever I create a tag, do I need to switch to the desired branch and tag inside that branch so that the tag refers to that branch at that point in...
185,488
604,020
2024-02-12 08:58:01
14,613,683
211
2013-01-30 21:00:49
1,967,931
2013-01-30 21:00:49
https://stackoverflow.com/q/14613540
https://stackoverflow.com/a/14613683
<p>If you create a tag by e.g.</p> <pre><code>git tag v1.0 </code></pre> <p>the tag will refer to the most recent commit of the branch you are currently on. You can change branch and create a tag there.</p> <p>You can also just refer to the other branch while tagging,</p> <pre><code>git tag v1.0 name_of_other_branc...
<p>If you create a tag by e.g.</p> <pre><code>git tag v1.0 </code></pre> <p>the tag will refer to the most recent commit of the branch you are currently on. You can change branch and create a tag there.</p> <p>You can also just refer to the other branch while tagging,</p> <pre><code>git tag v1.0 name_of_other_branc...
119, 60718
git, git-tag
<h1>Do Git tags only apply to the current branch?</h1> <p>I'm currently working with a repository that has multiple branches.</p> <p>When I create a tag, does that tag refer to the then-current branch?</p> <p>In other words: Whenever I create a tag, do I need to switch to the desired branch and tag inside that branch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,031
git
# Do Git tags only apply to the current branch? I'm currently working with a repository that has multiple branches. When I create a tag, does that tag refer to the then-current branch? In other words: Whenever I create a tag, do I need to switch to the desired branch and tag inside that branch so that the tag refers...
If you create a tag by e.g. ``` git tag v1.0 ``` the tag will refer to the most recent commit of the branch you are currently on. You can change branch and create a tag there. You can also just refer to the other branch while tagging, ``` git tag v1.0 name_of_other_branch ``` which will create the tag to the most ...
3410976
How to round a number to significant figures in Python
225
2010-08-05 00:48:04
<p>I need to round a float to be displayed in a UI. e.g, to one significant figure:</p> <pre><code>1234 -&gt; 1000 0.12 -&gt; 0.1 0.012 -&gt; 0.01 0.062 -&gt; 0.06 6253 -&gt; 6000 1999 -&gt; 2000 </code></pre> <p>Is there a nice way to do this using the Python library, or do I have to write it myself?</p>
428,402
303,927
2024-12-03 19:01:12
3,411,435
211
2010-08-05 02:57:33
331,701
2016-01-07 06:43:05
https://stackoverflow.com/q/3410976
https://stackoverflow.com/a/3411435
<p>You can use negative numbers to round integers:</p> <pre><code>&gt;&gt;&gt; round(1234, -3) 1000.0 </code></pre> <p>Thus if you need only most significant digit:</p> <pre><code>&gt;&gt;&gt; from math import log10, floor &gt;&gt;&gt; def round_to_1(x): ... return round(x, -int(floor(log10(abs(x))))) ... &gt;&gt...
<p>You can use negative numbers to round integers:</p> <pre><code>&gt;&gt;&gt; round(1234, -3) 1000.0 </code></pre> <p>Thus if you need only most significant digit:</p> <pre><code>&gt;&gt;&gt; from math import log10, floor &gt;&gt;&gt; def round_to_1(x): ... return round(x, -int(floor(log10(abs(x))))) ... &gt;&gt...
16, 259, 9069, 12414
math, python, rounding, significant-digits
<h1>How to round a number to significant figures in Python</h1> <p>I need to round a float to be displayed in a UI. e.g, to one significant figure:</p> <pre><code>1234 -&gt; 1000 0.12 -&gt; 0.1 0.012 -&gt; 0.01 0.062 -&gt; 0.06 6253 -&gt; 6000 1999 -&gt; 2000 </code></pre> <p>Is there a nice way to do this using ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,033
git
# How to round a number to significant figures in Python I need to round a float to be displayed in a UI. e.g, to one significant figure: ``` 1234 -> 1000 0.12 -> 0.1 0.012 -> 0.01 0.062 -> 0.06 6253 -> 6000 1999 -> 2000 ``` Is there a nice way to do this using the Python library, or do I have to write it mysel...
You can use negative numbers to round integers: ``` >>> round(1234, -3) 1000.0 ``` Thus if you need only most significant digit: ``` >>> from math import log10, floor >>> def round_to_1(x): ... return round(x, -int(floor(log10(abs(x))))) ... >>> round_to_1(0.0232) 0.02 >>> round_to_1(1234243) 1000000.0 >>> round_...
8483983
How to create the branch from a specific commit in a different branch
176
2011-12-13 03:28:24
<p>I have made several commits in the <em>master</em> branch and then merged them to the <em>dev</em> branch.</p> <p>I want to create a branch from a specific commit in the <em>dev</em> branch, which was first committed in the <em>master</em> branch.</p> <p>I used the commands:</p> <pre><code>git checkout dev git branc...
238,725
818,399
2023-07-20 21:06:58
8,491,176
211
2011-12-13 14:51:41
108,802
2011-12-14 09:27:44
https://stackoverflow.com/q/8483983
https://stackoverflow.com/a/8491176
<p>If you are using this form of the <code>branch</code> command (with start point), it does not matter where your <code>HEAD</code> is.</p> <p>What you are doing:</p> <pre><code>git checkout dev git branch test 07aeec983bfc17c25f0b0a7c1d47da8e35df7af8 </code></pre> <ul> <li><p>First, you set your <code>HEAD</code> ...
<p>If you are using this form of the <code>branch</code> command (with start point), it does not matter where your <code>HEAD</code> is.</p> <p>What you are doing:</p> <pre><code>git checkout dev git branch test 07aeec983bfc17c25f0b0a7c1d47da8e35df7af8 </code></pre> <ul> <li><p>First, you set your <code>HEAD</code> ...
119, 76220
git, git-branch
<h1>How to create the branch from a specific commit in a different branch</h1> <p>I have made several commits in the <em>master</em> branch and then merged them to the <em>dev</em> branch.</p> <p>I want to create a branch from a specific commit in the <em>dev</em> branch, which was first committed in the <em>master</em...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,035
git
# How to create the branch from a specific commit in a different branch I have made several commits in the *master* branch and then merged them to the *dev* branch. I want to create a branch from a specific commit in the *dev* branch, which was first committed in the *master* branch. I used the commands: ``` git ch...
If you are using this form of the `branch` command (with start point), it does not matter where your `HEAD` is. What you are doing: ``` git checkout dev git branch test 07aeec983bfc17c25f0b0a7c1d47da8e35df7af8 ``` - First, you set your `HEAD` to the branch `dev`, - Second, you start a new branch on commit `07aeec98`...
9378760
git push local branch with same name as remote tag
170
2012-02-21 13:54:08
<p>I'm trying to push a new local branch <code>product-0.2</code> to remote where there is already a tag with the same name (but the branch itself does not exist)</p> <pre><code>git push -v --tags --set-upstream origin product-0.2:product-0.2 Pushing to https://****@github.com/mycompany/product.git error: src refspec ...
139,114
1,215,723
2025-06-12 19:46:04
9,382,344
211
2012-02-21 17:38:51
106,205
2012-02-21 18:54:51
https://stackoverflow.com/q/9378760
https://stackoverflow.com/a/9382344
<p>The following command should work.</p> <pre><code>git push origin refs/heads/product-0.2:refs/heads/product-0.2 </code></pre>
<p>The following command should work.</p> <pre><code>git push origin refs/heads/product-0.2:refs/heads/product-0.2 </code></pre>
119, 76220
git, git-branch
<h1>git push local branch with same name as remote tag</h1> <p>I'm trying to push a new local branch <code>product-0.2</code> to remote where there is already a tag with the same name (but the branch itself does not exist)</p> <pre><code>git push -v --tags --set-upstream origin product-0.2:product-0.2 Pushing to https...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,036
git
# git push local branch with same name as remote tag I'm trying to push a new local branch `product-0.2` to remote where there is already a tag with the same name (but the branch itself does not exist) ``` git push -v --tags --set-upstream origin product-0.2:product-0.2 Pushing to https://****@github.com/mycompany/p...
The following command should work. ``` git push origin refs/heads/product-0.2:refs/heads/product-0.2 ```
6143285
Git: add vs push vs commit
164
2011-05-26 18:23:24
<p>What is the difference between git <code>add</code>, <code>push</code> and <code>commit</code>?</p> <p>Just a little confused coming from SVN, where "update" will 'add' stuff, and commit does a "push" and will 'add' as well</p> <p>There are all different functions within git. Hoping for some explanation from your ...
181,328
727,429
2022-11-30 17:59:43
6,143,352
211
2011-05-26 18:28:34
3,730,911
2017-09-09 15:04:48
https://stackoverflow.com/q/6143285
https://stackoverflow.com/a/6143352
<ol> <li><p><code>git add</code> adds your modified files to the queue <em>to be committed later</em>. Files are not committed</p> </li> <li><p><code>git commit</code> commits the files that have been added and creates a new revision with a log... If you do not add any files, git will not commit anything. You can combi...
<ol> <li><p><code>git add</code> adds your modified files to the queue <em>to be committed later</em>. Files are not committed</p> </li> <li><p><code>git commit</code> commits the files that have been added and creates a new revision with a log... If you do not add any files, git will not commit anything. You can combi...
119, 4236, 5597, 7330, 14215
addition, commit, git, push, repository
<h1>Git: add vs push vs commit</h1> <p>What is the difference between git <code>add</code>, <code>push</code> and <code>commit</code>?</p> <p>Just a little confused coming from SVN, where "update" will 'add' stuff, and commit does a "push" and will 'add' as well</p> <p>There are all different functions within git. Ho...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,037
git
# Git: add vs push vs commit What is the difference between git `add`, `push` and `commit`? Just a little confused coming from SVN, where "update" will 'add' stuff, and commit does a "push" and will 'add' as well There are all different functions within git. Hoping for some explanation from your experience.
1. `git add` adds your modified files to the queue *to be committed later*. Files are not committed 2. `git commit` commits the files that have been added and creates a new revision with a log... If you do not add any files, git will not commit anything. You can combine both actions with `git commit -a` 3. `git push` p...
1106529
How to skip "Loose Object" popup when running 'git gui'
154
2009-07-09 21:20:30
<p>When I run 'git gui' I get a popup that says</p> <pre> This repository currently has approximately 1500 loose objects. </pre> <p>It then suggests compressing the database. I've done this before, and it reduces the loose objects to about 250, but that doesn't suppress the popup. Compressing again doesn't change...
28,776
75,204
2021-11-18 09:42:26
10,131,626
211
2012-04-12 20:51:19
62,130
2017-02-17 09:21:15
https://stackoverflow.com/q/1106529
https://stackoverflow.com/a/10131626
<p>Since nobody had yet an answer, I looked into the code to see how to remove the code which shows up that dialog. I found the <code>hint_gc</code> procedure which does it and the place where it is called. At the same time I noticed that late 2011 there was added <a href="https://github.com/gitster/git/commit/af867683...
<p>Since nobody had yet an answer, I looked into the code to see how to remove the code which shows up that dialog. I found the <code>hint_gc</code> procedure which does it and the place where it is called. At the same time I noticed that late 2011 there was added <a href="https://github.com/gitster/git/commit/af867683...
119, 1850, 8974, 33729, 44929
garbage-collection, git, git-gc, git-gui, rebase
<h1>How to skip "Loose Object" popup when running 'git gui'</h1> <p>When I run 'git gui' I get a popup that says</p> <pre> This repository currently has approximately 1500 loose objects. </pre> <p>It then suggests compressing the database. I've done this before, and it reduces the loose objects to about 250, but th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,038
git
# How to skip "Loose Object" popup when running 'git gui' When I run 'git gui' I get a popup that says ``` This repository currently has approximately 1500 loose objects. ``` It then suggests compressing the database. I've done this before, and it reduces the loose objects to about 250, but that doesn't suppress the...
Since nobody had yet an answer, I looked into the code to see how to remove the code which shows up that dialog. I found the `hint_gc` procedure which does it and the place where it is called. At the same time I noticed that late 2011 there was added [a configuration option for disabling the dialog](https://github.com/...
10181057
Unlink of file failed
175
2012-04-16 20:16:29
<p>I'm trying to do a git pull and I get the following error:</p> <blockquote> <p>Unlink of file 'lib/xxx.jar' failed. Should I try again? (y/n)</p> </blockquote> <p>No matter if I select y or n it's not possible to get to a state where I can pull or push.</p>
123,199
1,023,620
2022-02-28 10:44:27
10,181,965
210
2012-04-16 21:27:40
6,309
2019-01-28 23:08:23
https://stackoverflow.com/q/10181057
https://stackoverflow.com/a/10181965
<p>That usually means a process is still using that specific file (still has an handle on it)<br> (on Windows, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653" rel="noreferrer"><code>ProcessExplorer</code></a> is good at tracking that kind of process)</p> <p>Try closing your other programs, and try a...
<p>That usually means a process is still using that specific file (still has an handle on it)<br> (on Windows, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653" rel="noreferrer"><code>ProcessExplorer</code></a> is good at tracking that kind of process)</p> <p>Try closing your other programs, and try a...
64, 119
git, windows
<h1>Unlink of file failed</h1> <p>I'm trying to do a git pull and I get the following error:</p> <blockquote> <p>Unlink of file 'lib/xxx.jar' failed. Should I try again? (y/n)</p> </blockquote> <p>No matter if I select y or n it's not possible to get to a state where I can pull or push.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,041
git
# Unlink of file failed I'm trying to do a git pull and I get the following error: > Unlink of file 'lib/xxx.jar' failed. Should I try again? (y/n) No matter if I select y or n it's not possible to get to a state where I can pull or push.
That usually means a process is still using that specific file (still has an handle on it) (on Windows, [`ProcessExplorer`](http://technet.microsoft.com/en-us/sysinternals/bb896653) is good at tracking that kind of process) Try closing your other programs, and try again your `git pull`. Note that you have an altern...
23156415
How do I stop git bisect?
157
2014-04-18 14:43:29
<p>I tried git bisect a while ago and it helped me well, but apparently I didn't stop it. When I do git status I still get:</p> <pre><code>You are currently bisecting. (use "git bisect reset" to get back to the original branch) </code></pre> <p>I don't really want to reset to anywhere, I just want to stop bisecting. ...
50,690
1,896,048
2025-05-13 12:15:02
23,156,531
210
2014-04-18 14:49:46
2,441,252
2014-04-18 14:49:46
https://stackoverflow.com/q/23156415
https://stackoverflow.com/a/23156531
<p><code>git bisect reset</code> is how you stop bisecting. By default it will reset the HEAD to where it was before you started, although you can also use <code>git bisect reset &lt;commit&gt;</code> to go to that one instead.</p> <p>If you just want to stop bisecting without changing the commit, from the documentatio...
<p><code>git bisect reset</code> is how you stop bisecting. By default it will reset the HEAD to where it was before you started, although you can also use <code>git bisect reset &lt;commit&gt;</code> to go to that one instead.</p> <p>If you just want to stop bisecting without changing the commit, from the documentatio...
119, 47326
git, git-bisect
<h1>How do I stop git bisect?</h1> <p>I tried git bisect a while ago and it helped me well, but apparently I didn't stop it. When I do git status I still get:</p> <pre><code>You are currently bisecting. (use "git bisect reset" to get back to the original branch) </code></pre> <p>I don't really want to reset to anywhe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,042
git
# How do I stop git bisect? I tried git bisect a while ago and it helped me well, but apparently I didn't stop it. When I do git status I still get: ``` You are currently bisecting. (use "git bisect reset" to get back to the original branch) ``` I don't really want to reset to anywhere, I just want to stop bisecting...
`git bisect reset` is how you stop bisecting. By default it will reset the HEAD to where it was before you started, although you can also use `git bisect reset <commit>` to go to that one instead. If you just want to stop bisecting without changing the commit, from the documentation, `git bisect reset HEAD` would do w...
10728956
What should I put in a meteor .gitignore file?
155
2012-05-23 22:52:22
<p>I have a new meteor project. I'm guessing the <code>.meteor</code> dir has a combination of configuration files (needed) and temporary files (not needed). </p> <p>So what's in your <code>.gitignore</code>?</p>
23,772
191,991
2018-06-28 00:21:53
10,729,053
209
2012-05-23 23:02:42
791,538
2016-01-01 18:17:58
https://stackoverflow.com/q/10728956
https://stackoverflow.com/a/10729053
<p>The only directory you want excluded from version control is <code>.meteor/local</code>.</p> <p>Meteor automatically creates the right <code>.meteor</code> and <code>.meteor/.gitignore</code>, though -- you shouldn't need to do anything.</p>
<p>The only directory you want excluded from version control is <code>.meteor/local</code>.</p> <p>Meteor automatically creates the right <code>.meteor</code> and <code>.meteor/.gitignore</code>, though -- you shouldn't need to do anything.</p>
119, 25056, 79111
git, gitignore, meteor
<h1>What should I put in a meteor .gitignore file?</h1> <p>I have a new meteor project. I'm guessing the <code>.meteor</code> dir has a combination of configuration files (needed) and temporary files (not needed). </p> <p>So what's in your <code>.gitignore</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,044
git
# What should I put in a meteor .gitignore file? I have a new meteor project. I'm guessing the `.meteor` dir has a combination of configuration files (needed) and temporary files (not needed). So what's in your `.gitignore`?
The only directory you want excluded from version control is `.meteor/local`. Meteor automatically creates the right `.meteor` and `.meteor/.gitignore`, though -- you shouldn't need to do anything.
6119036
How to revert a folder to a particular commit
134
2011-05-25 02:54:50
<p>Here's my history for the folder 'somefolder'</p> <pre><code>$ git log somefolder commit 89cd More changes to somefolder commit ef47a Updating somefolder and other stuff commit e095 Bugs fixed in somefolder </code></pre> <p>I want to revert somefolder back to the 'Bugs fixed in some folder" commit.</p> <p>Sinc...
99,156
129,932
2024-06-17 08:00:36
6,119,127
209
2011-05-25 03:10:42
198,244
2011-05-25 03:10:42
https://stackoverflow.com/q/6119036
https://stackoverflow.com/a/6119127
<p>You can use <a href="http://git-scm.com/docs/git-checkout">git checkout</a> to update your repository to a specific state.</p> <pre><code>git checkout e095 -- somefolder </code></pre> <p>As for your question about generating the diff, that would work too. Just generate the diff to go from your current state back ...
<p>You can use <a href="http://git-scm.com/docs/git-checkout">git checkout</a> to update your repository to a specific state.</p> <pre><code>git checkout e095 -- somefolder </code></pre> <p>As for your question about generating the diff, that would work too. Just generate the diff to go from your current state back ...
119, 12309
git, revert
<h1>How to revert a folder to a particular commit</h1> <p>Here's my history for the folder 'somefolder'</p> <pre><code>$ git log somefolder commit 89cd More changes to somefolder commit ef47a Updating somefolder and other stuff commit e095 Bugs fixed in somefolder </code></pre> <p>I want to revert somefolder back ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,045
git
# How to revert a folder to a particular commit Here's my history for the folder 'somefolder' ``` $ git log somefolder commit 89cd More changes to somefolder commit ef47a Updating somefolder and other stuff commit e095 Bugs fixed in somefolder ``` I want to revert somefolder back to the 'Bugs fixed in some folder...
You can use [git checkout](http://git-scm.com/docs/git-checkout) to update your repository to a specific state. ``` git checkout e095 -- somefolder ``` As for your question about generating the diff, that would work too. Just generate the diff to go from your current state back to `e095`: ``` git diff 89cd..e095 -- ...
1510798
Trying to fix line-endings with git filter-branch, but having no luck
292
2009-10-02 17:12:48
<p>I have been bitten by the Windows/Linux line-ending issue with git. It seems, via GitHub, MSysGit, and other sources, that the best solution is to have your local repos set to use linux-style line endings, but set <code>core.autocrlf</code> to <code>true</code>. Unfortunately, I didn't do this early enough, so now...
86,039
140,263
2022-11-08 10:24:35
4,683,783
208
2011-01-13 18:32:28
387,176
2022-11-08 10:24:35
https://stackoverflow.com/q/1510798
https://stackoverflow.com/a/4683783
<p>The git documentation for <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer">gitattributes</a> now documents another approach for &quot;fixing&quot; or normalizing all the line endings in your project. Here's the gist of it:</p> <pre><code>$ echo &quot;* text=auto&quot; &gt;.gitattributes $ git add --...
<p>The git documentation for <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer">gitattributes</a> now documents another approach for &quot;fixing&quot; or normalizing all the line endings in your project. Here's the gist of it:</p> <pre><code>$ echo &quot;* text=auto&quot; &gt;.gitattributes $ git add --...
119, 3705, 8329, 21628
git, line-endings, msysgit, newline
<h1>Trying to fix line-endings with git filter-branch, but having no luck</h1> <p>I have been bitten by the Windows/Linux line-ending issue with git. It seems, via GitHub, MSysGit, and other sources, that the best solution is to have your local repos set to use linux-style line endings, but set <code>core.autocrlf</co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,046
git
# Trying to fix line-endings with git filter-branch, but having no luck I have been bitten by the Windows/Linux line-ending issue with git. It seems, via GitHub, MSysGit, and other sources, that the best solution is to have your local repos set to use linux-style line endings, but set `core.autocrlf` to `true`. Unfort...
The git documentation for [gitattributes](http://git-scm.com/docs/gitattributes) now documents another approach for "fixing" or normalizing all the line endings in your project. Here's the gist of it: ``` $ echo "* text=auto" >.gitattributes $ git add --renormalize . $ git status # Show files that will be norma...
16244969
How to tell git to ignore individual lines, i.e. gitignore for specific lines of code
267
2013-04-26 20:47:17
<p><code>.gitignore</code> can ignore whole files, but is there a way to ignore specific lines of code while coding?</p> <p>I frequently and repeatedly add the same debug lines in a project, only to have to remember to remove them before committing. I'd like to just keep the lines in the code and have git disregard th...
127,719
234,593
2023-11-07 13:14:35
16,244,970
208
2013-04-26 20:47:17
234,593
2020-05-20 07:32:38
https://stackoverflow.com/q/16244969
https://stackoverflow.com/a/16244970
<p>This is how you can kind of do it with <a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_tt_filter_tt" rel="noreferrer">git filters</a>:</p> <ol> <li>Create/Open gitattributes file: <ul> <li><code>&lt;project root&gt;/.gitattributes</code> (will be committed into repo)<br> OR</li> <li><...
<p>This is how you can kind of do it with <a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_tt_filter_tt" rel="noreferrer">git filters</a>:</p> <ol> <li>Create/Open gitattributes file: <ul> <li><code>&lt;project root&gt;/.gitattributes</code> (will be committed into repo)<br> OR</li> <li><...
119, 4333, 25056
git, gitignore, ignore
<h1>How to tell git to ignore individual lines, i.e. gitignore for specific lines of code</h1> <p><code>.gitignore</code> can ignore whole files, but is there a way to ignore specific lines of code while coding?</p> <p>I frequently and repeatedly add the same debug lines in a project, only to have to remember to remov...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,047
git
# How to tell git to ignore individual lines, i.e. gitignore for specific lines of code `.gitignore` can ignore whole files, but is there a way to ignore specific lines of code while coding? I frequently and repeatedly add the same debug lines in a project, only to have to remember to remove them before committing. I...
This is how you can kind of do it with [git filters](https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_tt_filter_tt): 1. Create/Open gitattributes file: - `<project root>/.gitattributes` (will be committed into repo) OR - `<project root>/.git/info/attributes` (won't be committed into re...
27850222
What is .gitignore?
244
2015-01-08 21:56:42
<p>I just created a Github repository and was wondering what the <code>.gitignore</code> file was for. I started by not creating one, but added one due to the fact that most repositories have one. Do I need to have one? Can/do I just ignore it, or does it have a use?</p>
132,542
3,700,651
2025-12-04 02:06:19
27,850,270
208
2015-01-08 21:59:17
2,422,776
2024-06-30 09:21:09
https://stackoverflow.com/q/27850222
https://stackoverflow.com/a/27850270
<p><code>.gitignore</code> tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc.</p> <p>You can find the full details <a href="http...
<p><code>.gitignore</code> tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc.</p> <p>You can find the full details <a href="http...
119, 25056
git, gitignore
<h1>What is .gitignore?</h1> <p>I just created a Github repository and was wondering what the <code>.gitignore</code> file was for. I started by not creating one, but added one due to the fact that most repositories have one. Do I need to have one? Can/do I just ignore it, or does it have a use?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,048
git
# What is .gitignore? I just created a Github repository and was wondering what the `.gitignore` file was for. I started by not creating one, but added one due to the fact that most repositories have one. Do I need to have one? Can/do I just ignore it, or does it have a use?
`.gitignore` tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc. You can find the full details [here](https://git-scm.com/docs/g...
1360712
Git stash: "Cannot apply to a dirty working tree, please stage your changes"
141
2009-09-01 05:47:56
<p>I am trying to apply changes I stashed earlier with <code>git stash pop</code> and get the message:</p> <pre><code>Cannot apply to a dirty working tree, please stage your changes </code></pre> <p>Any suggestion on how to deal with that?</p>
58,120
5,295
2022-08-02 14:27:59
3,733,698
208
2010-09-17 08:21:45
450,383
2014-07-29 06:41:22
https://stackoverflow.com/q/1360712
https://stackoverflow.com/a/3733698
<p>When I have to apply stashed changes to a dirty working copy, e.g. pop more than one changeset from the stash, I use the following:</p> <pre><code>$ git stash show -p | git apply -3 &amp;&amp; git stash drop </code></pre> <p>Basically it </p> <ol> <li>creates a patch</li> <li>pipes that to the apply command</li> ...
<p>When I have to apply stashed changes to a dirty working copy, e.g. pop more than one changeset from the stash, I use the following:</p> <pre><code>$ git stash show -p | git apply -3 &amp;&amp; git stash drop </code></pre> <p>Basically it </p> <ol> <li>creates a patch</li> <li>pipes that to the apply command</li> ...
119, 13091
git, git-stash
<h1>Git stash: "Cannot apply to a dirty working tree, please stage your changes"</h1> <p>I am trying to apply changes I stashed earlier with <code>git stash pop</code> and get the message:</p> <pre><code>Cannot apply to a dirty working tree, please stage your changes </code></pre> <p>Any suggestion on how to deal wit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,049
git
# Git stash: "Cannot apply to a dirty working tree, please stage your changes" I am trying to apply changes I stashed earlier with `git stash pop` and get the message: ``` Cannot apply to a dirty working tree, please stage your changes ``` Any suggestion on how to deal with that?
When I have to apply stashed changes to a dirty working copy, e.g. pop more than one changeset from the stash, I use the following: ``` $ git stash show -p | git apply -3 && git stash drop ``` Basically it 1. creates a patch 2. pipes that to the apply command 3. if there are any conflicts they will need to be resolv...
7374069
Undo git reset --hard with uncommitted files in the staging area
132
2011-09-10 19:28:59
<p>I am trying to recover my work. I did <code>git reset --hard</code>, but before that I've done only <code>get add .</code> and didn't do <code>git commit</code>. Please help! Here is my log:</p> <pre><code>MacBookPro:api user$ git status # On branch master # Changes to be committed: # (use &quot;git reset HEAD &lt...
77,536
762,896
2025-12-08 08:22:02
7,376,959
208
2011-09-11 07:44:37
223,092
2011-09-13 05:46:33
https://stackoverflow.com/q/7374069
https://stackoverflow.com/a/7376959
<p>You should be able to recover any files back that you added to the index (e.g, as in your situation, with <code>git add .</code>) although it might be a bit of work. In order to add a file to the index, git adds it to the object database, which means it can be recovered so long as garbage collection hasn't happened...
<p>You should be able to recover any files back that you added to the index (e.g, as in your situation, with <code>git add .</code>) although it might be a bit of work. In order to add a file to the index, git adds it to the object database, which means it can be recovered so long as garbage collection hasn't happened...
119, 5766, 34792, 51381, 53850
git, git-add, git-commit, git-reset, undo
<h1>Undo git reset --hard with uncommitted files in the staging area</h1> <p>I am trying to recover my work. I did <code>git reset --hard</code>, but before that I've done only <code>get add .</code> and didn't do <code>git commit</code>. Please help! Here is my log:</p> <pre><code>MacBookPro:api user$ git status # On ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,050
git
# Undo git reset --hard with uncommitted files in the staging area I am trying to recover my work. I did `git reset --hard`, but before that I've done only `get add .` and didn't do `git commit`. Please help! Here is my log: ``` MacBookPro:api user$ git status # On branch master # Changes to be committed: # (use "g...
You should be able to recover any files back that you added to the index (e.g, as in your situation, with `git add .`) although it might be a bit of work. In order to add a file to the index, git adds it to the object database, which means it can be recovered so long as garbage collection hasn't happened yet. There's a...
7231608
How to ignore files which are in repository?
109
2011-08-29 14:38:57
<p>I have a file (<code>config.php</code>), that is already committed to a Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore any changes to it.</p> <p>I put the file into <code>.gitignore</code>, but it is still marked as changed and Git still is attemp...
38,847
898,937
2022-03-14 23:52:17
7,232,354
208
2011-08-29 15:37:45
6,309
2020-12-09 09:21:08
https://stackoverflow.com/q/7231608
https://stackoverflow.com/a/7232354
<p>If the file is still displayed in the status, even though it is in the .gitignore, make sure it isn't already tracked.</p> <pre><code>git rm --cached config.php </code></pre> <p>If you just want to ignore it locally, you could also make it ignored by the git status:</p> <pre><code>git update-index --assume-unchanged...
<p>If the file is still displayed in the status, even though it is in the .gitignore, make sure it isn't already tracked.</p> <pre><code>git rm --cached config.php </code></pre> <p>If you just want to ignore it locally, you could also make it ignored by the git status:</p> <pre><code>git update-index --assume-unchanged...
119, 25056, 112901
git, gitignore, git-rm
<h1>How to ignore files which are in repository?</h1> <p>I have a file (<code>config.php</code>), that is already committed to a Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore any changes to it.</p> <p>I put the file into <code>.gitignore</code>, but...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,051
git
# How to ignore files which are in repository? I have a file (`config.php`), that is already committed to a Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore any changes to it. I put the file into `.gitignore`, but it is still marked as changed and Gi...
If the file is still displayed in the status, even though it is in the .gitignore, make sure it isn't already tracked. ``` git rm --cached config.php ``` If you just want to ignore it locally, you could also make it ignored by the git status: ``` git update-index --assume-unchanged config.php ``` As [commented](htt...
53569
How to get the changes on a branch in Git
304
2008-09-10 07:44:53
<p>What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:</p> <pre><code>git log $(git merge-base HEAD branch)..branch </code></pre> <p>The documentation for <a href="http://git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> indica...
309,298
893
2025-05-02 10:25:44
53,573
207
2008-09-10 07:50:41
582
2015-02-11 14:23:54
https://stackoverflow.com/q/53569
https://stackoverflow.com/a/53573
<p>In the context of a revision list, <code>A...B</code> is how <code>git-rev-parse</code> defines it. git-log takes a revision list. <code>git-diff</code> does not take a list of revisions - it takes one or two revisions, and has defined the <code>A...B</code> syntax to mean how it's defined in the <code>git-diff</cod...
<p>In the context of a revision list, <code>A...B</code> is how <code>git-rev-parse</code> defines it. git-log takes a revision list. <code>git-diff</code> does not take a list of revisions - it takes one or two revisions, and has defined the <code>A...B</code> syntax to mean how it's defined in the <code>git-diff</cod...
119, 1879
branch, git
<h1>How to get the changes on a branch in Git</h1> <p>What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:</p> <pre><code>git log $(git merge-base HEAD branch)..branch </code></pre> <p>The documentation for <a href="http://git-scm.com/...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,052
git
# How to get the changes on a branch in Git What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is: ``` git log $(git merge-base HEAD branch)..branch ``` The documentation for [git-diff](http://git-scm.com/docs/git-diff) indicates that `...
In the context of a revision list, `A...B` is how `git-rev-parse` defines it. git-log takes a revision list. `git-diff` does not take a list of revisions - it takes one or two revisions, and has defined the `A...B` syntax to mean how it's defined in the `git-diff` manpage. If `git-diff` did not explicitly define `A...B...
7072013
git cherry-pick not working
184
2011-08-15 23:33:21
<p>I'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute <code>git cherry-pick &lt;SHA-hash&gt;</code>, I just get this message:</p> <pre><code># On branch prod_20110801 # Untracked files: # (use "git add &lt;file&gt;..." to include in what will be com...
163,743
293,064
2021-07-21 22:43:31
7,072,029
207
2011-08-15 23:36:05
501,250
2011-08-15 23:36:05
https://stackoverflow.com/q/7072013
https://stackoverflow.com/a/7072029
<p>Git is resolving the cherry-pick as a no-op -- all of the changes introduced by that commit have been introduced by some commit on your current branch. (Or that's what Git thinks, anyway.) Verify that the commit you are cherry-picking hasn't already been merged somehow, as either a proper merge, rebase/cherry-pick...
<p>Git is resolving the cherry-pick as a no-op -- all of the changes introduced by that commit have been introduced by some commit on your current branch. (Or that's what Git thinks, anyway.) Verify that the commit you are cherry-picking hasn't already been merged somehow, as either a proper merge, rebase/cherry-pick...
119, 36489, 53847
branching-and-merging, cherry-pick, git
<h1>git cherry-pick not working</h1> <p>I'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute <code>git cherry-pick &lt;SHA-hash&gt;</code>, I just get this message:</p> <pre><code># On branch prod_20110801 # Untracked files: # (use "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
15,054
git
# git cherry-pick not working I'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute `git cherry-pick <SHA-hash>`, I just get this message: ``` # On branch prod_20110801 # Untracked files: # (use "git add <file>..." to include in what will be committed)...
Git is resolving the cherry-pick as a no-op -- all of the changes introduced by that commit have been introduced by some commit on your current branch. (Or that's what Git thinks, anyway.) Verify that the commit you are cherry-picking hasn't already been merged somehow, as either a proper merge, rebase/cherry-pick, or ...
19023550
How do I add files without dots in them (all extension-less files) to the gitignore file?
175
2013-09-26 08:51:12
<p>Like the title says, is it possible to add "files without dots in them" to the gitignore file?</p> <p>I imagine this would take care of all those bothersome extensionless files.</p>
58,151
992,687
2018-12-20 15:48:18
19,023,985
207
2013-09-26 09:12:06
6,309
2016-04-12 18:33:50
https://stackoverflow.com/q/19023550
https://stackoverflow.com/a/19023985
<p>You can try a combination similar to:</p> <pre><code>* !/**/ !*.* </code></pre> <p>That <a href="https://stackoverflow.com/a/3001967/6309"><code>gitignore</code> exclusion rule</a> (a <a href="https://stackoverflow.com/a/2820310/6309">negated pattern</a>) should ignore all files, except the ones with an extension....
<p>You can try a combination similar to:</p> <pre><code>* !/**/ !*.* </code></pre> <p>That <a href="https://stackoverflow.com/a/3001967/6309"><code>gitignore</code> exclusion rule</a> (a <a href="https://stackoverflow.com/a/2820310/6309">negated pattern</a>) should ignore all files, except the ones with an extension....
119, 25056
git, gitignore
<h1>How do I add files without dots in them (all extension-less files) to the gitignore file?</h1> <p>Like the title says, is it possible to add "files without dots in them" to the gitignore file?</p> <p>I imagine this would take care of all those bothersome extensionless files.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,055
git
# How do I add files without dots in them (all extension-less files) to the gitignore file? Like the title says, is it possible to add "files without dots in them" to the gitignore file? I imagine this would take care of all those bothersome extensionless files.
You can try a combination similar to: ``` * !/**/ !*.* ``` That [`gitignore` exclusion rule](https://stackoverflow.com/a/3001967/6309) (a [negated pattern](https://stackoverflow.com/a/2820310/6309)) should ignore all files, except the ones with an extension. As mentioned [below](https://stackoverflow.com/a/31326382/...
1526471
git: difference between "branchname" and "refs/heads/branchname"
162
2009-10-06 15:47:49
<p>Best to be explained at an example: I am on branch 0.58 of repository and this his how I pull:</p> <pre><code>git pull origin 0.58 </code></pre> <p>When I just call "git pull", I get:</p> <pre><code>ip238:openlierox az$ git pull You asked me to pull without telling me which branch you want to merge with, and 'bra...
151,739
133,374
2023-07-29 04:47:29
1,526,526
207
2009-10-06 15:58:12
119,963
2020-08-14 05:24:14
https://stackoverflow.com/q/1526471
https://stackoverflow.com/a/1526526
<p>A <code>ref</code> is anything pointing to a commit, for example, branches (heads), tags, and remote branches. You should see heads, remotes, and tags in your <code>.git/refs</code> directory, assuming you have all three types of refs in your repository.</p> <p><code>refs/heads/0.58</code> specifies a <em>branch</em...
<p>A <code>ref</code> is anything pointing to a commit, for example, branches (heads), tags, and remote branches. You should see heads, remotes, and tags in your <code>.git/refs</code> directory, assuming you have all three types of refs in your repository.</p> <p><code>refs/heads/0.58</code> specifies a <em>branch</em...
119
git
<h1>git: difference between "branchname" and "refs/heads/branchname"</h1> <p>Best to be explained at an example: I am on branch 0.58 of repository and this his how I pull:</p> <pre><code>git pull origin 0.58 </code></pre> <p>When I just call "git pull", I get:</p> <pre><code>ip238:openlierox az$ git pull You asked m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,056
git
# git: difference between "branchname" and "refs/heads/branchname" Best to be explained at an example: I am on branch 0.58 of repository and this his how I pull: ``` git pull origin 0.58 ``` When I just call "git pull", I get: ``` ip238:openlierox az$ git pull You asked me to pull without telling me which branch yo...
A `ref` is anything pointing to a commit, for example, branches (heads), tags, and remote branches. You should see heads, remotes, and tags in your `.git/refs` directory, assuming you have all three types of refs in your repository. `refs/heads/0.58` specifies a *branch* named 0.58. If you don't specify what namespace...
8021441
How to ignore all hidden directories/files recursively in a git repository?
152
2011-11-05 16:16:41
<p>I'd like to have Git ignore all hidden files and directories. i.e. </p> <ul> <li><code>.aptitude</code></li> <li><code>.ssh/</code></li> <li><code>.bash_rc</code></li> <li><code>config/.hidden</code></li> </ul> <p>Is there a simple rule to cover this without specifically adding each entry?</p>
141,885
332,913
2025-07-09 12:39:43
8,021,453
206
2011-11-05 16:18:14
498,634
2013-07-25 23:37:08
https://stackoverflow.com/q/8021441
https://stackoverflow.com/a/8021453
<p>Just add a pattern to <code>.gitignore</code></p> <pre><code>.* !/.gitignore </code></pre> <p><strong>Edit:</strong> Added the <code>.gitignore</code> file itself (matters if it is not yet commited).</p>
<p>Just add a pattern to <code>.gitignore</code></p> <pre><code>.* !/.gitignore </code></pre> <p><strong>Edit:</strong> Added the <code>.gitignore</code> file itself (matters if it is not yet commited).</p>
119, 25056
git, gitignore
<h1>How to ignore all hidden directories/files recursively in a git repository?</h1> <p>I'd like to have Git ignore all hidden files and directories. i.e. </p> <ul> <li><code>.aptitude</code></li> <li><code>.ssh/</code></li> <li><code>.bash_rc</code></li> <li><code>config/.hidden</code></li> </ul> <p>Is there a simp...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,061
git
# How to ignore all hidden directories/files recursively in a git repository? I'd like to have Git ignore all hidden files and directories. i.e. - `.aptitude` - `.ssh/` - `.bash_rc` - `config/.hidden` Is there a simple rule to cover this without specifically adding each entry?
Just add a pattern to `.gitignore` ``` .* !/.gitignore ``` **Edit:** Added the `.gitignore` file itself (matters if it is not yet commited).
35011366
Move Git LFS tracked files under regular Git
149
2016-01-26 10:10:54
<p>I have a project where I stored video files with Git LFS. Now I ran into some complications with my build server that doesn't yet support Git LFS. As it's an external service, I can't really affect the build process, and thus would want to move the files from under Git LFS back to "regular" Git. I managed to untrack...
89,175
3,413,415
2023-06-19 16:36:21
41,961,459
206
2017-01-31 15:36:18
4,673,402
2019-03-14 19:58:31
https://stackoverflow.com/q/35011366
https://stackoverflow.com/a/41961459
<p>I have just recently run into this problem where assets were accidentally added to git-lfs on one branch that shouldn't have been. My solution was:</p> <pre><code>git lfs untrack '&lt;file-type&gt;' git rm --cached '&lt;file-type&gt;' git add '&lt;file-type&gt;' git commit -m "restore '&lt;file-type&gt;' to git fro...
<p>I have just recently run into this problem where assets were accidentally added to git-lfs on one branch that shouldn't have been. My solution was:</p> <pre><code>git lfs untrack '&lt;file-type&gt;' git rm --cached '&lt;file-type&gt;' git add '&lt;file-type&gt;' git commit -m "restore '&lt;file-type&gt;' to git fro...
119, 115244
git, git-lfs
<h1>Move Git LFS tracked files under regular Git</h1> <p>I have a project where I stored video files with Git LFS. Now I ran into some complications with my build server that doesn't yet support Git LFS. As it's an external service, I can't really affect the build process, and thus would want to move the files from und...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,062
git
# Move Git LFS tracked files under regular Git I have a project where I stored video files with Git LFS. Now I ran into some complications with my build server that doesn't yet support Git LFS. As it's an external service, I can't really affect the build process, and thus would want to move the files from under Git LF...
I have just recently run into this problem where assets were accidentally added to git-lfs on one branch that shouldn't have been. My solution was: ``` git lfs untrack '<file-type>' git rm --cached '<file-type>' git add '<file-type>' git commit -m "restore '<file-type>' to git from lfs" ``` The result is a rewrite of...
10780228
How can I revert multiple Git commits (already pushed) to a published repository?
122
2012-05-28 06:27:49
<p>New to git, and already messing up.</p> <p>I've commited and pushed some changes to a remote dev machine. I need to recover an older version, but keep the "bad progress" doing so far to keep working on a separate branch;</p> <p>I was thinking doing it like this:</p> <ol> <li><strong>Create a local branch</strong>...
192,438
378,170
2024-09-20 00:28:20
10,780,488
206
2012-05-28 06:51:01
1,301,972
2024-09-20 00:28:20
https://stackoverflow.com/q/10780228
https://stackoverflow.com/a/10780488
<h3>The Problem</h3> <p>There are a number of work-flows you can use. The main point is not to break history in a published branch unless you've communicated with everyone who might consume the branch and are willing to do surgery on everyone's clones. It's best not to do that if you can avoid it.</p> <h3>Solutions for...
<h3>The Problem</h3> <p>There are a number of work-flows you can use. The main point is not to break history in a published branch unless you've communicated with everyone who might consume the branch and are willing to do surgery on everyone's clones. It's best not to do that if you can avoid it.</p> <h3>Solutions for...
119, 456
git, version-control
<h1>How can I revert multiple Git commits (already pushed) to a published repository?</h1> <p>New to git, and already messing up.</p> <p>I've commited and pushed some changes to a remote dev machine. I need to recover an older version, but keep the "bad progress" doing so far to keep working on a separate branch;</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,064
git
# How can I revert multiple Git commits (already pushed) to a published repository? New to git, and already messing up. I've commited and pushed some changes to a remote dev machine. I need to recover an older version, but keep the "bad progress" doing so far to keep working on a separate branch; I was thinking doin...
### The Problem There are a number of work-flows you can use. The main point is not to break history in a published branch unless you've communicated with everyone who might consume the branch and are willing to do surgery on everyone's clones. It's best not to do that if you can avoid it. ### Solutions for Published...
42830318
Getting "fatal: Authentication failed" -error when sending git commands in Windows 10
95
2017-03-16 09:42:45
<p>After updating domain password, accessing git-repo is no longer possible. VS Code and Source Tree as well as Visual Studio are returning the following error message on pull, push, fetch etc..</p> <blockquote> <p>fatal: Authentication failed</p> </blockquote> <p>Normally a credentials pop-up should appear however thi...
140,810
1,184,623
2023-07-29 03:40:14
42,830,319
206
2017-03-16 09:42:45
1,184,623
2017-03-16 09:42:45
https://stackoverflow.com/q/42830318
https://stackoverflow.com/a/42830319
<p>The password is stored in windows credential manager and needs to be updated. Open command prompt and enter the following command to view the list of stored passwords:</p> <pre><code>rundll32.exe keymgr.dll,KRShowKeyMgr </code></pre> <p>Scroll down in the list until you spot the git-related entries. Click it and e...
<p>The password is stored in windows credential manager and needs to be updated. Open command prompt and enter the following command to view the list of stored passwords:</p> <pre><code>rundll32.exe keymgr.dll,KRShowKeyMgr </code></pre> <p>Scroll down in the list until you spot the git-related entries. Click it and e...
64, 119, 90056, 111608
atlassian-sourcetree, git, visual-studio-code, windows
<h1>Getting "fatal: Authentication failed" -error when sending git commands in Windows 10</h1> <p>After updating domain password, accessing git-repo is no longer possible. VS Code and Source Tree as well as Visual Studio are returning the following error message on pull, push, fetch etc..</p> <blockquote> <p>fatal: Aut...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,065
git
# Getting "fatal: Authentication failed" -error when sending git commands in Windows 10 After updating domain password, accessing git-repo is no longer possible. VS Code and Source Tree as well as Visual Studio are returning the following error message on pull, push, fetch etc.. > fatal: Authentication failed Normal...
The password is stored in windows credential manager and needs to be updated. Open command prompt and enter the following command to view the list of stored passwords: ``` rundll32.exe keymgr.dll,KRShowKeyMgr ``` Scroll down in the list until you spot the git-related entries. Click it and edit the correct password. ...
8382019
How do I 'git diff' on a certain directory?
230
2011-12-05 07:09:40
<p><code>git diff</code> actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?</p>
225,920
1,004,443
2024-06-06 21:32:56
8,382,054
205
2011-12-05 07:13:57
31,610
2020-06-12 22:06:12
https://stackoverflow.com/q/8382019
https://stackoverflow.com/a/8382054
<p>Provide a path (myfolder in this case) and just run:</p> <pre><code>git diff myfolder/ </code></pre>
<p>Provide a path (myfolder in this case) and just run:</p> <pre><code>git diff myfolder/ </code></pre>
119
git
<h1>How do I 'git diff' on a certain directory?</h1> <p><code>git diff</code> actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,066
git
# How do I 'git diff' on a certain directory? `git diff` actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?
Provide a path (myfolder in this case) and just run: ``` git diff myfolder/ ```
6754881
Java double vs BigDecimal for latitude/longitude
87
2011-07-19 22:27:45
<p>When storing latitudes/longitudes which are typically of the format: 44.087585 (i.e. max 2 numbers before the dot and 6dp) do I need to bother with bigdecimals?</p>
58,374
249,571
2021-04-07 22:31:14
6,765,101
205
2011-07-20 16:16:39
817,828
2021-04-07 22:31:14
https://stackoverflow.com/q/6754881
https://stackoverflow.com/a/6765101
<p>Using <code>double</code> has enough precision for accurate lat/lon down to inches for 6-7 decimal places. In aviation, if decimal degrees are used, they typically go to at least 7 decimal places. In our NASA simulations, lat/lon data are <code>doubles</code> while all other attitude and altitude are floats. In o...
<p>Using <code>double</code> has enough precision for accurate lat/lon down to inches for 6-7 decimal places. In aviation, if decimal degrees are used, they typically go to at least 7 decimal places. In our NASA simulations, lat/lon data are <code>doubles</code> while all other attitude and altitude are floats. In o...
17, 451, 12620, 15516, 20301
bigdecimal, double, geospatial, java, latitude-longitude
<h1>Java double vs BigDecimal for latitude/longitude</h1> <p>When storing latitudes/longitudes which are typically of the format: 44.087585 (i.e. max 2 numbers before the dot and 6dp) do I need to bother with bigdecimals?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,070
git
# Java double vs BigDecimal for latitude/longitude When storing latitudes/longitudes which are typically of the format: 44.087585 (i.e. max 2 numbers before the dot and 6dp) do I need to bother with bigdecimals?
Using `double` has enough precision for accurate lat/lon down to inches for 6-7 decimal places. In aviation, if decimal degrees are used, they typically go to at least 7 decimal places. In our NASA simulations, lat/lon data are `doubles` while all other attitude and altitude are floats. In other words, the 6th decimal ...
11200839
Why git can't do hard/soft resets by path?
198
2012-06-26 04:36:45
<p><code>$ git reset -- &lt;file_path&gt;</code> can reset by path.</p> <p>However, <code>$ git reset (--hard|--soft) &lt;file_path&gt;</code> will report an error like below:</p> <pre><code>Cannot do hard|soft reset with paths. </code></pre>
161,388
1,395,106
2024-07-16 18:59:53
11,200,860
204
2012-06-26 04:39:54
148,870
2016-11-24 02:34:43
https://stackoverflow.com/q/11200839
https://stackoverflow.com/a/11200860
<p>Because there's no point (other commands provide that functionality already), and it reduces the potential for doing the wrong thing by accident.</p> <p>A "hard reset" for a path is just done with <code>git checkout HEAD -- &lt;path&gt;</code> (checking out the existing version of the file).</p> <p>A soft reset fo...
<p>Because there's no point (other commands provide that functionality already), and it reduces the potential for doing the wrong thing by accident.</p> <p>A "hard reset" for a path is just done with <code>git checkout HEAD -- &lt;path&gt;</code> (checking out the existing version of the file).</p> <p>A soft reset fo...
119, 51381
git, git-reset
<h1>Why git can't do hard/soft resets by path?</h1> <p><code>$ git reset -- &lt;file_path&gt;</code> can reset by path.</p> <p>However, <code>$ git reset (--hard|--soft) &lt;file_path&gt;</code> will report an error like below:</p> <pre><code>Cannot do hard|soft reset with paths. </code></pre>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,071
git
# Why git can't do hard/soft resets by path? `$ git reset -- <file_path>` can reset by path. However, `$ git reset (--hard|--soft) <file_path>` will report an error like below: ``` Cannot do hard|soft reset with paths. ```
Because there's no point (other commands provide that functionality already), and it reduces the potential for doing the wrong thing by accident. A "hard reset" for a path is just done with `git checkout HEAD -- <path>` (checking out the existing version of the file). A soft reset for a path doesn't make sense. A mi...
25715898
What's the difference between Git ignoring directory and directory/*?
109
2014-09-08 00:03:33
<p>I'm confused about what's the correct way to ignore the contents of a directory in git.</p> <p>Assume I have the following directory structure:</p> <pre><code>my_project |--www |--1.txt |--2.txt |--.gitignore </code></pre> <p>What's the difference between putting this:</p> <pre>...
5,565
2,303,252
2014-09-25 18:45:35
25,716,803
204
2014-09-08 02:45:26
2,749,114
2014-09-08 02:58:52
https://stackoverflow.com/q/25715898
https://stackoverflow.com/a/25716803
<p>There're differences among <code>www</code>, <code>www/</code> and <code>www/*</code>.</p> <p><strong>Basically from the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">documentation</a> and my own tests, <code>www</code> find a match with a file or a directory, <code>www/</code> only matches a directo...
<p>There're differences among <code>www</code>, <code>www/</code> and <code>www/*</code>.</p> <p><strong>Basically from the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">documentation</a> and my own tests, <code>www</code> find a match with a file or a directory, <code>www/</code> only matches a directo...
119, 14868, 25056, 54848
dotfiles, git, gitignore, notation
<h1>What's the difference between Git ignoring directory and directory/*?</h1> <p>I'm confused about what's the correct way to ignore the contents of a directory in git.</p> <p>Assume I have the following directory structure:</p> <pre><code>my_project |--www |--1.txt |--2.txt |--.git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,072
git
# What's the difference between Git ignoring directory and directory/*? I'm confused about what's the correct way to ignore the contents of a directory in git. Assume I have the following directory structure: ``` my_project |--www |--1.txt |--2.txt |--.gitignore ``` What's the diff...
There're differences among `www`, `www/` and `www/*`. **Basically from the [documentation](http://git-scm.com/docs/gitignore) and my own tests, `www` find a match with a file or a directory, `www/` only matches a directory, while `www/*` matches directories and files inside `www`.** I'll only discuss on the differenc...
20038056
Discard Git Stash Pop
147
2013-11-18 00:25:32
<p>I did a git stash pop and now I have a ton of conflicts. I had committed all my recent code before the <code>git stash pop</code>, so is there a way to go back to the last commit and get rid of all the conflicts and code the <code>git stash pop</code> injected?</p>
94,282
307,428
2018-02-05 09:25:17
20,038,085
203
2013-11-18 00:30:51
2,615,944
2016-06-21 20:28:16
https://stackoverflow.com/q/20038056
https://stackoverflow.com/a/20038085
<p>This has already been asked and answered on stackoverflow (see <a href="https://stackoverflow.com/questions/4114095/revert-to-previous-git-commit">How to revert Git repository to a previous commit?</a>), but the simple answer is:</p> <pre><code>git reset --hard HEAD </code></pre> <p>This should take care of your p...
<p>This has already been asked and answered on stackoverflow (see <a href="https://stackoverflow.com/questions/4114095/revert-to-previous-git-commit">How to revert Git repository to a previous commit?</a>), but the simple answer is:</p> <pre><code>git reset --hard HEAD </code></pre> <p>This should take care of your p...
119
git
<h1>Discard Git Stash Pop</h1> <p>I did a git stash pop and now I have a ton of conflicts. I had committed all my recent code before the <code>git stash pop</code>, so is there a way to go back to the last commit and get rid of all the conflicts and code the <code>git stash pop</code> injected?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,074
git
# Discard Git Stash Pop I did a git stash pop and now I have a ton of conflicts. I had committed all my recent code before the `git stash pop`, so is there a way to go back to the last commit and get rid of all the conflicts and code the `git stash pop` injected?
This has already been asked and answered on stackoverflow (see [How to revert Git repository to a previous commit?](https://stackoverflow.com/questions/4114095/revert-to-previous-git-commit)), but the simple answer is: ``` git reset --hard HEAD ``` This should take care of your problem. **Note that this removes all u...
36810467
git commit signing failed: secret key not available
276
2016-04-23 11:54:18
<p>I am getting this error when trying to commit using Git.</p> <pre><code>gpg: skipped "name &lt;name@mail.com&gt;": secret key not available gpg: signing failed: secret key not available error: gpg failed to sign the data fatal: failed to write commit object </code></pre> <p>I have generated a new key as below but ...
186,054
6,124,030
2025-02-07 21:49:37
36,811,656
202
2016-04-23 13:49:47
1,437,507
2019-12-04 10:50:44
https://stackoverflow.com/q/36810467
https://stackoverflow.com/a/36811656
<p>You need to configure the secret key before using it.</p> <pre><code>git config user.signingkey 35F5FFB2 </code></pre> <p>Or declare it globally if you want to use the same key for every repository.</p> <pre><code>git config --global user.signingkey 35F5FFB2 </code></pre> <p>Source: <a href="https://git-scm.com/...
<p>You need to configure the secret key before using it.</p> <pre><code>git config user.signingkey 35F5FFB2 </code></pre> <p>Or declare it globally if you want to use the same key for every repository.</p> <pre><code>git config --global user.signingkey 35F5FFB2 </code></pre> <p>Source: <a href="https://git-scm.com/...
119
git
<h1>git commit signing failed: secret key not available</h1> <p>I am getting this error when trying to commit using Git.</p> <pre><code>gpg: skipped "name &lt;name@mail.com&gt;": secret key not available gpg: signing failed: secret key not available error: gpg failed to sign the data fatal: failed to write commit obje...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,076
git
# git commit signing failed: secret key not available I am getting this error when trying to commit using Git. ``` gpg: skipped "name <name@mail.com>": secret key not available gpg: signing failed: secret key not available error: gpg failed to sign the data fatal: failed to write commit object ``` I have generated a...
You need to configure the secret key before using it. ``` git config user.signingkey 35F5FFB2 ``` Or declare it globally if you want to use the same key for every repository. ``` git config --global user.signingkey 35F5FFB2 ``` Source: [Git Tools - Signing Your Work](https://git-scm.com/book/en/v2/Git-Tools-Signin...
35123108
Cherry-pick and squash a range of commits into a subdirectory or subtree
148
2016-02-01 04:41:43
<p>How can I tell cherry-pick to pick range of commits and squash it?</p> <p>Or in other words, apply the diff between two commits to the current state of the repository?</p> <p>The following does <em>not</em> work (cherry-pick has no --squash option):</p> <pre><code>git cherry-pick --squash e064480..eab48b59c </code><...
88,133
246,724
2025-06-11 10:44:26
35,130,099
202
2016-02-01 12:04:36
724,411
2016-02-01 12:04:36
https://stackoverflow.com/q/35123108
https://stackoverflow.com/a/35130099
<p>Pass <code>-n</code> to <code>git cherry-pick</code>. This will apply all the commits, but not commit them. Then simply do <code>git commit</code> to commit all the changes in a single commit.</p>
<p>Pass <code>-n</code> to <code>git cherry-pick</code>. This will apply all the commits, but not commit them. Then simply do <code>git commit</code> to commit all the changes in a single commit.</p>
119, 78810, 98455
git, git-cherry-pick, git-squash
<h1>Cherry-pick and squash a range of commits into a subdirectory or subtree</h1> <p>How can I tell cherry-pick to pick range of commits and squash it?</p> <p>Or in other words, apply the diff between two commits to the current state of the repository?</p> <p>The following does <em>not</em> work (cherry-pick has no --s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,079
git
# Cherry-pick and squash a range of commits into a subdirectory or subtree How can I tell cherry-pick to pick range of commits and squash it? Or in other words, apply the diff between two commits to the current state of the repository? The following does *not* work (cherry-pick has no --squash option): ``` git cher...
Pass `-n` to `git cherry-pick`. This will apply all the commits, but not commit them. Then simply do `git commit` to commit all the changes in a single commit.
5507489
Git Server Like GitHub?
414
2011-03-31 23:13:02
<p>I am a long time Subversion user that is going to try Git. I have read some about it and understand the distributed nature - I can see a lot of the benefits. </p> <p>However, I do like the idea of a central server that can take on the role of backups, system of record, etc, while still using Git for my local bran...
302,680
469,106
2021-05-06 16:53:08
5,507,556
201
2011-03-31 23:21:08
576,139
2015-07-27 01:52:19
https://stackoverflow.com/q/5507489
https://stackoverflow.com/a/5507556
<p>You can just set up an ssh server and run a central repository there. All developers then simply agree (as a matter of policy) to push to the server when they are done making commits. This is the usage pattern at my workplace. Very CVS and SVN-like.</p> <ol> <li>Find somewhere to put the repository (<code>/var/gitr...
<p>You can just set up an ssh server and run a central repository there. All developers then simply agree (as a matter of policy) to push to the server when they are done making commits. This is the usage pattern at my workplace. Very CVS and SVN-like.</p> <ol> <li>Find somewhere to put the repository (<code>/var/gitr...
119
git
<h1>Git Server Like GitHub?</h1> <p>I am a long time Subversion user that is going to try Git. I have read some about it and understand the distributed nature - I can see a lot of the benefits. </p> <p>However, I do like the idea of a central server that can take on the role of backups, system of record, etc, while ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,082
git
# Git Server Like GitHub? I am a long time Subversion user that is going to try Git. I have read some about it and understand the distributed nature - I can see a lot of the benefits. However, I do like the idea of a central server that can take on the role of backups, system of record, etc, while still using Git for...
You can just set up an ssh server and run a central repository there. All developers then simply agree (as a matter of policy) to push to the server when they are done making commits. This is the usage pattern at my workplace. Very CVS and SVN-like. 1. Find somewhere to put the repository (`/var/gitroot` for example)....
10330425
How do I export a Git log to a text file?
131
2012-04-26 09:10:47
<p>I want to export the log of all commits in a repository to a text file. Is there a way to do this?</p>
158,938
1,250,250
2024-05-27 14:06:08
10,330,711
201
2012-04-26 09:29:57
365,237
2012-04-26 09:29:57
https://stackoverflow.com/q/10330425
https://stackoverflow.com/a/10330711
<p>You'll just need to disable the pager.</p> <pre><code>git --no-pager log &gt; log.txt </code></pre> <p>If you want to format it to look nicer, you can use <a href="http://linux.die.net/man/1/git-log" rel="noreferrer">parameters</a> of git log.</p>
<p>You'll just need to disable the pager.</p> <pre><code>git --no-pager log &gt; log.txt </code></pre> <p>If you want to format it to look nicer, you can use <a href="http://linux.die.net/man/1/git-log" rel="noreferrer">parameters</a> of git log.</p>
119
git
<h1>How do I export a Git log to a text file?</h1> <p>I want to export the log of all commits in a repository to a text file. Is there a way to do this?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,083
git
# How do I export a Git log to a text file? I want to export the log of all commits in a repository to a text file. Is there a way to do this?
You'll just need to disable the pager. ``` git --no-pager log > log.txt ``` If you want to format it to look nicer, you can use [parameters](http://linux.die.net/man/1/git-log) of git log.
12650261
Git says local branch is behind remote branch, but it's not
88
2012-09-29 05:41:29
<p>Scenario: </p> <ol> <li>I make a new branch<br></li> <li>hack on it<br></li> <li>commit it<br></li> <li>push it<br></li> <li>hack on it some more<br></li> <li>commit again<br></li> <li>try to push again<br></li> </ol> <p>Git responds:</p> <blockquote> <p>Updates were rejected because the tip of your current br...
178,653
1,325,172
2017-08-14 10:43:32
12,651,399
201
2012-09-29 09:03:31
758,345
2016-01-19 12:10:14
https://stackoverflow.com/q/12650261
https://stackoverflow.com/a/12651399
<p>You probably did some history rewriting? Your local branch diverged from the one on the server. Run this command to get a better understanding of what happened:</p> <pre><code>gitk HEAD @{u} </code></pre> <p>I would strongly recommend you try to understand where this error is coming from. To fix it, simply run:</p...
<p>You probably did some history rewriting? Your local branch diverged from the one on the server. Run this command to get a better understanding of what happened:</p> <pre><code>gitk HEAD @{u} </code></pre> <p>I would strongly recommend you try to understand where this error is coming from. To fix it, simply run:</p...
119, 28898
git, git-push
<h1>Git says local branch is behind remote branch, but it's not</h1> <p>Scenario: </p> <ol> <li>I make a new branch<br></li> <li>hack on it<br></li> <li>commit it<br></li> <li>push it<br></li> <li>hack on it some more<br></li> <li>commit again<br></li> <li>try to push again<br></li> </ol> <p>Git responds:</p> <bloc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,085
git
# Git says local branch is behind remote branch, but it's not Scenario: 1. I make a new branch 2. hack on it 3. commit it 4. push it 5. hack on it some more 6. commit again 7. try to push again Git responds: > Updates were rejected because the tip of your current branch is behind > its remote counterpart. etc. I'm...
You probably did some history rewriting? Your local branch diverged from the one on the server. Run this command to get a better understanding of what happened: ``` gitk HEAD @{u} ``` I would strongly recommend you try to understand where this error is coming from. To fix it, simply run: ``` git push -f ``` **The `...
22424142
error: Your local changes to the following files would be overwritten by checkout
239
2014-03-15 13:01:08
<p><em>This question is similar to <a href="https://stackoverflow.com/questions/14318234/how-to-ignore-error-on-git-pull-about-my-local-changes-would-be-overwritten-by-m">this one</a>, but more specific.</em></p> <p>I have a project with two branches: <code>staging</code> and <code>beta</code>. I develop on <code>stagi...
569,462
2,571,840
2024-08-13 19:36:13
22,424,970
200
2014-03-15 14:20:13
744,720
2023-02-15 21:31:22
https://stackoverflow.com/q/22424142
https://stackoverflow.com/a/22424970
<p>Your error appears when you have modified a file and the branch that you are switching to has changes for this file too (from latest merge point).</p> <p>Your options, as I see it, are</p> <ul> <li>commit, and then amend this commit with extra changes (you can modify commits in git, as long as they're not <code>push...
<p>Your error appears when you have modified a file and the branch that you are switching to has changes for this file too (from latest merge point).</p> <p>Your options, as I see it, are</p> <ul> <li>commit, and then amend this commit with extra changes (you can modify commits in git, as long as they're not <code>push...
119, 28897, 37230
git, git-checkout, git-merge
<h1>error: Your local changes to the following files would be overwritten by checkout</h1> <p><em>This question is similar to <a href="https://stackoverflow.com/questions/14318234/how-to-ignore-error-on-git-pull-about-my-local-changes-would-be-overwritten-by-m">this one</a>, but more specific.</em></p> <p>I have a proj...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,086
git
# error: Your local changes to the following files would be overwritten by checkout *This question is similar to [this one](https://stackoverflow.com/questions/14318234/how-to-ignore-error-on-git-pull-about-my-local-changes-would-be-overwritten-by-m), but more specific.* I have a project with two branches: `staging` ...
Your error appears when you have modified a file and the branch that you are switching to has changes for this file too (from latest merge point). Your options, as I see it, are - commit, and then amend this commit with extra changes (you can modify commits in git, as long as they're not `push`ed); or - use stash: ...
5241644
Using .gitignore to ignore everything but specific directories
219
2011-03-09 05:14:29
<p>My issue is that I have a bunch of WordPress websites in my git repo, of which I want to selectively commit only the content of my <code>themes</code> folders, while ignoring the rest of the redundant files found in WordPress. </p> <p>I've used .gitignore files to ignore file types before, but can it be used the o...
149,349
165,673
2020-02-23 16:41:51
5,250,314
200
2011-03-09 18:19:53
165,673
2014-07-01 21:13:45
https://stackoverflow.com/q/5241644
https://stackoverflow.com/a/5250314
<p>Here's how I did it - you essentially have to walk up the paths, you can't wildcard more than one level in any direction:</p> <pre><code># Ignore everything: * # Except for the themes directories: !wordpress/ !wordpress/*/ !wordpress/*/wp-content/ !wordpress/*/wp-content/themes/ !wordpress/*/wp-content/themes/* !...
<p>Here's how I did it - you essentially have to walk up the paths, you can't wildcard more than one level in any direction:</p> <pre><code># Ignore everything: * # Except for the themes directories: !wordpress/ !wordpress/*/ !wordpress/*/wp-content/ !wordpress/*/wp-content/themes/ !wordpress/*/wp-content/themes/* !...
119, 3889, 25056
git, gitignore, glob
<h1>Using .gitignore to ignore everything but specific directories</h1> <p>My issue is that I have a bunch of WordPress websites in my git repo, of which I want to selectively commit only the content of my <code>themes</code> folders, while ignoring the rest of the redundant files found in WordPress. </p> <p>I've use...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,088
git
# Using .gitignore to ignore everything but specific directories My issue is that I have a bunch of WordPress websites in my git repo, of which I want to selectively commit only the content of my `themes` folders, while ignoring the rest of the redundant files found in WordPress. I've used .gitignore files to ignore ...
Here's how I did it - you essentially have to walk up the paths, you can't wildcard more than one level in any direction: ``` # Ignore everything: * # Except for the themes directories: !wordpress/ !wordpress/*/ !wordpress/*/wp-content/ !wordpress/*/wp-content/themes/ !wordpress/*/wp-content/themes/* !wordpress/*/wp...
616556
How do you squash commits into one patch with git format-patch?
183
2009-03-05 20:53:59
<p>I've got eight commits on a branch that I'd like to email to some people who aren't git enlightened, yet. So far, everything I do either gives me 8 patch files, or starts giving me patch files for every commit in the branch's history, since the beginning of time. I used git rebase --interactive to squash the commi...
111,028
18,103
2021-01-09 23:44:42
616,766
200
2009-03-05 21:46:58
33,164
2021-01-09 23:44:42
https://stackoverflow.com/q/616556
https://stackoverflow.com/a/616766
<p>I'd recommend doing this on a throwaway branch as follows. If your commits are in the &quot;newlines&quot; branch and you have switched back to your &quot;master&quot; branch already, this should do the trick:</p> <pre><code>[adam@mbp2600 example (master)]$ git checkout -b tmpsquash Switched to a new branch &quot;t...
<p>I'd recommend doing this on a throwaway branch as follows. If your commits are in the &quot;newlines&quot; branch and you have switched back to your &quot;master&quot; branch already, this should do the trick:</p> <pre><code>[adam@mbp2600 example (master)]$ git checkout -b tmpsquash Switched to a new branch &quot;t...
119, 2132, 42532, 98455
git, git-squash, patch, squash
<h1>How do you squash commits into one patch with git format-patch?</h1> <p>I've got eight commits on a branch that I'd like to email to some people who aren't git enlightened, yet. So far, everything I do either gives me 8 patch files, or starts giving me patch files for every commit in the branch's history, since th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,089
git
# How do you squash commits into one patch with git format-patch? I've got eight commits on a branch that I'd like to email to some people who aren't git enlightened, yet. So far, everything I do either gives me 8 patch files, or starts giving me patch files for every commit in the branch's history, since the beginnin...
I'd recommend doing this on a throwaway branch as follows. If your commits are in the "newlines" branch and you have switched back to your "master" branch already, this should do the trick: ``` [adam@mbp2600 example (master)]$ git checkout -b tmpsquash Switched to a new branch "tmpsquash" [adam@mbp2600 example (tmpsq...
4235431
Git - deleted some files locally, how do I get them from a remote repository
152
2010-11-20 22:52:46
<p>I've deleted some files on my PC, how do I download them again?</p> <p>Pull says: "Already up-to-date".</p>
197,410
500,933
2025-12-24 22:18:04
4,235,559
200
2010-11-20 23:20:14
119,963
2025-12-24 22:18:04
https://stackoverflow.com/q/4235431
https://stackoverflow.com/a/4235559
<p>Since git is a distributed VCS, your local repository contains all of the information. No downloading is necessary; you just need to extract the content you want from the repo at your fingertips.</p> <p>If you haven't committed the deletion, just check out the files from your current commit:</p> <pre><code>git check...
<p>Since git is a distributed VCS, your local repository contains all of the information. No downloading is necessary; you just need to extract the content you want from the repo at your fingertips.</p> <p>If you haven't committed the deletion, just check out the files from your current commit:</p> <pre><code>git check...
119
git
<h1>Git - deleted some files locally, how do I get them from a remote repository</h1> <p>I've deleted some files on my PC, how do I download them again?</p> <p>Pull says: "Already up-to-date".</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,090
git
# Git - deleted some files locally, how do I get them from a remote repository I've deleted some files on my PC, how do I download them again? Pull says: "Already up-to-date".
Since git is a distributed VCS, your local repository contains all of the information. No downloading is necessary; you just need to extract the content you want from the repo at your fingertips. If you haven't committed the deletion, just check out the files from your current commit: ``` git checkout HEAD <path>... ...
44246876
How to remove cached credentials from Git?
123
2017-05-29 16:24:36
<p>I ran:</p> <pre><code>$ git config credential.helper store </code></pre> <p>And then:</p> <pre><code>$ git push origin master </code></pre> <p>After pushing, I entered my credentials and they were saved. <br>I read that they are stored in plaintext, and so now I want to remove my credentials from being saved and ent...
276,342
5,869,848
2024-11-13 01:57:00
46,764,829
200
2017-10-16 07:16:23
4,162,588
2017-10-16 07:16:23
https://stackoverflow.com/q/44246876
https://stackoverflow.com/a/46764829
<p>Run the following command in the terminal to remove your credentials stored in the cache </p> <pre><code>git config --global --unset credential.helper </code></pre>
<p>Run the following command in the terminal to remove your credentials stored in the cache </p> <pre><code>git config --global --unset credential.helper </code></pre>
58, 119, 5357
credentials, git, linux
<h1>How to remove cached credentials from Git?</h1> <p>I ran:</p> <pre><code>$ git config credential.helper store </code></pre> <p>And then:</p> <pre><code>$ git push origin master </code></pre> <p>After pushing, I entered my credentials and they were saved. <br>I read that they are stored in plaintext, and so now I wa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,092
git
# How to remove cached credentials from Git? I ran: ``` $ git config credential.helper store ``` And then: ``` $ git push origin master ``` After pushing, I entered my credentials and they were saved. I read that they are stored in plaintext, and so now I want to remove my credentials from being saved and enter...
Run the following command in the terminal to remove your credentials stored in the cache ``` git config --global --unset credential.helper ```
6872223
How do I revert master branch to a tag in git?
115
2011-07-29 11:10:13
<p>We have branches origin and develop. The initial state of master was tagged at <code>tag_ABC</code>.</p> <p>We have few changes made to the develop branch and pushed to origin. Then we have accidentally merged develop into master and pushed to origin. </p> <p>Now we would like to revert master to the checkpoint <...
92,986
765,581
2021-02-24 10:59:37
6,872,462
200
2011-07-29 11:31:33
693,166
2021-02-24 10:59:37
https://stackoverflow.com/q/6872223
https://stackoverflow.com/a/6872462
<p>You can do</p> <pre><code>git checkout master git reset --hard tag_ABC git push --force origin master </code></pre> <p>Please note that this will overwrite existing history in the upstream repo and may cause problems for other developers who have this repo checked out.</p> <p>As per <a href="https://stackoverflow.co...
<p>You can do</p> <pre><code>git checkout master git reset --hard tag_ABC git push --force origin master </code></pre> <p>Please note that this will overwrite existing history in the upstream repo and may cause problems for other developers who have this repo checked out.</p> <p>As per <a href="https://stackoverflow.co...
119
git
<h1>How do I revert master branch to a tag in git?</h1> <p>We have branches origin and develop. The initial state of master was tagged at <code>tag_ABC</code>.</p> <p>We have few changes made to the develop branch and pushed to origin. Then we have accidentally merged develop into master and pushed to origin. </p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,093
git
# How do I revert master branch to a tag in git? We have branches origin and develop. The initial state of master was tagged at `tag_ABC`. We have few changes made to the develop branch and pushed to origin. Then we have accidentally merged develop into master and pushed to origin. Now we would like to revert master...
You can do ``` git checkout master git reset --hard tag_ABC git push --force origin master ``` Please note that this will overwrite existing history in the upstream repo and may cause problems for other developers who have this repo checked out. As per [Luke Wenke's comment](https://stackoverflow.com/questions/68722...
4043609
getting "fatal: not a git repository: '.'" when using post-update hook to execute 'git pull' on another repo
100
2010-10-28 14:00:41
<p>I'm new to git so I apologize (and please correct me) if I misuse terminology here, but I'll do my best.</p> <p>I'm trying to set up a bare git repo (hub) and a development site working copy (prime) on a web server. I've tried to pattern it after <a href="http://joemaller.com/990/a-web-focused-git-workflow/" rel="n...
24,843
113,910
2024-08-27 14:59:01
4,100,577
200
2010-11-04 19:40:47
113,910
2010-11-04 19:40:47
https://stackoverflow.com/q/4043609
https://stackoverflow.com/a/4100577
<p>Here is the script that ultimately worked. I think the bit I was originally missing that prevented it from working remotely was the <code>unset GIT_DIR</code></p> <pre><code>#!/bin/sh cd /path/to/working-copy/ || exit unset GIT_DIR git pull repo branch exec git-update-server-info </code></pre>
<p>Here is the script that ultimately worked. I think the bit I was originally missing that prevented it from working remotely was the <code>unset GIT_DIR</code></p> <pre><code>#!/bin/sh cd /path/to/working-copy/ || exit unset GIT_DIR git pull repo branch exec git-update-server-info </code></pre>
119, 43087
git, githooks
<h1>getting "fatal: not a git repository: '.'" when using post-update hook to execute 'git pull' on another repo</h1> <p>I'm new to git so I apologize (and please correct me) if I misuse terminology here, but I'll do my best.</p> <p>I'm trying to set up a bare git repo (hub) and a development site working copy (prime)...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,094
git
# getting "fatal: not a git repository: '.'" when using post-update hook to execute 'git pull' on another repo I'm new to git so I apologize (and please correct me) if I misuse terminology here, but I'll do my best. I'm trying to set up a bare git repo (hub) and a development site working copy (prime) on a web server...
Here is the script that ultimately worked. I think the bit I was originally missing that prevented it from working remotely was the `unset GIT_DIR` ``` #!/bin/sh cd /path/to/working-copy/ || exit unset GIT_DIR git pull repo branch exec git-update-server-info ```
5658302
Checking out an old commit and maintaining the head on the master branch?
91
2011-04-14 03:47:01
<p>Currently for switching to another git commit (on the same branch...actually, on the master branch!), I'm executing the command</p> <pre><code>git checkout ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a </code></pre> <p>Now, every time I do this git tells me that I'm now with a detached head. How do I go to an older com...
84,183
130,758
2017-03-06 16:02:29
5,658,339
200
2011-04-14 03:54:08
282,975
2011-04-14 03:54:08
https://stackoverflow.com/q/5658302
https://stackoverflow.com/a/5658339
<p>Most of the time when I do this I checkout to a temp branch:</p> <pre><code>git checkout -b temp-branch-name ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a </code></pre> <p>Then after I'm done i just delete the branch </p>
<p>Most of the time when I do this I checkout to a temp branch:</p> <pre><code>git checkout -b temp-branch-name ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a </code></pre> <p>Then after I'm done i just delete the branch </p>
119, 456
git, version-control
<h1>Checking out an old commit and maintaining the head on the master branch?</h1> <p>Currently for switching to another git commit (on the same branch...actually, on the master branch!), I'm executing the command</p> <pre><code>git checkout ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a </code></pre> <p>Now, every time I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,096
git
# Checking out an old commit and maintaining the head on the master branch? Currently for switching to another git commit (on the same branch...actually, on the master branch!), I'm executing the command ``` git checkout ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a ``` Now, every time I do this git tells me that I'm now...
Most of the time when I do this I checkout to a temp branch: ``` git checkout -b temp-branch-name ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a ``` Then after I'm done i just delete the branch
4589731
Git Blame Commit Statistics
231
2011-01-04 00:46:41
<p>How can I "abuse" blame (or some better suited function, and/or in conjunction with shell commands) to give me a statistic of how much lines (of code) are currently in the repository originating from each committer?</p> <p>Example Output:</p> <pre><code>Committer 1: 8046 Lines Committer 2: 4378 Lines </code></pre>...
68,232
null
2021-05-04 14:24:38
13,687,302
199
2012-12-03 16:14:27
887,836
2021-05-04 14:24:38
https://stackoverflow.com/q/4589731
https://stackoverflow.com/a/13687302
<h3>Update</h3> <pre><code>git ls-tree -r -z --name-only HEAD -- */*.c | sed 's/^/.\//' | xargs -0 -n1 git blame \ --line-porcelain HEAD |grep -ae &quot;^author &quot;|sort|uniq -c|sort -nr </code></pre> <p>I updated some things on the way.</p> <p>For convenience, you can also put this into its own command:</p> <pre><...
<h3>Update</h3> <pre><code>git ls-tree -r -z --name-only HEAD -- */*.c | sed 's/^/.\//' | xargs -0 -n1 git blame \ --line-porcelain HEAD |grep -ae &quot;^author &quot;|sort|uniq -c|sort -nr </code></pre> <p>I updated some things on the way.</p> <p>For convenience, you can also put this into its own command:</p> <pre><...
119
git
<h1>Git Blame Commit Statistics</h1> <p>How can I "abuse" blame (or some better suited function, and/or in conjunction with shell commands) to give me a statistic of how much lines (of code) are currently in the repository originating from each committer?</p> <p>Example Output:</p> <pre><code>Committer 1: 8046 Lines ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,097
git
# Git Blame Commit Statistics How can I "abuse" blame (or some better suited function, and/or in conjunction with shell commands) to give me a statistic of how much lines (of code) are currently in the repository originating from each committer? Example Output: ``` Committer 1: 8046 Lines Committer 2: 4378 Lines ```
### Update ``` git ls-tree -r -z --name-only HEAD -- */*.c | sed 's/^/.\//' | xargs -0 -n1 git blame \ --line-porcelain HEAD |grep -ae "^author "|sort|uniq -c|sort -nr ``` I updated some things on the way. For convenience, you can also put this into its own command: ``` #!/bin/bash # save as i.e.: git-authors and...
377213
Git serve: I would like it that simple
143
2008-12-18 08:34:56
<p>I want to know how to simply publish over http = much like <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a>'s hg serve! On the Windows/work box do this:</p> <pre><code>git serve </code></pre> <p>and then on the Linux box SIMPLY go:</p> <pre><code>git clone http://project project <...
22,430
21,537
2019-03-03 17:33:59
377,293
199
2008-12-18 09:07:40
43,662
2013-06-03 12:20:57
https://stackoverflow.com/q/377213
https://stackoverflow.com/a/377293
<p>Navigate into your project and start git-daemon with the following switches:</p> <pre><code>cd project git daemon --reuseaddr --base-path=. --export-all --verbose </code></pre> <p>This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .gi...
<p>Navigate into your project and start git-daemon with the following switches:</p> <pre><code>cd project git daemon --reuseaddr --base-path=. --export-all --verbose </code></pre> <p>This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .gi...
64, 119, 802
git, mercurial, windows
<h1>Git serve: I would like it that simple</h1> <p>I want to know how to simply publish over http = much like <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a>'s hg serve! On the Windows/work box do this:</p> <pre><code>git serve </code></pre> <p>and then on the Linux box SIMPLY go:</p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,099
git
# Git serve: I would like it that simple I want to know how to simply publish over http = much like [Mercurial](http://en.wikipedia.org/wiki/Mercurial)'s hg serve! On the Windows/work box do this: ``` git serve ``` and then on the Linux box SIMPLY go: ``` git clone http://project project ``` finished.
Navigate into your project and start git-daemon with the following switches: ``` cd project git daemon --reuseaddr --base-path=. --export-all --verbose ``` This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .git/ folder). It also tells i...
9583527
git - diff of current changes before committing
131
2012-03-06 12:15:37
<p>I have changed several files in a git repository, but have not committed them yet.</p> <p>I can get a list of the changes by just invoking <code>git status</code>. But how do I get a listing of the <em>lines</em> or the <em>content</em> that I have changed, in addition to the filenames?</p> <p>I initially thought ...
100,544
312,586
2019-09-04 21:06:01
9,583,539
199
2012-03-06 12:16:33
1,116,279
2017-09-02 22:05:33
https://stackoverflow.com/q/9583527
https://stackoverflow.com/a/9583539
<p><code>git diff</code> by default shows difference between your <em>working directory</em> and the <em>index</em> (<em>staging area</em> for the next commit).</p> <p>If you have already added (<em>staged</em>) the changes to the <em>staging area</em>, <code>git diff --staged</code> does the job. <em>Staging area</e...
<p><code>git diff</code> by default shows difference between your <em>working directory</em> and the <em>index</em> (<em>staging area</em> for the next commit).</p> <p>If you have already added (<em>staged</em>) the changes to the <em>staging area</em>, <code>git diff --staged</code> does the job. <em>Staging area</e...
119, 386, 606, 13630
diff, git, meld, ssh
<h1>git - diff of current changes before committing</h1> <p>I have changed several files in a git repository, but have not committed them yet.</p> <p>I can get a list of the changes by just invoking <code>git status</code>. But how do I get a listing of the <em>lines</em> or the <em>content</em> that I have changed, i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,101
git
# git - diff of current changes before committing I have changed several files in a git repository, but have not committed them yet. I can get a list of the changes by just invoking `git status`. But how do I get a listing of the *lines* or the *content* that I have changed, in addition to the filenames? I initially...
`git diff` by default shows difference between your *working directory* and the *index* (*staging area* for the next commit). If you have already added (*staged*) the changes to the *staging area*, `git diff --staged` does the job. *Staging area* is the data from which the next commit will be formed by `git commit`. ...
11356460
How to cleanly get/copy a remote git branch to local repository
126
2012-07-06 05:41:34
<p>I want an exact "copy" of a remote branch "copied" to a specific local branch. </p> <p>Say, for example, a team member has created an experimental feature, which he has checked into a branch called <code>experiment</code> on the remote repository. I want to be able to checkout a new branch on my local repository, ...
180,562
1,210,718
2025-01-16 19:56:54
11,356,470
199
2012-07-06 05:42:50
520,162
2019-11-23 08:43:12
https://stackoverflow.com/q/11356460
https://stackoverflow.com/a/11356470
<p>If you don't care about merging:</p> <pre><code>git reset --hard &lt;remote&gt;/&lt;branch_name&gt; </code></pre> <p>This will exactly do what you want: no merging, no rebasing, simply put the local branch to exactly the same state as the remote is.</p> <p>In your case however, you don't need that. You want to cr...
<p>If you don't care about merging:</p> <pre><code>git reset --hard &lt;remote&gt;/&lt;branch_name&gt; </code></pre> <p>This will exactly do what you want: no merging, no rebasing, simply put the local branch to exactly the same state as the remote is.</p> <p>In your case however, you don't need that. You want to cr...
119
git
<h1>How to cleanly get/copy a remote git branch to local repository</h1> <p>I want an exact "copy" of a remote branch "copied" to a specific local branch. </p> <p>Say, for example, a team member has created an experimental feature, which he has checked into a branch called <code>experiment</code> on the remote reposit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,102
git
# How to cleanly get/copy a remote git branch to local repository I want an exact "copy" of a remote branch "copied" to a specific local branch. Say, for example, a team member has created an experimental feature, which he has checked into a branch called `experiment` on the remote repository. I want to be able to ch...
If you don't care about merging: ``` git reset --hard <remote>/<branch_name> ``` This will exactly do what you want: no merging, no rebasing, simply put the local branch to exactly the same state as the remote is. In your case however, you don't need that. You want to create a **new** local branch that has the same ...
9468970
How to get a count of all the files in a git repository?
114
2012-02-27 17:00:01
<p>How would you get a count of all the files currently in a git repository?</p>
74,477
53,777
2021-09-20 22:09:09
9,468,981
199
2012-02-27 17:00:22
53,777
2012-02-27 17:51:12
https://stackoverflow.com/q/9468970
https://stackoverflow.com/a/9468981
<p>You can get a count of all tracked files in a git respository by using the following command:</p> <pre><code>git ls-files | wc -l </code></pre> <p>Command Breakdown:</p> <ul> <li>The <code>git ls-files</code> command by itself prints out a list of all the tracked files in the repository, one per line.</li> <li>Th...
<p>You can get a count of all tracked files in a git respository by using the following command:</p> <pre><code>git ls-files | wc -l </code></pre> <p>Command Breakdown:</p> <ul> <li>The <code>git ls-files</code> command by itself prints out a list of all the tracked files in the repository, one per line.</li> <li>Th...
119
git
<h1>How to get a count of all the files in a git repository?</h1> <p>How would you get a count of all the files currently in a git repository?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,103
git
# How to get a count of all the files in a git repository? How would you get a count of all the files currently in a git repository?
You can get a count of all tracked files in a git respository by using the following command: ``` git ls-files | wc -l ``` Command Breakdown: - The `git ls-files` command by itself prints out a list of all the tracked files in the repository, one per line. - The `|` operator funnels the output from the preceding com...
18693006
Git undo merge attempt
102
2013-09-09 07:02:24
<p>I have working directory (#1) which has vendor directory(#2) in it. There is one dependency which I wanted to pull manually without composer (php version of npm/gem). I was working in #1, haven't saved/commited changes, when I decided I want to update library in #2. I navigated to vendor/myname, and did git pull rep...
48,508
1,188,570
2016-08-04 15:38:58
18,693,059
199
2013-09-09 07:06:59
390,363
2013-09-09 07:06:59
https://stackoverflow.com/q/18693006
https://stackoverflow.com/a/18693059
<p><code>git merge --abort</code> might be what you're looking for.</p>
<p><code>git merge --abort</code> might be what you're looking for.</p>
119, 28896, 28897
git, git-merge, git-pull
<h1>Git undo merge attempt</h1> <p>I have working directory (#1) which has vendor directory(#2) in it. There is one dependency which I wanted to pull manually without composer (php version of npm/gem). I was working in #1, haven't saved/commited changes, when I decided I want to update library in #2. I navigated to ven...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,104
git
# Git undo merge attempt I have working directory (#1) which has vendor directory(#2) in it. There is one dependency which I wanted to pull manually without composer (php version of npm/gem). I was working in #1, haven't saved/commited changes, when I decided I want to update library in #2. I navigated to vendor/mynam...
`git merge --abort` might be what you're looking for.
58003030
What is `git restore` and how is it different from `git reset`?
304
2019-09-19 02:48:31
<p>When I want to unstage a staged file, all of my Git tutorials show something like:</p> <pre><code>$ git add * $ git status On branch master Changes to be committed: (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage) renamed: README.md -&gt; README modified: CONTRIBUTING.md </code></pre> <p>T...
417,528
2,620,022
2025-01-12 02:07:09
58,003,889
198
2019-09-19 04:47:59
6,309
2020-05-09 22:30:31
https://stackoverflow.com/q/58003030
https://stackoverflow.com/a/58003889
<p>I have presented <code>git restore</code> (which is still marked as "experimental") in "<a href="https://stackoverflow.com/a/57066072/6309">How to reset all files from working directory but not from staging area?</a>", with the recent Git 2.23 (August 2019).</p> <p>It helps separate <code>git checkout</code> into t...
<p>I have presented <code>git restore</code> (which is still marked as "experimental") in "<a href="https://stackoverflow.com/a/57066072/6309">How to reset all files from working directory but not from staging area?</a>", with the recent Git 2.23 (August 2019).</p> <p>It helps separate <code>git checkout</code> into t...
119, 51381, 71398, 165501
git, git-reset, git-restore, unstage
<h1>What is `git restore` and how is it different from `git reset`?</h1> <p>When I want to unstage a staged file, all of my Git tutorials show something like:</p> <pre><code>$ git add * $ git status On branch master Changes to be committed: (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage) renamed: ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,105
git
# What is `git restore` and how is it different from `git reset`? When I want to unstage a staged file, all of my Git tutorials show something like: ``` $ git add * $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) renamed: README.md -> README modified: ...
I have presented `git restore` (which is still marked as "experimental") in "[How to reset all files from working directory but not from staging area?](https://stackoverflow.com/a/57066072/6309)", with the recent Git 2.23 (August 2019). It helps separate `git checkout` into two commands: - one for files ([`git restor...
30542491
push --force-with-lease by default
200
2015-05-30 05:09:36
<p>I just learned about <code>git push --force-with-lease</code>. It's pretty awesome. But, of course, I don't use force that often, and so I'm worried that I might forget about this nifty feature the next time I need it.</p> <p>Is there a way to configure git so <code>git push -f</code> will automatically use <code>-...
42,250
54,829
2024-05-07 06:41:20
30,567,394
198
2015-06-01 06:54:58
2,274,224
2022-05-11 08:55:01
https://stackoverflow.com/q/30542491
https://stackoverflow.com/a/30567394
<p>There currently is no way to configure git to always use <code>force-with-lease</code> instead of <code>force</code>. As such the next best available option is, as so often, to create an alias which serves this purpose.</p> <p><em><strong>EDIT</strong> This is still true in May 2022. But <a href="https://raw.githubu...
<p>There currently is no way to configure git to always use <code>force-with-lease</code> instead of <code>force</code>. As such the next best available option is, as so often, to create an alias which serves this purpose.</p> <p><em><strong>EDIT</strong> This is still true in May 2022. But <a href="https://raw.githubu...
119
git
<h1>push --force-with-lease by default</h1> <p>I just learned about <code>git push --force-with-lease</code>. It's pretty awesome. But, of course, I don't use force that often, and so I'm worried that I might forget about this nifty feature the next time I need it.</p> <p>Is there a way to configure git so <code>git p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,106
git
# push --force-with-lease by default I just learned about `git push --force-with-lease`. It's pretty awesome. But, of course, I don't use force that often, and so I'm worried that I might forget about this nifty feature the next time I need it. Is there a way to configure git so `git push -f` will automatically use `...
There currently is no way to configure git to always use `force-with-lease` instead of `force`. As such the next best available option is, as so often, to create an alias which serves this purpose. ***EDIT** This is still true in May 2022. But [git 2.30](https://raw.githubusercontent.com/git/git/master/Documentation/R...
40009820
Git rebase one branch on top of another branch
152
2016-10-12 23:12:07
<p>In my git repo, I have a <code>Master</code> branch. One of the remote devs created a branch <code>Branch1</code> and had a bunch of commits on it. I branched from <code>Branch1</code>, creating a new branch called <code>Branch2</code> (<code>git checkout -b Branch2 Branch1</code>) such that <code>Branch2</code> hea...
331,406
3,133,885
2019-05-02 21:52:15
40,009,875
198
2016-10-12 23:19:49
1,863,229
2016-10-12 23:45:55
https://stackoverflow.com/q/40009820
https://stackoverflow.com/a/40009875
<p>First backup your current <code>Branch2</code>:</p> <pre><code># from Branch2 git checkout -b Branch2_backup </code></pre> <p>Then rebase <code>Branch2</code> on <code>Branch1</code>:</p> <pre><code># from Branch2 git fetch origin # update all tracking branches, including Branch1 git rebase origin/Branc...
<p>First backup your current <code>Branch2</code>:</p> <pre><code># from Branch2 git checkout -b Branch2_backup </code></pre> <p>Then rebase <code>Branch2</code> on <code>Branch1</code>:</p> <pre><code># from Branch2 git fetch origin # update all tracking branches, including Branch1 git rebase origin/Branc...
119, 8974
git, rebase
<h1>Git rebase one branch on top of another branch</h1> <p>In my git repo, I have a <code>Master</code> branch. One of the remote devs created a branch <code>Branch1</code> and had a bunch of commits on it. I branched from <code>Branch1</code>, creating a new branch called <code>Branch2</code> (<code>git checkout -b Br...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,108
git
# Git rebase one branch on top of another branch In my git repo, I have a `Master` branch. One of the remote devs created a branch `Branch1` and had a bunch of commits on it. I branched from `Branch1`, creating a new branch called `Branch2` (`git checkout -b Branch2 Branch1`) such that `Branch2` head was on the last c...
First backup your current `Branch2`: ``` # from Branch2 git checkout -b Branch2_backup ``` Then rebase `Branch2` on `Branch1`: ``` # from Branch2 git fetch origin # update all tracking branches, including Branch1 git rebase origin/Branch1 # rebase on latest Branch1 ``` After the rebase your branch struct...
34637896
gitk will not start on Mac: unknown color name "lime"
127
2016-01-06 16:27:12
<p>I've installed git on a mac via <code>brew install git</code>. When I try to start gitk I get the following error:</p> <pre><code>Error in startup script: unknown color name "lime" (processing "-fore" option) invoked from within "$ctext tag conf m2 -fore [lindex $mergecolors 2]" (procedure "makewindow" ...
22,317
1,014,251
2018-06-20 12:57:50
34,886,815
198
2016-01-19 20:58:59
16,633
2016-01-19 20:58:59
https://stackoverflow.com/q/34637896
https://stackoverflow.com/a/34886815
<p>You can check your version of Tcl/Tk by running <code>wish</code> and using the command <code>info patchlevel</code>. It appears that git 2.7.0, Tcl/Tk 8.5.9, and OS X 10.11 El Capitan do not work well together.</p> <p>I solved this problem by doing <code>brew cask install tcl</code>, which installed 8.6.4, and <co...
<p>You can check your version of Tcl/Tk by running <code>wish</code> and using the command <code>info patchlevel</code>. It appears that git 2.7.0, Tcl/Tk 8.5.9, and OS X 10.11 El Capitan do not work well together.</p> <p>I solved this problem by doing <code>brew cask install tcl</code>, which installed 8.6.4, and <co...
30785
gitk
<h1>gitk will not start on Mac: unknown color name "lime"</h1> <p>I've installed git on a mac via <code>brew install git</code>. When I try to start gitk I get the following error:</p> <pre><code>Error in startup script: unknown color name "lime" (processing "-fore" option) invoked from within "$ctext tag conf...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,110
git
# gitk will not start on Mac: unknown color name "lime" I've installed git on a mac via `brew install git`. When I try to start gitk I get the following error: ``` Error in startup script: unknown color name "lime" (processing "-fore" option) invoked from within "$ctext tag conf m2 -fore [lindex $mergecolors ...
You can check your version of Tcl/Tk by running `wish` and using the command `info patchlevel`. It appears that git 2.7.0, Tcl/Tk 8.5.9, and OS X 10.11 El Capitan do not work well together. I solved this problem by doing `brew cask install tcl`, which installed 8.6.4, and `gitk` works now.
33413890
Bitbucket fails to authenticate on git pull
113
2015-10-29 12:11:54
<p>I use BitBucket and had to change my password because it was compromised.</p> <pre><code>git pull </code></pre> <blockquote> <p>remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.<br> fatal: Authentication faile...
199,959
399,508
2025-09-04 14:03:49
33,414,167
198
2015-10-29 12:23:19
399,508
2022-02-28 17:50:53
https://stackoverflow.com/q/33413890
https://stackoverflow.com/a/33414167
<p>You need to reset the password as shown below.</p> <p>On macOS:</p> <pre><code>git config --global credential.helper osxkeychain </code></pre> <p>On Windows 10/11:</p> <pre><code>git config --global credential.helper store </code></pre> <p>After executing this, it prompts you for the user name and password for your ...
<p>You need to reset the password as shown below.</p> <p>On macOS:</p> <pre><code>git config --global credential.helper osxkeychain </code></pre> <p>On Windows 10/11:</p> <pre><code>git config --global credential.helper store </code></pre> <p>After executing this, it prompts you for the user name and password for your ...
119, 8337
bitbucket, git
<h1>Bitbucket fails to authenticate on git pull</h1> <p>I use BitBucket and had to change my password because it was compromised.</p> <pre><code>git pull </code></pre> <blockquote> <p>remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in yo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,111
git
# Bitbucket fails to authenticate on git pull I use BitBucket and had to change my password because it was compromised. ``` git pull ``` > remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile. > fatal: Authentication ...
You need to reset the password as shown below. On macOS: ``` git config --global credential.helper osxkeychain ``` On Windows 10/11: ``` git config --global credential.helper store ``` After executing this, it prompts you for the user name and password for your repo.
19298600
“tag already exists in the remote" error after recreating the git tag
175
2013-10-10 14:29:37
<p>I get the following error after I run the steps below:</p> <pre><code>To git@provider.com:username/repo-name.git ! [rejected] dev -&gt; dev (already exists) error: failed to push some refs to 'git@provider.com:username/repo-name.git' hint: Updates were rejected because the tag already exists in the remote. ...
248,591
2,621,606
2024-02-05 16:50:31
19,300,065
197
2013-10-10 15:30:06
1,256,452
2017-02-14 03:19:57
https://stackoverflow.com/q/19298600
https://stackoverflow.com/a/19300065
<p>Edit, 24 Nov 2016: this answer is apparently popular, so I am adding a note here. If you <em>replace</em> a tag on a central server, anyone who has the <em>old</em> tag—any clone of that central-server repository that already has the tag—could <em>retain its old tag</em>. So while this tells you how to do it, be r...
<p>Edit, 24 Nov 2016: this answer is apparently popular, so I am adding a note here. If you <em>replace</em> a tag on a central server, anyone who has the <em>old</em> tag—any clone of that central-server repository that already has the tag—could <em>retain its old tag</em>. So while this tells you how to do it, be r...
119, 7330, 60718
git, git-tag, repository
<h1>“tag already exists in the remote" error after recreating the git tag</h1> <p>I get the following error after I run the steps below:</p> <pre><code>To git@provider.com:username/repo-name.git ! [rejected] dev -&gt; dev (already exists) error: failed to push some refs to 'git@provider.com:username/repo-name....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,113
git
# “tag already exists in the remote" error after recreating the git tag I get the following error after I run the steps below: ``` To git@provider.com:username/repo-name.git ! [rejected] dev -> dev (already exists) error: failed to push some refs to 'git@provider.com:username/repo-name.git' hint: Updates were...
Edit, 24 Nov 2016: this answer is apparently popular, so I am adding a note here. If you *replace* a tag on a central server, anyone who has the *old* tag—any clone of that central-server repository that already has the tag—could *retain its old tag*. So while this tells you how to do it, be really sure you *want* to d...
3417896
How do I prompt the user from within a commit-msg hook?
94
2010-08-05 18:27:14
<p>I want to warn the user if their commit message doesn't follow a certain set of guidelines, and then give them the option to edit their commit message, ignore the warning, or cancel the commit. The problem is that I don't seem to have access to <code>stdin</code>.</p> <p>Below is my commit-msg file:</p> <pre class="...
33,353
293,511
2024-04-23 18:14:55
10,015,707
196
2012-04-04 16:49:05
67,834
2022-05-12 07:34:41
https://stackoverflow.com/q/3417896
https://stackoverflow.com/a/10015707
<p>Calling <code>exec &lt; /dev/tty</code> assigns standard input to the keyboard. Works for me in a post-commit git hook:</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh echo &quot;[post-commit hook] Commit done!&quot; # Allows us to read user input below, assigns stdin to keyboard exec &lt; /dev/tty ...
<p>Calling <code>exec &lt; /dev/tty</code> assigns standard input to the keyboard. Works for me in a post-commit git hook:</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh echo &quot;[post-commit hook] Commit done!&quot; # Allows us to read user input below, assigns stdin to keyboard exec &lt; /dev/tty ...
119, 853, 3809
commit-message, git, hook
<h1>How do I prompt the user from within a commit-msg hook?</h1> <p>I want to warn the user if their commit message doesn't follow a certain set of guidelines, and then give them the option to edit their commit message, ignore the warning, or cancel the commit. The problem is that I don't seem to have access to <code>s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,116
git
# How do I prompt the user from within a commit-msg hook? I want to warn the user if their commit message doesn't follow a certain set of guidelines, and then give them the option to edit their commit message, ignore the warning, or cancel the commit. The problem is that I don't seem to have access to `stdin`. Below ...
Calling `exec < /dev/tty` assigns standard input to the keyboard. Works for me in a post-commit git hook: ``` #!/bin/sh echo "[post-commit hook] Commit done!" # Allows us to read user input below, assigns stdin to keyboard exec < /dev/tty while true; do read -p "[post-commit hook] Check for outdated gems? (Y/n) "...
7605469
Git Submodules. Pulling into a new clone of the super-project
90
2011-09-30 02:49:39
<p>OK. So I thought I had this licked ... but now ....</p> <p>I have a project which includes one small library from GitHub as a submodule. In the original version of that super-project the submodule is working as expected. </p> <p>However, I just cloned the superproject, did what I thought I should : "git submodule ...
70,691
8,482
2021-11-18 21:37:05
8,573,310
196
2011-12-20 09:31:35
674,641
2020-05-20 07:20:19
https://stackoverflow.com/q/7605469
https://stackoverflow.com/a/8573310
<p>It seems that now (in 2019) installing <strong>latest GIT client</strong> could solve the problem according to comments below. This should be the best solution for now.</p> <hr> <p>I have the same problem as you. This is a bug in git: <a href="http://git.661346.n2.nabble.com/BUG-git-submodule-update-is-not-fail-sa...
<p>It seems that now (in 2019) installing <strong>latest GIT client</strong> could solve the problem according to comments below. This should be the best solution for now.</p> <hr> <p>I have the same problem as you. This is a bug in git: <a href="http://git.661346.n2.nabble.com/BUG-git-submodule-update-is-not-fail-sa...
119, 41612
git, git-submodules
<h1>Git Submodules. Pulling into a new clone of the super-project</h1> <p>OK. So I thought I had this licked ... but now ....</p> <p>I have a project which includes one small library from GitHub as a submodule. In the original version of that super-project the submodule is working as expected. </p> <p>However, I just...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,117
git
# Git Submodules. Pulling into a new clone of the super-project OK. So I thought I had this licked ... but now .... I have a project which includes one small library from GitHub as a submodule. In the original version of that super-project the submodule is working as expected. However, I just cloned the superproject...
It seems that now (in 2019) installing **latest GIT client** could solve the problem according to comments below. This should be the best solution for now. --- I have the same problem as you. This is a bug in git: <http://git.661346.n2.nabble.com/BUG-git-submodule-update-is-not-fail-safe-td7574168.html> In short, fo...
31787803
How do I search for branch names in Git?
161
2015-08-03 12:51:32
<p>I'd like to find a specific branch, and I know that its name would contain a specific substring (the id of the issue from our bug tracker), but I don't know the whole name of the branch (this is what I want to find out). </p> <p>How can I search for this branch?</p>
130,663
650,309
2025-02-05 16:26:22
31,787,945
195
2015-08-03 12:57:50
2,618,609
2015-08-03 12:57:50
https://stackoverflow.com/q/31787803
https://stackoverflow.com/a/31787945
<pre><code>git branch --all | grep &lt;id&gt; </code></pre>
<pre><code>git branch --all | grep &lt;id&gt; </code></pre>
119, 816
git, search
<h1>How do I search for branch names in Git?</h1> <p>I'd like to find a specific branch, and I know that its name would contain a specific substring (the id of the issue from our bug tracker), but I don't know the whole name of the branch (this is what I want to find out). </p> <p>How can I search for this branch?</p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,119
git
# How do I search for branch names in Git? I'd like to find a specific branch, and I know that its name would contain a specific substring (the id of the issue from our bug tracker), but I don't know the whole name of the branch (this is what I want to find out). How can I search for this branch?
``` git branch --all | grep <id> ```
1579643
Change timestamps while rebasing git branch
144
2009-10-16 18:32:14
<p>I have reorganized the commits in a branch before it is going to be made public causing the timestamps of the commits to be in an mixed up order. I would rather have them be all be today with only seconds in between.</p> <p>Obviously these time stamps won't be correct either, but since this is the time when things ...
55,344
51,019
2021-01-20 11:07:07
1,579,676
195
2009-10-16 18:36:53
95,382
2021-01-20 11:07:07
https://stackoverflow.com/q/1579643
https://stackoverflow.com/a/1579676
<p>Use <a href="https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---ignore-date" rel="noreferrer">--ignore-date</a>:</p> <pre><code>git rebase --ignore-date </code></pre>
<p>Use <a href="https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---ignore-date" rel="noreferrer">--ignore-date</a>:</p> <pre><code>git rebase --ignore-date </code></pre>
119, 29934
git, git-rebase
<h1>Change timestamps while rebasing git branch</h1> <p>I have reorganized the commits in a branch before it is going to be made public causing the timestamps of the commits to be in an mixed up order. I would rather have them be all be today with only seconds in between.</p> <p>Obviously these time stamps won't be co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,120
git
# Change timestamps while rebasing git branch I have reorganized the commits in a branch before it is going to be made public causing the timestamps of the commits to be in an mixed up order. I would rather have them be all be today with only seconds in between. Obviously these time stamps won't be correct either, bu...
Use [--ignore-date](https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---ignore-date): ``` git rebase --ignore-date ```