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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4319486 | git - merge conflict when local is deleted but file exists in remote | 131 | 2010-11-30 22:45:24 | <p>I am very new to git and wondered how I should go about a merge where in the local repo I have deleted several files on the master branch but these files exist within the remote master branch.</p>
<p>After doing git-merge it shows the conflicts that have occured.</p>
<p>Using git gui it shows that the local file is ... | 117,377 | 75,774 | 2025-04-04 08:19:57 | 4,320,027 | 170 | 2010-12-01 00:07:03 | 119,963 | 2010-12-01 00:07:03 | https://stackoverflow.com/q/4319486 | https://stackoverflow.com/a/4320027 | <p>You should resolve the conflicts as you see fit. If the file really is supposed to be removed, and you will be publishing that change to origin, remove it again:</p>
<pre><code>git rm path/to/file
</code></pre>
<p>If the file should in fact be tracked still, add it (the version in the work tree will be the version... | <p>You should resolve the conflicts as you see fit. If the file really is supposed to be removed, and you will be publishing that change to origin, remove it again:</p> <pre><code>git rm path/to/file </code></pre> <p>If the file should in fact be tracked still, add it (the version in the work tree will be the version... | 119 | git | <h1>git - merge conflict when local is deleted but file exists in remote</h1>
<p>I am very new to git and wondered how I should go about a merge where in the local repo I have deleted several files on the master branch but these files exist within the remote master branch.</p>
<p>After doing git-merge it shows the conf... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,260 | git | # git - merge conflict when local is deleted but file exists in remote
I am very new to git and wondered how I should go about a merge where in the local repo I have deleted several files on the master branch but these files exist within the remote master branch.
After doing git-merge it shows the conflicts that have... | You should resolve the conflicts as you see fit. If the file really is supposed to be removed, and you will be publishing that change to origin, remove it again:
```
git rm path/to/file
```
If the file should in fact be tracked still, add it (the version in the work tree will be the version from origin):
```
git add... |
37582250 | Git diff in summary? | 130 | 2016-06-02 03:42:51 | <p>With <code>git pull</code>, it shows a diff summary like this:</p>
<pre><code>Updating 6a78751..811f788
Fast-forward
app/Http/Controllers/SaleController.php | 7 +-
.../views/pages/sale/create.blade.php | 137 +++++++++++++---
resources/views/pages/sale/index.blade.php | 4 +-
resources/views/pages/sal... | 80,181 | 4,520,373 | 2025-04-10 19:32:51 | 37,582,295 | 170 | 2016-06-02 03:48:11 | 5,898,312 | 2019-02-12 11:34:55 | https://stackoverflow.com/q/37582250 | https://stackoverflow.com/a/37582295 | <p><code>git log --stat</code> will show the amount each file was changed.</p>
<p><code>git whatchanged</code> gives some detail into the files that were modified.</p>
<p><code>git diff --stat <sha1> <sha2></code> gives the files and the amount of changes between two commits.</p>
<p><code>git diff --stat... | <p><code>git log --stat</code> will show the amount each file was changed.</p> <p><code>git whatchanged</code> gives some detail into the files that were modified.</p> <p><code>git diff --stat <sha1> <sha2></code> gives the files and the amount of changes between two commits.</p> <p><code>git diff --stat... | 119 | git | <h1>Git diff in summary?</h1>
<p>With <code>git pull</code>, it shows a diff summary like this:</p>
<pre><code>Updating 6a78751..811f788
Fast-forward
app/Http/Controllers/SaleController.php | 7 +-
.../views/pages/sale/create.blade.php | 137 +++++++++++++---
resources/views/pages/sale/index.blade.php | 4... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,261 | git | # Git diff in summary?
With `git pull`, it shows a diff summary like this:
```
Updating 6a78751..811f788
Fast-forward
app/Http/Controllers/SaleController.php | 7 +-
.../views/pages/sale/create.blade.php | 137 +++++++++++++---
resources/views/pages/sale/index.blade.php | 4 +-
resources/views/pages/sale... | `git log --stat` will show the amount each file was changed.
`git whatchanged` gives some detail into the files that were modified.
`git diff --stat <sha1> <sha2>` gives the files and the amount of changes between two commits.
`git diff --stat <branch>` to compare to another branch (e.g. master) |
28498688 | Gradle script to autoversion and include the commit hash in Android | 76 | 2015-02-13 11:35:23 | <p>I need to write a gradle script to auto version my application on every commit. I need to also include the commit hash as a reference in the application for testers.</p>
<p>I am confused how auto versioning usually work. Can someone explain the autoversioning process?</p>
| 41,960 | 445,548 | 2022-05-04 07:30:57 | 35,041,457 | 170 | 2016-01-27 15:29:39 | 44,636 | 2016-01-27 15:29:39 | https://stackoverflow.com/q/28498688 | https://stackoverflow.com/a/35041457 | <p>I encountered a similar problem, but did not want to modify the versionName to include the git hash. We wanted to keep that as something like 1.2.2, but still have the possibility of displaying the git hash in the UI. </p>
<p>I modified the code from <a href="https://stackoverflow.com/a/30259848/44636">the other an... | <p>I encountered a similar problem, but did not want to modify the versionName to include the git hash. We wanted to keep that as something like 1.2.2, but still have the possibility of displaying the git hash in the UI. </p> <p>I modified the code from <a href="https://stackoverflow.com/a/30259848/44636">the other an... | 81, 119, 1386, 32307, 91905 | android, android-studio, git, gradle, versioning | <h1>Gradle script to autoversion and include the commit hash in Android</h1>
<p>I need to write a gradle script to auto version my application on every commit. I need to also include the commit hash as a reference in the application for testers.</p>
<p>I am confused how auto versioning usually work. Can someone explai... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,264 | git | # Gradle script to autoversion and include the commit hash in Android
I need to write a gradle script to auto version my application on every commit. I need to also include the commit hash as a reference in the application for testers.
I am confused how auto versioning usually work. Can someone explain the autoversio... | I encountered a similar problem, but did not want to modify the versionName to include the git hash. We wanted to keep that as something like 1.2.2, but still have the possibility of displaying the git hash in the UI.
I modified the code from [the other answer here](https://stackoverflow.com/a/30259848/44636) to use t... |
35008713 | Bitbucket git credentials if signed up with Google | 461 | 2016-01-26 07:23:30 | <p>I have an account on bitbucket.org that I created by signing up with my Google account. Now everytime I log in I just click "Log in with Google" and that's fine.</p>
<p>How can I access my repos from git command line? It requests me username and password. I have a username, but no password.
How do I log in then?</p... | 225,837 | 3,771,035 | 2024-08-24 23:57:23 | 35,238,806 | 169 | 2016-02-06 08:06:44 | 3,771,035 | 2019-10-15 04:08:24 | https://stackoverflow.com/q/35008713 | https://stackoverflow.com/a/35238806 | <p>Solved:</p>
<ul>
<li>Went on the log-in screen and clicked <code>forgot my password</code>.</li>
<li>I entered my Google account email and I received a reset link.</li>
<li>As you enter there a new password you'll have bitbucket id and password to use.</li>
</ul>
<p>Sample: </p>
<pre><code>git clone https://<b... | <p>Solved:</p> <ul> <li>Went on the log-in screen and clicked <code>forgot my password</code>.</li> <li>I entered my Google account email and I received a reset link.</li> <li>As you enter there a new password you'll have bitbucket id and password to use.</li> </ul> <p>Sample: </p> <pre><code>git clone https://<b... | 119, 8337, 37784 | bitbucket, git, google-account | <h1>Bitbucket git credentials if signed up with Google</h1>
<p>I have an account on bitbucket.org that I created by signing up with my Google account. Now everytime I log in I just click "Log in with Google" and that's fine.</p>
<p>How can I access my repos from git command line? It requests me username and password. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,265 | git | # Bitbucket git credentials if signed up with Google
I have an account on bitbucket.org that I created by signing up with my Google account. Now everytime I log in I just click "Log in with Google" and that's fine.
How can I access my repos from git command line? It requests me username and password. I have a usernam... | Solved:
- Went on the log-in screen and clicked `forgot my password`.
- I entered my Google account email and I received a reset link.
- As you enter there a new password you'll have bitbucket id and password to use.
Sample:
```
git clone https://<bitbucket_id>@bitbucket.org/<repo>
``` |
10712555 | gitignore all files of extension in directory | 330 | 2012-05-23 02:04:12 | <p>Is there a way to ignore all files of a type in a directory?</p>
<p><code>**</code> is apparently meaningless to git, so this doesn't work:</p>
<pre><code>/public/static/**/*.js
</code></pre>
<p>The idea is to match arbitrary nested folders.</p>
| 396,636 | 663,447 | 2023-04-10 15:37:21 | 10,712,702 | 169 | 2012-05-23 02:27:46 | 83,196 | 2017-05-05 15:38:01 | https://stackoverflow.com/q/10712555 | https://stackoverflow.com/a/10712702 | <p>Never tried it, but <code>git help ignore</code> suggests that if you put a <code>.gitignore</code> with <code>*.js</code> in <code>/public/static</code>, it will do what you want.</p>
<p>Note: make sure to also check out Joeys' answer below: if you want to ignore files in a specific subdirectory, then a local .git... | <p>Never tried it, but <code>git help ignore</code> suggests that if you put a <code>.gitignore</code> with <code>*.js</code> in <code>/public/static</code>, it will do what you want.</p> <p>Note: make sure to also check out Joeys' answer below: if you want to ignore files in a specific subdirectory, then a local .git... | 119, 25056 | git, gitignore | <h1>gitignore all files of extension in directory</h1>
<p>Is there a way to ignore all files of a type in a directory?</p>
<p><code>**</code> is apparently meaningless to git, so this doesn't work:</p>
<pre><code>/public/static/**/*.js
</code></pre>
<p>The idea is to match arbitrary nested folders.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,266 | git | # gitignore all files of extension in directory
Is there a way to ignore all files of a type in a directory?
`**` is apparently meaningless to git, so this doesn't work:
```
/public/static/**/*.js
```
The idea is to match arbitrary nested folders. | Never tried it, but `git help ignore` suggests that if you put a `.gitignore` with `*.js` in `/public/static`, it will do what you want.
Note: make sure to also check out Joeys' answer below: if you want to ignore files in a specific subdirectory, then a local .gitignore is the right solution (locality is good). Howev... |
10790232 | Hanging at "POST git-receive-pack (chunked)" | 85 | 2012-05-28 20:44:51 | <p>I will be honest, I know very little about the internals of git.</p>
<p>I have staged and commit a 40mb directory, but when I come to push...</p>
<pre><code>$ git push --verbose --progress
Pushing to https://acron0@bitbucket.org/acron0/project.git
Password for 'https://acron0@bitbucket.org':
POST git-receive-pack ... | 84,355 | 254,190 | 2022-12-22 16:15:08 | 14,594,496 | 169 | 2013-01-30 00:10:42 | 1,347,638 | 2015-06-29 15:07:26 | https://stackoverflow.com/q/10790232 | https://stackoverflow.com/a/14594496 | <p>This is a bug in Git; when using HTTPS it will use chunked encoding for uploads above a certain size. Those do not work.</p>
<p>A trivial fix is to tell git to not chunk until some ridiculously large size value, such as:</p>
<pre><code>git config http.postBuffer 524288000
</code></pre>
| <p>This is a bug in Git; when using HTTPS it will use chunked encoding for uploads above a certain size. Those do not work.</p> <p>A trivial fix is to tell git to not chunk until some ridiculously large size value, such as:</p> <pre><code>git config http.postBuffer 524288000 </code></pre> | 119, 456, 8337 | bitbucket, git, version-control | <h1>Hanging at "POST git-receive-pack (chunked)"</h1>
<p>I will be honest, I know very little about the internals of git.</p>
<p>I have staged and commit a 40mb directory, but when I come to push...</p>
<pre><code>$ git push --verbose --progress
Pushing to https://acron0@bitbucket.org/acron0/project.git
Password for ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,271 | git | # Hanging at "POST git-receive-pack (chunked)"
I will be honest, I know very little about the internals of git.
I have staged and commit a 40mb directory, but when I come to push...
```
$ git push --verbose --progress
Pushing to https://acron0@bitbucket.org/acron0/project.git
Password for 'https://acron0@bitbucket.o... | This is a bug in Git; when using HTTPS it will use chunked encoding for uploads above a certain size. Those do not work.
A trivial fix is to tell git to not chunk until some ridiculously large size value, such as:
```
git config http.postBuffer 524288000
``` |
12319968 | Remote branch is not showing up in "git branch -r" | 212 | 2012-09-07 14:20:45 | <p>I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.</p>
<p>I'm trying to fetch the changes he uploaded.</p>
<pre><code> $ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
</code></pre>
<blockquote>
<p>... | 234,378 | 1,221,061 | 2024-01-16 22:44:54 | 12,320,930 | 168 | 2012-09-07 15:17:10 | 438,742 | 2019-12-06 11:16:51 | https://stackoverflow.com/q/12319968 | https://stackoverflow.com/a/12320930 | <p>The <code>remote</code> section also specifies fetch rules. You could add something like this into it to fetch all branches from the remote:</p>
<pre><code>fetch = +refs/heads/*:refs/remotes/origin/*
</code></pre>
<p>(Or replace <code>origin</code> with <code>bitbucket</code>.)</p>
<p>Please read about it here: <... | <p>The <code>remote</code> section also specifies fetch rules. You could add something like this into it to fetch all branches from the remote:</p> <pre><code>fetch = +refs/heads/*:refs/remotes/origin/* </code></pre> <p>(Or replace <code>origin</code> with <code>bitbucket</code>.)</p> <p>Please read about it here: <... | 119 | git | <h1>Remote branch is not showing up in "git branch -r"</h1>
<p>I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.</p>
<p>I'm trying to fetch the changes he uploaded.</p>
<pre><code> $ git branch -a
* master
localbranch1
localbran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,272 | git | # Remote branch is not showing up in "git branch -r"
I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.
I'm trying to fetch the changes he uploaded.
```
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
... | The `remote` section also specifies fetch rules. You could add something like this into it to fetch all branches from the remote:
```
fetch = +refs/heads/*:refs/remotes/origin/*
```
(Or replace `origin` with `bitbucket`.)
Please read about it here: *[10.5 Git Internals - The Refspec](https://git-scm.com/book/en/v2/G... |
2069490 | Git Diff with Beyond Compare | 148 | 2010-01-15 04:21:31 | <p>I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded and nothing else, so there is nothing in the right pane of Beyond Compare.</p>
<p>I am running git 1.6.3.1 with Cygw... | 171,478 | 191,577 | 2024-05-28 05:25:04 | 3,395,497 | 168 | 2010-08-03 10:10:23 | 46,090 | 2024-01-20 04:43:03 | https://stackoverflow.com/q/2069490 | https://stackoverflow.com/a/3395497 | <p>I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my <strong>.git/config</strong> file.</p>
<pre><code>[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
#use cygpath to transform cygwin path $LOCAL (something li... | <p>I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my <strong>.git/config</strong> file.</p> <pre><code>[diff] tool = bc3 [difftool] prompt = false [difftool "bc3"] #use cygpath to transform cygwin path $LOCAL (something li... | 119, 15129 | beyondcompare, git | <h1>Git Diff with Beyond Compare</h1>
<p>I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded and nothing else, so there is nothing in the right pane of Beyond Compare.</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,273 | git | # Git Diff with Beyond Compare
I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded and nothing else, so there is nothing in the right pane of Beyond Compare.
I am running ... | I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my **.git/config** file.
```
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
#use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path,... |
23492381 | Does Git warn me if a shorthand commit ID can refer to 2 different commits? | 130 | 2014-05-06 10:39:02 | <p>If <code>cee157</code> can refer to 2 different commit IDs, such as </p>
<p><code>cee157eb799af829a9a0c42c0915f55cd29818d4</code> and <code>cee1577fecf6fc5369a80bd6e926ac5f864a754b</code></p>
<p>will Git warn me if I type in <code>git log cee157</code>? (or Git 1.8.5.2 (Apple Git-48) allows me to type in <code>gi... | 5,102 | 325,418 | 2014-05-09 19:33:58 | 23,492,539 | 168 | 2014-05-06 10:46:17 | 641,955 | 2014-05-07 05:42:22 | https://stackoverflow.com/q/23492381 | https://stackoverflow.com/a/23492539 | <p>It should give you something like this:</p>
<pre><code>$ git log cee157
error: short SHA1 cee157 is ambiguous.
error: short SHA1 cee157 is ambiguous.
fatal: ambiguous argument 'cee157': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<... | <p>It should give you something like this:</p> <pre><code>$ git log cee157 error: short SHA1 cee157 is ambiguous. error: short SHA1 cee157 is ambiguous. fatal: ambiguous argument 'cee157': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<... | 119 | git | <h1>Does Git warn me if a shorthand commit ID can refer to 2 different commits?</h1>
<p>If <code>cee157</code> can refer to 2 different commit IDs, such as </p>
<p><code>cee157eb799af829a9a0c42c0915f55cd29818d4</code> and <code>cee1577fecf6fc5369a80bd6e926ac5f864a754b</code></p>
<p>will Git warn me if I type in <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,275 | git | # Does Git warn me if a shorthand commit ID can refer to 2 different commits?
If `cee157` can refer to 2 different commit IDs, such as
`cee157eb799af829a9a0c42c0915f55cd29818d4` and `cee1577fecf6fc5369a80bd6e926ac5f864a754b`
will Git warn me if I type in `git log cee157`? (or Git 1.8.5.2 (Apple Git-48) allows me to ... | It should give you something like this:
```
$ git log cee157
error: short SHA1 cee157 is ambiguous.
error: short SHA1 cee157 is ambiguous.
fatal: ambiguous argument 'cee157': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file... |
2676912 | Resuming git-svn clone | 129 | 2010-04-20 16:35:20 | <p>I started cloning an SVN repository using the git-svn's clone operation. After about 6 hours of importing (it's a big repo), my computer went and slept on me. Is there a way to resume the operation without redoing all of the initial work?</p>
| 26,974 | 81,491 | 2019-05-23 04:31:34 | 2,677,228 | 168 | 2010-04-20 17:24:40 | 6,309 | 2019-05-23 04:31:34 | https://stackoverflow.com/q/2676912 | https://stackoverflow.com/a/2677228 | <p>The <code>git svn fetch</code> command to resume a <code>git svn clone</code> is confirmed by several sources:</p>
<ul>
<li><a href="https://web.archive.org/web/20101203210755/http://gsocblog.jsharpe.net/archives/4" rel="noreferrer">Git svn and Gnome</a> blog entry</li>
</ul>
<blockquote>
<p>(Incidentally, if du... | <p>The <code>git svn fetch</code> command to resume a <code>git svn clone</code> is confirmed by several sources:</p> <ul> <li><a href="https://web.archive.org/web/20101203210755/http://gsocblog.jsharpe.net/archives/4" rel="noreferrer">Git svn and Gnome</a> blog entry</li> </ul> <blockquote> <p>(Incidentally, if du... | 119, 6452 | git, git-svn | <h1>Resuming git-svn clone</h1>
<p>I started cloning an SVN repository using the git-svn's clone operation. After about 6 hours of importing (it's a big repo), my computer went and slept on me. Is there a way to resume the operation without redoing all of the initial work?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,276 | git | # Resuming git-svn clone
I started cloning an SVN repository using the git-svn's clone operation. After about 6 hours of importing (it's a big repo), my computer went and slept on me. Is there a way to resume the operation without redoing all of the initial work? | The `git svn fetch` command to resume a `git svn clone` is confirmed by several sources:
- [Git svn and Gnome](https://web.archive.org/web/20101203210755/http://gsocblog.jsharpe.net/archives/4) blog entry
> (Incidentally, if during the initial clone step your connection dies or you need to stop it then to resume the ... |
18079433 | How to reset "local" git repository? | 76 | 2013-08-06 11:52:16 | <p>I was trying to ignore some folders when pushing and ended up with only the <code>.gitignore</code> in the repository. Now want to "reset" my repository (by reset I mean to remove all the rules I applied and clean the commit area), so that I can add all my files and remove the folders I don't want after that. Any he... | 126,854 | 1,237,359 | 2013-08-06 12:47:29 | 18,079,487 | 168 | 2013-08-06 11:54:50 | 97,073 | 2013-08-06 12:47:29 | https://stackoverflow.com/q/18079433 | https://stackoverflow.com/a/18079487 | <p>You could just delete your .git folder and start again.</p>
<pre><code>rm -rf .git
git init
</code></pre>
<p>This will leave the current .gitignore in place, which would still be followed by the new git repo. The .gitignore could be removed, or delete the contents so it is a blank file.</p>
| <p>You could just delete your .git folder and start again.</p> <pre><code>rm -rf .git git init </code></pre> <p>This will leave the current .gitignore in place, which would still be followed by the new git repo. The .gitignore could be removed, or delete the contents so it is a blank file.</p> | 119 | git | <h1>How to reset "local" git repository?</h1>
<p>I was trying to ignore some folders when pushing and ended up with only the <code>.gitignore</code> in the repository. Now want to "reset" my repository (by reset I mean to remove all the rules I applied and clean the commit area), so that I can add all my files and remo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,278 | git | # How to reset "local" git repository?
I was trying to ignore some folders when pushing and ended up with only the `.gitignore` in the repository. Now want to "reset" my repository (by reset I mean to remove all the rules I applied and clean the commit area), so that I can add all my files and remove the folders I don... | You could just delete your .git folder and start again.
```
rm -rf .git
git init
```
This will leave the current .gitignore in place, which would still be followed by the new git repo. The .gitignore could be removed, or delete the contents so it is a blank file. |
1657017 | How to squash all git commits into one? | 832 | 2009-11-01 08:38:06 | <p>How do you squash your entire repository down to the first commit?</p>
<p>I can rebase to the first commit, but that would leave me with 2 commits.
Is there a way to reference the commit before the first one?</p>
| 608,159 | 84,399 | 2025-10-28 02:35:00 | 1,657,287 | 167 | 2009-11-01 14:23:33 | 825 | 2009-11-01 14:23:33 | https://stackoverflow.com/q/1657017 | https://stackoverflow.com/a/1657287 | <p>Perhaps the easiest way is to just create a new repository with current state of the working copy. If you want to keep all the commit messages you could first do <code>git log > original.log</code> and then edit that for your initial commit message in the new repository:</p>
<pre><code>rm -rf .git
git init
git ... | <p>Perhaps the easiest way is to just create a new repository with current state of the working copy. If you want to keep all the commit messages you could first do <code>git log > original.log</code> and then edit that for your initial commit message in the new repository:</p> <pre><code>rm -rf .git git init git ... | 119, 8974, 29934, 91259, 98455 | git, git-rebase, git-rewrite-history, git-squash, rebase | <h1>How to squash all git commits into one?</h1>
<p>How do you squash your entire repository down to the first commit?</p>
<p>I can rebase to the first commit, but that would leave me with 2 commits.
Is there a way to reference the commit before the first one?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,279 | git | # How to squash all git commits into one?
How do you squash your entire repository down to the first commit?
I can rebase to the first commit, but that would leave me with 2 commits.
Is there a way to reference the commit before the first one? | Perhaps the easiest way is to just create a new repository with current state of the working copy. If you want to keep all the commit messages you could first do `git log > original.log` and then edit that for your initial commit message in the new repository:
```
rm -rf .git
git init
git add .
git commit
```
or
```... |
427207 | Can Git hook scripts be managed along with the repository? | 553 | 2009-01-09 06:05:57 | <p>We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <code><project>/.git/hooks/</code>. However, those scripts are not propagated when people do a clone and they are not version contro... | 167,983 | 825 | 2024-03-06 14:40:55 | 427,269 | 167 | 2009-01-09 06:53:56 | 28,804 | 2024-03-06 14:40:55 | https://stackoverflow.com/q/427207 | https://stackoverflow.com/a/427269 | <p>Theoretically, you could create a <code>hooks</code> directory (or whatever name you prefer) in your project directory with all the scripts, and then symlink them in <code>.git/hooks</code>. Of course, each person who cloned the repo would have to set up these symlinks (although you could get really fancy and have a... | <p>Theoretically, you could create a <code>hooks</code> directory (or whatever name you prefer) in your project directory with all the scripts, and then symlink them in <code>.git/hooks</code>. Of course, each person who cloned the repo would have to set up these symlinks (although you could get really fancy and have a... | 119, 43087 | git, githooks | <h1>Can Git hook scripts be managed along with the repository?</h1>
<p>We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <code><project>/.git/hooks/</code>. However, those scripts are n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,280 | git | # Can Git hook scripts be managed along with the repository?
We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under `<project>/.git/hooks/`. However, those scripts are not propagated when people do... | Theoretically, you could create a `hooks` directory (or whatever name you prefer) in your project directory with all the scripts, and then symlink them in `.git/hooks`. Of course, each person who cloned the repo would have to set up these symlinks (although you could get really fancy and have a deploy script that the c... |
25156238 | TortoiseGit not showing icon overlays | 182 | 2014-08-06 09:03:37 | <p>I have been using <code>TortoiseGit</code> for almost a full year now. It has been working very well for me until yesterday, when I encountered a problem. I was deleting a folder when Windows Explorer sort of crashed on me (it hung on "discovering items") for over an hour, then I restarted the system.</p>
<p>Since ... | 152,539 | 2,381,279 | 2024-04-09 01:09:26 | 26,534,509 | 167 | 2014-10-23 18:08:23 | 305,469 | 2022-04-03 03:47:45 | https://stackoverflow.com/q/25156238 | https://stackoverflow.com/a/26534509 | <p>I had the same problem and I got it to work by following instructions from a forum. What I did was this (copied):</p>
<blockquote>
<p>I find solution :)
Wrapping with <code>""</code> all tortoise keys under <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdenti... | <p>I had the same problem and I got it to work by following instructions from a forum. What I did was this (copied):</p> <blockquote> <p>I find solution :) Wrapping with <code>""</code> all tortoise keys under <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdenti... | 119, 31409 | git, tortoisegit | <h1>TortoiseGit not showing icon overlays</h1>
<p>I have been using <code>TortoiseGit</code> for almost a full year now. It has been working very well for me until yesterday, when I encountered a problem. I was deleting a folder when Windows Explorer sort of crashed on me (it hung on "discovering items") for over an ho... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,281 | git | # TortoiseGit not showing icon overlays
I have been using `TortoiseGit` for almost a full year now. It has been working very well for me until yesterday, when I encountered a problem. I was deleting a folder when Windows Explorer sort of crashed on me (it hung on "discovering items") for over an hour, then I restarted... | I had the same problem and I got it to work by following instructions from a forum. What I did was this (copied):
> I find solution :)
> Wrapping with `""` all tortoise keys under `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers`
> on `1TortoiseNormal` and etc...
> I ... |
10169328 | git - Your branch is ahead of 'origin/master' by 1 commit | 171 | 2012-04-16 06:00:39 | <p>I am newbie in git and I am working on git. </p>
<p>I added some files in git : </p>
<pre><code>git add <file1>
git add <file2>
</code></pre>
<p>then I wanted to push that for review, but mistakenly I did</p>
<pre><code>git commit
</code></pre>
<p>so the files which I have changed don't go for rev... | 537,531 | 778,942 | 2022-04-22 15:35:07 | 10,169,382 | 167 | 2012-04-16 06:06:24 | 406,323 | 2012-04-16 06:06:24 | https://stackoverflow.com/q/10169328 | https://stackoverflow.com/a/10169382 | <p>You cannot push anything that hasn't been committed yet. The order of operations is:</p>
<ol>
<li>Make your change.</li>
<li><code>git add</code> - this stages your changes for committing</li>
<li><code>git commit</code> - this commits your staged changes locally</li>
<li><code>git push</code> - this pushes your co... | <p>You cannot push anything that hasn't been committed yet. The order of operations is:</p> <ol> <li>Make your change.</li> <li><code>git add</code> - this stages your changes for committing</li> <li><code>git commit</code> - this commits your staged changes locally</li> <li><code>git push</code> - this pushes your co... | 119, 4236, 5597 | commit, git, push | <h1>git - Your branch is ahead of 'origin/master' by 1 commit</h1>
<p>I am newbie in git and I am working on git. </p>
<p>I added some files in git : </p>
<pre><code>git add <file1>
git add <file2>
</code></pre>
<p>then I wanted to push that for review, but mistakenly I did</p>
<pre><code>git commit
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,282 | git | # git - Your branch is ahead of 'origin/master' by 1 commit
I am newbie in git and I am working on git.
I added some files in git :
```
git add <file1>
git add <file2>
```
then I wanted to push that for review, but mistakenly I did
```
git commit
```
so the files which I have changed don't go for reviews.
Now i... | You cannot push anything that hasn't been committed yet. The order of operations is:
1. Make your change.
2. `git add` - this stages your changes for committing
3. `git commit` - this commits your staged changes locally
4. `git push` - this pushes your committed changes to a remote
If you push without committing, not... |
42861353 | git pull *after* git rebase? | 124 | 2017-03-17 15:24:22 | <p>I have a feature branch, and a master branch.</p>
<p>Master branch has evolved and I mean to have those updates to diverging as little as possible from master branch.</p>
<p>So I <code>git pull</code> in both branches, <code>git checkout feature/branch</code> and finally <code>git rebase master</code>.</p>
<p>Now... | 113,482 | 745,920 | 2024-06-28 11:51:30 | 42,862,404 | 167 | 2017-03-17 16:16:03 | 26,396 | 2022-08-22 14:09:41 | https://stackoverflow.com/q/42861353 | https://stackoverflow.com/a/42862404 | <p><strong>tl;dr</strong> You should update both <code>master</code> and <code>feature</code> with <code>git pull</code> and <code>git pull --rebase</code> <strong>before</strong> rebasing <code>feature</code> on top of <code>master</code>. <strong>There is no need to do a</strong> <code>git pull</code> <strong>after</... | <p><strong>tl;dr</strong> You should update both <code>master</code> and <code>feature</code> with <code>git pull</code> and <code>git pull --rebase</code> <strong>before</strong> rebasing <code>feature</code> on top of <code>master</code>. <strong>There is no need to do a</strong> <code>git pull</code> <strong>after</... | 119, 8974 | git, rebase | <h1>git pull *after* git rebase?</h1>
<p>I have a feature branch, and a master branch.</p>
<p>Master branch has evolved and I mean to have those updates to diverging as little as possible from master branch.</p>
<p>So I <code>git pull</code> in both branches, <code>git checkout feature/branch</code> and finally <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,283 | git | # git pull *after* git rebase?
I have a feature branch, and a master branch.
Master branch has evolved and I mean to have those updates to diverging as little as possible from master branch.
So I `git pull` in both branches, `git checkout feature/branch` and finally `git rebase master`.
Now here I either expect eve... | **tl;dr** You should update both `master` and `feature` with `git pull` and `git pull --rebase` **before** rebasing `feature` on top of `master`. **There is no need to do a** `git pull` **after** you have rebased your `feature` branch on top of `master`.
With your current workflow, the reason why `git status` is telli... |
6011521 | opposite of .gitignore file? | 119 | 2011-05-15 21:52:38 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/987142/make-gitignore-ignore-everything-except-a-few-files">Make .gitignore ignore everything except a few files</a> </p>
</blockquote>
<p>Is it possible to let git ignore all files by default, unless specified... | 40,645 | 147,530 | 2012-10-09 06:46:41 | 6,011,532 | 167 | 2011-05-15 21:55:23 | 85,371 | 2012-10-09 06:46:41 | https://stackoverflow.com/q/6011521 | https://stackoverflow.com/a/6011532 | <p>You can include !-lines to whitelist files: a .gitignore with:</p>
<pre><code>*
!included/
</code></pre>
<p>will exclude all, but the 'included/' directory</p>
<p>Note that if you want files matching a pattern to be un-ignored, in subdirectories, you will need to prevent the containing directories from getting ig... | <p>You can include !-lines to whitelist files: a .gitignore with:</p> <pre><code>* !included/ </code></pre> <p>will exclude all, but the 'included/' directory</p> <p>Note that if you want files matching a pattern to be un-ignored, in subdirectories, you will need to prevent the containing directories from getting ig... | 119 | git | <h1>opposite of .gitignore file?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/987142/make-gitignore-ignore-everything-except-a-few-files">Make .gitignore ignore everything except a few files</a> </p>
</blockquote>
<p>Is it possible to let git ignore ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,284 | git | # opposite of .gitignore file?
> **Possible Duplicate:**
> [Make .gitignore ignore everything except a few files](https://stackoverflow.com/questions/987142/make-gitignore-ignore-everything-except-a-few-files)
Is it possible to let git ignore all files by default, unless specified in a special file? | You can include !-lines to whitelist files: a .gitignore with:
```
*
!included/
```
will exclude all, but the 'included/' directory
Note that if you want files matching a pattern to be un-ignored, in subdirectories, you will need to prevent the containing directories from getting ignored too. This should not pose a ... |
28225045 | No such keg: /usr/local/Cellar/git | 83 | 2015-01-29 21:35:03 | <p>I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing <code>$git add -i</code> and I got this error:</p>
<blockquote>
<p>Can't locate Git.pm in @INC (@INC contains:</p>
</blockquote>
<p>So I followed the instructions h... | 271,214 | 4,509,210 | 2021-12-01 08:48:12 | 28,240,901 | 167 | 2015-01-30 17:01:23 | 1,496,501 | 2020-10-18 18:48:56 | https://stackoverflow.com/q/28225045 | https://stackoverflow.com/a/28240901 | <p>Give another go at force removing the brewed version of git</p>
<pre><code>brew uninstall --force git
</code></pre>
<p>Then cleanup any older versions and clear the brew cache</p>
<pre><code>brew cleanup -s git
</code></pre>
<p>Remove any dead symlinks</p>
<pre><code>brew cleanup --prune-prefix
</code></pre>
<p>Then... | <p>Give another go at force removing the brewed version of git</p> <pre><code>brew uninstall --force git </code></pre> <p>Then cleanup any older versions and clear the brew cache</p> <pre><code>brew cleanup -s git </code></pre> <p>Remove any dead symlinks</p> <pre><code>brew cleanup --prune-prefix </code></pre> <p>Then... | 119, 369, 1067 | git, homebrew, macos | <h1>No such keg: /usr/local/Cellar/git</h1>
<p>I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing <code>$git add -i</code> and I got this error:</p>
<blockquote>
<p>Can't locate Git.pm in @INC (@INC contains:</p>
</bloc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,285 | git | # No such keg: /usr/local/Cellar/git
I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing `$git add -i` and I got this error:
> Can't locate Git.pm in @INC (@INC contains:
So I followed the instructions here:
[Can't locat... | Give another go at force removing the brewed version of git
```
brew uninstall --force git
```
Then cleanup any older versions and clear the brew cache
```
brew cleanup -s git
```
Remove any dead symlinks
```
brew cleanup --prune-prefix
```
Then try reinstalling git
```
brew install git
```
If that doesn't work... |
12534312 | Revert a merge after being pushed | 149 | 2012-09-21 16:20:10 | <p>Steps I performed:</p>
<p>I have two branches branch1 and branch2,</p>
<pre><code>$git branch --Initial state
$branch1
$git checkout branch2
$git pull origin branch1 --Step1
</code></pre>
<p>I resolve the conflicts and did a</p>
<pre><code>$git commit -m "Merge resolved"
</code></pre>
<p>then</p>
<pre><co... | 223,148 | 599,989 | 2023-02-04 21:28:07 | 12,554,525 | 166 | 2012-09-23 17:28:04 | 330,280 | 2012-09-23 17:28:04 | https://stackoverflow.com/q/12534312 | https://stackoverflow.com/a/12554525 | <p>You can revert the merge following the <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt" rel="noreferrer">official guide</a>, however this leaves Git with the erroneous belief that the merged commits are still on the target branch.</p>
<p>Basically you have to : </p>
<pre><c... | <p>You can revert the merge following the <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt" rel="noreferrer">official guide</a>, however this leaves Git with the erroneous belief that the merged commits are still on the target branch.</p> <p>Basically you have to : </p> <pre><c... | 119, 34403 | git, git-revert | <h1>Revert a merge after being pushed</h1>
<p>Steps I performed:</p>
<p>I have two branches branch1 and branch2,</p>
<pre><code>$git branch --Initial state
$branch1
$git checkout branch2
$git pull origin branch1 --Step1
</code></pre>
<p>I resolve the conflicts and did a</p>
<pre><code>$git commit -m "Merge resolv... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,286 | git | # Revert a merge after being pushed
Steps I performed:
I have two branches branch1 and branch2,
```
$git branch --Initial state
$branch1
$git checkout branch2
$git pull origin branch1 --Step1
```
I resolve the conflicts and did a
```
$git commit -m "Merge resolved"
```
then
```
$git checkout branch1
$git merge ... | You can revert the merge following the [official guide](http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt), however this leaves Git with the erroneous belief that the merged commits are still on the target branch.
Basically you have to :
```
git revert -m 1 (Commit id of the merge commit... |
17244471 | See diff between current state and last commit | 141 | 2013-06-21 21:19:47 | <p>Sometimes when I'm about to make a commit, I can't recall exactly what has changed since the last commit. How can I see a diff of the current state of the code and the last commit? </p>
| 129,112 | 877,271 | 2021-01-07 21:23:40 | 17,244,494 | 166 | 2013-06-21 21:21:47 | 46,194 | 2013-06-21 21:32:11 | https://stackoverflow.com/q/17244471 | https://stackoverflow.com/a/17244494 | <p>If you haven't added any files to the index yet (with <code>git add</code>), simply do</p>
<pre><code>git diff
</code></pre>
<p>This will show the diff between your working tree and index.</p>
<p>If you have added files to the index, you need to do this to show the differences between index and the last commit (H... | <p>If you haven't added any files to the index yet (with <code>git add</code>), simply do</p> <pre><code>git diff </code></pre> <p>This will show the diff between your working tree and index.</p> <p>If you have added files to the index, you need to do this to show the differences between index and the last commit (H... | 119 | git | <h1>See diff between current state and last commit</h1>
<p>Sometimes when I'm about to make a commit, I can't recall exactly what has changed since the last commit. How can I see a diff of the current state of the code and the last commit? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,287 | git | # See diff between current state and last commit
Sometimes when I'm about to make a commit, I can't recall exactly what has changed since the last commit. How can I see a diff of the current state of the code and the last commit? | If you haven't added any files to the index yet (with `git add`), simply do
```
git diff
```
This will show the diff between your working tree and index.
If you have added files to the index, you need to do this to show the differences between index and the last commit (HEAD).
```
git diff --cached
```
Finally, if... |
14542326 | Undo git filter-branch | 88 | 2013-01-26 22:40:56 | <p>I accidentally delete a file from my repo using git filter-branch:</p>
<pre><code>git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch images/thumb/a.JPG' HEAD
</code></pre>
<p>How can I undo this? Is it possible? i.e. is the file permanently deleted?</p>
| 35,097 | 1,748,450 | 2018-11-23 19:18:34 | 14,544,544 | 166 | 2013-01-27 04:52:09 | 1,965,396 | 2014-01-10 22:26:14 | https://stackoverflow.com/q/14542326 | https://stackoverflow.com/a/14544544 | <p>When you use <code>git filter-branch</code>, a backup file is created in </p>
<pre><code>refs/original/refs/heads/master
</code></pre>
<p>If you used the command in branch <code>master</code>. You can check if you have the backup in <code>.git/refs</code> directory. With this in mind, you can use this backup to re... | <p>When you use <code>git filter-branch</code>, a backup file is created in </p> <pre><code>refs/original/refs/heads/master </code></pre> <p>If you used the command in branch <code>master</code>. You can check if you have the backup in <code>.git/refs</code> directory. With this in mind, you can use this backup to re... | 119 | git | <h1>Undo git filter-branch</h1>
<p>I accidentally delete a file from my repo using git filter-branch:</p>
<pre><code>git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch images/thumb/a.JPG' HEAD
</code></pre>
<p>How can I undo this? Is it possible? i.e. is the file permanently deleted?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,289 | git | # Undo git filter-branch
I accidentally delete a file from my repo using git filter-branch:
```
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch images/thumb/a.JPG' HEAD
```
How can I undo this? Is it possible? i.e. is the file permanently deleted? | When you use `git filter-branch`, a backup file is created in
```
refs/original/refs/heads/master
```
If you used the command in branch `master`. You can check if you have the backup in `.git/refs` directory. With this in mind, you can use this backup to recover your files with:
```
git reset --hard refs/original/re... |
71901632 | Fatal error "unsafe repository ('/home/repon' is owned by someone else)" | 217 | 2022-04-17 11:49:59 | <p>I found an error log from Apache 2 that is fatal:</p>
<pre class="lang-none prettyprint-override"><code>unsafe repository ('/home/repon' is owned by someone else)
</code></pre>
<p>It happens because I have <code>git rev-parse --symbolic-full-name --abbrev-ref HEAD'</code> in PHP code, and it looks like the <a href="... | 200,184 | 18,836,161 | 2023-04-11 03:52:22 | 71,941,707 | 165 | 2022-04-20 14:45:57 | 10,126,479 | 2022-06-05 09:38:42 | https://stackoverflow.com/q/71901632 | https://stackoverflow.com/a/71941707 | <p>This started appearing with the release of the Git 2.35.2 security update which fixes vulnerabilities described <a href="https://github.blog/2022-04-12-git-security-vulnerability-announced/" rel="noreferrer">here</a>. Credits @Juan-Kabbali</p>
<p>Here are four possible solutions:</p>
<ul>
<li>trust the Git directory... | <p>This started appearing with the release of the Git 2.35.2 security update which fixes vulnerabilities described <a href="https://github.blog/2022-04-12-git-security-vulnerability-announced/" rel="noreferrer">here</a>. Credits @Juan-Kabbali</p> <p>Here are four possible solutions:</p> <ul> <li>trust the Git directory... | 119, 155837 | cve-2022-24765, git | <h1>Fatal error "unsafe repository ('/home/repon' is owned by someone else)"</h1>
<p>I found an error log from Apache 2 that is fatal:</p>
<pre class="lang-none prettyprint-override"><code>unsafe repository ('/home/repon' is owned by someone else)
</code></pre>
<p>It happens because I have <code>git rev-parse --symboli... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,290 | git | # Fatal error "unsafe repository ('/home/repon' is owned by someone else)"
I found an error log from Apache 2 that is fatal:
```
unsafe repository ('/home/repon' is owned by someone else)
```
It happens because I have `git rev-parse --symbolic-full-name --abbrev-ref HEAD'` in PHP code, and it looks like the [new Git... | This started appearing with the release of the Git 2.35.2 security update which fixes vulnerabilities described [here](https://github.blog/2022-04-12-git-security-vulnerability-announced/). Credits @Juan-Kabbali
Here are four possible solutions:
- trust the Git directory (do it if you know the directory contents are ... |
19576116 | How to add multiple files to Git at the same time | 209 | 2013-10-24 20:35:42 | <p>This will be my first git use. I have added new files ( a lot ) to the folder/project ( git local repository).</p>
<p>I went through online tutorials and forums and see i can do</p>
<pre><code>git commit -a
</code></pre>
<p>So I go to the base folder of the repository and do a</p>
<pre><code>sudo git commit -a
</cod... | 551,405 | 1,404,317 | 2023-12-19 18:30:23 | 19,576,183 | 165 | 2013-10-24 20:39:20 | 2,128,691 | 2014-02-28 07:04:46 | https://stackoverflow.com/q/19576116 | https://stackoverflow.com/a/19576183 | <p>To add all the changes you've made:</p>
<p><code>git add .</code></p>
<p>To commit them:</p>
<p><code>git commit -m "MY MESSAGE HERE"</code> #-m is the message flag</p>
<p>You can put those steps together like this:</p>
<p><code>git commit -a -m "MY MESSAGE HERE"</code></p>
<p>To push your committed changes fr... | <p>To add all the changes you've made:</p> <p><code>git add .</code></p> <p>To commit them:</p> <p><code>git commit -m "MY MESSAGE HERE"</code> #-m is the message flag</p> <p>You can put those steps together like this:</p> <p><code>git commit -a -m "MY MESSAGE HERE"</code></p> <p>To push your committed changes fr... | 119, 4236, 5597 | commit, git, push | <h1>How to add multiple files to Git at the same time</h1>
<p>This will be my first git use. I have added new files ( a lot ) to the folder/project ( git local repository).</p>
<p>I went through online tutorials and forums and see i can do</p>
<pre><code>git commit -a
</code></pre>
<p>So I go to the base folder of the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,291 | git | # How to add multiple files to Git at the same time
This will be my first git use. I have added new files ( a lot ) to the folder/project ( git local repository).
I went through online tutorials and forums and see i can do
```
git commit -a
```
So I go to the base folder of the repository and do a
```
sudo git com... | To add all the changes you've made:
`git add .`
To commit them:
`git commit -m "MY MESSAGE HERE"` #-m is the message flag
You can put those steps together like this:
`git commit -a -m "MY MESSAGE HERE"`
To push your committed changes from your local repository to your remote repository:
`git push origin master`
... |
1282639 | Switch Git branch without files checkout | 155 | 2009-08-15 19:32:01 | <p>Is it possible in Git to switch to another branch without checking out all files?</p>
<p>After switching branch I need to delete all files, regenerate them, commit and switch back. So checking out files is just a waste of time (and there are about 14,000 files - it is a long operation).</p>
<p>To make everything c... | 84,024 | 96,823 | 2020-08-19 12:31:22 | 1,282,894 | 165 | 2009-08-15 21:29:30 | 19,563 | 2009-08-15 21:29:30 | https://stackoverflow.com/q/1282639 | https://stackoverflow.com/a/1282894 | <p>Yes, you can do this.</p>
<pre><code>git symbolic-ref HEAD refs/heads/otherbranch
</code></pre>
<p>If you need to commit on this branch, you'll want to reset the index too otherwise you'll end up committing something based on the last checked out branch.</p>
<pre><code>git reset
</code></pre>
| <p>Yes, you can do this.</p> <pre><code>git symbolic-ref HEAD refs/heads/otherbranch </code></pre> <p>If you need to commit on this branch, you'll want to reset the index too otherwise you'll end up committing something based on the last checked out branch.</p> <pre><code>git reset </code></pre> | 119, 1879, 37230 | branch, git, git-checkout | <h1>Switch Git branch without files checkout</h1>
<p>Is it possible in Git to switch to another branch without checking out all files?</p>
<p>After switching branch I need to delete all files, regenerate them, commit and switch back. So checking out files is just a waste of time (and there are about 14,000 files - it ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,293 | git | # Switch Git branch without files checkout
Is it possible in Git to switch to another branch without checking out all files?
After switching branch I need to delete all files, regenerate them, commit and switch back. So checking out files is just a waste of time (and there are about 14,000 files - it is a long operat... | Yes, you can do this.
```
git symbolic-ref HEAD refs/heads/otherbranch
```
If you need to commit on this branch, you'll want to reset the index too otherwise you'll end up committing something based on the last checked out branch.
```
git reset
``` |
20008025 | Git: Checkout all files except one | 88 | 2013-11-15 18:24:26 | <p>When I do a git status, I see files like this:</p>
<pre><code>modified: dir/A/file.txt
modified: dir/B/file.txt
modified: dir/C/file.txt
modified: dir/D/file.txt
</code></pre>
<p>What I want to do is to discard changes to all files EXCEPT for dir/C/file.txt</p>
<p>I want to do something like this:</p>
<pre><... | 38,519 | 3,335 | 2024-01-01 00:23:47 | 20,008,082 | 165 | 2013-11-15 18:27:37 | 1,464,605 | 2013-11-15 18:27:37 | https://stackoverflow.com/q/20008025 | https://stackoverflow.com/a/20008082 | <pre><code>git add dir/C/file.txt # this file will stay modified and staged
git checkout .
</code></pre>
<p>If you want to unstage the file after that:</p>
<pre><code>git reset
</code></pre>
| <pre><code>git add dir/C/file.txt # this file will stay modified and staged git checkout . </code></pre> <p>If you want to unstage the file after that:</p> <pre><code>git reset </code></pre> | 119, 37230 | git, git-checkout | <h1>Git: Checkout all files except one</h1>
<p>When I do a git status, I see files like this:</p>
<pre><code>modified: dir/A/file.txt
modified: dir/B/file.txt
modified: dir/C/file.txt
modified: dir/D/file.txt
</code></pre>
<p>What I want to do is to discard changes to all files EXCEPT for dir/C/file.txt</p>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,296 | git | # Git: Checkout all files except one
When I do a git status, I see files like this:
```
modified: dir/A/file.txt
modified: dir/B/file.txt
modified: dir/C/file.txt
modified: dir/D/file.txt
```
What I want to do is to discard changes to all files EXCEPT for dir/C/file.txt
I want to do something like this:
```
gi... | ```
git add dir/C/file.txt # this file will stay modified and staged
git checkout .
```
If you want to unstage the file after that:
```
git reset
``` |
10196668 | Git rollback 1 pull | 66 | 2012-04-17 18:12:29 | <p>I have a web server that serves a project that is a git repository. When I do some changes to the code I then do a git pull from the server. Sometimes the new code just crashes, I would like to be able to do a rollback to the latest pull, the one just before. I want to do that with a script, without having to search... | 137,460 | 1,075,374 | 2020-12-06 10:36:40 | 10,197,858 | 165 | 2012-04-17 19:31:06 | 389,146 | 2012-04-17 19:31:06 | https://stackoverflow.com/q/10196668 | https://stackoverflow.com/a/10197858 | <p><code>git reset --hard HEAD^1</code> will take you back one commit from what you pulled. If you want it back to the state it was in before you pulled, use <code>git reset --hard HEAD@{1}</code>. The <code>@{1}</code> tracks where the head was at before the last operation that changed it in your local repo, so it w... | <p><code>git reset --hard HEAD^1</code> will take you back one commit from what you pulled. If you want it back to the state it was in before you pulled, use <code>git reset --hard HEAD@{1}</code>. The <code>@{1}</code> tracks where the head was at before the last operation that changed it in your local repo, so it w... | 119, 12196 | git, rollback | <h1>Git rollback 1 pull</h1>
<p>I have a web server that serves a project that is a git repository. When I do some changes to the code I then do a git pull from the server. Sometimes the new code just crashes, I would like to be able to do a rollback to the latest pull, the one just before. I want to do that with a scr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,297 | git | # Git rollback 1 pull
I have a web server that serves a project that is a git repository. When I do some changes to the code I then do a git pull from the server. Sometimes the new code just crashes, I would like to be able to do a rollback to the latest pull, the one just before. I want to do that with a script, with... | `git reset --hard HEAD^1` will take you back one commit from what you pulled. If you want it back to the state it was in before you pulled, use `git reset --hard HEAD@{1}`. The `@{1}` tracks where the head was at before the last operation that changed it in your local repo, so it will go back several commits if several... |
28238037 | Git log out user from command line | 198 | 2015-01-30 14:29:55 | <p>Is there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal. </p>
| 662,743 | 3,783,804 | 2024-12-26 11:02:47 | 28,238,196 | 164 | 2015-01-30 14:37:44 | 799,073 | 2024-11-18 04:42:17 | https://stackoverflow.com/q/28238037 | https://stackoverflow.com/a/28238196 | <p>Remove your SSH keys from <code>~/.ssh</code> (or where you stored them).</p>
<p>Remove your user settings:</p>
<pre><code>git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
</code></pre>
<p>Or all your global settings:</p>
<pre><code>git config... | <p>Remove your SSH keys from <code>~/.ssh</code> (or where you stored them).</p> <p>Remove your user settings:</p> <pre><code>git config --global --unset user.name git config --global --unset user.email git config --global --unset credential.helper </code></pre> <p>Or all your global settings:</p> <pre><code>git config... | 119 | git | <h1>Git log out user from command line</h1>
<p>Is there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,299 | git | # Git log out user from command line
Is there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal. | Remove your SSH keys from `~/.ssh` (or where you stored them).
Remove your user settings:
```
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
```
Or all your global settings:
```
git config --global --unset-all
```
For newer versions of Git... |
17688594 | How to Diff between local uncommitted changes and origin | 184 | 2013-07-16 23:21:20 | <p>Let's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows <code>git diff test.txt</code> and it will show me the difference between the current local HEAD and the modified, uncommitted changes in the file. If I commit those changes I can ... | 166,334 | 79,339 | 2021-05-20 06:50:52 | 17,688,732 | 164 | 2013-07-16 23:35:42 | 356,895 | 2013-07-16 23:35:42 | https://stackoverflow.com/q/17688594 | https://stackoverflow.com/a/17688732 | <p>Given that the remote repository has been cached via <code>git fetch</code> it should be possible to compare against these commits. Try the following:</p>
<pre><code>$ git fetch origin
$ git diff origin/master
</code></pre>
| <p>Given that the remote repository has been cached via <code>git fetch</code> it should be possible to compare against these commits. Try the following:</p> <pre><code>$ git fetch origin $ git diff origin/master </code></pre> | 119, 9033 | git, git-diff | <h1>How to Diff between local uncommitted changes and origin</h1>
<p>Let's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows <code>git diff test.txt</code> and it will show me the difference between the current local HEAD and the modified,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,300 | git | # How to Diff between local uncommitted changes and origin
Let's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows `git diff test.txt` and it will show me the difference between the current local HEAD and the modified, uncommitted changes... | Given that the remote repository has been cached via `git fetch` it should be possible to compare against these commits. Try the following:
```
$ git fetch origin
$ git diff origin/master
``` |
3541647 | git add . vs git commit -a | 123 | 2010-08-22 13:34:24 | <p>What's the difference between:</p>
<ul>
<li><code>git add .</code></li>
<li><code>git commit -a</code></li>
</ul>
<p>Should I be doing both, or is that redundant?</p>
| 69,183 | 165,673 | 2019-06-04 04:43:11 | 3,541,655 | 164 | 2010-08-22 13:36:38 | 19,563 | 2010-08-22 13:42:07 | https://stackoverflow.com/q/3541647 | https://stackoverflow.com/a/3541655 | <p><code>git commit -a</code> means almost[*] the same thing as <code>git add -u && git commit</code>.</p>
<p>It's not the same as <code>git add .</code> as this would add untracked files that aren't being ignored, <code>git add -u</code> only stages changes (including deletions) to already tracked files.</p>
... | <p><code>git commit -a</code> means almost[*] the same thing as <code>git add -u && git commit</code>.</p> <p>It's not the same as <code>git add .</code> as this would add untracked files that aren't being ignored, <code>git add -u</code> only stages changes (including deletions) to already tracked files.</p> ... | 119, 456, 34792, 53850 | git, git-add, git-commit, version-control | <h1>git add . vs git commit -a</h1>
<p>What's the difference between:</p>
<ul>
<li><code>git add .</code></li>
<li><code>git commit -a</code></li>
</ul>
<p>Should I be doing both, or is that redundant?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,301 | git | # git add . vs git commit -a
What's the difference between:
- `git add .`
- `git commit -a`
Should I be doing both, or is that redundant? | `git commit -a` means almost[*] the same thing as `git add -u && git commit`.
It's not the same as `git add .` as this would add untracked files that aren't being ignored, `git add -u` only stages changes (including deletions) to already tracked files.
[*] There's a subtle difference if you're not at the root directo... |
4524998 | How to make git status show only staged files | 111 | 2010-12-24 07:52:01 | <p>I would like to get a list of only the staged filenames. I can't find the equivalent flag for <code>--name-only</code> for the <code>git status</code> command. What is a good alternative?</p>
<p>The file list will be piped to <code>php -l</code> (PHP lint syntax checker).</p>
<p><strong>Solution: the complete comm... | 52,668 | 127,401 | 2024-04-19 11:53:48 | 4,525,025 | 164 | 2010-12-24 07:59:03 | 479,989 | 2010-12-24 07:59:03 | https://stackoverflow.com/q/4524998 | https://stackoverflow.com/a/4525025 | <p>Use <code>git diff --name-only</code> (with <code>--cached</code> to get the staged files)</p>
| <p>Use <code>git diff --name-only</code> (with <code>--cached</code> to get the staged files)</p> | 119, 54839 | git, git-status | <h1>How to make git status show only staged files</h1>
<p>I would like to get a list of only the staged filenames. I can't find the equivalent flag for <code>--name-only</code> for the <code>git status</code> command. What is a good alternative?</p>
<p>The file list will be piped to <code>php -l</code> (PHP lint synta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,302 | git | # How to make git status show only staged files
I would like to get a list of only the staged filenames. I can't find the equivalent flag for `--name-only` for the `git status` command. What is a good alternative?
The file list will be piped to `php -l` (PHP lint syntax checker).
**Solution: the complete command**
... | Use `git diff --name-only` (with `--cached` to get the staged files) |
20222732 | Why does git merge sometimes create a commit, sometimes does not? | 107 | 2013-11-26 16:35:55 | <p>When I do <code>git merge</code> from another branch to current workspace, git sometimes makes a new commit:</p>
<pre><code>Merge remote-tracking branch xxx into xxx
</code></pre>
<p>Sometimes, it does not:</p>
<pre><code>Fast-forward
... src files ...
</code></pre>
<p>So what determines whether a commit should ... | 29,844 | null | 2023-05-10 08:10:29 | 20,223,069 | 164 | 2013-11-26 16:48:59 | 227,887 | 2013-11-26 16:48:59 | https://stackoverflow.com/q/20222732 | https://stackoverflow.com/a/20223069 | <p>So-called "Fast-forward" merges don't produce a commit, whereas other merges (often refered to as "octopus merge" (now you see why github's mascott is an octocat)) produce commits.</p>
<p>Basically, a Fast-forward happens when your branches did not diverge.</p>
<p>Say you want to merge a branch <code>foo</code> in... | <p>So-called "Fast-forward" merges don't produce a commit, whereas other merges (often refered to as "octopus merge" (now you see why github's mascott is an octocat)) produce commits.</p> <p>Basically, a Fast-forward happens when your branches did not diverge.</p> <p>Say you want to merge a branch <code>foo</code> in... | 119 | git | <h1>Why does git merge sometimes create a commit, sometimes does not?</h1>
<p>When I do <code>git merge</code> from another branch to current workspace, git sometimes makes a new commit:</p>
<pre><code>Merge remote-tracking branch xxx into xxx
</code></pre>
<p>Sometimes, it does not:</p>
<pre><code>Fast-forward
... ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,303 | git | # Why does git merge sometimes create a commit, sometimes does not?
When I do `git merge` from another branch to current workspace, git sometimes makes a new commit:
```
Merge remote-tracking branch xxx into xxx
```
Sometimes, it does not:
```
Fast-forward
... src files ...
```
So what determines whether a commit ... | So-called "Fast-forward" merges don't produce a commit, whereas other merges (often refered to as "octopus merge" (now you see why github's mascott is an octocat)) produce commits.
Basically, a Fast-forward happens when your branches did not diverge.
Say you want to merge a branch `foo` in the `master` branch. If the... |
10879331 | How to check merge conflicts of two branches, without merging them? | 101 | 2012-06-04 09:48:05 | <p>I can't merge two branches because of a release step of our project, but I want to know whether there are merge conflicts between them. How can I do this?</p>
| 48,224 | 1,434,823 | 2022-06-30 11:50:30 | 10,879,368 | 164 | 2012-06-04 09:50:51 | 259,576 | 2018-11-09 23:22:16 | https://stackoverflow.com/q/10879331 | https://stackoverflow.com/a/10879368 | <p>Suppose you are on the <code>master</code> branch and you would like to test if the <code>dev</code> branch can be merged without conflict into the <code>master</code>.</p>
<pre><code># In the master branch
git merge dev --no-ff --no-commit
</code></pre>
<p>After that, you will be able to know if there's a conflic... | <p>Suppose you are on the <code>master</code> branch and you would like to test if the <code>dev</code> branch can be merged without conflict into the <code>master</code>.</p> <pre><code># In the master branch git merge dev --no-ff --no-commit </code></pre> <p>After that, you will be able to know if there's a conflic... | 119 | git | <h1>How to check merge conflicts of two branches, without merging them?</h1>
<p>I can't merge two branches because of a release step of our project, but I want to know whether there are merge conflicts between them. 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 | 15,304 | git | # How to check merge conflicts of two branches, without merging them?
I can't merge two branches because of a release step of our project, but I want to know whether there are merge conflicts between them. How can I do this? | Suppose you are on the `master` branch and you would like to test if the `dev` branch can be merged without conflict into the `master`.
```
# In the master branch
git merge dev --no-ff --no-commit
```
After that, you will be able to know if there's a conflict or not.
To return in a normal situation, just abort the m... |
29583706 | How to disconnect a local Git repository from remote master | 100 | 2015-04-11 22:16:41 | <p>How do I completely disconnect a local Git repository from all remote branches?</p>
<p>I cloned a Git repository from github.com, but then it was deleted and I don't want Git to report any changes needing to be "pushed up". I've tried googling this, but I think my terminology is wrong, and I'm not finding ... | 177,699 | 247,542 | 2024-11-07 09:40:01 | 29,583,726 | 164 | 2015-04-11 22:19:08 | 143,269 | 2015-04-11 22:19:08 | https://stackoverflow.com/q/29583706 | https://stackoverflow.com/a/29583726 | <p><code>git remote rm origin</code> should work. </p>
| <p><code>git remote rm origin</code> should work. </p> | 119, 41346, 76220, 112901 | git, git-branch, git-remote, git-rm | <h1>How to disconnect a local Git repository from remote master</h1>
<p>How do I completely disconnect a local Git repository from all remote branches?</p>
<p>I cloned a Git repository from github.com, but then it was deleted and I don't want Git to report any changes needing to be "pushed up". I've tried goo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,305 | git | # How to disconnect a local Git repository from remote master
How do I completely disconnect a local Git repository from all remote branches?
I cloned a Git repository from github.com, but then it was deleted and I don't want Git to report any changes needing to be "pushed up". I've tried googling this, but I think m... | `git remote rm origin` should work. |
2342821 | Git branch deletion | 85 | 2010-02-26 15:52:08 | <p>In Git, what does "deletion" of a branch mean?</p>
<p>Will it be gone from the repository? Or will it still be navigable to via <code>git branch</code>?</p>
<p>What I really want to do is mark a branch as "dead end", i.e., the branch is so far from master, that nobody should use it as a starting point, though the... | 30,456 | 111,307 | 2017-06-16 11:12:20 | 2,343,746 | 164 | 2010-02-26 18:06:46 | 95,706 | 2011-01-11 13:55:51 | https://stackoverflow.com/q/2342821 | https://stackoverflow.com/a/2343746 | <p>You can delete the branch, but tag it first, so that it's history doesn't disappear. This way, the branch doesn't show up in the branch list, which should hopefully deter people from working on it, but the work won't be permanently erased (even after garbage collection is run). For instance, whenever I have a branch... | <p>You can delete the branch, but tag it first, so that it's history doesn't disappear. This way, the branch doesn't show up in the branch list, which should hopefully deter people from working on it, but the work won't be permanently erased (even after garbage collection is run). For instance, whenever I have a branch... | 119, 1879, 76220 | branch, git, git-branch | <h1>Git branch deletion</h1>
<p>In Git, what does "deletion" of a branch mean?</p>
<p>Will it be gone from the repository? Or will it still be navigable to via <code>git branch</code>?</p>
<p>What I really want to do is mark a branch as "dead end", i.e., the branch is so far from master, that nobody should use it as... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,306 | git | # Git branch deletion
In Git, what does "deletion" of a branch mean?
Will it be gone from the repository? Or will it still be navigable to via `git branch`?
What I really want to do is mark a branch as "dead end", i.e., the branch is so far from master, that nobody should use it as a starting point, though there wer... | You can delete the branch, but tag it first, so that it's history doesn't disappear. This way, the branch doesn't show up in the branch list, which should hopefully deter people from working on it, but the work won't be permanently erased (even after garbage collection is run). For instance, whenever I have a branch th... |
1764380 | How to push to a non-bare Git repository? | 178 | 2009-11-19 16:02:18 | <p>I usually work on a remote server via ssh (screen and vim), where I have a Git repository. Sometimes I'm not online, so I have a separate repository (cloned from my remote) on my laptop.</p>
<p>However, I can't pull from this repository on remote side because I'm usually behind a firewall or I don't have a public I... | 70,327 | 214,720 | 2018-05-28 08:28:46 | 28,381,311 | 163 | 2015-02-07 10:58:49 | 895,245 | 2018-05-28 08:28:46 | https://stackoverflow.com/q/1764380 | https://stackoverflow.com/a/28381311 | <p><strong><code>receive.denyCurrentBranch updateInstead</code></strong></p>
<p><a href="https://github.com/git/git/blob/v2.3.0/Documentation/config.txt#L2155" rel="noreferrer">This options</a> was added <a href="https://github.com/blog/1957-git-2-3-has-been-released" rel="noreferrer">in Git 2.3</a>, and it makes the ... | <p><strong><code>receive.denyCurrentBranch updateInstead</code></strong></p> <p><a href="https://github.com/git/git/blob/v2.3.0/Documentation/config.txt#L2155" rel="noreferrer">This options</a> was added <a href="https://github.com/blog/1957-git-2-3-has-been-released" rel="noreferrer">in Git 2.3</a>, and it makes the ... | 119, 28898, 106074 | git, git-non-bare-repository, git-push | <h1>How to push to a non-bare Git repository?</h1>
<p>I usually work on a remote server via ssh (screen and vim), where I have a Git repository. Sometimes I'm not online, so I have a separate repository (cloned from my remote) on my laptop.</p>
<p>However, I can't pull from this repository on remote side because I'm u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,307 | git | # How to push to a non-bare Git repository?
I usually work on a remote server via ssh (screen and vim), where I have a Git repository. Sometimes I'm not online, so I have a separate repository (cloned from my remote) on my laptop.
However, I can't pull from this repository on remote side because I'm usually behind a ... | **`receive.denyCurrentBranch updateInstead`**
[This options](https://github.com/git/git/blob/v2.3.0/Documentation/config.txt#L2155) was added [in Git 2.3](https://github.com/blog/1957-git-2-3-has-been-released), and it makes the server update its working tree if it is clean.
So if you ensure that you always commit be... |
49853177 | How to see which files were changed in last commit | 131 | 2018-04-16 08:50:06 | <p>In this commit message, it says that 2 files have been changed. </p>
<pre><code>$ git commit -m "fixed .gitignore"
[master c30afbe] fixed .gitignore
Committer: Sahand Zarrinkoub <sahandzarrinkoub@n133-p41.eduroam.kth.se>
Your name and email address were configured automatically based
on your username and hos... | 127,535 | 3,128,156 | 2024-01-04 10:34:18 | 49,854,517 | 163 | 2018-04-16 10:00:25 | 8,258,942 | 2020-08-11 17:06:21 | https://stackoverflow.com/q/49853177 | https://stackoverflow.com/a/49854517 | <p>You can try <code>git log --stat</code></p>
<p>Here <code>--stat</code> will display the number of insertions and deletions to each file altered by each commit.</p>
<p><strong>Example:</strong> Below commit added 67 lines to the <code>Demo.java</code> file and removed 38 lines:</p>
<pre><code>commit f2a238924456ca1d... | <p>You can try <code>git log --stat</code></p> <p>Here <code>--stat</code> will display the number of insertions and deletions to each file altered by each commit.</p> <p><strong>Example:</strong> Below commit added 67 lines to the <code>Demo.java</code> file and removed 38 lines:</p> <pre><code>commit f2a238924456ca1d... | 119 | git | <h1>How to see which files were changed in last commit</h1>
<p>In this commit message, it says that 2 files have been changed. </p>
<pre><code>$ git commit -m "fixed .gitignore"
[master c30afbe] fixed .gitignore
Committer: Sahand Zarrinkoub <sahandzarrinkoub@n133-p41.eduroam.kth.se>
Your name and email address ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,308 | git | # How to see which files were changed in last commit
In this commit message, it says that 2 files have been changed.
```
$ git commit -m "fixed .gitignore"
[master c30afbe] fixed .gitignore
Committer: Sahand Zarrinkoub <sahandzarrinkoub@n133-p41.eduroam.kth.se>
Your name and email address were configured automatical... | You can try `git log --stat`
Here `--stat` will display the number of insertions and deletions to each file altered by each commit.
**Example:** Below commit added 67 lines to the `Demo.java` file and removed 38 lines:
```
commit f2a238924456ca1d4947662928218a06d39068c3
Author: X <X@example.com>
Date: Fri May 21 15:... |
10649814 | Get last git tag from a remote repo without cloning | 84 | 2012-05-18 09:12:01 | <p>How to get last tag from a (non checked-out) remote repo?</p>
<p>On my local copy I use <code>describe</code></p>
<pre><code>git describe --abbrev=0 --tags
</code></pre>
<p>But I cannot use <code>describe</code> with remote storage</p>
| 63,570 | 298,624 | 2021-07-15 08:52:10 | 12,704,727 | 163 | 2012-10-03 08:38:20 | 153,049 | 2020-08-03 17:34:44 | https://stackoverflow.com/q/10649814 | https://stackoverflow.com/a/12704727 | <h2>TL;DR</h2>
<p>With <a href="https://git-scm.com/docs/git-ls-remote" rel="noreferrer"><code>git ls-remote</code></a> you can get a list of references from a remote repository.</p>
<p>To see what the latest version is, look at the last line of output from:</p>
<pre class="lang-sh prettyprint-override"><code>git -c 'v... | <h2>TL;DR</h2> <p>With <a href="https://git-scm.com/docs/git-ls-remote" rel="noreferrer"><code>git ls-remote</code></a> you can get a list of references from a remote repository.</p> <p>To see what the latest version is, look at the last line of output from:</p> <pre class="lang-sh prettyprint-override"><code>git -c 'v... | 119, 60718, 80455 | git, git-describe, git-tag | <h1>Get last git tag from a remote repo without cloning</h1>
<p>How to get last tag from a (non checked-out) remote repo?</p>
<p>On my local copy I use <code>describe</code></p>
<pre><code>git describe --abbrev=0 --tags
</code></pre>
<p>But I cannot use <code>describe</code> with remote storage</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,311 | git | # Get last git tag from a remote repo without cloning
How to get last tag from a (non checked-out) remote repo?
On my local copy I use `describe`
```
git describe --abbrev=0 --tags
```
But I cannot use `describe` with remote storage | ## TL;DR
With [`git ls-remote`](https://git-scm.com/docs/git-ls-remote) you can get a list of references from a remote repository.
To see what the latest version is, look at the last line of output from:
```
git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' <repository>
```
To *only* output the late... |
17017335 | No submodule mapping found in .gitmodules for path and missing .gitmodules file | 70 | 2013-06-10 05:25:23 | <p>When I run <code>git submodule init</code>, I get the following error:</p>
<blockquote>
<p>No submodule mapping found in .gitmodules for path 'xxx'</p>
</blockquote>
<p>I searched for a <code>.gitmodules</code> file and I cannot find it anywhere.</p>
<p>I have read <a href="https://stackoverflow.com/questions/4... | 67,245 | 80,353 | 2020-02-17 20:27:16 | 17,021,059 | 163 | 2013-06-10 09:49:33 | 603,094 | 2020-02-17 20:27:16 | https://stackoverflow.com/q/17017335 | https://stackoverflow.com/a/17021059 | <ol>
<li>Make sure that there are no <code>submodule</code> sections in <code>.git/config</code>. If there are, remove them.</li>
<li>Do <code>git rm --cached <path_to_submodule></code>.</li>
</ol>
| <ol> <li>Make sure that there are no <code>submodule</code> sections in <code>.git/config</code>. If there are, remove them.</li> <li>Do <code>git rm --cached <path_to_submodule></code>.</li> </ol> | 119, 41612 | git, git-submodules | <h1>No submodule mapping found in .gitmodules for path and missing .gitmodules file</h1>
<p>When I run <code>git submodule init</code>, I get the following error:</p>
<blockquote>
<p>No submodule mapping found in .gitmodules for path 'xxx'</p>
</blockquote>
<p>I searched for a <code>.gitmodules</code> file and I ca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,312 | git | # No submodule mapping found in .gitmodules for path and missing .gitmodules file
When I run `git submodule init`, I get the following error:
> No submodule mapping found in .gitmodules for path 'xxx'
I searched for a `.gitmodules` file and I cannot find it anywhere.
I have read [this](https://stackoverflow.com/que... | 1. Make sure that there are no `submodule` sections in `.git/config`. If there are, remove them.
2. Do `git rm --cached <path_to_submodule>`. |
4120001 | What is the Git equivalent for revision number? | 267 | 2010-11-07 22:16:52 | <p>We use SVN at work, but for my personal projects I decided to use Git. So I installed Git yesterday, and I wonder what is the <strong>revision number</strong> equivalent <strong>in Git</strong>.</p>
<p>Let's say we work on version 3.0.8 and every bug fix has its own revision number we can use when we talk about thi... | 261,456 | 250,422 | 2021-12-02 11:39:16 | 4,120,038 | 162 | 2010-11-07 22:24:42 | 277,918 | 2010-11-07 22:24:42 | https://stackoverflow.com/q/4120001 | https://stackoverflow.com/a/4120038 | <p>Good or bad news for you, that hash IS the revision number. I also had trouble with this when I made the switch from SVN to git.</p>
<p>You can use "tagging" in git to tag a certain revision as the "release" for a specific version, making it easy to refer to that revision. Check out this <a href="http://www.gitre... | <p>Good or bad news for you, that hash IS the revision number. I also had trouble with this when I made the switch from SVN to git.</p> <p>You can use "tagging" in git to tag a certain revision as the "release" for a specific version, making it easy to refer to that revision. Check out this <a href="http://www.gitre... | 119, 456, 17085, 69559 | git, revision-history, version-control, version-numbering | <h1>What is the Git equivalent for revision number?</h1>
<p>We use SVN at work, but for my personal projects I decided to use Git. So I installed Git yesterday, and I wonder what is the <strong>revision number</strong> equivalent <strong>in Git</strong>.</p>
<p>Let's say we work on version 3.0.8 and every bug fix has ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,313 | git | # What is the Git equivalent for revision number?
We use SVN at work, but for my personal projects I decided to use Git. So I installed Git yesterday, and I wonder what is the **revision number** equivalent **in Git**.
Let's say we work on version 3.0.8 and every bug fix has its own revision number we can use when we... | Good or bad news for you, that hash IS the revision number. I also had trouble with this when I made the switch from SVN to git.
You can use "tagging" in git to tag a certain revision as the "release" for a specific version, making it easy to refer to that revision. Check out this [blog post](http://www.gitready.com/b... |
14635672 | Rebase a single Git commit | 176 | 2013-01-31 21:41:22 | <p>Is there a way to rebase a single commit from a branch onto another branch? </p>
<p>I have this branch structure:</p>
<pre><code>-- -- -- -- -- (Master)
\
-- -- -- -- -- XX (Feature-branch)
</code></pre>
<p>All I want to do is to rebase the last commit of <code>Feature-branch</code> ont... | 168,223 | 1,981,986 | 2020-04-23 18:58:33 | 14,635,752 | 162 | 2013-01-31 21:46:50 | 299,788 | 2013-01-31 21:46:50 | https://stackoverflow.com/q/14635672 | https://stackoverflow.com/a/14635752 | <p>You can cherry-pick XX to master.</p>
<pre><code>git checkout master
git cherry-pick <commit ID of XX>
</code></pre>
<p>And remove the last commit from the feature branch with git reset.</p>
<pre><code>git checkout Feature-branch
git reset --hard HEAD^
</code></pre>
| <p>You can cherry-pick XX to master.</p> <pre><code>git checkout master git cherry-pick <commit ID of XX> </code></pre> <p>And remove the last commit from the feature branch with git reset.</p> <pre><code>git checkout Feature-branch git reset --hard HEAD^ </code></pre> | 119, 8974 | git, rebase | <h1>Rebase a single Git commit</h1>
<p>Is there a way to rebase a single commit from a branch onto another branch? </p>
<p>I have this branch structure:</p>
<pre><code>-- -- -- -- -- (Master)
\
-- -- -- -- -- XX (Feature-branch)
</code></pre>
<p>All I want to do is to rebase the last commi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,314 | git | # Rebase a single Git commit
Is there a way to rebase a single commit from a branch onto another branch?
I have this branch structure:
```
-- -- -- -- -- (Master)
\
-- -- -- -- -- XX (Feature-branch)
```
All I want to do is to rebase the last commit of `Feature-branch` onto master and roll... | You can cherry-pick XX to master.
```
git checkout master
git cherry-pick <commit ID of XX>
```
And remove the last commit from the feature branch with git reset.
```
git checkout Feature-branch
git reset --hard HEAD^
``` |
15371866 | Why is git capitalizing my branch name prefix? | 99 | 2013-03-12 20:50:40 | <p>I have a really straightforward set of git commands that is resulting in some curious behavior:</p>
<p>Show my current local branches, and see that I'm on <code>release/beta1</code>:</p>
<pre><code>$ git branch
develop
master
* release/beta1
</code></pre>
<p>Create a <code>bugfix/somefeature</code> branch fro... | 59,645 | 41,728 | 2024-12-11 20:01:07 | 15,372,154 | 162 | 2013-03-12 21:08:28 | 216,074 | 2013-03-12 21:25:03 | https://stackoverflow.com/q/15371866 | https://stackoverflow.com/a/15372154 | <p>Branches are stored as <em>files</em> within the <code>.git</code> directory. A single branch is a single file containing the hash to the commit object the branch points to.</p>
<p>So, as you maybe guess, when creating a branch <code>foo/bar</code> this will correspond to a directory with a file. So Git will create... | <p>Branches are stored as <em>files</em> within the <code>.git</code> directory. A single branch is a single file containing the hash to the commit object the branch points to.</p> <p>So, as you maybe guess, when creating a branch <code>foo/bar</code> this will correspond to a directory with a file. So Git will create... | 119 | git | <h1>Why is git capitalizing my branch name prefix?</h1>
<p>I have a really straightforward set of git commands that is resulting in some curious behavior:</p>
<p>Show my current local branches, and see that I'm on <code>release/beta1</code>:</p>
<pre><code>$ git branch
develop
master
* release/beta1
</code></pre>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,317 | git | # Why is git capitalizing my branch name prefix?
I have a really straightforward set of git commands that is resulting in some curious behavior:
Show my current local branches, and see that I'm on `release/beta1`:
```
$ git branch
develop
master
* release/beta1
```
Create a `bugfix/somefeature` branch from `rel... | Branches are stored as *files* within the `.git` directory. A single branch is a single file containing the hash to the commit object the branch points to.
So, as you maybe guess, when creating a branch `foo/bar` this will correspond to a directory with a file. So Git will create a folder `foo` with a file `bar` which... |
10197188 | git flow branches have diverged | 80 | 2012-04-17 18:48:20 | <p>I'm using the git flow tools and I've gotten myself in a bit of problem. My git branches have diverged. I've read <a href="https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-how-to-undiverge-branches">master branch and 'origin/master' have diverged, how to 'undiverg... | 105,852 | 1,050,482 | 2022-07-31 16:45:05 | 10,199,252 | 162 | 2012-04-17 21:13:37 | 11,343 | 2012-04-17 21:23:43 | https://stackoverflow.com/q/10197188 | https://stackoverflow.com/a/10199252 | <p>What happens here is that the remote has received updates, and git-flow requires that <code>develop</code> and <code>origin/develop</code> to be at the same commit before merging back the feature. This is to prevent bad conflicts when publishing the branch.</p>
<p>To solve this, you need to:</p>
<ol>
<li><p>sync y... | <p>What happens here is that the remote has received updates, and git-flow requires that <code>develop</code> and <code>origin/develop</code> to be at the same commit before merging back the feature. This is to prevent bad conflicts when publishing the branch.</p> <p>To solve this, you need to:</p> <ol> <li><p>sync y... | 119, 64339 | git, git-flow | <h1>git flow branches have diverged</h1>
<p>I'm using the git flow tools and I've gotten myself in a bit of problem. My git branches have diverged. I've read <a href="https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-how-to-undiverge-branches">master branch and 'origin/master... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,319 | git | # git flow branches have diverged
I'm using the git flow tools and I've gotten myself in a bit of problem. My git branches have diverged. I've read [master branch and 'origin/master' have diverged, how to 'undiverge' branches'?](https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-... | What happens here is that the remote has received updates, and git-flow requires that `develop` and `origin/develop` to be at the same commit before merging back the feature. This is to prevent bad conflicts when publishing the branch.
To solve this, you need to:
1. sync your local `develop` with `origin`: checkout `... |
16526321 | How to apply a Git patch to a file with a different name and path? | 162 | 2013-05-13 15:58:23 | <p>I have two repositories. In one, I make changes to file <code>./hello.test</code>. I commit the changes and create a patch from that commit with <code>git format-patch -1 HEAD</code>. Now, I have a second repository that contains a file that has the same contents as hello.test but is placed in a different directory ... | 102,845 | 864,413 | 2024-06-14 01:44:08 | 16,527,024 | 161 | 2013-05-13 16:38:33 | 5,168 | 2013-05-13 16:38:33 | https://stackoverflow.com/q/16526321 | https://stackoverflow.com/a/16527024 | <p>You could create the patch using <a href="https://www.kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer"><code>git diff</code></a> and then apply it using the <a href="http://linux.die.net/man/1/patch" rel="noreferrer"><code>patch</code></a> utility, which allows you to specify the file you want to... | <p>You could create the patch using <a href="https://www.kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer"><code>git diff</code></a> and then apply it using the <a href="http://linux.die.net/man/1/patch" rel="noreferrer"><code>patch</code></a> utility, which allows you to specify the file you want to... | 119, 1062, 2132, 62078, 84451 | filenames, git, git-am, git-patch, patch | <h1>How to apply a Git patch to a file with a different name and path?</h1>
<p>I have two repositories. In one, I make changes to file <code>./hello.test</code>. I commit the changes and create a patch from that commit with <code>git format-patch -1 HEAD</code>. Now, I have a second repository that contains a file that... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,320 | git | # How to apply a Git patch to a file with a different name and path?
I have two repositories. In one, I make changes to file `./hello.test`. I commit the changes and create a patch from that commit with `git format-patch -1 HEAD`. Now, I have a second repository that contains a file that has the same contents as hello... | You could create the patch using [`git diff`](https://www.kernel.org/pub/software/scm/git/docs/git-diff.html) and then apply it using the [`patch`](http://linux.die.net/man/1/patch) utility, which allows you to specify the file you want to apply the diff to.
For example:
```
cd first-repo
git diff HEAD^ -- hello.test... |
5730460 | How to do a git diff on moved/renamed file? | 154 | 2011-04-20 12:41:23 | <p>I moved a file using <code>git mv</code>. Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name). </p>
<p>How do I do this?</p>
| 43,842 | 288,190 | 2018-10-09 07:15:48 | 10,121,060 | 161 | 2012-04-12 09:38:17 | 11,722 | 2012-04-12 09:38:17 | https://stackoverflow.com/q/5730460 | https://stackoverflow.com/a/10121060 | <p>You need to use -M to let git autodetect the moved file when diffing. Using just <code>git diff</code> as knittl mentioned does not work for me.</p>
<p>So simply: <code>git diff -M</code> should do it.</p>
<p>The documentation for this switch is:</p>
<pre><code>-M[<n>], --find-renames[=<n>]
Det... | <p>You need to use -M to let git autodetect the moved file when diffing. Using just <code>git diff</code> as knittl mentioned does not work for me.</p> <p>So simply: <code>git diff -M</code> should do it.</p> <p>The documentation for this switch is:</p> <pre><code>-M[<n>], --find-renames[=<n>] Det... | 119, 606, 12668, 12895 | diff, file-rename, git, mv | <h1>How to do a git diff on moved/renamed file?</h1>
<p>I moved a file using <code>git mv</code>. Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name). </p>
<p>How do I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,321 | git | # How to do a git diff on moved/renamed file?
I moved a file using `git mv`. Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name).
How do I do this? | You need to use -M to let git autodetect the moved file when diffing. Using just `git diff` as knittl mentioned does not work for me.
So simply: `git diff -M` should do it.
The documentation for this switch is:
```
-M[<n>], --find-renames[=<n>]
Detect renames. If n is specified, it is a threshold on the simil... |
2936652 | Git push won't do anything (everything up-to-date) | 122 | 2010-05-29 21:27:41 | <p>I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a <code>git push</code>. The response tells me that everything is up to date, but clearly it's not.</p>
<pre><code>git remote show origin
</code></pre>
<p>responds with the repository I'd expect.<... | 257,480 | 303,911 | 2023-04-25 21:43:22 | 2,936,751 | 161 | 2010-05-29 22:07:57 | 20,131 | 2018-08-17 17:52:37 | https://stackoverflow.com/q/2936652 | https://stackoverflow.com/a/2936751 | <p><code>git push</code> doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.</p>
<p>On my version of Git (1.6.5.3), when I run <code>git remote show origin</code> it actually pr... | <p><code>git push</code> doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.</p> <p>On my version of Git (1.6.5.3), when I run <code>git remote show origin</code> it actually pr... | 119, 3346 | dvcs, git | <h1>Git push won't do anything (everything up-to-date)</h1>
<p>I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a <code>git push</code>. The response tells me that everything is up to date, but clearly it's not.</p>
<pre><code>git remote show origin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,322 | git | # Git push won't do anything (everything up-to-date)
I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a `git push`. The response tells me that everything is up to date, but clearly it's not.
```
git remote show origin
```
responds with the reposit... | `git push` doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.
On my version of Git (1.6.5.3), when I run `git remote show origin` it actually prints out which branches are conf... |
10074582 | How do I remove an empty folder and push that change? | 107 | 2012-04-09 14:19:00 | <p>How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren't 'tracked' in that sense by git but the question remains.</p>
<p>e.g. I moved a file to another folder and committed the change (of the move).</p>
<p>But I can't ... | 93,114 | 631,619 | 2024-12-18 09:47:02 | 10,075,480 | 161 | 2012-04-09 15:24:20 | 382,110 | 2019-12-09 21:31:22 | https://stackoverflow.com/q/10074582 | https://stackoverflow.com/a/10075480 | <p>The short answer: <strong>You can't push changes to directories (added, removed, etc.) because Git does not track directories on their own</strong>. </p>
<p>According to the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F" rel="noreferrer">FAQ</a>:</p>
<blockquote>
<p>Current... | <p>The short answer: <strong>You can't push changes to directories (added, removed, etc.) because Git does not track directories on their own</strong>. </p> <p>According to the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F" rel="noreferrer">FAQ</a>:</p> <blockquote> <p>Current... | 119, 218, 5610, 46606 | directory, git, rm, rmdir | <h1>How do I remove an empty folder and push that change?</h1>
<p>How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren't 'tracked' in that sense by git but the question remains.</p>
<p>e.g. I moved a file to another fol... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,323 | git | # How do I remove an empty folder and push that change?
How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren't 'tracked' in that sense by git but the question remains.
e.g. I moved a file to another folder and committe... | The short answer: **You can't push changes to directories (added, removed, etc.) because Git does not track directories on their own**.
According to the [FAQ](https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F):
> Currently the design of the git index (staging area) only permits files to be l... |
2381665 | list tags contained by a branch | 100 | 2010-03-04 18:20:30 | <p>How can I list tags contained by a given branch, the opposite of:</p>
<pre><code>git tag --contains <commit>
</code></pre>
<p>Which "only list tags which contain the specified commit".</p>
<p>If something like this does not exist, how do I test whether a commit is contained by another commit so that I can s... | 124,620 | 51,019 | 2021-07-26 08:18:33 | 39,084,124 | 161 | 2016-08-22 16:07:52 | 1,260,292 | 2017-04-07 09:47:46 | https://stackoverflow.com/q/2381665 | https://stackoverflow.com/a/39084124 | <pre><code>git tag --merged <branch>
</code></pre>
<p>From the man page: </p>
<pre><code>--[no-]merged <commit>
Only list tags whose tips are reachable, or not reachable if --no-merged is used, from the specified commit (HEAD if not specified).
</code></pre>
<p>I believe this option was added quite rece... | <pre><code>git tag --merged <branch> </code></pre> <p>From the man page: </p> <pre><code>--[no-]merged <commit> Only list tags whose tips are reachable, or not reachable if --no-merged is used, from the specified commit (HEAD if not specified). </code></pre> <p>I believe this option was added quite rece... | 119 | git | <h1>list tags contained by a branch</h1>
<p>How can I list tags contained by a given branch, the opposite of:</p>
<pre><code>git tag --contains <commit>
</code></pre>
<p>Which "only list tags which contain the specified commit".</p>
<p>If something like this does not exist, how do I test whether a commit is co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,324 | git | # list tags contained by a branch
How can I list tags contained by a given branch, the opposite of:
```
git tag --contains <commit>
```
Which "only list tags which contain the specified commit".
If something like this does not exist, how do I test whether a commit is contained by another commit so that I can script... | ```
git tag --merged <branch>
```
From the man page:
```
--[no-]merged <commit>
Only list tags whose tips are reachable, or not reachable if --no-merged is used, from the specified commit (HEAD if not specified).
```
I believe this option was added quite recently - it definitely wasn't available back when the origi... |
5224364 | How do I load a specific git commit? | 100 | 2011-03-07 19:37:46 | <p>I cloned a repository and want to switch to a commit to test my plugin against the core.</p>
| 156,713 | 473,890 | 2022-04-26 01:31:38 | 5,224,392 | 161 | 2011-03-07 19:39:45 | 218,196 | 2011-03-07 19:45:15 | https://stackoverflow.com/q/5224364 | https://stackoverflow.com/a/5224392 | <p>Instead of passing the name of a branch, you can pass any commit ID to <code>checkout</code>:</p>
<pre><code>git checkout <commit-id>
</code></pre>
<p><a href="http://git-scm.com/docs/git-checkout" rel="noreferrer">See the <code>man</code> page</a>.</p>
| <p>Instead of passing the name of a branch, you can pass any commit ID to <code>checkout</code>:</p> <pre><code>git checkout <commit-id> </code></pre> <p><a href="http://git-scm.com/docs/git-checkout" rel="noreferrer">See the <code>man</code> page</a>.</p> | 119 | git | <h1>How do I load a specific git commit?</h1>
<p>I cloned a repository and want to switch to a commit to test my plugin against the core.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,325 | git | # How do I load a specific git commit?
I cloned a repository and want to switch to a commit to test my plugin against the core. | Instead of passing the name of a branch, you can pass any commit ID to `checkout`:
```
git checkout <commit-id>
```
[See the `man` page](http://git-scm.com/docs/git-checkout). |
24942161 | Does NPM ignore files listed in .gitignore? | 95 | 2014-07-24 19:18:17 | <p>I have a file that is generated by <code>npm install</code> command (using <code>preinstall</code> task). I don't want to add it in the git repository, nor in the NPM project.</p>
<p>Supposing the file name is <code>foo.json</code>, I added it in <code>.gitignore</code> file as <code>foo.json</code>.</p>
<p>Is thi... | 43,797 | 1,420,197 | 2023-11-13 11:49:32 | 24,942,436 | 161 | 2014-07-24 19:31:49 | 283,078 | 2023-11-13 11:49:32 | https://stackoverflow.com/q/24942161 | https://stackoverflow.com/a/24942436 | <p>If a project has both <code>.npmignore</code> and <code>.gitignore</code>, npm will <strong>only</strong> use the <code>.npmignore</code> file.</p>
<p>From <a href="https://docs.npmjs.com/cli/v9/using-npm/developers#keeping-files-out-of-your-package" rel="nofollow noreferrer">the documentation</a>:</p>
<blockquote>
... | <p>If a project has both <code>.npmignore</code> and <code>.gitignore</code>, npm will <strong>only</strong> use the <code>.npmignore</code> file.</p> <p>From <a href="https://docs.npmjs.com/cli/v9/using-npm/developers#keeping-files-out-of-your-package" rel="nofollow noreferrer">the documentation</a>:</p> <blockquote> ... | 119, 46426, 61387 | git, node.js, npm | <h1>Does NPM ignore files listed in .gitignore?</h1>
<p>I have a file that is generated by <code>npm install</code> command (using <code>preinstall</code> task). I don't want to add it in the git repository, nor in the NPM project.</p>
<p>Supposing the file name is <code>foo.json</code>, I added it in <code>.gitignore... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,326 | git | # Does NPM ignore files listed in .gitignore?
I have a file that is generated by `npm install` command (using `preinstall` task). I don't want to add it in the git repository, nor in the NPM project.
Supposing the file name is `foo.json`, I added it in `.gitignore` file as `foo.json`.
Is this enough to avoid uploadi... | If a project has both `.npmignore` and `.gitignore`, npm will **only** use the `.npmignore` file.
From [the documentation](https://docs.npmjs.com/cli/v9/using-npm/developers#keeping-files-out-of-your-package):
> Use a `.npmignore` file to keep stuff out of your package. If there's no `.npmignore` file, but there *is*... |
12452042 | Git error: src refspec master does not match any error: failed to push some refs | 60 | 2012-09-17 01:01:34 | <p>I am trying to add a file to my repository on BitBucket and I am having trouble.</p>
<p>I am using GIT and this is what I type in </p>
<pre><code>$ cd lis4368/assignments
$ git remote
$ git remote -v
$ git remote rm origin
</code></pre>
<p>and then I type this in (this is what BitBucket tells me to enter)</p>
<p... | 147,373 | 1,676,428 | 2020-10-02 14:37:13 | 12,793,757 | 161 | 2012-10-09 06:07:43 | 6,309 | 2020-10-02 14:37:13 | https://stackoverflow.com/q/12452042 | https://stackoverflow.com/a/12793757 | <p>One classic root cause for this message is:</p>
<ul>
<li>when the repo has been initialized (<code>git init lis4368/assignments</code>),</li>
<li>but <strong>no commit has ever been made</strong></li>
</ul>
<p>Ie, if you don't have added and committed at least once, there won't be a local <code>master</code> branch ... | <p>One classic root cause for this message is:</p> <ul> <li>when the repo has been initialized (<code>git init lis4368/assignments</code>),</li> <li>but <strong>no commit has ever been made</strong></li> </ul> <p>Ie, if you don't have added and committed at least once, there won't be a local <code>master</code> branch ... | 119, 8337, 28898, 72193 | bitbucket, git, git-push, refspec | <h1>Git error: src refspec master does not match any error: failed to push some refs</h1>
<p>I am trying to add a file to my repository on BitBucket and I am having trouble.</p>
<p>I am using GIT and this is what I type in </p>
<pre><code>$ cd lis4368/assignments
$ git remote
$ git remote -v
$ git remote rm origin
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,329 | git | # Git error: src refspec master does not match any error: failed to push some refs
I am trying to add a file to my repository on BitBucket and I am having trouble.
I am using GIT and this is what I type in
```
$ cd lis4368/assignments
$ git remote
$ git remote -v
$ git remote rm origin
```
and then I type this in (... | One classic root cause for this message is:
- when the repo has been initialized (`git init lis4368/assignments`),
- but **no commit has ever been made**
Ie, if you don't have added and committed at least once, there won't be a local `master` branch to push to.
Try first to create a commit:
- either by adding (`git... |
38001038 | How to undo a git commit --amend | 57 | 2016-06-23 20:17:46 | <p>I accidentally typed in a git commit --amend. This is a mistake because I realized that the commit is actually entirely new and it should be committed with a new message. I want to make a new commit. How do I undo this?</p>
| 51,398 | 2,714,301 | 2016-06-24 14:23:50 | 38,002,218 | 161 | 2016-06-23 21:31:14 | 1,256,452 | 2016-06-23 23:31:18 | https://stackoverflow.com/q/38001038 | https://stackoverflow.com/a/38002218 | <p><a href="https://stackoverflow.com/questions/38001038/how-to-undo-a-git-commit-amend#comment63446333_38001038">PetSerAl's comment</a> is the key. Here's the two command sequence to do just what you want:</p>
<pre><code>git reset --soft @{1}
git commit -C @{1}
</code></pre>
<p>and an explanation of how this works.... | <p><a href="https://stackoverflow.com/questions/38001038/how-to-undo-a-git-commit-amend#comment63446333_38001038">PetSerAl's comment</a> is the key. Here's the two command sequence to do just what you want:</p> <pre><code>git reset --soft @{1} git commit -C @{1} </code></pre> <p>and an explanation of how this works.... | 119 | git | <h1>How to undo a git commit --amend</h1>
<p>I accidentally typed in a git commit --amend. This is a mistake because I realized that the commit is actually entirely new and it should be committed with a new message. I want to make a new commit. How do I undo this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,330 | git | # How to undo a git commit --amend
I accidentally typed in a git commit --amend. This is a mistake because I realized that the commit is actually entirely new and it should be committed with a new message. I want to make a new commit. How do I undo this? | [PetSerAl's comment](https://stackoverflow.com/questions/38001038/how-to-undo-a-git-commit-amend#comment63446333_38001038) is the key. Here's the two command sequence to do just what you want:
```
git reset --soft @{1}
git commit -C @{1}
```
and an explanation of how this works.
### Description
When you make a new ... |
6349139 | Can I get git to tell me all the files one user has modified? | 181 | 2011-06-14 19:44:18 | <p>I would like git to give me a list of all the files modified by one user, across all commits.</p>
<p>My particular use case is that I've been involved in the i18n of a ruby on rails project, and we want to know what files have already been done and what files still need to be done. The users in question have only d... | 49,632 | 3,189 | 2022-05-19 12:50:16 | 6,349,405 | 160 | 2011-06-14 20:04:28 | 259,466 | 2011-06-14 20:12:55 | https://stackoverflow.com/q/6349139 | https://stackoverflow.com/a/6349405 | <p>This isn't the only way, but it works:</p>
<pre><code>git log --pretty="%H" --author="authorname" |
while read commit_hash
do
git show --oneline --name-only $commit_hash | tail -n+2
done | sort | uniq
</code></pre>
<p>Or, as one line:</p>
<pre><code>git log --pretty="%H" --author="authorname" ... | <p>This isn't the only way, but it works:</p> <pre><code>git log --pretty="%H" --author="authorname" | while read commit_hash do git show --oneline --name-only $commit_hash | tail -n+2 done | sort | uniq </code></pre> <p>Or, as one line:</p> <pre><code>git log --pretty="%H" --author="authorname" ... | 119 | git | <h1>Can I get git to tell me all the files one user has modified?</h1>
<p>I would like git to give me a list of all the files modified by one user, across all commits.</p>
<p>My particular use case is that I've been involved in the i18n of a ruby on rails project, and we want to know what files have already been done ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,331 | git | # Can I get git to tell me all the files one user has modified?
I would like git to give me a list of all the files modified by one user, across all commits.
My particular use case is that I've been involved in the i18n of a ruby on rails project, and we want to know what files have already been done and what files s... | This isn't the only way, but it works:
```
git log --pretty="%H" --author="authorname" |
while read commit_hash
do
git show --oneline --name-only $commit_hash | tail -n+2
done | sort | uniq
```
Or, as one line:
```
git log --pretty="%H" --author="authorname" | while read commit_hash; do git show ... |
2949738 | git merge different repositories? | 86 | 2010-06-01 12:33:47 | <p>I've been using SVN for all my projects.
Sometimes project B is originating as a copy from project A.
When project A has a generic change, I can use <code>svn merge A</code> within directory B and it will merge those changes.</p>
<p>Now, if I wanted to use git. I don't like having all my projects in the same reposi... | 71,607 | 330,777 | 2010-06-01 12:52:10 | 2,949,855 | 160 | 2010-06-01 12:52:10 | 262,667 | 2010-06-01 12:52:10 | https://stackoverflow.com/q/2949738 | https://stackoverflow.com/a/2949855 | <p>If you have two projects, <code>proj1</code> and <code>proj2</code> and want to merge changes of <code>proj1</code> into <code>proj2</code>, you would do it like this:</p>
<pre><code># in proj2:
git remote add proj1 path/to/proj1
git fetch proj1
git merge proj1/master # or whichever branch you want to merge
</code>... | <p>If you have two projects, <code>proj1</code> and <code>proj2</code> and want to merge changes of <code>proj1</code> into <code>proj2</code>, you would do it like this:</p> <pre><code># in proj2: git remote add proj1 path/to/proj1 git fetch proj1 git merge proj1/master # or whichever branch you want to merge </code>... | 119, 6452 | git, git-svn | <h1>git merge different repositories?</h1>
<p>I've been using SVN for all my projects.
Sometimes project B is originating as a copy from project A.
When project A has a generic change, I can use <code>svn merge A</code> within directory B and it will merge those changes.</p>
<p>Now, if I wanted to use git. I don't lik... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,332 | git | # git merge different repositories?
I've been using SVN for all my projects.
Sometimes project B is originating as a copy from project A.
When project A has a generic change, I can use `svn merge A` within directory B and it will merge those changes.
Now, if I wanted to use git. I don't like having all my projects in... | If you have two projects, `proj1` and `proj2` and want to merge changes of `proj1` into `proj2`, you would do it like this:
```
# in proj2:
git remote add proj1 path/to/proj1
git fetch proj1
git merge proj1/master # or whichever branch you want to merge
```
I believe this does the same thing as what you were doing wi... |
42082338 | Git checkout - switching back to HEAD | 158 | 2017-02-07 05:24:22 | <p>I've been doing my project while at some point I discovered that one thing stopped working. I needed to look up the state of my code when it was working correctly, so I've decided to use git checkout (because I wanted to check-something-out). And so I've done</p>
<pre><code>git checkout SHA
</code></pre>
<p>couple... | 354,802 | 5,293,594 | 2024-10-22 12:27:53 | 42,082,377 | 159 | 2017-02-07 05:27:57 | 4,133,798 | 2024-10-22 12:27:53 | https://stackoverflow.com/q/42082338 | https://stackoverflow.com/a/42082377 | <p>You can <code>stash</code> (save the changes in temporary place) then, back to <code>master</code> branch HEAD.</p>
<pre><code>$ git stash
$ git checkout master
</code></pre>
<p>Note that some sites have changed the name of the default branch from "master" to "main" so you might have to use <code... | <p>You can <code>stash</code> (save the changes in temporary place) then, back to <code>master</code> branch HEAD.</p> <pre><code>$ git stash $ git checkout master </code></pre> <p>Note that some sites have changed the name of the default branch from "master" to "main" so you might have to use <code... | 119, 37230 | git, git-checkout | <h1>Git checkout - switching back to HEAD</h1>
<p>I've been doing my project while at some point I discovered that one thing stopped working. I needed to look up the state of my code when it was working correctly, so I've decided to use git checkout (because I wanted to check-something-out). And so I've done</p>
<pre>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,334 | git | # Git checkout - switching back to HEAD
I've been doing my project while at some point I discovered that one thing stopped working. I needed to look up the state of my code when it was working correctly, so I've decided to use git checkout (because I wanted to check-something-out). And so I've done
```
git checkout S... | You can `stash` (save the changes in temporary place) then, back to `master` branch HEAD.
```
$ git stash
$ git checkout master
```
Note that some sites have changed the name of the default branch from "master" to "main" so you might have to use `git checkout main` instead.
---
**Jump Over Commits Back and Forth:**... |
4624127 | What is the difference between 'git format-patch and 'git diff'? | 126 | 2011-01-07 09:33:27 | <p>I don't see a difference between the output of 'git format-patch' and 'git diff', is there any? And won't I be able to use 'git diff' to produce a patch and then apply it using git apply?</p>
<p>My problem is that I have changes added to the index, but apparently git format-patch only accepts commits, so if I can u... | 58,428 | 196,697 | 2020-02-20 16:00:13 | 4,624,204 | 159 | 2011-01-07 09:42:27 | 5,353 | 2011-01-07 21:24:01 | https://stackoverflow.com/q/4624127 | https://stackoverflow.com/a/4624204 | <p>A patch created with <code>git format-patch</code> will also include some meta-information about the commit (committer, date, commit message, ...) and will contains diff of binary data. Everything will be formatted as a mail, so that it can be easily sent. The person that receive it can then recreate the correspondi... | <p>A patch created with <code>git format-patch</code> will also include some meta-information about the commit (committer, date, commit message, ...) and will contains diff of binary data. Everything will be formatted as a mail, so that it can be easily sent. The person that receive it can then recreate the correspondi... | 119, 606, 2132 | diff, git, patch | <h1>What is the difference between 'git format-patch and 'git diff'?</h1>
<p>I don't see a difference between the output of 'git format-patch' and 'git diff', is there any? And won't I be able to use 'git diff' to produce a patch and then apply it using git apply?</p>
<p>My problem is that I have changes added to the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,335 | git | # What is the difference between 'git format-patch and 'git diff'?
I don't see a difference between the output of 'git format-patch' and 'git diff', is there any? And won't I be able to use 'git diff' to produce a patch and then apply it using git apply?
My problem is that I have changes added to the index, but appar... | A patch created with `git format-patch` will also include some meta-information about the commit (committer, date, commit message, ...) and will contains diff of binary data. Everything will be formatted as a mail, so that it can be easily sent. The person that receive it can then recreate the corresponding commit with... |
10248137 | Git: How to list commits on this branch but not from merged branches | 115 | 2012-04-20 14:25:17 | <p>Suppose your git commit history looks like this:</p>
<pre><code>A---B---C---D---E---F master
\ /
X---Y---Z topic
</code></pre>
<p>Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch, I don't want it show.</p>
| 94,666 | 412,655 | 2020-10-27 07:40:39 | 10,248,421 | 159 | 2012-04-20 14:44:08 | 11,343 | 2012-04-20 14:53:33 | https://stackoverflow.com/q/10248137 | https://stackoverflow.com/a/10248421 | <p><code>git log</code> has option <code>--first-parent</code>, so you won't get <code>topic</code> history.</p>
<p>When merged from <code>master</code>, the <code>master</code> commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff.</p>
| <p><code>git log</code> has option <code>--first-parent</code>, so you won't get <code>topic</code> history.</p> <p>When merged from <code>master</code>, the <code>master</code> commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff.</p> | 119, 1879, 47913, 76220 | branch, git, git-branch, git-log | <h1>Git: How to list commits on this branch but not from merged branches</h1>
<p>Suppose your git commit history looks like this:</p>
<pre><code>A---B---C---D---E---F master
\ /
X---Y---Z topic
</code></pre>
<p>Is it possible to have git list only the commits on master, A-F? In other words, if the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,336 | git | # Git: How to list commits on this branch but not from merged branches
Suppose your git commit history looks like this:
```
A---B---C---D---E---F master
\ /
X---Y---Z topic
```
Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch,... | `git log` has option `--first-parent`, so you won't get `topic` history.
When merged from `master`, the `master` commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff. |
26382234 | What names are valid git tags? | 112 | 2014-10-15 12:08:41 | <p>I have got a error message while creating tag containing <code>[</code> character:</p>
<blockquote>
<p>fatal: '[' is not a valid tag name.</p>
</blockquote>
<p>Question: are there any rules for tags in the git?</p>
| 80,121 | 373,249 | 2023-04-26 18:42:33 | 26,382,358 | 159 | 2014-10-15 12:14:28 | 67,579 | 2018-04-03 07:25:50 | https://stackoverflow.com/q/26382234 | https://stackoverflow.com/a/26382358 | <p>You can check if the name is valid with</p>
<pre><code>git check-ref-format
</code></pre>
<p>This <a href="http://git-scm.com/docs/git-check-ref-format" rel="noreferrer">page</a> contains the constraints on a valid name. Quoted from the page (possibly outdated in the future):</p>
<blockquote>
<ol>
<li><p>They... | <p>You can check if the name is valid with</p> <pre><code>git check-ref-format </code></pre> <p>This <a href="http://git-scm.com/docs/git-check-ref-format" rel="noreferrer">page</a> contains the constraints on a valid name. Quoted from the page (possibly outdated in the future):</p> <blockquote> <ol> <li><p>They... | 119, 60718 | git, git-tag | <h1>What names are valid git tags?</h1>
<p>I have got a error message while creating tag containing <code>[</code> character:</p>
<blockquote>
<p>fatal: '[' is not a valid tag name.</p>
</blockquote>
<p>Question: are there any rules for tags in the git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,337 | git | # What names are valid git tags?
I have got a error message while creating tag containing `[` character:
> fatal: '[' is not a valid tag name.
Question: are there any rules for tags in the git? | You can check if the name is valid with
```
git check-ref-format
```
This [page](http://git-scm.com/docs/git-check-ref-format) contains the constraints on a valid name. Quoted from the page (possibly outdated in the future):
> 1. They can include slash `/` for hierarchical (directory) grouping, but no slash-separate... |
35115585 | Remove files completely from a Git repository along with its history | 108 | 2016-01-31 15:31:35 | <p>I have uploaded a font file that I don't have the rights to distribute to GitHub several updates ago.</p>
<p>I have a relatively inactive repository and I have the ability to notify all of my members if necessary. I've tried several of the solutions. I need to delete a file in my directory called <code>Resources\Vid... | 83,329 | 3,692,156 | 2025-01-15 16:00:33 | 35,115,769 | 159 | 2016-01-31 15:49:54 | 3,098,330 | 2024-11-25 01:43:05 | https://stackoverflow.com/q/35115585 | https://stackoverflow.com/a/35115769 | <p>In that case, you could to use the <a href="https://git-scm.com/docs/git-filter-branch" rel="nofollow noreferrer">Git Filter Branch</a> command with the <code>--tree-filter</code> option.</p>
<p>The syntax is <code>git filter-branch --tree-filter <command> ...</code></p>
<pre class="lang-bash prettyprint-over... | <p>In that case, you could to use the <a href="https://git-scm.com/docs/git-filter-branch" rel="nofollow noreferrer">Git Filter Branch</a> command with the <code>--tree-filter</code> option.</p> <p>The syntax is <code>git filter-branch --tree-filter <command> ...</code></p> <pre class="lang-bash prettyprint-over... | 119, 8337, 37510 | bitbucket, delete-file, git | <h1>Remove files completely from a Git repository along with its history</h1>
<p>I have uploaded a font file that I don't have the rights to distribute to GitHub several updates ago.</p>
<p>I have a relatively inactive repository and I have the ability to notify all of my members if necessary. I've tried several of the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,338 | git | # Remove files completely from a Git repository along with its history
I have uploaded a font file that I don't have the rights to distribute to GitHub several updates ago.
I have a relatively inactive repository and I have the ability to notify all of my members if necessary. I've tried several of the solutions. I n... | In that case, you could to use the [Git Filter Branch](https://git-scm.com/docs/git-filter-branch) command with the `--tree-filter` option.
The syntax is `git filter-branch --tree-filter <command> ...`
```
git filter-branch --tree-filter 'rm -f Resources\Video\%font%.ttf' -- --all
```
---
Note that `git filter-bran... |
23207791 | Git Rebase Conflict: Who is HEAD? | 100 | 2014-04-21 23:33:16 | <p>I have this project where the remote repo has the main development branch, and I have a fork containing the experimental branch. I'm required to <code>rebase</code> changes from the development branch to my experimental branch before I push to my fork. So it goes like:</p>
<pre><code>git checkout experimentalbranch... | 55,512 | 575,527 | 2018-06-14 10:08:09 | 23,208,027 | 159 | 2014-04-22 00:00:05 | 1,256,452 | 2018-05-17 15:10:04 | https://stackoverflow.com/q/23207791 | https://stackoverflow.com/a/23208027 | <h3>TL;DR (added May 2018)</h3>
<p>The whole thing is fundamentally at least a little bit confusing because Git lets its internal workings show right through to you.</p>
<p>Note that the cases we are concerned with here occur when you run:</p>
<pre><code>git checkout somebranch; git rebase origin/their-branch
</code... | <h3>TL;DR (added May 2018)</h3> <p>The whole thing is fundamentally at least a little bit confusing because Git lets its internal workings show right through to you.</p> <p>Note that the cases we are concerned with here occur when you run:</p> <pre><code>git checkout somebranch; git rebase origin/their-branch </code... | 119, 13630 | git, meld | <h1>Git Rebase Conflict: Who is HEAD?</h1>
<p>I have this project where the remote repo has the main development branch, and I have a fork containing the experimental branch. I'm required to <code>rebase</code> changes from the development branch to my experimental branch before I push to my fork. So it goes like:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,339 | git | # Git Rebase Conflict: Who is HEAD?
I have this project where the remote repo has the main development branch, and I have a fork containing the experimental branch. I'm required to `rebase` changes from the development branch to my experimental branch before I push to my fork. So it goes like:
```
git checkout experi... | ### TL;DR (added May 2018)
The whole thing is fundamentally at least a little bit confusing because Git lets its internal workings show right through to you.
Note that the cases we are concerned with here occur when you run:
```
git checkout somebranch; git rebase origin/their-branch
```
or similar. The rebase has ... |
26752481 | remove git submodule but keep files | 83 | 2014-11-05 08:20:00 | <p>I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule). </p>
<p>So I'd like to remove the git references to the submodule and add the files to my main git repository.</p>
<p>But how ?</p>
| 42,815 | 2,663,538 | 2022-10-02 18:14:17 | 26,752,628 | 159 | 2014-11-05 08:29:46 | 6,309 | 2015-06-07 20:19:24 | https://stackoverflow.com/q/26752481 | https://stackoverflow.com/a/26752628 | <p>You must remove the <a href="https://stackoverflow.com/a/16581096/6309">gitlink entry</a> in your index:</p>
<pre><code>mv subfolder subfolder_tmp
git submodule deinit subfolder
git rm --cached subfolder
mv subfolder_tmp subfolder
git add subfolder
</code></pre>
<p>Replace <code>subfolder</code> with the name of t... | <p>You must remove the <a href="https://stackoverflow.com/a/16581096/6309">gitlink entry</a> in your index:</p> <pre><code>mv subfolder subfolder_tmp git submodule deinit subfolder git rm --cached subfolder mv subfolder_tmp subfolder git add subfolder </code></pre> <p>Replace <code>subfolder</code> with the name of t... | 119 | git | <h1>remove git submodule but keep files</h1>
<p>I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule). </p>
<p>So I'd like to remove the git references to the submodule and add the files to my main git repository.</p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,340 | git | # remove git submodule but keep files
I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule).
So I'd like to remove the git references to the submodule and add the files to my main git repository.
But how ? | You must remove the [gitlink entry](https://stackoverflow.com/a/16581096/6309) in your index:
```
mv subfolder subfolder_tmp
git submodule deinit subfolder
git rm --cached subfolder
mv subfolder_tmp subfolder
git add subfolder
```
Replace `subfolder` with the name of the folder for your submodule, and make sure to no... |
10859632 | git add . -> still "nothing to commit" with new files | 82 | 2012-06-02 03:46:24 | <p>I am struggling with Git, I can't seem to add my files. I ran <code>ls</code> to show that the files are in the current directory, then ran <code>git add .</code> then <code>git status</code> which showed "nothing to commit".</p>
<pre><code>JJ-Computer:first_app JJ$ git init
Reinitialized existing Git repository ... | 169,377 | 1,431,929 | 2024-02-28 05:51:49 | 10,859,669 | 159 | 2012-06-02 03:55:45 | 871,012 | 2012-06-02 04:10:09 | https://stackoverflow.com/q/10859632 | https://stackoverflow.com/a/10859669 | <p>Your commands look correct (I've done them many times that way). </p>
<p>First try</p>
<pre><code>git add --all
</code></pre>
<p>and then try <code>git status</code>. I don't think that will solve it, but worth trying next.</p>
<p>Next try looking at your .gitignore file, if you have one (in the top level wher... | <p>Your commands look correct (I've done them many times that way). </p> <p>First try</p> <pre><code>git add --all </code></pre> <p>and then try <code>git status</code>. I don't think that will solve it, but worth trying next.</p> <p>Next try looking at your .gitignore file, if you have one (in the top level wher... | 119, 7280, 14215 | addition, git, init | <h1>git add . -> still "nothing to commit" with new files</h1>
<p>I am struggling with Git, I can't seem to add my files. I ran <code>ls</code> to show that the files are in the current directory, then ran <code>git add .</code> then <code>git status</code> which showed "nothing to commit".</p>
<pre><code>JJ-Computer... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,341 | git | # git add . -> still "nothing to commit" with new files
I am struggling with Git, I can't seem to add my files. I ran `ls` to show that the files are in the current directory, then ran `git add .` then `git status` which showed "nothing to commit".
```
JJ-Computer:first_app JJ$ git init
Reinitialized existing Git re... | Your commands look correct (I've done them many times that way).
First try
```
git add --all
```
and then try `git status`. I don't think that will solve it, but worth trying next.
Next try looking at your .gitignore file, if you have one (in the top level where you did `git init`).
```
cat .gitignore
```
Remove ... |
31782090 | Remove saved credentials from TortoiseGit | 69 | 2015-08-03 07:52:46 | <p>My credentials are saved in TortoiseGit (using Wincred) but my password changed.<br>
The only way for me to pull from the repository now is to remove the Credential Helper.</p>
<p>How can I simply change the password?<br>
Alternately, can I remove my credentials and save my new ones?</p>
| 79,208 | 1,709,629 | 2023-06-14 14:03:16 | 31,782,500 | 159 | 2015-08-03 08:17:30 | 3,906,760 | 2023-06-14 14:03:16 | https://stackoverflow.com/q/31782090 | https://stackoverflow.com/a/31782500 | <p>Normally the invalid credentials should be purged automatically (after one unsuccessful authentication attempt).</p>
<p>Go to the Windows <code>Credential Manager</code> (press <kbd>Windows</kbd> and type "Credential Manager", or go to <code>Control Panel\User Accounts and Family Safety\Credential Manager<... | <p>Normally the invalid credentials should be purged automatically (after one unsuccessful authentication attempt).</p> <p>Go to the Windows <code>Credential Manager</code> (press <kbd>Windows</kbd> and type "Credential Manager", or go to <code>Control Panel\User Accounts and Family Safety\Credential Manager<... | 119, 5357, 31409 | credentials, git, tortoisegit | <h1>Remove saved credentials from TortoiseGit</h1>
<p>My credentials are saved in TortoiseGit (using Wincred) but my password changed.<br>
The only way for me to pull from the repository now is to remove the Credential Helper.</p>
<p>How can I simply change the password?<br>
Alternately, can I remove my credentials an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,342 | git | # Remove saved credentials from TortoiseGit
My credentials are saved in TortoiseGit (using Wincred) but my password changed.
The only way for me to pull from the repository now is to remove the Credential Helper.
How can I simply change the password?
Alternately, can I remove my credentials and save my new ones? | Normally the invalid credentials should be purged automatically (after one unsuccessful authentication attempt).
Go to the Windows `Credential Manager` (press `Windows` and type "Credential Manager", or go to `Control Panel\User Accounts and Family Safety\Credential Manager` or use Start->Run `rundll32.exe keymgr.dll,... |
4610744 | Can I get a patch-compatible output from git-diff? | 208 | 2011-01-06 00:39:03 | <p>I am doing something very simple wrong. I'm trying to prepare an ordinary patch file, so I can reapply some changes:</p>
<pre><code>$ git diff > before
$ git diff something_here > save.patch
$ git checkout .
$ patch < save.patch
$ git diff > after
$ diff before after
$
</code></pre>
<p>With <code>somet... | 152,175 | 238,884 | 2024-11-12 18:13:07 | 4,610,809 | 158 | 2011-01-06 00:50:51 | 19,563 | 2014-01-07 15:42:25 | https://stackoverflow.com/q/4610744 | https://stackoverflow.com/a/4610809 | <p>If you want to use patch you need to remove the <code>a/</code> <code>b/</code> prefixes that git uses by default. You can do this with the <code>--no-prefix</code> option (you can also do this with patch's <code>-p</code> option):</p>
<pre><code>git diff --no-prefix [<other git-diff arguments>]
</code></pre>... | <p>If you want to use patch you need to remove the <code>a/</code> <code>b/</code> prefixes that git uses by default. You can do this with the <code>--no-prefix</code> option (you can also do this with patch's <code>-p</code> option):</p> <pre><code>git diff --no-prefix [<other git-diff arguments>] </code></pre>... | 119 | git | <h1>Can I get a patch-compatible output from git-diff?</h1>
<p>I am doing something very simple wrong. I'm trying to prepare an ordinary patch file, so I can reapply some changes:</p>
<pre><code>$ git diff > before
$ git diff something_here > save.patch
$ git checkout .
$ patch < save.patch
$ git diff > a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,344 | git | # Can I get a patch-compatible output from git-diff?
I am doing something very simple wrong. I'm trying to prepare an ordinary patch file, so I can reapply some changes:
```
$ git diff > before
$ git diff something_here > save.patch
$ git checkout .
$ patch < save.patch
$ git diff > after
$ diff before after
$
```
... | If you want to use patch you need to remove the `a/` `b/` prefixes that git uses by default. You can do this with the `--no-prefix` option (you can also do this with patch's `-p` option):
```
git diff --no-prefix [<other git-diff arguments>]
```
Usually though, it is easier to use straight `git diff` and then use the... |
805222 | How to copy a local Git branch to a remote repo | 129 | 2009-04-30 03:13:21 | <p>I've taken the following steps so far:</p>
<ol>
<li>Cloned a remote Git repo</li>
<li>Branched the master branch to an experimental</li>
<li>edited/tested/committed code in the experimental branch</li>
</ol>
<p>Now, I'm not ready to merge experimental into master. I do however want to push it back to the remote re... | 82,646 | 40,882 | 2018-06-19 09:19:06 | 805,313 | 158 | 2009-04-30 04:13:03 | 6,309 | 2011-08-08 12:47:49 | https://stackoverflow.com/q/805222 | https://stackoverflow.com/a/805313 | <p>According to <a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer">git push manual page</a>:</p>
<pre><code> git push origin experimental
</code></pre>
<p>Find a ref that matches <code>experimental</code> in the source repository (most likely, it would find <code>refs/heads/experim... | <p>According to <a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer">git push manual page</a>:</p> <pre><code> git push origin experimental </code></pre> <p>Find a ref that matches <code>experimental</code> in the source repository (most likely, it would find <code>refs/heads/experim... | 119, 456, 1632 | distributed, git, version-control | <h1>How to copy a local Git branch to a remote repo</h1>
<p>I've taken the following steps so far:</p>
<ol>
<li>Cloned a remote Git repo</li>
<li>Branched the master branch to an experimental</li>
<li>edited/tested/committed code in the experimental branch</li>
</ol>
<p>Now, I'm not ready to merge experimental into m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,345 | git | # How to copy a local Git branch to a remote repo
I've taken the following steps so far:
1. Cloned a remote Git repo
2. Branched the master branch to an experimental
3. edited/tested/committed code in the experimental branch
Now, I'm not ready to merge experimental into master. I do however want to push it back to t... | According to [git push manual page](http://www.kernel.org/pub/software/scm/git/docs/git-push.html):
```
git push origin experimental
```
Find a ref that matches `experimental` in the source repository (most likely, it would find `refs/heads/experimental`), and update the same ref (e.g. `refs/heads/experimental`) in ... |
5531362 | Why git keeps showing my changes when I switch branches (modified,added, deleted files) no matter if I run git add or not? | 127 | 2011-04-03 17:55:02 | <p>I'm really new to git and I've been trying to understand why git keeps showing whatever I changed in one branch in another branch when I run git checkout to switch between branches First I tried not using git add and didn't work. However, I tried then using git add, but didn't fix the problem. I'm not using git comm... | 53,559 | 690,072 | 2023-04-09 04:49:41 | 5,531,400 | 158 | 2011-04-03 18:00:40 | 105,678 | 2011-04-03 18:00:40 | https://stackoverflow.com/q/5531362 | https://stackoverflow.com/a/5531400 | <p>Switching branches carries uncommitted changes with you. Either commit first, run <code>git checkout .</code> to undo them, or run <code>git stash</code> before switching. (You can get your changes back with <code>git stash apply</code>)</p>
| <p>Switching branches carries uncommitted changes with you. Either commit first, run <code>git checkout .</code> to undo them, or run <code>git stash</code> before switching. (You can get your changes back with <code>git stash apply</code>)</p> | 119 | git | <h1>Why git keeps showing my changes when I switch branches (modified,added, deleted files) no matter if I run git add or not?</h1>
<p>I'm really new to git and I've been trying to understand why git keeps showing whatever I changed in one branch in another branch when I run git checkout to switch between branches Firs... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,346 | git | # Why git keeps showing my changes when I switch branches (modified,added, deleted files) no matter if I run git add or not?
I'm really new to git and I've been trying to understand why git keeps showing whatever I changed in one branch in another branch when I run git checkout to switch between branches First I tried... | Switching branches carries uncommitted changes with you. Either commit first, run `git checkout .` to undo them, or run `git stash` before switching. (You can get your changes back with `git stash apply`) |
35110079 | Git Bash and Pageant are not using keys | 89 | 2016-01-31 03:40:52 | <p>I've got Git for Windows (configured for MinTTY and <code>PuTTY\plink.exe</code>) and PuTTY installed, and I am trying to get it to work with a Bitbucket repository. I've got my SSH key loaded, in Pageant and on the website, and yet whenever I attempt to do anything that requires pulling/pushing:</p>
<pre><code>Per... | 77,267 | 1,086,048 | 2024-07-04 17:31:18 | 43,313,491 | 158 | 2017-04-10 00:47:38 | 349,659 | 2020-07-03 09:44:17 | https://stackoverflow.com/q/35110079 | https://stackoverflow.com/a/43313491 | <p>This is what ended up working for me.</p>
<p>BTW, I do have Bash on Windows as well, but I don't think that matters.</p>
<p>I had Sourcetree installed and pointed at its folder with <code>plink.exe</code>, <code>puttygen.exe</code>, & <code>pageant.exe</code>. You could also download and install these separately... | <p>This is what ended up working for me.</p> <p>BTW, I do have Bash on Windows as well, but I don't think that matters.</p> <p>I had Sourcetree installed and pointed at its folder with <code>plink.exe</code>, <code>puttygen.exe</code>, & <code>pageant.exe</code>. You could also download and install these separately... | 64, 119, 386, 1768 | git, putty, ssh, windows | <h1>Git Bash and Pageant are not using keys</h1>
<p>I've got Git for Windows (configured for MinTTY and <code>PuTTY\plink.exe</code>) and PuTTY installed, and I am trying to get it to work with a Bitbucket repository. I've got my SSH key loaded, in Pageant and on the website, and yet whenever I attempt to do anything t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,348 | git | # Git Bash and Pageant are not using keys
I've got Git for Windows (configured for MinTTY and `PuTTY\plink.exe`) and PuTTY installed, and I am trying to get it to work with a Bitbucket repository. I've got my SSH key loaded, in Pageant and on the website, and yet whenever I attempt to do anything that requires pulling... | This is what ended up working for me.
BTW, I do have Bash on Windows as well, but I don't think that matters.
I had Sourcetree installed and pointed at its folder with `plink.exe`, `puttygen.exe`, & `pageant.exe`. You could also download and install these separately as well.
## Configure Windows Environment Variable... |
1184518 | Getting existing git branches to track remote branches | 85 | 2009-07-26 12:58:11 | <p>My usual workflow when working with git, is something like this:</p>
<ol>
<li>create a local repository</li>
<li>do some work in that repository, add/change files etc.</li>
<li>decide that I want a central remote location for the repository, and create one</li>
<li>push all the commits from my local repository to t... | 99,768 | 1,577,190 | 2020-05-31 14:15:13 | 5,172,032 | 158 | 2011-03-02 18:59:06 | 641,785 | 2018-04-20 02:18:22 | https://stackoverflow.com/q/1184518 | https://stackoverflow.com/a/5172032 | <p>Use the set-upstream arg:</p>
<pre><code>git branch --set-upstream local-branch-name origin/remote-branch-name
</code></pre>
<p>Running the above command updates your .git/config file correctly and even verifies with this output:</p>
<p><em>"Branch local-branch-name set up to track remote branch remote-branch-nam... | <p>Use the set-upstream arg:</p> <pre><code>git branch --set-upstream local-branch-name origin/remote-branch-name </code></pre> <p>Running the above command updates your .git/config file correctly and even verifies with this output:</p> <p><em>"Branch local-branch-name set up to track remote branch remote-branch-nam... | 119 | git | <h1>Getting existing git branches to track remote branches</h1>
<p>My usual workflow when working with git, is something like this:</p>
<ol>
<li>create a local repository</li>
<li>do some work in that repository, add/change files etc.</li>
<li>decide that I want a central remote location for the repository, and create... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,349 | git | # Getting existing git branches to track remote branches
My usual workflow when working with git, is something like this:
1. create a local repository
2. do some work in that repository, add/change files etc.
3. decide that I want a central remote location for the repository, and create one
4. push all the commits fr... | Use the set-upstream arg:
```
git branch --set-upstream local-branch-name origin/remote-branch-name
```
Running the above command updates your .git/config file correctly and even verifies with this output:
*"Branch local-branch-name set up to track remote branch remote-branch-name from origin."*
**EDIT:** As [marti... |
13669410 | Clear git repository on Bitbucket? | 82 | 2012-12-02 12:48:05 | <p>I'm just getting started with git, and started messing about with Bitbucket. However, I now want to use the repository I created, but without its initial history.</p>
<p>Is there any way I can clear out or purge my repository so that I can start from scratch?</p>
<p>I'm not too bothered about any of the content, ... | 62,058 | 1,813,169 | 2022-01-06 00:45:18 | 13,669,433 | 158 | 2012-12-02 12:51:33 | 6,309 | 2020-06-26 11:26:28 | https://stackoverflow.com/q/13669410 | https://stackoverflow.com/a/13669433 | <p>No need to delete it.</p>
<p>From your new local repo create directory or remote simple the .git, if you want upload (without history) an existing repo:</p>
<pre><code> rm -rf .git
</code></pre>
<p>Recreate the repos from the current content only</p>
<pre><code> git init
git add .
git commit -m "Initial commi... | <p>No need to delete it.</p> <p>From your new local repo create directory or remote simple the .git, if you want upload (without history) an existing repo:</p> <pre><code> rm -rf .git </code></pre> <p>Recreate the repos from the current content only</p> <pre><code> git init git add . git commit -m "Initial commi... | 119, 8337 | bitbucket, git | <h1>Clear git repository on Bitbucket?</h1>
<p>I'm just getting started with git, and started messing about with Bitbucket. However, I now want to use the repository I created, but without its initial history.</p>
<p>Is there any way I can clear out or purge my repository so that I can start from scratch?</p>
<p>I'm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,350 | git | # Clear git repository on Bitbucket?
I'm just getting started with git, and started messing about with Bitbucket. However, I now want to use the repository I created, but without its initial history.
Is there any way I can clear out or purge my repository so that I can start from scratch?
I'm not too bothered about ... | No need to delete it.
From your new local repo create directory or remote simple the .git, if you want upload (without history) an existing repo:
```
rm -rf .git
```
Recreate the repos from the current content only
```
git init
git add .
git commit -m "Initial commit"
```
Then simply push to the github remote ... |
9776434 | How to configure kdiff3 instead of emerge as a git mergetool? | 64 | 2012-03-19 19:17:03 | <p>I have Git on mac OSX Snow Leopard and I tried to edit my merge and diff tool to use kdiff3 instead of emerge.</p>
<p>But when I try to use it does not launch the GUI of kdiff and keeps me with a cmd based interface.</p>
<p>My setting in gitconfig are: </p>
<pre><code>[merge]
tool = kdiff3
[mergetool "kdiff3... | 50,526 | 909,822 | 2017-08-18 09:00:34 | 14,359,455 | 158 | 2013-01-16 13:21:32 | 1,127,485 | 2016-09-01 16:48:59 | https://stackoverflow.com/q/9776434 | https://stackoverflow.com/a/14359455 | <p>Recent Git versions have built-in support for <code>kdiff3</code>, so there's no need to configure it manually using the generic <em>cmd</em> and <em>args</em> settings. Instead do:</p>
<pre><code>$ git config --global merge.tool kdiff3
</code></pre>
<p>And if <code>kdiff3</code> is not in your <em>PATH</em> envir... | <p>Recent Git versions have built-in support for <code>kdiff3</code>, so there's no need to configure it manually using the generic <em>cmd</em> and <em>args</em> settings. Instead do:</p> <pre><code>$ git config --global merge.tool kdiff3 </code></pre> <p>And if <code>kdiff3</code> is not in your <em>PATH</em> envir... | 119, 369, 717, 3574, 39542 | config, git, kdiff3, macos, merge | <h1>How to configure kdiff3 instead of emerge as a git mergetool?</h1>
<p>I have Git on mac OSX Snow Leopard and I tried to edit my merge and diff tool to use kdiff3 instead of emerge.</p>
<p>But when I try to use it does not launch the GUI of kdiff and keeps me with a cmd based interface.</p>
<p>My setting in gitcon... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,351 | git | # How to configure kdiff3 instead of emerge as a git mergetool?
I have Git on mac OSX Snow Leopard and I tried to edit my merge and diff tool to use kdiff3 instead of emerge.
But when I try to use it does not launch the GUI of kdiff and keeps me with a cmd based interface.
My setting in gitconfig are:
```
[merge]
... | Recent Git versions have built-in support for `kdiff3`, so there's no need to configure it manually using the generic *cmd* and *args* settings. Instead do:
```
$ git config --global merge.tool kdiff3
```
And if `kdiff3` is not in your *PATH* environment also do:
```
$ git config --global mergetool.kdiff3.path /Appl... |
40883798 | How to get Git diff of the first commit? | 63 | 2016-11-30 08:45:47 | <p>I created a repo, created a file inside it, put some content in the file, and committed the file. Now, I'd like to see a diff of that commit, which should ideally show the file that was added and the lines that were added to it.</p>
<p>However, <code>git diff HEAD^ HEAD</code> returns <code>fatal: ambiguous argumen... | 24,168 | 49,153 | 2022-09-20 22:54:27 | 40,884,093 | 158 | 2016-11-30 09:03:28 | 19,563 | 2016-11-30 09:03:28 | https://stackoverflow.com/q/40883798 | https://stackoverflow.com/a/40884093 | <p>You can do:</p>
<pre><code>git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD
</code></pre>
<p><code>4b825dc642cb6eb9a060e54bf8d69288fbee4904</code> is the id of the "empty tree" in Git and it's always available in every repository.</p>
| <p>You can do:</p> <pre><code>git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD </code></pre> <p><code>4b825dc642cb6eb9a060e54bf8d69288fbee4904</code> is the id of the "empty tree" in Git and it's always available in every repository.</p> | 119, 456, 9033 | git, git-diff, version-control | <h1>How to get Git diff of the first commit?</h1>
<p>I created a repo, created a file inside it, put some content in the file, and committed the file. Now, I'd like to see a diff of that commit, which should ideally show the file that was added and the lines that were added to it.</p>
<p>However, <code>git diff HEAD^ ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,352 | git | # How to get Git diff of the first commit?
I created a repo, created a file inside it, put some content in the file, and committed the file. Now, I'd like to see a diff of that commit, which should ideally show the file that was added and the lines that were added to it.
However, `git diff HEAD^ HEAD` returns `fatal:... | You can do:
```
git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD
```
`4b825dc642cb6eb9a060e54bf8d69288fbee4904` is the id of the "empty tree" in Git and it's always available in every repository. |
17577409 | git remove merge commit from history | 182 | 2013-07-10 17:44:30 | <p>My Git history looks like that :</p>
<p><img src="https://i.sstatic.net/67sda.png" alt="Git history"></p>
<p>I would like to squash the purple commits into a single one. I don't want to see them ever again in my commit log.</p>
<p>I've tried to do a <code>git rebase -i 1</code>, but even though <code>1</code> is ... | 355,174 | 1,435,156 | 2025-10-09 12:25:52 | 17,577,876 | 157 | 2013-07-10 18:10:18 | 498,699 | 2013-07-10 18:10:18 | https://stackoverflow.com/q/17577409 | https://stackoverflow.com/a/17577876 | <p>Do <code>git rebase -i <sha before the branches diverged></code> this will allow you to remove the merge commit and the log will be one single line as you wanted. You can also delete any commits that you do not want any more. The reason that your rebase wasn't working was that you weren't going back far enou... | <p>Do <code>git rebase -i <sha before the branches diverged></code> this will allow you to remove the merge commit and the log will be one single line as you wanted. You can also delete any commits that you do not want any more. The reason that your rebase wasn't working was that you weren't going back far enou... | 119, 28897, 29934 | git, git-merge, git-rebase | <h1>git remove merge commit from history</h1>
<p>My Git history looks like that :</p>
<p><img src="https://i.sstatic.net/67sda.png" alt="Git history"></p>
<p>I would like to squash the purple commits into a single one. I don't want to see them ever again in my commit log.</p>
<p>I've tried to do a <code>git rebase -... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,355 | git | # git remove merge commit from history
My Git history looks like that :

I would like to squash the purple commits into a single one. I don't want to see them ever again in my commit log.
I've tried to do a `git rebase -i 1`, but even though `1` is on the blue branch (... | Do `git rebase -i <sha before the branches diverged>` this will allow you to remove the merge commit and the log will be one single line as you wanted. You can also delete any commits that you do not want any more. The reason that your rebase wasn't working was that you weren't going back far enough.
WARNING:
You are ... |
37358340 | Should I add the google-services.json (from Firebase) to my repository? | 179 | 2016-05-21 02:37:33 | <p>I just signed up with Firebase and I created a new project. Firebase asked me for my app domain and a SHA1 debug key. I input these details and it generated a google-services.json file for me to add in the root of my app module.</p>
<p>My question is, should this .json file be added to a public (open source) repo. ... | 67,795 | 1,386,289 | 2022-08-09 19:59:37 | 37,359,108 | 157 | 2016-05-21 05:04:31 | 6,309 | 2022-08-06 11:22:04 | https://stackoverflow.com/q/37358340 | https://stackoverflow.com/a/37359108 | <p>A <a href="https://firebase.google.com/docs/admob/android/google-services.json" rel="noreferrer"><code>google-services.json</code></a> file is, <a href="https://firebase.google.com/support/guides/google-android#migrate_your_console_project" rel="noreferrer">from the Firebase doc</a>:</p>
<blockquote>
<p>Firebase man... | <p>A <a href="https://firebase.google.com/docs/admob/android/google-services.json" rel="noreferrer"><code>google-services.json</code></a> file is, <a href="https://firebase.google.com/support/guides/google-android#migrate_your_console_project" rel="noreferrer">from the Firebase doc</a>:</p> <blockquote> <p>Firebase man... | 119, 456, 79466 | firebase, git, version-control | <h1>Should I add the google-services.json (from Firebase) to my repository?</h1>
<p>I just signed up with Firebase and I created a new project. Firebase asked me for my app domain and a SHA1 debug key. I input these details and it generated a google-services.json file for me to add in the root of my app module.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,356 | git | # Should I add the google-services.json (from Firebase) to my repository?
I just signed up with Firebase and I created a new project. Firebase asked me for my app domain and a SHA1 debug key. I input these details and it generated a google-services.json file for me to add in the root of my app module.
My question is,... | A [`google-services.json`](https://firebase.google.com/docs/admob/android/google-services.json) file is, [from the Firebase doc](https://firebase.google.com/support/guides/google-android#migrate_your_console_project):
> Firebase manages all of your API settings and credentials through a single configuration file.
> ... |
8762601 | How do I rename my Git 'master' branch to 'release'? | 133 | 2012-01-06 18:26:23 | <p>We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have develop and release candidate branches as well.</p>
<p>I understand I can rename the master branch locally by simply u... | 87,970 | 58,843 | 2020-10-11 13:09:23 | 8,762,728 | 157 | 2012-01-06 18:37:43 | 1,864,976 | 2020-07-27 20:17:46 | https://stackoverflow.com/q/8762601 | https://stackoverflow.com/a/8762728 | <pre><code>git checkout -b release master # Create and switch to the release branch
git push -u origin release # Push the release branch to the remote and track it
git branch -d master # Delete local master
git push --delete origin master # Delete remote master
git remote prune origin ... | <pre><code>git checkout -b release master # Create and switch to the release branch git push -u origin release # Push the release branch to the remote and track it git branch -d master # Delete local master git push --delete origin master # Delete remote master git remote prune origin ... | 119, 456, 1879, 76220 | branch, git, git-branch, version-control | <h1>How do I rename my Git 'master' branch to 'release'?</h1>
<p>We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have develop and release candidate branches as well.</p>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,357 | git | # How do I rename my Git 'master' branch to 'release'?
We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have develop and release candidate branches as well.
I understand I c... | ```
git checkout -b release master # Create and switch to the release branch
git push -u origin release # Push the release branch to the remote and track it
git branch -d master # Delete local master
git push --delete origin master # Delete remote master
git remote prune origin # Dele... |
1474115 | How to find the tag associated with a given git commit? | 129 | 2009-09-24 20:58:22 | <p>For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit, and branch info in the file, but I would like to add the tag.</p>
<p>Is this possible?</p>
| 86,401 | 178,727 | 2020-02-27 19:45:50 | 1,474,161 | 157 | 2009-09-24 21:07:28 | 19,563 | 2009-09-24 21:07:28 | https://stackoverflow.com/q/1474115 | https://stackoverflow.com/a/1474161 | <p>Check the documentation for <code>git describe</code>. It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag.</p>
<p>If you only want to know if the commit is pointed to by a tag then you can check the output of:</p>
<pre>... | <p>Check the documentation for <code>git describe</code>. It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag.</p> <p>If you only want to know if the commit is pointed to by a tag then you can check the output of:</p> <pre>... | 119 | git | <h1>How to find the tag associated with a given git commit?</h1>
<p>For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit, and branch info in the file, but I would like to add the tag.</p>
<p>Is this... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,358 | git | # How to find the tag associated with a given git commit?
For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit, and branch info in the file, but I would like to add the tag.
Is this possible? | Check the documentation for `git describe`. It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag.
If you only want to know if the commit is pointed to by a tag then you can check the output of:
```
git describe --exact-match... |
6618612 | Ignoring a directory from a Git repo after it's been added | 105 | 2011-07-08 00:14:41 | <p>I've learned <a href="https://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory/1470664#1470664">how to exclude an entire directory in git</a> (add a line <code>bin/</code> to <code>.gitignore</code>). And I've learned <a href="https://stackoverflow.com/questions/4308610/git-how-to-ignore-files-... | 95,079 | 586,707 | 2022-10-14 22:57:14 | 6,618,678 | 157 | 2011-07-08 00:25:32 | 356,746 | 2011-12-07 05:51:15 | https://stackoverflow.com/q/6618612 | https://stackoverflow.com/a/6618678 | <p>I was able to get this working with <code>git rm -r --cached bin/</code> (note the recursive <code>-r</code>)in the root of the repo - are you talking about <em>finding</em> the bin directories and untracking them?</p>
<p>You will have to <code>commit</code> before the exclusion is reflected.</p>
<p>I just saw tha... | <p>I was able to get this working with <code>git rm -r --cached bin/</code> (note the recursive <code>-r</code>)in the root of the repo - are you talking about <em>finding</em> the bin directories and untracking them?</p> <p>You will have to <code>commit</code> before the exclusion is reflected.</p> <p>I just saw tha... | 119, 25056 | git, gitignore | <h1>Ignoring a directory from a Git repo after it's been added</h1>
<p>I've learned <a href="https://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory/1470664#1470664">how to exclude an entire directory in git</a> (add a line <code>bin/</code> to <code>.gitignore</code>). And I've learned <a href="... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,359 | git | # Ignoring a directory from a Git repo after it's been added
I've learned [how to exclude an entire directory in git](https://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory/1470664#1470664) (add a line `bin/` to `.gitignore`). And I've learned [how to ignore files "after the fact"](https://stac... | I was able to get this working with `git rm -r --cached bin/` (note the recursive `-r`)in the root of the repo - are you talking about *finding* the bin directories and untracking them?
You will have to `commit` before the exclusion is reflected.
I just saw that you were on Windows. This was in Terminal on OSX, just ... |
18514659 | What is a dangling commit and a blob in a Git repository and where do they come from? | 256 | 2013-08-29 15:08:50 | <p>I'm looking for the basic information on dangling commits and blobs.</p>
<p>My repository seems fine. But I ran <code>git fsck</code> for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'.</p>
<p>What are these things? Where did they come from? Do they indi... | 131,209 | 263,900 | 2024-12-05 17:01:26 | 18,515,113 | 156 | 2013-08-29 15:29:58 | 485,864 | 2024-12-05 17:01:26 | https://stackoverflow.com/q/18514659 | https://stackoverflow.com/a/18515113 | <p>During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.</p>
<p>Eventually (conditionally, according to the <a href="https://www.kernel.org/pub/s... | <p>During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.</p> <p>Eventually (conditionally, according to the <a href="https://www.kernel.org/pub/s... | 119, 53850, 102491, 116920 | git, git-commit, git-dangling, git-fsck | <h1>What is a dangling commit and a blob in a Git repository and where do they come from?</h1>
<p>I'm looking for the basic information on dangling commits and blobs.</p>
<p>My repository seems fine. But I ran <code>git fsck</code> for the first time to see what it did and I have a long list of 'dangling blobs' and a s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,361 | git | # What is a dangling commit and a blob in a Git repository and where do they come from?
I'm looking for the basic information on dangling commits and blobs.
My repository seems fine. But I ran `git fsck` for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'.
... | During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.
Eventually (conditionally, according to the [git gc man page](https://www.kernel.org/pub/s... |
5203535 | Practical uses of git reset --soft? | 227 | 2011-03-05 11:31:44 | <p>I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me.</p>
<p>I understand I can use the soft reset to edit a commit without altering the index or the working directory, as I would with <code>git commit ... | 648,371 | 377,917 | 2023-08-10 16:50:03 | 5,203,843 | 156 | 2011-03-05 12:36:41 | 6,309 | 2023-07-29 05:47:13 | https://stackoverflow.com/q/5203535 | https://stackoverflow.com/a/5203843 | <p><code>git reset</code> is all about moving <code>HEAD</code>, <a href="https://stackoverflow.com/a/54934887/6309">and generally the branch <em>ref</em></a>.<br />
Question: what about the working tree and index?<br />
When employed with <code>--soft</code>, <strong>moves <code>HEAD</code>, most often updating the br... | <p><code>git reset</code> is all about moving <code>HEAD</code>, <a href="https://stackoverflow.com/a/54934887/6309">and generally the branch <em>ref</em></a>.<br /> Question: what about the working tree and index?<br /> When employed with <code>--soft</code>, <strong>moves <code>HEAD</code>, most often updating the br... | 119 | git | <h1>Practical uses of git reset --soft?</h1>
<p>I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me.</p>
<p>I understand I can use the soft reset to edit a commit without altering the index or the working... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,362 | git | # Practical uses of git reset --soft?
I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me.
I understand I can use the soft reset to edit a commit without altering the index or the working directory, as I... | `git reset` is all about moving `HEAD`, [and generally the branch *ref*](https://stackoverflow.com/a/54934887/6309).
Question: what about the working tree and index?
When employed with `--soft`, **moves `HEAD`, most often updating the branch ref, and only the `HEAD`**.
This differs from `commit --amend` as:
- it... |
4684352 | What does "Git push non-fast-forward updates were rejected" mean? | 172 | 2011-01-13 19:31:32 | <p>I'm using Git to manage my two computers and my development. I'm trying to commit changes to GitHub, and I got this error:</p>
<blockquote>
<p>Failed to push some refs to <code><repo></code>. To prevent you from losing history, non-fast-forward updates were rejected. Merge remote changes before pushing again.<... | 316,849 | 224,988 | 2024-05-09 18:25:28 | 4,684,404 | 156 | 2011-01-13 19:36:23 | 6,309 | 2015-12-10 15:32:46 | https://stackoverflow.com/q/4684352 | https://stackoverflow.com/a/4684404 | <p>GitHub has a nice section called "<a href="https://help.github.com/articles/dealing-with-non-fast-forward-errors" rel="noreferrer">Dealing with “non-fast-forward” errors</a>"</p>
<blockquote>
<p>This error can be a bit overwhelming at first, do not fear.<br>
<strong>Simply put, git cannot make the change on the... | <p>GitHub has a nice section called "<a href="https://help.github.com/articles/dealing-with-non-fast-forward-errors" rel="noreferrer">Dealing with “non-fast-forward” errors</a>"</p> <blockquote> <p>This error can be a bit overwhelming at first, do not fear.<br> <strong>Simply put, git cannot make the change on the... | 119, 456 | git, version-control | <h1>What does "Git push non-fast-forward updates were rejected" mean?</h1>
<p>I'm using Git to manage my two computers and my development. I'm trying to commit changes to GitHub, and I got this error:</p>
<blockquote>
<p>Failed to push some refs to <code><repo></code>. To prevent you from losing history, non-fast... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,363 | git | # What does "Git push non-fast-forward updates were rejected" mean?
I'm using Git to manage my two computers and my development. I'm trying to commit changes to GitHub, and I got this error:
> Failed to push some refs to `<repo>`. To prevent you from losing history, non-fast-forward updates were rejected. Merge remot... | GitHub has a nice section called "[Dealing with “non-fast-forward” errors](https://help.github.com/articles/dealing-with-non-fast-forward-errors)"
> This error can be a bit overwhelming at first, do not fear.
> **Simply put, git cannot make the change on the remote without losing commits, so it refuses the push**. ... |
8820668 | The current branch is not configured for pull No value for key branch.master.merge found in configuration | 166 | 2012-01-11 14:09:39 | <p>I get this error when I try to pull from remote repository using Egit team>pull</p>
<blockquote>
<p>The current branch is not configured for pull No value for key
branch.master.merge found in configuration</p>
</blockquote>
| 87,169 | 263,215 | 2021-08-17 02:28:48 | 8,821,041 | 156 | 2012-01-11 14:35:51 | 369,894 | 2012-01-11 14:35:51 | https://stackoverflow.com/q/8820668 | https://stackoverflow.com/a/8821041 | <p>Your local master branch is not set up to track remote master branch.</p>
<p>You could do <code>git pull origin master</code> to tell git the explicit branch you want to pull or you add this to your .git/config:</p>
<pre><code>[branch "master"]
remote = origin
merge = refs/heads/master
</code></pre>
<p>When y... | <p>Your local master branch is not set up to track remote master branch.</p> <p>You could do <code>git pull origin master</code> to tell git the explicit branch you want to pull or you add this to your .git/config:</p> <pre><code>[branch "master"] remote = origin merge = refs/heads/master </code></pre> <p>When y... | 53, 119, 43702 | eclipse, egit, git | <h1>The current branch is not configured for pull No value for key branch.master.merge found in configuration</h1>
<p>I get this error when I try to pull from remote repository using Egit team>pull</p>
<blockquote>
<p>The current branch is not configured for pull No value for key
branch.master.merge found in confi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,364 | git | # The current branch is not configured for pull No value for key branch.master.merge found in configuration
I get this error when I try to pull from remote repository using Egit team>pull
> The current branch is not configured for pull No value for key
> branch.master.merge found in configuration | Your local master branch is not set up to track remote master branch.
You could do `git pull origin master` to tell git the explicit branch you want to pull or you add this to your .git/config:
```
[branch "master"]
remote = origin
merge = refs/heads/master
```
When you push to master for the first time, add the... |
18436680 | how to reset develop branch to master | 145 | 2013-08-26 04:36:32 | <p>I have <code>develop</code> & <code>master</code> branches, my <code>develop</code> branch is messy now and i would like to reset it and make it as a copy of my <code>master</code>. i'm not sure if merging the <code>master</code> into <code>develop</code> will make both of them identical. after trying to merge i... | 257,201 | 223,130 | 2023-02-02 09:57:46 | 18,436,728 | 156 | 2013-08-26 04:41:58 | 148,870 | 2023-02-02 09:57:46 | https://stackoverflow.com/q/18436680 | https://stackoverflow.com/a/18436728 | <p>If you want to make <code>develop</code> be identical to <code>master</code>, the simplest way is just to recreate the pointer:</p>
<pre><code>git branch -f develop master
</code></pre>
<p>Or, if you already have <code>develop</code> checked out:</p>
<pre><code>git reset --hard master
</code></pre>
<p>Note however t... | <p>If you want to make <code>develop</code> be identical to <code>master</code>, the simplest way is just to recreate the pointer:</p> <pre><code>git branch -f develop master </code></pre> <p>Or, if you already have <code>develop</code> checked out:</p> <pre><code>git reset --hard master </code></pre> <p>Note however t... | 119, 456, 1879 | branch, git, version-control | <h1>how to reset develop branch to master</h1>
<p>I have <code>develop</code> & <code>master</code> branches, my <code>develop</code> branch is messy now and i would like to reset it and make it as a copy of my <code>master</code>. i'm not sure if merging the <code>master</code> into <code>develop</code> will make ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,365 | git | # how to reset develop branch to master
I have `develop` & `master` branches, my `develop` branch is messy now and i would like to reset it and make it as a copy of my `master`. i'm not sure if merging the `master` into `develop` will make both of them identical. after trying to merge i got many conflicts i solved the... | If you want to make `develop` be identical to `master`, the simplest way is just to recreate the pointer:
```
git branch -f develop master
```
Or, if you already have `develop` checked out:
```
git reset --hard master
```
Note however that both of these options will get rid of any history that `develop` had which w... |
928646 | Have Git Select Local Version On Merge Conflict on a Specific File? | 118 | 2009-05-30 00:29:53 | <p>Say I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to.</p>
<p>Is there any way to set up my local repo to not complain about a conflicted merge every time I git pull? I'd like to always select my local version when merging this fil... | 60,549 | 37,984 | 2024-10-07 19:39:46 | 930,495 | 156 | 2009-05-30 20:12:53 | 6,309 | 2023-04-25 07:31:25 | https://stackoverflow.com/q/928646 | https://stackoverflow.com/a/930495 | <p>On the specific instance of a config file, I would agree with <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/928771#928771">Ron's answer</a>:<br />
the config should be "private" to your workspace (hence "ignored&qu... | <p>On the specific instance of a config file, I would agree with <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/928771#928771">Ron's answer</a>:<br /> the config should be "private" to your workspace (hence "ignored&qu... | 119, 28897 | git, git-merge | <h1>Have Git Select Local Version On Merge Conflict on a Specific File?</h1>
<p>Say I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to.</p>
<p>Is there any way to set up my local repo to not complain about a conflicted merge every time... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,366 | git | # Have Git Select Local Version On Merge Conflict on a Specific File?
Say I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to.
Is there any way to set up my local repo to not complain about a conflicted merge every time I git pull? I'... | On the specific instance of a config file, I would agree with [Ron's answer](https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-sp/928771#928771):
the config should be "private" to your workspace (hence "ignored", as in "declared in a `.gitignore`... |
11284350 | How to see code changes after git pull? | 147 | 2012-07-01 17:53:34 | <p>I would like to inspect any code changes after doing a <code>git pull</code>. Currently it's just showing me which files changes. How can I see what code changed?</p>
| 120,374 | 686,654 | 2023-01-26 10:07:17 | 11,284,366 | 155 | 2012-07-01 17:55:29 | 238,886 | 2015-12-02 10:22:06 | https://stackoverflow.com/q/11284350 | https://stackoverflow.com/a/11284366 | <pre><code>git log --name-status -2
</code></pre>
<p>Will show you the names of the files that changed for the last two commits.</p>
<pre><code>git log -p -2
</code></pre>
<p>Will show you the changes themselves.</p>
<p>Before you pull,</p>
<pre><code>git fetch
git log --name-status origin/master..
</code></pre>
... | <pre><code>git log --name-status -2 </code></pre> <p>Will show you the names of the files that changed for the last two commits.</p> <pre><code>git log -p -2 </code></pre> <p>Will show you the changes themselves.</p> <p>Before you pull,</p> <pre><code>git fetch git log --name-status origin/master.. </code></pre> ... | 119 | git | <h1>How to see code changes after git pull?</h1>
<p>I would like to inspect any code changes after doing a <code>git pull</code>. Currently it's just showing me which files changes. How can I see what code changed?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,367 | git | # How to see code changes after git pull?
I would like to inspect any code changes after doing a `git pull`. Currently it's just showing me which files changes. How can I see what code changed? | ```
git log --name-status -2
```
Will show you the names of the files that changed for the last two commits.
```
git log -p -2
```
Will show you the changes themselves.
Before you pull,
```
git fetch
git log --name-status origin/master..
```
Will show you what commits you are about to retrieve, along with the nam... |
13030714 | Git: fatal: The current branch master has multiple upstream branches, refusing to push | 93 | 2012-10-23 12:45:39 | <p>I have this strange issue, whenever I do <code>git push</code> it refuses to do anything:</p>
<p><code>fatal: The current branch master has multiple upstream branches, refusing to push.</code></p>
<p>When I do <code>git push -u origin master</code> it seem to set it as a tracking branch:</p>
<p><code>Branch master s... | 57,449 | 166,484 | 2025-04-30 03:49:42 | 13,033,395 | 155 | 2012-10-23 14:59:43 | 337,297 | 2012-10-23 14:59:43 | https://stackoverflow.com/q/13030714 | https://stackoverflow.com/a/13033395 | <p>You might want to do the following:</p>
<pre><code>git config remote.origin.push HEAD
</code></pre>
<p>Pushing without any arguments on a master branch can lead to your error message. I'm not sure if it's a regression problem, or if it's always been the case.</p>
| <p>You might want to do the following:</p> <pre><code>git config remote.origin.push HEAD </code></pre> <p>Pushing without any arguments on a master branch can lead to your error message. I'm not sure if it's a regression problem, or if it's always been the case.</p> | 119 | git | <h1>Git: fatal: The current branch master has multiple upstream branches, refusing to push</h1>
<p>I have this strange issue, whenever I do <code>git push</code> it refuses to do anything:</p>
<p><code>fatal: The current branch master has multiple upstream branches, refusing to push.</code></p>
<p>When I do <code>git p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,368 | git | # Git: fatal: The current branch master has multiple upstream branches, refusing to push
I have this strange issue, whenever I do `git push` it refuses to do anything:
`fatal: The current branch master has multiple upstream branches, refusing to push.`
When I do `git push -u origin master` it seem to set it as a tra... | You might want to do the following:
```
git config remote.origin.push HEAD
```
Pushing without any arguments on a master branch can lead to your error message. I'm not sure if it's a regression problem, or if it's always been the case. |
34549040 | git not displaying unicode file names | 86 | 2015-12-31 16:29:28 | <p>I'm using git 2.5.4 on Mac OS X. </p>
<p>I have filenames containing <code>é</code> and git is displaying it with escapes. Is there a way to make it use unicode and show the character? The terminal can obviously handle it.</p>
<pre><code>> ls
Sél
> git status
Untracked files:
(use "git add <file>..." ... | 11,776 | 327,572 | 2022-07-01 08:53:53 | 34,549,249 | 155 | 2015-12-31 16:49:06 | 6,309 | 2022-07-01 08:53:53 | https://stackoverflow.com/q/34549040 | https://stackoverflow.com/a/34549249 | <p>Check first if <code>git config core.quotePath false</code> helps.</p>
<pre><code>git config --global core.quotePath false
</code></pre>
<p>This is the documentation for <code>core.quotePath</code>:</p>
<blockquote>
<p><code>core.quotePath</code></p>
<p>Commands that output paths (e.g. <code>ls-files</code>, <code>d... | <p>Check first if <code>git config core.quotePath false</code> helps.</p> <pre><code>git config --global core.quotePath false </code></pre> <p>This is the documentation for <code>core.quotePath</code>:</p> <blockquote> <p><code>core.quotePath</code></p> <p>Commands that output paths (e.g. <code>ls-files</code>, <code>d... | 119, 279 | git, unicode | <h1>git not displaying unicode file names</h1>
<p>I'm using git 2.5.4 on Mac OS X. </p>
<p>I have filenames containing <code>é</code> and git is displaying it with escapes. Is there a way to make it use unicode and show the character? The terminal can obviously handle it.</p>
<pre><code>> ls
Sél
> git status
U... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,369 | git | # git not displaying unicode file names
I'm using git 2.5.4 on Mac OS X.
I have filenames containing `é` and git is displaying it with escapes. Is there a way to make it use unicode and show the character? The terminal can obviously handle it.
```
> ls
Sél
> git status
Untracked files:
(use "git add <file>..." to i... | Check first if `git config core.quotePath false` helps.
```
git config --global core.quotePath false
```
This is the documentation for `core.quotePath`:
> `core.quotePath`
>
> Commands that output paths (e.g. `ls-files`, `diff`), will quote "unusual" characters in the pathname by enclosing the pathname in double-quo... |
1809484 | Git: how to reverse-merge a commit? | 176 | 2009-11-27 15:54:07 | <p>With SVN it is easy to reverse-merge a commit, but how to do that with Git?</p>
| 183,480 | 209,706 | 2022-10-25 01:31:11 | 1,809,552 | 154 | 2009-11-27 16:09:36 | 189,179 | 2022-06-17 06:52:08 | https://stackoverflow.com/q/1809484 | https://stackoverflow.com/a/1809552 | <p>To create a new commit that 'undoes' the changes of a past commit, use:</p>
<pre><code>$ git revert <commit-hash>
</code></pre>
<p>It's also possible to actually remove a commit from an arbitrary point in the past by rebasing and then resetting, but you really don't want to do that if you have already pushed y... | <p>To create a new commit that 'undoes' the changes of a past commit, use:</p> <pre><code>$ git revert <commit-hash> </code></pre> <p>It's also possible to actually remove a commit from an arbitrary point in the past by rebasing and then resetting, but you really don't want to do that if you have already pushed y... | 119, 717 | git, merge | <h1>Git: how to reverse-merge a commit?</h1>
<p>With SVN it is easy to reverse-merge a commit, but how to do that with Git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,371 | git | # Git: how to reverse-merge a commit?
With SVN it is easy to reverse-merge a commit, but how to do that with Git? | To create a new commit that 'undoes' the changes of a past commit, use:
```
$ git revert <commit-hash>
```
It's also possible to actually remove a commit from an arbitrary point in the past by rebasing and then resetting, but you really don't want to do that if you have already pushed your commits to another reposito... |
24983762 | Git ignore local file changes | 106 | 2014-07-27 17:47:41 | <p>I've tried both</p>
<pre><code>git update-index --assume-unchanged config/myconfig
</code></pre>
<p>and </p>
<p>editing <code>.git/info/exclude</code> and adding <code>config/myconfig</code></p>
<p>however when I do git pull I always get:</p>
<blockquote>
<p>Updating 0156abc..1cfd6a5
error: Your local chang... | 286,441 | 2,395,365 | 2023-06-13 16:02:33 | 24,983,863 | 154 | 2014-07-27 17:57:29 | 406,249 | 2014-07-27 18:37:28 | https://stackoverflow.com/q/24983762 | https://stackoverflow.com/a/24983863 | <p><code>git pull</code> wants you to either remove or save your current work so that the merge it triggers doesn't cause conflicts with your uncommitted work. Note that you should only need to remove/save untracked files if the changes you're pulling create files in the same locations as your local uncommitted files.<... | <p><code>git pull</code> wants you to either remove or save your current work so that the merge it triggers doesn't cause conflicts with your uncommitted work. Note that you should only need to remove/save untracked files if the changes you're pulling create files in the same locations as your local uncommitted files.<... | 119 | git | <h1>Git ignore local file changes</h1>
<p>I've tried both</p>
<pre><code>git update-index --assume-unchanged config/myconfig
</code></pre>
<p>and </p>
<p>editing <code>.git/info/exclude</code> and adding <code>config/myconfig</code></p>
<p>however when I do git pull I always get:</p>
<blockquote>
<p>Updating 015... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,374 | git | # Git ignore local file changes
I've tried both
```
git update-index --assume-unchanged config/myconfig
```
and
editing `.git/info/exclude` and adding `config/myconfig`
however when I do git pull I always get:
> Updating 0156abc..1cfd6a5
> error: Your local changes to the following files would be overwritten by m... | `git pull` wants you to either remove or save your current work so that the merge it triggers doesn't cause conflicts with your uncommitted work. Note that you should only need to remove/save untracked files if the changes you're pulling create files in the same locations as your local uncommitted files.
## Remove you... |
43161383 | Stage only deleted files with git add | 87 | 2017-04-01 19:59:15 | <p>I have run <code>git status</code> and see several modified files and several deleted files.</p>
<p>Is it possible to stage only deleted or only modified files?</p>
| 31,703 | 1,264,304 | 2023-07-21 19:57:12 | 45,959,365 | 154 | 2017-08-30 11:36:17 | 1,173,869 | 2017-08-30 11:36:17 | https://stackoverflow.com/q/43161383 | https://stackoverflow.com/a/45959365 | <p>If you have a mix of modified and deleted files and only want to stage deleted files to the index, you can use <code>git ls-files</code> as a filter.</p>
<pre><code>git ls-files --deleted | xargs git add
</code></pre>
<p>If you only want this to apply to part of the file tree, give one or more subdirectories as ar... | <p>If you have a mix of modified and deleted files and only want to stage deleted files to the index, you can use <code>git ls-files</code> as a filter.</p> <pre><code>git ls-files --deleted | xargs git add </code></pre> <p>If you only want this to apply to part of the file tree, give one or more subdirectories as ar... | 119, 34792, 74978 | git, git-add, git-stage | <h1>Stage only deleted files with git add</h1>
<p>I have run <code>git status</code> and see several modified files and several deleted files.</p>
<p>Is it possible to stage only deleted or only modified files?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,375 | git | # Stage only deleted files with git add
I have run `git status` and see several modified files and several deleted files.
Is it possible to stage only deleted or only modified files? | If you have a mix of modified and deleted files and only want to stage deleted files to the index, you can use `git ls-files` as a filter.
```
git ls-files --deleted | xargs git add
```
If you only want this to apply to part of the file tree, give one or more subdirectories as arguments to `ls-files`:
```
git ls-fil... |
58165880 | Xcode 11 SPM authentication failed because no credentials provided | 58 | 2019-09-30 10:22:18 | <p>I started using Swift package manager and when I add repository with https (<a href="https://github.com/Alamofire/Alamofire.git" rel="noreferrer">https://github.com/Alamofire/Alamofire.git</a>) address authentication always fails when I try to login with my github account</p>
<p><a href="https://i.sstatic.net/cLUqH... | 45,177 | 2,346,696 | 2023-09-09 14:21:57 | 58,179,025 | 154 | 2019-10-01 06:17:32 | 2,346,696 | 2022-04-08 03:40:56 | https://stackoverflow.com/q/58165880 | https://stackoverflow.com/a/58179025 | <p>It was a problem with git config. In .gitconfig file it was set to</p>
<pre><code>[url "git@github.com:"]
insteadOf = https://github.com/
</code></pre>
<p>After removing this section https worked correctly</p>
<p>EDIT: as mentioned in comments you can easily access your gitconfig in terminal with comma... | <p>It was a problem with git config. In .gitconfig file it was set to</p> <pre><code>[url "git@github.com:"] insteadOf = https://github.com/ </code></pre> <p>After removing this section https worked correctly</p> <p>EDIT: as mentioned in comments you can easily access your gitconfig in terminal with comma... | 119, 908, 58338, 104797, 116442 | git, ios, swift, swift-package-manager, xcode | <h1>Xcode 11 SPM authentication failed because no credentials provided</h1>
<p>I started using Swift package manager and when I add repository with https (<a href="https://github.com/Alamofire/Alamofire.git" rel="noreferrer">https://github.com/Alamofire/Alamofire.git</a>) address authentication always fails when I try ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,377 | git | # Xcode 11 SPM authentication failed because no credentials provided
I started using Swift package manager and when I add repository with https (<https://github.com/Alamofire/Alamofire.git>) address authentication always fails when I try to login with my github account
[Xcode authentication fail](https://i.sstatic.ne... | It was a problem with git config. In .gitconfig file it was set to
```
[url "git@github.com:"]
insteadOf = https://github.com/
```
After removing this section https worked correctly
EDIT: as mentioned in comments you can easily access your gitconfig in terminal with command: `git config --global --edit` |
14872486 | Retrieve specific commit from a remote Git repository | 258 | 2013-02-14 10:18:07 | <p>Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and hence there won't be any conflicts but I have no idea how to do this and I don't want to clone that huge repository.</p>
<p>I am new to git, i... | 471,416 | 1,340,332 | 2024-11-16 23:19:36 | 30,701,724 | 153 | 2015-06-08 05:22:17 | 6,309 | 2024-11-16 23:19:36 | https://stackoverflow.com/q/14872486 | https://stackoverflow.com/a/30701724 | <p>Starting with Git version 2.5+ (Q2 2015), fetching a single commit (without cloning the full repo) is actually possible.</p>
<p>See <a href="https://github.com/git/git/commit/68ee628932c2196742b77d2961c5e16360734a62" rel="noreferrer">commit 68ee628</a> by <a href="https://github.com/moroten" rel="noreferrer">Fredrik... | <p>Starting with Git version 2.5+ (Q2 2015), fetching a single commit (without cloning the full repo) is actually possible.</p> <p>See <a href="https://github.com/git/git/commit/68ee628932c2196742b77d2961c5e16360734a62" rel="noreferrer">commit 68ee628</a> by <a href="https://github.com/moroten" rel="noreferrer">Fredrik... | 119, 33720 | git, git-fetch | <h1>Retrieve specific commit from a remote Git repository</h1>
<p>Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and hence there won't be any conflicts but I have no idea how to do this and I don't... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,378 | git | # Retrieve specific commit from a remote Git repository
Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and hence there won't be any conflicts but I have no idea how to do this and I don't want to ... | Starting with Git version 2.5+ (Q2 2015), fetching a single commit (without cloning the full repo) is actually possible.
See [commit 68ee628](https://github.com/git/git/commit/68ee628932c2196742b77d2961c5e16360734a62) by [Fredrik Medley (`moroten`)](https://github.com/moroten), 21 May 2015.
(Merged by [Junio C Haman... |
5167367 | How can I make git do the "did you mean" suggestion? | 123 | 2011-03-02 12:20:07 | <p>I type </p>
<pre><code>git puhs
</code></pre>
<p>And git says:</p>
<pre><code>kristian@office:~/myrepo$ git puhs
git: 'puhs' is not a git command. See 'git --help'
Did you mean this?
push
</code></pre>
<p>What is the config setting to make git just do the suggested command if it only has one suggestion ?<... | 16,650 | 23,691 | 2022-01-09 12:48:22 | 5,167,644 | 153 | 2011-03-02 12:44:57 | 198,244 | 2012-02-06 19:02:47 | https://stackoverflow.com/q/5167367 | https://stackoverflow.com/a/5167644 | <p>According to <a href="http://schacon.github.com/git/git-config.html">git-config(1)</a>, you want to set <code>help.autocorrect</code> appropriately. For example, <code>git config --global help.autocorrect 5</code> will make it wait half a second before running the command so you can see the message first.</p>
| <p>According to <a href="http://schacon.github.com/git/git-config.html">git-config(1)</a>, you want to set <code>help.autocorrect</code> appropriately. For example, <code>git config --global help.autocorrect 5</code> will make it wait half a second before running the command so you can see the message first.</p> | 119 | git | <h1>How can I make git do the "did you mean" suggestion?</h1>
<p>I type </p>
<pre><code>git puhs
</code></pre>
<p>And git says:</p>
<pre><code>kristian@office:~/myrepo$ git puhs
git: 'puhs' is not a git command. See 'git --help'
Did you mean this?
push
</code></pre>
<p>What is the config setting to make git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,380 | git | # How can I make git do the "did you mean" suggestion?
I type
```
git puhs
```
And git says:
```
kristian@office:~/myrepo$ git puhs
git: 'puhs' is not a git command. See 'git --help'
Did you mean this?
push
```
What is the config setting to make git just do the suggested command if it only has one suggestio... | According to [git-config(1)](http://schacon.github.com/git/git-config.html), you want to set `help.autocorrect` appropriately. For example, `git config --global help.autocorrect 5` will make it wait half a second before running the command so you can see the message first. |
4126300 | Git: how to get all the files changed and new files in a folder or zip? | 111 | 2010-11-08 17:26:20 | <p>As my question says, after changing files and adding new files in my repository, I normally commit files with <strong>git</strong>, but sometimes I need all the modified / changed files copied to a folder for organizing-myself reasons.</p>
<p>Any option?</p>
| 79,309 | 301,742 | 2023-06-01 22:49:05 | 4,126,342 | 153 | 2010-11-08 17:31:43 | 119,963 | 2023-06-01 22:30:25 | https://stackoverflow.com/q/4126300 | https://stackoverflow.com/a/4126342 | <p>Assuming you mean you haven't yet committed, and want to package up all of the files that currently have local <em>modifications</em> (but <strong>not</strong> completely new files), you can get the list of modified files with <code>git ls-files --modified</code>. If you want the files which were changed by the last... | <p>Assuming you mean you haven't yet committed, and want to package up all of the files that currently have local <em>modifications</em> (but <strong>not</strong> completely new files), you can get the list of modified files with <code>git ls-files --modified</code>. If you want the files which were changed by the last... | 119 | git | <h1>Git: how to get all the files changed and new files in a folder or zip?</h1>
<p>As my question says, after changing files and adding new files in my repository, I normally commit files with <strong>git</strong>, but sometimes I need all the modified / changed files copied to a folder for organizing-myself reasons.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,382 | git | # Git: how to get all the files changed and new files in a folder or zip?
As my question says, after changing files and adding new files in my repository, I normally commit files with **git**, but sometimes I need all the modified / changed files copied to a folder for organizing-myself reasons.
Any option? | Assuming you mean you haven't yet committed, and want to package up all of the files that currently have local *modifications* (but **not** completely new files), you can get the list of modified files with `git ls-files --modified`. If you want the files which were changed by the last commit, you could use `git diff -... |
42800902 | How to generate patch for all commits in a branch? | 110 | 2017-03-15 04:03:38 | <p>How can I generate patch for all commits in a given branch by knowing only the branch name?</p>
<p>This step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not an option.</p>
<p>Note that anything relying on reflog is ... | 87,121 | 121,371 | 2021-07-15 12:03:31 | 42,802,061 | 153 | 2017-03-15 05:56:21 | 6,309 | 2020-09-30 19:50:12 | https://stackoverflow.com/q/42800902 | https://stackoverflow.com/a/42802061 | <p>If you know from which branch your "given branch" has been created, then <a href="https://stackoverflow.com/a/16676931/6309">making a patch is easy</a>:</p>
<pre><code>git diff master Branch1 > ../patchfile
git checkout Branch2
git apply ../patchfile
</code></pre>
<p>(and you can generate a <a href=... | <p>If you know from which branch your "given branch" has been created, then <a href="https://stackoverflow.com/a/16676931/6309">making a patch is easy</a>:</p> <pre><code>git diff master Branch1 > ../patchfile git checkout Branch2 git apply ../patchfile </code></pre> <p>(and you can generate a <a href=... | 119, 62078, 76220 | git, git-branch, git-patch | <h1>How to generate patch for all commits in a branch?</h1>
<p>How can I generate patch for all commits in a given branch by knowing only the branch name?</p>
<p>This step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,383 | git | # How to generate patch for all commits in a branch?
How can I generate patch for all commits in a given branch by knowing only the branch name?
This step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not an option.
Note... | If you know from which branch your "given branch" has been created, then [making a patch is easy](https://stackoverflow.com/a/16676931/6309):
```
git diff master Branch1 > ../patchfile
git checkout Branch2
git apply ../patchfile
```
(and you can generate a [patch applicable without git too](https://stackoverflow.... |
18487089 | Git command to checkout any branch and overwrite local changes | 107 | 2013-08-28 11:51:08 | <p>Is there a Git command (or a short sequence of commands) that will safely and surely do the following?</p>
<ul>
<li>Get rid of any local changes.</li>
<li>Fetch the given branch from origin if necessary</li>
<li>Checkout the given branch?</li>
</ul>
<p>Currently I'm stuck with:</p>
<pre><code>git fetch -p
git sta... | 206,028 | 7,202 | 2021-10-27 05:23:18 | 18,487,838 | 153 | 2013-08-28 12:24:41 | 6,309 | 2021-10-27 05:23:18 | https://stackoverflow.com/q/18487089 | https://stackoverflow.com/a/18487838 | <p>You could follow a solution similar to <em>"<a href="https://stackoverflow.com/a/8888015/6309">How do I force “git pull” to overwrite local files?</a>"</em>:</p>
<pre><code>git fetch --all
git reset --hard origin/abranch
git checkout abranch
</code></pre>
<p>That would involve only one fetch.</p>
<p>With ... | <p>You could follow a solution similar to <em>"<a href="https://stackoverflow.com/a/8888015/6309">How do I force “git pull” to overwrite local files?</a>"</em>:</p> <pre><code>git fetch --all git reset --hard origin/abranch git checkout abranch </code></pre> <p>That would involve only one fetch.</p> <p>With ... | 119, 190, 37230 | deployment, git, git-checkout | <h1>Git command to checkout any branch and overwrite local changes</h1>
<p>Is there a Git command (or a short sequence of commands) that will safely and surely do the following?</p>
<ul>
<li>Get rid of any local changes.</li>
<li>Fetch the given branch from origin if necessary</li>
<li>Checkout the given branch?</li>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,385 | git | # Git command to checkout any branch and overwrite local changes
Is there a Git command (or a short sequence of commands) that will safely and surely do the following?
- Get rid of any local changes.
- Fetch the given branch from origin if necessary
- Checkout the given branch?
Currently I'm stuck with:
```
git fet... | You could follow a solution similar to *"[How do I force “git pull” to overwrite local files?](https://stackoverflow.com/a/8888015/6309)"*:
```
git fetch --all
git reset --hard origin/abranch
git checkout abranch
```
That would involve only one fetch.
With Git 2.23+, `git checkout` is replaced here with [`git switch... |
20438293 | Preparing a git commit message before committing? | 96 | 2013-12-07 06:07:34 | <p>Is it possible to prepare a commit message prior to a commit, meaning that I will type my commit message before the actual commit or during the working dir so that I know what I am working on and I know what this branch or commit will be all about. When I say "before" I do not mean just couple secs before I enter th... | 39,243 | 1,814,930 | 2024-05-24 23:23:46 | 20,438,380 | 153 | 2013-12-07 06:21:44 | 641,955 | 2013-12-14 14:01:12 | https://stackoverflow.com/q/20438293 | https://stackoverflow.com/a/20438380 | <p>Git can take the commit message from a file using the <code>-F</code> or <code>--file</code> flags:</p>
<pre><code>git commit -F message.txt
</code></pre>
<p>You can prepare your message in advance in a text file and use that file when you commit.</p>
<p>If you do this often, it makes sense to create an alias for... | <p>Git can take the commit message from a file using the <code>-F</code> or <code>--file</code> flags:</p> <pre><code>git commit -F message.txt </code></pre> <p>You can prepare your message in advance in a text file and use that file when you commit.</p> <p>If you do this often, it makes sense to create an alias for... | 119 | git | <h1>Preparing a git commit message before committing?</h1>
<p>Is it possible to prepare a commit message prior to a commit, meaning that I will type my commit message before the actual commit or during the working dir so that I know what I am working on and I know what this branch or commit will be all about. When I sa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,386 | git | # Preparing a git commit message before committing?
Is it possible to prepare a commit message prior to a commit, meaning that I will type my commit message before the actual commit or during the working dir so that I know what I am working on and I know what this branch or commit will be all about. When I say "before... | Git can take the commit message from a file using the `-F` or `--file` flags:
```
git commit -F message.txt
```
You can prepare your message in advance in a text file and use that file when you commit.
If you do this often, it makes sense to create an alias for it, for example:
```
done = commit -F message.txt
```
... |
17470691 | Remove old remote branches from Git | 93 | 2013-07-04 12:46:00 | <p>When I use bash autocompletion in Git, it keeps showing me branches of old remotes that I don't have anymore. When I do a <code>git branch -la</code> it shows those old remotes and branches while a <code>git branch -l</code> won't. A <code>ls .git/refs/remotes/</code> also shows them. However, they are not present i... | 43,014 | 679,913 | 2020-02-20 02:40:18 | 17,471,862 | 153 | 2013-07-04 13:42:04 | 43,681 | 2016-07-15 08:12:14 | https://stackoverflow.com/q/17470691 | https://stackoverflow.com/a/17471862 | <p>Git does not delete the (local) remote-tracking branches automatically if the branch was deleted in the remote repository. Additionally, before V2.0.1 remote-tracking branches were in some cases not deleted when you removed the remote from your git config (see VonC's answer).</p>
<p>To delete stale remote-tracking ... | <p>Git does not delete the (local) remote-tracking branches automatically if the branch was deleted in the remote repository. Additionally, before V2.0.1 remote-tracking branches were in some cases not deleted when you removed the remote from your git config (see VonC's answer).</p> <p>To delete stale remote-tracking ... | 119 | git | <h1>Remove old remote branches from Git</h1>
<p>When I use bash autocompletion in Git, it keeps showing me branches of old remotes that I don't have anymore. When I do a <code>git branch -la</code> it shows those old remotes and branches while a <code>git branch -l</code> won't. A <code>ls .git/refs/remotes/</code> als... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,387 | git | # Remove old remote branches from Git
When I use bash autocompletion in Git, it keeps showing me branches of old remotes that I don't have anymore. When I do a `git branch -la` it shows those old remotes and branches while a `git branch -l` won't. A `ls .git/refs/remotes/` also shows them. However, they are not presen... | Git does not delete the (local) remote-tracking branches automatically if the branch was deleted in the remote repository. Additionally, before V2.0.1 remote-tracking branches were in some cases not deleted when you removed the remote from your git config (see VonC's answer).
To delete stale remote-tracking branches (... |
11557759 | Gem file with git remote failing on heroku push | 55 | 2012-07-19 09:25:35 | <p>I have the following line in my gemfile:</p>
<pre><code>gem 'client_side_validations', :git => "git@github.com:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'
</code></pre>
<p>The repo it's pointing at is public and I can run bundle install / update l... | 11,231 | 702,072 | 2017-11-24 18:35:33 | 11,558,814 | 153 | 2012-07-19 10:25:07 | 5,168 | 2013-07-02 14:28:42 | https://stackoverflow.com/q/11557759 | https://stackoverflow.com/a/11558814 | <p>Use this GitHub URL instead: <code>git://github.com/Dakuan/client_side_validations.git</code></p>
<p>The <code>git@github.com:…</code> URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.</p>
<p>The <code>git://github.... | <p>Use this GitHub URL instead: <code>git://github.com/Dakuan/client_side_validations.git</code></p> <p>The <code>git@github.com:…</code> URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.</p> <p>The <code>git://github.... | 12, 119, 4984, 8279, 43112 | bundler, git, heroku, ruby, ruby-on-rails | <h1>Gem file with git remote failing on heroku push</h1>
<p>I have the following line in my gemfile:</p>
<pre><code>gem 'client_side_validations', :git => "git@github.com:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'
</code></pre>
<p>The repo it's poin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,388 | git | # Gem file with git remote failing on heroku push
I have the following line in my gemfile:
```
gem 'client_side_validations', :git => "git@github.com:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'
```
The repo it's pointing at is public and I can run bundle ... | Use this GitHub URL instead: `git://github.com/Dakuan/client_side_validations.git`
The `git@github.com:…` URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.
The `git://github.com/…` URL is the public, read-only version.... |
8625406 | How to delete a branch in the remote repository using EGIT? | 80 | 2011-12-24 15:39:16 | <p>How to delete the remote branch itself in sourceforge with all files in it, using egit ?</p>
| 41,510 | 263,215 | 2016-03-09 15:36:21 | 8,625,647 | 152 | 2011-12-24 16:24:40 | 123,695 | 2016-03-09 15:36:21 | https://stackoverflow.com/q/8625406 | https://stackoverflow.com/a/8625647 | <p>Go to <code>Team > Remote > Push…</code> from the menu. Select your repository, and click <code>Next</code>. Under <code>Remote ref to delete…</code> select your branch and click <code>Add spec</code>. Then click <code>Finish</code>. This should delete the remote branch. </p>
<p><a href="https://i.sstatic.ne... | <p>Go to <code>Team > Remote > Push…</code> from the menu. Select your repository, and click <code>Next</code>. Under <code>Remote ref to delete…</code> select your branch and click <code>Add spec</code>. Then click <code>Finish</code>. This should delete the remote branch. </p> <p><a href="https://i.sstatic.ne... | 53, 119, 1879, 43702 | branch, eclipse, egit, git | <h1>How to delete a branch in the remote repository using EGIT?</h1>
<p>How to delete the remote branch itself in sourceforge with all files in it, using egit ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,390 | git | # How to delete a branch in the remote repository using EGIT?
How to delete the remote branch itself in sourceforge with all files in it, using egit ? | Go to `Team > Remote > Push…` from the menu. Select your repository, and click `Next`. Under `Remote ref to delete…` select your branch and click `Add spec`. Then click `Finish`. This should delete the remote branch.
[](https://i.sstatic.ne... |
1351567 | Putting uncommitted changes at Master to a new branch by Git | 188 | 2009-08-29 14:29:00 | <p>How can you put uncommitted changes to a branch TEST when I am at the branch <code>master</code>?</p>
| 46,528 | 54,964 | 2022-08-09 14:43:37 | 1,351,587 | 151 | 2009-08-29 14:34:05 | 105,486 | 2012-03-28 05:47:13 | https://stackoverflow.com/q/1351567 | https://stackoverflow.com/a/1351587 | <p>You can just checkout to the test branch and then commit. You don't lose your uncommited changes when moving to another branch.</p>
<p>Supposing you are at the master branch:</p>
<pre><code>git checkout test
git add .
git add deletedFile1
git add deletedFile2
...
git commit -m "My Custom Message"
</code></pre>
<p... | <p>You can just checkout to the test branch and then commit. You don't lose your uncommited changes when moving to another branch.</p> <p>Supposing you are at the master branch:</p> <pre><code>git checkout test git add . git add deletedFile1 git add deletedFile2 ... git commit -m "My Custom Message" </code></pre> <p... | 119, 1879 | branch, git | <h1>Putting uncommitted changes at Master to a new branch by Git</h1>
<p>How can you put uncommitted changes to a branch TEST when I am at the branch <code>master</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,391 | git | # Putting uncommitted changes at Master to a new branch by Git
How can you put uncommitted changes to a branch TEST when I am at the branch `master`? | You can just checkout to the test branch and then commit. You don't lose your uncommited changes when moving to another branch.
Supposing you are at the master branch:
```
git checkout test
git add .
git add deletedFile1
git add deletedFile2
...
git commit -m "My Custom Message"
```
I am not really sure about the de... |
7938723 | Git: How to check if a local repo is up to date? | 158 | 2011-10-29 11:53:01 | <p>I would like to know if my local repo is up to date (and if not, ideally, I would like to see the changes).</p>
<p>How could I check this without doing <code>git fetch</code> or <code>git pull</code> ?</p>
| 265,944 | 247,243 | 2023-12-18 20:09:43 | 7,939,193 | 151 | 2011-10-29 13:29:45 | 717,355 | 2023-12-18 20:09:43 | https://stackoverflow.com/q/7938723 | https://stackoverflow.com/a/7939193 | <p>Try <code>git fetch --dry-run</code>
The manual (<code>git help fetch</code>) says:</p>
<pre><code>--dry-run
Show what would be done, without making any changes.
</code></pre>
<p>This may show no output at all (indicating repo is up-to-date); if you prefer to see some output try <code>git fetch --dry-run --verbose</... | <p>Try <code>git fetch --dry-run</code> The manual (<code>git help fetch</code>) says:</p> <pre><code>--dry-run Show what would be done, without making any changes. </code></pre> <p>This may show no output at all (indicating repo is up-to-date); if you prefer to see some output try <code>git fetch --dry-run --verbose</... | 119, 28896, 33720 | git, git-fetch, git-pull | <h1>Git: How to check if a local repo is up to date?</h1>
<p>I would like to know if my local repo is up to date (and if not, ideally, I would like to see the changes).</p>
<p>How could I check this without doing <code>git fetch</code> or <code>git pull</code> ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,392 | git | # Git: How to check if a local repo is up to date?
I would like to know if my local repo is up to date (and if not, ideally, I would like to see the changes).
How could I check this without doing `git fetch` or `git pull` ? | Try `git fetch --dry-run`
The manual (`git help fetch`) says:
```
--dry-run
Show what would be done, without making any changes.
```
This may show no output at all (indicating repo is up-to-date); if you prefer to see some output try `git fetch --dry-run --verbose` |
14404704 | How do I replace a git submodule with another repo? | 116 | 2013-01-18 17:52:39 | <p>How do I replace a git submodule with a different git repo?</p>
<p>Specifically, I have a submodule:</p>
<ul>
<li>located at <code>./ExternalFrameworks/TestFramework</code> that points to a git repo <code>git@github.com:userA/TestFramework.git</code> </li>
<li>I'd like it to now point to <code>git@github.com:userB... | 56,758 | 1,192,740 | 2022-06-13 04:15:59 | 14,405,542 | 151 | 2013-01-18 18:45:13 | 63,147 | 2022-06-13 04:15:59 | https://stackoverflow.com/q/14404704 | https://stackoverflow.com/a/14405542 | <p>If the location (URL) of the submodule has changed, then you can simply:</p>
<ol>
<li>Modify the <code>.gitmodules</code> file in the repo root to use the new URL.</li>
<li>Delete the submodule folder in the repo <code>rm -rf .git/modules/<submodule></code>.</li>
<li>Delete the submodule folder in the working ... | <p>If the location (URL) of the submodule has changed, then you can simply:</p> <ol> <li>Modify the <code>.gitmodules</code> file in the repo root to use the new URL.</li> <li>Delete the submodule folder in the repo <code>rm -rf .git/modules/<submodule></code>.</li> <li>Delete the submodule folder in the working ... | 119, 41612 | git, git-submodules | <h1>How do I replace a git submodule with another repo?</h1>
<p>How do I replace a git submodule with a different git repo?</p>
<p>Specifically, I have a submodule:</p>
<ul>
<li>located at <code>./ExternalFrameworks/TestFramework</code> that points to a git repo <code>git@github.com:userA/TestFramework.git</code> </l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,394 | git | # How do I replace a git submodule with another repo?
How do I replace a git submodule with a different git repo?
Specifically, I have a submodule:
- located at `./ExternalFrameworks/TestFramework` that points to a git repo `git@github.com:userA/TestFramework.git`
- I'd like it to now point to `git@github.com:userB/... | If the location (URL) of the submodule has changed, then you can simply:
1. Modify the `.gitmodules` file in the repo root to use the new URL.
2. Delete the submodule folder in the repo `rm -rf .git/modules/<submodule>`.
3. Delete the submodule folder in the working directory `rm -rf <submodule>`.
4. Run `git submodul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.