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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16738949 | Go back N commits in Git to find commit that causes test regressions | 20 | 2013-05-24 15:50:26 | <p>Is there a command that will let me checkout a commit based on its distance from the current commit instead of using commit IDs? </p>
<h3>Use Case</h3>
<p>Basically I am thinking of setting up a cron job type script to do the following on a build server:</p>
<ul>
<li>Pull down the latest of a specific git branch ... | 14,017 | 1,044,650 | 2017-02-15 11:17:16 | 16,739,578 | 36 | 2013-05-24 16:25:22 | 1,727,593 | 2013-05-24 16:25:22 | https://stackoverflow.com/q/16738949 | https://stackoverflow.com/a/16739578 | <pre><code>git checkout HEAD~N
</code></pre>
<p>will checkout the Nth commit before your current commit.</p>
<p>If you have merge commits in your history, you may be interested in</p>
<pre><code>git checkout HEAD^N
</code></pre>
<p>which will checkout the Nth parent of a merge commit (most merge commits have 2 pare... | <pre><code>git checkout HEAD~N </code></pre> <p>will checkout the Nth commit before your current commit.</p> <p>If you have merge commits in your history, you may be interested in</p> <pre><code>git checkout HEAD^N </code></pre> <p>which will checkout the Nth parent of a merge commit (most merge commits have 2 pare... | 119, 1362, 53850 | automation, git, git-commit | <h1>Go back N commits in Git to find commit that causes test regressions</h1>
<p>Is there a command that will let me checkout a commit based on its distance from the current commit instead of using commit IDs? </p>
<h3>Use Case</h3>
<p>Basically I am thinking of setting up a cron job type script to do the following o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,387 | git | # Go back N commits in Git to find commit that causes test regressions
Is there a command that will let me checkout a commit based on its distance from the current commit instead of using commit IDs?
### Use Case
Basically I am thinking of setting up a cron job type script to do the following on a build server:
- P... | ```
git checkout HEAD~N
```
will checkout the Nth commit before your current commit.
If you have merge commits in your history, you may be interested in
```
git checkout HEAD^N
```
which will checkout the Nth parent of a merge commit (most merge commits have 2 parents).
So, to always go back one commit following t... |
49420785 | git ignore file but not folder with the same name | 19 | 2018-03-22 04:52:06 | <p>My code structure is:</p>
<pre><code>.gitignore
my-service << this is a file without an extention
charts
| my-service << this is a folder
| | file1
| | file2
</code></pre>
<p>When I write in my gitignore <code>my-service</code> it ignores both my-service the file and <code>my-service</code> the folder.... | 3,903 | 830,230 | 2018-03-22 07:00:43 | 49,420,835 | 36 | 2018-03-22 04:56:48 | 1,484,621 | 2018-03-22 04:56:48 | https://stackoverflow.com/q/49420785 | https://stackoverflow.com/a/49420835 | <p>you can do the reverse way with<code>!</code> in .gitignore</p>
<pre><code>myservice
!myservice/
</code></pre>
| <p>you can do the reverse way with<code>!</code> in .gitignore</p> <pre><code>myservice !myservice/ </code></pre> | 119, 25056 | git, gitignore | <h1>git ignore file but not folder with the same name</h1>
<p>My code structure is:</p>
<pre><code>.gitignore
my-service << this is a file without an extention
charts
| my-service << this is a folder
| | file1
| | file2
</code></pre>
<p>When I write in my gitignore <code>my-service</code> it ignores both ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,388 | git | # git ignore file but not folder with the same name
My code structure is:
```
.gitignore
my-service << this is a file without an extention
charts
| my-service << this is a folder
| | file1
| | file2
```
When I write in my gitignore `my-service` it ignores both my-service the file and `my-service` the folder.
How can... | you can do the reverse way with`!` in .gitignore
```
myservice
!myservice/
``` |
36369239 | How can I round to an arbitrary number of significant digits with JavaScript? | 19 | 2016-04-02 04:35:40 | <p>I tried below sample code </p>
<pre><code>function sigFigs(n, sig) {
if ( n === 0 )
return 0
var mult = Math.pow(10,
sig - Math.floor(Math.log(n < 0 ? -n: n) / Math.LN10) - 1);
return Math.round(n * mult) / mult;
}
</code></pre>
<p>But this function is not working for inputs like
s... | 30,267 | 6,147,777 | 2023-04-06 22:05:56 | 36,369,703 | 36 | 2016-04-02 05:51:24 | 3,270,651 | 2016-04-02 06:05:57 | https://stackoverflow.com/q/36369239 | https://stackoverflow.com/a/36369703 | <p>You can try javascript inbuilt method-</p>
<pre><code>Number( my_number.toPrecision(3) )
</code></pre>
<p>For Your case try</p>
<pre><code>Number( 24730790.0.toPrecision(5) )
</code></pre>
<p>For your refrence and working example you can see <a href="https://stackoverflow.com/questions/202302/rounding-to-an-arbi... | <p>You can try javascript inbuilt method-</p> <pre><code>Number( my_number.toPrecision(3) ) </code></pre> <p>For Your case try</p> <pre><code>Number( 24730790.0.toPrecision(5) ) </code></pre> <p>For your refrence and working example you can see <a href="https://stackoverflow.com/questions/202302/rounding-to-an-arbi... | 3, 9069, 12414 | javascript, rounding, significant-digits | <h1>How can I round to an arbitrary number of significant digits with JavaScript?</h1>
<p>I tried below sample code </p>
<pre><code>function sigFigs(n, sig) {
if ( n === 0 )
return 0
var mult = Math.pow(10,
sig - Math.floor(Math.log(n < 0 ? -n: n) / Math.LN10) - 1);
return Math.round(n *... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,389 | git | # How can I round to an arbitrary number of significant digits with JavaScript?
I tried below sample code
```
function sigFigs(n, sig) {
if ( n === 0 )
return 0
var mult = Math.pow(10,
sig - Math.floor(Math.log(n < 0 ? -n: n) / Math.LN10) - 1);
return Math.round(n * mult) / mult;
}
```
B... | You can try javascript inbuilt method-
```
Number( my_number.toPrecision(3) )
```
For Your case try
```
Number( 24730790.0.toPrecision(5) )
```
For your refrence and working example you can see [link](https://stackoverflow.com/questions/202302/rounding-to-an-arbitrary-number-of-significant-digits) |
32327108 | Get the current commit id of specified submodule | 19 | 2015-09-01 08:37:41 | <p>I want get the current commit id of the specified submodule. I thought when I cd into submodule directory and run <code>git rev-parse HEAD</code> i get this after I noticed this is a superproject current id.
Tried <code>git submodule status | grep <submodule_name></code> also but its to slow to me. Any idea ho... | 32,924 | 3,699,261 | 2022-03-23 20:08:12 | 32,327,200 | 36 | 2015-09-01 08:43:30 | 6,309 | 2022-03-23 20:08:12 | https://stackoverflow.com/q/32327108 | https://stackoverflow.com/a/32327200 | <p>First, as <a href="https://stackoverflow.com/questions/32327108/get-the-current-commit-id-of-specified-submodule/32327200#comment126532790_32327200">commented</a> by <a href="https://stackoverflow.com/users/9431020/brookbot"><code>brookbot</code></a>, <strong><a href="https://git-scm.com/docs/git-submodule/#Document... | <p>First, as <a href="https://stackoverflow.com/questions/32327108/get-the-current-commit-id-of-specified-submodule/32327200#comment126532790_32327200">commented</a> by <a href="https://stackoverflow.com/users/9431020/brookbot"><code>brookbot</code></a>, <strong><a href="https://git-scm.com/docs/git-submodule/#Document... | 119, 41612 | git, git-submodules | <h1>Get the current commit id of specified submodule</h1>
<p>I want get the current commit id of the specified submodule. I thought when I cd into submodule directory and run <code>git rev-parse HEAD</code> i get this after I noticed this is a superproject current id.
Tried <code>git submodule status | grep <submodu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,390 | git | # Get the current commit id of specified submodule
I want get the current commit id of the specified submodule. I thought when I cd into submodule directory and run `git rev-parse HEAD` i get this after I noticed this is a superproject current id.
Tried `git submodule status | grep <submodule_name>` also but its to sl... | First, as [commented](https://stackoverflow.com/questions/32327108/get-the-current-commit-id-of-specified-submodule/32327200#comment126532790_32327200) by [`brookbot`](https://stackoverflow.com/users/9431020/brookbot), **[`git submodule status`](https://git-scm.com/docs/git-submodule/#Documentation/git-submodule.txt-st... |
23136044 | Automation of git pull using PHP code | 19 | 2014-04-17 14:32:33 | <p>I am working to automate the task of <strong>'git pull'</strong> from bit-bucket server to my godaddy shared hosting. I have installed Git on Godaddy server and able to <strong>'git clone'</strong>, <strong>'git pull'</strong> etc from command line remotely. But now I want to write a PHP code to run 'git pull' direc... | 39,146 | 1,306,063 | 2020-10-21 14:08:04 | 23,136,269 | 36 | 2014-04-17 14:41:54 | 2,671,237 | 2020-10-21 14:08:04 | https://stackoverflow.com/q/23136044 | https://stackoverflow.com/a/23136269 | <p>If you use https instead of ssh you can specify user/password directly in the request:</p>
<p>git clone:</p>
<pre><code>exec("git clone https://user:password@bitbucket.org/user/repo.git");
</code></pre>
<p>git pull:</p>
<pre><code>exec("git pull https://user:password@bitbucket.org/user/repo.git master... | <p>If you use https instead of ssh you can specify user/password directly in the request:</p> <p>git clone:</p> <pre><code>exec("git clone https://user:password@bitbucket.org/user/repo.git"); </code></pre> <p>git pull:</p> <pre><code>exec("git pull https://user:password@bitbucket.org/user/repo.git master... | 5, 119, 8337 | bitbucket, git, php | <h1>Automation of git pull using PHP code</h1>
<p>I am working to automate the task of <strong>'git pull'</strong> from bit-bucket server to my godaddy shared hosting. I have installed Git on Godaddy server and able to <strong>'git clone'</strong>, <strong>'git pull'</strong> etc from command line remotely. But now I w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,392 | git | # Automation of git pull using PHP code
I am working to automate the task of **'git pull'** from bit-bucket server to my godaddy shared hosting. I have installed Git on Godaddy server and able to **'git clone'**, **'git pull'** etc from command line remotely. But now I want to write a PHP code to run 'git pull' direct... | If you use https instead of ssh you can specify user/password directly in the request:
git clone:
```
exec("git clone https://user:password@bitbucket.org/user/repo.git");
```
git pull:
```
exec("git pull https://user:password@bitbucket.org/user/repo.git master");
```
Alternatives to exposing your password:
- Use ... |
21112557 | Is possible change the commit date on git? | 19 | 2014-01-14 11:35:25 | <p>When I commited my work, the pc date was 02/13/2014, but the correct date was 01/13/2014. Is possible the change commit date to the correct date?</p>
| 16,613 | 1,902,062 | 2015-03-25 20:21:42 | 21,112,849 | 36 | 2014-01-14 11:49:58 | 1,242,778 | 2015-03-25 20:21:42 | https://stackoverflow.com/q/21112557 | https://stackoverflow.com/a/21112849 | <p>If it is your latest commit:</p>
<pre><code>git commit --amend --date="Wed Jan 13 12:00 2014 +0100"
</code></pre>
<p>If it is for example your 5th last commit, you can do an interactive rebase and edit the commit:</p>
<pre><code>git rebase -i HEAD~5
<find the commit and change 'pick' to 'e', save and close fil... | <p>If it is your latest commit:</p> <pre><code>git commit --amend --date="Wed Jan 13 12:00 2014 +0100" </code></pre> <p>If it is for example your 5th last commit, you can do an interactive rebase and edit the commit:</p> <pre><code>git rebase -i HEAD~5 <find the commit and change 'pick' to 'e', save and close fil... | 119 | git | <h1>Is possible change the commit date on git?</h1>
<p>When I commited my work, the pc date was 02/13/2014, but the correct date was 01/13/2014. Is possible the change commit date to the correct date?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,393 | git | # Is possible change the commit date on git?
When I commited my work, the pc date was 02/13/2014, but the correct date was 01/13/2014. Is possible the change commit date to the correct date? | If it is your latest commit:
```
git commit --amend --date="Wed Jan 13 12:00 2014 +0100"
```
If it is for example your 5th last commit, you can do an interactive rebase and edit the commit:
```
git rebase -i HEAD~5
<find the commit and change 'pick' to 'e', save and close file>
git commit --amend --date="Wed Jan 13 ... |
26732339 | Git history rewrite on Bitbucket [remote rejected] HEAD -> branch (pre-receive hook declined) | 16 | 2014-11-04 10:02:05 | <p>On Bitbucket, using the Bitbucket web interface, I sync'd a blessed repo with my own private fork in error. I wanted to rewrite history on the blessed repo to bring it back to the correct commit.</p>
<p>I cloned the blessed repo that contained my incorrect commits and locally ran </p>
<pre><code>git reset --hard H... | 24,277 | 411,902 | 2022-12-19 19:14:06 | 26,732,340 | 36 | 2014-11-04 10:02:05 | 411,902 | 2019-03-26 09:14:25 | https://stackoverflow.com/q/26732339 | https://stackoverflow.com/a/26732340 | <p>In Bitbucket, it is possible to <s><a href="https://confluence.atlassian.com/display/BITBUCKET/Branch+management#Branchmanagement-Limitpushpowers" rel="noreferrer">limit push powers broken-link</a></s> <a href="https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html" rel="noreferrer">use branch ... | <p>In Bitbucket, it is possible to <s><a href="https://confluence.atlassian.com/display/BITBUCKET/Branch+management#Branchmanagement-Limitpushpowers" rel="noreferrer">limit push powers broken-link</a></s> <a href="https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html" rel="noreferrer">use branch ... | 119, 8337 | bitbucket, git | <h1>Git history rewrite on Bitbucket [remote rejected] HEAD -> branch (pre-receive hook declined)</h1>
<p>On Bitbucket, using the Bitbucket web interface, I sync'd a blessed repo with my own private fork in error. I wanted to rewrite history on the blessed repo to bring it back to the correct commit.</p>
<p>I cloned t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,395 | git | # Git history rewrite on Bitbucket [remote rejected] HEAD -> branch (pre-receive hook declined)
On Bitbucket, using the Bitbucket web interface, I sync'd a blessed repo with my own private fork in error. I wanted to rewrite history on the blessed repo to bring it back to the correct commit.
I cloned the blessed repo ... | In Bitbucket, it is possible to ~~[limit push powers broken-link](https://confluence.atlassian.com/display/BITBUCKET/Branch+management#Branchmanagement-Limitpushpowers)~~ [use branch permissions](https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html) to prevent users from pushing to a branch dire... |
18157583 | git credential.helper=cache never forgets the password? | 15 | 2013-08-10 00:48:29 | <p>I want my password to be forgotten, so I have to type it again.</p>
<p>I have setup this:</p>
<pre><code>git config credential.helper 'cache --timeout=600'
</code></pre>
<p>but much later on, several days, it still remembers the password and does not ask me it again...</p>
<p>git version 1.7.10.4 (at Ubuntu)</p>... | 28,607 | 1,422,630 | 2013-08-30 23:42:43 | 18,542,920 | 36 | 2013-08-30 23:36:35 | 1,639,707 | 2013-08-30 23:42:43 | https://stackoverflow.com/q/18157583 | https://stackoverflow.com/a/18542920 | <p><strong>Problem 1</strong>: "want my password to be forgotten" by git</p>
<p><strong>Problem 2 (implied)</strong>: contradictory configuration settings</p>
<p><strong>Answer</strong>:</p>
<pre><code>git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --un... | <p><strong>Problem 1</strong>: "want my password to be forgotten" by git</p> <p><strong>Problem 2 (implied)</strong>: contradictory configuration settings</p> <p><strong>Answer</strong>:</p> <pre><code>git config --unset-all credential.helper git config --global --unset-all credential.helper git config --system --un... | 119, 1763, 5357, 7687 | caching, credentials, git, helper | <h1>git credential.helper=cache never forgets the password?</h1>
<p>I want my password to be forgotten, so I have to type it again.</p>
<p>I have setup this:</p>
<pre><code>git config credential.helper 'cache --timeout=600'
</code></pre>
<p>but much later on, several days, it still remembers the password and does no... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,397 | git | # git credential.helper=cache never forgets the password?
I want my password to be forgotten, so I have to type it again.
I have setup this:
```
git config credential.helper 'cache --timeout=600'
```
but much later on, several days, it still remembers the password and does not ask me it again...
git version 1.7.10... | **Problem 1**: "want my password to be forgotten" by git
**Problem 2 (implied)**: contradictory configuration settings
**Answer**:
```
git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper
```
**Explanation:**
Git configuration i... |
12861224 | how to completely replace code in a git repository | 15 | 2012-10-12 14:29:00 | <p>I have a Facebook application on my local machine and another created with Heroku (the code in the Heroku application was created automatically by Heroku). I'd like to completely replace the code within the Heroku application with the code on my local machine. I've already initialized a git repository in the directo... | 6,060 | 259,288 | 2012-10-12 14:33:38 | 12,861,308 | 36 | 2012-10-12 14:33:38 | 972,789 | 2012-10-12 14:33:38 | https://stackoverflow.com/q/12861224 | https://stackoverflow.com/a/12861308 | <p>you could force it</p>
<pre><code>git push -f origin master
</code></pre>
<p>taken from <a href="https://devcenter.heroku.com/articles/git" rel="noreferrer">https://devcenter.heroku.com/articles/git</a></p>
| <p>you could force it</p> <pre><code>git push -f origin master </code></pre> <p>taken from <a href="https://devcenter.heroku.com/articles/git" rel="noreferrer">https://devcenter.heroku.com/articles/git</a></p> | 119, 8279 | git, heroku | <h1>how to completely replace code in a git repository</h1>
<p>I have a Facebook application on my local machine and another created with Heroku (the code in the Heroku application was created automatically by Heroku). I'd like to completely replace the code within the Heroku application with the code on my local machi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,398 | git | # how to completely replace code in a git repository
I have a Facebook application on my local machine and another created with Heroku (the code in the Heroku application was created automatically by Heroku). I'd like to completely replace the code within the Heroku application with the code on my local machine. I've ... | you could force it
```
git push -f origin master
```
taken from <https://devcenter.heroku.com/articles/git> |
7299237 | how can I do a git pull in the gitg / gitx visual tool? | 15 | 2011-09-04 12:33:33 | <p>I can do a push using gitg and push my code to the remote master branch but I can't see any option to do a git <strong>pull</strong>.</p>
<p>I am on Ubuntu 10 and 11</p>
| 25,071 | 631,619 | 2016-04-28 03:37:00 | 7,307,508 | 36 | 2011-09-05 11:39:51 | 11,343 | 2011-09-05 11:46:15 | https://stackoverflow.com/q/7299237 | https://stackoverflow.com/a/7307508 | <p>You cannot directly pull from <code>git gui</code>, but given than a <code>pull</code> is a <code>fetch</code> followed by a <code>merge</code>, you can fetch the remote (in the remote menu and <code>fetch from</code>), and then merge the remote branch into yours (Merge menu and <code>Local merge</code>, select <co... | <p>You cannot directly pull from <code>git gui</code>, but given than a <code>pull</code> is a <code>fetch</code> followed by a <code>merge</code>, you can fetch the remote (in the remote menu and <code>fetch from</code>), and then merge the remote branch into yours (Merge menu and <code>Local merge</code>, select <co... | 119, 37258, 41346, 78482 | git, gitg, git-remote, gitx | <h1>how can I do a git pull in the gitg / gitx visual tool?</h1>
<p>I can do a push using gitg and push my code to the remote master branch but I can't see any option to do a git <strong>pull</strong>.</p>
<p>I am on Ubuntu 10 and 11</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,399 | git | # how can I do a git pull in the gitg / gitx visual tool?
I can do a push using gitg and push my code to the remote master branch but I can't see any option to do a git **pull**.
I am on Ubuntu 10 and 11 | You cannot directly pull from `git gui`, but given than a `pull` is a `fetch` followed by a `merge`, you can fetch the remote (in the remote menu and `fetch from`), and then merge the remote branch into yours (Merge menu and `Local merge`, select `tracking branch`). |
7270802 | What's the use of `-u` in `git push -u origin master`? | 15 | 2011-09-01 13:11:31 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5697750/what-exactly-does-the-u-do-git-push-u-origin-master-vs-git-push-origin-mas">What exactly does the "u" do? "git push -u origin master" vs "git push origin master"</a> </p>
</bl... | 7,686 | 740,014 | 2011-09-01 13:19:17 | 7,270,918 | 36 | 2011-09-01 13:19:17 | 223,092 | 2011-09-01 13:19:17 | https://stackoverflow.com/q/7270802 | https://stackoverflow.com/a/7270918 | <p>git can set a particular branch in a remote repository to be the default "upstream" branch for that particular branch. For example, if you clone an existing repository, git will, by default, associate your <code>master</code> branch with the <code>master</code> branch in the <code>origin</code> repository, i.e. the... | <p>git can set a particular branch in a remote repository to be the default "upstream" branch for that particular branch. For example, if you clone an existing repository, git will, by default, associate your <code>master</code> branch with the <code>master</code> branch in the <code>origin</code> repository, i.e. the... | 119 | git | <h1>What's the use of `-u` in `git push -u origin master`?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5697750/what-exactly-does-the-u-do-git-push-u-origin-master-vs-git-push-origin-mas">What exactly does the "u" do? "git push -u origin m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,400 | git | # What's the use of `-u` in `git push -u origin master`?
> **Possible Duplicate:**
> [What exactly does the "u" do? "git push -u origin master" vs "git push origin master"](https://stackoverflow.com/questions/5697750/what-exactly-does-the-u-do-git-push-u-origin-master-vs-git-push-origin-mas)
In Github, when you cre... | git can set a particular branch in a remote repository to be the default "upstream" branch for that particular branch. For example, if you clone an existing repository, git will, by default, associate your `master` branch with the `master` branch in the `origin` repository, i.e. the one you're cloning from. This means ... |
72574209 | git pull error: cannot lock ref 'ref/remotes/origin/xxx' ... exists; cannot create | 14 | 2022-06-10 12:19:44 | <p>I have done several git pulls today, without issue.I have not changed or modified anything locally.</p>
<p>Now I do another git pull, and out of the blue get this:</p>
<pre><code>error: cannot lock ref 'refs/remotes/origin/task/DEV-2527/DEV-2535': 'refs/remotes/origin/task/DEV-2527' exists; cannot create 'refs/remot... | 40,927 | 1,072,187 | 2025-06-23 06:59:13 | 72,575,583 | 36 | 2022-06-10 14:01:42 | 1,072,187 | 2024-06-10 08:15:33 | https://stackoverflow.com/q/72574209 | https://stackoverflow.com/a/72575583 | <pre><code>git fetch --prune
</code></pre>
<p>Fixed it for me. A developer accidentally created a new branch with a path of an old branch. The old branch was later deleted on the origin, so presumably prune fixed this locally.</p>
<p>Thanks to <a href="https://stackoverflow.com/users/10662240/krzysiek-karbowiak">Krz... | <pre><code>git fetch --prune </code></pre> <p>Fixed it for me. A developer accidentally created a new branch with a path of an old branch. The old branch was later deleted on the origin, so presumably prune fixed this locally.</p> <p>Thanks to <a href="https://stackoverflow.com/users/10662240/krzysiek-karbowiak">Krz... | 119 | git | <h1>git pull error: cannot lock ref 'ref/remotes/origin/xxx' ... exists; cannot create</h1>
<p>I have done several git pulls today, without issue.I have not changed or modified anything locally.</p>
<p>Now I do another git pull, and out of the blue get this:</p>
<pre><code>error: cannot lock ref 'refs/remotes/origin/ta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,401 | git | # git pull error: cannot lock ref 'ref/remotes/origin/xxx' ... exists; cannot create
I have done several git pulls today, without issue.I have not changed or modified anything locally.
Now I do another git pull, and out of the blue get this:
```
error: cannot lock ref 'refs/remotes/origin/task/DEV-2527/DEV-2535': 'r... | ```
git fetch --prune
```
Fixed it for me. A developer accidentally created a new branch with a path of an old branch. The old branch was later deleted on the origin, so presumably prune fixed this locally.
Thanks to [Krzysiek Karbowiak](https://stackoverflow.com/users/10662240/krzysiek-karbowiak) for the help. |
19508849 | How to fix broken submodule config in git? | 14 | 2013-10-22 04:15:17 | <p>I'm hitting this git error with sub module creation. I initial had a bad URL in the command, now any additional runs show this error. Any ideas on what is wrong?</p>
<pre><code>$ git submodule add -f https://github.com/Shougo/vimproc.vim.git .vim/bundle/vimproc
Adding existing repo at '.vim/bundle/vimproc' to the i... | 19,315 | 64,313 | 2019-11-09 18:17:41 | 19,510,004 | 36 | 2013-10-22 05:55:06 | 2,859,666 | 2019-11-09 18:17:41 | https://stackoverflow.com/q/19508849 | https://stackoverflow.com/a/19510004 | <p>Maybe the submodules were added to the index. You should remove them from the index.</p>
<p>To remove a submodule completely, perform following steps:</p>
<p>1 remove these lines from <code>.git/config</code></p>
<pre><code>[submodule ".vim/bundle/vimproc"]
url = https://github.com/Shougo/vimproc.vim.git
</co... | <p>Maybe the submodules were added to the index. You should remove them from the index.</p> <p>To remove a submodule completely, perform following steps:</p> <p>1 remove these lines from <code>.git/config</code></p> <pre><code>[submodule ".vim/bundle/vimproc"] url = https://github.com/Shougo/vimproc.vim.git </co... | 119, 41612 | git, git-submodules | <h1>How to fix broken submodule config in git?</h1>
<p>I'm hitting this git error with sub module creation. I initial had a bad URL in the command, now any additional runs show this error. Any ideas on what is wrong?</p>
<pre><code>$ git submodule add -f https://github.com/Shougo/vimproc.vim.git .vim/bundle/vimproc
Ad... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,403 | git | # How to fix broken submodule config in git?
I'm hitting this git error with sub module creation. I initial had a bad URL in the command, now any additional runs show this error. Any ideas on what is wrong?
```
$ git submodule add -f https://github.com/Shougo/vimproc.vim.git .vim/bundle/vimproc
Adding existing repo a... | Maybe the submodules were added to the index. You should remove them from the index.
To remove a submodule completely, perform following steps:
1 remove these lines from `.git/config`
```
[submodule ".vim/bundle/vimproc"]
url = https://github.com/Shougo/vimproc.vim.git
```
2 remove these lines from `.gitmodules... |
14087667 | Create a remote git repo from local folder | 14 | 2012-12-30 02:02:52 | <p>I think there must be an easier way to do this. Right now I find myself following these steps:</p>
<p><strong>On the remote:</strong></p>
<pre><code>mkdir my_repo
cd my_repo
git init --bare
</code></pre>
<p><strong>Then locally:</strong></p>
<pre><code>mv my_repo old_my_repo
git clone ssh://myserver/my_repo
mv o... | 31,165 | 966,023 | 2019-11-15 01:55:45 | 14,087,684 | 36 | 2012-12-30 02:07:31 | 846,273 | 2012-12-30 02:12:39 | https://stackoverflow.com/q/14087667 | https://stackoverflow.com/a/14087684 | <p>Unfortunately almost all steps are necessary, even though locally you can avoid to recreate the repo by cloning it.</p>
<p>Just init the repo and add a remote</p>
<pre><code>cd my_repo
git init
git remote add origin ssh://myserver/my_repo
git add .
git commit -m "Initial commit"
git push -u origin master
</code></... | <p>Unfortunately almost all steps are necessary, even though locally you can avoid to recreate the repo by cloning it.</p> <p>Just init the repo and add a remote</p> <pre><code>cd my_repo git init git remote add origin ssh://myserver/my_repo git add . git commit -m "Initial commit" git push -u origin master </code></... | 119 | git | <h1>Create a remote git repo from local folder</h1>
<p>I think there must be an easier way to do this. Right now I find myself following these steps:</p>
<p><strong>On the remote:</strong></p>
<pre><code>mkdir my_repo
cd my_repo
git init --bare
</code></pre>
<p><strong>Then locally:</strong></p>
<pre><code>mv my_re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,404 | git | # Create a remote git repo from local folder
I think there must be an easier way to do this. Right now I find myself following these steps:
**On the remote:**
```
mkdir my_repo
cd my_repo
git init --bare
```
**Then locally:**
```
mv my_repo old_my_repo
git clone ssh://myserver/my_repo
mv old_my_repo/* my_repo
rmdi... | Unfortunately almost all steps are necessary, even though locally you can avoid to recreate the repo by cloning it.
Just init the repo and add a remote
```
cd my_repo
git init
git remote add origin ssh://myserver/my_repo
git add .
git commit -m "Initial commit"
git push -u origin master
```
Note that the `-u` option... |
10135155 | Git - did init bare in wrong directory | 14 | 2012-04-13 04:16:29 | <p>I ran the <code>git --bare init</code> in a wrong directory(in the server). I see the files branches, config, deps etc., in that directory.. How do I undo it?</p>
| 9,869 | 500,865 | 2012-04-13 05:22:56 | 10,135,410 | 36 | 2012-04-13 04:52:29 | 1,286,639 | 2012-04-13 05:22:56 | https://stackoverflow.com/q/10135155 | https://stackoverflow.com/a/10135410 | <p>Since you performed a '--bare' init, there is no .git directory - instead the normal contents of the .git directory are directly in the parent directory. For example, the place where you did 'git init --bare' looks something like:</p>
<pre><code>$ git --bare init
Initialized empty Git repository in /Users/ebg/test... | <p>Since you performed a '--bare' init, there is no .git directory - instead the normal contents of the .git directory are directly in the parent directory. For example, the place where you did 'git init --bare' looks something like:</p> <pre><code>$ git --bare init Initialized empty Git repository in /Users/ebg/test... | 119, 5766, 64465 | git, git-bare, undo | <h1>Git - did init bare in wrong directory</h1>
<p>I ran the <code>git --bare init</code> in a wrong directory(in the server). I see the files branches, config, deps etc., in that directory.. How do I undo it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,405 | git | # Git - did init bare in wrong directory
I ran the `git --bare init` in a wrong directory(in the server). I see the files branches, config, deps etc., in that directory.. How do I undo it? | Since you performed a '--bare' init, there is no .git directory - instead the normal contents of the .git directory are directly in the parent directory. For example, the place where you did 'git init --bare' looks something like:
```
$ git --bare init
Initialized empty Git repository in /Users/ebg/test/foo/
$ ls
HEAD... |
49325013 | error: --mirror can't be combined with refspecs | 13 | 2018-03-16 16:01:57 | <p>I mirrored a git repository and deleted <code>application.properties</code> containing passwords from the <code>MyProject</code> repository. I can see the message under <code>Deleted files</code> and my file name below:</p>
<pre><code>$ java -jar bfg-1.13.0.jar --delete-files application.properties --no-blob-protec... | 14,660 | 5,320,351 | 2023-11-21 19:56:39 | 49,339,040 | 36 | 2018-03-17 16:12:21 | 8,705,432 | 2018-03-17 16:12:21 | https://stackoverflow.com/q/49325013 | https://stackoverflow.com/a/49339040 | <p>Since you said that you mirrored the repository, what's probably going on here is that the config option <code>remote.origin.mirror</code> is set. You can confirm this by running <code>git config remote.origin.mirror</code>, which will show you <code>true</code> if it's set.</p>
<p>The easiest thing to do in this ... | <p>Since you said that you mirrored the repository, what's probably going on here is that the config option <code>remote.origin.mirror</code> is set. You can confirm this by running <code>git config remote.origin.mirror</code>, which will show you <code>true</code> if it's set.</p> <p>The easiest thing to do in this ... | 119 | git | <h1>error: --mirror can't be combined with refspecs</h1>
<p>I mirrored a git repository and deleted <code>application.properties</code> containing passwords from the <code>MyProject</code> repository. I can see the message under <code>Deleted files</code> and my file name below:</p>
<pre><code>$ java -jar bfg-1.13.0.j... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,406 | git | # error: --mirror can't be combined with refspecs
I mirrored a git repository and deleted `application.properties` containing passwords from the `MyProject` repository. I can see the message under `Deleted files` and my file name below:
```
$ java -jar bfg-1.13.0.jar --delete-files application.properties --no-blob-pr... | Since you said that you mirrored the repository, what's probably going on here is that the config option `remote.origin.mirror` is set. You can confirm this by running `git config remote.origin.mirror`, which will show you `true` if it's set.
The easiest thing to do in this case is to run `git config --unset remote.or... |
8485451 | Git: Never Commit Changed Files (But still keep original revisioned.) | 12 | 2011-12-13 06:57:11 | <p>What is a good <em>git</em> practice to denote that a changed file should never be committed?</p>
<p>For example, for a WordPress theme development project, I am tracking the original WordPress files in <em>git</em>; and the <em>wp-config.php</em> config file, which contains local info that only pertains to the cur... | 2,749 | 583,539 | 2017-02-01 12:39:03 | 8,485,503 | 36 | 2011-12-13 07:03:57 | 6,309 | 2011-12-13 07:03:57 | https://stackoverflow.com/q/8485451 | https://stackoverflow.com/a/8485503 | <p>If you still want to keep <code>wp-config.php</code> versioned, but ignore any local change to it:</p>
<pre><code>git update-index --assume-unchanged wp-config.php
</code></pre>
<p>This is different that a .gitignore, which would only work if you <em>remove</em> first <code>wp-config.php</code> from the index: </p... | <p>If you still want to keep <code>wp-config.php</code> versioned, but ignore any local change to it:</p> <pre><code>git update-index --assume-unchanged wp-config.php </code></pre> <p>This is different that a .gitignore, which would only work if you <em>remove</em> first <code>wp-config.php</code> from the index: </p... | 119, 1286 | git, perforce | <h1>Git: Never Commit Changed Files (But still keep original revisioned.)</h1>
<p>What is a good <em>git</em> practice to denote that a changed file should never be committed?</p>
<p>For example, for a WordPress theme development project, I am tracking the original WordPress files in <em>git</em>; and the <em>wp-confi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,408 | git | # Git: Never Commit Changed Files (But still keep original revisioned.)
What is a good *git* practice to denote that a changed file should never be committed?
For example, for a WordPress theme development project, I am tracking the original WordPress files in *git*; and the *wp-config.php* config file, which contain... | If you still want to keep `wp-config.php` versioned, but ignore any local change to it:
```
git update-index --assume-unchanged wp-config.php
```
This is different that a .gitignore, which would only work if you *remove* first `wp-config.php` from the index:
```
git rm --cache `wp-config.php`
echo wp-config.php >> .... |
20105790 | .xcodeproj file is lost, cannot be opened after a branch merge | 11 | 2013-11-20 20:01:55 | <p>I just merged one of the feature branches into develop branch, and since then, when I open Xcode, the <code>.xcodeproj</code> file seems lost, all files in the project navigator are gone also. click on the <code>.xcodeproj</code> file I get the following alert: <code>The file couldn’t be opened.</code></p>
<p>This ... | 12,136 | 602,257 | 2021-05-13 11:35:43 | 20,106,061 | 36 | 2013-11-20 20:15:30 | 1,694,897 | 2013-11-20 20:15:30 | https://stackoverflow.com/q/20105790 | https://stackoverflow.com/a/20106061 | <p>This might be caused by unresolved merge conflicts. In that case the XML structure is broken, so Xcode can't read it.</p>
<p>In that case you can try this:</p>
<ul>
<li><p>In finder right click on the .xcodeproj and choose 'Show Package contents'.</p></li>
<li><p>Open project.pbxproj in an text editor (this is the... | <p>This might be caused by unresolved merge conflicts. In that case the XML structure is broken, so Xcode can't read it.</p> <p>In that case you can try this:</p> <ul> <li><p>In finder right click on the .xcodeproj and choose 'Show Package contents'.</p></li> <li><p>Open project.pbxproj in an text editor (this is the... | 119, 717, 908 | git, merge, xcode | <h1>.xcodeproj file is lost, cannot be opened after a branch merge</h1>
<p>I just merged one of the feature branches into develop branch, and since then, when I open Xcode, the <code>.xcodeproj</code> file seems lost, all files in the project navigator are gone also. click on the <code>.xcodeproj</code> file I get the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,409 | git | # .xcodeproj file is lost, cannot be opened after a branch merge
I just merged one of the feature branches into develop branch, and since then, when I open Xcode, the `.xcodeproj` file seems lost, all files in the project navigator are gone also. click on the `.xcodeproj` file I get the following alert: `The file coul... | This might be caused by unresolved merge conflicts. In that case the XML structure is broken, so Xcode can't read it.
In that case you can try this:
- In finder right click on the .xcodeproj and choose 'Show Package contents'.
- Open project.pbxproj in an text editor (this is the actual project file, and has to be va... |
65878595 | Invalid HTTP method in Traceback: Uvicorn | 8 | 2021-01-25 03:25:43 | <p>I am using uvicorn 0.11.8 and fastapi 0.61.1. My application is hosted in VPS. When I run the app in local server, such error is not reproducible. It shows correct message 404 Not found for methods not available but I couldn't figure out what is causing this issue in VPS (error in Traceback).
<a href="https://i.ss... | 16,359 | 6,189,499 | 2021-03-03 18:09:51 | 66,442,753 | 36 | 2021-03-02 15:58:21 | 2,121,777 | 2021-03-03 18:09:51 | https://stackoverflow.com/q/65878595 | https://stackoverflow.com/a/66442753 | <p>I was getting the same arcane <code>WARNING: Invalid HTTP request received.</code> error with an unhelpful stack trace. I tried all of the environment variable tweaks recommended and none worked (see <a href="https://github.com/tiangolo/fastapi/issues/680#issuecomment-621365894" rel="noreferrer">FastAPI issue #680<... | <p>I was getting the same arcane <code>WARNING: Invalid HTTP request received.</code> error with an unhelpful stack trace. I tried all of the environment variable tweaks recommended and none worked (see <a href="https://github.com/tiangolo/fastapi/issues/680#issuecomment-621365894" rel="noreferrer">FastAPI issue #680<... | 16, 37424, 97102, 138034, 138150 | digital-ocean, fastapi, linode, python, uvicorn | <h1>Invalid HTTP method in Traceback: Uvicorn</h1>
<p>I am using uvicorn 0.11.8 and fastapi 0.61.1. My application is hosted in VPS. When I run the app in local server, such error is not reproducible. It shows correct message 404 Not found for methods not available but I couldn't figure out what is causing this issue... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,411 | git | # Invalid HTTP method in Traceback: Uvicorn
I am using uvicorn 0.11.8 and fastapi 0.61.1. My application is hosted in VPS. When I run the app in local server, such error is not reproducible. It shows correct message 404 Not found for methods not available but I couldn't figure out what is causing this issue in VPS (er... | I was getting the same arcane `WARNING: Invalid HTTP request received.` error with an unhelpful stack trace. I tried all of the environment variable tweaks recommended and none worked (see [FastAPI issue #680](https://github.com/tiangolo/fastapi/issues/680#issuecomment-621365894), [uvicorn issue #441](https://github.co... |
11383094 | Unstaged changes left after git reset --hard | 425 | 2012-07-08 12:19:15 | <p>After <code>git reset --hard</code>, <code>git status</code> gives me files within the <code>Changes not staged for commit:</code> section.</p>
<p>I've also tried <code>git reset .</code>, <code>git checkout -- .</code> and <code>git checkout-index -f -a</code>, to no avail.</p>
<p>So, how can I get rid of those u... | 322,837 | 298,664 | 2025-11-13 15:10:04 | 11,383,501 | 35 | 2012-07-08 13:25:41 | 298,664 | 2012-07-08 15:20:15 | https://stackoverflow.com/q/11383094 | https://stackoverflow.com/a/11383501 | <p>Okay, I've kind of solved the problem.</p>
<p>It seemed that the <code>.gitattributes</code> file, containing:</p>
<pre><code>*.sln eol=crlf
*.vcproj eol=crlf
*.vcxproj* eol=crlf
</code></pre>
<p>made the project files appear unstaged. I am clueless why that is, and I'm really hoping that someone pri... | <p>Okay, I've kind of solved the problem.</p> <p>It seemed that the <code>.gitattributes</code> file, containing:</p> <pre><code>*.sln eol=crlf *.vcproj eol=crlf *.vcxproj* eol=crlf </code></pre> <p>made the project files appear unstaged. I am clueless why that is, and I'm really hoping that someone pri... | 119, 51381 | git, git-reset | <h1>Unstaged changes left after git reset --hard</h1>
<p>After <code>git reset --hard</code>, <code>git status</code> gives me files within the <code>Changes not staged for commit:</code> section.</p>
<p>I've also tried <code>git reset .</code>, <code>git checkout -- .</code> and <code>git checkout-index -f -a</code>,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,412 | git | # Unstaged changes left after git reset --hard
After `git reset --hard`, `git status` gives me files within the `Changes not staged for commit:` section.
I've also tried `git reset .`, `git checkout -- .` and `git checkout-index -f -a`, to no avail.
So, how can I get rid of those unstaged changes?
This seems to hit... | Okay, I've kind of solved the problem.
It seemed that the `.gitattributes` file, containing:
```
*.sln eol=crlf
*.vcproj eol=crlf
*.vcxproj* eol=crlf
```
made the project files appear unstaged. I am clueless why that is, and I'm really hoping that someone privy to the ways of git will give us a nice exp... |
3816040 | git: Apply changes introduced by commit in one repo to another repo | 167 | 2010-09-28 18:49:45 | <p>I have a <code>repo1</code> and <code>repo2</code> on local machine. They are very similar, but the latter is some kind of other branch (<code>repo1</code> is not maintained anymore).</p>
<pre><code>/path/to/repo1 $ git log HEAD~5..HEAD~4
<some_sha> Add: Introduce feature X
</code></pre>
<p>How to apply chan... | 77,238 | 234,780 | 2023-10-02 18:32:37 | 3,817,291 | 35 | 2010-09-28 21:49:59 | 46,058 | 2015-10-06 11:00:55 | https://stackoverflow.com/q/3816040 | https://stackoverflow.com/a/3817291 | <p>As a hack, you can try modifying <a href="https://git.wiki.kernel.org/index.php/GitTips#How_to_compare_two_local_repositories" rel="noreferrer">recipe for comparing commits in two different repositories on GitTips page</a>, i.e.:</p>
<pre><code>GIT_ALTERNATE_OBJECT_DIRECTORIES=../repo/.git/objects \
git cherry-pick... | <p>As a hack, you can try modifying <a href="https://git.wiki.kernel.org/index.php/GitTips#How_to_compare_two_local_repositories" rel="noreferrer">recipe for comparing commits in two different repositories on GitTips page</a>, i.e.:</p> <pre><code>GIT_ALTERNATE_OBJECT_DIRECTORIES=../repo/.git/objects \ git cherry-pick... | 119 | git | <h1>git: Apply changes introduced by commit in one repo to another repo</h1>
<p>I have a <code>repo1</code> and <code>repo2</code> on local machine. They are very similar, but the latter is some kind of other branch (<code>repo1</code> is not maintained anymore).</p>
<pre><code>/path/to/repo1 $ git log HEAD~5..HEAD~4
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,413 | git | # git: Apply changes introduced by commit in one repo to another repo
I have a `repo1` and `repo2` on local machine. They are very similar, but the latter is some kind of other branch (`repo1` is not maintained anymore).
```
/path/to/repo1 $ git log HEAD~5..HEAD~4
<some_sha> Add: Introduce feature X
```
How to apply... | As a hack, you can try modifying [recipe for comparing commits in two different repositories on GitTips page](https://git.wiki.kernel.org/index.php/GitTips#How_to_compare_two_local_repositories), i.e.:
```
GIT_ALTERNATE_OBJECT_DIRECTORIES=../repo/.git/objects \
git cherry-pick $(git --git-dir=../repo/.git rev-parse --... |
4908336 | Can Git track the movement of a single function from 1 file to another? How? | 84 | 2011-02-05 17:25:10 | <p>Several times, I have come across the statement that, if you move a single function from one file to another file, Git can track it. For example, <a href="https://stackoverflow.com/questions/1598759/git-and-mercurial-compare-and-contrast/1598812#1598812/">this entry</a> says, "Linus says that if you move a func... | 14,614 | 80,112 | 2025-04-30 07:29:31 | 10,664,943 | 35 | 2012-05-19 11:53:13 | 1,405,037 | 2020-11-28 21:07:07 | https://stackoverflow.com/q/4908336 | https://stackoverflow.com/a/10664943 | <p>This functionality is provided through <code>git blame -C <file></code>.</p>
<p>The <code>-C</code> option drives git into trying to find matches between addition or deletion of chunks of text in the file being reviewed and the files modified in the same changesets. Additional <code>-C -C</code>, or <code>-C -... | <p>This functionality is provided through <code>git blame -C <file></code>.</p> <p>The <code>-C</code> option drives git into trying to find matches between addition or deletion of chunks of text in the file being reviewed and the files modified in the same changesets. Additional <code>-C -C</code>, or <code>-C -... | 119, 9033, 47913 | git, git-diff, git-log | <h1>Can Git track the movement of a single function from 1 file to another? How?</h1>
<p>Several times, I have come across the statement that, if you move a single function from one file to another file, Git can track it. For example, <a href="https://stackoverflow.com/questions/1598759/git-and-mercurial-compare-and-co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,416 | git | # Can Git track the movement of a single function from 1 file to another? How?
Several times, I have come across the statement that, if you move a single function from one file to another file, Git can track it. For example, [this entry](https://stackoverflow.com/questions/1598759/git-and-mercurial-compare-and-contras... | This functionality is provided through `git blame -C <file>`.
The `-C` option drives git into trying to find matches between addition or deletion of chunks of text in the file being reviewed and the files modified in the same changesets. Additional `-C -C`, or `-C -C -C` extend the search.
Try for yourself in a test ... |
9000163 | git: list new files only | 72 | 2012-01-25 09:15:30 | <p>When I do a <code>git status</code> I get a list of files prefixed with <code>new file:</code> . How can I get only this list? I want to process this files in a simple loop in a little shell script.</p>
| 82,188 | 671,639 | 2022-02-24 10:08:06 | 9,000,390 | 35 | 2012-01-25 09:33:58 | 657,439 | 2012-01-25 09:33:58 | https://stackoverflow.com/q/9000163 | https://stackoverflow.com/a/9000390 | <p>I would use something like <code>git status --porcelain | grep "^A" | cut -c 4-</code></p>
| <p>I would use something like <code>git status --porcelain | grep "^A" | cut -c 4-</code></p> | 119, 6951 | git, status | <h1>git: list new files only</h1>
<p>When I do a <code>git status</code> I get a list of files prefixed with <code>new file:</code> . How can I get only this list? I want to process this files in a simple loop in a little shell script.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,417 | git | # git: list new files only
When I do a `git status` I get a list of files prefixed with `new file:` . How can I get only this list? I want to process this files in a simple loop in a little shell script. | I would use something like `git status --porcelain | grep "^A" | cut -c 4-` |
1269566 | Unable to determine upstream SVN information from HEAD history | 66 | 2009-08-13 01:20:16 | <p>Why do I get this error message?</p>
| 50,679 | 17,382 | 2023-05-15 15:01:26 | 3,445,081 | 35 | 2010-08-10 00:03:49 | 67,022 | 2023-01-24 23:49:14 | https://stackoverflow.com/q/1269566 | https://stackoverflow.com/a/3445081 | <p><em>(Posted Chad's "question" as an answer, fixed formatting and typos.)</em></p>
<p>There are a couple of causes for this error message.</p>
<p>The first, being the most common. You have two disjoint histories in your git repository: The history that you made in git, and the history from the remote svn re... | <p><em>(Posted Chad's "question" as an answer, fixed formatting and typos.)</em></p> <p>There are a couple of causes for this error message.</p> <p>The first, being the most common. You have two disjoint histories in your git repository: The history that you made in git, and the history from the remote svn re... | 119, 6452 | git, git-svn | <h1>Unable to determine upstream SVN information from HEAD history</h1>
<p>Why do I get this error message?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,418 | git | # Unable to determine upstream SVN information from HEAD history
Why do I get this error message? | *(Posted Chad's "question" as an answer, fixed formatting and typos.)*
There are a couple of causes for this error message.
The first, being the most common. You have two disjoint histories in your git repository: The history that you made in git, and the history from the remote svn repository.
To fix this, you need... |
13787109 | How to see changes to a file before commit? | 61 | 2012-12-09 11:49:54 | <p>I have tried <code>git commit -v</code></p>
<pre><code>ubuntu@ip:~/agile$ git commit -v
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: .htac... | 124,736 | 92,153 | 2012-12-09 13:40:56 | 13,787,170 | 35 | 2012-12-09 11:57:10 | 683,080 | 2012-12-09 12:08:42 | https://stackoverflow.com/q/13787109 | https://stackoverflow.com/a/13787170 | <p>Make sure you've staged some changes. Otherwise, <code>git commit -v</code> will show you a block similar to what you posted, but not do anything. You can stage changes manually with <code>git add</code>, or if the files are already versioned, you can use <code>git commit -a -v</code> to stage and commit the chang... | <p>Make sure you've staged some changes. Otherwise, <code>git commit -v</code> will show you a block similar to what you posted, but not do anything. You can stage changes manually with <code>git add</code>, or if the files are already versioned, you can use <code>git commit -a -v</code> to stage and commit the chang... | 119 | git | <h1>How to see changes to a file before commit?</h1>
<p>I have tried <code>git commit -v</code></p>
<pre><code>ubuntu@ip:~/agile$ git commit -v
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,419 | git | # How to see changes to a file before commit?
I have tried `git commit -v`
```
ubuntu@ip:~/agile$ git commit -v
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modifie... | Make sure you've staged some changes. Otherwise, `git commit -v` will show you a block similar to what you posted, but not do anything. You can stage changes manually with `git add`, or if the files are already versioned, you can use `git commit -a -v` to stage and commit the changes.
For example:
```
$ echo "more fo... |
7060401 | Working on git repo without cd into directory | 46 | 2011-08-14 23:19:48 | <p>How would I run git commands on a repo when I have not <code>cd</code>'d into that directory?</p>
<p>I.e. I want to run <code>git branch /repos/myrepo.git</code></p>
| 11,972 | 735,390 | 2020-08-13 17:26:17 | 7,060,432 | 35 | 2011-08-14 23:25:00 | 65,977 | 2011-08-15 00:07:40 | https://stackoverflow.com/q/7060401 | https://stackoverflow.com/a/7060432 | <blockquote>
<p><code>--git-dir=<path></code></p>
<p>Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.</p>
</blockquote>
<p><a href="http://www.kernel.org/pub/software/scm/git/d... | <blockquote> <p><code>--git-dir=<path></code></p> <p>Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.</p> </blockquote> <p><a href="http://www.kernel.org/pub/software/scm/git/d... | 119 | git | <h1>Working on git repo without cd into directory</h1>
<p>How would I run git commands on a repo when I have not <code>cd</code>'d into that directory?</p>
<p>I.e. I want to run <code>git branch /repos/myrepo.git</code></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,422 | git | # Working on git repo without cd into directory
How would I run git commands on a repo when I have not `cd`'d into that directory?
I.e. I want to run `git branch /repos/myrepo.git` | > `--git-dir=<path>`
>
> Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.
<http://www.kernel.org/pub/software/scm/git/docs/git.html>
Note that `<path>` above means the path to the actual g... |
39834729 | What does the "diff --git" output in "git diff" refer to? | 45 | 2016-10-03 15:05:40 | <p>When I run <code>git diff</code>, the output begins with:</p>
<pre><code>diff --git a/foo/bar b/foo/bar
</code></pre>
<p>If I try to run plain old <code>diff --git</code>, I'm told that the <code>--git</code> option doesn't exist (obviously, I guess, it would seem silly for a low-level tool to know about a specifi... | 28,581 | 6,199,611 | 2025-11-17 02:10:20 | 39,835,817 | 35 | 2016-10-03 16:03:58 | 827,263 | 2025-11-17 02:10:20 | https://stackoverflow.com/q/39834729 | https://stackoverflow.com/a/39835817 | <p>It's an "imaginary diff option", used to indicate to the reader that it's not <em>just</em> the output of running the <code>diff</code> command. For example, in git's own git repo:</p>
<pre><code>$ git diff HEAD~1..HEAD | head
diff --git Documentation/git.txt Documentation/git.txt
index bd659c4..7913fc2 10... | <p>It's an "imaginary diff option", used to indicate to the reader that it's not <em>just</em> the output of running the <code>diff</code> command. For example, in git's own git repo:</p> <pre><code>$ git diff HEAD~1..HEAD | head diff --git Documentation/git.txt Documentation/git.txt index bd659c4..7913fc2 10... | 119 | git | <h1>What does the "diff --git" output in "git diff" refer to?</h1>
<p>When I run <code>git diff</code>, the output begins with:</p>
<pre><code>diff --git a/foo/bar b/foo/bar
</code></pre>
<p>If I try to run plain old <code>diff --git</code>, I'm told that the <code>--git</code> option doesn't exist (obviously, I gues... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,424 | git | # What does the "diff --git" output in "git diff" refer to?
When I run `git diff`, the output begins with:
```
diff --git a/foo/bar b/foo/bar
```
If I try to run plain old `diff --git`, I'm told that the `--git` option doesn't exist (obviously, I guess, it would seem silly for a low-level tool to know about a specif... | It's an "imaginary diff option", used to indicate to the reader that it's not *just* the output of running the `diff` command. For example, in git's own git repo:
```
$ git diff HEAD~1..HEAD | head
diff --git Documentation/git.txt Documentation/git.txt
index bd659c4..7913fc2 100644
--- Documentation/git.txt
+++ Docume... |
9045435 | Search Git Commits Using Regex | 42 | 2012-01-28 13:04:19 | <p>I have a Git repository that contains hundreds of commits and several branches. How to search a particular commit that contains a certain string e.g. "helper function"? Ideally, the string can be denoted by a regex.</p>
| 28,288 | 583,539 | 2023-05-04 06:08:34 | 15,120,469 | 35 | 2013-02-27 19:18:36 | 583,539 | 2013-02-27 19:18:36 | https://stackoverflow.com/q/9045435 | https://stackoverflow.com/a/15120469 | <p>Credits go to <a href="https://stackoverflow.com/a/7124949/583539">this answer</a>:</p>
<pre><code>git log --all --grep='Build 0051'
# case insensitive
git log --all --grep='Build 0051' -i
</code></pre>
| <p>Credits go to <a href="https://stackoverflow.com/a/7124949/583539">this answer</a>:</p> <pre><code>git log --all --grep='Build 0051' # case insensitive git log --all --grep='Build 0051' -i </code></pre> | 18, 119, 1231 | command-line, git, regex | <h1>Search Git Commits Using Regex</h1>
<p>I have a Git repository that contains hundreds of commits and several branches. How to search a particular commit that contains a certain string e.g. "helper function"? Ideally, the string can be denoted by a regex.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,425 | git | # Search Git Commits Using Regex
I have a Git repository that contains hundreds of commits and several branches. How to search a particular commit that contains a certain string e.g. "helper function"? Ideally, the string can be denoted by a regex. | Credits go to [this answer](https://stackoverflow.com/a/7124949/583539):
```
git log --all --grep='Build 0051'
# case insensitive
git log --all --grep='Build 0051' -i
``` |
5713563 | Reasons for not working on the master branch in Git | 41 | 2011-04-19 08:25:01 | <p>So, I'm fairly new to git and I've after a bit of reading around over the last couple of weeks I've read a few people saying that the master branch shouldn't be changed but rather branched from and then merged to.</p>
<p>I'm happy enough to work with branches but was wondering for the reasons behind not working on ... | 18,651 | 578,642 | 2019-03-23 02:04:03 | 5,713,627 | 35 | 2011-04-19 08:31:08 | 112,968 | 2011-04-19 08:40:41 | https://stackoverflow.com/q/5713563 | https://stackoverflow.com/a/5713627 | <p>i guess the usual reasoning is, that the master branch should represent the 'stable' history of your code. use branches to experiment with new features, implement them, and when they have matured enough you can merge them back to master.</p>
<p>that way code in master will almost always build without problems, and ... | <p>i guess the usual reasoning is, that the master branch should represent the 'stable' history of your code. use branches to experiment with new features, implement them, and when they have matured enough you can merge them back to master.</p> <p>that way code in master will almost always build without problems, and ... | 119, 456, 1879, 3346 | branch, dvcs, git, version-control | <h1>Reasons for not working on the master branch in Git</h1>
<p>So, I'm fairly new to git and I've after a bit of reading around over the last couple of weeks I've read a few people saying that the master branch shouldn't be changed but rather branched from and then merged to.</p>
<p>I'm happy enough to work with bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,427 | git | # Reasons for not working on the master branch in Git
So, I'm fairly new to git and I've after a bit of reading around over the last couple of weeks I've read a few people saying that the master branch shouldn't be changed but rather branched from and then merged to.
I'm happy enough to work with branches but was won... | i guess the usual reasoning is, that the master branch should represent the 'stable' history of your code. use branches to experiment with new features, implement them, and when they have matured enough you can merge them back to master.
that way code in master will almost always build without problems, and can be mos... |
10878976 | Why does "git svn fetch" command seem to be stuck and does nothing? | 38 | 2012-06-04 09:20:12 | <p><strong>EDIT: Workaround.</strong>
Now we understand the issue, here is the solution: do</p>
<pre><code>git svn fetch -r REVISION:HEAD
</code></pre>
<p>where REVISION is the number of the svn commit of the branch creation.</p>
<hr>
<p>I've been happy using git svn to work on the trunk of my project for a while, ... | 14,336 | 1,060,205 | 2020-07-23 09:28:14 | 10,881,325 | 35 | 2012-06-04 12:32:11 | 1,435,156 | 2020-07-23 09:28:14 | https://stackoverflow.com/q/10878976 | https://stackoverflow.com/a/10881325 | <p>It becomes verbose after fetching the first relevant commit.</p>
<p>But until it fetches that commit, you can ensure the command is working properly by checking the <code>.git\svn\.metadata</code> file. The lines <code>branches-maxRev = 123</code> and <code>tags-maxRev = 123</code> will keep updating and increasing ... | <p>It becomes verbose after fetching the first relevant commit.</p> <p>But until it fetches that commit, you can ensure the command is working properly by checking the <code>.git\svn\.metadata</code> file. The lines <code>branches-maxRev = 123</code> and <code>tags-maxRev = 123</code> will keep updating and increasing ... | 119, 6452 | git, git-svn | <h1>Why does "git svn fetch" command seem to be stuck and does nothing?</h1>
<p><strong>EDIT: Workaround.</strong>
Now we understand the issue, here is the solution: do</p>
<pre><code>git svn fetch -r REVISION:HEAD
</code></pre>
<p>where REVISION is the number of the svn commit of the branch creation.</p>
<hr>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,428 | git | # Why does "git svn fetch" command seem to be stuck and does nothing?
**EDIT: Workaround.**
Now we understand the issue, here is the solution: do
```
git svn fetch -r REVISION:HEAD
```
where REVISION is the number of the svn commit of the branch creation.
---
I've been happy using git svn to work on the trunk of m... | It becomes verbose after fetching the first relevant commit.
But until it fetches that commit, you can ensure the command is working properly by checking the `.git\svn\.metadata` file. The lines `branches-maxRev = 123` and `tags-maxRev = 123` will keep updating and increasing their numbers as it works. |
41600326 | How to revert the second to last commit but not the last commit? | 37 | 2017-01-11 20:42:14 | <p>Say I have four commits <code>A-->B-->C-->D</code> but C was terribly misguided. How can I undo C without losing the changes from D? I understand the basic functionality of <a href="https://git-scm.com/docs/git-revert" rel="noreferrer">git-revert</a> and <a href="https://stackoverflow.com/a/927386/5937428">... | 29,908 | 5,937,428 | 2018-07-28 20:27:24 | 41,600,781 | 35 | 2017-01-11 21:12:50 | 82,294 | 2018-07-28 20:27:24 | https://stackoverflow.com/q/41600326 | https://stackoverflow.com/a/41600781 | <h2>Revert</h2>
<p>The <code>git revert</code> command is designed to do exactly this.</p>
<pre><code>git revert <hash for C>
</code></pre>
<p>This will create a new commit which reverses the change in C.</p>
<h2>Rewrite History</h2>
<p>You can also rewrite history. This is not generally recommended, and sh... | <h2>Revert</h2> <p>The <code>git revert</code> command is designed to do exactly this.</p> <pre><code>git revert <hash for C> </code></pre> <p>This will create a new commit which reverses the change in C.</p> <h2>Rewrite History</h2> <p>You can also rewrite history. This is not generally recommended, and sh... | 119 | git | <h1>How to revert the second to last commit but not the last commit?</h1>
<p>Say I have four commits <code>A-->B-->C-->D</code> but C was terribly misguided. How can I undo C without losing the changes from D? I understand the basic functionality of <a href="https://git-scm.com/docs/git-revert" rel="noreferrer... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,429 | git | # How to revert the second to last commit but not the last commit?
Say I have four commits `A-->B-->C-->D` but C was terribly misguided. How can I undo C without losing the changes from D? I understand the basic functionality of [git-revert](https://git-scm.com/docs/git-revert) and [undoing commits](https://stackoverf... | ## Revert
The `git revert` command is designed to do exactly this.
```
git revert <hash for C>
```
This will create a new commit which reverses the change in C.
## Rewrite History
You can also rewrite history. This is not generally recommended, and should only be used if you have a good reason to actually remove a... |
19362345 | git ls-files sort by modification time | 35 | 2013-10-14 14:17:09 | <p>How can I list files sorted by their modification time? </p>
<p>I want the git modification time, not the system modification time. For example, if I have a (committed) file <code>README</code>, then</p>
<pre><code>touch README
</code></pre>
<p>will change the system modification time... but the git status would ... | 13,867 | 749,514 | 2022-01-24 17:09:05 | 19,362,660 | 35 | 2013-10-14 14:32:58 | 2,235,132 | 2015-01-02 14:36:24 | https://stackoverflow.com/q/19362345 | https://stackoverflow.com/a/19362660 | <blockquote>
<p>Is there any option to <code>git ls-files</code> that would list files sorted by
their git modification time?</p>
</blockquote>
<p>I don't think so. One possible way would be to iterate over the files, get the timestamp using <code>git log</code>, and <code>sort</code> the output.</p>
<p>The foll... | <blockquote> <p>Is there any option to <code>git ls-files</code> that would list files sorted by their git modification time?</p> </blockquote> <p>I don't think so. One possible way would be to iterate over the files, get the timestamp using <code>git log</code>, and <code>sort</code> the output.</p> <p>The foll... | 119, 134 | git, sorting | <h1>git ls-files sort by modification time</h1>
<p>How can I list files sorted by their modification time? </p>
<p>I want the git modification time, not the system modification time. For example, if I have a (committed) file <code>README</code>, then</p>
<pre><code>touch README
</code></pre>
<p>will change the syste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,433 | git | # git ls-files sort by modification time
How can I list files sorted by their modification time?
I want the git modification time, not the system modification time. For example, if I have a (committed) file `README`, then
```
touch README
```
will change the system modification time... but the git status would rema... | > Is there any option to `git ls-files` that would list files sorted by
> their git modification time?
I don't think so. One possible way would be to iterate over the files, get the timestamp using `git log`, and `sort` the output.
The following might work for you:
```
while read file; do echo $(git log --pretty=for... |
30935689 | git: fatal: Cannot switch branch to a non-commit '12382' | 33 | 2015-06-19 10:19:17 | <p>Someone else on my team created a new git branch, committed and pushed to the usual remote that we work with. When I try to check out this branch, I get this:</p>
<pre><code>% git checkout 12382
fatal: Cannot switch branch to a non-commit '12382'
</code></pre>
<p>I have not had trouble checking out other branches... | 26,073 | 2,498,090 | 2021-11-03 20:59:56 | 30,935,796 | 35 | 2015-06-19 10:24:44 | 112,968 | 2017-04-18 15:52:35 | https://stackoverflow.com/q/30935689 | https://stackoverflow.com/a/30935796 | <p>Git is confused, because <code>12382</code> looks like a commit hash. Use the fully qualified name to checkout the branch:</p>
<pre><code>git checkout refs/heads/12382 --
</code></pre>
<p>or, if it's a remote branch:</p>
<pre><code>git checkout refs/remotes/origin/12382 --
</code></pre>
| <p>Git is confused, because <code>12382</code> looks like a commit hash. Use the fully qualified name to checkout the branch:</p> <pre><code>git checkout refs/heads/12382 -- </code></pre> <p>or, if it's a remote branch:</p> <pre><code>git checkout refs/remotes/origin/12382 -- </code></pre> | 119, 37230 | git, git-checkout | <h1>git: fatal: Cannot switch branch to a non-commit '12382'</h1>
<p>Someone else on my team created a new git branch, committed and pushed to the usual remote that we work with. When I try to check out this branch, I get this:</p>
<pre><code>% git checkout 12382
fatal: Cannot switch branch to a non-commit '12382'
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,437 | git | # git: fatal: Cannot switch branch to a non-commit '12382'
Someone else on my team created a new git branch, committed and pushed to the usual remote that we work with. When I try to check out this branch, I get this:
```
% git checkout 12382
fatal: Cannot switch branch to a non-commit '12382'
```
I have not had tro... | Git is confused, because `12382` looks like a commit hash. Use the fully qualified name to checkout the branch:
```
git checkout refs/heads/12382 --
```
or, if it's a remote branch:
```
git checkout refs/remotes/origin/12382 --
``` |
21608997 | What is git staging and why does Hg *ostensibly* not support it? | 31 | 2014-02-06 16:49:49 | <p>The <a href="https://www.mercurial-scm.org/wiki/GitConcepts#Git.27s_staging_area" rel="noreferrer">Hg docs</a> state that <code>hg</code> doesn't support an equivalent to git's index out of the box and suggests using extensions (record or mq) for similar behaviour.</p>
<p>First, I have very little field experience ... | 5,998 | 11,545 | 2021-08-12 21:39:09 | 21,609,107 | 35 | 2014-02-06 16:54:31 | 148,870 | 2014-02-06 17:02:43 | https://stackoverflow.com/q/21608997 | https://stackoverflow.com/a/21609107 | <p>The staging area (index) records <em>change snapshots</em>, not just a selection of files. For instance, you can modify file A to add <code>foo</code>, stage file A, then modify file A again to add <code>bar</code>. If you don't re-stage file A, then when you commit, <em>only</em> <code>foo</code> will be committed,... | <p>The staging area (index) records <em>change snapshots</em>, not just a selection of files. For instance, you can modify file A to add <code>foo</code>, stage file A, then modify file A again to add <code>bar</code>. If you don't re-stage file A, then when you commit, <em>only</em> <code>foo</code> will be committed,... | 119, 802, 8122, 20002 | git, mercurial, staging, tortoisehg | <h1>What is git staging and why does Hg *ostensibly* not support it?</h1>
<p>The <a href="https://www.mercurial-scm.org/wiki/GitConcepts#Git.27s_staging_area" rel="noreferrer">Hg docs</a> state that <code>hg</code> doesn't support an equivalent to git's index out of the box and suggests using extensions (record or mq) ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,438 | git | # What is git staging and why does Hg *ostensibly* not support it?
The [Hg docs](https://www.mercurial-scm.org/wiki/GitConcepts#Git.27s_staging_area) state that `hg` doesn't support an equivalent to git's index out of the box and suggests using extensions (record or mq) for similar behaviour.
First, I have very littl... | The staging area (index) records *change snapshots*, not just a selection of files. For instance, you can modify file A to add `foo`, stage file A, then modify file A again to add `bar`. If you don't re-stage file A, then when you commit, *only* `foo` will be committed, because the index has the snapshot of A when it w... |
9604485 | How do you see which commit deleted a file from the repo? | 30 | 2012-03-07 15:40:57 | <p>Since it is no longer in the repository, I can't do</p>
<pre><code>git log <filename>
</code></pre>
<p>I can run</p>
<pre><code>git log --diff-filter='D|R' <directory_that_contained_it>
</code></pre>
<p>but that is too much information and grepping it does not seem to list the file I'm looking for.<... | 10,513 | 21,075 | 2012-03-08 07:40:38 | 9,604,786 | 35 | 2012-03-07 15:55:49 | 1,120,728 | 2012-03-08 07:40:38 | https://stackoverflow.com/q/9604485 | https://stackoverflow.com/a/9604786 | <pre><code>git log -1 --stat -- <path/to/file>
</code></pre>
<p>I put the <code>--stat</code> in there so that you can verify that the file was deleted.</p>
| <pre><code>git log -1 --stat -- <path/to/file> </code></pre> <p>I put the <code>--stat</code> in there so that you can verify that the file was deleted.</p> | 119 | git | <h1>How do you see which commit deleted a file from the repo?</h1>
<p>Since it is no longer in the repository, I can't do</p>
<pre><code>git log <filename>
</code></pre>
<p>I can run</p>
<pre><code>git log --diff-filter='D|R' <directory_that_contained_it>
</code></pre>
<p>but that is too much informati... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,439 | git | # How do you see which commit deleted a file from the repo?
Since it is no longer in the repository, I can't do
```
git log <filename>
```
I can run
```
git log --diff-filter='D|R' <directory_that_contained_it>
```
but that is too much information and grepping it does not seem to list the file I'm looking for. | ```
git log -1 --stat -- <path/to/file>
```
I put the `--stat` in there so that you can verify that the file was deleted. |
9550447 | Is there a shortcut for git branch name? | 30 | 2012-03-03 22:31:55 | <p>I tend to have long branch names for git (e.g., step110_create_search_engine_to_replace_google). </p>
<p>How should I refer to it simply as step110 in checkout/commit statements?</p>
| 11,218 | 927,667 | 2023-01-21 20:09:49 | 9,550,532 | 35 | 2012-03-03 22:46:44 | 1,084,945 | 2012-03-08 11:55:21 | https://stackoverflow.com/q/9550447 | https://stackoverflow.com/a/9550532 | <p>If you're on a Unix-like system (Linux, Mac OS X, perhaps others), there's the <code>contrib/complete/git-completion.bash</code> bash auto-complete ruleset, which will let you auto-complete git commands (you can type <code>git checkout step110<tab></code> and your shell will autocomplete the branch-name. </p>
... | <p>If you're on a Unix-like system (Linux, Mac OS X, perhaps others), there's the <code>contrib/complete/git-completion.bash</code> bash auto-complete ruleset, which will let you auto-complete git commands (you can type <code>git checkout step110<tab></code> and your shell will autocomplete the branch-name. </p> ... | 119 | git | <h1>Is there a shortcut for git branch name?</h1>
<p>I tend to have long branch names for git (e.g., step110_create_search_engine_to_replace_google). </p>
<p>How should I refer to it simply as step110 in checkout/commit statements?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,440 | git | # Is there a shortcut for git branch name?
I tend to have long branch names for git (e.g., step110_create_search_engine_to_replace_google).
How should I refer to it simply as step110 in checkout/commit statements? | If you're on a Unix-like system (Linux, Mac OS X, perhaps others), there's the `contrib/complete/git-completion.bash` bash auto-complete ruleset, which will let you auto-complete git commands (you can type `git checkout step110<tab>` and your shell will autocomplete the branch-name.
To activate this:
- If you've got ... |
52819584 | Copying local git config into docker container | 29 | 2018-10-15 15:00:31 | <p>I'm using both docker and docker-compose to host what for the most part is a LAMP stack. I'd like to be able to use git inside one of my containers without it asking for my user.email and user.name on push after I build. Along with other things such as my push.default and branch settings. Is there any good way to ha... | 40,264 | 2,576,372 | 2022-01-24 16:40:19 | 52,827,029 | 35 | 2018-10-16 02:17:01 | 6,394,722 | 2018-10-16 02:17:01 | https://stackoverflow.com/q/52819584 | https://stackoverflow.com/a/52827029 | <blockquote>
<p>Is there any good way to have docker or docker-compose copy the results of git config --list to a file in the container, which I can then use with my entrypoint to setup the git config.</p>
</blockquote>
<p>You really needn't do that to reach your aims, there is a outbox solution:</p>
<p>For your ho... | <blockquote> <p>Is there any good way to have docker or docker-compose copy the results of git config --list to a file in the container, which I can then use with my entrypoint to setup the git config.</p> </blockquote> <p>You really needn't do that to reach your aims, there is a outbox solution:</p> <p>For your ho... | 58, 119, 90304, 110604 | docker, docker-compose, git, linux | <h1>Copying local git config into docker container</h1>
<p>I'm using both docker and docker-compose to host what for the most part is a LAMP stack. I'd like to be able to use git inside one of my containers without it asking for my user.email and user.name on push after I build. Along with other things such as my push.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,441 | git | # Copying local git config into docker container
I'm using both docker and docker-compose to host what for the most part is a LAMP stack. I'd like to be able to use git inside one of my containers without it asking for my user.email and user.name on push after I build. Along with other things such as my push.default a... | > Is there any good way to have docker or docker-compose copy the results of git config --list to a file in the container, which I can then use with my entrypoint to setup the git config.
You really needn't do that to reach your aims, there is a outbox solution:
For your host machine which run git, all the contents o... |
36123655 | What is the Git "alternates mechanism"? | 28 | 2016-03-21 05:20:45 | <p>I'm studying through <code>man gitglossary</code>, and this one term has eluded me—because it isn't defined in the glossary at all.</p>
<p>It's referred to only twice (asterisks added):</p>
<pre><code> alternate object database
Via the **alternates mechanism**, a repository can inherit part of its
... | 11,938 | 5,419,599 | 2023-08-03 09:44:46 | 36,123,844 | 35 | 2016-03-21 05:36:11 | 1,256,452 | 2016-03-21 05:36:11 | https://stackoverflow.com/q/36123655 | https://stackoverflow.com/a/36123844 | <p>The short answer is that you can point any existing git repository to any number of <em>additional</em> existing git repositories—specifically, to their <code>.git/objects</code> directories—after which your git will search for objects in both your own <code>.git/objects</code> directory <em>and</em> all the other l... | <p>The short answer is that you can point any existing git repository to any number of <em>additional</em> existing git repositories—specifically, to their <code>.git/objects</code> directories—after which your git will search for objects in both your own <code>.git/objects</code> directory <em>and</em> all the other l... | 119 | git | <h1>What is the Git "alternates mechanism"?</h1>
<p>I'm studying through <code>man gitglossary</code>, and this one term has eluded me—because it isn't defined in the glossary at all.</p>
<p>It's referred to only twice (asterisks added):</p>
<pre><code> alternate object database
Via the **alternates mechanis... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,444 | git | # What is the Git "alternates mechanism"?
I'm studying through `man gitglossary`, and this one term has eluded me—because it isn't defined in the glossary at all.
It's referred to only twice (asterisks added):
```
alternate object database
Via the **alternates mechanism**, a repository can inherit part of ... | The short answer is that you can point any existing git repository to any number of *additional* existing git repositories—specifically, to their `.git/objects` directories—after which your git will search for objects in both your own `.git/objects` directory *and* all the other listed ones (in listing order).
What's ... |
28192422 | Git warning: refname 'xxx' is ambiguous | 28 | 2015-01-28 12:35:21 | <p>I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ;</p>
<pre><code>git checkout master
git merge --no-ff hotfix-1
</code></pre>
<p>Created a tag for this point;</p>
<pre><code>git tag -a hotfix-1 -m ""
</code></pre>
<p>an... | 24,175 | 2,359,670 | 2021-05-28 09:32:38 | 28,205,895 | 35 | 2015-01-29 02:08:24 | 4,354,956 | 2015-01-29 02:08:24 | https://stackoverflow.com/q/28192422 | https://stackoverflow.com/a/28205895 | <p>From your original question it looks like you have a tag and a branch named <code>hotfix-1</code>. Of course, their actual names are <code>refs/tags/hotfix-1</code> and <code>refs/heads/hotfix-1</code> respectively, but Git allows you to use the shorthand, which in this case is ambiguous since Git allows you to use ... | <p>From your original question it looks like you have a tag and a branch named <code>hotfix-1</code>. Of course, their actual names are <code>refs/tags/hotfix-1</code> and <code>refs/heads/hotfix-1</code> respectively, but Git allows you to use the shorthand, which in this case is ambiguous since Git allows you to use ... | 119, 28897 | git, git-merge | <h1>Git warning: refname 'xxx' is ambiguous</h1>
<p>I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ;</p>
<pre><code>git checkout master
git merge --no-ff hotfix-1
</code></pre>
<p>Created a tag for this point;</p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,445 | git | # Git warning: refname 'xxx' is ambiguous
I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ;
```
git checkout master
git merge --no-ff hotfix-1
```
Created a tag for this point;
```
git tag -a hotfix-1 -m ""
```
and then I... | From your original question it looks like you have a tag and a branch named `hotfix-1`. Of course, their actual names are `refs/tags/hotfix-1` and `refs/heads/hotfix-1` respectively, but Git allows you to use the shorthand, which in this case is ambiguous since Git allows you to use any *committish* in the `git merge` ... |
6716355 | Why staging directory is also called Index/Git Index? | 28 | 2011-07-16 08:49:36 | <p>I was confused the naming of staging directory (Git Index) in Git. </p>
<p>Is there any special meaning such that it is called Index?
Why not just called Cache / or Temp directory so that we can understand more easily?</p>
<p>To me, index is sth which help us to search things faster, like indexing in DBMS,
how do... | 3,162 | 514,316 | 2012-09-18 19:14:54 | 6,718,135 | 35 | 2011-07-16 14:53:01 | 6,309 | 2011-07-16 14:53:01 | https://stackoverflow.com/q/6716355 | https://stackoverflow.com/a/6718135 | <p>The <a href="http://gitster.livejournal.com/39629.html" rel="noreferrer">article by the main Git maintainer Junio C. Hamano</a>, is instructive, for grasping the difference between cache and index:<br>
<sup>(emphasis mine)</sup></p>
<blockquote>
<p>When Linus started writing git, his aim was to allow him to repro... | <p>The <a href="http://gitster.livejournal.com/39629.html" rel="noreferrer">article by the main Git maintainer Junio C. Hamano</a>, is instructive, for grasping the difference between cache and index:<br> <sup>(emphasis mine)</sup></p> <blockquote> <p>When Linus started writing git, his aim was to allow him to repro... | 119, 68400 | git, git-index | <h1>Why staging directory is also called Index/Git Index?</h1>
<p>I was confused the naming of staging directory (Git Index) in Git. </p>
<p>Is there any special meaning such that it is called Index?
Why not just called Cache / or Temp directory so that we can understand more easily?</p>
<p>To me, index is sth which ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,446 | git | # Why staging directory is also called Index/Git Index?
I was confused the naming of staging directory (Git Index) in Git.
Is there any special meaning such that it is called Index?
Why not just called Cache / or Temp directory so that we can understand more easily?
To me, index is sth which help us to search things... | The [article by the main Git maintainer Junio C. Hamano](http://gitster.livejournal.com/39629.html), is instructive, for grasping the difference between cache and index:
(emphasis mine)
> When Linus started writing git, his aim was to allow him to reproduce each and every intermediate state produced by his original ... |
2945842 | Using git-svn (or similar) *just* to help out with an svn merge? | 28 | 2010-05-31 20:31:12 | <p>Some complex subversion merges are coming up in my project: big branches that have been apart for a long time. Svn gives too many conflicts - and some of them seem spurious.</p>
<hr>
<p>Given that <code>git</code> is praised for a superiour merge experience,
Would it be any good to use <code>git-svn</code> <em>jus... | 4,070 | 174,284 | 2012-10-06 02:04:56 | 2,981,745 | 35 | 2010-06-05 19:27:01 | 174,284 | 2011-02-18 19:26:43 | https://stackoverflow.com/q/2945842 | https://stackoverflow.com/a/2981745 | <p>Trying to answer my question: using git for svn merges seems promising.</p>
<p>Update: it's not just promising, it's a great success. In short, <a href="http://www.youtube.com/watch?v=4XpnKHJAok8#t=33m02s" rel="noreferrer">Linus was right</a>.</p>
<p>Just completed a huge merge of 2 svn branches that have been apa... | <p>Trying to answer my question: using git for svn merges seems promising.</p> <p>Update: it's not just promising, it's a great success. In short, <a href="http://www.youtube.com/watch?v=4XpnKHJAok8#t=33m02s" rel="noreferrer">Linus was right</a>.</p> <p>Just completed a huge merge of 2 svn branches that have been apa... | 63, 717, 4352, 6452, 34573 | git-svn, hgsubversion, merge, svk, svn | <h1>Using git-svn (or similar) *just* to help out with an svn merge?</h1>
<p>Some complex subversion merges are coming up in my project: big branches that have been apart for a long time. Svn gives too many conflicts - and some of them seem spurious.</p>
<hr>
<p>Given that <code>git</code> is praised for a superiour ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,447 | git | # Using git-svn (or similar) *just* to help out with an svn merge?
Some complex subversion merges are coming up in my project: big branches that have been apart for a long time. Svn gives too many conflicts - and some of them seem spurious.
---
Given that `git` is praised for a superiour merge experience,
Would it b... | Trying to answer my question: using git for svn merges seems promising.
Update: it's not just promising, it's a great success. In short, [Linus was right](http://www.youtube.com/watch?v=4XpnKHJAok8#t=33m02s).
Just completed a huge merge of 2 svn branches that have been apart for 1.5 years; 3k files were changed, got ... |
9447371 | Override author on git merge | 27 | 2012-02-25 19:38:23 | <p>Is there an option like <code>--author</code> of git-commit for git-merge?</p>
<p>We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment.</p>
<p>Anyway, we are a small team with cooperative initiative and we tell when ... | 14,303 | 854,868 | 2023-02-21 14:38:17 | 9,447,413 | 35 | 2012-02-25 19:43:12 | 43,582 | 2022-07-07 13:03:40 | https://stackoverflow.com/q/9447371 | https://stackoverflow.com/a/9447413 | <p>First, prevent the merge from creating the commit:</p>
<pre><code>git merge --no-commit …
</code></pre>
<p>Then, do the commit manually:</p>
<pre><code>git commit --author="A. U. Thor <a.u@thor.example.com>"
</code></pre>
| <p>First, prevent the merge from creating the commit:</p> <pre><code>git merge --no-commit … </code></pre> <p>Then, do the commit manually:</p> <pre><code>git commit --author="A. U. Thor <a.u@thor.example.com>" </code></pre> | 119, 456, 28897, 53847, 76220 | branching-and-merging, git, git-branch, git-merge, version-control | <h1>Override author on git merge</h1>
<p>Is there an option like <code>--author</code> of git-commit for git-merge?</p>
<p>We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment.</p>
<p>Anyway, we are a small team with co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,450 | git | # Override author on git merge
Is there an option like `--author` of git-commit for git-merge?
We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment.
Anyway, we are a small team with cooperative initiative and we tell... | First, prevent the merge from creating the commit:
```
git merge --no-commit …
```
Then, do the commit manually:
```
git commit --author="A. U. Thor <a.u@thor.example.com>"
``` |
5024402 | Git merge using recursive strategy and patience option | 27 | 2011-02-17 02:17:41 | <p>How to merge a branch with git using patience option provided by the recursive strategy? I'm using
git version 1.7.3.1.msysgit.0</p>
<p>Even docs are not consistent and, what's more, differ from what the actual command outputs. </p>
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="n... | 15,653 | 99,841 | 2021-08-31 22:35:46 | 5,103,768 | 35 | 2011-02-24 11:06:09 | 223,092 | 2011-02-24 14:37:23 | https://stackoverflow.com/q/5024402 | https://stackoverflow.com/a/5103768 | <p>The <code>--patience</code> option for <code>git merge-recursive</code> was introduced in commit <a href="https://github.com/git/git/commit/58a1ece478c6038a7eb0b6e494d563bd5e6d5978"><code>58a1ece478c6038a7eb0b6e494d563bd5e6d5978</code></a>. You can find out in a clone of <code>git.git</code> what versions contain t... | <p>The <code>--patience</code> option for <code>git merge-recursive</code> was introduced in commit <a href="https://github.com/git/git/commit/58a1ece478c6038a7eb0b6e494d563bd5e6d5978"><code>58a1ece478c6038a7eb0b6e494d563bd5e6d5978</code></a>. You can find out in a clone of <code>git.git</code> what versions contain t... | 119 | git | <h1>Git merge using recursive strategy and patience option</h1>
<p>How to merge a branch with git using patience option provided by the recursive strategy? I'm using
git version 1.7.3.1.msysgit.0</p>
<p>Even docs are not consistent and, what's more, differ from what the actual command outputs. </p>
<p><a href="http:/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,451 | git | # Git merge using recursive strategy and patience option
How to merge a branch with git using patience option provided by the recursive strategy? I'm using
git version 1.7.3.1.msysgit.0
Even docs are not consistent and, what's more, differ from what the actual command outputs.
[Docs say:](http://www.kernel.org/pub/s... | The `--patience` option for `git merge-recursive` was introduced in commit [`58a1ece478c6038a7eb0b6e494d563bd5e6d5978`](https://github.com/git/git/commit/58a1ece478c6038a7eb0b6e494d563bd5e6d5978). You can find out in a clone of `git.git` what versions contain this change with `git tag --contains 58a1ece478`:
```
v1.7.... |
3715031 | GIT: "fatal: unable to write new_index file" while commit | 27 | 2010-09-15 05:59:53 | <p>When I try to commit changes to local repo, I have got following message:<br>
fatal: unable to write new_index file </p>
| 33,579 | 428,148 | 2024-08-06 18:41:15 | 3,715,045 | 35 | 2010-09-15 06:02:59 | 6,309 | 2024-08-06 18:41:15 | https://stackoverflow.com/q/3715031 | https://stackoverflow.com/a/3715045 | <p>As this <a href="http://luhman.org/blog/2010/04/05/git-fatal-unable-write-newindex-file" rel="nofollow noreferrer">thread illustrates</a>, this is usually a disk space issue:</p>
<pre><code>$ git status
fatal: unable to write new_index file
</code></pre>
<blockquote>
<p>One cause of this that I found was that my fil... | <p>As this <a href="http://luhman.org/blog/2010/04/05/git-fatal-unable-write-newindex-file" rel="nofollow noreferrer">thread illustrates</a>, this is usually a disk space issue:</p> <pre><code>$ git status fatal: unable to write new_index file </code></pre> <blockquote> <p>One cause of this that I found was that my fil... | 119, 31409 | git, tortoisegit | <h1>GIT: "fatal: unable to write new_index file" while commit</h1>
<p>When I try to commit changes to local repo, I have got following message:<br>
fatal: unable to write new_index file </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,452 | git | # GIT: "fatal: unable to write new_index file" while commit
When I try to commit changes to local repo, I have got following message:
fatal: unable to write new_index file | As this [thread illustrates](http://luhman.org/blog/2010/04/05/git-fatal-unable-write-newindex-file), this is usually a disk space issue:
```
$ git status
fatal: unable to write new_index file
```
> One cause of this that I found was that my file system had run out of space.
> Finding large directories with somethi... |
48619276 | Actually undo git stash pop | 26 | 2018-02-05 09:26:00 | <p><a href="https://stackoverflow.com/questions/20038056/undo-git-stash-pop">This question</a> had the same title but it is <strong>NOT</strong> the same question. That question is really asking "Discard results of git stash pop". This question is actually </p>
<h2><strong>UNDO</strong> git stash pop</h2>
<p>in other... | 19,801 | null | 2018-02-05 16:02:45 | 48,619,473 | 35 | 2018-02-05 09:37:48 | 893 | 2018-02-05 09:37:48 | https://stackoverflow.com/q/48619276 | https://stackoverflow.com/a/48619473 | <p>In your example, to restore to the state before <code>git stash pop</code>, use:</p>
<pre><code>git reset --hard bar
</code></pre>
<p>This form of the <code>git reset</code> command restores the state of the index <em>and</em> the working directory to the head of the <code>bar</code> branch.</p>
<p>Because you ha... | <p>In your example, to restore to the state before <code>git stash pop</code>, use:</p> <pre><code>git reset --hard bar </code></pre> <p>This form of the <code>git reset</code> command restores the state of the index <em>and</em> the working directory to the head of the <code>bar</code> branch.</p> <p>Because you ha... | 119 | git | <h1>Actually undo git stash pop</h1>
<p><a href="https://stackoverflow.com/questions/20038056/undo-git-stash-pop">This question</a> had the same title but it is <strong>NOT</strong> the same question. That question is really asking "Discard results of git stash pop". This question is actually </p>
<h2><strong>UNDO</st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,454 | git | # Actually undo git stash pop
[This question](https://stackoverflow.com/questions/20038056/undo-git-stash-pop) had the same title but it is **NOT** the same question. That question is really asking "Discard results of git stash pop". This question is actually
## **UNDO** git stash pop
in other words
```
// in branc... | In your example, to restore to the state before `git stash pop`, use:
```
git reset --hard bar
```
This form of the `git reset` command restores the state of the index *and* the working directory to the head of the `bar` branch.
Because you had conflicts on the first `git stash pop`, the stash *remains* on the top o... |
5306031 | How can I pull all remote changes with rebase instead of merge? | 26 | 2011-03-14 23:54:37 | <p>I can pull changes using <code>git pull</code>, but it merges my local commits. Is there a <code>git rebase</code> equivalent with which I can pull in remote changes?</p>
| 8,532 | 286,802 | 2025-05-04 17:50:31 | 5,306,274 | 35 | 2011-03-15 00:38:09 | 1,864,976 | 2025-05-04 17:48:11 | https://stackoverflow.com/q/5306031 | https://stackoverflow.com/a/5306274 | <p>Yes, you can do <code>git pull --rebase</code>.</p>
<p>You can also set that to be the default pull behaviour when you track a branch with <code>git config branch.autosetuprebase always</code>. Replace "always" with "remote" or "local" if you want to do it to those specific types of bra... | <p>Yes, you can do <code>git pull --rebase</code>.</p> <p>You can also set that to be the default pull behaviour when you track a branch with <code>git config branch.autosetuprebase always</code>. Replace "always" with "remote" or "local" if you want to do it to those specific types of bra... | 119, 456, 4860, 8974 | git, pull, rebase, version-control | <h1>How can I pull all remote changes with rebase instead of merge?</h1>
<p>I can pull changes using <code>git pull</code>, but it merges my local commits. Is there a <code>git rebase</code> equivalent with which I can pull in remote changes?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,455 | git | # How can I pull all remote changes with rebase instead of merge?
I can pull changes using `git pull`, but it merges my local commits. Is there a `git rebase` equivalent with which I can pull in remote changes? | Yes, you can do `git pull --rebase`.
You can also set that to be the default pull behaviour when you track a branch with `git config branch.autosetuprebase always`. Replace "always" with "remote" or "local" if you want to do it to those specific types of branches that you're tracking.
Now all you have to do is `git p... |
56068823 | If we change `git config core.hooksPath`, how to revert back to default | 25 | 2019-05-09 23:30:26 | <p>By default, it looks like this is empty when run in a git repo root:</p>
<pre><code>git config core.hooksPath
</code></pre>
<p>If we change git config core.hooksPath to <code>git config core.hooksPath myhooks</code>, my question is - how do we change it back to the default? Should we unset the value (how?), or sho... | 18,312 | 1,223,975 | 2019-05-10 00:14:08 | 56,069,128 | 35 | 2019-05-10 00:14:08 | 8,705,432 | 2019-05-10 00:14:08 | https://stackoverflow.com/q/56068823 | https://stackoverflow.com/a/56069128 | <p>The answer depends on where it's set and what you want to change. If the option is set in your local repository and you want to undo it, then <code>git config --unset core.hooksPath</code> is sufficient to unset it, which will make Git pick the default option.</p>
<p>If the option is set in a higher level configura... | <p>The answer depends on where it's set and what you want to change. If the option is set in your local repository and you want to undo it, then <code>git config --unset core.hooksPath</code> is sufficient to unset it, which will make Git pick the default option.</p> <p>If the option is set in a higher level configura... | 119, 32868, 43087 | git, git-config, githooks | <h1>If we change `git config core.hooksPath`, how to revert back to default</h1>
<p>By default, it looks like this is empty when run in a git repo root:</p>
<pre><code>git config core.hooksPath
</code></pre>
<p>If we change git config core.hooksPath to <code>git config core.hooksPath myhooks</code>, my question is - ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,456 | git | # If we change `git config core.hooksPath`, how to revert back to default
By default, it looks like this is empty when run in a git repo root:
```
git config core.hooksPath
```
If we change git config core.hooksPath to `git config core.hooksPath myhooks`, my question is - how do we change it back to the default? Sho... | The answer depends on where it's set and what you want to change. If the option is set in your local repository and you want to undo it, then `git config --unset core.hooksPath` is sufficient to unset it, which will make Git pick the default option.
If the option is set in a higher level configuration (e.g., per-user ... |
19045751 | Git: Import commits from a repo to another repo | 25 | 2013-09-27 08:03:50 | <p>I have a big <code>Git</code> repository for a project for which I created a plug-in which also is source controller with <code>Git</code>. Recently I copied the plug-in's folder to the main project folder. Now I have a project folder source controlled with <code>Git</code> and the plug-in's folder which is also sou... | 12,843 | 1,007,758 | 2025-05-11 17:02:51 | 19,050,339 | 35 | 2013-09-27 12:04:48 | 1,430,772 | 2025-05-11 17:02:51 | https://stackoverflow.com/q/19045751 | https://stackoverflow.com/a/19050339 | <p>Open a command window in the project folder.</p>
<p>Make sure you're on a branch. e.g. <code>git checkout -b plugin-history</code></p>
<p>Add the plugin folder as a remote: <code>git remote add plugin ../path/to/plugin/repo</code></p>
<p>Fetch the hashes from the new remote: <code>git fetch plugin [main_branch]</cod... | <p>Open a command window in the project folder.</p> <p>Make sure you're on a branch. e.g. <code>git checkout -b plugin-history</code></p> <p>Add the plugin folder as a remote: <code>git remote add plugin ../path/to/plugin/repo</code></p> <p>Fetch the hashes from the new remote: <code>git fetch plugin [main_branch]</cod... | 119 | git | <h1>Git: Import commits from a repo to another repo</h1>
<p>I have a big <code>Git</code> repository for a project for which I created a plug-in which also is source controller with <code>Git</code>. Recently I copied the plug-in's folder to the main project folder. Now I have a project folder source controlled with <c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,457 | git | # Git: Import commits from a repo to another repo
I have a big `Git` repository for a project for which I created a plug-in which also is source controller with `Git`. Recently I copied the plug-in's folder to the main project folder. Now I have a project folder source controlled with `Git` and the plug-in's folder wh... | Open a command window in the project folder.
Make sure you're on a branch. e.g. `git checkout -b plugin-history`
Add the plugin folder as a remote: `git remote add plugin ../path/to/plugin/repo`
Fetch the hashes from the new remote: `git fetch plugin [main_branch]`
Bulk cherry-pick all the plugin history from the r... |
74566599 | How do I remove a Git worktree that contains a submodule? | 24 | 2022-11-24 22:03:14 | <p>Let’s say that I have a Git repo that contains a <a href="https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefsubmoduleasubmodule" rel="noreferrer">submodule</a>:</p>
<pre><code>$ mkdir main-worktree
$ cd main-worktree
$ git init
Initialized empty Git repository in /…/main-worktree/.git/
$ git s... | 7,419 | 7,593,853 | 2023-08-17 21:46:30 | 74,566,600 | 35 | 2022-11-24 22:03:14 | 7,593,853 | 2022-11-24 22:03:14 | https://stackoverflow.com/q/74566599 | https://stackoverflow.com/a/74566600 | <p><a href="https://git-scm.com/docs/git-worktree#Documentation/git-worktree.txt-remove" rel="noreferrer">You can use <code>--force</code> to remove a worktree that contains submodules:</a></p>
<pre class="lang-bash prettyprint-override"><code>git worktree remove --force <path-to-worktree-with-submodules>
</code>... | <p><a href="https://git-scm.com/docs/git-worktree#Documentation/git-worktree.txt-remove" rel="noreferrer">You can use <code>--force</code> to remove a worktree that contains submodules:</a></p> <pre class="lang-bash prettyprint-override"><code>git worktree remove --force <path-to-worktree-with-submodules> </code>... | 119, 41612, 117020 | git, git-submodules, git-worktree | <h1>How do I remove a Git worktree that contains a submodule?</h1>
<p>Let’s say that I have a Git repo that contains a <a href="https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefsubmoduleasubmodule" rel="noreferrer">submodule</a>:</p>
<pre><code>$ mkdir main-worktree
$ cd main-worktree
$ git init... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,458 | git | # How do I remove a Git worktree that contains a submodule?
Let’s say that I have a Git repo that contains a [submodule](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefsubmoduleasubmodule):
```
$ mkdir main-worktree
$ cd main-worktree
$ git init
Initialized empty Git repository in /…/main-wo... | [You can use `--force` to remove a worktree that contains submodules:](https://git-scm.com/docs/git-worktree#Documentation/git-worktree.txt-remove)
```
git worktree remove --force <path-to-worktree-with-submodules>
``` |
42559131 | How do you get `git grep` to return results without a pager? | 24 | 2017-03-02 15:15:17 | <p>How do you get <code>git grep</code> to return results without a pager? Grep does this by default. When I pipe <code>git grep</code> to cat: <code>git grep foo | cat</code> it does this but it loses the highlighting on the match. I want to keep the highlighting on the match without doing <code>git grep foo | cat | g... | 5,080 | 1,507,139 | 2023-10-10 18:40:44 | 42,559,737 | 35 | 2017-03-02 15:41:43 | 589,329 | 2023-10-10 18:40:44 | https://stackoverflow.com/q/42559131 | https://stackoverflow.com/a/42559737 | <p>You can either use the <code>--no-pager</code> parameter like <code>git --no-pager grep foo</code> or tell grep to always do the highlighting even if you pipe the result to some other process with <code>git grep --color=always foo | cat</code>. Or you can set the config option <code>core.pager</code> to <code>cat</c... | <p>You can either use the <code>--no-pager</code> parameter like <code>git --no-pager grep foo</code> or tell grep to always do the highlighting even if you pipe the result to some other process with <code>git grep --color=always foo | cat</code>. Or you can set the config option <code>core.pager</code> to <code>cat</c... | 119 | git | <h1>How do you get `git grep` to return results without a pager?</h1>
<p>How do you get <code>git grep</code> to return results without a pager? Grep does this by default. When I pipe <code>git grep</code> to cat: <code>git grep foo | cat</code> it does this but it loses the highlighting on the match. I want to keep th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,459 | git | # How do you get `git grep` to return results without a pager?
How do you get `git grep` to return results without a pager? Grep does this by default. When I pipe `git grep` to cat: `git grep foo | cat` it does this but it loses the highlighting on the match. I want to keep the highlighting on the match without doing ... | You can either use the `--no-pager` parameter like `git --no-pager grep foo` or tell grep to always do the highlighting even if you pipe the result to some other process with `git grep --color=always foo | cat`. Or you can set the config option `core.pager` to `cat` like `git -c core.pager=cat grep foo` or of course pe... |
41130886 | How to disable git pull.rebase (rebasing by default upon pull) | 24 | 2016-12-13 21:30:22 | <p>I tried setting </p>
<pre><code>git config --global pull.rebase false
</code></pre>
<p>and</p>
<pre><code>git config pull.rebase false
</code></pre>
<p>and when I run</p>
<pre><code>git config --global pull.rebase
</code></pre>
<p>or</p>
<pre><code>git config pull.rebase
</code></pre>
<p>I see false, but whe... | 60,083 | 621,366 | 2025-05-16 08:57:53 | 41,131,043 | 35 | 2016-12-13 21:41:39 | 1,256,452 | 2016-12-13 21:41:39 | https://stackoverflow.com/q/41130886 | https://stackoverflow.com/a/41131043 | <h3>The <em>best</em> way</h3>
<p>Don't use <code>git pull</code>. Just run <code>git fetch</code> and then when it's done, run <code>git merge</code>.</p>
<p>(This is also the best way to do rebase pulls: don't use <code>git pull</code>. <a href="https://www.youtube.com/watch?v=v79fYnuVzdI" rel="noreferrer">"This ... | <h3>The <em>best</em> way</h3> <p>Don't use <code>git pull</code>. Just run <code>git fetch</code> and then when it's done, run <code>git merge</code>.</p> <p>(This is also the best way to do rebase pulls: don't use <code>git pull</code>. <a href="https://www.youtube.com/watch?v=v79fYnuVzdI" rel="noreferrer">"This ... | 119 | git | <h1>How to disable git pull.rebase (rebasing by default upon pull)</h1>
<p>I tried setting </p>
<pre><code>git config --global pull.rebase false
</code></pre>
<p>and</p>
<pre><code>git config pull.rebase false
</code></pre>
<p>and when I run</p>
<pre><code>git config --global pull.rebase
</code></pre>
<p>or</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,460 | git | # How to disable git pull.rebase (rebasing by default upon pull)
I tried setting
```
git config --global pull.rebase false
```
and
```
git config pull.rebase false
```
and when I run
```
git config --global pull.rebase
```
or
```
git config pull.rebase
```
I see false, but when I run `git pull ...` it still is... | ### The *best* way
Don't use `git pull`. Just run `git fetch` and then when it's done, run `git merge`.
(This is also the best way to do rebase pulls: don't use `git pull`. ["This ... is wrong tool. Never use this."](https://www.youtube.com/watch?v=v79fYnuVzdI))
### The other way
Use `git pull --rebase=false`. The ... |
34678950 | Git branch has diverged after rebase, so why rebase? | 24 | 2016-01-08 14:05:58 | <p>Recently I came across the notification that my branch has diverged. That was when I made a feature branch, pushed it to remote, and did a rebase with master a few days later when I started working on it again.</p>
<pre><code>git checkout -b feature-branch
git push origin feature-branch:feature-branch
</code></pre>... | 20,163 | 5,269,999 | 2017-06-13 10:10:13 | 34,679,616 | 35 | 2016-01-08 14:41:33 | 6,309 | 2017-06-13 10:10:13 | https://stackoverflow.com/q/34678950 | https://stackoverflow.com/a/34679616 | <p>The idea is to rebase only if you haven't pushed yet, to replay your <em>local</em> commits.</p>
<p>As soon as you have pushed (and are working in a team), you should not rebase the branch on top of <code>master</code>, as it rewrites its SHA1, forcing you to force push the new state of the branch.</p>
<p><a href=... | <p>The idea is to rebase only if you haven't pushed yet, to replay your <em>local</em> commits.</p> <p>As soon as you have pushed (and are working in a team), you should not rebase the branch on top of <code>master</code>, as it rewrites its SHA1, forcing you to force push the new state of the branch.</p> <p><a href=... | 119, 1879, 28897, 29934 | branch, git, git-merge, git-rebase | <h1>Git branch has diverged after rebase, so why rebase?</h1>
<p>Recently I came across the notification that my branch has diverged. That was when I made a feature branch, pushed it to remote, and did a rebase with master a few days later when I started working on it again.</p>
<pre><code>git checkout -b feature-bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,461 | git | # Git branch has diverged after rebase, so why rebase?
Recently I came across the notification that my branch has diverged. That was when I made a feature branch, pushed it to remote, and did a rebase with master a few days later when I started working on it again.
```
git checkout -b feature-branch
git push origin f... | The idea is to rebase only if you haven't pushed yet, to replay your *local* commits.
As soon as you have pushed (and are working in a team), you should not rebase the branch on top of `master`, as it rewrites its SHA1, forcing you to force push the new state of the branch.
[ You'll find it on the "Team Explorer", at the bottom of the list of TFS projects. If you already have a local Git repository, simply add it using the `add` option. If you have access to a remo... |
16674503 | The diff tool in Visual Studio when using the Git Plugin | 24 | 2013-05-21 16:04:10 | <p>Microsoft has released a <a href="http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c">Git plugin for Visual Studio 2012</a>. I have found it to be excellent, but there doesn't seem to be any option to change the default Diff tool. Worse, I cannot do a diff at all on ascx codebehind ... | 16,043 | 672 | 2019-05-29 09:08:22 | 17,000,474 | 35 | 2013-06-08 14:26:20 | 55,948 | 2014-03-11 03:37:33 | https://stackoverflow.com/q/16674503 | https://stackoverflow.com/a/17000474 | <p>You have to change your local .gitconfig, rather than make the change through Visual Studio as you would with TFS</p>
<p><a href="https://gist.github.com/mkchandler/2377564">https://gist.github.com/mkchandler/2377564</a></p>
<pre><code>Add the following to your global .gitconfig file:
[diff]
tool = diffmerge
... | <p>You have to change your local .gitconfig, rather than make the change through Visual Studio as you would with TFS</p> <p><a href="https://gist.github.com/mkchandler/2377564">https://gist.github.com/mkchandler/2377564</a></p> <pre><code>Add the following to your global .gitconfig file: [diff] tool = diffmerge ... | 119, 33953, 105625 | git, git-difftool, visual-studio | <h1>The diff tool in Visual Studio when using the Git Plugin</h1>
<p>Microsoft has released a <a href="http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c">Git plugin for Visual Studio 2012</a>. I have found it to be excellent, but there doesn't seem to be any option to change the defaul... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,464 | git | # The diff tool in Visual Studio when using the Git Plugin
Microsoft has released a [Git plugin for Visual Studio 2012](http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c). I have found it to be excellent, but there doesn't seem to be any option to change the default Diff tool. Worse, I... | You have to change your local .gitconfig, rather than make the change through Visual Studio as you would with TFS
<https://gist.github.com/mkchandler/2377564>
```
Add the following to your global .gitconfig file:
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = \"C:\\Program Files\\SourceGear\\Common\\Di... |
20991138 | After moving git submodule to another directory it fails with error 'git status --porcelain' failed in submodule | 23 | 2014-01-08 09:07:31 | <p>Initially I had the following (simplified) repo structure:</p>
<pre><code>MyRepo
external1/MySub (git submodule)
.gitsubmodules
</code></pre>
<p>Where</p>
<pre><code>$ cat .gitsubmodules
[submodule "external1/MySub"]
path = external1/MySub
url = user@repo:/remoterepo/externals/MySub.git
</code></pre>... | 20,773 | 587,267 | 2018-06-29 23:25:50 | 20,991,180 | 35 | 2014-01-08 09:09:45 | 6,309 | 2018-06-29 23:25:50 | https://stackoverflow.com/q/20991138 | https://stackoverflow.com/a/20991180 | <blockquote>
<p>I simply moved the external1/MySub directory to external2/MySub</p>
</blockquote>
<p>Move as in <code>mv</code> (unix command), or <code>git mv</code> (git command)?</p>
<p>You need to move the <a href="https://stackoverflow.com/a/2227598/6309">special entry</a> of <a href="https://stackoverflow.com... | <blockquote> <p>I simply moved the external1/MySub directory to external2/MySub</p> </blockquote> <p>Move as in <code>mv</code> (unix command), or <code>git mv</code> (git command)?</p> <p>You need to move the <a href="https://stackoverflow.com/a/2227598/6309">special entry</a> of <a href="https://stackoverflow.com... | 119, 41612 | git, git-submodules | <h1>After moving git submodule to another directory it fails with error 'git status --porcelain' failed in submodule</h1>
<p>Initially I had the following (simplified) repo structure:</p>
<pre><code>MyRepo
external1/MySub (git submodule)
.gitsubmodules
</code></pre>
<p>Where</p>
<pre><code>$ cat .gitsubmodules... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,467 | git | # After moving git submodule to another directory it fails with error 'git status --porcelain' failed in submodule
Initially I had the following (simplified) repo structure:
```
MyRepo
external1/MySub (git submodule)
.gitsubmodules
```
Where
```
$ cat .gitsubmodules
[submodule "external1/MySub"]
path = e... | > I simply moved the external1/MySub directory to external2/MySub
Move as in `mv` (unix command), or `git mv` (git command)?
You need to move the [special entry](https://stackoverflow.com/a/2227598/6309) of [the index](https://stackoverflow.com/a/17442045/6309) representing the submodule for the parent repo.
Normall... |
9588111 | How do you git fetch then merge? "Error: Your local changes to the following files would be overwritten by merge" | 23 | 2012-03-06 16:47:51 | <p>Newbie Git question: I have a repo set up on bitbucket. I git fetched someone else's changes and would like to merge them with my own. However, when I try to git merge (or git merge origin/master), I get the message "error: Your local changes to the following files would be overwritten by merge:", and then a list of... | 29,588 | 817,963 | 2012-03-06 17:05:16 | 9,588,386 | 35 | 2012-03-06 17:05:16 | 106,205 | 2012-03-06 17:05:16 | https://stackoverflow.com/q/9588111 | https://stackoverflow.com/a/9588386 | <p>You can either commit your changes before you do the merge, or you stash them:</p>
<pre><code>git stash
git merge origin/master
git stash pop
</code></pre>
| <p>You can either commit your changes before you do the merge, or you stash them:</p> <pre><code>git stash git merge origin/master git stash pop </code></pre> | 119, 28897, 33720 | git, git-fetch, git-merge | <h1>How do you git fetch then merge? "Error: Your local changes to the following files would be overwritten by merge"</h1>
<p>Newbie Git question: I have a repo set up on bitbucket. I git fetched someone else's changes and would like to merge them with my own. However, when I try to git merge (or git merge origin/maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,468 | git | # How do you git fetch then merge? "Error: Your local changes to the following files would be overwritten by merge"
Newbie Git question: I have a repo set up on bitbucket. I git fetched someone else's changes and would like to merge them with my own. However, when I try to git merge (or git merge origin/master), I get... | You can either commit your changes before you do the merge, or you stash them:
```
git stash
git merge origin/master
git stash pop
``` |
52754063 | Git push failed due to husky pre-push on sourcetree | 22 | 2018-10-11 06:57:16 | <p>While pushing a react native project, I'm getting error due to husky pre-push failed</p>
<blockquote>
<p>husky > pre-push hook failed (add --no-verify to bypass)</p>
</blockquote>
<p>All these errors shown are lint errors like the below</p>
<pre><code>unused-vars
27:48 error Trailing spaces not allowed ... | 50,749 | 5,546,443 | 2022-10-28 07:23:39 | 53,720,038 | 35 | 2018-12-11 08:23:22 | 5,546,443 | 2022-10-28 07:23:39 | https://stackoverflow.com/q/52754063 | https://stackoverflow.com/a/53720038 | <p>The issue (even though it's not a real issue! ) is because of the hooks created by Husky. Husky is an npm package that lets you define npm scripts that correlate to local Git events such as a commit or push. And this helps in enforcing collaborative standards in a project. The quick solution, if you are too busy, is... | <p>The issue (even though it's not a real issue! ) is because of the hooks created by Husky. Husky is an npm package that lets you define npm scripts that correlate to local Git events such as a commit or push. And this helps in enforcing collaborative standards in a project. The quick solution, if you are too busy, is... | 119, 90056, 110853, 130301 | atlassian-sourcetree, git, git-husky, react-native | <h1>Git push failed due to husky pre-push on sourcetree</h1>
<p>While pushing a react native project, I'm getting error due to husky pre-push failed</p>
<blockquote>
<p>husky > pre-push hook failed (add --no-verify to bypass)</p>
</blockquote>
<p>All these errors shown are lint errors like the below</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,469 | git | # Git push failed due to husky pre-push on sourcetree
While pushing a react native project, I'm getting error due to husky pre-push failed
> husky > pre-push hook failed (add --no-verify to bypass)
All these errors shown are lint errors like the below
```
unused-vars
27:48 error Trailing spaces not allowed ... | The issue (even though it's not a real issue! ) is because of the hooks created by Husky. Husky is an npm package that lets you define npm scripts that correlate to local Git events such as a commit or push. And this helps in enforcing collaborative standards in a project. The quick solution, if you are too busy, is to... |
23140240 | git: How do I add a custom merge strategy? | 22 | 2014-04-17 18:00:45 | <p>I'm trying to add a custom merge strategy similar to the one in this question: <a href="https://stackoverflow.com/questions/7607125/git-merge-conflict-to-always-take-the-newest-file">Git merge conflict to always take the newest file</a></p>
<p>I've saved the script as <code>git-merge-latest.sh</code> and added the ... | 14,251 | 1,278,804 | 2014-04-17 22:03:10 | 23,140,455 | 35 | 2014-04-17 18:13:04 | 729,881 | 2014-04-17 22:03:10 | https://stackoverflow.com/q/23140240 | https://stackoverflow.com/a/23140455 | <p>In this case, you didn't configure a <em>merge strategy</em>, you configured a <em>merge driver</em>:</p>
<p>A merge strategy is a program that determines how two (or more) <em>commits</em> are merged. By default, <code>git merge</code> uses the "recursive" strategy, found in the program <code>git-merge-recursive<... | <p>In this case, you didn't configure a <em>merge strategy</em>, you configured a <em>merge driver</em>:</p> <p>A merge strategy is a program that determines how two (or more) <em>commits</em> are merged. By default, <code>git merge</code> uses the "recursive" strategy, found in the program <code>git-merge-recursive<... | 119, 717 | git, merge | <h1>git: How do I add a custom merge strategy?</h1>
<p>I'm trying to add a custom merge strategy similar to the one in this question: <a href="https://stackoverflow.com/questions/7607125/git-merge-conflict-to-always-take-the-newest-file">Git merge conflict to always take the newest file</a></p>
<p>I've saved the scrip... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,470 | git | # git: How do I add a custom merge strategy?
I'm trying to add a custom merge strategy similar to the one in this question: [Git merge conflict to always take the newest file](https://stackoverflow.com/questions/7607125/git-merge-conflict-to-always-take-the-newest-file)
I've saved the script as `git-merge-latest.sh` ... | In this case, you didn't configure a *merge strategy*, you configured a *merge driver*:
A merge strategy is a program that determines how two (or more) *commits* are merged. By default, `git merge` uses the "recursive" strategy, found in the program `git-merge-recursive`. By specifying the `--strategy <strategy>` flag... |
15730551 | Get new upstream branch with git | 22 | 2013-03-31 14:40:02 | <p>I've forked a repo and all of my work goes into that fork (my origin) and I merge branches upstream with pull requests. Pretty standard.</p>
<p>But now there's a new branch in the upstream repo and I can't quite figure out how to get that new branch locally and then push it to my origin. Here is my situation.</p>
... | 13,976 | 25,991 | 2013-04-05 14:09:33 | 15,731,197 | 35 | 2013-03-31 15:46:22 | 6,309 | 2013-04-05 14:09:33 | https://stackoverflow.com/q/15730551 | https://stackoverflow.com/a/15731197 | <p>This should be enough</p>
<pre><code># I prefer fetching everything from upstream
git fetch upstream
# Then I track the new remote branch with a local branch
git checkout -b 1.6.x --track upstream/1.6.x
git push origin 1.6.x
</code></pre>
<p>If there are update issues like:</p>
<pre><code>fatal: Cannot update pa... | <p>This should be enough</p> <pre><code># I prefer fetching everything from upstream git fetch upstream # Then I track the new remote branch with a local branch git checkout -b 1.6.x --track upstream/1.6.x git push origin 1.6.x </code></pre> <p>If there are update issues like:</p> <pre><code>fatal: Cannot update pa... | 119, 76220 | git, git-branch | <h1>Get new upstream branch with git</h1>
<p>I've forked a repo and all of my work goes into that fork (my origin) and I merge branches upstream with pull requests. Pretty standard.</p>
<p>But now there's a new branch in the upstream repo and I can't quite figure out how to get that new branch locally and then push it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,471 | git | # Get new upstream branch with git
I've forked a repo and all of my work goes into that fork (my origin) and I merge branches upstream with pull requests. Pretty standard.
But now there's a new branch in the upstream repo and I can't quite figure out how to get that new branch locally and then push it to my origin. H... | This should be enough
```
# I prefer fetching everything from upstream
git fetch upstream
# Then I track the new remote branch with a local branch
git checkout -b 1.6.x --track upstream/1.6.x
git push origin 1.6.x
```
If there are update issues like:
```
fatal: Cannot update paths and switch to branch '1.6.x' at th... |
4660521 | Recovering from a failed rebase | 22 | 2011-01-11 17:26:20 | <p>I'm using <code>git svn</code> to get some git goodness with the company-mandated svn server. I just had a rebase go horribly awry, and I"m trying to figure out the best way to recover. </p>
<p>Here's what happened:</p>
<ol>
<li><p>To start with, I had this</p>
<pre><code>---1 (master)
\--B--C--D--E (feature/... | 17,533 | 19,370 | 2011-01-11 17:55:10 | 4,660,856 | 35 | 2011-01-11 17:55:10 | 6,309 | 2011-01-11 17:55:10 | https://stackoverflow.com/q/4660521 | https://stackoverflow.com/a/4660856 | <p>You should have a look at <strong><a href="https://stackoverflow.com/questions/964876/head-and-orig-head-in-git"><code>ORIG_HEAD</code></a></strong></p>
<blockquote>
<p><code>ORIG_HEAD</code> is previous state of <code>HEAD</code>, set by commands that have possibly dangerous behavior, to be easy to revert them.<... | <p>You should have a look at <strong><a href="https://stackoverflow.com/questions/964876/head-and-orig-head-in-git"><code>ORIG_HEAD</code></a></strong></p> <blockquote> <p><code>ORIG_HEAD</code> is previous state of <code>HEAD</code>, set by commands that have possibly dangerous behavior, to be easy to revert them.<... | 119, 6452, 8974 | git, git-svn, rebase | <h1>Recovering from a failed rebase</h1>
<p>I'm using <code>git svn</code> to get some git goodness with the company-mandated svn server. I just had a rebase go horribly awry, and I"m trying to figure out the best way to recover. </p>
<p>Here's what happened:</p>
<ol>
<li><p>To start with, I had this</p>
<pre><code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,472 | git | # Recovering from a failed rebase
I'm using `git svn` to get some git goodness with the company-mandated svn server. I just had a rebase go horribly awry, and I"m trying to figure out the best way to recover.
Here's what happened:
1. To start with, I had this
```
---1 (master)
\--B--C--D--E (feature/fi... | You should have a look at **[`ORIG_HEAD`](https://stackoverflow.com/questions/964876/head-and-orig-head-in-git)**
> `ORIG_HEAD` is previous state of `HEAD`, set by commands that have possibly dangerous behavior, to be easy to revert them.
> It is less useful now that Git has reflog: `HEAD@{1}` is roughly equivalent ... |
4319290 | How do I search for all my git repositories on my Mac? | 22 | 2010-11-30 22:20:55 | <p>I'm curious where I've scattered my git repositories across my mac. I'm trying to figure out how I could do a search to find them all so I can organize my life a bit. How can I do this?</p>
| 31,660 | 264,881 | 2010-11-30 23:31:10 | 4,319,315 | 35 | 2010-11-30 22:23:19 | 27,604 | 2010-11-30 22:23:19 | https://stackoverflow.com/q/4319290 | https://stackoverflow.com/a/4319315 | <p>Find is your friend. a .git folder will exist in each of your repositories so finding the location of them will give you all your repos.</p>
<pre><code>find /Users/username -name ".git" -print
</code></pre>
| <p>Find is your friend. a .git folder will exist in each of your repositories so finding the location of them will give you all your repos.</p> <pre><code>find /Users/username -name ".git" -print </code></pre> | 119, 369 | git, macos | <h1>How do I search for all my git repositories on my Mac?</h1>
<p>I'm curious where I've scattered my git repositories across my mac. I'm trying to figure out how I could do a search to find them all so I can organize my life a bit. How can I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,473 | git | # How do I search for all my git repositories on my Mac?
I'm curious where I've scattered my git repositories across my mac. I'm trying to figure out how I could do a search to find them all so I can organize my life a bit. How can I do this? | Find is your friend. a .git folder will exist in each of your repositories so finding the location of them will give you all your repos.
```
find /Users/username -name ".git" -print
``` |
71420124 | How do I solve this empty git commit warning? | 20 | 2022-03-10 07:15:07 | <p>After pushing my code to the remote branch and creating a PR. I wanted to make some more changes to my code and then commit to the remote branch again</p>
<p>First, I started these steps:</p>
<pre><code>git add .
git commit -m "Remove semicolons, change to multi line returns"`
</code></pre>
<p>But then thi... | 32,476 | 17,156,530 | 2025-11-05 14:00:14 | 71,420,483 | 35 | 2022-03-10 07:49:49 | 1,057,485 | 2022-03-10 09:02:22 | https://stackoverflow.com/q/71420124 | https://stackoverflow.com/a/71420483 | <p>Look at the husky line on your screenshot, you have a pre-commit <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">hook</a> running here.</p>
<p>The reason it fires would have to be found in the hook itself, but it looks like the linting process deems that you changed only whitespac... | <p>Look at the husky line on your screenshot, you have a pre-commit <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">hook</a> running here.</p> <p>The reason it fires would have to be found in the hook itself, but it looks like the linting process deems that you changed only whitespac... | 119, 43087, 53850, 124263, 126368 | git, git-commit, githooks, husky, lint-staged | <h1>How do I solve this empty git commit warning?</h1>
<p>After pushing my code to the remote branch and creating a PR. I wanted to make some more changes to my code and then commit to the remote branch again</p>
<p>First, I started these steps:</p>
<pre><code>git add .
git commit -m "Remove semicolons, change to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,475 | git | # How do I solve this empty git commit warning?
After pushing my code to the remote branch and creating a PR. I wanted to make some more changes to my code and then commit to the remote branch again
First, I started these steps:
```
git add .
git commit -m "Remove semicolons, change to multi line returns"`
```
But ... | Look at the husky line on your screenshot, you have a pre-commit [hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) running here.
The reason it fires would have to be found in the hook itself, but it looks like the linting process deems that you changed only whitespace (check it with `git diff --staged` ... |
22046808 | How to ignore files using git-gui (tcl-tk) application? | 20 | 2014-02-26 16:04:57 | <p>I'm using the <code>git-gui</code> interface to manage my <code>git</code> project. Despite being ugly –<code>tcl-tk</code>– it's one of the most complete interface out there. </p>
<p>However, I can't find <strong>how to ignore files from this interface ?</strong></p>
<p><img src="https://i.sstatic.net/tRKYe.png" ... | 26,330 | 802,365 | 2018-03-01 06:14:32 | 33,036,624 | 35 | 2015-10-09 11:02:50 | 5,427,302 | 2015-10-19 09:54:22 | https://stackoverflow.com/q/22046808 | https://stackoverflow.com/a/33036624 | <p>the pragmatic way is, to add this to your <code>git</code> configuration:</p>
<pre><code>git config --global guitool."Add to .gitignore".cmd $'echo "\n$FILENAME" >> .gitignore & git add .gitignore'
git config --global guitool."Add to .gitignore".needsfile yes
git config --global guitool."Add to .gitignore... | <p>the pragmatic way is, to add this to your <code>git</code> configuration:</p> <pre><code>git config --global guitool."Add to .gitignore".cmd $'echo "\n$FILENAME" >> .gitignore & git add .gitignore' git config --global guitool."Add to .gitignore".needsfile yes git config --global guitool."Add to .gitignore... | 119, 25056, 33729 | git, git-gui, gitignore | <h1>How to ignore files using git-gui (tcl-tk) application?</h1>
<p>I'm using the <code>git-gui</code> interface to manage my <code>git</code> project. Despite being ugly –<code>tcl-tk</code>– it's one of the most complete interface out there. </p>
<p>However, I can't find <strong>how to ignore files from this interfa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,476 | git | # How to ignore files using git-gui (tcl-tk) application?
I'm using the `git-gui` interface to manage my `git` project. Despite being ugly –`tcl-tk`– it's one of the most complete interface out there.
However, I can't find **how to ignore files from this interface ?**
, how can I do a <code>git remote add origin http://github.com/user/repo</code> ?</p>
<p>To remove I do the following:</p>
<pre><code>StoredConfig config = git.getRepository().getConfig();
config.uns... | 8,888 | 405,013 | 2022-11-01 17:09:25 | 12,801,356 | 35 | 2012-10-09 13:37:27 | 405,013 | 2022-11-01 17:09:25 | https://stackoverflow.com/q/12799573 | https://stackoverflow.com/a/12801356 | <p>Managed it to work that way:</p>
<pre><code>Git git = new Git(localRepository);
StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "url", "http://github.com/user/repo");
config.save();
</code></pre>
| <p>Managed it to work that way:</p> <pre><code>Git git = new Git(localRepository); StoredConfig config = git.getRepository().getConfig(); config.setString("remote", "origin", "url", "http://github.com/user/repo"); config.save(); </code></pre> | 17, 119, 61058 | git, java, jgit | <h1>Add remote via JGit</h1>
<p>I playing around JGit, I could successfully remove a remote from some repository (<code>git remote rm origin</code>), how can I do a <code>git remote add origin http://github.com/user/repo</code> ?</p>
<p>To remove I do the following:</p>
<pre><code>StoredConfig config = git.getReposit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,478 | git | # Add remote via JGit
I playing around JGit, I could successfully remove a remote from some repository (`git remote rm origin`), how can I do a `git remote add origin http://github.com/user/repo` ?
To remove I do the following:
```
StoredConfig config = git.getRepository().getConfig();
config.unsetSection("remote", ... | Managed it to work that way:
```
Git git = new Git(localRepository);
StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "url", "http://github.com/user/repo");
config.save();
``` |
1937297 | What do I need to know about XML Signatures to get SAML working? | 20 | 2009-12-20 22:22:43 | <p>At work we have a web app that we'll need to interface with another company's web app using Single Sign On validated by SAML. Our web apps are written in PHP, and it's obviously irrelevant what language choice the other company is using. Nonetheless, I've needed to write a simple API that this other company can send... | 19,505 | 5,454 | 2018-04-26 15:45:20 | 1,937,391 | 35 | 2009-12-20 22:53:56 | 176,312 | 2018-04-26 15:45:20 | https://stackoverflow.com/q/1937297 | https://stackoverflow.com/a/1937391 | <p>Processing XML signatures is not really too difficult, if you are very familiar with XML, but there are a lot of details that have to be absolutely right or things don't work, so I probably wouldn't try writing my own implementation in this situation (I did implement it partially once, but that was for a different a... | <p>Processing XML signatures is not really too difficult, if you are very familiar with XML, but there are a lot of details that have to be absolutely right or things don't work, so I probably wouldn't try writing my own implementation in this situation (I did implement it partially once, but that was for a different a... | 5, 19, 13574, 17782, 71751 | digital-signature, php, saml, xml, xml-signature | <h1>What do I need to know about XML Signatures to get SAML working?</h1>
<p>At work we have a web app that we'll need to interface with another company's web app using Single Sign On validated by SAML. Our web apps are written in PHP, and it's obviously irrelevant what language choice the other company is using. Nonet... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,479 | git | # What do I need to know about XML Signatures to get SAML working?
At work we have a web app that we'll need to interface with another company's web app using Single Sign On validated by SAML. Our web apps are written in PHP, and it's obviously irrelevant what language choice the other company is using. Nonetheless, I... | Processing XML signatures is not really too difficult, if you are very familiar with XML, but there are a lot of details that have to be absolutely right or things don't work, so I probably wouldn't try writing my own implementation in this situation (I did implement it partially once, but that was for a different and ... |
1856654 | How to add and commit removals made with "rm" instead of "git rm"? | 20 | 2009-12-06 21:23:12 | <p>I deleted a bunch of files and directories from a Git repository using <code>rm</code>, the Finder, etc.</p>
<p>I'm looking for a Git command that'll record these to the index as marked for removal, as if I had called <code>git rm</code> on them.</p>
<p>I understand <code>git add -u</code> will do this, along with... | 9,760 | 13,989 | 2017-09-11 15:43:49 | 1,856,694 | 35 | 2009-12-06 21:34:27 | 123,109 | 2017-09-11 15:43:49 | https://stackoverflow.com/q/1856654 | https://stackoverflow.com/a/1856694 | <p>Without spaces in filenames:</p>
<pre><code>$ git rm `git ls-files -d`
</code></pre>
<p>More robust:</p>
<pre><code>$ git ls-files -z -d | xargs -0 --no-run-if-empty git rm
</code></pre>
| <p>Without spaces in filenames:</p> <pre><code>$ git rm `git ls-files -d` </code></pre> <p>More robust:</p> <pre><code>$ git ls-files -z -d | xargs -0 --no-run-if-empty git rm </code></pre> | 119, 456 | git, version-control | <h1>How to add and commit removals made with "rm" instead of "git rm"?</h1>
<p>I deleted a bunch of files and directories from a Git repository using <code>rm</code>, the Finder, etc.</p>
<p>I'm looking for a Git command that'll record these to the index as marked for removal, as if I had called <code>git rm</code> on... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,480 | git | # How to add and commit removals made with "rm" instead of "git rm"?
I deleted a bunch of files and directories from a Git repository using `rm`, the Finder, etc.
I'm looking for a Git command that'll record these to the index as marked for removal, as if I had called `git rm` on them.
I understand `git add -u` will... | Without spaces in filenames:
```
$ git rm `git ls-files -d`
```
More robust:
```
$ git ls-files -z -d | xargs -0 --no-run-if-empty git rm
``` |
51343304 | Git confusion ("Update" and "Pull") | 19 | 2018-07-14 20:54:12 | <p>I'm a bit confused about how to use IntelliJ's VCS options correctly.</p>
<p>We're working on a Git repo and I would like to understand how I can do the following in as few steps as possible:</p>
<ol>
<li>Stage and commit (prompt me for the "commit message")</li>
<li>Pull/Push and Merge (automatically reso... | 29,182 | 9,768,291 | 2020-11-25 20:02:16 | 51,344,482 | 35 | 2018-07-15 00:57:25 | 4,603,538 | 2018-07-15 01:35:10 | https://stackoverflow.com/q/51343304 | https://stackoverflow.com/a/51344482 | <p>You're asking 3 different questions, but I'm going to focus on the very last one (Update option).</p>
<p>First, I'd like to point out that the title (<code>Git confusion (“Update” and “Pull”)</code>) doesn't match with the answer you're looking for. <code>Update</code> is not a git command -- the <code>update</code... | <p>You're asking 3 different questions, but I'm going to focus on the very last one (Update option).</p> <p>First, I'd like to point out that the title (<code>Git confusion (“Update” and “Pull”)</code>) doesn't match with the answer you're looking for. <code>Update</code> is not a git command -- the <code>update</code... | 119, 8945 | git, intellij-idea | <h1>Git confusion ("Update" and "Pull")</h1>
<p>I'm a bit confused about how to use IntelliJ's VCS options correctly.</p>
<p>We're working on a Git repo and I would like to understand how I can do the following in as few steps as possible:</p>
<ol>
<li>Stage and commit (prompt me for the "commit message")</li... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,483 | git | # Git confusion ("Update" and "Pull")
I'm a bit confused about how to use IntelliJ's VCS options correctly.
We're working on a Git repo and I would like to understand how I can do the following in as few steps as possible:
1. Stage and commit (prompt me for the "commit message")
2. Pull/Push and Merge (automatically... | You're asking 3 different questions, but I'm going to focus on the very last one (Update option).
First, I'd like to point out that the title (`Git confusion (“Update” and “Pull”)`) doesn't match with the answer you're looking for. `Update` is not a git command -- the `update` you're referring to is a feature offered ... |
38754631 | Git GUI on Windows: merging conflicts | 19 | 2016-08-03 22:23:17 | <p>I am fluent with Git on the command line but for a specific project, I need to show others how to do things exclusively in the GUI environment. We are using Git for Windows (available at <a href="https://git-scm.com/download/win" rel="noreferrer">https://git-scm.com/download/win</a>).</p>
<p>I created a file and ad... | 54,298 | 1,527,248 | 2020-05-21 20:38:00 | 38,777,195 | 35 | 2016-08-04 20:51:53 | 1,527,248 | 2016-08-04 20:51:53 | https://stackoverflow.com/q/38754631 | https://stackoverflow.com/a/38777195 | <p>I found the answer. As annoying as it is, when you are doing anything other than conflict resolution, the <code>Stage Changed</code> button does what the <code>git add</code> command would do. But if you are resolving conflicts, you should not use that button (it actually doesn't work); instead you should use the fo... | <p>I found the answer. As annoying as it is, when you are doing anything other than conflict resolution, the <code>Stage Changed</code> button does what the <code>git add</code> command would do. But if you are resolving conflicts, you should not use that button (it actually doesn't work); instead you should use the fo... | 119, 33729, 62599 | git, git-gui, merge-conflict-resolution | <h1>Git GUI on Windows: merging conflicts</h1>
<p>I am fluent with Git on the command line but for a specific project, I need to show others how to do things exclusively in the GUI environment. We are using Git for Windows (available at <a href="https://git-scm.com/download/win" rel="noreferrer">https://git-scm.com/dow... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,484 | git | # Git GUI on Windows: merging conflicts
I am fluent with Git on the command line but for a specific project, I need to show others how to do things exclusively in the GUI environment. We are using Git for Windows (available at <https://git-scm.com/download/win>).
I created a file and added to the repository. Then had... | I found the answer. As annoying as it is, when you are doing anything other than conflict resolution, the `Stage Changed` button does what the `git add` command would do. But if you are resolving conflicts, you should not use that button (it actually doesn't work); instead you should use the following menu: `Commit > S... |
34163412 | How do I setup Carthage to use my own Frameworks that are in private repository like Stash (Bitbucket)? | 19 | 2015-12-08 18:34:54 | <p>I was wondering if there is something like <a href="https://guides.cocoapods.org/making/private-cocoapods.html" rel="noreferrer">private pods</a> in <code>Carthage</code>, I have a couple of frameworks and I'm currently using <code>git submodules</code>, I started using <code>Carthage</code> for a new project and is... | 15,003 | 1,985,044 | 2021-04-05 12:54:57 | 34,166,199 | 35 | 2015-12-08 21:18:30 | 1,985,044 | 2018-05-16 18:00:07 | https://stackoverflow.com/q/34163412 | https://stackoverflow.com/a/34166199 | <p>So I finally found out how to setup Carthage with a <code>Atlassian-Bitbucket</code> </p>
<p>on the <code>Cartfile</code> i Just need to define the dependency origin which is the git repository</p>
<p>Enterprise git repository like <code>Atlassian-Stash(Bitbucket)</code> </p>
<pre><code>git "https://stashRepo"
<... | <p>So I finally found out how to setup Carthage with a <code>Atlassian-Bitbucket</code> </p> <p>on the <code>Cartfile</code> i Just need to define the dependency origin which is the git repository</p> <p>Enterprise git repository like <code>Atlassian-Stash(Bitbucket)</code> </p> <pre><code>git "https://stashRepo" <... | 119, 8337, 83703, 109201 | bitbucket, bitbucket-server, carthage, git | <h1>How do I setup Carthage to use my own Frameworks that are in private repository like Stash (Bitbucket)?</h1>
<p>I was wondering if there is something like <a href="https://guides.cocoapods.org/making/private-cocoapods.html" rel="noreferrer">private pods</a> in <code>Carthage</code>, I have a couple of frameworks an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,485 | git | # How do I setup Carthage to use my own Frameworks that are in private repository like Stash (Bitbucket)?
I was wondering if there is something like [private pods](https://guides.cocoapods.org/making/private-cocoapods.html) in `Carthage`, I have a couple of frameworks and I'm currently using `git submodules`, I starte... | So I finally found out how to setup Carthage with a `Atlassian-Bitbucket`
on the `Cartfile` i Just need to define the dependency origin which is the git repository
Enterprise git repository like `Atlassian-Stash(Bitbucket)`
```
git "https://stashRepo"
```
it also works with `ssh://`
Or local project
```
git "file... |
13731144 | How to get a single .gitignore after git svn create-ignore | 19 | 2012-12-03 09:59:21 | <p>I have imported SVN repository with Git using:</p>
<pre><code>git svn clone --preserve-empty-dirs --stdlayout svn+ssh://... SVN.git
</code></pre>
<p>It did succeed in the end although on the way it did fail few times and I had to "restart" with</p>
<pre><code>git svn fetch
</code></pre>
<p>Yet it seems in the en... | 6,278 | 422,489 | 2012-12-05 19:43:51 | 13,731,145 | 35 | 2012-12-05 05:55:17 | 422,489 | 2012-12-05 05:55:17 | https://stackoverflow.com/q/13731144 | https://stackoverflow.com/a/13731145 | <p>I found a solution. You have to use <code>show-ignore</code> instead of <code>create-ignore</code> and save the output to a file.</p>
<p>So after cloning the repository execute following command:</p>
<pre><code>git svn show-ignore > .gitignore
</code></pre>
<p>from the repository root where you have the <code>... | <p>I found a solution. You have to use <code>show-ignore</code> instead of <code>create-ignore</code> and save the output to a file.</p> <p>So after cloning the repository execute following command:</p> <pre><code>git svn show-ignore > .gitignore </code></pre> <p>from the repository root where you have the <code>... | 63, 119, 6452 | git, git-svn, svn | <h1>How to get a single .gitignore after git svn create-ignore</h1>
<p>I have imported SVN repository with Git using:</p>
<pre><code>git svn clone --preserve-empty-dirs --stdlayout svn+ssh://... SVN.git
</code></pre>
<p>It did succeed in the end although on the way it did fail few times and I had to "restart" with</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,487 | git | # How to get a single .gitignore after git svn create-ignore
I have imported SVN repository with Git using:
```
git svn clone --preserve-empty-dirs --stdlayout svn+ssh://... SVN.git
```
It did succeed in the end although on the way it did fail few times and I had to "restart" with
```
git svn fetch
```
Yet it seem... | I found a solution. You have to use `show-ignore` instead of `create-ignore` and save the output to a file.
So after cloning the repository execute following command:
```
git svn show-ignore > .gitignore
```
from the repository root where you have the `.git` directory. |
7893854 | Gerrit recreating change-ids | 18 | 2011-10-25 18:12:47 | <p>I am using gerrit. I used the following command</p>
<pre><code>$ cd .git/hooks
$ scp -P 29418 demo@localhost:hooks/commit-msg .
$ cd ../..
</code></pre>
<p>This adds the change-id to my commit message, however if I amend to a commit it creates a NEW change-id. So when I push back to gerrit it's not adding the patc... | 42,663 | 418,859 | 2019-05-15 12:55:06 | 8,392,507 | 35 | 2011-12-05 22:02:27 | 377,095 | 2011-12-28 17:15:23 | https://stackoverflow.com/q/7893854 | https://stackoverflow.com/a/8392507 | <p>commit-msg hook work that way:</p>
<ol>
<li>Check if you have change-id in your commit message.</li>
<li>If not, generates one.</li>
</ol>
<p>If you type <code>git commit --amend</code> and edit commit message, you still have old change-id (it is good).</p>
<p>But if you type <code>git commit --amend -m "...."</c... | <p>commit-msg hook work that way:</p> <ol> <li>Check if you have change-id in your commit message.</li> <li>If not, generates one.</li> </ol> <p>If you type <code>git commit --amend</code> and edit commit message, you still have old change-id (it is good).</p> <p>But if you type <code>git commit --amend -m "...."</c... | 119, 52272 | gerrit, git | <h1>Gerrit recreating change-ids</h1>
<p>I am using gerrit. I used the following command</p>
<pre><code>$ cd .git/hooks
$ scp -P 29418 demo@localhost:hooks/commit-msg .
$ cd ../..
</code></pre>
<p>This adds the change-id to my commit message, however if I amend to a commit it creates a NEW change-id. So when I push b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,490 | git | # Gerrit recreating change-ids
I am using gerrit. I used the following command
```
$ cd .git/hooks
$ scp -P 29418 demo@localhost:hooks/commit-msg .
$ cd ../..
```
This adds the change-id to my commit message, however if I amend to a commit it creates a NEW change-id. So when I push back to gerrit it's not adding the... | commit-msg hook work that way:
1. Check if you have change-id in your commit message.
2. If not, generates one.
If you type `git commit --amend` and edit commit message, you still have old change-id (it is good).
But if you type `git commit --amend -m "...."` you have removed change-id, so gerrit generates new one.
... |
58037142 | how to use git diff show some invisible characters differences? | 17 | 2019-09-21 03:54:15 | <p>When I use <code>git diff</code>, I saw the differences like below:</p>
<pre><code>- self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
+ self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
</code></pre>
<p>And I'm sure there are no white backspace differe... | 7,276 | 7,701,908 | 2021-06-02 11:20:52 | 58,037,244 | 35 | 2019-09-21 04:17:29 | 373,815 | 2019-09-21 04:17:29 | https://stackoverflow.com/q/58037142 | https://stackoverflow.com/a/58037244 | <p>The <a href="https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---ws-error-highlightltkindgt" rel="noreferrer"><code>--ws-error-highlight</code> flag</a> might be useful.</p>
<pre><code>git diff --ws-error-highlight=all
</code></pre>
<p>Alternatively, you can pipe the <code>git diff</code> output to <cod... | <p>The <a href="https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---ws-error-highlightltkindgt" rel="noreferrer"><code>--ws-error-highlight</code> flag</a> might be useful.</p> <pre><code>git diff --ws-error-highlight=all </code></pre> <p>Alternatively, you can pipe the <code>git diff</code> output to <cod... | 119 | git | <h1>how to use git diff show some invisible characters differences?</h1>
<p>When I use <code>git diff</code>, I saw the differences like below:</p>
<pre><code>- self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
+ self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=F... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,491 | git | # how to use git diff show some invisible characters differences?
When I use `git diff`, I saw the differences like below:
```
- self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
+ self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
```
And I'm sure there ... | The [`--ws-error-highlight` flag](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---ws-error-highlightltkindgt) might be useful.
```
git diff --ws-error-highlight=all
```
Alternatively, you can pipe the `git diff` output to `cat` and use its `-A` flag to explicitly print a variety of non-printing charact... |
39450654 | How to ignore everything in a directory except one file | 16 | 2016-09-12 12:45:45 | <p>Repo structure:</p>
<pre><code>.gitignore
file1
file2
dir/
file3
<stuff>
</code></pre>
<p>I want to ignore everything inside <code>dir</code> except file 3. Here's what I have in my <code>.gitignore</code> file:</p>
<pre><code>dir/*
!dir/file3
</code></pre>
<p>But this doesn't seem to work. <code>g... | 14,447 | 1,826,627 | 2020-11-11 09:01:58 | 39,451,011 | 35 | 2016-09-12 13:04:59 | 3,795,597 | 2017-09-27 23:45:25 | https://stackoverflow.com/q/39450654 | https://stackoverflow.com/a/39451011 | <p>The right way to do it is:</p>
<pre><code>!dir
dir/*
!dir/file3
</code></pre>
<p>Note that there are other solutions, such as creating a local <code>.gitignore</code> file in <code>dir/</code>, which will take precedence over the previous one.</p>
<p>Curiously, I also tried your solution, and</p>
<pre><code>dir/... | <p>The right way to do it is:</p> <pre><code>!dir dir/* !dir/file3 </code></pre> <p>Note that there are other solutions, such as creating a local <code>.gitignore</code> file in <code>dir/</code>, which will take precedence over the previous one.</p> <p>Curiously, I also tried your solution, and</p> <pre><code>dir/... | 119 | git | <h1>How to ignore everything in a directory except one file</h1>
<p>Repo structure:</p>
<pre><code>.gitignore
file1
file2
dir/
file3
<stuff>
</code></pre>
<p>I want to ignore everything inside <code>dir</code> except file 3. Here's what I have in my <code>.gitignore</code> file:</p>
<pre><code>dir/*
!d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,493 | git | # How to ignore everything in a directory except one file
Repo structure:
```
.gitignore
file1
file2
dir/
file3
<stuff>
```
I want to ignore everything inside `dir` except file 3. Here's what I have in my `.gitignore` file:
```
dir/*
!dir/file3
```
But this doesn't seem to work. `git` still tries to index ... | The right way to do it is:
```
!dir
dir/*
!dir/file3
```
Note that there are other solutions, such as creating a local `.gitignore` file in `dir/`, which will take precedence over the previous one.
Curiously, I also tried your solution, and
```
dir/*
!dir/file3
```
Seems to work for me. If someone could comment on... |
35036774 | Git submodule status - how to show current branches in submodules | 16 | 2016-01-27 11:58:49 | <p>Checking status of submodules in main repository with this command:</p>
<pre><code>git submodule status
</code></pre>
<p>produces output (without clear information about branches):</p>
<pre><code>491e03096e2234dab9a9533da714fb6eff5dcaa7 vendor/submodule1 (v1.51.0-560-g491e030)
8bccab48338219e73c3118ad71c8c98fbd32... | 33,177 | 3,708,596 | 2020-04-20 08:52:31 | 35,046,222 | 35 | 2016-01-27 19:22:46 | 3,708,596 | 2016-01-27 19:22:46 | https://stackoverflow.com/q/35036774 | https://stackoverflow.com/a/35046222 | <p>Answer was hidden in <code>git submodule foreach</code>:</p>
<pre><code>git submodule foreach 'git status'
</code></pre>
<p>You can always make it simpler by assign this to alias:</p>
<pre><code>git config --global alias.sb "submodule foreach \"git status\""
</code></pre>
<p>Now <code>git sb</code> give you nice... | <p>Answer was hidden in <code>git submodule foreach</code>:</p> <pre><code>git submodule foreach 'git status' </code></pre> <p>You can always make it simpler by assign this to alias:</p> <pre><code>git config --global alias.sb "submodule foreach \"git status\"" </code></pre> <p>Now <code>git sb</code> give you nice... | 119, 41612 | git, git-submodules | <h1>Git submodule status - how to show current branches in submodules</h1>
<p>Checking status of submodules in main repository with this command:</p>
<pre><code>git submodule status
</code></pre>
<p>produces output (without clear information about branches):</p>
<pre><code>491e03096e2234dab9a9533da714fb6eff5dcaa7 ve... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,494 | git | # Git submodule status - how to show current branches in submodules
Checking status of submodules in main repository with this command:
```
git submodule status
```
produces output (without clear information about branches):
```
491e03096e2234dab9a9533da714fb6eff5dcaa7 vendor/submodule1 (v1.51.0-560-g491e030)
8bcca... | Answer was hidden in `git submodule foreach`:
```
git submodule foreach 'git status'
```
You can always make it simpler by assign this to alias:
```
git config --global alias.sb "submodule foreach \"git status\""
```
Now `git sb` give you nice information about your branches in submodules:
```
Entering 'vendor/sub... |
30556438 | Git cloning into current directory | 16 | 2015-05-31 10:37:21 | <p>I am trying to clone a repository into my current directory. However, when I clone it with this command:</p>
<pre><code>git clone REPOURL .
</code></pre>
<p>it says:</p>
<pre><code>fatal: destination path '.' already exists and is not an empty directory.
</code></pre>
<p>The folders that I am cloning into alrea... | 21,720 | 1,318,584 | 2017-07-14 18:34:04 | 30,556,538 | 35 | 2015-05-31 10:51:09 | 1,755,598 | 2017-07-14 18:34:04 | https://stackoverflow.com/q/30556438 | https://stackoverflow.com/a/30556538 | <p>You don't need to clone the repository, you need to add remote and then add the files to the repository.</p>
<pre><code>git init
git remote add origin <remote_url>
git fetch --all --prune
git checkout master
git add -A .
git commit -m "Adding my files..."
</code></pre>
<hr />
<h3>In details:</h3>
<p>... | <p>You don't need to clone the repository, you need to add remote and then add the files to the repository.</p> <pre><code>git init git remote add origin <remote_url> git fetch --all --prune git checkout master git add -A . git commit -m "Adding my files..." </code></pre> <hr /> <h3>In details:</h3> <p>... | 119 | git | <h1>Git cloning into current directory</h1>
<p>I am trying to clone a repository into my current directory. However, when I clone it with this command:</p>
<pre><code>git clone REPOURL .
</code></pre>
<p>it says:</p>
<pre><code>fatal: destination path '.' already exists and is not an empty directory.
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,495 | git | # Git cloning into current directory
I am trying to clone a repository into my current directory. However, when I clone it with this command:
```
git clone REPOURL .
```
it says:
```
fatal: destination path '.' already exists and is not an empty directory.
```
The folders that I am cloning into already exist and I... | You don't need to clone the repository, you need to add remote and then add the files to the repository.
```
git init
git remote add origin <remote_url>
git fetch --all --prune
git checkout master
git add -A .
git commit -m "Adding my files..."
```
---
### In details:
You already have a remote repository and you wa... |
35362525 | Pipe git diff to git checkout | 14 | 2016-02-12 12:20:02 | <p>If I delete a file, I can revert it in git with:</p>
<pre><code>git checkout filename
</code></pre>
<p>If I want to revert all deleted files, I can list them with:</p>
<pre><code>git diff --diff-filter=D --name-only
</code></pre>
<p>What I then want to do is restore them, but</p>
<pre><code>git diff --diff-filter=D ... | 10,707 | 134,919 | 2024-05-09 05:26:07 | 35,362,641 | 35 | 2016-02-12 12:26:15 | 67,579 | 2021-10-07 06:42:19 | https://stackoverflow.com/q/35362525 | https://stackoverflow.com/a/35362641 | <p>You cannot use a pipe for this. You can however use <em>Unix</em>'s <code>xargs</code>:</p>
<pre><code>git diff --diff-filter=D --name-only | xargs git checkout
</code></pre>
<p><code>xargs</code> is a tool that reads from stdin and puts the lines as arguments next to its own arguments and calls the result. So if <c... | <p>You cannot use a pipe for this. You can however use <em>Unix</em>'s <code>xargs</code>:</p> <pre><code>git diff --diff-filter=D --name-only | xargs git checkout </code></pre> <p><code>xargs</code> is a tool that reads from stdin and puts the lines as arguments next to its own arguments and calls the result. So if <c... | 119 | git | <h1>Pipe git diff to git checkout</h1>
<p>If I delete a file, I can revert it in git with:</p>
<pre><code>git checkout filename
</code></pre>
<p>If I want to revert all deleted files, I can list them with:</p>
<pre><code>git diff --diff-filter=D --name-only
</code></pre>
<p>What I then want to do is restore them, but</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,498 | git | # Pipe git diff to git checkout
If I delete a file, I can revert it in git with:
```
git checkout filename
```
If I want to revert all deleted files, I can list them with:
```
git diff --diff-filter=D --name-only
```
What I then want to do is restore them, but
```
git diff --diff-filter=D --name-only | git checko... | You cannot use a pipe for this. You can however use *Unix*'s `xargs`:
```
git diff --diff-filter=D --name-only | xargs git checkout
```
`xargs` is a tool that reads from stdin and puts the lines as arguments next to its own arguments and calls the result. So if `git diff` generates a line `a` and a line `b`, `xargs g... |
9443927 | git clone into home directory | 14 | 2012-02-25 12:20:28 | <pre><code>$ git clone ssh://host/repo.git ~/
destination directory '/home/username/' already exists.
</code></pre>
<p>Can anyone tell me how to make this work? I'm trying to quickly be able to replicate common dev scripts and config.</p>
| 31,984 | 180,416 | 2012-02-25 13:19:43 | 9,444,352 | 35 | 2012-02-25 13:19:43 | 180,416 | 2012-02-25 13:19:43 | https://stackoverflow.com/q/9443927 | https://stackoverflow.com/a/9444352 | <p>This seems to work:</p>
<pre><code>cd ~
git init
git remote add origin ssh://host/repo.git
git pull origin master
</code></pre>
| <p>This seems to work:</p> <pre><code>cd ~ git init git remote add origin ssh://host/repo.git git pull origin master </code></pre> | 58, 119, 48871 | git, home-directory, linux | <h1>git clone into home directory</h1>
<pre><code>$ git clone ssh://host/repo.git ~/
destination directory '/home/username/' already exists.
</code></pre>
<p>Can anyone tell me how to make this work? I'm trying to quickly be able to replicate common dev scripts and config.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,499 | git | # git clone into home directory
```
$ git clone ssh://host/repo.git ~/
destination directory '/home/username/' already exists.
```
Can anyone tell me how to make this work? I'm trying to quickly be able to replicate common dev scripts and config. | This seems to work:
```
cd ~
git init
git remote add origin ssh://host/repo.git
git pull origin master
``` |
52697745 | How to change all the folder files permission private into public in Digital Ocean spaces? | 8 | 2018-10-08 07:54:58 | <p>I have synced my AWS s3:bucket to digital ocean spaces. In my s3:bucket, my all folders/files permission is in Private- but anyone will read. After, the sync s3 - spaces, my all folders/files permission is in Private. Because of that anyone not able to read. </p>
<p>So I want to make my all folders/files permission... | 11,882 | 9,589,710 | 2018-10-17 10:23:02 | 52,852,181 | 35 | 2018-10-17 10:01:57 | 6,781,518 | 2018-10-17 10:23:02 | https://stackoverflow.com/q/52697745 | https://stackoverflow.com/a/52852181 | <p>before move/copy file you have to set acl to public in rclone config (rclone.conf) file like this</p>
<pre><code>[spaces]
acl = public-read
</code></pre>
<p>if your files are already in <strong>Digital Ocean spaces</strong> there is no way to modify permission with rclone, you have to use <strong>s3cmd</strong>, the... | <p>before move/copy file you have to set acl to public in rclone config (rclone.conf) file like this</p> <pre><code>[spaces] acl = public-read </code></pre> <p>if your files are already in <strong>Digital Ocean spaces</strong> there is no way to modify permission with rclone, you have to use <strong>s3cmd</strong>, the... | 11444, 97102 | amazon-s3, digital-ocean | <h1>How to change all the folder files permission private into public in Digital Ocean spaces?</h1>
<p>I have synced my AWS s3:bucket to digital ocean spaces. In my s3:bucket, my all folders/files permission is in Private- but anyone will read. After, the sync s3 - spaces, my all folders/files permission is in Private.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,501 | git | # How to change all the folder files permission private into public in Digital Ocean spaces?
I have synced my AWS s3:bucket to digital ocean spaces. In my s3:bucket, my all folders/files permission is in Private- but anyone will read. After, the sync s3 - spaces, my all folders/files permission is in Private. Because ... | before move/copy file you have to set acl to public in rclone config (rclone.conf) file like this
```
[spaces]
acl = public-read
```
if your files are already in **Digital Ocean spaces** there is no way to modify permission with rclone, you have to use **s3cmd**, the setup is very slimier to rclone. After setup succe... |
34888725 | Setting Makefile variable to result of command in rule | 8 | 2016-01-19 23:13:47 | <p>I am trying to assign the result of a command to a variable in GNU make. It works if I do it outside the rule:</p>
<pre><code>$ cat stack.mk
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
all:
@echo Git branch is $(GIT_BRANCH)
$ make -f stack.mk all
Git branch is dev
</code></pre>
<p>But not if I put i... | 15,552 | 229,058 | 2016-01-20 06:13:46 | 34,888,892 | 35 | 2016-01-19 23:28:42 | 391,161 | 2016-01-20 06:13:46 | https://stackoverflow.com/q/34888725 | https://stackoverflow.com/a/34888892 | <p>Yes, if you are trying to set a <code>Makefile</code> variable, you can do it using <a href="https://www.gnu.org/software/make/manual/html_node/Eval-Function.html" rel="noreferrer"><code>eval</code></a> function. </p>
<pre><code>all:
$(eval GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD))
echo Git branc... | <p>Yes, if you are trying to set a <code>Makefile</code> variable, you can do it using <a href="https://www.gnu.org/software/make/manual/html_node/Eval-Function.html" rel="noreferrer"><code>eval</code></a> function. </p> <pre><code>all: $(eval GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)) echo Git branc... | 119, 4301 | git, makefile | <h1>Setting Makefile variable to result of command in rule</h1>
<p>I am trying to assign the result of a command to a variable in GNU make. It works if I do it outside the rule:</p>
<pre><code>$ cat stack.mk
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
all:
@echo Git branch is $(GIT_BRANCH)
$ make -f sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,502 | git | # Setting Makefile variable to result of command in rule
I am trying to assign the result of a command to a variable in GNU make. It works if I do it outside the rule:
```
$ cat stack.mk
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
all:
@echo Git branch is $(GIT_BRANCH)
$ make -f stack.mk all
Git branch ... | Yes, if you are trying to set a `Makefile` variable, you can do it using [`eval`](https://www.gnu.org/software/make/manual/html_node/Eval-Function.html) function.
```
all:
$(eval GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD))
echo Git branch is $(GIT_BRANCH)
``` |
826715 | How do I manage conflicts with git submodules? | 218 | 2009-05-05 20:11:34 | <p>I have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within.</p>
<p>For this question, lets say my superproject is called <code>supery</code> and the submodule is called <code>subby</code>. (Then is a simplification of wh... | 245,850 | 101,819 | 2024-12-08 20:10:47 | 836,019 | 34 | 2009-05-07 17:33:16 | 103,017 | 2015-03-03 14:33:25 | https://stackoverflow.com/q/826715 | https://stackoverflow.com/a/836019 | <p>I have not seen that exact error before. But I have a guess about the trouble you are encountering. It looks like because the <code>master</code> and <code>one.one</code> branches of <code>supery</code> contain different refs for the <code>subby</code> submodule, when you merge changes from <code>master</code> git d... | <p>I have not seen that exact error before. But I have a guess about the trouble you are encountering. It looks like because the <code>master</code> and <code>one.one</code> branches of <code>supery</code> contain different refs for the <code>subby</code> submodule, when you merge changes from <code>master</code> git d... | 119, 1879, 3146, 41612 | branch, conflict, git, git-submodules | <h1>How do I manage conflicts with git submodules?</h1>
<p>I have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within.</p>
<p>For this question, lets say my superproject is called <code>supery</code> and the submodule is ca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,504 | git | # How do I manage conflicts with git submodules?
I have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within.
For this question, lets say my superproject is called `supery` and the submodule is called `subby`. (Then is a si... | I have not seen that exact error before. But I have a guess about the trouble you are encountering. It looks like because the `master` and `one.one` branches of `supery` contain different refs for the `subby` submodule, when you merge changes from `master` git does not know which ref - `v1.0` or `v1.1` - should be kept... |
5720343 | Using Git, show all commits that exist *only* on one specific branch, and not *any* others | 112 | 2011-04-19 17:34:24 | <p>Given a branch, I'd like to see a list of commits that exist <strong>only</strong> on that branch. In <a href="https://stackoverflow.com/questions/1710894/using-git-show-all-commits-that-are-in-one-branch-but-not-the-others">this question</a> we discuss ways to see which commits are on one branch but not one or mor... | 77,079 | 19,239 | 2020-05-03 13:52:09 | 5,720,575 | 34 | 2011-04-19 17:57:32 | 19,239 | 2012-04-16 21:47:56 | https://stackoverflow.com/q/5720343 | https://stackoverflow.com/a/5720575 | <p>Courtesy of my dear friend <a href="https://serverfault.com/users/52693/redmumba">Redmumba</a>:</p>
<pre><code>git log --no-merges origin/merge-only \
--not $(git for-each-ref --format="%(refname)" refs/remotes/origin |
grep -Fv refs/remotes/origin/merge-only)
</code></pre>
<p>...where <code>origin/merge-o... | <p>Courtesy of my dear friend <a href="https://serverfault.com/users/52693/redmumba">Redmumba</a>:</p> <pre><code>git log --no-merges origin/merge-only \ --not $(git for-each-ref --format="%(refname)" refs/remotes/origin | grep -Fv refs/remotes/origin/merge-only) </code></pre> <p>...where <code>origin/merge-o... | 119 | git | <h1>Using Git, show all commits that exist *only* on one specific branch, and not *any* others</h1>
<p>Given a branch, I'd like to see a list of commits that exist <strong>only</strong> on that branch. In <a href="https://stackoverflow.com/questions/1710894/using-git-show-all-commits-that-are-in-one-branch-but-not-the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,506 | git | # Using Git, show all commits that exist *only* on one specific branch, and not *any* others
Given a branch, I'd like to see a list of commits that exist **only** on that branch. In [this question](https://stackoverflow.com/questions/1710894/using-git-show-all-commits-that-are-in-one-branch-but-not-the-others) we disc... | Courtesy of my dear friend [Redmumba](https://serverfault.com/users/52693/redmumba):
```
git log --no-merges origin/merge-only \
--not $(git for-each-ref --format="%(refname)" refs/remotes/origin |
grep -Fv refs/remotes/origin/merge-only)
```
...where `origin/merge-only` is your remote merge-only branch name.... |
4948190 | git repository sync between computers, when moving around? | 101 | 2011-02-09 17:18:05 | <p>Let's say that I have a desktop pc and a laptop,
and sometimes I work on the desktop and sometimes I work on the laptop.</p>
<p>What is the easiest way to move a git repository back and forth?</p>
<p>I want the git repositories to be identical,
so that I can continue where I left of at the other computer.</p>
<... | 67,307 | 51,425 | 2023-01-24 01:15:36 | 4,948,264 | 34 | 2011-02-09 17:25:38 | 421,223 | 2011-02-14 00:58:01 | https://stackoverflow.com/q/4948190 | https://stackoverflow.com/a/4948264 | <p>I think, there are multiple approaches. I will just describe, how I handle this</p>
<p>I have one netbook as a 24/7 server, that holds multiple git-repositories. From/To there I push and pull changes via SSH. For access from outside I use dyndns.org. It works fine, especially because I have more than two systems, t... | <p>I think, there are multiple approaches. I will just describe, how I handle this</p> <p>I have one netbook as a 24/7 server, that holds multiple git-repositories. From/To there I push and pull changes via SSH. For access from outside I use dyndns.org. It works fine, especially because I have more than two systems, t... | 119, 456 | git, version-control | <h1>git repository sync between computers, when moving around?</h1>
<p>Let's say that I have a desktop pc and a laptop,
and sometimes I work on the desktop and sometimes I work on the laptop.</p>
<p>What is the easiest way to move a git repository back and forth?</p>
<p>I want the git repositories to be identical,
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,507 | git | # git repository sync between computers, when moving around?
Let's say that I have a desktop pc and a laptop,
and sometimes I work on the desktop and sometimes I work on the laptop.
What is the easiest way to move a git repository back and forth?
I want the git repositories to be identical,
so that I can continue wh... | I think, there are multiple approaches. I will just describe, how I handle this
I have one netbook as a 24/7 server, that holds multiple git-repositories. From/To there I push and pull changes via SSH. For access from outside I use dyndns.org. It works fine, especially because I have more than two systems, that needs ... |
1507463 | How to deal with Git "Could not read" error | 61 | 2009-10-02 02:13:51 | <p>I am getting this error in my git repository:</p>
<pre><code>22:09:15 $ git status
# On branch master
error: Could not read 8124cc15c63be92d534e4cdfa33c38d54deee122
error: unable to read tree object HEAD
nothing to commit (working directory clean)
</code></pre>
<p>A Google search for <code>error: unable to read tr... | 87,334 | 121,112 | 2024-05-07 18:51:39 | 1,507,935 | 34 | 2009-10-02 06:01:20 | 6,309 | 2016-07-26 19:32:14 | https://stackoverflow.com/q/1507463 | https://stackoverflow.com/a/1507935 | <p>On a "broken link" message, you could follow the <a href="https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F" rel="noreferrer"><strong>GitFaq</strong> recommendations</a>:</p>
<blockquote>
<ul>
<li>back up all your state so that anything you do is re-doable if you corrupt things more... | <p>On a "broken link" message, you could follow the <a href="https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F" rel="noreferrer"><strong>GitFaq</strong> recommendations</a>:</p> <blockquote> <ul> <li>back up all your state so that anything you do is re-doable if you corrupt things more... | 119 | git | <h1>How to deal with Git "Could not read" error</h1>
<p>I am getting this error in my git repository:</p>
<pre><code>22:09:15 $ git status
# On branch master
error: Could not read 8124cc15c63be92d534e4cdfa33c38d54deee122
error: unable to read tree object HEAD
nothing to commit (working directory clean)
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,509 | git | # How to deal with Git "Could not read" error
I am getting this error in my git repository:
```
22:09:15 $ git status
# On branch master
error: Could not read 8124cc15c63be92d534e4cdfa33c38d54deee122
error: unable to read tree object HEAD
nothing to commit (working directory clean)
```
A Google search for `error: un... | On a "broken link" message, you could follow the [**GitFaq** recommendations](https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F):
> - back up all your state so that anything you do is re-doable if you corrupt things more!
> - explode any corrupt pack-files
> - See "`man git-unpack-object... |
585844 | How resolve multiple conflicts with "git mergetool" without having to close the editor between files? | 53 | 2009-02-25 12:44:04 | <p>I've found <strong>git mergetool</strong> to be a handy utility for merging diffs visually, but the way I'm going about it seems really wonky. Essentially, my process looks like this when conflicts are reported:</p>
<ol>
<li>Execute a <strong>git mergetool</strong></li>
<li>At the prompt, hit <strong>Enter</strong... | 81,476 | 1,665 | 2020-09-03 03:22:04 | 586,002 | 34 | 2009-02-25 13:31:22 | 6,309 | 2009-02-25 13:36:43 | https://stackoverflow.com/q/585844 | https://stackoverflow.com/a/586002 | <p>At first glance, it does not seem possible to reuse an external diff tool session.</p>
<p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html" rel="noreferrer"><code>git-mergetool</code> documentation</a> clearly states:</p>
<blockquote>
<p>If the custom merge tool correctly indicate... | <p>At first glance, it does not seem possible to reuse an external diff tool session.</p> <p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html" rel="noreferrer"><code>git-mergetool</code> documentation</a> clearly states:</p> <blockquote> <p>If the custom merge tool correctly indicate... | 119, 606, 25165 | diff, git, mergetool | <h1>How resolve multiple conflicts with "git mergetool" without having to close the editor between files?</h1>
<p>I've found <strong>git mergetool</strong> to be a handy utility for merging diffs visually, but the way I'm going about it seems really wonky. Essentially, my process looks like this when conflicts are rep... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,510 | git | # How resolve multiple conflicts with "git mergetool" without having to close the editor between files?
I've found **git mergetool** to be a handy utility for merging diffs visually, but the way I'm going about it seems really wonky. Essentially, my process looks like this when conflicts are reported:
1. Execute a **... | At first glance, it does not seem possible to reuse an external diff tool session.
The [`git-mergetool` documentation](http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html) clearly states:
> If the custom merge tool correctly indicates the success of a merge resolution ***with its exit code***, then the... |
56442203 | Checkout part of a branch in Azure DevOps Pipelines (GetSources) | 47 | 2019-06-04 10:37:08 | <p>My repository in my organisation's devops project contains a lot of .net solutions and some unity projects as well. When I run my build pipeline, it fails due to several of these:</p>
<blockquote>
<p>Error MSB3491: Could not write lines to file "obj\Release\path\to\file". There is not enough space on the disk.</p... | 55,074 | 9,595,496 | 2026-01-07 09:45:53 | 56,442,503 | 34 | 2019-06-04 10:58:11 | 7,409,220 | 2026-01-07 09:45:53 | https://stackoverflow.com/q/56442203 | https://stackoverflow.com/a/56442503 | <p>In Azure DevOps you don't have option to get only part of the repository, but there is a workaround:
Disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script.</p>
<p>To disable the default "Get Sources" just specify <code>none</... | <p>In Azure DevOps you don't have option to get only part of the repository, but there is a workaround: Disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script.</p> <p>To disable the default "Get Sources" just specify <code>none</... | 119, 116537, 119596 | azure-devops, azure-pipelines, git | <h1>Checkout part of a branch in Azure DevOps Pipelines (GetSources)</h1>
<p>My repository in my organisation's devops project contains a lot of .net solutions and some unity projects as well. When I run my build pipeline, it fails due to several of these:</p>
<blockquote>
<p>Error MSB3491: Could not write lines to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,511 | git | # Checkout part of a branch in Azure DevOps Pipelines (GetSources)
My repository in my organisation's devops project contains a lot of .net solutions and some unity projects as well. When I run my build pipeline, it fails due to several of these:
> Error MSB3491: Could not write lines to file "obj\Release\path\to\fil... | In Azure DevOps you don't have option to get only part of the repository, but there is a workaround:
Disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script.
To disable the default "Get Sources" just specify `none` in the checkout statement:
```
- c... |
6284887 | What's the difference between `git fetch` then `git rebase`, and `git pull --rebase`? | 47 | 2011-06-08 20:32:13 | <p>In reading the <code>git pull</code> page, it gives this stern warning about <code>git pull --rebase</code>:</p>
<blockquote>
<p>This is a potentially dangerous mode of operation. It rewrites history, which does not bode well when you published that history already. Do not use this option unless you have read git... | 24,842 | 5,486 | 2019-01-27 16:24:29 | 6,285,123 | 34 | 2011-06-08 20:54:29 | 719,673 | 2019-01-27 16:19:20 | https://stackoverflow.com/q/6284887 | https://stackoverflow.com/a/6285123 | <p>The rule with Git is that you should never attempt to change history after it has been shared, published, or pushed. You can do so, of course, if you really want to and have sufficient permissions, but it should be done with great care since it can mess other people up.</p>
<p>Now fortunately when you have a typica... | <p>The rule with Git is that you should never attempt to change history after it has been shared, published, or pushed. You can do so, of course, if you really want to and have sufficient permissions, but it should be done with great care since it can mess other people up.</p> <p>Now fortunately when you have a typica... | 119, 29934 | git, git-rebase | <h1>What's the difference between `git fetch` then `git rebase`, and `git pull --rebase`?</h1>
<p>In reading the <code>git pull</code> page, it gives this stern warning about <code>git pull --rebase</code>:</p>
<blockquote>
<p>This is a potentially dangerous mode of operation. It rewrites history, which does not bod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,512 | git | # What's the difference between `git fetch` then `git rebase`, and `git pull --rebase`?
In reading the `git pull` page, it gives this stern warning about `git pull --rebase`:
> This is a potentially dangerous mode of operation. It rewrites history, which does not bode well when you published that history already. Do ... | The rule with Git is that you should never attempt to change history after it has been shared, published, or pushed. You can do so, of course, if you really want to and have sufficient permissions, but it should be done with great care since it can mess other people up.
Now fortunately when you have a typical Git depl... |
21787872 | Is it possible to set a git commit to have a timestamp prior to 1970? | 45 | 2014-02-14 19:26:27 | <p>Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. </p>
<p>However, when I try the following:</p>
<pre><code>git commit -m "this is a test commit" --date="1960-04-07 18:00:00"
</code>... | 5,878 | 425,893 | 2019-02-10 00:50:11 | 24,977,895 | 34 | 2014-07-27 04:24:14 | 6,309 | 2019-02-10 00:50:11 | https://stackoverflow.com/q/21787872 | https://stackoverflow.com/a/24977895 | <p>As far back as <a href="https://github.com/git/git/commit/c64b9b88605f9d6824bf953a84d993c4a70fd759" rel="noreferrer">commit c64b9b8</a> (git 0.99, May 2005), time has always been referred as </p>
<pre><code><date>
</code></pre>
<blockquote>
<p>Date in 'seconds since <a href="http://en.wikipedia.org/wiki/Un... | <p>As far back as <a href="https://github.com/git/git/commit/c64b9b88605f9d6824bf953a84d993c4a70fd759" rel="noreferrer">commit c64b9b8</a> (git 0.99, May 2005), time has always been referred as </p> <pre><code><date> </code></pre> <blockquote> <p>Date in 'seconds since <a href="http://en.wikipedia.org/wiki/Un... | 119, 2177, 11716, 53850 | epoch, git, git-commit, timestamp | <h1>Is it possible to set a git commit to have a timestamp prior to 1970?</h1>
<p>Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. </p>
<p>However, when I try the following:</p>
<pre><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,513 | git | # Is it possible to set a git commit to have a timestamp prior to 1970?
Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so.
However, when I try the following:
```
git commit -m "this is ... | As far back as [commit c64b9b8](https://github.com/git/git/commit/c64b9b88605f9d6824bf953a84d993c4a70fd759) (git 0.99, May 2005), time has always been referred as
```
<date>
```
> Date in 'seconds since [epoch](http://en.wikipedia.org/wiki/Unix_time)'
[commit 6eb8ae0](https://github.com/git/git/commit/6eb8ae00d4bcea... |
1138990 | git equivalent of svn status -u | 45 | 2009-07-16 17:13:02 | <p>What's the git equivalent of <code>svn status -u</code> or more verbose <code>svn status --show-updates</code>.
The <code>svn status --show-updates</code> command shows the updates that the <code>svn update</code> command will bring from the server.</p>
<p>Thanks!</p>
| 20,683 | 49,032 | 2015-12-09 07:24:38 | 1,139,066 | 34 | 2009-07-16 17:26:53 | 9,654 | 2012-05-29 18:22:38 | https://stackoverflow.com/q/1138990 | https://stackoverflow.com/a/1139066 | <p>I can't think of a way to do it without actually fetching the updates (maybe someone else will). Assuming you are on the default branch "master" and the upstream from which these hypothetical updates will come is the default remote "origin", try....</p>
<pre><code>git fetch
git log --name-only ..origin/master
</cod... | <p>I can't think of a way to do it without actually fetching the updates (maybe someone else will). Assuming you are on the default branch "master" and the upstream from which these hypothetical updates will come is the default remote "origin", try....</p> <pre><code>git fetch git log --name-only ..origin/master </cod... | 63, 119 | git, svn | <h1>git equivalent of svn status -u</h1>
<p>What's the git equivalent of <code>svn status -u</code> or more verbose <code>svn status --show-updates</code>.
The <code>svn status --show-updates</code> command shows the updates that the <code>svn update</code> command will bring from the server.</p>
<p>Thanks!</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,514 | git | # git equivalent of svn status -u
What's the git equivalent of `svn status -u` or more verbose `svn status --show-updates`.
The `svn status --show-updates` command shows the updates that the `svn update` command will bring from the server.
Thanks! | I can't think of a way to do it without actually fetching the updates (maybe someone else will). Assuming you are on the default branch "master" and the upstream from which these hypothetical updates will come is the default remote "origin", try....
```
git fetch
git log --name-only ..origin/master
```
Note the doubl... |
14732639 | Git conflict (rename/rename) | 44 | 2013-02-06 15:28:22 | <p>After merging branched I've received a <code>conflict (rename/rename)</code> on bunch of files, with <code>file~HEAD</code>, and <code>file~my_test_branch</code> created. How to resolve these?</p>
| 41,111 | 278,984 | 2025-04-03 08:07:47 | 27,896,330 | 34 | 2015-01-12 06:17:03 | 452,210 | 2015-01-12 06:17:03 | https://stackoverflow.com/q/14732639 | https://stackoverflow.com/a/27896330 | <p>Given the following test-setup:</p>
<pre><code>git init resolving-rename-conflicts
cd resolving-rename-conflicts
echo "this file we will rename" > will-be-renamed.txt
git add -A
git commit -m "initial commit"
git checkout -b branch1
git rename will-be-renamed.txt new-name-1.txt
git commit -a -m "renamed a file o... | <p>Given the following test-setup:</p> <pre><code>git init resolving-rename-conflicts cd resolving-rename-conflicts echo "this file we will rename" > will-be-renamed.txt git add -A git commit -m "initial commit" git checkout -b branch1 git rename will-be-renamed.txt new-name-1.txt git commit -a -m "renamed a file o... | 119, 28897, 62599 | git, git-merge, merge-conflict-resolution | <h1>Git conflict (rename/rename)</h1>
<p>After merging branched I've received a <code>conflict (rename/rename)</code> on bunch of files, with <code>file~HEAD</code>, and <code>file~my_test_branch</code> created. How to resolve these?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,516 | git | # Git conflict (rename/rename)
After merging branched I've received a `conflict (rename/rename)` on bunch of files, with `file~HEAD`, and `file~my_test_branch` created. How to resolve these? | Given the following test-setup:
```
git init resolving-rename-conflicts
cd resolving-rename-conflicts
echo "this file we will rename" > will-be-renamed.txt
git add -A
git commit -m "initial commit"
git checkout -b branch1
git rename will-be-renamed.txt new-name-1.txt
git commit -a -m "renamed a file on branch1"
git ch... |
5623208 | How to execute a command right after a fetch or pull command in git? | 43 | 2011-04-11 14:56:33 | <p>I cloned the GHC (Glasgow Haskell Compiler) repository. In order to build the compiler, you need several libraries, all of them are available as git repositories too. In order to ease ones live, the GHC hackers included a script <code>sync-all</code> that, when executed, updates all the dependent repositories.</p>
... | 47,048 | 417,501 | 2025-09-06 11:24:28 | 5,623,947 | 34 | 2011-04-11 15:50:53 | 6,309 | 2018-08-15 20:11:37 | https://stackoverflow.com/q/5623208 | https://stackoverflow.com/a/5623947 | <p>If you need to execute a script after a <code>git pull</code> on the client side (your machine), then a there is no reliable solution.</p>
<p>The <a href="https://git-scm.com/docs/githooks#_post_merge" rel="noreferrer">post-merge client-side hook</a> (<a href="https://stackoverflow.com/a/4185449/6309">mentioned her... | <p>If you need to execute a script after a <code>git pull</code> on the client side (your machine), then a there is no reliable solution.</p> <p>The <a href="https://git-scm.com/docs/githooks#_post_merge" rel="noreferrer">post-merge client-side hook</a> (<a href="https://stackoverflow.com/a/4185449/6309">mentioned her... | 119, 19287, 43087 | ghc, git, githooks | <h1>How to execute a command right after a fetch or pull command in git?</h1>
<p>I cloned the GHC (Glasgow Haskell Compiler) repository. In order to build the compiler, you need several libraries, all of them are available as git repositories too. In order to ease ones live, the GHC hackers included a script <code>sync... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,517 | git | # How to execute a command right after a fetch or pull command in git?
I cloned the GHC (Glasgow Haskell Compiler) repository. In order to build the compiler, you need several libraries, all of them are available as git repositories too. In order to ease ones live, the GHC hackers included a script `sync-all` that, wh... | If you need to execute a script after a `git pull` on the client side (your machine), then a there is no reliable solution.
The [post-merge client-side hook](https://git-scm.com/docs/githooks#_post_merge) ([mentioned here](https://stackoverflow.com/a/4185449/6309)) won't be triggered by every pull (for instance, not i... |
158514 | Is it possible to make git svn dcommit result in a single svn commit? | 42 | 2008-10-01 16:31:22 | <p>According to <a href="http://git-scm.com/docs/git-svn" rel="noreferrer">the manual</a>, <code>git dcommit</code> “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the <code>svn commit</code>?</... | 15,938 | 446,328 | 2014-02-10 17:47:14 | 158,570 | 34 | 2008-10-01 16:43:10 | 3,029 | 2014-02-10 17:47:14 | https://stackoverflow.com/q/158514 | https://stackoverflow.com/a/158570 | <p>If you work on a branch in git, you can <a href="http://git-scm.com/docs/git-merge" rel="nofollow noreferrer"><code>git-merge --squash</code></a>, which does that within git. You could then push that one squashed commit to SVN.</p>
<p>Of course, lots of small commits are good, so why would you want to squash them?... | <p>If you work on a branch in git, you can <a href="http://git-scm.com/docs/git-merge" rel="nofollow noreferrer"><code>git-merge --squash</code></a>, which does that within git. You could then push that one squashed commit to SVN.</p> <p>Of course, lots of small commits are good, so why would you want to squash them?... | 63, 119, 6452 | git, git-svn, svn | <h1>Is it possible to make git svn dcommit result in a single svn commit?</h1>
<p>According to <a href="http://git-scm.com/docs/git-svn" rel="noreferrer">the manual</a>, <code>git dcommit</code> “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,518 | git | # Is it possible to make git svn dcommit result in a single svn commit?
According to [the manual](http://git-scm.com/docs/git-svn), `git dcommit` “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing... | If you work on a branch in git, you can [`git-merge --squash`](http://git-scm.com/docs/git-merge), which does that within git. You could then push that one squashed commit to SVN.
Of course, lots of small commits are good, so why would you want to squash them? |
37599665 | How do I `git rebase -i` and prevent "You asked to amend the most recent commit, but doing so would make it empty."? | 41 | 2016-06-02 18:34:20 | <p>I want to run a <code>git rebase -i some-hash</code>.</p>
<p>When I run it, I get the error:</p>
<blockquote>
<p>You asked to amend the most recent commit, but doing so would make it
empty. You can repeat your command with --allow-empty, or you can
remove the commit entirely with "git reset HEAD^".<br>
[..... | 18,814 | 131,227 | 2024-04-14 07:38:08 | 37,600,256 | 34 | 2016-06-02 19:09:48 | 131,227 | 2024-04-14 07:36:45 | https://stackoverflow.com/q/37599665 | https://stackoverflow.com/a/37600256 | <p>Seems like running:</p>
<pre class="lang-bash prettyprint-override"><code>git commit --allow-empty
git rebase --continue
</code></pre>
<p>Creates 2 squashed commits, instead of one.
Running <code>git rebase -i some-hash</code> allows me to squash the 2 new commits into one.</p>
| <p>Seems like running:</p> <pre class="lang-bash prettyprint-override"><code>git commit --allow-empty git rebase --continue </code></pre> <p>Creates 2 squashed commits, instead of one. Running <code>git rebase -i some-hash</code> allows me to squash the 2 new commits into one.</p> | 119, 29934 | git, git-rebase | <h1>How do I `git rebase -i` and prevent "You asked to amend the most recent commit, but doing so would make it empty."?</h1>
<p>I want to run a <code>git rebase -i some-hash</code>.</p>
<p>When I run it, I get the error:</p>
<blockquote>
<p>You asked to amend the most recent commit, but doing so would make it
em... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,519 | git | # How do I `git rebase -i` and prevent "You asked to amend the most recent commit, but doing so would make it empty."?
I want to run a `git rebase -i some-hash`.
When I run it, I get the error:
> You asked to amend the most recent commit, but doing so would make it
> empty. You can repeat your command with --allow-e... | Seems like running:
```
git commit --allow-empty
git rebase --continue
```
Creates 2 squashed commits, instead of one.
Running `git rebase -i some-hash` allows me to squash the 2 new commits into one. |
2248994 | Cloning a repository without making it the origin remote | 40 | 2010-02-12 01:08:57 | <p>I'm cloning a git repository from a computer that's going to be wiped.</p>
<p>Is it possible to clone a repository without making the original repository <code>origin/master</code>? Or do I need to clone it, and then delete the remote branch (which is done with <code>git remote rm origin</code>)?</p>
<p><strong>Ed... | 24,409 | 38,765 | 2022-04-21 13:11:14 | 2,249,681 | 34 | 2010-02-12 04:31:59 | 184,700 | 2010-02-12 15:09:29 | https://stackoverflow.com/q/2248994 | https://stackoverflow.com/a/2249681 | <p>It is not necessary to make the original repository the "origin" remote to clone the master branch.</p>
<p>On the new machine, create a new repository:</p>
<pre><code>git init foo
</code></pre>
<p>Then pull the old repository into the new one, without creating a remote:</p>
<pre><code>cd foo
git pull <referen... | <p>It is not necessary to make the original repository the "origin" remote to clone the master branch.</p> <p>On the new machine, create a new repository:</p> <pre><code>git init foo </code></pre> <p>Then pull the old repository into the new one, without creating a remote:</p> <pre><code>cd foo git pull <referen... | 119, 34099 | git, git-clone | <h1>Cloning a repository without making it the origin remote</h1>
<p>I'm cloning a git repository from a computer that's going to be wiped.</p>
<p>Is it possible to clone a repository without making the original repository <code>origin/master</code>? Or do I need to clone it, and then delete the remote branch (which i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,520 | git | # Cloning a repository without making it the origin remote
I'm cloning a git repository from a computer that's going to be wiped.
Is it possible to clone a repository without making the original repository `origin/master`? Or do I need to clone it, and then delete the remote branch (which is done with `git remote rm ... | It is not necessary to make the original repository the "origin" remote to clone the master branch.
On the new machine, create a new repository:
```
git init foo
```
Then pull the old repository into the new one, without creating a remote:
```
cd foo
git pull <reference to old repository>
```
However, it should be... |
5520425 | How can I rebase a commit made by another author without adding myself as the committer? | 39 | 2011-04-02 01:08:15 | <p>Normally, when you rebase another author's commit with git, git adds a <code>Commit:</code> header with your name and email address. I have a situation where I don't want this to happen. I want the rebased commit to end up with the same SHA1 as it would have if the original author had done the equivalent rebase him/... | 17,745 | 52,207 | 2024-01-20 08:04:16 | 5,520,650 | 34 | 2011-04-02 02:09:45 | 36,723 | 2011-04-02 02:09:45 | https://stackoverflow.com/q/5520425 | https://stackoverflow.com/a/5520650 | <p>All git commits have a committer field internally; you can see this by typing <code>git cat-file commit HEAD</code> immediately after committing something. As such you cannot erase it; you can only make it equal to the author field.</p>
<p>That said, you might be seeing git porcelain showing the commit field becaus... | <p>All git commits have a committer field internally; you can see this by typing <code>git cat-file commit HEAD</code> immediately after committing something. As such you cannot erase it; you can only make it equal to the author field.</p> <p>That said, you might be seeing git porcelain showing the commit field becaus... | 119, 8974 | git, rebase | <h1>How can I rebase a commit made by another author without adding myself as the committer?</h1>
<p>Normally, when you rebase another author's commit with git, git adds a <code>Commit:</code> header with your name and email address. I have a situation where I don't want this to happen. I want the rebased commit to end... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,521 | git | # How can I rebase a commit made by another author without adding myself as the committer?
Normally, when you rebase another author's commit with git, git adds a `Commit:` header with your name and email address. I have a situation where I don't want this to happen. I want the rebased commit to end up with the same SH... | All git commits have a committer field internally; you can see this by typing `git cat-file commit HEAD` immediately after committing something. As such you cannot erase it; you can only make it equal to the author field.
That said, you might be seeing git porcelain showing the commit field because the *datestamp* has... |
65754188 | Should I add .swiftpm to gitignore? | 38 | 2021-01-16 20:08:00 | <p>A <code>MyPackage/.swiftpm</code> directory is created when editing the Swift Package in Xcode. Should I ignore this directory by adding to my <code>MyPackage/.gitignore</code>?</p>
| 16,364 | 456,366 | 2026-01-07 20:06:32 | 65,754,189 | 34 | 2021-01-16 20:08:00 | 456,366 | 2026-01-07 20:06:32 | https://stackoverflow.com/q/65754188 | https://stackoverflow.com/a/65754189 | <p>According to <a href="https://forums.swift.org/t/files-created-when-opening-spm-package-in-xcode-11/28589/2" rel="nofollow noreferrer">this post</a> in the Swift forums:</p>
<blockquote>
<p>the <code>.swiftpm</code> directory:</p>
</blockquote>
<blockquote>
<p>is intended as a place for tools that operate on package... | <p>According to <a href="https://forums.swift.org/t/files-created-when-opening-spm-package-in-xcode-11/28589/2" rel="nofollow noreferrer">this post</a> in the Swift forums:</p> <blockquote> <p>the <code>.swiftpm</code> directory:</p> </blockquote> <blockquote> <p>is intended as a place for tools that operate on package... | 119, 116442 | git, swift-package-manager | <h1>Should I add .swiftpm to gitignore?</h1>
<p>A <code>MyPackage/.swiftpm</code> directory is created when editing the Swift Package in Xcode. Should I ignore this directory by adding to my <code>MyPackage/.gitignore</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,522 | git | # Should I add .swiftpm to gitignore?
A `MyPackage/.swiftpm` directory is created when editing the Swift Package in Xcode. Should I ignore this directory by adding to my `MyPackage/.gitignore`? | According to [this post](https://forums.swift.org/t/files-created-when-opening-spm-package-in-xcode-11/28589/2) in the Swift forums:
> the `.swiftpm` directory:
> is intended as a place for tools that operate on packages to store state or configuration files of their own that users are not expected to edit directly a... |
1488753 | How to merge two branches without a common ancestor? | 38 | 2009-09-28 18:56:55 | <p>I have started using Git in the middle of my project, where the first two commits are just some initial settings (.gitignore and .gitattributes), and the third commit <strong>M2</strong> adds the content of the SVN trunk:</p>
<pre><code>I1 -- I2 -- M2 -- N -- .. -- Z
</code></pre>
<p>I have imported the SVN histor... | 31,258 | 19,756 | 2019-06-28 13:50:15 | 1,491,057 | 34 | 2009-09-29 07:25:25 | 136,954 | 2016-02-23 15:53:23 | https://stackoverflow.com/q/1488753 | https://stackoverflow.com/a/1491057 | <p><strong>Disclaimer</strong>: <em>I've only used "graft points" myself once in a toy repository. But it is an obscure feature which you may not have heard of, and which _may_ be helpful in your situation.</em></p>
<p>You could use "graft points" to fake the ancestry information. See, e.g., <a href="https://stackover... | <p><strong>Disclaimer</strong>: <em>I've only used "graft points" myself once in a toy repository. But it is an obscure feature which you may not have heard of, and which _may_ be helpful in your situation.</em></p> <p>You could use "graft points" to fake the ancestry information. See, e.g., <a href="https://stackover... | 119, 717, 8974 | git, merge, rebase | <h1>How to merge two branches without a common ancestor?</h1>
<p>I have started using Git in the middle of my project, where the first two commits are just some initial settings (.gitignore and .gitattributes), and the third commit <strong>M2</strong> adds the content of the SVN trunk:</p>
<pre><code>I1 -- I2 -- M2 --... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,523 | git | # How to merge two branches without a common ancestor?
I have started using Git in the middle of my project, where the first two commits are just some initial settings (.gitignore and .gitattributes), and the third commit **M2** adds the content of the SVN trunk:
```
I1 -- I2 -- M2 -- N -- .. -- Z
```
I have importe... | **Disclaimer**: *I've only used "graft points" myself once in a toy repository. But it is an obscure feature which you may not have heard of, and which _may_ be helpful in your situation.*
You could use "graft points" to fake the ancestry information. See, e.g., [What are .git/info/grafts for?](https://stackoverflow.c... |
3669636 | Automatically keep a secondary repo in sync with a primary repo? | 37 | 2010-09-08 15:59:49 | <p>We have a two tier setup.</p>
<p>We have a primary repository (called 'primary' below).</p>
<p>And a secondary repository (called 'secondary' below) that was created like so:</p>
<pre><code>$ git clone --bare --shared $REPO_A/primary secondary.git
</code></pre>
<p>People working on the secondary repository view ... | 37,247 | 245,602 | 2020-04-05 00:40:40 | 3,670,234 | 34 | 2010-09-08 17:14:18 | 6,309 | 2010-09-08 17:14:18 | https://stackoverflow.com/q/3669636 | https://stackoverflow.com/a/3670234 | <p>Oh, don't do all that, just do:</p>
<pre><code>git --bare fetch
</code></pre>
<p>;)</p>
<p>(See this <a href="http://lists.zerezo.com/git/msg623942.html" rel="noreferrer">old thread for instance</a>)<br>
If you have added the <a href="http://lists.zerezo.com/git/msg623939.html" rel="noreferrer">relevant remote or... | <p>Oh, don't do all that, just do:</p> <pre><code>git --bare fetch </code></pre> <p>;)</p> <p>(See this <a href="http://lists.zerezo.com/git/msg623942.html" rel="noreferrer">old thread for instance</a>)<br> If you have added the <a href="http://lists.zerezo.com/git/msg623939.html" rel="noreferrer">relevant remote or... | 119, 1652, 7330 | git, repository, synchronization | <h1>Automatically keep a secondary repo in sync with a primary repo?</h1>
<p>We have a two tier setup.</p>
<p>We have a primary repository (called 'primary' below).</p>
<p>And a secondary repository (called 'secondary' below) that was created like so:</p>
<pre><code>$ git clone --bare --shared $REPO_A/primary second... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,524 | git | # Automatically keep a secondary repo in sync with a primary repo?
We have a two tier setup.
We have a primary repository (called 'primary' below).
And a secondary repository (called 'secondary' below) that was created like so:
```
$ git clone --bare --shared $REPO_A/primary secondary.git
```
People working on the... | Oh, don't do all that, just do:
```
git --bare fetch
```
;)
(See this [old thread for instance](http://lists.zerezo.com/git/msg623942.html))
If you have added the [relevant remote origins](http://lists.zerezo.com/git/msg623939.html) to your bare repo, you can fetch in turn each of those origins. |
23327701 | Git merge submodule into parent tree cleanly and preserving commit history | 36 | 2014-04-27 19:06:03 | <p>I have a repository with two submodules that I want to convert into a single project. Many answers involve scripts, and some seem to be overcomplicated.</p>
<pre><code>[submodule "site"]
path = wp-content/themes/site
url = https://ajf-@bitbucket.org/ajf-/site.git
fetchRecurseSubmodules = true
ignore... | 29,088 | 890,899 | 2024-01-11 06:28:19 | 23,328,223 | 34 | 2014-04-27 19:51:50 | 3,566,933 | 2024-01-11 06:28:19 | https://stackoverflow.com/q/23327701 | https://stackoverflow.com/a/23328223 | <p>The best approach is to do <em>subtree merging</em>.</p>
<p>First, remove the submodules and related configuration from your superproject; Edit your .gitmodules file to remove the submodules affected, or delete the file entirely if you intend to merge all submodules. Delete the submodule directories as well.</p>
<p>... | <p>The best approach is to do <em>subtree merging</em>.</p> <p>First, remove the submodules and related configuration from your superproject; Edit your .gitmodules file to remove the submodules affected, or delete the file entirely if you intend to merge all submodules. Delete the submodule directories as well.</p> <p>... | 119, 41612 | git, git-submodules | <h1>Git merge submodule into parent tree cleanly and preserving commit history</h1>
<p>I have a repository with two submodules that I want to convert into a single project. Many answers involve scripts, and some seem to be overcomplicated.</p>
<pre><code>[submodule "site"]
path = wp-content/themes/site
url = h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,525 | git | # Git merge submodule into parent tree cleanly and preserving commit history
I have a repository with two submodules that I want to convert into a single project. Many answers involve scripts, and some seem to be overcomplicated.
```
[submodule "site"]
path = wp-content/themes/site
url = https://ajf-@bitbucke... | The best approach is to do *subtree merging*.
First, remove the submodules and related configuration from your superproject; Edit your .gitmodules file to remove the submodules affected, or delete the file entirely if you intend to merge all submodules. Delete the submodule directories as well.
Next, add the submodul... |
34885397 | Using custom diff tool with `git show` | 35 | 2016-01-19 19:30:08 | <p>With git I can set a custom diff tool that is used for certain file extensions by the following in <code>.git/config</code></p>
<pre><code>[diff "csv_diff"]
command = Tools/csv_diff
</code></pre>
<p>and this in <code>.gitattributes</code> (in the root of the repository)</p>
<pre><code>*.csv diff=csv_diff
</co... | 10,724 | 3,171,863 | 2024-06-19 05:02:31 | 34,934,452 | 34 | 2016-01-21 21:13:17 | 3,764,814 | 2016-01-21 21:13:17 | https://stackoverflow.com/q/34885397 | https://stackoverflow.com/a/34934452 | <p>Looks like you're looking for the <code>--ext-diff</code> option.</p>
<p>Here's what <a href="https://git-scm.com/docs/git-show"><code>git show</code> docs</a> say about it:</p>
<blockquote>
<p><strong>--ext-diff</strong></p>
<p>Allow an external diff helper to be executed. If you set an external diff drive... | <p>Looks like you're looking for the <code>--ext-diff</code> option.</p> <p>Here's what <a href="https://git-scm.com/docs/git-show"><code>git show</code> docs</a> say about it:</p> <blockquote> <p><strong>--ext-diff</strong></p> <p>Allow an external diff helper to be executed. If you set an external diff drive... | 119 | git | <h1>Using custom diff tool with `git show`</h1>
<p>With git I can set a custom diff tool that is used for certain file extensions by the following in <code>.git/config</code></p>
<pre><code>[diff "csv_diff"]
command = Tools/csv_diff
</code></pre>
<p>and this in <code>.gitattributes</code> (in the root of the repo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,527 | git | # Using custom diff tool with `git show`
With git I can set a custom diff tool that is used for certain file extensions by the following in `.git/config`
```
[diff "csv_diff"]
command = Tools/csv_diff
```
and this in `.gitattributes` (in the root of the repository)
```
*.csv diff=csv_diff
```
This works when u... | Looks like you're looking for the `--ext-diff` option.
Here's what [`git show` docs](https://git-scm.com/docs/git-show) say about it:
> **--ext-diff**
>
> Allow an external diff helper to be executed. If you set an external diff driver with [`gitattributes`](https://git-scm.com/docs/gitattributes), you need to use th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.