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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1835837 | git: command not found (on OS X 10.5) | 21 | 2009-12-02 21:09:28 | <p>I am receiving this error when I try to use git lately. I'm not exactly sure when the error started as I rarely use git.
I used to use it. I didn't change anything about it or my machine that I know of. Now it doesn't work.</p>
<p>I've gone through and reinstalled the latest version using <a href="http://code.go... | 57,650 | 143,273 | 2025-04-04 01:47:01 | 1,835,854 | 26 | 2009-12-02 21:11:28 | 19,750 | 2009-12-02 21:47:04 | https://stackoverflow.com/q/1835837 | https://stackoverflow.com/a/1835854 | <p>From the page you linked to:</p>
<pre><code>/usr/local/git/bin
</code></pre>
<p>Is that in your PATH?</p>
<p>Open <code>~/.profile</code> in your favorite editor and add the line</p>
<pre><code>export PATH=$PATH:/usr/local/git/bin
</code></pre>
<p>This appends the item to your PATH variable (separarated by colo... | <p>From the page you linked to:</p> <pre><code>/usr/local/git/bin </code></pre> <p>Is that in your PATH?</p> <p>Open <code>~/.profile</code> in your favorite editor and add the line</p> <pre><code>export PATH=$PATH:/usr/local/git/bin </code></pre> <p>This appends the item to your PATH variable (separarated by colo... | 119, 369 | git, macos | <h1>git: command not found (on OS X 10.5)</h1>
<p>I am receiving this error when I try to use git lately. I'm not exactly sure when the error started as I rarely use git.
I used to use it. I didn't change anything about it or my machine that I know of. Now it doesn't work.</p>
<p>I've gone through and reinstalled t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,507 | git | # git: command not found (on OS X 10.5)
I am receiving this error when I try to use git lately. I'm not exactly sure when the error started as I rarely use git.
I used to use it. I didn't change anything about it or my machine that I know of. Now it doesn't work.
I've gone through and reinstalled the latest version u... | From the page you linked to:
```
/usr/local/git/bin
```
Is that in your PATH?
Open `~/.profile` in your favorite editor and add the line
```
export PATH=$PATH:/usr/local/git/bin
```
This appends the item to your PATH variable (separarated by colons), so it's compatible with other commands that modify the path. |
20243971 | How to create a remote Git branch without creating a local branch? | 20 | 2013-11-27 13:36:27 | <p>I'd like to create a new remote branch for later use.
The most commonly suggested way seems to be:</p>
<pre><code>git checkout -b newbranch origin/startingpoint
git push origin newbranch
</code></pre>
<p>But this will also create the branch locally and put me on it. Is there a way of creating a remote branch witho... | 11,173 | 1,063,716 | 2021-11-15 05:19:32 | 20,244,142 | 26 | 2013-11-27 13:44:52 | 1,290,731 | 2021-11-15 05:19:32 | https://stackoverflow.com/q/20243971 | https://stackoverflow.com/a/20244142 | <p>tl;dr: specify the full destination refname and you can push a commit directly:</p>
<pre><code>git push origin origin/startingpoint:refs/heads/newbranch
</code></pre>
<p>you can push anything that resolves to an id, including just an id:</p>
<pre><code>git push origin 6a5343d:refs/heads/newbranch
</code></pre>
<hr /... | <p>tl;dr: specify the full destination refname and you can push a commit directly:</p> <pre><code>git push origin origin/startingpoint:refs/heads/newbranch </code></pre> <p>you can push anything that resolves to an id, including just an id:</p> <pre><code>git push origin 6a5343d:refs/heads/newbranch </code></pre> <hr /... | 119, 1879, 76220 | branch, git, git-branch | <h1>How to create a remote Git branch without creating a local branch?</h1>
<p>I'd like to create a new remote branch for later use.
The most commonly suggested way seems to be:</p>
<pre><code>git checkout -b newbranch origin/startingpoint
git push origin newbranch
</code></pre>
<p>But this will also create the branc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,508 | git | # How to create a remote Git branch without creating a local branch?
I'd like to create a new remote branch for later use.
The most commonly suggested way seems to be:
```
git checkout -b newbranch origin/startingpoint
git push origin newbranch
```
But this will also create the branch locally and put me on it. Is th... | tl;dr: specify the full destination refname and you can push a commit directly:
```
git push origin origin/startingpoint:refs/heads/newbranch
```
you can push anything that resolves to an id, including just an id:
```
git push origin 6a5343d:refs/heads/newbranch
```
---
The jargon for what `git push` operates on i... |
11829911 | push changes without pull | 20 | 2012-08-06 14:06:46 | <p>I'm trying to undo some changes that have already been pushed to a remote repository, and I've done so locally with </p>
<pre><code>git reset --hard COMMIT-HASH
</code></pre>
<p>But now it won't let me push without pulling first, which of course defeats the purpose. I've tried:</p>
<pre><code>git push -f
</code><... | 25,711 | 422,109 | 2013-01-09 10:59:35 | 11,830,161 | 26 | 2012-08-06 14:20:57 | 718,180 | 2012-08-06 16:46:37 | https://stackoverflow.com/q/11829911 | https://stackoverflow.com/a/11830161 | <p>From the <code>git config</code> man page:</p>
<blockquote>
<p><code>receive.denyNonFastForwards</code></p>
<p>If set to true, git-receive-pack will deny a ref update which is not a fast-forward. Use this to prevent such an update via a push, even if that push is forced. This configuration variable is set wh... | <p>From the <code>git config</code> man page:</p> <blockquote> <p><code>receive.denyNonFastForwards</code></p> <p>If set to true, git-receive-pack will deny a ref update which is not a fast-forward. Use this to prevent such an update via a push, even if that push is forced. This configuration variable is set wh... | 119 | git | <h1>push changes without pull</h1>
<p>I'm trying to undo some changes that have already been pushed to a remote repository, and I've done so locally with </p>
<pre><code>git reset --hard COMMIT-HASH
</code></pre>
<p>But now it won't let me push without pulling first, which of course defeats the purpose. I've tried:</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,509 | git | # push changes without pull
I'm trying to undo some changes that have already been pushed to a remote repository, and I've done so locally with
```
git reset --hard COMMIT-HASH
```
But now it won't let me push without pulling first, which of course defeats the purpose. I've tried:
```
git push -f
```
Which errors ... | From the `git config` man page:
> `receive.denyNonFastForwards`
>
> If set to true, git-receive-pack will deny a ref update which is not a fast-forward. Use this to prevent such an update via a push, even if that push is forced. This configuration variable is set when initializing a shared repository.
The server you ... |
3219926 | Using make with msysgit | 20 | 2010-07-10 16:11:34 | <p>I'm using msysgit on Windows 7, but it doesn't seem to come with make. Is there an easy way to get make running on msysgit?</p>
| 7,225 | 49,376 | 2011-09-06 21:04:22 | 3,219,954 | 26 | 2010-07-10 16:20:42 | 49,376 | 2010-07-10 16:20:42 | https://stackoverflow.com/q/3219926 | https://stackoverflow.com/a/3219954 | <p>I found a <a href="http://repo.or.cz/w/msysgit.git?a=blob;f=bin/make.exe;h=a971ea1266ff40e89137bba068e2c944a382725f;hb=968336eddac1874c56cd934d10783566af5a3e26" rel="noreferrer">link to <code>make.exe</code></a> in the msysgit Google code <a href="http://code.google.com/p/msysgit/issues/detail?id=278" rel="noreferre... | <p>I found a <a href="http://repo.or.cz/w/msysgit.git?a=blob;f=bin/make.exe;h=a971ea1266ff40e89137bba068e2c944a382725f;hb=968336eddac1874c56cd934d10783566af5a3e26" rel="noreferrer">link to <code>make.exe</code></a> in the msysgit Google code <a href="http://code.google.com/p/msysgit/issues/detail?id=278" rel="noreferre... | 4301, 21628 | makefile, msysgit | <h1>Using make with msysgit</h1>
<p>I'm using msysgit on Windows 7, but it doesn't seem to come with make. Is there an easy way to get make running on msysgit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,510 | git | # Using make with msysgit
I'm using msysgit on Windows 7, but it doesn't seem to come with make. Is there an easy way to get make running on msysgit? | I found a [link to `make.exe`](http://repo.or.cz/w/msysgit.git?a=blob;f=bin/make.exe;h=a971ea1266ff40e89137bba068e2c944a382725f;hb=968336eddac1874c56cd934d10783566af5a3e26) in the msysgit Google code [issues section](http://code.google.com/p/msysgit/issues/detail?id=278). I downloaded it and put it in `Git\bin` and it ... |
2110595 | Redaction in git | 20 | 2010-01-21 15:52:47 | <p>I started working on a little Python script for FTP recently. To start off with, I had server, login and password details for an FTP site hardwired in the script, but this didn't matter because I was only working on it locally.</p>
<p>I then had the genius idea of putting the project on github. I realised my mistak... | 5,825 | 49,376 | 2017-12-31 07:34:33 | 2,111,378 | 26 | 2010-01-21 17:29:06 | 69,755 | 2010-01-21 20:19:27 | https://stackoverflow.com/q/2110595 | https://stackoverflow.com/a/2111378 | <p>First of all, you should change the password on the FTP site. The password has already been made public; you can't guarantee that no one has cloned the repo, or it's not in plain-text in a backup somewhere, or something of the sort. If the password is at all valuable, I would consider it compromised by now.</p>
<p>... | <p>First of all, you should change the password on the FTP site. The password has already been made public; you can't guarantee that no one has cloned the repo, or it's not in plain-text in a backup somewhere, or something of the sort. If the password is at all valuable, I would consider it compromised by now.</p> <p>... | 119 | git | <h1>Redaction in git</h1>
<p>I started working on a little Python script for FTP recently. To start off with, I had server, login and password details for an FTP site hardwired in the script, but this didn't matter because I was only working on it locally.</p>
<p>I then had the genius idea of putting the project on gi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,511 | git | # Redaction in git
I started working on a little Python script for FTP recently. To start off with, I had server, login and password details for an FTP site hardwired in the script, but this didn't matter because I was only working on it locally.
I then had the genius idea of putting the project on github. I realised... | First of all, you should change the password on the FTP site. The password has already been made public; you can't guarantee that no one has cloned the repo, or it's not in plain-text in a backup somewhere, or something of the sort. If the password is at all valuable, I would consider it compromised by now.
Now, for y... |
43275419 | Reverting one file in GitKraken | 19 | 2017-04-07 10:09:22 | <p>It is possible in GitKraken to revert changes of a single file to an earlier commit instead of reverting an entire commit?</p>
| 20,317 | 2,763,447 | 2022-02-10 11:54:29 | 43,275,994 | 26 | 2017-04-07 10:38:03 | 7,598,462 | 2018-08-07 19:57:34 | https://stackoverflow.com/q/43275419 | https://stackoverflow.com/a/43275994 | <h2>Answer</h2>
<p>A <code>revert</code> in the git-sense of it can only be performed on a commit. It introduces a new commit that exactly negates the reverted commits' changes. See <a href="https://git-scm.com/docs/git-revert" rel="noreferrer">here</a>. GitKraken supports this: right click on a commit, <code>Revert &... | <h2>Answer</h2> <p>A <code>revert</code> in the git-sense of it can only be performed on a commit. It introduces a new commit that exactly negates the reverted commits' changes. See <a href="https://git-scm.com/docs/git-revert" rel="noreferrer">here</a>. GitKraken supports this: right click on a commit, <code>Revert &... | 119628 | gitkraken | <h1>Reverting one file in GitKraken</h1>
<p>It is possible in GitKraken to revert changes of a single file to an earlier commit instead of reverting an entire commit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,512 | git | # Reverting one file in GitKraken
It is possible in GitKraken to revert changes of a single file to an earlier commit instead of reverting an entire commit? | ## Answer
A `revert` in the git-sense of it can only be performed on a commit. It introduces a new commit that exactly negates the reverted commits' changes. See [here](https://git-scm.com/docs/git-revert). GitKraken supports this: right click on a commit, `Revert <branch> to this commit`.
What you want to accomplish... |
36798310 | git create stash without need to configure user.email and user.name (git stash --author ?) | 19 | 2016-04-22 15:51:58 | <p><strong>IN SHORT</strong></p>
<p>Is there a possibility to create a stash (using <code>git stash create</code>) <strong>without</strong> the need to configure <code>user.email</code> and <code>user.name</code>? Something similar to the <code>git commit --author</code> option? </p>
<p><strong>SOME CONTEXT:</strong>... | 8,423 | 2,082,964 | 2022-10-06 20:04:09 | 36,798,378 | 26 | 2016-04-22 15:55:47 | 2,082,964 | 2022-10-06 20:04:09 | https://stackoverflow.com/q/36798310 | https://stackoverflow.com/a/36798378 | <p>With Git's <code>-c</code> flag, configuration parameters can be passed on the command line:</p>
<pre class="lang-none prettyprint-override"><code>git -c user.name=test -c user.email=test@test.com stash create
</code></pre>
| <p>With Git's <code>-c</code> flag, configuration parameters can be passed on the command line:</p> <pre class="lang-none prettyprint-override"><code>git -c user.name=test -c user.email=test@test.com stash create </code></pre> | 119, 13091, 32868 | git, git-config, git-stash | <h1>git create stash without need to configure user.email and user.name (git stash --author ?)</h1>
<p><strong>IN SHORT</strong></p>
<p>Is there a possibility to create a stash (using <code>git stash create</code>) <strong>without</strong> the need to configure <code>user.email</code> and <code>user.name</code>? Somet... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,513 | git | # git create stash without need to configure user.email and user.name (git stash --author ?)
**IN SHORT**
Is there a possibility to create a stash (using `git stash create`) **without** the need to configure `user.email` and `user.name`? Something similar to the `git commit --author` option?
**SOME CONTEXT:**
I hav... | With Git's `-c` flag, configuration parameters can be passed on the command line:
```
git -c user.name=test -c user.email=test@test.com stash create
``` |
28237043 | What is the resolution of Git's commit-date or author-date timestamps? | 19 | 2015-01-30 13:32:01 | <p>From what I can see, Git commit dates and author dates are only accurate to one second. I'm wondering if this is as precise as they get or can I get the timestamp in milliseconds or even microseconds.</p>
<p>This command returns the <a href="http://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">UNIX Timestamp</a... | 4,193 | 2,657,221 | 2022-09-18 11:32:23 | 28,238,046 | 26 | 2015-01-30 14:30:15 | 2,541,573 | 2022-09-18 11:32:23 | https://stackoverflow.com/q/28237043 | https://stackoverflow.com/a/28238046 | <p>The resolution of Git commit/author dates is 1 second, which, as pointed out by <a href="https://stackoverflow.com/questions/28237043/what-is-gits-commit-date-or-author-date-timestamp-precision#comment44836512_28237043">Alexey Ten</a> and <a href="https://stackoverflow.com/a/28237921/2541573">Edward Thomson</a>, is ... | <p>The resolution of Git commit/author dates is 1 second, which, as pointed out by <a href="https://stackoverflow.com/questions/28237043/what-is-gits-commit-date-or-author-date-timestamp-precision#comment44836512_28237043">Alexey Ten</a> and <a href="https://stackoverflow.com/a/28237921/2541573">Edward Thomson</a>, is ... | 34, 119, 2177, 5002 | date, git, timestamp, unix | <h1>What is the resolution of Git's commit-date or author-date timestamps?</h1>
<p>From what I can see, Git commit dates and author dates are only accurate to one second. I'm wondering if this is as precise as they get or can I get the timestamp in milliseconds or even microseconds.</p>
<p>This command returns the <a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,514 | git | # What is the resolution of Git's commit-date or author-date timestamps?
From what I can see, Git commit dates and author dates are only accurate to one second. I'm wondering if this is as precise as they get or can I get the timestamp in milliseconds or even microseconds.
This command returns the [UNIX Timestamp](ht... | The resolution of Git commit/author dates is 1 second, which, as pointed out by [Alexey Ten](https://stackoverflow.com/questions/28237043/what-is-gits-commit-date-or-author-date-timestamp-precision#comment44836512_28237043) and [Edward Thomson](https://stackoverflow.com/a/28237921/2541573), is also [the resolution of U... |
25700186 | .DS_Store still appears in git status despite being in .gitignore | 19 | 2014-09-06 12:21:03 | <pre><code>$ cat .gitignore
# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in w... | 11,301 | 312,725 | 2015-07-04 10:10:21 | 25,700,205 | 26 | 2014-09-06 12:23:09 | 6,309 | 2014-09-06 12:23:09 | https://stackoverflow.com/q/25700186 | https://stackoverflow.com/a/25700205 | <p>Make sure <code>.DS_Store</code> isn't in the cache:</p>
<pre><code>git rm --cached -- Assets/Sprites/.DS_Store
</code></pre>
| <p>Make sure <code>.DS_Store</code> isn't in the cache:</p> <pre><code>git rm --cached -- Assets/Sprites/.DS_Store </code></pre> | 119, 25056 | git, gitignore | <h1>.DS_Store still appears in git status despite being in .gitignore</h1>
<pre><code>$ cat .gitignore
# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,515 | git | # .DS_Store still appears in git status despite being in .gitignore
```
$ cat .gitignore
# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "... | Make sure `.DS_Store` isn't in the cache:
```
git rm --cached -- Assets/Sprites/.DS_Store
``` |
22356961 | What does it mean when it says a git step is "1 ahead" | 19 | 2014-03-12 15:55:21 | <p>I'm trying to learn git by playing around with it using SourceTree as as tool.</p>
<p>I added my local repository to a BitBucket repository and then made a couple of changes locally. I committed them, and then pushed them.
I then logged onto BitBucket and manually changed a portion of the document (item "Added 4").... | 19,320 | 1,675,976 | 2016-02-14 19:32:40 | 22,357,679 | 26 | 2014-03-12 16:20:31 | 1,640,038 | 2016-02-14 19:32:40 | https://stackoverflow.com/q/22356961 | https://stackoverflow.com/a/22357679 | <p>Basically, you need to <code>push</code> to your remote branch again to get rid of the <code>2 ahead</code> so to speak.</p>
<p>The master (the one on the top) is your local tracking branch, and <code>origin/master</code> is a remote tracking branch that records the status of the remote repository from your last <c... | <p>Basically, you need to <code>push</code> to your remote branch again to get rid of the <code>2 ahead</code> so to speak.</p> <p>The master (the one on the top) is your local tracking branch, and <code>origin/master</code> is a remote tracking branch that records the status of the remote repository from your last <c... | 119, 8337, 90056 | atlassian-sourcetree, bitbucket, git | <h1>What does it mean when it says a git step is "1 ahead"</h1>
<p>I'm trying to learn git by playing around with it using SourceTree as as tool.</p>
<p>I added my local repository to a BitBucket repository and then made a couple of changes locally. I committed them, and then pushed them.
I then logged onto BitBucket ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,516 | git | # What does it mean when it says a git step is "1 ahead"
I'm trying to learn git by playing around with it using SourceTree as as tool.
I added my local repository to a BitBucket repository and then made a couple of changes locally. I committed them, and then pushed them.
I then logged onto BitBucket and manually cha... | Basically, you need to `push` to your remote branch again to get rid of the `2 ahead` so to speak.
The master (the one on the top) is your local tracking branch, and `origin/master` is a remote tracking branch that records the status of the remote repository from your last `push`, `pull`, or `fetch`. `origin` refers t... |
20247389 | How to git list only the tracked directories? | 19 | 2013-11-27 16:07:59 | <p>Using <code>git list-files</code> gives me the directories and the files tracked within. Is there a command like: </p>
<pre><code>git list-directories
</code></pre>
<p>or something similar that lists only the tracked non-empty non-recursive directory names?</p>
| 24,216 | 704,028 | 2024-04-27 19:35:47 | 20,247,815 | 26 | 2013-11-27 16:26:27 | 1,174,001 | 2021-11-25 22:49:35 | https://stackoverflow.com/q/20247389 | https://stackoverflow.com/a/20247815 | <p><code>git ls-files | xargs -n 1 dirname | uniq</code></p>
| <p><code>git ls-files | xargs -n 1 dirname | uniq</code></p> | 119 | git | <h1>How to git list only the tracked directories?</h1>
<p>Using <code>git list-files</code> gives me the directories and the files tracked within. Is there a command like: </p>
<pre><code>git list-directories
</code></pre>
<p>or something similar that lists only the tracked non-empty non-recursive directory names?</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,517 | git | # How to git list only the tracked directories?
Using `git list-files` gives me the directories and the files tracked within. Is there a command like:
```
git list-directories
```
or something similar that lists only the tracked non-empty non-recursive directory names? | `git ls-files | xargs -n 1 dirname | uniq` |
11720945 | Unable to run git from command line | 19 | 2012-07-30 11:49:21 | <p>I have installed GIT for Windows right now. And when I am running this into my symfony project to reinstall the vendors by </p>
<pre><code>php bin/vendors install --reinstall
</code></pre>
<p>Then i am getting an error</p>
<pre><code>git' is not recognized as internal or external command
</code></pre>
<p>I have ... | 31,184 | 1,492,648 | 2017-03-02 03:49:43 | 11,721,293 | 26 | 2012-07-30 12:11:59 | 520,162 | 2012-07-30 13:31:03 | https://stackoverflow.com/q/11720945 | https://stackoverflow.com/a/11721293 | <p>Two possible solutions:</p>
<ul>
<li>My <code>PATH</code> has backslashes instead of forward ones.</li>
<li>your first line contains a typo, should be <code>c:\program files\git\cmd</code></li>
</ul>
<p>One more: If your path includes spaces, enclose it in quotes:</p>
<pre><code>set PATH=%PATH%;"C:\Program Files\... | <p>Two possible solutions:</p> <ul> <li>My <code>PATH</code> has backslashes instead of forward ones.</li> <li>your first line contains a typo, should be <code>c:\program files\git\cmd</code></li> </ul> <p>One more: If your path includes spaces, enclose it in quotes:</p> <pre><code>set PATH=%PATH%;"C:\Program Files\... | 64, 119, 57799 | git, symfony, windows | <h1>Unable to run git from command line</h1>
<p>I have installed GIT for Windows right now. And when I am running this into my symfony project to reinstall the vendors by </p>
<pre><code>php bin/vendors install --reinstall
</code></pre>
<p>Then i am getting an error</p>
<pre><code>git' is not recognized as internal ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,518 | git | # Unable to run git from command line
I have installed GIT for Windows right now. And when I am running this into my symfony project to reinstall the vendors by
```
php bin/vendors install --reinstall
```
Then i am getting an error
```
git' is not recognized as internal or external command
```
I have set the envir... | Two possible solutions:
- My `PATH` has backslashes instead of forward ones.
- your first line contains a typo, should be `c:\program files\git\cmd`
One more: If your path includes spaces, enclose it in quotes:
```
set PATH=%PATH%;"C:\Program Files\Git\cmd"
``` |
45604767 | Git - Cherry picking with ours/theirs strategy | 18 | 2017-08-10 04:55:35 | <p>I wonder if there is any way of cherry picking with ours/theirs strategy. On other words, I want to cherry pick multiple commits from dev branch into main branch with below commands,</p>
<pre><code>git cherry-pick HASH1 HASH2 HASH3 -n
</code></pre>
<p>This command is supposed to take all referred commits and prepa... | 26,893 | 1,084,174 | 2025-10-15 20:20:28 | 45,604,914 | 26 | 2017-08-10 05:08:42 | 6,309 | 2022-12-19 06:57:16 | https://stackoverflow.com/q/45604767 | https://stackoverflow.com/a/45604914 | <p>The <a href="https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---strategyltstrategygt" rel="noreferrer"><code>git cherry-pick</code> command</a> does have the <code>--strategy</code> and <code>--strategy-option=<option></code> options.</p>
<p>They are passed through to the <strong><a ... | <p>The <a href="https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---strategyltstrategygt" rel="noreferrer"><code>git cherry-pick</code> command</a> does have the <code>--strategy</code> and <code>--strategy-option=<option></code> options.</p> <p>They are passed through to the <strong><a ... | 119, 5597, 28897, 36489, 62599 | cherry-pick, commit, git, git-merge, merge-conflict-resolution | <h1>Git - Cherry picking with ours/theirs strategy</h1>
<p>I wonder if there is any way of cherry picking with ours/theirs strategy. On other words, I want to cherry pick multiple commits from dev branch into main branch with below commands,</p>
<pre><code>git cherry-pick HASH1 HASH2 HASH3 -n
</code></pre>
<p>This co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,522 | git | # Git - Cherry picking with ours/theirs strategy
I wonder if there is any way of cherry picking with ours/theirs strategy. On other words, I want to cherry pick multiple commits from dev branch into main branch with below commands,
```
git cherry-pick HASH1 HASH2 HASH3 -n
```
This command is supposed to take all ref... | The [`git cherry-pick` command](https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt---strategyltstrategygt) does have the `--strategy` and `--strategy-option=<option>` options.
They are passed through to the **[merge strategies](https://git-scm.com/docs/git-merge#_merge_strategies)**.
So, in yo... |
32405922 | In my repo, how long must the longest hash prefix be to prevent any overlap? | 18 | 2015-09-04 20:14:40 | <p>The <code>--abbrev-commit</code> flag can be used in conjunction with <code>git log</code> and <code>git rev-list</code> in order to show partial prefixes instead of the full 40-character SHA-1 hashes of commit objects. According to the <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Short-SHA-1... | 2,682 | 2,541,573 | 2018-01-29 06:42:26 | 32,406,103 | 26 | 2015-09-04 20:28:41 | 2,541,573 | 2016-09-30 22:49:46 | https://stackoverflow.com/q/32405922 | https://stackoverflow.com/a/32406103 | <p>The following shell script, when run in a local repo, prints the length of the longest prefix required to prevent any overlap among all prefix hashes of commit objects of that repository.</p>
<pre class="lang-sh prettyprint-override"><code>MAX_LENGTH=4;
git rev-list --abbrev=4 --abbrev-commit --all | \
( while r... | <p>The following shell script, when run in a local repo, prints the length of the longest prefix required to prevent any overlap among all prefix hashes of commit objects of that repository.</p> <pre class="lang-sh prettyprint-override"><code>MAX_LENGTH=4; git rev-list --abbrev=4 --abbrev-commit --all | \ ( while r... | 119, 3190, 21990, 47913, 85577 | git, git-log, git-rev-list, linux-kernel, sha1 | <h1>In my repo, how long must the longest hash prefix be to prevent any overlap?</h1>
<p>The <code>--abbrev-commit</code> flag can be used in conjunction with <code>git log</code> and <code>git rev-list</code> in order to show partial prefixes instead of the full 40-character SHA-1 hashes of commit objects. According t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,524 | git | # In my repo, how long must the longest hash prefix be to prevent any overlap?
The `--abbrev-commit` flag can be used in conjunction with `git log` and `git rev-list` in order to show partial prefixes instead of the full 40-character SHA-1 hashes of commit objects. According to the [Pro Git book](https://git-scm.com/b... | The following shell script, when run in a local repo, prints the length of the longest prefix required to prevent any overlap among all prefix hashes of commit objects of that repository.
```
MAX_LENGTH=4;
git rev-list --abbrev=4 --abbrev-commit --all | \
( while read -r line; do
if [ ${#line} -gt $MAX_LENGTH... |
31959425 | How to get staged files using GitPython? | 18 | 2015-08-12 08:03:01 | <p>I'm counting staged files in git using <a href="https://github.com/gitpython-developers/GitPython" rel="noreferrer">GitPython</a>.</p>
<p>For modified files, I can use</p>
<pre><code>repo = git.Repo()
modified_files = len(repo.index.diff(None))
</code></pre>
<p>But for staged files I can't find the solution.</p>
... | 8,979 | 4,158,863 | 2017-06-29 16:34:45 | 31,960,539 | 26 | 2015-08-12 09:00:27 | 1,860,929 | 2015-08-12 09:00:27 | https://stackoverflow.com/q/31959425 | https://stackoverflow.com/a/31960539 | <p>You are close, use <code>repo.index.diff("HEAD")</code> to get files in staging area.</p>
<hr />
<h2>Full demo:</h2>
<p>First create a test repo:</p>
<pre><code>$ cd test
$ mkdir repo && cd repo && touch a b c && git init && git add . && git commit -m "init"... | <p>You are close, use <code>repo.index.diff("HEAD")</code> to get files in staging area.</p> <hr /> <h2>Full demo:</h2> <p>First create a test repo:</p> <pre><code>$ cd test $ mkdir repo && cd repo && touch a b c && git init && git add . && git commit -m "init"... | 16, 119, 61013 | git, gitpython, python | <h1>How to get staged files using GitPython?</h1>
<p>I'm counting staged files in git using <a href="https://github.com/gitpython-developers/GitPython" rel="noreferrer">GitPython</a>.</p>
<p>For modified files, I can use</p>
<pre><code>repo = git.Repo()
modified_files = len(repo.index.diff(None))
</code></pre>
<p>Bu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,525 | git | # How to get staged files using GitPython?
I'm counting staged files in git using [GitPython](https://github.com/gitpython-developers/GitPython).
For modified files, I can use
```
repo = git.Repo()
modified_files = len(repo.index.diff(None))
```
But for staged files I can't find the solution.
I know `git status --... | You are close, use `repo.index.diff("HEAD")` to get files in staging area.
---
## Full demo:
First create a test repo:
```
$ cd test
$ mkdir repo && cd repo && touch a b c && git init && git add . && git commit -m "init"
$ echo "a" > a && echo "b" > b && echo "c" > c && git add a b
$ git status
On branch master
Cha... |
21376171 | How to show diff of a staged deleted file? | 18 | 2014-01-27 08:36:48 | <p>Here is the status:</p>
<pre><code>On branch howard
Your branch is up-to-date with 'origin/howard'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: thing.scala
(and other changed files)
</code></pre>
<p>If I do <code>git diff --cached</code>, it shows the content ... | 8,979 | null | 2023-10-12 15:03:54 | 21,376,278 | 26 | 2014-01-27 08:42:17 | null | 2023-10-12 15:03:54 | https://stackoverflow.com/q/21376171 | https://stackoverflow.com/a/21376278 | <p>Your first approach is almost right, it just has two small problems.</p>
<p>Firstly, since you haven't committed yet, the last version that still has the <code>thing.scala</code> file is <code>HEAD</code>. <code>HEAD~1</code> is the version before that.</p>
<p>Secondly, the syntax to show a file from a specific comm... | <p>Your first approach is almost right, it just has two small problems.</p> <p>Firstly, since you haven't committed yet, the last version that still has the <code>thing.scala</code> file is <code>HEAD</code>. <code>HEAD~1</code> is the version before that.</p> <p>Secondly, the syntax to show a file from a specific comm... | 119 | git | <h1>How to show diff of a staged deleted file?</h1>
<p>Here is the status:</p>
<pre><code>On branch howard
Your branch is up-to-date with 'origin/howard'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: thing.scala
(and other changed files)
</code></pre>
<p>If I do <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,527 | git | # How to show diff of a staged deleted file?
Here is the status:
```
On branch howard
Your branch is up-to-date with 'origin/howard'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: thing.scala
(and other changed files)
```
If I do `git diff --cached`, it shows the conten... | Your first approach is almost right, it just has two small problems.
Firstly, since you haven't committed yet, the last version that still has the `thing.scala` file is `HEAD`. `HEAD~1` is the version before that.
Secondly, the syntax to show a file from a specific commit is `git show <commit>:<file>`.
So the correc... |
12605576 | What are all available Git special files that can be committed to a repository? | 18 | 2012-09-26 15:46:58 | <p>Two examples I can think of are <code>.gitattributes</code> and <code>.gitignore</code>. </p>
<p>Can someone list all of them?</p>
| 4,459 | 383,214 | 2022-08-28 08:45:56 | 12,719,247 | 26 | 2012-10-04 01:40:26 | 161,801 | 2022-08-28 08:45:56 | https://stackoverflow.com/q/12605576 | https://stackoverflow.com/a/12719247 | <p>I grepped the git repository of git itself, and while I don't think an official list exists anywhere, I did notice that all the ones I know about were mentioned in the git-config manpage (<code>git help config</code>). So with that, I did a search for "file" on that page, and here's what I found:</p>
<ul>... | <p>I grepped the git repository of git itself, and while I don't think an official list exists anywhere, I did notice that all the ones I know about were mentioned in the git-config manpage (<code>git help config</code>). So with that, I did a search for "file" on that page, and here's what I found:</p> <ul>... | 119 | git | <h1>What are all available Git special files that can be committed to a repository?</h1>
<p>Two examples I can think of are <code>.gitattributes</code> and <code>.gitignore</code>. </p>
<p>Can someone list all of them?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,528 | git | # What are all available Git special files that can be committed to a repository?
Two examples I can think of are `.gitattributes` and `.gitignore`.
Can someone list all of them? | I grepped the git repository of git itself, and while I don't think an official list exists anywhere, I did notice that all the ones I know about were mentioned in the git-config manpage (`git help config`). So with that, I did a search for "file" on that page, and here's what I found:
- [`.gitignore`](http://git-scm.... |
7797555 | Take a Current Git Branch and "reset" Its contents to Master | 18 | 2011-10-17 17:51:27 | <p>At work, each developer has his own development branch we work off of, ie. branch = dev_name_of_employee. IE. dev_jon</p>
<p>dev_jon has a new feature with over 100 commits in it that is not ready to be tested or deployed, so I created another branch to put that new feature in called staging_jon (could have called ... | 29,513 | 250,991 | 2011-10-17 18:31:58 | 7,797,587 | 26 | 2011-10-17 17:54:32 | 526,535 | 2011-10-17 18:00:48 | https://stackoverflow.com/q/7797555 | https://stackoverflow.com/a/7797587 | <p>In dev_jon, you can do:</p>
<pre><code>git reset --hard master
</code></pre>
<p>May not be directly applicable / relevant, but you can look at GitHub flow: <a href="http://scottchacon.com/2011/08/31/github-flow.html" rel="noreferrer">http://scottchacon.com/2011/08/31/github-flow.html</a></p>
| <p>In dev_jon, you can do:</p> <pre><code>git reset --hard master </code></pre> <p>May not be directly applicable / relevant, but you can look at GitHub flow: <a href="http://scottchacon.com/2011/08/31/github-flow.html" rel="noreferrer">http://scottchacon.com/2011/08/31/github-flow.html</a></p> | 119 | git | <h1>Take a Current Git Branch and "reset" Its contents to Master</h1>
<p>At work, each developer has his own development branch we work off of, ie. branch = dev_name_of_employee. IE. dev_jon</p>
<p>dev_jon has a new feature with over 100 commits in it that is not ready to be tested or deployed, so I created another br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,530 | git | # Take a Current Git Branch and "reset" Its contents to Master
At work, each developer has his own development branch we work off of, ie. branch = dev_name_of_employee. IE. dev_jon
dev_jon has a new feature with over 100 commits in it that is not ready to be tested or deployed, so I created another branch to put that... | In dev_jon, you can do:
```
git reset --hard master
```
May not be directly applicable / relevant, but you can look at GitHub flow: <http://scottchacon.com/2011/08/31/github-flow.html> |
3426347 | How to run Ruby and GIT commands in one place on Windows | 18 | 2010-08-06 17:48:30 | <p>I have Ruby and GIT installed on my windows box. To run GIT commands I am utilizing the GIT Bash. To run Ruby commands I am using the command line.</p>
<p>I have not been successful running GIT commands from the CMD line nor can I seem to run Ruby commands from inside the GIT Bash. I would love to be able to run co... | 30,565 | 411,409 | 2015-06-28 08:42:04 | 3,426,805 | 26 | 2010-08-06 18:50:55 | 6,309 | 2015-06-28 08:42:04 | https://stackoverflow.com/q/3426347 | https://stackoverflow.com/a/3426805 | <p>I run git commands from the CMD session all the time.</p>
<p>Make sure your <code>PATH</code> environment variable includes the '<code>cmd</code>' directory from a msysgit distro:</p>
<pre><code>Path=C:\Path\To\Git\1.7.1\cmd
</code></pre>
<p>If not, add it in your session:</p>
<pre><code>set PATH=%PATH%;C:\Path\... | <p>I run git commands from the CMD session all the time.</p> <p>Make sure your <code>PATH</code> environment variable includes the '<code>cmd</code>' directory from a msysgit distro:</p> <pre><code>Path=C:\Path\To\Git\1.7.1\cmd </code></pre> <p>If not, add it in your session:</p> <pre><code>set PATH=%PATH%;C:\Path\... | 12, 119, 4984 | git, ruby, ruby-on-rails | <h1>How to run Ruby and GIT commands in one place on Windows</h1>
<p>I have Ruby and GIT installed on my windows box. To run GIT commands I am utilizing the GIT Bash. To run Ruby commands I am using the command line.</p>
<p>I have not been successful running GIT commands from the CMD line nor can I seem to run Ruby co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,531 | git | # How to run Ruby and GIT commands in one place on Windows
I have Ruby and GIT installed on my windows box. To run GIT commands I am utilizing the GIT Bash. To run Ruby commands I am using the command line.
I have not been successful running GIT commands from the CMD line nor can I seem to run Ruby commands from insi... | I run git commands from the CMD session all the time.
Make sure your `PATH` environment variable includes the '`cmd`' directory from a msysgit distro:
```
Path=C:\Path\To\Git\1.7.1\cmd
```
If not, add it in your session:
```
set PATH=%PATH%;C:\Path\To\Git\1.7.1\cmd
```
and you are done. Git *and* Ruby commands in ... |
2433637 | git pull not working | 18 | 2010-03-12 15:13:51 | <p>I am not using github. We have git setup on our machine.</p>
<p>I created a branch from master called experiment. However when I am trying to do git pull I am getting following message.</p>
<pre><code>> git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.experiment.... | 76,777 | 253,470 | 2016-06-09 10:36:13 | 2,433,710 | 26 | 2010-03-12 15:24:17 | 266,250 | 2013-10-10 09:26:26 | https://stackoverflow.com/q/2433637 | https://stackoverflow.com/a/2433710 | <p>Pull:</p>
<pre><code>git pull origin experiment
</code></pre>
<p>Push: </p>
<pre><code>git push origin experiment
</code></pre>
| <p>Pull:</p> <pre><code>git pull origin experiment </code></pre> <p>Push: </p> <pre><code>git push origin experiment </code></pre> | 119 | git | <h1>git pull not working</h1>
<p>I am not using github. We have git setup on our machine.</p>
<p>I created a branch from master called experiment. However when I am trying to do git pull I am getting following message.</p>
<pre><code>> git pull
You asked me to pull without telling me which branch you
want to merge... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,532 | git | # git pull not working
I am not using github. We have git setup on our machine.
I created a branch from master called experiment. However when I am trying to do git pull I am getting following message.
```
> git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.experiment.... | Pull:
```
git pull origin experiment
```
Push:
```
git push origin experiment
``` |
918768 | Are git submodules the only safe way to have working copies within working copies? | 18 | 2009-05-28 01:19:56 | <p>In my scenario, I have a program that analyzes data input files and produces other data output files. I want to version control the program, and I want to version control the data files, and as a matter of preference, I want to have the working copy of the data files within the working copy of the program. I want th... | 4,339 | 38,765 | 2009-11-30 07:39:36 | 918,927 | 26 | 2009-05-28 02:21:39 | 893 | 2009-05-28 02:21:39 | https://stackoverflow.com/q/918768 | https://stackoverflow.com/a/918927 | <p>It's possible to simply "nest" working copies in Git. So if you clone your program repository, then inside that make a clone of your data files, then you can work with them independently. When Git performs file operations, it searches <em>up</em> the directory tree looking for a <code>.git</code> directory, so Git o... | <p>It's possible to simply "nest" working copies in Git. So if you clone your program repository, then inside that make a clone of your data files, then you can work with them independently. When Git performs file operations, it searches <em>up</em> the directory tree looking for a <code>.git</code> directory, so Git o... | 119, 41612 | git, git-submodules | <h1>Are git submodules the only safe way to have working copies within working copies?</h1>
<p>In my scenario, I have a program that analyzes data input files and produces other data output files. I want to version control the program, and I want to version control the data files, and as a matter of preference, I want ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,533 | git | # Are git submodules the only safe way to have working copies within working copies?
In my scenario, I have a program that analyzes data input files and produces other data output files. I want to version control the program, and I want to version control the data files, and as a matter of preference, I want to have t... | It's possible to simply "nest" working copies in Git. So if you clone your program repository, then inside that make a clone of your data files, then you can work with them independently. When Git performs file operations, it searches *up* the directory tree looking for a `.git` directory, so Git operations performed i... |
24555358 | git log: only show yesterday's commit | 17 | 2014-07-03 13:42:45 | <p><code>git log --since=yesterday --until=today</code> doesn't work because it will <em>include</em> today's commits.</p>
<p><code>git log --since=yesterday --until=yesterday</code> doesn't work because it will not show anything at all.</p>
<p>I'm assuming that "yesterday" translates to 12:01am of the previous date,... | 5,999 | 10,608 | 2018-12-06 21:22:04 | 40,788,515 | 26 | 2016-11-24 14:10:10 | 1,238,300 | 2016-11-28 10:05:53 | https://stackoverflow.com/q/24555358 | https://stackoverflow.com/a/40788515 | <p>I was looking for a way to show all commits since "yesterday" and was having trouble to get the commits older than 24 hours ago (if it's 11am and I just use <code>--since=yesterday</code>, I wouldn't get commits made e.g. at 10:30am, as already pointed).
Using</p>
<pre><code>git log --since=yesterday.0:00am
</code>... | <p>I was looking for a way to show all commits since "yesterday" and was having trouble to get the commits older than 24 hours ago (if it's 11am and I just use <code>--since=yesterday</code>, I wouldn't get commits made e.g. at 10:30am, as already pointed). Using</p> <pre><code>git log --since=yesterday.0:00am </code>... | 119, 47913 | git, git-log | <h1>git log: only show yesterday's commit</h1>
<p><code>git log --since=yesterday --until=today</code> doesn't work because it will <em>include</em> today's commits.</p>
<p><code>git log --since=yesterday --until=yesterday</code> doesn't work because it will not show anything at all.</p>
<p>I'm assuming that "yesterd... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,536 | git | # git log: only show yesterday's commit
`git log --since=yesterday --until=today` doesn't work because it will *include* today's commits.
`git log --since=yesterday --until=yesterday` doesn't work because it will not show anything at all.
I'm assuming that "yesterday" translates to 12:01am of the previous date, and ... | I was looking for a way to show all commits since "yesterday" and was having trouble to get the commits older than 24 hours ago (if it's 11am and I just use `--since=yesterday`, I wouldn't get commits made e.g. at 10:30am, as already pointed).
Using
```
git log --since=yesterday.0:00am
```
or, more conveniently
```
... |
17743809 | Remove remote branches in Git | 17 | 2013-07-19 10:24:05 | <p>I want to delete some remote branches of my project repository. I've run the next command:</p>
<pre><code>git push origin :name_of_branch
</code></pre>
<p>and when I list the remote branches with</p>
<pre><code>git branch -r
</code></pre>
<p>the branch that I've deleted doesn't appear, but a partner of mine run<... | 4,686 | 2,231,432 | 2014-06-06 03:16:57 | 17,744,282 | 26 | 2013-07-19 10:48:24 | 12,471 | 2013-07-19 10:48:24 | https://stackoverflow.com/q/17743809 | https://stackoverflow.com/a/17744282 | <p>This happens because when this partner of yours runs <code>git fetch</code>, the branch deletion is not "applied" to his repository. <code>fetch</code> only updates and adds branches.</p>
<p>They can run <code>git remote prune origin</code> to trim away remote branches in their list that no longer exist in the upst... | <p>This happens because when this partner of yours runs <code>git fetch</code>, the branch deletion is not "applied" to his repository. <code>fetch</code> only updates and adds branches.</p> <p>They can run <code>git remote prune origin</code> to trim away remote branches in their list that no longer exist in the upst... | 81, 119, 456 | git, version-control, versioning | <h1>Remove remote branches in Git</h1>
<p>I want to delete some remote branches of my project repository. I've run the next command:</p>
<pre><code>git push origin :name_of_branch
</code></pre>
<p>and when I list the remote branches with</p>
<pre><code>git branch -r
</code></pre>
<p>the branch that I've deleted doe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,537 | git | # Remove remote branches in Git
I want to delete some remote branches of my project repository. I've run the next command:
```
git push origin :name_of_branch
```
and when I list the remote branches with
```
git branch -r
```
the branch that I've deleted doesn't appear, but a partner of mine run
```
git fetch
```... | This happens because when this partner of yours runs `git fetch`, the branch deletion is not "applied" to his repository. `fetch` only updates and adds branches.
They can run `git remote prune origin` to trim away remote branches in their list that no longer exist in the upstream repository. |
12669278 | What is the "reset" command for a git cloned repository? | 17 | 2012-10-01 07:48:05 | <p>I have downloaded a repository with </p>
<pre><code>git clone <address>
</code></pre>
<p>i have made some modification and have edited some files, now i want to discard everything and just be sure that what i have on the disk is nothing else than the original remote version of the codebase: what is the right... | 22,568 | 1,697,903 | 2018-12-11 12:54:42 | 12,669,390 | 26 | 2012-10-01 07:56:19 | 1,589,700 | 2018-12-11 12:54:42 | https://stackoverflow.com/q/12669278 | https://stackoverflow.com/a/12669390 | <p>Here is the long explanation so that you understand what is going on:</p>
<p>Assuming the remote is called <code>origin</code></p>
<pre><code>git reset --hard HEAD
git checkout origin/master
git branch -D master
git checkout -b master
</code></pre>
<p>What this does is:</p>
<ol>
<li><p>(Optional if git status sa... | <p>Here is the long explanation so that you understand what is going on:</p> <p>Assuming the remote is called <code>origin</code></p> <pre><code>git reset --hard HEAD git checkout origin/master git branch -D master git checkout -b master </code></pre> <p>What this does is:</p> <ol> <li><p>(Optional if git status sa... | 119, 456, 7330 | git, repository, version-control | <h1>What is the "reset" command for a git cloned repository?</h1>
<p>I have downloaded a repository with </p>
<pre><code>git clone <address>
</code></pre>
<p>i have made some modification and have edited some files, now i want to discard everything and just be sure that what i have on the disk is nothing else t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,539 | git | # What is the "reset" command for a git cloned repository?
I have downloaded a repository with
```
git clone <address>
```
i have made some modification and have edited some files, now i want to discard everything and just be sure that what i have on the disk is nothing else than the original remote version of the c... | Here is the long explanation so that you understand what is going on:
Assuming the remote is called `origin`
```
git reset --hard HEAD
git checkout origin/master
git branch -D master
git checkout -b master
```
What this does is:
1. (Optional if git status says no modified files) Discard *any* modified files on the ... |
7854141 | Git: moving commits from master to another branch | 17 | 2011-10-21 19:09:41 | <p>I made a series of commits after a good commit on the master branch, which in hindsight I should have made in another branch. Can I move those commits, beginning with a specific commit, to another branch, and keep the good commit as the last commit on master?</p>
| 5,621 | 773,862 | 2011-10-21 19:23:30 | 7,854,191 | 26 | 2011-10-21 19:13:08 | 28,804 | 2011-10-21 19:13:08 | https://stackoverflow.com/q/7854141 | https://stackoverflow.com/a/7854191 | <p>Sure:</p>
<pre><code>$ git branch new-branch-name # Create a new branch from the current commit
$ git reset --hard <last good commit on master> # Reset master to the good commit
</code></pre>
| <p>Sure:</p> <pre><code>$ git branch new-branch-name # Create a new branch from the current commit $ git reset --hard <last good commit on master> # Reset master to the good commit </code></pre> | 119 | git | <h1>Git: moving commits from master to another branch</h1>
<p>I made a series of commits after a good commit on the master branch, which in hindsight I should have made in another branch. Can I move those commits, beginning with a specific commit, to another branch, and keep the good commit as the last commit on master... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,540 | git | # Git: moving commits from master to another branch
I made a series of commits after a good commit on the master branch, which in hindsight I should have made in another branch. Can I move those commits, beginning with a specific commit, to another branch, and keep the good commit as the last commit on master? | Sure:
```
$ git branch new-branch-name # Create a new branch from the current commit
$ git reset --hard <last good commit on master> # Reset master to the good commit
``` |
2489559 | Git: Can I commit my working directory to a new branch without committing it to a current branch? | 17 | 2010-03-22 01:33:26 | <p>I am working on a project, and had all of my tests passing on the master branch. I then made some changes, and when everything started failing, I realized that maybe I should have made those changes on a different branch. Is there a way I can commit the changes to a new branch without committing them to my master ... | 6,970 | 262,972 | 2017-04-15 16:33:54 | 2,489,566 | 26 | 2010-03-22 01:34:44 | 28,804 | 2010-03-22 01:34:44 | https://stackoverflow.com/q/2489559 | https://stackoverflow.com/a/2489566 | <p>Yes, just create the new branch and check it out:</p>
<pre><code>$ git checkout -b new-branch
</code></pre>
<p>Then commit any changes you have. They'll be applied to the new, checked-out branch.</p>
| <p>Yes, just create the new branch and check it out:</p> <pre><code>$ git checkout -b new-branch </code></pre> <p>Then commit any changes you have. They'll be applied to the new, checked-out branch.</p> | 119, 1879, 5597 | branch, commit, git | <h1>Git: Can I commit my working directory to a new branch without committing it to a current branch?</h1>
<p>I am working on a project, and had all of my tests passing on the master branch. I then made some changes, and when everything started failing, I realized that maybe I should have made those changes on a diffe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,541 | git | # Git: Can I commit my working directory to a new branch without committing it to a current branch?
I am working on a project, and had all of my tests passing on the master branch. I then made some changes, and when everything started failing, I realized that maybe I should have made those changes on a different branc... | Yes, just create the new branch and check it out:
```
$ git checkout -b new-branch
```
Then commit any changes you have. They'll be applied to the new, checked-out branch. |
57960566 | How to force consistent line endings in Git commits with cross-platform compatibility | 16 | 2019-09-16 15:59:32 | <p>I am having issues with merge conflicts due to line endings while working with someone who uses a different OS. I work on Windows and my colleague is on Mac. When he pushes his changes, sometimes files he hasn't worked on show up in the diff as being changed, because the line endings now show <code>^M</code> on each... | 8,598 | 2,566,283 | 2022-12-30 12:58:41 | 59,644,154 | 26 | 2020-01-08 10:45:07 | 3,700,414 | 2022-12-30 12:58:41 | https://stackoverflow.com/q/57960566 | https://stackoverflow.com/a/59644154 | <blockquote>
<p>Q1 Enforcing consistent lineendings</p>
<p>Q2 Enforcing at commit as well as checkout (comment)</p>
</blockquote>
<p>I'll divide this into 2 parts: Practice and Principle</p>
<h1>Practice</h1>
<p>Expansion of <a href="https://stackoverflow.com/a/57961890/3700414">code-apprentice's</a> suggestion</p>
<o... | <blockquote> <p>Q1 Enforcing consistent lineendings</p> <p>Q2 Enforcing at commit as well as checkout (comment)</p> </blockquote> <p>I'll divide this into 2 parts: Practice and Principle</p> <h1>Practice</h1> <p>Expansion of <a href="https://stackoverflow.com/a/57961890/3700414">code-apprentice's</a> suggestion</p> <o... | 64, 119, 717, 8329, 28897 | git, git-merge, line-endings, merge, windows | <h1>How to force consistent line endings in Git commits with cross-platform compatibility</h1>
<p>I am having issues with merge conflicts due to line endings while working with someone who uses a different OS. I work on Windows and my colleague is on Mac. When he pushes his changes, sometimes files he hasn't worked on ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,542 | git | # How to force consistent line endings in Git commits with cross-platform compatibility
I am having issues with merge conflicts due to line endings while working with someone who uses a different OS. I work on Windows and my colleague is on Mac. When he pushes his changes, sometimes files he hasn't worked on show up i... | > Q1 Enforcing consistent lineendings
>
> Q2 Enforcing at commit as well as checkout (comment)
I'll divide this into 2 parts: Practice and Principle
# Practice
Expansion of [code-apprentice's](https://stackoverflow.com/a/57961890/3700414) suggestion
1. Strictly avoid `autocrlf` — See why [autocrlf is always wrong](... |
18755933 | Create a git submodule from a specific repo hash or tag | 16 | 2013-09-12 05:22:58 | <p>I have a project which depends on Twitter bootstrap 2.x, however, when I add bootstrap as a submodule using the following:</p>
<pre class="lang-bash prettyprint-override"><code>git submodule add https://github.com/twbs/bootstrap.git
</code></pre>
<p>This brings in the latest version of bootstrap.</p>
<p>I would like... | 12,647 | 249,933 | 2022-07-02 00:24:24 | 18,756,678 | 26 | 2013-09-12 06:15:26 | 6,309 | 2013-09-12 06:15:26 | https://stackoverflow.com/q/18755933 | https://stackoverflow.com/a/18756678 | <p>Once your submodule is created:</p>
<pre><code>cd /path/to/yoursubmodule
git checkout yourTag
cd ..
git add yoursubmodule
git commit -m "use submoduile at tag xx"
git push
</code></pre>
<p>You records that way the fact you want a submodule at a certain tag.</p>
| <p>Once your submodule is created:</p> <pre><code>cd /path/to/yoursubmodule git checkout yourTag cd .. git add yoursubmodule git commit -m "use submoduile at tag xx" git push </code></pre> <p>You records that way the fact you want a submodule at a certain tag.</p> | 119, 41612 | git, git-submodules | <h1>Create a git submodule from a specific repo hash or tag</h1>
<p>I have a project which depends on Twitter bootstrap 2.x, however, when I add bootstrap as a submodule using the following:</p>
<pre class="lang-bash prettyprint-override"><code>git submodule add https://github.com/twbs/bootstrap.git
</code></pre>
<p>Th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,544 | git | # Create a git submodule from a specific repo hash or tag
I have a project which depends on Twitter bootstrap 2.x, however, when I add bootstrap as a submodule using the following:
```
git submodule add https://github.com/twbs/bootstrap.git
```
This brings in the latest version of bootstrap.
I would like to create ... | Once your submodule is created:
```
cd /path/to/yoursubmodule
git checkout yourTag
cd ..
git add yoursubmodule
git commit -m "use submoduile at tag xx"
git push
```
You records that way the fact you want a submodule at a certain tag. |
9925590 | How can I recover a commit to an unnamed branch in Git? | 16 | 2012-03-29 12:43:55 | <p>I did some changes and then did a commit. Then I realized that I am on an unnamed branch. So I checked out another branch (with a name). Now I want to recover the commit that I did to the unnamed branch or switch back to the unnamed branch so that I can put a name on it.</p>
<p>Is my commit lost forever?</p>
<p>Is... | 3,459 | 487,855 | 2012-10-13 23:35:32 | 9,925,629 | 26 | 2012-03-29 12:46:13 | 229,044 | 2012-03-29 12:46:13 | https://stackoverflow.com/q/9925590 | https://stackoverflow.com/a/9925629 | <p>You can inspect <code>git reflog</code> to see what your HEAD was pointing at previously. When you find the commit id, you can check it out via <code>git checkout <commit-id></code>. Once you are on that commit, you can create a branch to point to it via <code>git checkout -b <branch-name></code>.</p>
| <p>You can inspect <code>git reflog</code> to see what your HEAD was pointing at previously. When you find the commit id, you can check it out via <code>git checkout <commit-id></code>. Once you are on that commit, you can create a branch to point to it via <code>git checkout -b <branch-name></code>.</p> | 119, 1879 | branch, git | <h1>How can I recover a commit to an unnamed branch in Git?</h1>
<p>I did some changes and then did a commit. Then I realized that I am on an unnamed branch. So I checked out another branch (with a name). Now I want to recover the commit that I did to the unnamed branch or switch back to the unnamed branch so that I ca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,545 | git | # How can I recover a commit to an unnamed branch in Git?
I did some changes and then did a commit. Then I realized that I am on an unnamed branch. So I checked out another branch (with a name). Now I want to recover the commit that I did to the unnamed branch or switch back to the unnamed branch so that I can put a n... | You can inspect `git reflog` to see what your HEAD was pointing at previously. When you find the commit id, you can check it out via `git checkout <commit-id>`. Once you are on that commit, you can create a branch to point to it via `git checkout -b <branch-name>`. |
5870727 | Git: need to recursively 'git rm' the contents of all bin and obj folders | 16 | 2011-05-03 14:08:21 | <p>Someone by accident just commited all of their bin and obj folders to our repo
(there are around 40 such folders). I would like to do a <code>git rm -r</code>
on all of these folders. Is there a command to do this?</p>
| 11,324 | 244,005 | 2015-12-29 13:30:57 | 5,870,756 | 26 | 2011-05-03 14:10:38 | 85,371 | 2015-12-29 13:30:57 | https://stackoverflow.com/q/5870727 | https://stackoverflow.com/a/5870756 | <p>Have backups,</p>
<pre><code> find . -type d -name bin -exec git rm -r {} \;
find . -type d -name obj -exec git rm -r {} \;
</code></pre>
<h2>Update</h2>
<p>With bash, you can set the shopt globstar, and be happy:</p>
<pre><code> shopt -s globstar
git rm -r **/{obj,bin}/
</code></pre>
<p>Finally, if you need... | <p>Have backups,</p> <pre><code> find . -type d -name bin -exec git rm -r {} \; find . -type d -name obj -exec git rm -r {} \; </code></pre> <h2>Update</h2> <p>With bash, you can set the shopt globstar, and be happy:</p> <pre><code> shopt -s globstar git rm -r **/{obj,bin}/ </code></pre> <p>Finally, if you need... | 119, 68596, 74978, 112901 | git, git-clean, git-rm, git-stage | <h1>Git: need to recursively 'git rm' the contents of all bin and obj folders</h1>
<p>Someone by accident just commited all of their bin and obj folders to our repo
(there are around 40 such folders). I would like to do a <code>git rm -r</code>
on all of these folders. Is there a command to do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,546 | git | # Git: need to recursively 'git rm' the contents of all bin and obj folders
Someone by accident just commited all of their bin and obj folders to our repo
(there are around 40 such folders). I would like to do a `git rm -r`
on all of these folders. Is there a command to do this? | Have backups,
```
find . -type d -name bin -exec git rm -r {} \;
find . -type d -name obj -exec git rm -r {} \;
```
## Update
With bash, you can set the shopt globstar, and be happy:
```
shopt -s globstar
git rm -r **/{obj,bin}/
```
Finally, if you need to remove these from the history of the repository, look... |
66129837 | About the .gitignore question, .cxx folder in the Android project | 15 | 2021-02-10 01:52:59 | <p>Here's a question about Git, .gitignore on Android!</p>
<p>======================================================</p>
<p><strong>Q1) What files are created in myproject/app/.cxx?</strong></p>
<p>I am using ndk, jni in android project.
It seems that the files related to this are being automatically changed in myproje... | 5,554 | 12,728,552 | 2025-03-14 06:49:57 | 66,131,117 | 26 | 2021-02-10 04:56:15 | 4,456,436 | 2025-03-14 06:49:57 | https://stackoverflow.com/q/66129837 | https://stackoverflow.com/a/66131117 | <p>As to answer your second question, You need to have only one .gitignore file at the root of the project folder.</p>
<p>As to answer your first question, all the .cxx files must be ignored. You can have the below line in .gitignore file.</p>
<pre><code>**/.cxx
</code></pre>
<p>If you have already tracked this file, u... | <p>As to answer your second question, You need to have only one .gitignore file at the root of the project folder.</p> <p>As to answer your first question, all the .cxx files must be ignored. You can have the below line in .gitignore file.</p> <pre><code>**/.cxx </code></pre> <p>If you have already tracked this file, u... | 119, 1386, 25056 | android, git, gitignore | <h1>About the .gitignore question, .cxx folder in the Android project</h1>
<p>Here's a question about Git, .gitignore on Android!</p>
<p>======================================================</p>
<p><strong>Q1) What files are created in myproject/app/.cxx?</strong></p>
<p>I am using ndk, jni in android project.
It seem... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,547 | git | # About the .gitignore question, .cxx folder in the Android project
Here's a question about Git, .gitignore on Android!
======================================================
**Q1) What files are created in myproject/app/.cxx?**
I am using ndk, jni in android project.
It seems that the files related to this are bei... | As to answer your second question, You need to have only one .gitignore file at the root of the project folder.
As to answer your first question, all the .cxx files must be ignored. You can have the below line in .gitignore file.
```
**/.cxx
```
If you have already tracked this file, use the below commands after add... |
56769964 | What is the meaning of - (single dash) in "git checkout - ..."? | 15 | 2019-06-26 09:54:25 | <p>In my repository, I had some changes (let's say that all the edited files' paths started with <code>abc_</code>) that I wanted to discard, with the command:</p>
<pre><code>git checkout -- abc_*
</code></pre>
<p>However, I made a typo and instead of two dashes I used only one:</p>
<pre><code>git checkout - abc_*
<... | 5,585 | 4,744,341 | 2019-07-16 15:30:11 | 56,770,347 | 26 | 2019-06-26 10:14:06 | 6,330,106 | 2019-06-26 10:14:06 | https://stackoverflow.com/q/56769964 | https://stackoverflow.com/a/56770347 | <p>The single dash here means the previous active branch or detached HEAD.</p>
<p>Case 1:</p>
<pre><code>git checkout master
git checkout dev
# here - means master
git checkout -
# here - means dev
git checkout -
</code></pre>
<p>Case 2:</p>
<pre><code># detached HEAD
git checkout refs/heads/master
# back to mast... | <p>The single dash here means the previous active branch or detached HEAD.</p> <p>Case 1:</p> <pre><code>git checkout master git checkout dev # here - means master git checkout - # here - means dev git checkout - </code></pre> <p>Case 2:</p> <pre><code># detached HEAD git checkout refs/heads/master # back to mast... | 119 | git | <h1>What is the meaning of - (single dash) in "git checkout - ..."?</h1>
<p>In my repository, I had some changes (let's say that all the edited files' paths started with <code>abc_</code>) that I wanted to discard, with the command:</p>
<pre><code>git checkout -- abc_*
</code></pre>
<p>However, I made a typo and inst... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,548 | git | # What is the meaning of - (single dash) in "git checkout - ..."?
In my repository, I had some changes (let's say that all the edited files' paths started with `abc_`) that I wanted to discard, with the command:
```
git checkout -- abc_*
```
However, I made a typo and instead of two dashes I used only one:
```
git ... | The single dash here means the previous active branch or detached HEAD.
Case 1:
```
git checkout master
git checkout dev
# here - means master
git checkout -
# here - means dev
git checkout -
```
Case 2:
```
# detached HEAD
git checkout refs/heads/master
# back to master
git checkout master
# detached HEAD again... |
44459774 | How to push to github with custom commit message with npm scripts? | 15 | 2017-06-09 13:59:53 | <p>In my <code>package.json</code> I have this</p>
<pre><code> "scripts": {
"start": "gulp serve",
"git": "git add . && git commit -m 'some-message' && git push --all"
},
</code></pre>
<p>In the terminal I run <code>npm run git</code> and the changes are pushed. But how can I change the com... | 9,248 | 4,941,988 | 2019-11-26 10:23:41 | 44,460,388 | 26 | 2017-06-09 14:28:45 | 2,902,821 | 2019-11-26 10:23:41 | https://stackoverflow.com/q/44459774 | https://stackoverflow.com/a/44460388 | <p>A solution involving some npm trickery might consist of:</p>
<pre><code>"scripts": {
"git": "git add . && git commit -m",
"postgit": "git push --all"
},
</code></pre>
<p>To be called like:</p>
<pre><code>npm run git -- "Message of the commit"
</code></pre>
<p>or:</p>
<pre><code>npm run git -- Messag... | <p>A solution involving some npm trickery might consist of:</p> <pre><code>"scripts": { "git": "git add . && git commit -m", "postgit": "git push --all" }, </code></pre> <p>To be called like:</p> <pre><code>npm run git -- "Message of the commit" </code></pre> <p>or:</p> <pre><code>npm run git -- Messag... | 119, 46426, 61387, 122330 | git, node.js, npm, npm-scripts | <h1>How to push to github with custom commit message with npm scripts?</h1>
<p>In my <code>package.json</code> I have this</p>
<pre><code> "scripts": {
"start": "gulp serve",
"git": "git add . && git commit -m 'some-message' && git push --all"
},
</code></pre>
<p>In the terminal I run <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,549 | git | # How to push to github with custom commit message with npm scripts?
In my `package.json` I have this
```
"scripts": {
"start": "gulp serve",
"git": "git add . && git commit -m 'some-message' && git push --all"
},
```
In the terminal I run `npm run git` and the changes are pushed. But how can I change th... | A solution involving some npm trickery might consist of:
```
"scripts": {
"git": "git add . && git commit -m",
"postgit": "git push --all"
},
```
To be called like:
```
npm run git -- "Message of the commit"
```
or:
```
npm run git -- Message
``` |
575694 | Can I remove the initial commit from a Git repo? | 15 | 2009-02-22 20:16:36 | <p>It seems that my initial commit is eating up 90% of the space, since it accidentally got made with quite a lot of media files in it. Is there a way to remove just the first commit from local and remote repos, or should I just leave this one be?</p>
| 13,055 | 21,716 | 2009-02-23 03:28:04 | 575,734 | 26 | 2009-02-22 20:35:22 | 19,563 | 2009-02-22 22:33:48 | https://stackoverflow.com/q/575694 | https://stackoverflow.com/a/575734 | <p>It sounds like you've already shared the repository with a number of other users. If this is the case, then you should probably just live with it.</p>
<p>If you're in control of all of the clones then you can re-write the history on top of a modified root commit with the unintended files removed. Note that you shou... | <p>It sounds like you've already shared the repository with a number of other users. If this is the case, then you should probably just live with it.</p> <p>If you're in control of all of the clones then you can re-write the history on top of a modified root commit with the unintended files removed. Note that you shou... | 119 | git | <h1>Can I remove the initial commit from a Git repo?</h1>
<p>It seems that my initial commit is eating up 90% of the space, since it accidentally got made with quite a lot of media files in it. Is there a way to remove just the first commit from local and remote repos, or should I just leave this one be?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,551 | git | # Can I remove the initial commit from a Git repo?
It seems that my initial commit is eating up 90% of the space, since it accidentally got made with quite a lot of media files in it. Is there a way to remove just the first commit from local and remote repos, or should I just leave this one be? | It sounds like you've already shared the repository with a number of other users. If this is the case, then you should probably just live with it.
If you're in control of all of the clones then you can re-write the history on top of a modified root commit with the unintended files removed. Note that you shouldn't do t... |
22981934 | How to use libgit2sharp to create a new branch from local to remote? | 14 | 2014-04-10 07:52:40 | <p>I want to create and delete a branch on git using libgit2sharp. I came up with this code but it throws an error at <code>repo.Network.Push(localBranch, pushOptions);</code></p>
<pre><code>using (var repo = new Repository(GIT_PATH))
{
var branch = repo.CreateBranch(branchName);
var localBranch = repo.Branch... | 8,782 | 53,261 | 2015-07-08 17:15:38 | 22,983,102 | 26 | 2014-04-10 08:49:24 | 335,418 | 2015-07-08 17:15:38 | https://stackoverflow.com/q/22981934 | https://stackoverflow.com/a/22983102 | <p>You have to associate your local branch with a remote against which you'd like to push.</p>
<p>For instance, given an already existing <code>"origin"</code> remote:</p>
<pre><code>Remote remote = repo.Network.Remotes["origin"];
// The local branch "buggy-3" will track a branch also named "buggy-3"
// in the repos... | <p>You have to associate your local branch with a remote against which you'd like to push.</p> <p>For instance, given an already existing <code>"origin"</code> remote:</p> <pre><code>Remote remote = repo.Network.Remotes["origin"]; // The local branch "buggy-3" will track a branch also named "buggy-3" // in the repos... | 9, 119, 74777 | c#, git, libgit2sharp | <h1>How to use libgit2sharp to create a new branch from local to remote?</h1>
<p>I want to create and delete a branch on git using libgit2sharp. I came up with this code but it throws an error at <code>repo.Network.Push(localBranch, pushOptions);</code></p>
<pre><code>using (var repo = new Repository(GIT_PATH))
{
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,555 | git | # How to use libgit2sharp to create a new branch from local to remote?
I want to create and delete a branch on git using libgit2sharp. I came up with this code but it throws an error at `repo.Network.Push(localBranch, pushOptions);`
```
using (var repo = new Repository(GIT_PATH))
{
var branch = repo.CreateBranch(... | You have to associate your local branch with a remote against which you'd like to push.
For instance, given an already existing `"origin"` remote:
```
Remote remote = repo.Network.Remotes["origin"];
// The local branch "buggy-3" will track a branch also named "buggy-3"
// in the repository pointed at by "origin"
re... |
3233056 | How do I avoid committing small changes in git? | 14 | 2010-07-12 23:27:59 | <p>I'm wondering, how could I avoid a commit in really small changes of code. For instance, sometimes I miss a space between parameters or that kind of tiny code formatting. The reason I ask this is because later I have to push my commits to a remote repository and I don't want to include those small changes.</p>
<p>A... | 8,693 | 389,961 | 2021-06-02 11:25:52 | 3,233,097 | 26 | 2010-07-12 23:36:49 | 95,509 | 2011-12-15 13:53:42 | https://stackoverflow.com/q/3233056 | https://stackoverflow.com/a/3233097 | <p>Update: As others pointed out, do not do any rebasing, or history re-writing of any sorts if you've pushed to a remote origin and shared this code with other developers. Short answer: It's dangerous and risky!</p>
<p>I'd recommend checking out the <a href="http://www.gitready.com/advanced/2009/02/10/squashing-commit... | <p>Update: As others pointed out, do not do any rebasing, or history re-writing of any sorts if you've pushed to a remote origin and shared this code with other developers. Short answer: It's dangerous and risky!</p> <p>I'd recommend checking out the <a href="http://www.gitready.com/advanced/2009/02/10/squashing-commit... | 119, 5597 | commit, git | <h1>How do I avoid committing small changes in git?</h1>
<p>I'm wondering, how could I avoid a commit in really small changes of code. For instance, sometimes I miss a space between parameters or that kind of tiny code formatting. The reason I ask this is because later I have to push my commits to a remote repository a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,556 | git | # How do I avoid committing small changes in git?
I'm wondering, how could I avoid a commit in really small changes of code. For instance, sometimes I miss a space between parameters or that kind of tiny code formatting. The reason I ask this is because later I have to push my commits to a remote repository and I don'... | Update: As others pointed out, do not do any rebasing, or history re-writing of any sorts if you've pushed to a remote origin and shared this code with other developers. Short answer: It's dangerous and risky!
I'd recommend checking out the [rebase](http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-re... |
53858884 | shortcut for git merging master into current branch | 13 | 2018-12-19 20:43:59 | <p>So sometimes I'm working on a branch and I want to pull in the changes made on origin/master since branch created. Just doing <code>git merge master</code> is not usually adequate because local master may not have the changes from remote master, so I find myself having to do this: </p>
<pre><code># save any uncommi... | 2,885 | 869,951 | 2018-12-21 14:54:37 | 53,859,568 | 26 | 2018-12-19 21:43:11 | 7,976,758 | 2018-12-19 21:43:11 | https://stackoverflow.com/q/53858884 | https://stackoverflow.com/a/53859568 | <p>One command:</p>
<pre><code>git pull origin master:master
</code></pre>
<p>Let's me split it and explain. <code>git pull master:master</code> is equivalent to</p>
<pre><code>git fetch origin master:master
git merge master
</code></pre>
<p><code>git fetch origin master:master</code> means: fetch new commits from ... | <p>One command:</p> <pre><code>git pull origin master:master </code></pre> <p>Let's me split it and explain. <code>git pull master:master</code> is equivalent to</p> <pre><code>git fetch origin master:master git merge master </code></pre> <p><code>git fetch origin master:master</code> means: fetch new commits from ... | 119 | git | <h1>shortcut for git merging master into current branch</h1>
<p>So sometimes I'm working on a branch and I want to pull in the changes made on origin/master since branch created. Just doing <code>git merge master</code> is not usually adequate because local master may not have the changes from remote master, so I find ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,558 | git | # shortcut for git merging master into current branch
So sometimes I'm working on a branch and I want to pull in the changes made on origin/master since branch created. Just doing `git merge master` is not usually adequate because local master may not have the changes from remote master, so I find myself having to do ... | One command:
```
git pull origin master:master
```
Let's me split it and explain. `git pull master:master` is equivalent to
```
git fetch origin master:master
git merge master
```
`git fetch origin master:master` means: fetch new commits from remote `origin` branch `master` and update local branch `master` to point... |
49388201 | git revert back to certain commit without changing history and creating a new commit like git revert | 13 | 2018-03-20 15:26:45 | <p>Is there a way to revert to a certain commit without changing the remote history, basically undoing all the changes from that commit in a new commit just like git revert?</p>
<p>For eg - I have 3 commits
commit A -> B -> C, my head is currently at C
I want to now create another commit D which will have the same co... | 11,235 | 6,553,048 | 2023-06-23 00:04:21 | 49,391,871 | 26 | 2018-03-20 18:38:25 | 1,256,452 | 2018-03-20 18:38:25 | https://stackoverflow.com/q/49388201 | https://stackoverflow.com/a/49391871 | <h3>Be careful with the word "revert"</h3>
<p>When people say "I want to revert" in Git they sometimes mean what <code>git revert</code> does, which is more of a <em>back out</em> operation, and sometimes mean what you do, which is to <em>restore the source base from an earlier version</em>.</p>
<p>To illustrate, sup... | <h3>Be careful with the word "revert"</h3> <p>When people say "I want to revert" in Git they sometimes mean what <code>git revert</code> does, which is more of a <em>back out</em> operation, and sometimes mean what you do, which is to <em>restore the source base from an earlier version</em>.</p> <p>To illustrate, sup... | 119, 12309, 34403 | git, git-revert, revert | <h1>git revert back to certain commit without changing history and creating a new commit like git revert</h1>
<p>Is there a way to revert to a certain commit without changing the remote history, basically undoing all the changes from that commit in a new commit just like git revert?</p>
<p>For eg - I have 3 commits
c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,559 | git | # git revert back to certain commit without changing history and creating a new commit like git revert
Is there a way to revert to a certain commit without changing the remote history, basically undoing all the changes from that commit in a new commit just like git revert?
For eg - I have 3 commits
commit A -> B -> C... | ### Be careful with the word "revert"
When people say "I want to revert" in Git they sometimes mean what `git revert` does, which is more of a *back out* operation, and sometimes mean what you do, which is to *restore the source base from an earlier version*.
To illustrate, suppose we have a commit that has just one ... |
34071868 | gem install git-up no longer working in El Capitan | 13 | 2015-12-03 16:59:07 | <p>After upgrating to OS "El Capitan" I noticed that git-up was no longer installed. I tried to install by: </p>
<pre><code>~ 🍺 gem install git-up
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/2.0.0/gems/git-up-0.5.12/bin/git-up
~ 🍺
</code></pre>
<p>Mal El Capitan</p>
| 23,030 | 2,158,441 | 2018-10-21 18:31:53 | 34,071,869 | 26 | 2015-12-03 16:59:07 | 2,158,441 | 2015-12-03 16:59:07 | https://stackoverflow.com/q/34071868 | https://stackoverflow.com/a/34071869 | <p>After digging in I found the directory is owned by a user other than myself. (/Library/Ruby/Gems/.. is installed by Apple as part of Mac OS X.)</p>
<p>So I simply used brew to get install my own ruby and bingo!</p>
<pre><code>~ 🍺 brew update
~ 🍺 brew install ruby
</code></pre>
<p>Then I could run:</p>
<pre><co... | <p>After digging in I found the directory is owned by a user other than myself. (/Library/Ruby/Gems/.. is installed by Apple as part of Mac OS X.)</p> <p>So I simply used brew to get install my own ruby and bingo!</p> <pre><code>~ 🍺 brew update ~ 🍺 brew install ruby </code></pre> <p>Then I could run:</p> <pre><co... | 119, 112573 | git, osx-elcapitan | <h1>gem install git-up no longer working in El Capitan</h1>
<p>After upgrating to OS "El Capitan" I noticed that git-up was no longer installed. I tried to install by: </p>
<pre><code>~ 🍺 gem install git-up
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/2.0.0/gems/git-up-0.5.12... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,561 | git | # gem install git-up no longer working in El Capitan
After upgrating to OS "El Capitan" I noticed that git-up was no longer installed. I tried to install by:
```
~ 🍺 gem install git-up
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/2.0.0/gems/git-up-0.5.12/bin/git-up
~ 🍺
```
... | After digging in I found the directory is owned by a user other than myself. (/Library/Ruby/Gems/.. is installed by Apple as part of Mac OS X.)
So I simply used brew to get install my own ruby and bingo!
```
~ 🍺 brew update
~ 🍺 brew install ruby
```
Then I could run:
```
~ 🍺 gem install git-up
...
6 gems install... |
12894154 | Get all tags from taggit | 13 | 2012-10-15 10:56:56 | <p>How to get all the (unique) tags from django-taggit? I would like to display all the tags in a side bar.
Currently I am able to get all the tags for a particular post, but now I need to get all the unique tags in the entire blog.</p>
<p>code in models.py:</p>
<pre><code>from django.db import models
from taggit.man... | 8,719 | 1,540,990 | 2020-05-16 01:17:36 | 12,894,243 | 26 | 2012-10-15 11:03:02 | 63,011 | 2012-10-15 14:03:37 | https://stackoverflow.com/q/12894154 | https://stackoverflow.com/a/12894243 | <p>You can use <a href="https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.all" rel="noreferrer"><code>all()</code></a> to get all the tags in your database:</p>
<pre><code>from taggit.models import Tag
tags = Tag.objects.all()
</code></pre>
<p>If you need a complete solution,... | <p>You can use <a href="https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.all" rel="noreferrer"><code>all()</code></a> to get all the tags in your database:</p> <pre><code>from taggit.models import Tag tags = Tag.objects.all() </code></pre> <p>If you need a complete solution,... | 16, 243, 10742, 67475 | django, django-models, django-taggit, python | <h1>Get all tags from taggit</h1>
<p>How to get all the (unique) tags from django-taggit? I would like to display all the tags in a side bar.
Currently I am able to get all the tags for a particular post, but now I need to get all the unique tags in the entire blog.</p>
<p>code in models.py:</p>
<pre><code>from djang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,563 | git | # Get all tags from taggit
How to get all the (unique) tags from django-taggit? I would like to display all the tags in a side bar.
Currently I am able to get all the tags for a particular post, but now I need to get all the unique tags in the entire blog.
code in models.py:
```
from django.db import models
from tag... | You can use [`all()`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.all) to get all the tags in your database:
```
from taggit.models import Tag
tags = Tag.objects.all()
```
If you need a complete solution, have a look at [`django-taggit-templatetags`](https://github.com/... |
7712177 | How to create branch and push to server | 13 | 2011-10-10 11:35:47 | <p>I have cloned project from repo and I need to create branch and in that branch do my changes. After that I need to push that branch on repo. How to do this ? I am sorry, I am new to git ?</p>
| 14,378 | 486,578 | 2011-10-10 11:50:44 | 7,712,217 | 26 | 2011-10-10 11:40:54 | 223,092 | 2011-10-10 11:50:44 | https://stackoverflow.com/q/7712177 | https://stackoverflow.com/a/7712217 | <p>You can create a new branch called <code>my-work</code> (based on your current commit) and switch to that branch with:</p>
<pre><code>git branch my-work
git checkout my-work
</code></pre>
<p>Or, as a shortcut for those two commands, you can just do:</p>
<pre><code>git checkout -b my-work
</code></pre>
<p>To push... | <p>You can create a new branch called <code>my-work</code> (based on your current commit) and switch to that branch with:</p> <pre><code>git branch my-work git checkout my-work </code></pre> <p>Or, as a shortcut for those two commands, you can just do:</p> <pre><code>git checkout -b my-work </code></pre> <p>To push... | 119 | git | <h1>How to create branch and push to server</h1>
<p>I have cloned project from repo and I need to create branch and in that branch do my changes. After that I need to push that branch on repo. How to do this ? I am sorry, I am new to git ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,564 | git | # How to create branch and push to server
I have cloned project from repo and I need to create branch and in that branch do my changes. After that I need to push that branch on repo. How to do this ? I am sorry, I am new to git ? | You can create a new branch called `my-work` (based on your current commit) and switch to that branch with:
```
git branch my-work
git checkout my-work
```
Or, as a shortcut for those two commands, you can just do:
```
git checkout -b my-work
```
To push that branch to the repository that you cloned from, you shoul... |
6975124 | How do I retrieve a git repository from Heroku? | 13 | 2011-08-07 19:13:36 | <p>I created an app and deployed it to Heroku, but I didn't have a github git repo (I know really bad idea!) and my local git repo has been deleted (just plain stupidity here). So I have no copies of my source. I need to make some updates and the only thing I can think of is doing a checkout from Heroku.</p>
<p>Is t... | 3,098 | 818,049 | 2014-03-14 03:31:15 | 6,975,172 | 26 | 2011-08-07 19:20:03 | 285,289 | 2011-08-07 19:20:03 | https://stackoverflow.com/q/6975124 | https://stackoverflow.com/a/6975172 | <p>You just need clone you git repo link by your heroku app.</p>
<pre><code>git clone git@heroku.com:<YOUR_APP>.git
</code></pre>
| <p>You just need clone you git repo link by your heroku app.</p> <pre><code>git clone git@heroku.com:<YOUR_APP>.git </code></pre> | 119, 4984, 8279 | git, heroku, ruby-on-rails | <h1>How do I retrieve a git repository from Heroku?</h1>
<p>I created an app and deployed it to Heroku, but I didn't have a github git repo (I know really bad idea!) and my local git repo has been deleted (just plain stupidity here). So I have no copies of my source. I need to make some updates and the only thing I c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,565 | git | # How do I retrieve a git repository from Heroku?
I created an app and deployed it to Heroku, but I didn't have a github git repo (I know really bad idea!) and my local git repo has been deleted (just plain stupidity here). So I have no copies of my source. I need to make some updates and the only thing I can think of... | You just need clone you git repo link by your heroku app.
```
git clone git@heroku.com:<YOUR_APP>.git
``` |
63178036 | How to find commit hash from within a running docker image | 12 | 2020-07-30 17:05:48 | <p>I currently build my images and tag them with the commit hash. I then pull this image and run it (either via the commit hash or the <code>latest</code> tag). How can I find out the commit hash from a running container ?</p>
<p>All I currently know is the container <code>hostname</code>. So if the container is runnin... | 20,148 | 2,768,038 | 2021-08-08 07:10:08 | 63,178,429 | 26 | 2020-07-30 17:34:05 | 3,288,890 | 2021-08-08 07:10:08 | https://stackoverflow.com/q/63178036 | https://stackoverflow.com/a/63178429 | <p>One of the option that you can try is to set <code>commit hash</code> in the environment variable, so you will able to get the <code>ENV</code> from the image as well.</p>
<pre><code>docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) -t my_image:$(git rev-parse HEAD) .
</code></pre>
<p>and the Dockerfile</p>
... | <p>One of the option that you can try is to set <code>commit hash</code> in the environment variable, so you will able to get the <code>ENV</code> from the image as well.</p> <pre><code>docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) -t my_image:$(git rev-parse HEAD) . </code></pre> <p>and the Dockerfile</p> ... | 119, 4985, 90304, 110753 | docker, docker-swarm, git, image | <h1>How to find commit hash from within a running docker image</h1>
<p>I currently build my images and tag them with the commit hash. I then pull this image and run it (either via the commit hash or the <code>latest</code> tag). How can I find out the commit hash from a running container ?</p>
<p>All I currently know i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,567 | git | # How to find commit hash from within a running docker image
I currently build my images and tag them with the commit hash. I then pull this image and run it (either via the commit hash or the `latest` tag). How can I find out the commit hash from a running container ?
All I currently know is the container `hostname`... | One of the option that you can try is to set `commit hash` in the environment variable, so you will able to get the `ENV` from the image as well.
```
docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) -t my_image:$(git rev-parse HEAD) .
```
and the Dockerfile
```
FROM alpine
ARG GIT_COMMIT
ENV GIT_COMMIT=$GIT... |
10176352 | Undo a merge that has been pushed | 12 | 2012-04-16 14:45:40 | <p>OK, I have made a bit of a mess. Apparently, on my machine at home, the develop branch was not updated. I made a commit and pushed. The result was that the actual origin/develop branch has been merged into my local develop branch - which for some reason were considered as different branches!</p>
<p>For one thing, I... | 9,999 | 551,694 | 2015-09-10 13:25:33 | 10,181,607 | 26 | 2012-04-16 20:56:56 | 1,256,452 | 2013-12-13 00:27:44 | https://stackoverflow.com/q/10176352 | https://stackoverflow.com/a/10181607 | <p>Merges don't happen on push, they happen on <code>git merge</code> (well, and <code>pull</code> but that's really just fetch + merge, hence, merge happening on merge).</p>
<p>It seems more likely that you did something like this:</p>
<pre><code><get copy from origin/develop>
<wait around for remote's orig... | <p>Merges don't happen on push, they happen on <code>git merge</code> (well, and <code>pull</code> but that's really just fetch + merge, hence, merge happening on merge).</p> <p>It seems more likely that you did something like this:</p> <pre><code><get copy from origin/develop> <wait around for remote's orig... | 119, 717, 12309, 12626 | git, merge, reset, revert | <h1>Undo a merge that has been pushed</h1>
<p>OK, I have made a bit of a mess. Apparently, on my machine at home, the develop branch was not updated. I made a commit and pushed. The result was that the actual origin/develop branch has been merged into my local develop branch - which for some reason were considered as d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,570 | git | # Undo a merge that has been pushed
OK, I have made a bit of a mess. Apparently, on my machine at home, the develop branch was not updated. I made a commit and pushed. The result was that the actual origin/develop branch has been merged into my local develop branch - which for some reason were considered as different ... | Merges don't happen on push, they happen on `git merge` (well, and `pull` but that's really just fetch + merge, hence, merge happening on merge).
It seems more likely that you did something like this:
```
<get copy from origin/develop>
<wait around for remote's origin/develop to acquire new commits>
git checkout deve... |
56571484 | Search git reflog | 10 | 2019-06-12 23:17:48 | <p>I create a new branch when a new issue pops up. These branches are named starting <code>issu</code>. After merging with <code>master</code> these branches are deleted. I wanted to get a list of all such branches. I was able to get it using <code>git reflog</code></p>
<pre><code>>git reflog
55e8b45 (HEAD -> m... | 10,829 | 11,316,253 | 2024-03-03 16:19:54 | 56,571,928 | 26 | 2019-06-13 00:30:52 | 10,155,936 | 2019-06-13 00:30:52 | https://stackoverflow.com/q/56571484 | https://stackoverflow.com/a/56571928 | <p>You can use this command,</p>
<p><code>git reflog --grep-reflog=<pattern></code></p>
<p>In your case it would be, <code>git reflog --grep-reflog="merge issu"</code></p>
<p><a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---grep-reflogltpatterngt" rel="noreferrer">Link</a></p>
| <p>You can use this command,</p> <p><code>git reflog --grep-reflog=<pattern></code></p> <p>In your case it would be, <code>git reflog --grep-reflog="merge issu"</code></p> <p><a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---grep-reflogltpatterngt" rel="noreferrer">Link</a></p> | 119 | git | <h1>Search git reflog</h1>
<p>I create a new branch when a new issue pops up. These branches are named starting <code>issu</code>. After merging with <code>master</code> these branches are deleted. I wanted to get a list of all such branches. I was able to get it using <code>git reflog</code></p>
<pre><code>>git r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,574 | git | # Search git reflog
I create a new branch when a new issue pops up. These branches are named starting `issu`. After merging with `master` these branches are deleted. I wanted to get a list of all such branches. I was able to get it using `git reflog`
```
>git reflog
55e8b45 (HEAD -> master, origin/master, origin/HEAD... | You can use this command,
`git reflog --grep-reflog=<pattern>`
In your case it would be, `git reflog --grep-reflog="merge issu"`
[Link](https://git-scm.com/docs/git-log#Documentation/git-log.txt---grep-reflogltpatterngt) |
53759965 | How to get opposite direction of `git diff origin/master` | 10 | 2018-12-13 10:39:30 | <p>If I run <code>git diff origin/master</code>, it shows me the changes in my local copy of the files in the repo against the files in the master branch in the remote repository.</p>
<p>I know you can list another parameter, and swap the parameters to get the opposite like this:</p>
<p><code>git diff origin/branch_a... | 4,795 | 4,901,390 | 2018-12-13 10:44:49 | 53,760,071 | 26 | 2018-12-13 10:44:49 | 1,256,452 | 2018-12-13 10:44:49 | https://stackoverflow.com/q/53759965 | https://stackoverflow.com/a/53760071 | <p>Right: <code>git diff <em>commit-specifier</em></code> compares the given commit's tree to the work-tree, with the commit's tree on the "left side" as <code>a/</code> and the work-tree on the "right side" as <code>b/</code>. As you noted, it's tough to reverse these as the work-tree is implied by the lack of a seco... | <p>Right: <code>git diff <em>commit-specifier</em></code> compares the given commit's tree to the work-tree, with the commit's tree on the "left side" as <code>a/</code> and the work-tree on the "right side" as <code>b/</code>. As you noted, it's tough to reverse these as the work-tree is implied by the lack of a seco... | 119 | git | <h1>How to get opposite direction of `git diff origin/master`</h1>
<p>If I run <code>git diff origin/master</code>, it shows me the changes in my local copy of the files in the repo against the files in the master branch in the remote repository.</p>
<p>I know you can list another parameter, and swap the parameters to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,575 | git | # How to get opposite direction of `git diff origin/master`
If I run `git diff origin/master`, it shows me the changes in my local copy of the files in the repo against the files in the master branch in the remote repository.
I know you can list another parameter, and swap the parameters to get the opposite like this... | Right: `git diff commit-specifier` compares the given commit's tree to the work-tree, with the commit's tree on the "left side" as `a/` and the work-tree on the "right side" as `b/`. As you noted, it's tough to reverse these as the work-tree is implied by the lack of a second tree or commit specifier.
Fortunately, `gi... |
23908263 | Remove or edit an unpushed Git tag | 10 | 2014-05-28 09:50:38 | <p>In our company we use Git tags to trigger production builds. I just created a tag locally with</p>
<pre class="lang-bash prettyprint-override"><code>git tag -m "Tag message"
</code></pre>
<p>but realize I've made a typo mistake, which will mess up with the production build if I share the tag (push it to remote).</... | 7,462 | 909,777 | 2014-07-31 04:46:08 | 23,908,487 | 26 | 2014-05-28 09:59:47 | 274 | 2014-05-28 09:59:47 | https://stackoverflow.com/q/23908263 | https://stackoverflow.com/a/23908487 | <p>Delete a local tag with</p>
<pre><code>git tag -d tag_name
</code></pre>
<p>Delete a remote tag with</p>
<pre><code>git push origin :refs/tags/tag_name
</code></pre>
<p>However, the command <code>git tag -m "Tag message"</code> wont work as you aren't supplying a tag name. You may find that you haven't actually... | <p>Delete a local tag with</p> <pre><code>git tag -d tag_name </code></pre> <p>Delete a remote tag with</p> <pre><code>git push origin :refs/tags/tag_name </code></pre> <p>However, the command <code>git tag -m "Tag message"</code> wont work as you aren't supplying a tag name. You may find that you haven't actually... | 119, 60718 | git, git-tag | <h1>Remove or edit an unpushed Git tag</h1>
<p>In our company we use Git tags to trigger production builds. I just created a tag locally with</p>
<pre class="lang-bash prettyprint-override"><code>git tag -m "Tag message"
</code></pre>
<p>but realize I've made a typo mistake, which will mess up with the production bui... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,577 | git | # Remove or edit an unpushed Git tag
In our company we use Git tags to trigger production builds. I just created a tag locally with
```
git tag -m "Tag message"
```
but realize I've made a typo mistake, which will mess up with the production build if I share the tag (push it to remote).
**Can I remove or amend the ... | Delete a local tag with
```
git tag -d tag_name
```
Delete a remote tag with
```
git push origin :refs/tags/tag_name
```
However, the command `git tag -m "Tag message"` wont work as you aren't supplying a tag name. You may find that you haven't actually created a tag yet
You can list all your tags with
```
git ta... |
21698854 | git restore a deleted file after merge | 10 | 2014-02-11 10:12:45 | <p>I am trying to recover a file that was accidentally removed when I merged a branch to the master. </p>
<p>Now, when I try to do a git checkout of a new branch I get this message: </p>
<pre><code> $ git checkout testingNewFormStyle
D module/FormDependencies/src/FormDependencies/Entity/LanguageList.php
Switch... | 16,244 | 2,447,558 | 2016-04-03 22:16:01 | 21,698,907 | 26 | 2014-02-11 10:14:54 | 1,093,528 | 2014-02-11 10:14:54 | https://stackoverflow.com/q/21698854 | https://stackoverflow.com/a/21698907 | <p>You can do, for instance:</p>
<pre><code>git checkout HEAD -- module/FormDependencies/src/FormDependencies/Entity/LanguageList.php
</code></pre>
<p>This will checkout the file as it exists in the HEAD refspec (ie, the current branch). If HEAD is not what you want, replace with the appropriate refspec.</p>
| <p>You can do, for instance:</p> <pre><code>git checkout HEAD -- module/FormDependencies/src/FormDependencies/Entity/LanguageList.php </code></pre> <p>This will checkout the file as it exists in the HEAD refspec (ie, the current branch). If HEAD is not what you want, replace with the appropriate refspec.</p> | 119 | git | <h1>git restore a deleted file after merge</h1>
<p>I am trying to recover a file that was accidentally removed when I merged a branch to the master. </p>
<p>Now, when I try to do a git checkout of a new branch I get this message: </p>
<pre><code> $ git checkout testingNewFormStyle
D module/FormDependencies/src... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,578 | git | # git restore a deleted file after merge
I am trying to recover a file that was accidentally removed when I merged a branch to the master.
Now, when I try to do a git checkout of a new branch I get this message:
```
$ git checkout testingNewFormStyle
D module/FormDependencies/src/FormDependencies/Entity/Langu... | You can do, for instance:
```
git checkout HEAD -- module/FormDependencies/src/FormDependencies/Entity/LanguageList.php
```
This will checkout the file as it exists in the HEAD refspec (ie, the current branch). If HEAD is not what you want, replace with the appropriate refspec. |
11021287 | git detect if there are untracked files quickly | 10 | 2012-06-13 18:41:25 | <p>Is there a way to quickly detect if there are any untracked files?</p>
<p>I can <a href="https://stackoverflow.com/questions/3801321/git-list-only-untracked-files-also-custom-commands">list all of the untracked files</a> with </p>
<pre><code>git ls-files --other --directory --exclude-standard
</code></pre>
<p>But... | 10,668 | 594,496 | 2018-03-13 15:13:09 | 11,024,039 | 26 | 2012-06-13 22:09:01 | 1,290,731 | 2018-03-13 15:13:09 | https://stackoverflow.com/q/11021287 | https://stackoverflow.com/a/11024039 | <p>If you have what you want when you've seen the first untracked file, quit right then.</p>
<p>If you're on GNU/anything </p>
<pre><code>git ls-files --other --directory --exclude-standard | sed q1
</code></pre>
<p>will set rc1 if there are any</p>
<p>Otherwise, </p>
<pre><code>anyuntracked() {
return `git ls... | <p>If you have what you want when you've seen the first untracked file, quit right then.</p> <p>If you're on GNU/anything </p> <pre><code>git ls-files --other --directory --exclude-standard | sed q1 </code></pre> <p>will set rc1 if there are any</p> <p>Otherwise, </p> <pre><code>anyuntracked() { return `git ls... | 119 | git | <h1>git detect if there are untracked files quickly</h1>
<p>Is there a way to quickly detect if there are any untracked files?</p>
<p>I can <a href="https://stackoverflow.com/questions/3801321/git-list-only-untracked-files-also-custom-commands">list all of the untracked files</a> with </p>
<pre><code>git ls-files --o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,579 | git | # git detect if there are untracked files quickly
Is there a way to quickly detect if there are any untracked files?
I can [list all of the untracked files](https://stackoverflow.com/questions/3801321/git-list-only-untracked-files-also-custom-commands) with
```
git ls-files --other --directory --exclude-standard
```... | If you have what you want when you've seen the first untracked file, quit right then.
If you're on GNU/anything
```
git ls-files --other --directory --exclude-standard | sed q1
```
will set rc1 if there are any
Otherwise,
```
anyuntracked() {
return `git ls-files -o --directory --exclude-standard | sed q | wc ... |
24583288 | How to ignore IDE settings on Git? | 9 | 2014-07-05 05:27:47 | <p>I have below Git information and I would like to ignore settings of my IDE (Eclipse).</p>
<pre><code>modified: myproject/.classpath
modified: myproject/.project
modified: myproject/.settings/com.google.gdt.eclipse.core.prefs
modified: myproject/.settings/org.eclipse.core.resources.prefs
modified: myprojec... | 15,284 | 1,531,064 | 2022-01-09 09:42:44 | 24,583,296 | 26 | 2014-07-05 05:28:46 | 6,309 | 2014-07-05 05:53:20 | https://stackoverflow.com/q/24583288 | https://stackoverflow.com/a/24583296 | <p>If those elements were already committed, you need to remove them first:</p>
<pre><code>git rm --cached .project
git rm --cached .classpath
git rm --cached -r .settings
</code></pre>
<p>The <code>--cached</code> option allows them to stay in the working tree, while being recorded for deletion.<br>
Once deleted, th... | <p>If those elements were already committed, you need to remove them first:</p> <pre><code>git rm --cached .project git rm --cached .classpath git rm --cached -r .settings </code></pre> <p>The <code>--cached</code> option allows them to stay in the working tree, while being recorded for deletion.<br> Once deleted, th... | 53, 119 | eclipse, git | <h1>How to ignore IDE settings on Git?</h1>
<p>I have below Git information and I would like to ignore settings of my IDE (Eclipse).</p>
<pre><code>modified: myproject/.classpath
modified: myproject/.project
modified: myproject/.settings/com.google.gdt.eclipse.core.prefs
modified: myproject/.settings/org.eclip... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,580 | git | # How to ignore IDE settings on Git?
I have below Git information and I would like to ignore settings of my IDE (Eclipse).
```
modified: myproject/.classpath
modified: myproject/.project
modified: myproject/.settings/com.google.gdt.eclipse.core.prefs
modified: myproject/.settings/org.eclipse.core.resources.pr... | If those elements were already committed, you need to remove them first:
```
git rm --cached .project
git rm --cached .classpath
git rm --cached -r .settings
```
The `--cached` option allows them to stay in the working tree, while being recorded for deletion.
Once deleted, they will be ignored.
Once committed, the... |
21941015 | Git push failing after Heroku app name change | 9 | 2014-02-21 17:22:16 | <p>I changed my app name from "my-app-staging" to "my-app-staging-new" in the Heroku dashboard. Now I can no longer push changes to it- git throws the following error:</p>
<blockquote>
<p>! No such app as my-app-staging.</p>
<p>fatal: Could not read from remote repository.</p>
</blockquote>
<p>How do I resolv... | 4,929 | 165,673 | 2023-06-26 08:45:18 | 21,941,352 | 26 | 2014-02-21 17:38:00 | 120,615 | 2014-02-21 17:38:00 | https://stackoverflow.com/q/21941015 | https://stackoverflow.com/a/21941352 | <p>You need to change your git remote.</p>
<p>If you do <code>git remote -v</code> you should see <code>heroku</code> listed.</p>
<p>It will look something like:</p>
<p><code>heroku git@github.com:my-app-staging.git (fetch)</code><br>
<code>heroku git@github.com:my-app-staging.git (push)</code></p>
<p>Delete that... | <p>You need to change your git remote.</p> <p>If you do <code>git remote -v</code> you should see <code>heroku</code> listed.</p> <p>It will look something like:</p> <p><code>heroku git@github.com:my-app-staging.git (fetch)</code><br> <code>heroku git@github.com:my-app-staging.git (push)</code></p> <p>Delete that... | 119, 8279 | git, heroku | <h1>Git push failing after Heroku app name change</h1>
<p>I changed my app name from "my-app-staging" to "my-app-staging-new" in the Heroku dashboard. Now I can no longer push changes to it- git throws the following error:</p>
<blockquote>
<p>! No such app as my-app-staging.</p>
<p>fatal: Could not read from r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,581 | git | # Git push failing after Heroku app name change
I changed my app name from "my-app-staging" to "my-app-staging-new" in the Heroku dashboard. Now I can no longer push changes to it- git throws the following error:
> ! No such app as my-app-staging.
>
> fatal: Could not read from remote repository.
How do I resolve th... | You need to change your git remote.
If you do `git remote -v` you should see `heroku` listed.
It will look something like:
`heroku git@github.com:my-app-staging.git (fetch)`
`heroku git@github.com:my-app-staging.git (push)`
Delete that remote...
`git remote rm heroku`
...and then add the new one
`git remote ad... |
20410138 | How do I configure remote refs for git + capistrano 3 in ROR deployment? | 9 | 2013-12-05 20:34:35 | <p>I am trying to use capistrano (for the first time) to deploy my rails app. First the essentials, I am using:</p>
<ul>
<li>ruby 1.9.3p362</li>
<li>Rails 3.2.13</li>
<li>rvm 1.24.7</li>
<li>Capistrano 3.0.1</li>
<li>Phusion Passenger 4.0.26</li>
<li>Ubuntu 12.04 LTS</li>
</ul>
<p>I get the following error when attem... | 3,765 | 959,634 | 2016-09-26 16:41:36 | 20,411,757 | 26 | 2013-12-05 22:04:11 | 2,262,149 | 2016-09-26 16:41:36 | https://stackoverflow.com/q/20410138 | https://stackoverflow.com/a/20411757 | <p>In Capistrano 3, you use <code>repo_url</code> instead of <code>repository</code></p>
<p>So in your <code>deploy.rb</code>, try replacing</p>
<pre><code>set :repository, "git@github.com:username/appname.git" # Your clone URL
</code></pre>
<p>with</p>
<pre><code>set :repo_url, "https://github.com/username/appnam... | <p>In Capistrano 3, you use <code>repo_url</code> instead of <code>repository</code></p> <p>So in your <code>deploy.rb</code>, try replacing</p> <pre><code>set :repository, "git@github.com:username/appname.git" # Your clone URL </code></pre> <p>with</p> <pre><code>set :repo_url, "https://github.com/username/appnam... | 119, 190, 2831, 4984, 97592 | capistrano, capistrano3, deployment, git, ruby-on-rails | <h1>How do I configure remote refs for git + capistrano 3 in ROR deployment?</h1>
<p>I am trying to use capistrano (for the first time) to deploy my rails app. First the essentials, I am using:</p>
<ul>
<li>ruby 1.9.3p362</li>
<li>Rails 3.2.13</li>
<li>rvm 1.24.7</li>
<li>Capistrano 3.0.1</li>
<li>Phusion Passenger 4.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,582 | git | # How do I configure remote refs for git + capistrano 3 in ROR deployment?
I am trying to use capistrano (for the first time) to deploy my rails app. First the essentials, I am using:
- ruby 1.9.3p362
- Rails 3.2.13
- rvm 1.24.7
- Capistrano 3.0.1
- Phusion Passenger 4.0.26
- Ubuntu 12.04 LTS
I get the following err... | In Capistrano 3, you use `repo_url` instead of `repository`
So in your `deploy.rb`, try replacing
```
set :repository, "git@github.com:username/appname.git" # Your clone URL
```
with
```
set :repo_url, "https://github.com/username/appname.git" # Your clone URL
```
Hopefully this helps.
*Update*: The ssh URL nee... |
18469737 | git push heroku master error: Repository not found | 8 | 2013-08-27 15:29:18 | <p>I just tried pushing to heroku from github and this happened, anyone know how to fix this?</p>
<pre><code>$ git push heroku master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
</code></pre>
| 16,246 | 2,721,532 | 2022-05-11 06:12:18 | 18,469,958 | 26 | 2013-08-27 15:39:02 | 249,543 | 2013-08-27 15:39:02 | https://stackoverflow.com/q/18469737 | https://stackoverflow.com/a/18469958 | <p>Inside your project folder go into <code>.git/config</code> and look at what (if anything) is defined under the <code>heroku</code> remote.</p>
<p>For example, one of my apps has:</p>
<pre><code>[remote "origin"]
url = git@github.com:jefflunt/cortex.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "mast... | <p>Inside your project folder go into <code>.git/config</code> and look at what (if anything) is defined under the <code>heroku</code> remote.</p> <p>For example, one of my apps has:</p> <pre><code>[remote "origin"] url = git@github.com:jefflunt/cortex.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "mast... | 8279, 28898 | git-push, heroku | <h1>git push heroku master error: Repository not found</h1>
<p>I just tried pushing to heroku from github and this happened, anyone know how to fix this?</p>
<pre><code>$ git push heroku master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,583 | git | # git push heroku master error: Repository not found
I just tried pushing to heroku from github and this happened, anyone know how to fix this?
```
$ git push heroku master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
``` | Inside your project folder go into `.git/config` and look at what (if anything) is defined under the `heroku` remote.
For example, one of my apps has:
```
[remote "origin"]
url = git@github.com:jefflunt/cortex.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads... |
6081607 | What is the best git config set up when you are using Linux and Windows? | 8 | 2011-05-21 12:08:16 | <p>I am a bit confused with core.eol, core.autocrlf, core.safecrlf for git config.</p>
<p><a href="http://git-scm.com/docs/git-config" rel="noreferrer">http://git-scm.com/docs/git-config</a></p>
<p>I am using Ubuntu and Widows.</p>
<p>I had ^M, and other issues before.</p>
<p>Could anyone suggest the best git confi... | 33,172 | 119,198 | 2011-05-21 12:43:10 | 6,081,812 | 26 | 2011-05-21 12:43:10 | 6,309 | 2011-05-21 12:43:10 | https://stackoverflow.com/q/6081607 | https://stackoverflow.com/a/6081812 | <p>As detailled in <a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git on Windows (msysgit) - Unix or DOS line termination</a>, I would use:</p>
<pre><code>git config --system core.autocrlf false
</code></pre>
<p>That would avoid any... | <p>As detailled in <a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git on Windows (msysgit) - Unix or DOS line termination</a>, I would use:</p> <pre><code>git config --system core.autocrlf false </code></pre> <p>That would avoid any... | 58, 119, 34595 | git, linux, windows-7 | <h1>What is the best git config set up when you are using Linux and Windows?</h1>
<p>I am a bit confused with core.eol, core.autocrlf, core.safecrlf for git config.</p>
<p><a href="http://git-scm.com/docs/git-config" rel="noreferrer">http://git-scm.com/docs/git-config</a></p>
<p>I am using Ubuntu and Widows.</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,584 | git | # What is the best git config set up when you are using Linux and Windows?
I am a bit confused with core.eol, core.autocrlf, core.safecrlf for git config.
<http://git-scm.com/docs/git-config>
I am using Ubuntu and Widows.
I had ^M, and other issues before.
Could anyone suggest the best git config setups for this p... | As detailled in [Git on Windows (msysgit) - Unix or DOS line termination](https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133), I would use:
```
git config --system core.autocrlf false
```
That would avoid any automatic eol transformation (See "[G... |
62060941 | Broken git repo after git lfs migrate | 6 | 2020-05-28 09:06:19 | <p>Improper use of git lfs migrate --everything somehow generated a .gitattributes file with every known file type. This has basically nuked our project, as all files of every type now look something like this:</p>
<pre><code> version https://git-lfs.github.com/spec/v1
oid sha256:f6d1237f5b00a49b32cca659d9764f... | 3,584 | 832,560 | 2020-05-28 09:30:01 | 62,061,359 | 26 | 2020-05-28 09:30:01 | 832,560 | 2020-05-28 09:30:01 | https://stackoverflow.com/q/62060941 | https://stackoverflow.com/a/62061359 | <p>Still not entirely sure how this came to happen, but have fixed it simply by running
<code>git lfs checkout</code></p>
<p>Leaving this here as other people as googling around just came up with a load of unresolved threads</p>
| <p>Still not entirely sure how this came to happen, but have fixed it simply by running <code>git lfs checkout</code></p> <p>Leaving this here as other people as googling around just came up with a load of unresolved threads</p> | 119, 115244 | git, git-lfs | <h1>Broken git repo after git lfs migrate</h1>
<p>Improper use of git lfs migrate --everything somehow generated a .gitattributes file with every known file type. This has basically nuked our project, as all files of every type now look something like this:</p>
<pre><code> version https://git-lfs.github.com/spec/v... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,587 | git | # Broken git repo after git lfs migrate
Improper use of git lfs migrate --everything somehow generated a .gitattributes file with every known file type. This has basically nuked our project, as all files of every type now look something like this:
```
version https://git-lfs.github.com/spec/v1
oid sha256:f6d1... | Still not entirely sure how this came to happen, but have fixed it simply by running
`git lfs checkout`
Leaving this here as other people as googling around just came up with a load of unresolved threads |
22239508 | 'git pull' is setting 664 instead of 644 permissions | 6 | 2014-03-07 01:09:48 | <p>From the <a href="https://stackoverflow.com/a/11231682/1867641">threads</a> that I have read, git should set 644 <strong>by design</strong>, which is what I want. However, whenever I <code>git pull</code> my repository, it changes the permissions to 664.</p>
<p>My local disk has permissions set as 644 (what I want)... | 4,734 | 1,867,641 | 2014-03-07 01:46:22 | 22,239,884 | 26 | 2014-03-07 01:46:22 | null | 2014-03-07 01:46:22 | https://stackoverflow.com/q/22239508 | https://stackoverflow.com/a/22239884 | <p>You need to distinguish between the permissions that are stored in the git repository and the permissions on the files in your working copy. The whole point of that other question you linked to is that these 2 things are different because <em>git doesn't preserve permissions.</em></p>
<p>When you commit something, ... | <p>You need to distinguish between the permissions that are stored in the git repository and the permissions on the files in your working copy. The whole point of that other question you linked to is that these 2 things are different because <em>git doesn't preserve permissions.</em></p> <p>When you commit something, ... | 119, 2120 | file-permissions, git | <h1>'git pull' is setting 664 instead of 644 permissions</h1>
<p>From the <a href="https://stackoverflow.com/a/11231682/1867641">threads</a> that I have read, git should set 644 <strong>by design</strong>, which is what I want. However, whenever I <code>git pull</code> my repository, it changes the permissions to 664.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,588 | git | # 'git pull' is setting 664 instead of 644 permissions
From the [threads](https://stackoverflow.com/a/11231682/1867641) that I have read, git should set 644 **by design**, which is what I want. However, whenever I `git pull` my repository, it changes the permissions to 664.
My local disk has permissions set as 644 (w... | You need to distinguish between the permissions that are stored in the git repository and the permissions on the files in your working copy. The whole point of that other question you linked to is that these 2 things are different because *git doesn't preserve permissions.*
When you commit something, git remembers whe... |
65837109 | When should I use "git push --force-if-includes" | 94 | 2021-01-21 23:11:32 | <p>When I want to force push, I nearly always use <code>--force-with-lease</code>. Today I upgraded to Git 2.30 and discovered a new option: <code>--force-if-includes</code>.</p>
<p>After reading the <a href="https://git-scm.com/docs/git-push" rel="noreferrer">updated documentation</a>, it's still not entirely clear to... | 19,512 | 184,546 | 2025-11-09 14:57:14 | 78,298,145 | 25 | 2024-04-09 11:37:15 | 265,521 | 2024-04-09 14:18:31 | https://stackoverflow.com/q/65837109 | https://stackoverflow.com/a/78298145 | <p>The top answer is VERY long and didn't even explain it to me. Here's a quicker better explanation.</p>
<p>This is all to avoid races where multiple people are working on the same branch and are force pushing it (e.g. to rebase it).</p>
<ol>
<li>Person X fetches <code>branch</code>.</li>
<li>Person Y fetches <code>br... | <p>The top answer is VERY long and didn't even explain it to me. Here's a quicker better explanation.</p> <p>This is all to avoid races where multiple people are working on the same branch and are force pushing it (e.g. to rebase it).</p> <ol> <li>Person X fetches <code>branch</code>.</li> <li>Person Y fetches <code>br... | 119, 28898 | git, git-push | <h1>When should I use "git push --force-if-includes"</h1>
<p>When I want to force push, I nearly always use <code>--force-with-lease</code>. Today I upgraded to Git 2.30 and discovered a new option: <code>--force-if-includes</code>.</p>
<p>After reading the <a href="https://git-scm.com/docs/git-push" rel="noreferrer">u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,590 | git | # When should I use "git push --force-if-includes"
When I want to force push, I nearly always use `--force-with-lease`. Today I upgraded to Git 2.30 and discovered a new option: `--force-if-includes`.
After reading the [updated documentation](https://git-scm.com/docs/git-push), it's still not entirely clear to me und... | The top answer is VERY long and didn't even explain it to me. Here's a quicker better explanation.
This is all to avoid races where multiple people are working on the same branch and are force pushing it (e.g. to rebase it).
1. Person X fetches `branch`.
2. Person Y fetches `branch`.
3. Y adds a new commit and `git p... |
34837173 | Authentication failed for Azure Git | 78 | 2016-01-17 10:11:33 | <p>I'm trying to clone my webapp in Azure.</p>
<p>When I run <code>git clone https://username@appname.scm.azurewebsites.net:443/appname.git</code> the terminal asks me for my password. </p>
<p>But when I fill in my password, it keeps saying that the authentication has failed.</p>
<p>Even though I changed my password... | 217,606 | 2,502,843 | 2024-08-27 07:26:24 | 39,186,504 | 25 | 2016-08-27 22:52:06 | 389,557 | 2019-05-06 10:15:17 | https://stackoverflow.com/q/34837173 | https://stackoverflow.com/a/39186504 | <p>I had the same problem with my site and it turned out the issue is with the site url:
the automatically generated remote url was: <a href="https://user@site.scm.azurewebsites.net/site.git" rel="noreferrer">https://user@site.scm.azurewebsites.net/site.git</a></p>
<p>On the other hand the portal showed: <a href="http... | <p>I had the same problem with my site and it turned out the issue is with the site url: the automatically generated remote url was: <a href="https://user@site.scm.azurewebsites.net/site.git" rel="noreferrer">https://user@site.scm.azurewebsites.net/site.git</a></p> <p>On the other hand the portal showed: <a href="http... | 119, 14158, 116275 | azure, azure-web-app-service, git | <h1>Authentication failed for Azure Git</h1>
<p>I'm trying to clone my webapp in Azure.</p>
<p>When I run <code>git clone https://username@appname.scm.azurewebsites.net:443/appname.git</code> the terminal asks me for my password. </p>
<p>But when I fill in my password, it keeps saying that the authentication has fail... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,591 | git | # Authentication failed for Azure Git
I'm trying to clone my webapp in Azure.
When I run `git clone https://username@appname.scm.azurewebsites.net:443/appname.git` the terminal asks me for my password.
But when I fill in my password, it keeps saying that the authentication has failed.
Even though I changed my passw... | I had the same problem with my site and it turned out the issue is with the site url:
the automatically generated remote url was: <https://user@site.scm.azurewebsites.net/site.git>
On the other hand the portal showed: [https://user@site.scm.azurewebsites.net:443/site.git](https://user@site.scm.azurewebsites.net/site.g... |
32682293 | django migrations - workflow with multiple dev branches | 76 | 2015-09-20 17:32:41 | <p>I'm curious how other django developers manage multiple code branches (in git for instance) with migrations.</p>
<p>My problem is as follows:
- we have multiple feature branches in git, some of them with django migrations (some of them altering fields, or removing them altogether)
- when I switch branches (with <co... | 16,321 | 1,138,710 | 2022-11-16 12:45:46 | 32,683,732 | 25 | 2015-09-20 20:02:18 | null | 2022-01-31 12:32:56 | https://stackoverflow.com/q/32682293 | https://stackoverflow.com/a/32683732 | <p>Migrations rollback are possible and usually handled automatically by django.</p>
<p>Considering the following model:</p>
<pre><code>class MyModel(models.Model):
pass
</code></pre>
<p>If you run <code>python manage.py makemigrations myapp</code>, it will generate the initial migration script.
You can then r... | <p>Migrations rollback are possible and usually handled automatically by django.</p> <p>Considering the following model:</p> <pre><code>class MyModel(models.Model): pass </code></pre> <p>If you run <code>python manage.py makemigrations myapp</code>, it will generate the initial migration script. You can then r... | 16, 97, 119, 243 | django, git, migration, python | <h1>django migrations - workflow with multiple dev branches</h1>
<p>I'm curious how other django developers manage multiple code branches (in git for instance) with migrations.</p>
<p>My problem is as follows:
- we have multiple feature branches in git, some of them with django migrations (some of them altering fields... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,592 | git | # django migrations - workflow with multiple dev branches
I'm curious how other django developers manage multiple code branches (in git for instance) with migrations.
My problem is as follows:
- we have multiple feature branches in git, some of them with django migrations (some of them altering fields, or removing th... | Migrations rollback are possible and usually handled automatically by django.
Considering the following model:
```
class MyModel(models.Model):
pass
```
If you run `python manage.py makemigrations myapp`, it will generate the initial migration script.
You can then run `python manage.py migrate myapp 0001` to app... |
16595908 | Exit Vim without committing changes in Git | 67 | 2013-05-16 19:31:53 | <p>When I use <code>git commit --amend</code> or <code>git rebase -i</code>, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in <code>git reflog</code>.</p>
<p>How do I exit the editor without committing anything?</p>
| 27,811 | 1,570,307 | 2019-12-09 11:49:27 | 16,596,912 | 25 | 2013-05-16 20:30:40 | 1,890,567 | 2013-05-16 20:30:40 | https://stackoverflow.com/q/16595908 | https://stackoverflow.com/a/16596912 | <p>To get git to not make a change when you are executing <code>git commit --amend</code> or <code>git rebase -i</code>.</p>
<p>Just delete the message (and save). All git does is look for a non empty message to see if a valid commit happened. Since there is a commit message (because you commited something before) git... | <p>To get git to not make a change when you are executing <code>git commit --amend</code> or <code>git rebase -i</code>.</p> <p>Just delete the message (and save). All git does is look for a non empty message to see if a valid commit happened. Since there is a commit message (because you commited something before) git... | 119, 370, 53850 | git, git-commit, vim | <h1>Exit Vim without committing changes in Git</h1>
<p>When I use <code>git commit --amend</code> or <code>git rebase -i</code>, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in <code>git reflog</code>.</p>
<p>How do I exit ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,594 | git | # Exit Vim without committing changes in Git
When I use `git commit --amend` or `git rebase -i`, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in `git reflog`.
How do I exit the editor without committing anything? | To get git to not make a change when you are executing `git commit --amend` or `git rebase -i`.
Just delete the message (and save). All git does is look for a non empty message to see if a valid commit happened. Since there is a commit message (because you commited something before) git thinks that its a valid commit ... |
364925 | Is it possible to retroactively turn a set of commits into a branch? | 57 | 2008-12-13 06:31:03 | <p>Say I have a git repository and I've been working on master, can I retroactively create a branch. For example:</p>
<p>A - B - C - A1 - D - A2 - E</p>
<p>I want to make it look like this:</p>
<pre><code>A - A1 - A2
\ \
B - C - D - E
</code></pre>
<p>The specific use case is when I've cherry-picke... | 12,066 | 9,594 | 2022-02-23 20:16:28 | 365,179 | 25 | 2008-12-13 12:55:14 | 43,582 | 2008-12-13 12:55:14 | https://stackoverflow.com/q/364925 | https://stackoverflow.com/a/365179 | <p>Of course you can. (With Git there isn’t much than you can’t do anyway. :)</p>
<pre><code>git checkout -b new-branch hash-of-A
git cherry-pick hash-of-A1
git cherry-pick hash-of-A2
</code></pre>
<p>This will create a new branch, starting from the commit <code>A</code>. Afterwards you go back to the same commit aga... | <p>Of course you can. (With Git there isn’t much than you can’t do anyway. :)</p> <pre><code>git checkout -b new-branch hash-of-A git cherry-pick hash-of-A1 git cherry-pick hash-of-A2 </code></pre> <p>This will create a new branch, starting from the commit <code>A</code>. Afterwards you go back to the same commit aga... | 119, 1879 | branch, git | <h1>Is it possible to retroactively turn a set of commits into a branch?</h1>
<p>Say I have a git repository and I've been working on master, can I retroactively create a branch. For example:</p>
<p>A - B - C - A1 - D - A2 - E</p>
<p>I want to make it look like this:</p>
<pre><code>A - A1 - A2
\ \
B... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,595 | git | # Is it possible to retroactively turn a set of commits into a branch?
Say I have a git repository and I've been working on master, can I retroactively create a branch. For example:
A - B - C - A1 - D - A2 - E
I want to make it look like this:
```
A - A1 - A2
\ \
B - C - D - E
```
The specific use ... | Of course you can. (With Git there isn’t much than you can’t do anyway. :)
```
git checkout -b new-branch hash-of-A
git cherry-pick hash-of-A1
git cherry-pick hash-of-A2
```
This will create a new branch, starting from the commit `A`. Afterwards you go back to the same commit again, creating another branch:
```
git ... |
1435754 | How do I resolve a conflict after git pull? | 56 | 2009-09-16 22:05:39 | <p>I have to solve some conflict after a <code>git pull</code>.</p>
<pre><code>$ git pull
CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in 49423dd0d47abe6d839a783b5517bdfd200a202f. vision_problem_8.h added in HEAD
Added as vision_problem_8.h~HEAD_1 instead
Removed vignette_generator... | 107,257 | 156,458 | 2023-09-13 14:37:39 | 1,435,807 | 25 | 2009-09-16 22:18:55 | 90,002 | 2009-09-16 22:49:01 | https://stackoverflow.com/q/1435754 | https://stackoverflow.com/a/1435807 | <p>You don't need mergetool for this. It can be resolved pretty easily manually.</p>
<p>Your conflict is that your local commits added a file, <code>vision_problem_8.h</code>, that a remote commit also created, by a rename from <code>vignette_generator_mashed.h</code>. If you run <code>ls -l vision_problem_8.h*</code>... | <p>You don't need mergetool for this. It can be resolved pretty easily manually.</p> <p>Your conflict is that your local commits added a file, <code>vision_problem_8.h</code>, that a remote commit also created, by a rename from <code>vignette_generator_mashed.h</code>. If you run <code>ls -l vision_problem_8.h*</code>... | 119, 3146, 28896, 28897 | conflict, git, git-merge, git-pull | <h1>How do I resolve a conflict after git pull?</h1>
<p>I have to solve some conflict after a <code>git pull</code>.</p>
<pre><code>$ git pull
CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in 49423dd0d47abe6d839a783b5517bdfd200a202f. vision_problem_8.h added in HEAD
Added as vision_... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,596 | git | # How do I resolve a conflict after git pull?
I have to solve some conflict after a `git pull`.
```
$ git pull
CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in 49423dd0d47abe6d839a783b5517bdfd200a202f. vision_problem_8.h added in HEAD
Added as vision_problem_8.h~HEAD_1 instead
Removed... | You don't need mergetool for this. It can be resolved pretty easily manually.
Your conflict is that your local commits added a file, `vision_problem_8.h`, that a remote commit also created, by a rename from `vignette_generator_mashed.h`. If you run `ls -l vision_problem_8.h*` you will probably see multiple versions of... |
3212485 | How do I Re-root a git repo to a parent folder while preserving history? | 53 | 2010-07-09 12:20:31 | <p>I have a git repo in <code>/foo/bar/baz</code> with a large commit history and multiple branches.</p>
<p>I now want <code>/foo/qux</code> to be in the same repo as <code>/foo/bar/baz</code>, which means that I need them both to be in a repo rooted at <code>/foo</code>. However, I want to preserve history of change... | 13,901 | 86,432 | 2021-01-23 14:35:11 | 3,212,697 | 25 | 2010-07-09 12:50:22 | 197,325 | 2015-08-15 07:11:32 | https://stackoverflow.com/q/3212485 | https://stackoverflow.com/a/3212697 | <p>What you want is <code>git filter-branch</code>, which can move a whole repository into a subtree, preserving history by making it look as if it's always been that way. Back up your repository before using this!</p>
<p>Here's the magic. In <code>/foo/bar</code>, run:</p>
<pre><code>git filter-branch --commit-fil... | <p>What you want is <code>git filter-branch</code>, which can move a whole repository into a subtree, preserving history by making it look as if it's always been that way. Back up your repository before using this!</p> <p>Here's the magic. In <code>/foo/bar</code>, run:</p> <pre><code>git filter-branch --commit-fil... | 119 | git | <h1>How do I Re-root a git repo to a parent folder while preserving history?</h1>
<p>I have a git repo in <code>/foo/bar/baz</code> with a large commit history and multiple branches.</p>
<p>I now want <code>/foo/qux</code> to be in the same repo as <code>/foo/bar/baz</code>, which means that I need them both to be in ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,597 | git | # How do I Re-root a git repo to a parent folder while preserving history?
I have a git repo in `/foo/bar/baz` with a large commit history and multiple branches.
I now want `/foo/qux` to be in the same repo as `/foo/bar/baz`, which means that I need them both to be in a repo rooted at `/foo`. However, I want to prese... | What you want is `git filter-branch`, which can move a whole repository into a subtree, preserving history by making it look as if it's always been that way. Back up your repository before using this!
Here's the magic. In `/foo/bar`, run:
```
git filter-branch --commit-filter '
TREE="$1";
shift;
SUBTREE=`... |
4112410 | git: change styling (whitespace) without changing ownership/blame? | 52 | 2010-11-06 08:12:14 | <p>We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced so over time a lot of violations have creeped in. Many of them are just whitespace issues, like using tabs instead of spaces, or spaces where t... | 13,927 | 160,709 | 2022-08-29 15:01:07 | 4,112,426 | 25 | 2010-11-06 08:17:31 | 15,464 | 2010-11-06 08:17:31 | https://stackoverflow.com/q/4112410 | https://stackoverflow.com/a/4112426 | <blockquote>
<p>In an ideal world there would be some way to rewrite history to look like the violations were never introduced</p>
</blockquote>
<p><code>git filter-branch</code> does precisely that.</p>
<p><a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer">http://git-scm.com/docs/git-filter-branc... | <blockquote> <p>In an ideal world there would be some way to rewrite history to look like the violations were never introduced</p> </blockquote> <p><code>git filter-branch</code> does precisely that.</p> <p><a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer">http://git-scm.com/docs/git-filter-branc... | 119, 861, 57198 | git, removing-whitespace, standards | <h1>git: change styling (whitespace) without changing ownership/blame?</h1>
<p>We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced so over time a lot of violations have creeped in. Many of them are ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,598 | git | # git: change styling (whitespace) without changing ownership/blame?
We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced so over time a lot of violations have creeped in. Many of them are just whit... | > In an ideal world there would be some way to rewrite history to look like the violations were never introduced
`git filter-branch` does precisely that.
<http://git-scm.com/docs/git-filter-branch>
This has the same issues as all history rewriting commands do, as it essentially invalidates all cloned repositories. |
350651 | How do I keep an svn:external up to date using git-svn? | 52 | 2008-12-08 19:52:06 | <p>Treating my repository as a SVN repo, I get:</p>
<pre><code>svn co http://myrepo/foo/trunk foo
...
foo/
bar/
baz/ -> http://myrepo/baz/trunk
</code></pre>
<p>Treating it as a Git repo, I get:</p>
<pre><code>git svn clone http://myrepo/foo --trunk=trunk --branches=branches --tags=tags
...
foo/
bar/
</code... | 28,022 | 1,190 | 2015-11-13 13:08:30 | 474,013 | 25 | 2009-01-23 18:47:45 | 1,190 | 2009-01-23 18:47:45 | https://stackoverflow.com/q/350651 | https://stackoverflow.com/a/474013 | <p>The solution I ended up using was just to symlink to other <code>git-svn</code> clones on my local box. This worked pretty well: it allows me to commit changes back, and it allows me to make local changes on project A just to get them into project B.</p>
| <p>The solution I ended up using was just to symlink to other <code>git-svn</code> clones on my local box. This worked pretty well: it allows me to commit changes back, and it allows me to make local changes on project A just to get them into project B.</p> | 63, 119, 456, 3346 | dvcs, git, svn, version-control | <h1>How do I keep an svn:external up to date using git-svn?</h1>
<p>Treating my repository as a SVN repo, I get:</p>
<pre><code>svn co http://myrepo/foo/trunk foo
...
foo/
bar/
baz/ -> http://myrepo/baz/trunk
</code></pre>
<p>Treating it as a Git repo, I get:</p>
<pre><code>git svn clone http://myrepo/foo --t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,599 | git | # How do I keep an svn:external up to date using git-svn?
Treating my repository as a SVN repo, I get:
```
svn co http://myrepo/foo/trunk foo
...
foo/
bar/
baz/ -> http://myrepo/baz/trunk
```
Treating it as a Git repo, I get:
```
git svn clone http://myrepo/foo --trunk=trunk --branches=branches --tags=tags
...
... | The solution I ended up using was just to symlink to other `git-svn` clones on my local box. This worked pretty well: it allows me to commit changes back, and it allows me to make local changes on project A just to get them into project B. |
3472804 | Git Merge - Incomplete, Missing files and Folders | 50 | 2010-08-12 23:28:47 | <p>I was trying to merge a dev branch into master.</p>
<pre><code>git checkout master
git pull . dev
</code></pre>
<p>Everything seemed to go well, although there were conflicts I fixed these and commited. But when I checked this newly merged working tree is missing a lot of folders and files from dev.</p>
<pre>... | 49,095 | 400,836 | 2023-12-08 14:50:07 | 3,472,930 | 25 | 2010-08-12 23:54:23 | 197,325 | 2010-08-12 23:54:23 | https://stackoverflow.com/q/3472804 | https://stackoverflow.com/a/3472930 | <p>It sounds like git thinks that the missing files were deleted on the master at some point between where it branches from dev and the pre-merge head. That's the only reason I can think of for why git would silently drop tracked files during a merge.</p>
<p>Unfortunately, I don't know a good way to fix that. I'd pr... | <p>It sounds like git thinks that the missing files were deleted on the master at some point between where it branches from dev and the pre-merge head. That's the only reason I can think of for why git would silently drop tracked files during a merge.</p> <p>Unfortunately, I don't know a good way to fix that. I'd pr... | 119, 717, 4860, 5310 | file, git, merge, pull | <h1>Git Merge - Incomplete, Missing files and Folders</h1>
<p>I was trying to merge a dev branch into master.</p>
<pre><code>git checkout master
git pull . dev
</code></pre>
<p>Everything seemed to go well, although there were conflicts I fixed these and commited. But when I checked this newly merged working tree... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,600 | git | # Git Merge - Incomplete, Missing files and Folders
I was trying to merge a dev branch into master.
```
git checkout master
git pull . dev
```
Everything seemed to go well, although there were conflicts I fixed these and commited. But when I checked this newly merged working tree is missing a lot of folders and ... | It sounds like git thinks that the missing files were deleted on the master at some point between where it branches from dev and the pre-merge head. That's the only reason I can think of for why git would silently drop tracked files during a merge.
Unfortunately, I don't know a good way to fix that. I'd probably just ... |
14583282 | Heroku - Display hash of current commit in browser | 47 | 2013-01-29 12:47:49 | <p>I want to display the hash of the current git commit in the browser so that testing team (which does not have an access to run heruko commands) will be able to include the corresponding commit hash in bug reports.</p>
<p>First I tried grit, but something is broken and it doesn't work on Heroku (on local it works gr... | 16,755 | 1,039,488 | 2020-04-28 13:08:07 | 14,924,922 | 25 | 2013-02-17 19:09:31 | 28,037 | 2013-02-19 07:25:10 | https://stackoverflow.com/q/14583282 | https://stackoverflow.com/a/14924922 | <p>Firstly, since heroku <a href="https://devcenter.heroku.com/articles/slug-compiler#compilation">"remove[s] unused files, including the .git directory"</a> during slug compilation, you won't be able to execute some git commands from inside your app's directory (on the heroku dyno). This includes things like <code>git... | <p>Firstly, since heroku <a href="https://devcenter.heroku.com/articles/slug-compiler#compilation">"remove[s] unused files, including the .git directory"</a> during slug compilation, you won't be able to execute some git commands from inside your app's directory (on the heroku dyno). This includes things like <code>git... | 119, 4984, 8279 | git, heroku, ruby-on-rails | <h1>Heroku - Display hash of current commit in browser</h1>
<p>I want to display the hash of the current git commit in the browser so that testing team (which does not have an access to run heruko commands) will be able to include the corresponding commit hash in bug reports.</p>
<p>First I tried grit, but something i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,601 | git | # Heroku - Display hash of current commit in browser
I want to display the hash of the current git commit in the browser so that testing team (which does not have an access to run heruko commands) will be able to include the corresponding commit hash in bug reports.
First I tried grit, but something is broken and it ... | Firstly, since heroku ["remove[s] unused files, including the .git directory"](https://devcenter.heroku.com/articles/slug-compiler#compilation) during slug compilation, you won't be able to execute some git commands from inside your app's directory (on the heroku dyno). This includes things like `git rev-parse HEAD`, w... |
9268378 | How do I clone a large Git repository on an unreliable connection? | 44 | 2012-02-13 21:33:27 | <p>I want to clone LibreOffice. From the official website, this is what's written:</p>
<blockquote>
<p>All our source code is hosted in git:</p>
<p>Clone: <code>$ git clone git://anongit.freedesktop.org/libreoffice/core</code> # (browse)</p>
<p>Clone (http): <code>$ git clone http://anongit.freedesktop.org/git/libreoff... | 19,507 | 1,207,785 | 2024-08-11 00:33:15 | 9,268,487 | 25 | 2012-02-13 21:43:07 | 5,353 | 2012-02-13 21:43:07 | https://stackoverflow.com/q/9268378 | https://stackoverflow.com/a/9268487 | <p>The repository is accessible via the <code>http</code> protocol (aka dumb protocol) here: <a href="http://anongit.freedesktop.org/git/libreoffice/core.git" rel="noreferrer">http://anongit.freedesktop.org/git/libreoffice/core.git</a>.</p>
<p>You can download everything here with <code>wget</code> or another download... | <p>The repository is accessible via the <code>http</code> protocol (aka dumb protocol) here: <a href="http://anongit.freedesktop.org/git/libreoffice/core.git" rel="noreferrer">http://anongit.freedesktop.org/git/libreoffice/core.git</a>.</p> <p>You can download everything here with <code>wget</code> or another download... | 119, 34099 | git, git-clone | <h1>How do I clone a large Git repository on an unreliable connection?</h1>
<p>I want to clone LibreOffice. From the official website, this is what's written:</p>
<blockquote>
<p>All our source code is hosted in git:</p>
<p>Clone: <code>$ git clone git://anongit.freedesktop.org/libreoffice/core</code> # (browse)</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,603 | git | # How do I clone a large Git repository on an unreliable connection?
I want to clone LibreOffice. From the official website, this is what's written:
> All our source code is hosted in git:
>
> Clone: `$ git clone git://anongit.freedesktop.org/libreoffice/core` # (browse)
>
> Clone (http): `$ git clone http://anongit.... | The repository is accessible via the `http` protocol (aka dumb protocol) here: <http://anongit.freedesktop.org/git/libreoffice/core.git>.
You can download everything here with `wget` or another download manager, and you'll have a clone of the repository. After that, you rename the directory from `core.git` to `.git`, ... |
12590947 | Using Git diff to detect code movement + How to use diff options | 42 | 2012-09-25 20:58:24 | <p>Consider that a file (1.c) contains three functions and changes made by authors M and J. If someone runs <code>git blame 1.c</code>, he will get the following output:</p>
<pre><code>^869c699 (M 2012-09-25 14:05:31 -0600 1)
de24af82 (J 2012-09-25 14:23:52 -0600 2)
de24af82 (J 2012-09-25 14:23:52 -0600 3)
de24a... | 15,768 | 298,160 | 2025-10-29 08:19:34 | 12,805,390 | 25 | 2012-10-09 17:38:02 | 709,943 | 2020-06-01 20:53:28 | https://stackoverflow.com/q/12590947 | https://stackoverflow.com/a/12805390 | <blockquote>
<p>This was the best answer at the time it was written, but it is <strong>no longer accurate</strong>. In 2017, Git 2.15 upgraded its <code>diff</code> to do move detection. <a href="https://stackoverflow.com/a/47192896/8910547">As explained in the now top voted answer</a>, use <code>git diff --color-mov... | <blockquote> <p>This was the best answer at the time it was written, but it is <strong>no longer accurate</strong>. In 2017, Git 2.15 upgraded its <code>diff</code> to do move detection. <a href="https://stackoverflow.com/a/47192896/8910547">As explained in the now top voted answer</a>, use <code>git diff --color-mov... | 119, 9033 | git, git-diff | <h1>Using Git diff to detect code movement + How to use diff options</h1>
<p>Consider that a file (1.c) contains three functions and changes made by authors M and J. If someone runs <code>git blame 1.c</code>, he will get the following output:</p>
<pre><code>^869c699 (M 2012-09-25 14:05:31 -0600 1)
de24af82 (J 2012-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,604 | git | # Using Git diff to detect code movement + How to use diff options
Consider that a file (1.c) contains three functions and changes made by authors M and J. If someone runs `git blame 1.c`, he will get the following output:
```
^869c699 (M 2012-09-25 14:05:31 -0600 1)
de24af82 (J 2012-09-25 14:23:52 -0600 2)
de24a... | > This was the best answer at the time it was written, but it is **no longer accurate**. In 2017, Git 2.15 upgraded its `diff` to do move detection. [As explained in the now top voted answer](https://stackoverflow.com/a/47192896/8910547), use `git diff --color-moved`
**Original answer:**
What you're running up agains... |
9663507 | What are tracked files and untracked files in the context of Git? | 41 | 2012-03-12 08:04:33 | <p>I'm new to Git. I wish to know what are <em>tracked</em> and <em>untracked</em> files?
I read "Pro Git", but still couldn't quite understand. </p>
<p>Can someone explain to me the difference between the two by providing an example?</p>
| 47,251 | 1,053,113 | 2024-06-20 17:56:43 | 9,663,622 | 25 | 2012-03-12 08:15:34 | 613,064 | 2012-03-12 08:15:34 | https://stackoverflow.com/q/9663507 | https://stackoverflow.com/a/9663622 | <p>A file is tracked if it is under version control.</p>
<p>As a small example, a C++ project would have</p>
<pre><code>Makefile
main.cpp
interface.hpp
worker.cpp
</code></pre>
<p>as source files; you'd put these under version control. During build,</p>
<pre><code>main.o
worker.o
myapp
</code></pre>
<p>are generat... | <p>A file is tracked if it is under version control.</p> <p>As a small example, a C++ project would have</p> <pre><code>Makefile main.cpp interface.hpp worker.cpp </code></pre> <p>as source files; you'd put these under version control. During build,</p> <pre><code>main.o worker.o myapp </code></pre> <p>are generat... | 119, 96541, 116991 | git, git-track, git-untracked | <h1>What are tracked files and untracked files in the context of Git?</h1>
<p>I'm new to Git. I wish to know what are <em>tracked</em> and <em>untracked</em> files?
I read "Pro Git", but still couldn't quite understand. </p>
<p>Can someone explain to me the difference between the two by providing an example?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,605 | git | # What are tracked files and untracked files in the context of Git?
I'm new to Git. I wish to know what are *tracked* and *untracked* files?
I read "Pro Git", but still couldn't quite understand.
Can someone explain to me the difference between the two by providing an example? | A file is tracked if it is under version control.
As a small example, a C++ project would have
```
Makefile
main.cpp
interface.hpp
worker.cpp
```
as source files; you'd put these under version control. During build,
```
main.o
worker.o
myapp
```
are generated; these do not belong under version control, so you do n... |
1961274 | git Warning: remote HEAD refers to nonexistent ref, unable to checkout | 41 | 2009-12-25 14:51:10 | <p>I'm trying to setup gitosis according to the instructions <a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way" rel="noreferrer">here</a>.</p>
<p>It works fine from my remote machine so the server seems to be setup fine but I'd also like to be able to do development on my gitosis ... | 53,354 | 6,805 | 2013-09-18 19:44:35 | 1,962,225 | 25 | 2009-12-25 23:29:03 | 6,805 | 2009-12-25 23:29:03 | https://stackoverflow.com/q/1961274 | https://stackoverflow.com/a/1962225 | <p>I found out what was going wrong. The problem was that I wasn't paying attention to the warnings when I was pushing to my gitosis server so I didn't realize that I wasn't pushing a particular branch. I had assumed it would just push the current but that isn't the case until you set:</p>
<pre><code>git config push... | <p>I found out what was going wrong. The problem was that I wasn't paying attention to the warnings when I was pushing to my gitosis server so I didn't realize that I wasn't pushing a particular branch. I had assumed it would just push the current but that isn't the case until you set:</p> <pre><code>git config push... | 119, 24526 | git, gitosis | <h1>git Warning: remote HEAD refers to nonexistent ref, unable to checkout</h1>
<p>I'm trying to setup gitosis according to the instructions <a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way" rel="noreferrer">here</a>.</p>
<p>It works fine from my remote machine so the server seem... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,606 | git | # git Warning: remote HEAD refers to nonexistent ref, unable to checkout
I'm trying to setup gitosis according to the instructions [here](http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way).
It works fine from my remote machine so the server seems to be setup fine but I'd also like to be a... | I found out what was going wrong. The problem was that I wasn't paying attention to the warnings when I was pushing to my gitosis server so I didn't realize that I wasn't pushing a particular branch. I had assumed it would just push the current but that isn't the case until you set:
```
git config push.default current... |
44882464 | Git conflict "both deleted" | 36 | 2017-07-03 09:47:49 | <p>I don't understand why "both deleted" is a status for unmerged paths.</p>
<p>If:</p>
<ul>
<li>OldStandard is the base</li>
<li>NewStandard is the last commit on the trunk</li>
<li>OldCustom is the branch (fork from OldStandard) we try to merge back in master</li>
</ul>
<p>Why is there a conflict with some files m... | 17,945 | 3,341,592 | 2020-09-03 07:54:55 | 44,885,129 | 25 | 2017-07-03 12:04:00 | 86,072 | 2020-09-03 07:54:55 | https://stackoverflow.com/q/44882464 | https://stackoverflow.com/a/44885129 | <p>As stated in <a href="https://stackoverflow.com/questions/43702944/reproducing-git-merge-conflict-dd">this answer</a> (suggested as a duplicate) :</p>
<p>you can see a "both deleted" when <code>branchA</code> has a <code>git mv oldfile newstandard</code> commit, and <code>branchB</code> has a <code>git mv ... | <p>As stated in <a href="https://stackoverflow.com/questions/43702944/reproducing-git-merge-conflict-dd">this answer</a> (suggested as a duplicate) :</p> <p>you can see a "both deleted" when <code>branchA</code> has a <code>git mv oldfile newstandard</code> commit, and <code>branchB</code> has a <code>git mv ... | 119, 717, 3146, 37510 | conflict, delete-file, git, merge | <h1>Git conflict "both deleted"</h1>
<p>I don't understand why "both deleted" is a status for unmerged paths.</p>
<p>If:</p>
<ul>
<li>OldStandard is the base</li>
<li>NewStandard is the last commit on the trunk</li>
<li>OldCustom is the branch (fork from OldStandard) we try to merge back in master</li>
</ul>
<p>Why ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,608 | git | # Git conflict "both deleted"
I don't understand why "both deleted" is a status for unmerged paths.
If:
- OldStandard is the base
- NewStandard is the last commit on the trunk
- OldCustom is the branch (fork from OldStandard) we try to merge back in master
Why is there a conflict with some files marked as "both del... | As stated in [this answer](https://stackoverflow.com/questions/43702944/reproducing-git-merge-conflict-dd) (suggested as a duplicate) :
you can see a "both deleted" when `branchA` has a `git mv oldfile newstandard` commit, and `branchB` has a `git mv oldfile newcustom` commit.
In that case, when trying to merge `cust... |
7572647 | How to do a "git checkout -b <branchname>" from a remote tag | 35 | 2011-09-27 16:39:26 | <p>I'm trying to create a branch from a remote tag, but it seems there's no way to do it. When I try</p>
<pre><code>git checkout -b test origin/deploy
</code></pre>
<p>where origin is the remote and deploy is the tag I want to check out, but I get</p>
<pre><code>fatal: git checkout: updating paths is incompatible wi... | 65,513 | 210,404 | 2018-11-15 20:54:42 | 11,210,224 | 25 | 2012-06-26 15:00:56 | 1,483,139 | 2016-07-11 12:28:36 | https://stackoverflow.com/q/7572647 | https://stackoverflow.com/a/11210224 | <p>I'm not a git guru, but I had used something like this before and it seemed to have worked fine:</p>
<pre><code>git pull (or fetch, just need to make sure you are updated)
git checkout -b test remotes/origin/deploy
</code></pre>
| <p>I'm not a git guru, but I had used something like this before and it seemed to have worked fine:</p> <pre><code>git pull (or fetch, just need to make sure you are updated) git checkout -b test remotes/origin/deploy </code></pre> | 119, 76220 | git, git-branch | <h1>How to do a "git checkout -b <branchname>" from a remote tag</h1>
<p>I'm trying to create a branch from a remote tag, but it seems there's no way to do it. When I try</p>
<pre><code>git checkout -b test origin/deploy
</code></pre>
<p>where origin is the remote and deploy is the tag I want to check out, but I get<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,610 | git | # How to do a "git checkout -b " from a remote tag
I'm trying to create a branch from a remote tag, but it seems there's no way to do it. When I try
```
git checkout -b test origin/deploy
```
where origin is the remote and deploy is the tag I want to check out, but I get
```
fatal: git checkout: updating paths is i... | I'm not a git guru, but I had used something like this before and it seemed to have worked fine:
```
git pull (or fetch, just need to make sure you are updated)
git checkout -b test remotes/origin/deploy
``` |
158172 | Formatting numbers with significant figures in C# | 32 | 2008-10-01 15:21:32 | <p>I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occas... | 44,096 | 404 | 2022-06-30 21:04:53 | 1,987,721 | 25 | 2010-01-01 02:18:04 | 128,506 | 2013-01-23 20:14:57 | https://stackoverflow.com/q/158172 | https://stackoverflow.com/a/1987721 | <p>See: <a href="https://stackoverflow.com/questions/374316/round-a-double-to-x-significant-figures-after-decimal-point/374470#374470">RoundToSignificantFigures</a> by "P Daddy".<br>
I've combined his method with another one I liked. </p>
<p>Rounding to significant figures is a lot easier in TSQL where the rounding ... | <p>See: <a href="https://stackoverflow.com/questions/374316/round-a-double-to-x-significant-figures-after-decimal-point/374470#374470">RoundToSignificantFigures</a> by "P Daddy".<br> I've combined his method with another one I liked. </p> <p>Rounding to significant figures is a lot easier in TSQL where the rounding ... | 9, 12414 | c#, significant-digits | <h1>Formatting numbers with significant figures in C#</h1>
<p>I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 1234... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,613 | git | # Formatting numbers with significant figures in C#
I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will beco... | See: [RoundToSignificantFigures](https://stackoverflow.com/questions/374316/round-a-double-to-x-significant-figures-after-decimal-point/374470#374470) by "P Daddy".
I've combined his method with another one I liked.
Rounding to significant figures is a lot easier in TSQL where the rounding method is based on roundin... |
40383230 | git clone: warning: --depth is ignored in local clones; use file:// instead | 31 | 2016-11-02 15:02:45 | <p>We have a remote repository on a shared folder in our local network. I attempted to make a shallow clone:</p>
<pre><code>git clone --depth 1 //gitrepos-pc/git/foo/
</code></pre>
<p>It gave me this warning, and made a full clone:</p>
<pre><code>warning: --depth is ignored in local clones; use file:// instead.
</co... | 8,565 | 492,336 | 2024-01-07 10:35:16 | 40,383,231 | 25 | 2016-11-02 15:02:45 | 492,336 | 2024-01-07 10:35:16 | https://stackoverflow.com/q/40383230 | https://stackoverflow.com/a/40383231 | <p>Ok, after some experimenting I got it, I had to use</p>
<pre><code>git clone --depth 1 file:////gitrepos-pc/git/foo/
</code></pre>
<p>It had to be 4 slashes, not 3.</p>
<p>Edit:</p>
<p>Adding
@Dale's comment about relative paths:</p>
<blockquote>
<p>I found I couldn't use relative paths with file://, so I used $(pwd... | <p>Ok, after some experimenting I got it, I had to use</p> <pre><code>git clone --depth 1 file:////gitrepos-pc/git/foo/ </code></pre> <p>It had to be 4 slashes, not 3.</p> <p>Edit:</p> <p>Adding @Dale's comment about relative paths:</p> <blockquote> <p>I found I couldn't use relative paths with file://, so I used $(pwd... | 119, 34099, 74346 | git, git-clone, shallow-clone | <h1>git clone: warning: --depth is ignored in local clones; use file:// instead</h1>
<p>We have a remote repository on a shared folder in our local network. I attempted to make a shallow clone:</p>
<pre><code>git clone --depth 1 //gitrepos-pc/git/foo/
</code></pre>
<p>It gave me this warning, and made a full clone:</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,614 | git | # git clone: warning: --depth is ignored in local clones; use file:// instead
We have a remote repository on a shared folder in our local network. I attempted to make a shallow clone:
```
git clone --depth 1 //gitrepos-pc/git/foo/
```
It gave me this warning, and made a full clone:
```
warning: --depth is ignored i... | Ok, after some experimenting I got it, I had to use
```
git clone --depth 1 file:////gitrepos-pc/git/foo/
```
It had to be 4 slashes, not 3.
Edit:
Adding
@Dale's comment about relative paths:
> I found I couldn't use relative paths with file://, so I used $(pwd) to save myself a lot of typing: `git clone --depth 1... |
10996248 | Freezing a Git branch | 31 | 2012-06-12 12:01:21 | <p>Let's say I have a develop branch. I create a feature branch from this to develop a feature. Once the feature is developed, it is merged back into develop. Pretty much like shown here:</p>
<p><img src="https://i.sstatic.net/7qIxL.png" alt="enter image description here"></p>
<p><strong>Is there a way I can freeze t... | 46,997 | 691,226 | 2019-06-11 13:13:27 | 10,998,419 | 25 | 2012-06-12 14:09:26 | 538,359 | 2015-09-23 23:56:37 | https://stackoverflow.com/q/10996248 | https://stackoverflow.com/a/10998419 | <p>Christopher is right, tagging will help you do this. I recommend deleting the branch name too to make it a little harder for someone to checkout the branch and make edits. </p>
<p>First, merge the branch into develop </p>
<pre><code>git checkout develop
git merge --no-ff feature_1
</code></pre>
<p>Then checkout ... | <p>Christopher is right, tagging will help you do this. I recommend deleting the branch name too to make it a little harder for someone to checkout the branch and make edits. </p> <p>First, merge the branch into develop </p> <pre><code>git checkout develop git merge --no-ff feature_1 </code></pre> <p>Then checkout ... | 119, 1879, 76220 | branch, git, git-branch | <h1>Freezing a Git branch</h1>
<p>Let's say I have a develop branch. I create a feature branch from this to develop a feature. Once the feature is developed, it is merged back into develop. Pretty much like shown here:</p>
<p><img src="https://i.sstatic.net/7qIxL.png" alt="enter image description here"></p>
<p><stron... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,615 | git | # Freezing a Git branch
Let's say I have a develop branch. I create a feature branch from this to develop a feature. Once the feature is developed, it is merged back into develop. Pretty much like shown here:

**Is there a way I can freeze the feature b... | Christopher is right, tagging will help you do this. I recommend deleting the branch name too to make it a little harder for someone to checkout the branch and make edits.
First, merge the branch into develop
```
git checkout develop
git merge --no-ff feature_1
```
Then checkout the branch
```
git checkout feature_... |
16725107 | How to add already cloned projects as submodules? | 30 | 2013-05-23 22:44:09 | <p>I have in a folder a large number of projects that I cloned for quite some time; recently I moved this whole folder into one of my repos and would like to convert these cloned projects into submodules so that I can better update and control in the future. I've googled a lot on how to do this, but all the tutorials o... | 12,235 | 1,265,364 | 2023-11-11 17:19:12 | 16,727,261 | 25 | 2013-05-24 03:30:47 | 668,963 | 2023-11-11 17:19:12 | https://stackoverflow.com/q/16725107 | https://stackoverflow.com/a/16727261 | <p>Adding existing git repository as a submodule is the same as adding a new one.</p>
<ol>
<li>First make the folder that contains all your git repositories as itself a git repository with <code>git init</code>.</li>
<li>Use <code>git submodule add https//example.com/remoterepo ./localrepo</code>, where <code>./localre... | <p>Adding existing git repository as a submodule is the same as adding a new one.</p> <ol> <li>First make the folder that contains all your git repositories as itself a git repository with <code>git init</code>.</li> <li>Use <code>git submodule add https//example.com/remoterepo ./localrepo</code>, where <code>./localre... | 119, 41612 | git, git-submodules | <h1>How to add already cloned projects as submodules?</h1>
<p>I have in a folder a large number of projects that I cloned for quite some time; recently I moved this whole folder into one of my repos and would like to convert these cloned projects into submodules so that I can better update and control in the future. I'... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,616 | git | # How to add already cloned projects as submodules?
I have in a folder a large number of projects that I cloned for quite some time; recently I moved this whole folder into one of my repos and would like to convert these cloned projects into submodules so that I can better update and control in the future. I've google... | Adding existing git repository as a submodule is the same as adding a new one.
1. First make the folder that contains all your git repositories as itself a git repository with `git init`.
2. Use `git submodule add https//example.com/remoterepo ./localrepo`, where `./localrepo` is your existing git repository.
- Note:... |
60725232 | What files/directories should I add to .gitignore when using Poetry, the Python package manager? | 29 | 2020-03-17 15:17:18 | <p>I'm using a very new Python package manager called <a href="https://python-poetry.org/" rel="noreferrer">Poetry</a>. </p>
<p>It creates several files/directories upon creating a new project (environment), but I'm not sure which one I should add to <code>.gitignore</code> for the best practice. </p>
<p>Say I creat... | 19,540 | 8,491,363 | 2021-10-20 12:32:30 | 60,833,514 | 25 | 2020-03-24 14:54:04 | 6,002,763 | 2021-10-20 12:32:30 | https://stackoverflow.com/q/60725232 | https://stackoverflow.com/a/60833514 | <p>Also moved to poetry quite recently.</p>
<p>I would say you should not add any of: <code>tests/</code>, <code>foo_project/</code>, <code>poetry.lock</code> or <code>README.rst</code> to your <code>.gitignore</code>. In other words, those files and folders <em>should</em> be in version control. My reasons are as foll... | <p>Also moved to poetry quite recently.</p> <p>I would say you should not add any of: <code>tests/</code>, <code>foo_project/</code>, <code>poetry.lock</code> or <code>README.rst</code> to your <code>.gitignore</code>. In other words, those files and folders <em>should</em> be in version control. My reasons are as foll... | 16, 25056, 136975 | gitignore, python, python-poetry | <h1>What files/directories should I add to .gitignore when using Poetry, the Python package manager?</h1>
<p>I'm using a very new Python package manager called <a href="https://python-poetry.org/" rel="noreferrer">Poetry</a>. </p>
<p>It creates several files/directories upon creating a new project (environment), but I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,617 | git | # What files/directories should I add to .gitignore when using Poetry, the Python package manager?
I'm using a very new Python package manager called [Poetry](https://python-poetry.org/).
It creates several files/directories upon creating a new project (environment), but I'm not sure which one I should add to `.gitig... | Also moved to poetry quite recently.
I would say you should not add any of: `tests/`, `foo_project/`, `poetry.lock` or `README.rst` to your `.gitignore`. In other words, those files and folders *should* be in version control. My reasons are as follows:
`tests/` - your tests should not be machine dependent (unless thi... |
31956506 | get short sha of commit with gitpython | 29 | 2015-08-12 05:11:28 | <p>The long SHA can be gotten like below:</p>
<pre><code>repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
</code></pre>
<p>Or, in git 3.1.7:</p>
<pre><code>sha = repo.head.commit.hexsha
</code></pre>
<p>How about short one?
(short <code>SHA</code> is decided by the scale of the repo, so it ... | 23,471 | 4,158,863 | 2023-01-05 06:00:02 | 31,957,429 | 25 | 2015-08-12 06:21:40 | 4,582,273 | 2020-08-19 08:29:51 | https://stackoverflow.com/q/31956506 | https://stackoverflow.com/a/31957429 | <p>As far as I can tell, the gitpython <code>Commit</code> object does not support the short sha directly. However, you can use still gitpython's <a href="http://gitpython.readthedocs.org/en/stable/tutorial.html#using-git-directly" rel="noreferrer">support for calling git directly</a> to retrieve it (as of git 3.1.7):... | <p>As far as I can tell, the gitpython <code>Commit</code> object does not support the short sha directly. However, you can use still gitpython's <a href="http://gitpython.readthedocs.org/en/stable/tutorial.html#using-git-directly" rel="noreferrer">support for calling git directly</a> to retrieve it (as of git 3.1.7):... | 16, 119, 61013 | git, gitpython, python | <h1>get short sha of commit with gitpython</h1>
<p>The long SHA can be gotten like below:</p>
<pre><code>repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
</code></pre>
<p>Or, in git 3.1.7:</p>
<pre><code>sha = repo.head.commit.hexsha
</code></pre>
<p>How about short one?
(short <code>SHA</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,618 | git | # get short sha of commit with gitpython
The long SHA can be gotten like below:
```
repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
```
Or, in git 3.1.7:
```
sha = repo.head.commit.hexsha
```
How about short one?
(short `SHA` is decided by the scale of the repo, so it should not be li... | As far as I can tell, the gitpython `Commit` object does not support the short sha directly. However, you can use still gitpython's [support for calling git directly](http://gitpython.readthedocs.org/en/stable/tutorial.html#using-git-directly) to retrieve it (as of git 3.1.7):
```
repo = git.Repo(search_parent_directo... |
22076944 | git stash reporting: '' is not a stash reference | 29 | 2014-02-27 18:15:54 | <p>Not quite sure what's happened, but git stash seems to be in a bad place.</p>
<pre><code>% git stash list
stash@{0}: filter-branch: rewrite
stash@{1}: filter-branch: rewrite
stash@{2}: On mysolr: start mysolr stuff
</code></pre>
<p>Is OK, and <code>git show stash@{0}</code> works fine. But:</p>
<pre><code>% git ... | 17,009 | 3,189 | 2023-04-08 04:51:26 | 22,079,133 | 25 | 2014-02-27 20:02:38 | 1,256,452 | 2014-02-27 20:02:38 | https://stackoverflow.com/q/22076944 | https://stackoverflow.com/a/22079133 | <p>I think <code>filter-branch</code> has broken your stashes. If the argument to <code>git stash</code> does not sufficiently resemble a <a href="https://stackoverflow.com/a/20412685/1256452">stash bag</a>, you get that <code>not a stash reference</code> complaint.</p>
<p>Note that <code>git show <em>stashref</em></... | <p>I think <code>filter-branch</code> has broken your stashes. If the argument to <code>git stash</code> does not sufficiently resemble a <a href="https://stackoverflow.com/a/20412685/1256452">stash bag</a>, you get that <code>not a stash reference</code> complaint.</p> <p>Note that <code>git show <em>stashref</em></... | 119, 13091 | git, git-stash | <h1>git stash reporting: '' is not a stash reference</h1>
<p>Not quite sure what's happened, but git stash seems to be in a bad place.</p>
<pre><code>% git stash list
stash@{0}: filter-branch: rewrite
stash@{1}: filter-branch: rewrite
stash@{2}: On mysolr: start mysolr stuff
</code></pre>
<p>Is OK, and <code>git show... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,619 | git | # git stash reporting: '' is not a stash reference
Not quite sure what's happened, but git stash seems to be in a bad place.
```
% git stash list
stash@{0}: filter-branch: rewrite
stash@{1}: filter-branch: rewrite
stash@{2}: On mysolr: start mysolr stuff
```
Is OK, and `git show stash@{0}` works fine. But:
```
% gi... | I think `filter-branch` has broken your stashes. If the argument to `git stash` does not sufficiently resemble a [stash bag](https://stackoverflow.com/a/20412685/1256452), you get that `not a stash reference` complaint.
Note that `git show stashref` uses plain old `git show`, which does not require that a commit given... |
16792737 | Git change working directory | 29 | 2013-05-28 12:58:22 | <p>I want to work with Git repository, but working tree should be remote. For example: if I have my project stored inside of <code>~/project</code> and <code>project.git</code> stored inside of <code>~/git/project.git</code>.</p>
<p>What I've changed working tree via config:</p>
<p><code>
worktree=/Users/myuser/proje... | 81,897 | 714,495 | 2025-02-24 02:52:41 | 16,793,529 | 25 | 2013-05-28 13:36:57 | 773,189 | 2013-05-28 13:53:02 | https://stackoverflow.com/q/16792737 | https://stackoverflow.com/a/16793529 | <p>The following seems to work, adjust to your needs:</p>
<pre><code>mkdir git
mkdir work
git --git-dir git/test --work-tree work/test init
mkdir work/test
echo -n foo > work/test/foo.txt
git --git-dir git/test status
git --git-dir git/test add foo.txt
git --git-dir git/test commit -m 'commit 1'
</code></pre>
<p>E... | <p>The following seems to work, adjust to your needs:</p> <pre><code>mkdir git mkdir work git --git-dir git/test --work-tree work/test init mkdir work/test echo -n foo > work/test/foo.txt git --git-dir git/test status git --git-dir git/test add foo.txt git --git-dir git/test commit -m 'commit 1' </code></pre> <p>E... | 119 | git | <h1>Git change working directory</h1>
<p>I want to work with Git repository, but working tree should be remote. For example: if I have my project stored inside of <code>~/project</code> and <code>project.git</code> stored inside of <code>~/git/project.git</code>.</p>
<p>What I've changed working tree via config:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,620 | git | # Git change working directory
I want to work with Git repository, but working tree should be remote. For example: if I have my project stored inside of `~/project` and `project.git` stored inside of `~/git/project.git`.
What I've changed working tree via config:
`worktree=/Users/myuser/project`
And I'm able to com... | The following seems to work, adjust to your needs:
```
mkdir git
mkdir work
git --git-dir git/test --work-tree work/test init
mkdir work/test
echo -n foo > work/test/foo.txt
git --git-dir git/test status
git --git-dir git/test add foo.txt
git --git-dir git/test commit -m 'commit 1'
```
EDIT: Notice that you don't hav... |
26886363 | Git: How to re-stage the staged files in a pre-commit hook | 28 | 2014-11-12 11:53:50 | <p>I'm writting a git pre-commit hook.<br>
The script could reformat some code, so it could modify the staged files. </p>
<p>How can I re-stage all files that are already staged ?</p>
| 13,502 | 1,978,945 | 2022-09-09 02:08:33 | 26,911,078 | 25 | 2014-11-13 14:24:15 | 1,978,945 | 2014-11-14 06:23:34 | https://stackoverflow.com/q/26886363 | https://stackoverflow.com/a/26911078 | <p>Without the <code>pre-commit hook</code> context, you can <a href="https://stackoverflow.com/questions/4524998/name-of-staged-files-from-git-status">get a list of the staged files</a> with the following command:</p>
<pre><code>git diff --name-only --cached
</code></pre>
<p>So if you want to re-index the staged fil... | <p>Without the <code>pre-commit hook</code> context, you can <a href="https://stackoverflow.com/questions/4524998/name-of-staged-files-from-git-status">get a list of the staged files</a> with the following command:</p> <pre><code>git diff --name-only --cached </code></pre> <p>So if you want to re-index the staged fil... | 119, 43087, 74978 | git, githooks, git-stage | <h1>Git: How to re-stage the staged files in a pre-commit hook</h1>
<p>I'm writting a git pre-commit hook.<br>
The script could reformat some code, so it could modify the staged files. </p>
<p>How can I re-stage all files that are already staged ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,621 | git | # Git: How to re-stage the staged files in a pre-commit hook
I'm writting a git pre-commit hook.
The script could reformat some code, so it could modify the staged files.
How can I re-stage all files that are already staged ? | Without the `pre-commit hook` context, you can [get a list of the staged files](https://stackoverflow.com/questions/4524998/name-of-staged-files-from-git-status) with the following command:
```
git diff --name-only --cached
```
So if you want to re-index the staged files, you can use:
```
git diff --name-only --cach... |
17988099 | How do I trivially linearize my git history? | 28 | 2013-08-01 07:50:54 | <h1>Question</h1>
<p>Given that I have a commit like the following:</p>
<pre><code>A - B - C - D - G - H
\ /
- E - F -
</code></pre>
<p>How do I get a perfectly linear history following only the first parents?</p>
<p>Eg, I want to get:</p>
<pre><code>A - B - C - D - G'- H'
</code></pre>
<p>It i... | 5,515 | 52,273 | 2016-02-08 14:46:01 | 17,994,534 | 25 | 2013-08-01 12:48:07 | 11,343 | 2016-02-08 14:46:01 | https://stackoverflow.com/q/17988099 | https://stackoverflow.com/a/17994534 | <p>As you said, the following command works:</p>
<pre><code>git filter-branch --parent-filter 'cut -f 2,3 -d " "'
</code></pre>
<p>Why?</p>
<p>The problem you pose is solved by transforming each merge commit with a simple commit: this will simply remove the feature branches that were merged, since they will become o... | <p>As you said, the following command works:</p> <pre><code>git filter-branch --parent-filter 'cut -f 2,3 -d " "' </code></pre> <p>Why?</p> <p>The problem you pose is solved by transforming each merge commit with a simple commit: this will simply remove the feature branches that were merged, since they will become o... | 119 | git | <h1>How do I trivially linearize my git history?</h1>
<h1>Question</h1>
<p>Given that I have a commit like the following:</p>
<pre><code>A - B - C - D - G - H
\ /
- E - F -
</code></pre>
<p>How do I get a perfectly linear history following only the first parents?</p>
<p>Eg, I want to get:</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,622 | git | # How do I trivially linearize my git history?
# Question
Given that I have a commit like the following:
```
A - B - C - D - G - H
\ /
- E - F -
```
How do I get a perfectly linear history following only the first parents?
Eg, I want to get:
```
A - B - C - D - G'- H'
```
It is expected that t... | As you said, the following command works:
```
git filter-branch --parent-filter 'cut -f 2,3 -d " "'
```
Why?
The problem you pose is solved by transforming each merge commit with a simple commit: this will simply remove the feature branches that were merged, since they will become orphan.
Each commit has one or mor... |
15752026 | git on windows shows modified files all the time, even for newly cloned repo | 26 | 2013-04-01 21:15:50 | <p>I am having issues with my git on a windows machine. I always have some git files that are modified in every repo, the files that show as modified are same. </p>
<p>If I clone a new repo and use tortoisegit to commit I see some files as modified, even if I never touched a single file in the repo. "gitstatus" doesnt... | 20,118 | 357,480 | 2019-09-25 15:13:59 | 27,834,457 | 25 | 2015-01-08 06:48:14 | 1,097,104 | 2015-01-08 06:48:14 | https://stackoverflow.com/q/15752026 | https://stackoverflow.com/a/27834457 | <p>Check if the changes are merely changes in file permissions. This was the reason in my case, both TortoiseGit and Git Extensions displayed unmodified files. </p>
<p>Use <code>git config core.fileMode false</code> to <a href="https://stackoverflow.com/q/1580596/1097104">ignore chmod differences</a> (or directly edit... | <p>Check if the changes are merely changes in file permissions. This was the reason in my case, both TortoiseGit and Git Extensions displayed unmodified files. </p> <p>Use <code>git config core.fileMode false</code> to <a href="https://stackoverflow.com/q/1580596/1097104">ignore chmod differences</a> (or directly edit... | 119, 31409 | git, tortoisegit | <h1>git on windows shows modified files all the time, even for newly cloned repo</h1>
<p>I am having issues with my git on a windows machine. I always have some git files that are modified in every repo, the files that show as modified are same. </p>
<p>If I clone a new repo and use tortoisegit to commit I see some fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,625 | git | # git on windows shows modified files all the time, even for newly cloned repo
I am having issues with my git on a windows machine. I always have some git files that are modified in every repo, the files that show as modified are same.
If I clone a new repo and use tortoisegit to commit I see some files as modified, ... | Check if the changes are merely changes in file permissions. This was the reason in my case, both TortoiseGit and Git Extensions displayed unmodified files.
Use `git config core.fileMode false` to [ignore chmod differences](https://stackoverflow.com/q/1580596/1097104) (or directly edit the *.git/config* file).
You ma... |
21353584 | How do I add a file to the first commit (and rewrite history in the process) in Git? | 26 | 2014-01-25 17:16:41 | <p>I'd like to add one file to a Git repository as if it was there from the start. I only found explanations how to remove a file from entire history, not how to add one.</p>
<p>I tried <code>git filter-branch --tree-filter 'git add LICENSE.txt'</code> but I got error that the file can't be found.</p>
| 6,269 | 175,398 | 2025-08-18 14:36:39 | 21,353,994 | 25 | 2014-01-25 17:45:47 | 1,256,452 | 2014-01-25 17:45:47 | https://stackoverflow.com/q/21353584 | https://stackoverflow.com/a/21353994 | <p><code>git filter-branch</code> <em>can</em> do this but is probably a lot heavier weight than needed.</p>
<p>How big and branch-y is your history? If it's small and short, the easiest way to do this would be add the new file now, then use <code>git rebase -i --root</code> to move the new commit to the 2nd position... | <p><code>git filter-branch</code> <em>can</em> do this but is probably a lot heavier weight than needed.</p> <p>How big and branch-y is your history? If it's small and short, the easiest way to do this would be add the new file now, then use <code>git rebase -i --root</code> to move the new commit to the 2nd position... | 119 | git | <h1>How do I add a file to the first commit (and rewrite history in the process) in Git?</h1>
<p>I'd like to add one file to a Git repository as if it was there from the start. I only found explanations how to remove a file from entire history, not how to add one.</p>
<p>I tried <code>git filter-branch --tree-filter 'g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,626 | git | # How do I add a file to the first commit (and rewrite history in the process) in Git?
I'd like to add one file to a Git repository as if it was there from the start. I only found explanations how to remove a file from entire history, not how to add one.
I tried `git filter-branch --tree-filter 'git add LICENSE.txt'`... | `git filter-branch` *can* do this but is probably a lot heavier weight than needed.
How big and branch-y is your history? If it's small and short, the easiest way to do this would be add the new file now, then use `git rebase -i --root` to move the new commit to the 2nd position and squash it into the root commit.
Fo... |
10180751 | List merge commits affecting a file | 26 | 2012-04-16 19:57:04 | <p>I want to find all the merge commits which affect or involve a given file. </p>
<p>For background, someone mis-resolved a conflict when merging, and it wasn't noticed by the team for a few days. At that point, a lot of other unrelated merges had been committed (some of us have been preferring to not use rebase, o... | 6,788 | 1,336,926 | 2012-04-16 21:24:22 | 10,181,681 | 25 | 2012-04-16 21:02:51 | 11,343 | 2012-04-16 21:24:22 | https://stackoverflow.com/q/10180751 | https://stackoverflow.com/a/10181681 | <p>The problem in your case is that the merge commits are empty, because you take stuff only from one branch, so git simplifies history by removing those "empty" commits.</p>
<p>So to have your merge commits shown in the log, you need to tell git to change history simplification, by telling <code>--simplify-merges</co... | <p>The problem in your case is that the merge commits are empty, because you take stuff only from one branch, so git simplifies history by removing those "empty" commits.</p> <p>So to have your merge commits shown in the log, you need to tell git to change history simplification, by telling <code>--simplify-merges</co... | 119, 28897, 47913, 76220 | git, git-branch, git-log, git-merge | <h1>List merge commits affecting a file</h1>
<p>I want to find all the merge commits which affect or involve a given file. </p>
<p>For background, someone mis-resolved a conflict when merging, and it wasn't noticed by the team for a few days. At that point, a lot of other unrelated merges had been committed (some of... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,627 | git | # List merge commits affecting a file
I want to find all the merge commits which affect or involve a given file.
For background, someone mis-resolved a conflict when merging, and it wasn't noticed by the team for a few days. At that point, a lot of other unrelated merges had been committed (some of us have been prefe... | The problem in your case is that the merge commits are empty, because you take stuff only from one branch, so git simplifies history by removing those "empty" commits.
So to have your merge commits shown in the log, you need to tell git to change history simplification, by telling `--simplify-merges`. If you want to u... |
52306173 | Can't push to remote SSH repo on GitHub via VSCode | 24 | 2018-09-13 03:19:59 | <p>I already updated my Git for Windows. I checked the keys are correct. The only "solution" is to start</p>
<pre><code>ssh-agent
</code></pre>
<p>Or opening VSCode via Git Bash.</p>
<p>So, any useful solution?</p>
<p>Log:</p>
<pre><code>> git push origin master:master
git@github.com: Permission denied (publick... | 51,969 | 3,100,464 | 2019-08-12 13:34:56 | 52,306,245 | 25 | 2018-09-13 03:31:14 | 9,840,318 | 2018-09-13 04:38:30 | https://stackoverflow.com/q/52306173 | https://stackoverflow.com/a/52306245 | <p>Force push might be disabled on the master branch. Check the settings on the repo that you're trying to push to.</p>
<p>If force push on master is not disabled, you need to make sure that you have added your ssh key path on your ssh config, so that you don't have to add the ssh key to the session every time. Edit t... | <p>Force push might be disabled on the master branch. Check the settings on the repo that you're trying to push to.</p> <p>If force push on master is not disabled, you need to make sure that you have added your ssh key path on your ssh config, so that you don't have to add the ssh key to the session every time. Edit t... | 119, 386, 111608 | git, ssh, visual-studio-code | <h1>Can't push to remote SSH repo on GitHub via VSCode</h1>
<p>I already updated my Git for Windows. I checked the keys are correct. The only "solution" is to start</p>
<pre><code>ssh-agent
</code></pre>
<p>Or opening VSCode via Git Bash.</p>
<p>So, any useful solution?</p>
<p>Log:</p>
<pre><code>> git push ori... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,630 | git | # Can't push to remote SSH repo on GitHub via VSCode
I already updated my Git for Windows. I checked the keys are correct. The only "solution" is to start
```
ssh-agent
```
Or opening VSCode via Git Bash.
So, any useful solution?
Log:
```
> git push origin master:master
git@github.com: Permission denied (publicke... | Force push might be disabled on the master branch. Check the settings on the repo that you're trying to push to.
If force push on master is not disabled, you need to make sure that you have added your ssh key path on your ssh config, so that you don't have to add the ssh key to the session every time. Edit the `config... |
33849704 | git reset vs git reset HEAD | 24 | 2015-11-21 23:09:21 | <p>Every time a file has been staged, Git offers helpful instructions in the event you needed to unstage a file:</p>
<p><code>(use "git reset HEAD <file>..." to unstage)</code></p>
<p>However the decent <a href="https://www.atlassian.com/git/tutorials/undoing-changes/git-reset" rel="noreferrer">Git Tutorials by... | 16,095 | 572,747 | 2019-08-29 06:49:36 | 33,849,726 | 25 | 2015-11-21 23:11:45 | 6,309 | 2019-08-29 06:49:36 | https://stackoverflow.com/q/33849704 | https://stackoverflow.com/a/33849726 | <p>No difference (from <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code> man page</a>) in term of default parameter:</p>
<blockquote>
<p>The <code><tree-ish>/<commit></code> defaults to <code>HEAD</code> in all forms.</p>
</blockquote>
<p>That message initially did <em>not<... | <p>No difference (from <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code> man page</a>) in term of default parameter:</p> <blockquote> <p>The <code><tree-ish>/<commit></code> defaults to <code>HEAD</code> in all forms.</p> </blockquote> <p>That message initially did <em>not<... | 119, 51381, 71398 | git, git-reset, unstage | <h1>git reset vs git reset HEAD</h1>
<p>Every time a file has been staged, Git offers helpful instructions in the event you needed to unstage a file:</p>
<p><code>(use "git reset HEAD <file>..." to unstage)</code></p>
<p>However the decent <a href="https://www.atlassian.com/git/tutorials/undoing-changes/git-res... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,631 | git | # git reset vs git reset HEAD
Every time a file has been staged, Git offers helpful instructions in the event you needed to unstage a file:
`(use "git reset HEAD <file>..." to unstage)`
However the decent [Git Tutorials by Atlassian](https://www.atlassian.com/git/tutorials/undoing-changes/git-reset) simply say:
`gi... | No difference (from [`git reset` man page](http://git-scm.com/docs/git-reset)) in term of default parameter:
> The `<tree-ish>/<commit>` defaults to `HEAD` in all forms.
That message initially did *not* include HEAD: [commit 3c1eb9c, Jan. 2007, git 1.5.0-rc1](https://github.com/git/git/commit/3c1eb9cb2d57769f770ddc36... |
7644276 | merging to branches, doesn't matter which one you merge into? | 24 | 2011-10-04 06:58:23 | <p>git version 1.7.5.4</p>
<p>I have about 5 branches. All from the same initial branch.</p>
<p>I want to merge 2 branches together. say, branch1 and branch2. These branches have a lot of differences.</p>
<p>I am currently working on branch1 and have just realized there are some changes I implemented in branch2 that... | 5,373 | 70,942 | 2017-09-11 21:39:30 | 7,645,143 | 25 | 2011-10-04 08:30:15 | 1,864,976 | 2017-09-11 21:38:02 | https://stackoverflow.com/q/7644276 | https://stackoverflow.com/a/7645143 | <p>Usually it does not matter if both branches are topic or feature branches.</p>
<p>However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.</p>
<p>The reason fo... | <p>Usually it does not matter if both branches are topic or feature branches.</p> <p>However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.</p> <p>The reason fo... | 119, 456 | git, version-control | <h1>merging to branches, doesn't matter which one you merge into?</h1>
<p>git version 1.7.5.4</p>
<p>I have about 5 branches. All from the same initial branch.</p>
<p>I want to merge 2 branches together. say, branch1 and branch2. These branches have a lot of differences.</p>
<p>I am currently working on branch1 and ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,632 | git | # merging to branches, doesn't matter which one you merge into?
git version 1.7.5.4
I have about 5 branches. All from the same initial branch.
I want to merge 2 branches together. say, branch1 and branch2. These branches have a lot of differences.
I am currently working on branch1 and have just realized there are s... | Usually it does not matter if both branches are topic or feature branches.
However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.
The reason for this is that th... |
6547933 | Is it possible to clone git config from remote location? | 24 | 2011-07-01 12:27:19 | <p>I have a bare repo on remote location with some configs I'd like to share with everyone who clones it. Is it possible? Every time I clone, it seems to revert everything in <code>.git/config</code> to defaults and just add information about remote repo.</p>
| 13,410 | 206,720 | 2014-03-06 16:11:45 | 6,548,056 | 25 | 2011-07-01 12:39:03 | 6,309 | 2011-07-01 13:10:20 | https://stackoverflow.com/q/6547933 | https://stackoverflow.com/a/6548056 | <p>I confirm a local config (the one within <code>.git/config</code>) is never shared amongst repo<br>
(for various security reasons, like, for instance,:</p>
<ul>
<li>a git alias which would define some commands only valid in your particular environment<br>
(or <del>git commands themselves</del>: <em>no</em>, as <a h... | <p>I confirm a local config (the one within <code>.git/config</code>) is never shared amongst repo<br> (for various security reasons, like, for instance,:</p> <ul> <li>a git alias which would define some commands only valid in your particular environment<br> (or <del>git commands themselves</del>: <em>no</em>, as <a h... | 119 | git | <h1>Is it possible to clone git config from remote location?</h1>
<p>I have a bare repo on remote location with some configs I'd like to share with everyone who clones it. Is it possible? Every time I clone, it seems to revert everything in <code>.git/config</code> to defaults and just add information about remote repo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,633 | git | # Is it possible to clone git config from remote location?
I have a bare repo on remote location with some configs I'd like to share with everyone who clones it. Is it possible? Every time I clone, it seems to revert everything in `.git/config` to defaults and just add information about remote repo. | I confirm a local config (the one within `.git/config`) is never shared amongst repo
(for various security reasons, like, for instance,:
- a git alias which would define some commands only valid in your particular environment
(or ~~git commands themselves~~: *no*, as [Jan Hudec](https://stackoverflow.com/users/2... |
36732119 | How to setup .gitignore for Windows? | 23 | 2016-04-20 01:10:08 | <p>I am setting up my first project in Git. How do I setup <code>git-ignore</code> file in Windows?</p>
<p>I am creating my first Rails project using Vagrant and trying to configure <code>.gitignore</code> in Windows</p>
| 67,760 | 5,469,534 | 2022-02-15 21:42:12 | 36,732,193 | 25 | 2016-04-20 01:18:15 | 1,564,659 | 2016-04-20 01:18:15 | https://stackoverflow.com/q/36732119 | https://stackoverflow.com/a/36732193 | <p>Easy. </p>
<ol>
<li>Make a file <code>.gitignore</code> using your text editor</li>
<li>In there, write the file name you'd want to ignore</li>
<li>You can use wildcard like: <code>*.pyc</code> ignoring any file with extension <code>.pyc</code></li>
</ol>
<p>If you use TortoiseGit or other Git software, it will be... | <p>Easy. </p> <ol> <li>Make a file <code>.gitignore</code> using your text editor</li> <li>In there, write the file name you'd want to ignore</li> <li>You can use wildcard like: <code>*.pyc</code> ignoring any file with extension <code>.pyc</code></li> </ol> <p>If you use TortoiseGit or other Git software, it will be... | 64, 119 | git, windows | <h1>How to setup .gitignore for Windows?</h1>
<p>I am setting up my first project in Git. How do I setup <code>git-ignore</code> file in Windows?</p>
<p>I am creating my first Rails project using Vagrant and trying to configure <code>.gitignore</code> in Windows</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,634 | git | # How to setup .gitignore for Windows?
I am setting up my first project in Git. How do I setup `git-ignore` file in Windows?
I am creating my first Rails project using Vagrant and trying to configure `.gitignore` in Windows | Easy.
1. Make a file `.gitignore` using your text editor
2. In there, write the file name you'd want to ignore
3. You can use wildcard like: `*.pyc` ignoring any file with extension `.pyc`
If you use TortoiseGit or other Git software, it will be easier. There will be `add to ignore list` menu when you right click to ... |
35016573 | Escape # character in interactive rebase commit message | 23 | 2016-01-26 14:45:27 | <p>After performing an interactive rebase in git I want to have a commit message that starts with the <code>#</code> (hash, or pound) character, but lines starting with <code>#</code> are treated as comments and ignored.</p>
<p>Is there any way to escape the <code>#</code> character to make my commit message actually ... | 5,519 | 4,316,831 | 2018-10-23 10:51:32 | 35,016,575 | 25 | 2016-01-26 14:45:27 | 4,316,831 | 2018-10-23 10:51:32 | https://stackoverflow.com/q/35016573 | https://stackoverflow.com/a/35016575 | <p>If you save your commit message with the <code>#</code>, it results in your commit message being blank (you could also delete everything in the commit message). Git will show you what to do:</p>
<pre><code>Aborting commit due to empty commit message.
Could not amend commit after successfully picking 5e9159d9ce3a5c3... | <p>If you save your commit message with the <code>#</code>, it results in your commit message being blank (you could also delete everything in the commit message). Git will show you what to do:</p> <pre><code>Aborting commit due to empty commit message. Could not amend commit after successfully picking 5e9159d9ce3a5c3... | 119 | git | <h1>Escape # character in interactive rebase commit message</h1>
<p>After performing an interactive rebase in git I want to have a commit message that starts with the <code>#</code> (hash, or pound) character, but lines starting with <code>#</code> are treated as comments and ignored.</p>
<p>Is there any way to escape... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,635 | git | # Escape # character in interactive rebase commit message
After performing an interactive rebase in git I want to have a commit message that starts with the `#` (hash, or pound) character, but lines starting with `#` are treated as comments and ignored.
Is there any way to escape the `#` character to make my commit m... | If you save your commit message with the `#`, it results in your commit message being blank (you could also delete everything in the commit message). Git will show you what to do:
```
Aborting commit due to empty commit message.
Could not amend commit after successfully picking 5e9159d9ce3a5c3c87a4fb7932fda4e53c7891db... |
32505684 | Where is .gitignore_global saved on OS X? | 23 | 2015-09-10 15:13:39 | <p>I have created a <code>.gitignore_global</code> file by running</p>
<pre><code>git config --global core.excludesfile ~/.gitignore_global
</code></pre>
<p>However, I can't find the file in question in my file system? Where was it saved? </p>
| 16,220 | 1,083,572 | 2025-08-19 16:23:09 | 32,506,057 | 25 | 2015-09-10 15:32:01 | 2,541,573 | 2016-08-23 16:20:13 | https://stackoverflow.com/q/32505684 | https://stackoverflow.com/a/32506057 | <blockquote>
<p>I have created a <code>.gitignore_global</code> file using the command [...]</p>
</blockquote>
<p>The command</p>
<pre><code>git config --global core.excludesfile ~/.gitignore_global
</code></pre>
<p>does <em>not</em> create any file. In other words, if <code>~/.gitignore_global</code> did not exis... | <blockquote> <p>I have created a <code>.gitignore_global</code> file using the command [...]</p> </blockquote> <p>The command</p> <pre><code>git config --global core.excludesfile ~/.gitignore_global </code></pre> <p>does <em>not</em> create any file. In other words, if <code>~/.gitignore_global</code> did not exis... | 119, 369, 25056 | git, gitignore, macos | <h1>Where is .gitignore_global saved on OS X?</h1>
<p>I have created a <code>.gitignore_global</code> file by running</p>
<pre><code>git config --global core.excludesfile ~/.gitignore_global
</code></pre>
<p>However, I can't find the file in question in my file system? Where was it saved? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,636 | git | # Where is .gitignore_global saved on OS X?
I have created a `.gitignore_global` file by running
```
git config --global core.excludesfile ~/.gitignore_global
```
However, I can't find the file in question in my file system? Where was it saved? | > I have created a `.gitignore_global` file using the command [...]
The command
```
git config --global core.excludesfile ~/.gitignore_global
```
does *not* create any file. In other words, if `~/.gitignore_global` did not exist beforehand, running that command does not create it.
The semantics of that command are
... |
30171571 | Increment Android build number in Continuous Integration | 23 | 2015-05-11 15:20:57 | <p>I'm using Android Studio, Gradle, git.</p>
<p>On every push to the master branch I want to build a new App version that's uploaded to the Alpha channel of the Google Play Store. For this I need to increase the versionCode of the App for every build.</p>
<p>For this I seem to have several choices:</p>
<ol>
<li>Inc... | 10,085 | 1,388,068 | 2015-05-11 17:10:12 | 30,173,667 | 25 | 2015-05-11 17:10:12 | 234,938 | 2015-05-11 17:10:12 | https://stackoverflow.com/q/30171571 | https://stackoverflow.com/a/30173667 | <p>I use none of the above — like you, I don't want to alter the repo for each build, nor any files.</p>
<p>Jenkins has an always-increasing value for each build, exposed via the <code>BUILD_NUMBER</code> environment variable.</p>
<p>In Gradle, I generate the <code>versionCode</code> value programmatically at build t... | <p>I use none of the above — like you, I don't want to alter the repo for each build, nor any files.</p> <p>Jenkins has an always-increasing value for each build, exposed via the <code>BUILD_NUMBER</code> environment variable.</p> <p>In Gradle, I generate the <code>versionCode</code> value programmatically at build t... | 119, 1066, 1386, 64999 | android, continuous-integration, git, jenkins | <h1>Increment Android build number in Continuous Integration</h1>
<p>I'm using Android Studio, Gradle, git.</p>
<p>On every push to the master branch I want to build a new App version that's uploaded to the Alpha channel of the Google Play Store. For this I need to increase the versionCode of the App for every build.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,637 | git | # Increment Android build number in Continuous Integration
I'm using Android Studio, Gradle, git.
On every push to the master branch I want to build a new App version that's uploaded to the Alpha channel of the Google Play Store. For this I need to increase the versionCode of the App for every build.
For this I seem... | I use none of the above — like you, I don't want to alter the repo for each build, nor any files.
Jenkins has an always-increasing value for each build, exposed via the `BUILD_NUMBER` environment variable.
In Gradle, I generate the `versionCode` value programmatically at build time, using the `BUILD_NUMBER` value to ... |
19986075 | Git submodule to track remote branch | 23 | 2013-11-14 18:59:23 | <p>I'm trying to use git submodules for aggregating 10+ repositories into one structure for easy development.</p>
<p>It is supposed to clone the module and checkout a branch.
Instead, the module is checked out in detached head mode.</p>
<pre><code>git clone git@github.com:org/global-repository.git
git submodule updat... | 22,235 | 1,304,351 | 2024-06-23 19:42:23 | 20,016,830 | 25 | 2013-11-16 09:26:13 | 6,309 | 2024-06-23 19:42:23 | https://stackoverflow.com/q/19986075 | https://stackoverflow.com/a/20016830 | <p>Submodules are <em>always</em> checked out in a <strong><a href="https://stackoverflow.com/a/3965714/6309">detached HEAD mode</a></strong>.</p>
<p>That is because a submodule will checkout the SHA1 stored in the <strong><a href="https://stackoverflow.com/a/19354410/6309">special entry in the index of the parent repo... | <p>Submodules are <em>always</em> checked out in a <strong><a href="https://stackoverflow.com/a/3965714/6309">detached HEAD mode</a></strong>.</p> <p>That is because a submodule will checkout the SHA1 stored in the <strong><a href="https://stackoverflow.com/a/19354410/6309">special entry in the index of the parent repo... | 119, 41346, 41612, 76220 | git, git-branch, git-remote, git-submodules | <h1>Git submodule to track remote branch</h1>
<p>I'm trying to use git submodules for aggregating 10+ repositories into one structure for easy development.</p>
<p>It is supposed to clone the module and checkout a branch.
Instead, the module is checked out in detached head mode.</p>
<pre><code>git clone git@github.com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,639 | git | # Git submodule to track remote branch
I'm trying to use git submodules for aggregating 10+ repositories into one structure for easy development.
It is supposed to clone the module and checkout a branch.
Instead, the module is checked out in detached head mode.
```
git clone git@github.com:org/global-repository.git
... | Submodules are *always* checked out in a **[detached HEAD mode](https://stackoverflow.com/a/3965714/6309)**.
That is because a submodule will checkout the SHA1 stored in the **[special entry in the index of the parent repo](https://stackoverflow.com/a/19354410/6309)**.
Plus, if you want a submodule to follow the bran... |
13955390 | git grep--but restricted to new or modified files in the index | 23 | 2012-12-19 15:15:14 | <p>Is it possible to get <code>git grep</code> to search only new or modified files in the index/cache? </p>
<p>(The use-case for this is to use in a pre-commit hook that looks for "debug" code such as <code>console.log</code> in the prospective commit. But I'm not bothered by <code>console.log</code> in "existing" c... | 6,349 | 11,543 | 2019-12-26 14:33:17 | 14,053,984 | 25 | 2012-12-27 11:32:14 | 11,543 | 2012-12-27 11:32:14 | https://stackoverflow.com/q/13955390 | https://stackoverflow.com/a/14053984 | <p>It turns out the way to do this is not via <code>git grep</code>, but by a completely different command, that also happens to be able to search: <code>git diff-index</code>. (Another triumph for simplicity and orthogonality...)</p>
<p>What I wanted can be achieved via:</p>
<pre><code>$ git diff-index -U --cached -... | <p>It turns out the way to do this is not via <code>git grep</code>, but by a completely different command, that also happens to be able to search: <code>git diff-index</code>. (Another triumph for simplicity and orthogonality...)</p> <p>What I wanted can be achieved via:</p> <pre><code>$ git diff-index -U --cached -... | 119, 1271 | git, grep | <h1>git grep--but restricted to new or modified files in the index</h1>
<p>Is it possible to get <code>git grep</code> to search only new or modified files in the index/cache? </p>
<p>(The use-case for this is to use in a pre-commit hook that looks for "debug" code such as <code>console.log</code> in the prospective c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,640 | git | # git grep--but restricted to new or modified files in the index
Is it possible to get `git grep` to search only new or modified files in the index/cache?
(The use-case for this is to use in a pre-commit hook that looks for "debug" code such as `console.log` in the prospective commit. But I'm not bothered by `console... | It turns out the way to do this is not via `git grep`, but by a completely different command, that also happens to be able to search: `git diff-index`. (Another triumph for simplicity and orthogonality...)
What I wanted can be achieved via:
```
$ git diff-index -U --cached -G <regexp> HEAD
``` |
7515213 | git show commit in beyond compare | 23 | 2011-09-22 13:06:49 | <p>I would like to see a specific commit in Beyond Compare or any other separate diff tool while viewing it via <code>git show</code>. I tried looking at help of git show/difftool/config but couldn't find anything. Does anyone know how it can be done?</p>
<p>I've looked at <a href="https://stackoverflow.com/questions/... | 6,913 | 499,808 | 2024-01-20 03:29:33 | 7,674,023 | 25 | 2011-10-06 12:06:26 | 499,808 | 2012-12-13 20:00:35 | https://stackoverflow.com/q/7515213 | https://stackoverflow.com/a/7674023 | <p>I managed to use <code>git difftool</code> to see commits that I normally used to see via <code>git show</code>. </p>
<p><code>git show $commit</code> translates to <code>git difftool $commit^ $commit</code>.</p>
<p>The above command shows difference between commit's parent ($commit^) and commit. All this is of co... | <p>I managed to use <code>git difftool</code> to see commits that I normally used to see via <code>git show</code>. </p> <p><code>git show $commit</code> translates to <code>git difftool $commit^ $commit</code>.</p> <p>The above command shows difference between commit's parent ($commit^) and commit. All this is of co... | 119, 9033, 15129 | beyondcompare, git, git-diff | <h1>git show commit in beyond compare</h1>
<p>I would like to see a specific commit in Beyond Compare or any other separate diff tool while viewing it via <code>git show</code>. I tried looking at help of git show/difftool/config but couldn't find anything. Does anyone know how it can be done?</p>
<p>I've looked at <a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,641 | git | # git show commit in beyond compare
I would like to see a specific commit in Beyond Compare or any other separate diff tool while viewing it via `git show`. I tried looking at help of git show/difftool/config but couldn't find anything. Does anyone know how it can be done?
I've looked at [Git Diff with Beyond Compare... | I managed to use `git difftool` to see commits that I normally used to see via `git show`.
`git show $commit` translates to `git difftool $commit^ $commit`.
The above command shows difference between commit's parent ($commit^) and commit. All this is of course after configuring Beyond Compare with difftool. |
3817478 | Setting up Git Server on Windows With git-http-backend.exe | 23 | 2010-09-28 22:28:31 | <p>I am in the process of setting up a Git server (1.7.2.3) on a WS 2008 machine using Apache and git-http-backend.exe. I have been following a good tut <a href="http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/" rel="noreferrer">here</a>. I have the GUI working, I can annoymousl... | 28,544 | 6,486 | 2020-03-28 07:46:54 | 3,982,493 | 25 | 2010-10-20 21:33:13 | 6,486 | 2010-10-20 21:33:13 | https://stackoverflow.com/q/3817478 | https://stackoverflow.com/a/3982493 | <p>OK, so hell has frozen over and I have finally got this working!</p>
<p>I believe there were two things that were fundamentally wrong with my setup.</p>
<p>1) The user was not getting authentication passed through, I found this helped:</p>
<pre><code>SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
</code></pre>
<p>Seco... | <p>OK, so hell has frozen over and I have finally got this working!</p> <p>I believe there were two things that were fundamentally wrong with my setup.</p> <p>1) The user was not getting authentication passed through, I found this helped:</p> <pre><code>SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER </code></pre> <p>Seco... | 119, 5876, 124638 | apache2, git, git-http-backend | <h1>Setting up Git Server on Windows With git-http-backend.exe</h1>
<p>I am in the process of setting up a Git server (1.7.2.3) on a WS 2008 machine using Apache and git-http-backend.exe. I have been following a good tut <a href="http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/" ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,642 | git | # Setting up Git Server on Windows With git-http-backend.exe
I am in the process of setting up a Git server (1.7.2.3) on a WS 2008 machine using Apache and git-http-backend.exe. I have been following a good tut [here](http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/). I have the ... | OK, so hell has frozen over and I have finally got this working!
I believe there were two things that were fundamentally wrong with my setup.
1) The user was not getting authentication passed through, I found this helped:
```
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
```
Secondly I couldn't get the physical "Directo... |
8500089 | fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits | 22 | 2011-12-14 06:00:00 | <p>I am getting the following error while pushing the commit</p>
<pre><code>$ git push origin master
fatal: unable to create 'refs/heads/master.lock': File exists fatal:
The remote end hung up unexpectedly
</code></pre>
<p>I thought of removing the lock file (<code>refs/heads/master.lock</code>) from my local machine... | 34,268 | 905,511 | 2024-07-13 18:49:47 | 26,837,305 | 25 | 2014-11-10 05:25:28 | 1,153,551 | 2014-12-22 04:50:54 | https://stackoverflow.com/q/8500089 | https://stackoverflow.com/a/26837305 | <p>You need to remove existing <strong><code>.lock</code></strong> file and try to push,</p>
<h3>Linux</h3>
<pre><code>rm -f .git/refs/heads/master.lock
</code></pre>
<h3>Windows</h3>
<pre><code>del .git\refs\heads\master.lock
</code></pre>
| <p>You need to remove existing <strong><code>.lock</code></strong> file and try to push,</p> <h3>Linux</h3> <pre><code>rm -f .git/refs/heads/master.lock </code></pre> <h3>Windows</h3> <pre><code>del .git\refs\heads\master.lock </code></pre> | 119, 28898 | git, git-push | <h1>fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits</h1>
<p>I am getting the following error while pushing the commit</p>
<pre><code>$ git push origin master
fatal: unable to create 'refs/heads/master.lock': File exists fatal:
The remote end hung up u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,645 | git | # fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits
I am getting the following error while pushing the commit
```
$ git push origin master
fatal: unable to create 'refs/heads/master.lock': File exists fatal:
The remote end hung up unexpectedly
```
I t... | You need to remove existing **`.lock`** file and try to push,
### Linux
```
rm -f .git/refs/heads/master.lock
```
### Windows
```
del .git\refs\heads\master.lock
``` |
20069482 | How to push 'refs/replace' without pushing any other refs in git? | 21 | 2013-11-19 10:51:06 | <p>I have done a replacement of one commit with another in this way:</p>
<pre><code>* HEAD
|
...
|
* ==> * `git replace left_commit right_commit`
| |
*-----/
|
...
</code></pre>
<p>This replacement is placed in .git/refs/replace folder, so I wonder - how can I push this refs to the remote end?</p>
| 3,541 | 377,393 | 2013-11-19 13:08:01 | 20,072,413 | 25 | 2013-11-19 13:08:01 | 377,393 | 2013-11-19 13:08:01 | https://stackoverflow.com/q/20069482 | https://stackoverflow.com/a/20072413 | <p>Found the answer in <a href="http://comments.gmane.org/gmane.comp.version-control.git/187800" rel="noreferrer" title="mailing-list">mailing-list</a>:</p>
<pre><code>git push origin 'refs/replace/*'
git fetch origin 'refs/replace/*:refs/replace/*'
</code></pre>
<p>Only explicit pushing and fetching do work right no... | <p>Found the answer in <a href="http://comments.gmane.org/gmane.comp.version-control.git/187800" rel="noreferrer" title="mailing-list">mailing-list</a>:</p> <pre><code>git push origin 'refs/replace/*' git fetch origin 'refs/replace/*:refs/replace/*' </code></pre> <p>Only explicit pushing and fetching do work right no... | 119 | git | <h1>How to push 'refs/replace' without pushing any other refs in git?</h1>
<p>I have done a replacement of one commit with another in this way:</p>
<pre><code>* HEAD
|
...
|
* ==> * `git replace left_commit right_commit`
| |
*-----/
|
...
</code></pre>
<p>This replacement is placed in .git/refs/replace folder... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,646 | git | # How to push 'refs/replace' without pushing any other refs in git?
I have done a replacement of one commit with another in this way:
```
* HEAD
|
...
|
* ==> * `git replace left_commit right_commit`
| |
*-----/
|
...
```
This replacement is placed in .git/refs/replace folder, so I wonder - how can I push this ... | Found the answer in [mailing-list](http://comments.gmane.org/gmane.comp.version-control.git/187800 "mailing-list"):
```
git push origin 'refs/replace/*'
git fetch origin 'refs/replace/*:refs/replace/*'
```
Only explicit pushing and fetching do work right now in git. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.