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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
55045740 | Stuck in a git rebase ... how to reset | 54 | 2019-03-07 14:07:41 | <p>I am part way through a git rebase and I am stuck. I can't remember exactly what happened but I was using a UI and deleted a checked-out branch and things just seemed to go blank. I restarted and managed to do a bit of other work creating and committing to other branches etc but then I noticed a status saying I was ... | 48,791 | 4,121,869 | 2023-07-22 17:45:15 | 55,046,679 | 70 | 2019-03-07 14:52:52 | 2,612,235 | 2023-07-22 17:45:15 | https://stackoverflow.com/q/55045740 | https://stackoverflow.com/a/55046679 | <p>To escape from corrupted <code>git rebase</code> you can do the following</p>
<ol>
<li>Reset to a known state. You can find out from which commit you started your <code>rebase</code> with <code>git reflog</code>.</li>
</ol>
<p>For example, <code>reflog</code> will give you the following. The rebase starting point is... | <p>To escape from corrupted <code>git rebase</code> you can do the following</p> <ol> <li>Reset to a known state. You can find out from which commit you started your <code>rebase</code> with <code>git reflog</code>.</li> </ol> <p>For example, <code>reflog</code> will give you the following. The rebase starting point is... | 119, 8974 | git, rebase | <h1>Stuck in a git rebase ... how to reset</h1>
<p>I am part way through a git rebase and I am stuck. I can't remember exactly what happened but I was using a UI and deleted a checked-out branch and things just seemed to go blank. I restarted and managed to do a bit of other work creating and committing to other branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,640 | git | # Stuck in a git rebase ... how to reset
I am part way through a git rebase and I am stuck. I can't remember exactly what happened but I was using a UI and deleted a checked-out branch and things just seemed to go blank. I restarted and managed to do a bit of other work creating and committing to other branches etc bu... | To escape from corrupted `git rebase` you can do the following
1. Reset to a known state. You can find out from which commit you started your `rebase` with `git reflog`.
For example, `reflog` will give you the following. The rebase starting point is the last `rebase (start)` or `rebase -i (start)` if you did an inter... |
14259265 | egit - not authorized | 52 | 2013-01-10 13:40:30 | <p>I just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.</p>
<p>Then I tried to "Fetch from Upstream". I got this error:</p>
<pre>https://github.com/biunlp/nlp-lab.git: not auth... | 118,283 | 827,927 | 2024-04-29 15:21:19 | 14,260,809 | 70 | 2013-01-10 15:01:14 | 6,309 | 2022-04-10 10:35:34 | https://stackoverflow.com/q/14259265 | https://stackoverflow.com/a/14260809 | <p>Update 2022: In what follows, always use:</p>
<ul>
<li>a <a href="https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231" rel="nofollow noreferrer">App password, <em>not</em> your account password</a> (see <a href="https://bitbucket.org/blo... | <p>Update 2022: In what follows, always use:</p> <ul> <li>a <a href="https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231" rel="nofollow noreferrer">App password, <em>not</em> your account password</a> (see <a href="https://bitbucket.org/blo... | 53, 119, 43702 | eclipse, egit, git | <h1>egit - not authorized</h1>
<p>I just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.</p>
<p>Then I tried to "Fetch from Upstream". I got this error:</p>
<pre>https://github.c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,641 | git | # egit - not authorized
I just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.
Then I tried to "Fetch from Upstream". I got this error:
```
https://github.com/biunlp/nlp-lab.git... | Update 2022: In what follows, always use:
- a [App password, *not* your account password](https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231) (see [blog post](https://bitbucket.org/blog/deprecating-atlassian-account-password-for-bitbucket... |
11007552 | Git: whole file to stdout | 51 | 2012-06-13 02:40:58 | <p>Is there a command that can take a ref and a file path, and output the full contents of the file as it was at that commit to STDOUT?</p>
<p>Eg. Something like this:</p>
<pre><code>git show-me-the-file HEAD~2 some/file | do_something_with_piped_output_here
</code></pre>
| 17,068 | 31,092 | 2016-04-11 12:21:27 | 11,007,594 | 70 | 2012-06-13 02:47:21 | 209,246 | 2016-04-11 12:21:27 | https://stackoverflow.com/q/11007552 | https://stackoverflow.com/a/11007594 | <p><code>git show</code></p>
<p>e.g.</p>
<p><code>git show HEAD:./<path_to_file></code></p>
| <p><code>git show</code></p> <p>e.g.</p> <p><code>git show HEAD:./<path_to_file></code></p> | 119 | git | <h1>Git: whole file to stdout</h1>
<p>Is there a command that can take a ref and a file path, and output the full contents of the file as it was at that commit to STDOUT?</p>
<p>Eg. Something like this:</p>
<pre><code>git show-me-the-file HEAD~2 some/file | do_something_with_piped_output_here
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,642 | git | # Git: whole file to stdout
Is there a command that can take a ref and a file path, and output the full contents of the file as it was at that commit to STDOUT?
Eg. Something like this:
```
git show-me-the-file HEAD~2 some/file | do_something_with_piped_output_here
``` | `git show`
e.g.
`git show HEAD:./<path_to_file>` |
4848607 | Git 'fatal: No such ref: HEAD' | 48 | 2011-01-31 07:39:48 | <p>A weird thing happend to my git repository. When I try to commit something in tortoisegit window I receive all files from project. I cannot revert them, when I pull from server I receive <code>fatal: No such ref: HEAD</code> and <code>fatal: Cannot lock the ref 'HEAD'</code>. All my local branches are missing. Is th... | 60,548 | 205,234 | 2024-12-13 16:49:24 | 4,848,878 | 70 | 2011-01-31 08:29:43 | 19,563 | 2015-03-13 03:26:12 | https://stackoverflow.com/q/4848607 | https://stackoverflow.com/a/4848878 | <p>You've lost your <code>HEAD</code> so you'll need to recreate it. The simplest thing to do is this.</p>
<pre><code>echo ref: refs/heads/master >.git/HEAD
</code></pre>
<p>Now you should be able to run other git commands and see where you're at.</p>
<p>(Although, in theory, you could attempt to do <code>git sym... | <p>You've lost your <code>HEAD</code> so you'll need to recreate it. The simplest thing to do is this.</p> <pre><code>echo ref: refs/heads/master >.git/HEAD </code></pre> <p>Now you should be able to run other git commands and see where you're at.</p> <p>(Although, in theory, you could attempt to do <code>git sym... | 119, 31409 | git, tortoisegit | <h1>Git 'fatal: No such ref: HEAD'</h1>
<p>A weird thing happend to my git repository. When I try to commit something in tortoisegit window I receive all files from project. I cannot revert them, when I pull from server I receive <code>fatal: No such ref: HEAD</code> and <code>fatal: Cannot lock the ref 'HEAD'</code>. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,644 | git | # Git 'fatal: No such ref: HEAD'
A weird thing happend to my git repository. When I try to commit something in tortoisegit window I receive all files from project. I cannot revert them, when I pull from server I receive `fatal: No such ref: HEAD` and `fatal: Cannot lock the ref 'HEAD'`. All my local branches are missi... | You've lost your `HEAD` so you'll need to recreate it. The simplest thing to do is this.
```
echo ref: refs/heads/master >.git/HEAD
```
Now you should be able to run other git commands and see where you're at.
(Although, in theory, you could attempt to do `git symbolic-ref HEAD refs/heads/master` newer git versions ... |
4675726 | Merge (no branch) into master | 46 | 2011-01-13 00:50:34 | <pre><code>dave@dave-dev:/media/dev/belgravia$ git branch
* (no branch)
master
</code></pre>
<p>I'm not sure how this happened, but is there a way I can merge no-branch into the master. I'm not sure how I can merge two branches when one of them is not a branch. The commits in no-branch seem to be loose. I'm afraid t... | 20,354 | 181,637 | 2015-03-12 19:35:42 | 4,675,769 | 70 | 2011-01-13 00:58:24 | 893 | 2011-01-13 00:58:24 | https://stackoverflow.com/q/4675726 | https://stackoverflow.com/a/4675769 | <p>Use <code>git show</code> to get the SHA1 commit ID of the current HEAD. With that information, you can't lose those commits.</p>
<p>Then, switch to master and:</p>
<pre><code>git merge abc123
</code></pre>
<p>where <code>abc123</code> is the SHA1 from the first step.</p>
| <p>Use <code>git show</code> to get the SHA1 commit ID of the current HEAD. With that information, you can't lose those commits.</p> <p>Then, switch to master and:</p> <pre><code>git merge abc123 </code></pre> <p>where <code>abc123</code> is the SHA1 from the first step.</p> | 119, 456 | git, version-control | <h1>Merge (no branch) into master</h1>
<pre><code>dave@dave-dev:/media/dev/belgravia$ git branch
* (no branch)
master
</code></pre>
<p>I'm not sure how this happened, but is there a way I can merge no-branch into the master. I'm not sure how I can merge two branches when one of them is not a branch. The commits in n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,646 | git | # Merge (no branch) into master
```
dave@dave-dev:/media/dev/belgravia$ git branch
* (no branch)
master
```
I'm not sure how this happened, but is there a way I can merge no-branch into the master. I'm not sure how I can merge two branches when one of them is not a branch. The commits in no-branch seem to be loose.... | Use `git show` to get the SHA1 commit ID of the current HEAD. With that information, you can't lose those commits.
Then, switch to master and:
```
git merge abc123
```
where `abc123` is the SHA1 from the first step. |
22135465 | Cant commit after starting a merge in Sourcetree | 45 | 2014-03-03 00:04:17 | <p>When trying to commit after a merge I'm getting this error message:</p>
<blockquote>
<p>"fatal: You are in the middle of a merge -- cannot amend."</p>
</blockquote>
<p>How do i resolve this? as far as I know I have resolved all conflicts, i just need to complete the merge and commit the changes. but the product ... | 86,785 | 328,327 | 2019-10-17 05:56:59 | 31,257,966 | 70 | 2015-07-07 00:39:51 | 857,012 | 2019-03-27 02:45:09 | https://stackoverflow.com/q/22135465 | https://stackoverflow.com/a/31257966 | <p>You can manually delete <code>.git/MERGE_HEAD</code> and Git won't be able to tell that you were just doing a merge. It will let you amend the previous commit with the changes in your index just like normal.</p>
<h3>Please read:</h3>
<p>Though this would work, it is a hack and not recommended. All is needed here i... | <p>You can manually delete <code>.git/MERGE_HEAD</code> and Git won't be able to tell that you were just doing a merge. It will let you amend the previous commit with the changes in your index just like normal.</p> <h3>Please read:</h3> <p>Though this would work, it is a hack and not recommended. All is needed here i... | 119, 90056 | atlassian-sourcetree, git | <h1>Cant commit after starting a merge in Sourcetree</h1>
<p>When trying to commit after a merge I'm getting this error message:</p>
<blockquote>
<p>"fatal: You are in the middle of a merge -- cannot amend."</p>
</blockquote>
<p>How do i resolve this? as far as I know I have resolved all conflicts, i just need to c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,647 | git | # Cant commit after starting a merge in Sourcetree
When trying to commit after a merge I'm getting this error message:
> "fatal: You are in the middle of a merge -- cannot amend."
How do i resolve this? as far as I know I have resolved all conflicts, i just need to complete the merge and commit the changes. but the ... | You can manually delete `.git/MERGE_HEAD` and Git won't be able to tell that you were just doing a merge. It will let you amend the previous commit with the changes in your index just like normal.
### Please read:
Though this would work, it is a hack and not recommended. All is needed here is to let git know the merg... |
22038600 | .gitignore not ignoring web.config | 43 | 2014-02-26 10:31:01 | <p>For my remote repository, I'm trying to ignore the web.config file of my Umbraco website.
The .gitignore is in the root of my website, and the file to ignore, web.config is also in the root of my website.</p>
<p>so I added this line to my .gitignore file:</p>
<pre><code>web.config
</code></pre>
<p>But everytime I... | 34,434 | 831,732 | 2022-11-05 02:16:58 | 22,038,663 | 70 | 2014-02-26 10:33:07 | 1,640,038 | 2022-11-05 02:16:58 | https://stackoverflow.com/q/22038600 | https://stackoverflow.com/a/22038663 | <p>git will not ignore a file that's already tracked before a rule is added to this file to ignore it. In such a case, the file must be un-tracked with <code>git rm --cached <filename></code>.</p>
<p>So, if you are trying to ignore this file newly, run this: <code>git rm --cached web.config</code>.</p>
| <p>git will not ignore a file that's already tracked before a rule is added to this file to ignore it. In such a case, the file must be un-tracked with <code>git rm --cached <filename></code>.</p> <p>So, if you are trying to ignore this file newly, run this: <code>git rm --cached web.config</code>.</p> | 119, 5893 | git, umbraco | <h1>.gitignore not ignoring web.config</h1>
<p>For my remote repository, I'm trying to ignore the web.config file of my Umbraco website.
The .gitignore is in the root of my website, and the file to ignore, web.config is also in the root of my website.</p>
<p>so I added this line to my .gitignore file:</p>
<pre><code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,649 | git | # .gitignore not ignoring web.config
For my remote repository, I'm trying to ignore the web.config file of my Umbraco website.
The .gitignore is in the root of my website, and the file to ignore, web.config is also in the root of my website.
so I added this line to my .gitignore file:
```
web.config
```
But everyti... | git will not ignore a file that's already tracked before a rule is added to this file to ignore it. In such a case, the file must be un-tracked with `git rm --cached <filename>`.
So, if you are trying to ignore this file newly, run this: `git rm --cached web.config`. |
28819345 | Git - how to verify if and where Git is installed on Ubuntu | 41 | 2015-03-02 21:00:35 | <p>I am new to Ubuntu and Git. How I can verify that I have installed git on my machine? When I tried apt-get I got:</p>
<pre><code>root@ubuntu:/home/nebojsa# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version.
The follo... | 105,286 | 4,503,829 | 2024-09-28 15:12:25 | 28,819,373 | 70 | 2015-03-02 21:02:17 | 1,389,596 | 2024-09-28 15:12:25 | https://stackoverflow.com/q/28819345 | https://stackoverflow.com/a/28819373 | <p>Type <code>which git</code>. It should return the path to the executable</p>
<p>If you want to see more details see: <a href="https://serverfault.com/questions/96964/list-of-files-installed-from-apt-package">List of files installed from apt package</a></p>
| <p>Type <code>which git</code>. It should return the path to the executable</p> <p>If you want to see more details see: <a href="https://serverfault.com/questions/96964/list-of-files-installed-from-apt-package">List of files installed from apt package</a></p> | 119, 549 | git, ubuntu | <h1>Git - how to verify if and where Git is installed on Ubuntu</h1>
<p>I am new to Ubuntu and Git. How I can verify that I have installed git on my machine? When I tried apt-get I got:</p>
<pre><code>root@ubuntu:/home/nebojsa# apt-get install git
Reading package lists... Done
Building dependency tree
Reading s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,651 | git | # Git - how to verify if and where Git is installed on Ubuntu
I am new to Ubuntu and Git. How I can verify that I have installed git on my machine? When I tried apt-get I got:
```
root@ubuntu:/home/nebojsa# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... ... | Type `which git`. It should return the path to the executable
If you want to see more details see: [List of files installed from apt package](https://serverfault.com/questions/96964/list-of-files-installed-from-apt-package) |
17546246 | Cloning a repository into a new repository | 41 | 2013-07-09 10:45:47 | <p>I am using Git (on Bitbucket) and have a repository with my code. I now want to use this code and largely modify it for another project all together.</p>
<p>I understand that I should abstract the common components to a third library and use that but for the sake of argument, if I want to clone the current repositor... | 133,764 | 225,814 | 2026-01-24 12:24:39 | 17,547,320 | 70 | 2013-07-09 11:40:10 | 2,158,473 | 2022-02-07 15:58:12 | https://stackoverflow.com/q/17546246 | https://stackoverflow.com/a/17547320 | <p>First clone the repository you want to work with. This step could be skipped if you want it all to happen in the folder you are already in.</p>
<pre><code>git clone file:///path/to/repo/
</code></pre>
<p>Cloning will bring over the remotes specified in that directory. So you'll need to <a href="http://git-scm.com/bo... | <p>First clone the repository you want to work with. This step could be skipped if you want it all to happen in the folder you are already in.</p> <pre><code>git clone file:///path/to/repo/ </code></pre> <p>Cloning will bring over the remotes specified in that directory. So you'll need to <a href="http://git-scm.com/bo... | 119, 7330, 8337 | bitbucket, git, repository | <h1>Cloning a repository into a new repository</h1>
<p>I am using Git (on Bitbucket) and have a repository with my code. I now want to use this code and largely modify it for another project all together.</p>
<p>I understand that I should abstract the common components to a third library and use that but for the sake o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,653 | git | # Cloning a repository into a new repository
I am using Git (on Bitbucket) and have a repository with my code. I now want to use this code and largely modify it for another project all together.
I understand that I should abstract the common components to a third library and use that but for the sake of argument, if ... | First clone the repository you want to work with. This step could be skipped if you want it all to happen in the folder you are already in.
```
git clone file:///path/to/repo/
```
Cloning will bring over the remotes specified in that directory. So you'll need to [remove the remotes](http://git-scm.com/book/ch2-5.html... |
25593043 | Configuring Git `user.name`? | 38 | 2014-08-31 14:42:18 | <p>I installed Git for Windows 7 today. I don't know much about Git yet and I'm following <a href="http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup" rel="nofollow noreferrer">http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup</a> and videos from YouTube on that subject. On the videos p... | 100,010 | 2,896,490 | 2024-10-03 17:02:04 | 25,593,073 | 70 | 2014-08-31 14:45:57 | 2,541,573 | 2020-07-23 10:33:40 | https://stackoverflow.com/q/25593043 | https://stackoverflow.com/a/25593073 | <p>You're not using the correct syntax: there shouldn't be any equal sign between <code>user.name</code> and <code>"My name"</code>, or between <code>user.email</code> and <code>"email@example.com"</code>. For instance, when you run</p>
<pre><code>git config --global user.name = "My Name"
... | <p>You're not using the correct syntax: there shouldn't be any equal sign between <code>user.name</code> and <code>"My name"</code>, or between <code>user.email</code> and <code>"email@example.com"</code>. For instance, when you run</p> <pre><code>git config --global user.name = "My Name" ... | 119, 32868 | git, git-config | <h1>Configuring Git `user.name`?</h1>
<p>I installed Git for Windows 7 today. I don't know much about Git yet and I'm following <a href="http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup" rel="nofollow noreferrer">http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup</a> and videos from Yo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,655 | git | # Configuring Git `user.name`?
I installed Git for Windows 7 today. I don't know much about Git yet and I'm following <http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup> and videos from YouTube on that subject. On the videos people install Git and go to the command line and use
```
git config --globa... | You're not using the correct syntax: there shouldn't be any equal sign between `user.name` and `"My name"`, or between `user.email` and `"email@example.com"`. For instance, when you run
```
git config --global user.name = "My Name"
```
the command interprets the `=` character as the string value passed to the `user.n... |
66476216 | How can I edit the .git / config file from the git terminal? | 34 | 2021-03-04 13:38:48 | <p>I am trying to modify the config file from the git terminal, for this, inside the repository, I have launched the command <code>git global --edit</code>.</p>
<p>An editor opens within the same terminal, my problem is, <strong>how can I save the changes and exit the editor?</strong>? Every time I make a change the ed... | 131,084 | 15,297,444 | 2025-11-19 17:33:17 | 66,476,393 | 70 | 2021-03-04 13:48:52 | 2,915,738 | 2024-11-05 12:05:46 | https://stackoverflow.com/q/66476216 | https://stackoverflow.com/a/66476393 | <blockquote>
<p>I have launched the command git global --edit</p>
</blockquote>
<p>Not sure how and why that works for you. That should not have worked in the first place.
To edit the config globally in editor, you should use below command :</p>
<pre><code>git config --global --edit
</code></pre>
<p>This should open a ... | <blockquote> <p>I have launched the command git global --edit</p> </blockquote> <p>Not sure how and why that works for you. That should not have worked in the first place. To edit the config globally in editor, you should use below command :</p> <pre><code>git config --global --edit </code></pre> <p>This should open a ... | 119 | git | <h1>How can I edit the .git / config file from the git terminal?</h1>
<p>I am trying to modify the config file from the git terminal, for this, inside the repository, I have launched the command <code>git global --edit</code>.</p>
<p>An editor opens within the same terminal, my problem is, <strong>how can I save the ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,656 | git | # How can I edit the .git / config file from the git terminal?
I am trying to modify the config file from the git terminal, for this, inside the repository, I have launched the command `git global --edit`.
An editor opens within the same terminal, my problem is, **how can I save the changes and exit the editor?**? Ev... | > I have launched the command git global --edit
Not sure how and why that works for you. That should not have worked in the first place.
To edit the config globally in editor, you should use below command :
```
git config --global --edit
```
This should open a text editor, make your changes ,save and exit the editor... |
8007675 | Trouble Installing Git on CentOS | 20 | 2011-11-04 10:14:21 | <p>I'm having trouble installing Git on CentOS 5.5 x86_64. I'm not an expert at this type of thing, what's the problem?</p>
<pre><code>root@server [/]# yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: fedora-epel.mirror.lstn.net
* rpmfusion-free-updates: mirror.us.leas... | 8,243 | 1,018,582 | 2012-02-06 11:44:42 | 8,007,970 | 70 | 2011-11-04 10:35:17 | 1,018,582 | 2011-11-04 10:35:17 | https://stackoverflow.com/q/8007675 | https://stackoverflow.com/a/8007970 | <p>Figured it out, it was because of cpanel.</p>
<p>This fixes it:</p>
<pre><code>yum install git --disableexcludes=main
</code></pre>
| <p>Figured it out, it was because of cpanel.</p> <p>This fixes it:</p> <pre><code>yum install git --disableexcludes=main </code></pre> | 58, 119, 4956, 7425 | centos, git, linux, yum | <h1>Trouble Installing Git on CentOS</h1>
<p>I'm having trouble installing Git on CentOS 5.5 x86_64. I'm not an expert at this type of thing, what's the problem?</p>
<pre><code>root@server [/]# yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: fedora-epel.mirror.lstn.net... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,659 | git | # Trouble Installing Git on CentOS
I'm having trouble installing Git on CentOS 5.5 x86_64. I'm not an expert at this type of thing, what's the problem?
```
root@server [/]# yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: fedora-epel.mirror.lstn.net
* rpmfusion-free-u... | Figured it out, it was because of cpanel.
This fixes it:
```
yum install git --disableexcludes=main
``` |
7897517 | Why does "git difftool" not open the tool directly? | 196 | 2011-10-26 00:40:42 | <p>I configured <code>git</code> like this:</p>
<pre><code>git config --global diff.tool meld
</code></pre>
<p>When I run: </p>
<pre><code>git difftool
</code></pre>
<p>I get the following message:</p>
<pre><code>Viewing: 'hello.txt'
Hit return to launch 'meld':
</code></pre>
<p>Then, if I press <kbd>Enter</kbd>... | 48,260 | 247,243 | 2020-06-24 13:55:05 | 7,898,422 | 69 | 2011-10-26 03:24:56 | 424,780 | 2011-10-26 03:24:56 | https://stackoverflow.com/q/7897517 | https://stackoverflow.com/a/7898422 | <pre><code>man git-difftool
OPTIONS
-y, --no-prompt
Do not prompt before launching a diff tool.
</code></pre>
| <pre><code>man git-difftool OPTIONS -y, --no-prompt Do not prompt before launching a diff tool. </code></pre> | 119, 606, 33608 | diff, difftool, git | <h1>Why does "git difftool" not open the tool directly?</h1>
<p>I configured <code>git</code> like this:</p>
<pre><code>git config --global diff.tool meld
</code></pre>
<p>When I run: </p>
<pre><code>git difftool
</code></pre>
<p>I get the following message:</p>
<pre><code>Viewing: 'hello.txt'
Hit return to launch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,660 | git | # Why does "git difftool" not open the tool directly?
I configured `git` like this:
```
git config --global diff.tool meld
```
When I run:
```
git difftool
```
I get the following message:
```
Viewing: 'hello.txt'
Hit return to launch 'meld':
```
Then, if I press `Enter`, `meld` will launch.
How can I disable t... | ```
man git-difftool
OPTIONS
-y, --no-prompt
Do not prompt before launching a diff tool.
``` |
45096755 | fatal: ambiguous argument 'origin': unknown revision or path not in the working tree | 108 | 2017-07-14 07:05:12 | <p>I used <code>git diff origin</code> often in the past.</p>
<p>In a different environment it does not work. I have no clue why.</p>
<pre><code>user@host> git diff origin
fatal: ambiguous argument 'origin': unknown revision or path
not in the working tree.
Use '--' to separate paths from revisions, like t... | 338,107 | 633,961 | 2024-03-28 15:50:03 | 45,096,973 | 69 | 2017-07-14 07:16:57 | 991,762 | 2017-07-14 10:00:24 | https://stackoverflow.com/q/45096755 | https://stackoverflow.com/a/45096973 | <p>The <code>git diff</code> command typically expects one or more commit hashes to generate your diff. You seem to be supplying the name of a remote.</p>
<p>If you had a branch named <code>origin</code>, the commit hash at tip of the branch would have been used if you supplied <code>origin</code> to the diff command,... | <p>The <code>git diff</code> command typically expects one or more commit hashes to generate your diff. You seem to be supplying the name of a remote.</p> <p>If you had a branch named <code>origin</code>, the commit hash at tip of the branch would have been used if you supplied <code>origin</code> to the diff command,... | 119 | git | <h1>fatal: ambiguous argument 'origin': unknown revision or path not in the working tree</h1>
<p>I used <code>git diff origin</code> often in the past.</p>
<p>In a different environment it does not work. I have no clue why.</p>
<pre><code>user@host> git diff origin
fatal: ambiguous argument 'origin': unknown revis... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,663 | git | # fatal: ambiguous argument 'origin': unknown revision or path not in the working tree
I used `git diff origin` often in the past.
In a different environment it does not work. I have no clue why.
```
user@host> git diff origin
fatal: ambiguous argument 'origin': unknown revision or path
not in the working tr... | The `git diff` command typically expects one or more commit hashes to generate your diff. You seem to be supplying the name of a remote.
If you had a branch named `origin`, the commit hash at tip of the branch would have been used if you supplied `origin` to the diff command, but currently (with no corresponding branc... |
3392392 | When is the right time to delete a git feature branch? | 103 | 2010-08-02 22:49:02 | <p>I don't want to end up with <a href="https://stackoverflow.com/questions/2353804/list-git-branches-that-can-safely-be-deleted">82 feature branches hanging around</a>, so I'm wondering what the potential drawbacks are to simply deleting the feature branch as soon as I merge it to master.</p>
<p>Workflow:</p>
<pre><... | 39,959 | 67,022 | 2024-02-12 17:31:07 | 3,392,942 | 69 | 2010-08-03 01:12:32 | 86,432 | 2023-04-17 18:09:15 | https://stackoverflow.com/q/3392392 | https://stackoverflow.com/a/3392942 | <p>Delete after merge is the usual way. This is why <code>git branch -d yourbranchname</code> checks to make sure that the branch is fully merged before it will delete.</p>
<p>There are a few reasons that I can think of to keep a branch around: you might want to hold onto it in case you have bugs coming back once it h... | <p>Delete after merge is the usual way. This is why <code>git branch -d yourbranchname</code> checks to make sure that the branch is fully merged before it will delete.</p> <p>There are a few reasons that I can think of to keep a branch around: you might want to hold onto it in case you have bugs coming back once it h... | 119, 456, 1879 | branch, git, version-control | <h1>When is the right time to delete a git feature branch?</h1>
<p>I don't want to end up with <a href="https://stackoverflow.com/questions/2353804/list-git-branches-that-can-safely-be-deleted">82 feature branches hanging around</a>, so I'm wondering what the potential drawbacks are to simply deleting the feature branc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,664 | git | # When is the right time to delete a git feature branch?
I don't want to end up with [82 feature branches hanging around](https://stackoverflow.com/questions/2353804/list-git-branches-that-can-safely-be-deleted), so I'm wondering what the potential drawbacks are to simply deleting the feature branch as soon as I merge... | Delete after merge is the usual way. This is why `git branch -d yourbranchname` checks to make sure that the branch is fully merged before it will delete.
There are a few reasons that I can think of to keep a branch around: you might want to hold onto it in case you have bugs coming back once it hits production, or yo... |
45216144 | How do I move unpushed committed code to another branch? | 94 | 2017-07-20 13:25:58 | <p>So I have the following situation:</p>
<p>I committed some work locally, without pushing to the remote repository. I want to move this local code to another branch, because if I pull, there will be modifications that will ruin all the work I put locally.</p>
<p>This is the output of <code>git status</code> on the ol... | 55,821 | 7,200,751 | 2024-04-27 14:18:35 | 45,216,522 | 69 | 2017-07-20 13:42:13 | 498,699 | 2020-08-13 15:32:55 | https://stackoverflow.com/q/45216144 | https://stackoverflow.com/a/45216522 | <p>If you made the branch after you committed it should contain the commit that you are wanting to move. You can verify this with <code>git log</code>, you should see your commit as the first on in the log.</p>
<p>On the branch that you no longer want the commit to be do <code>git reset --hard HEAD~</code>. This remo... | <p>If you made the branch after you committed it should contain the commit that you are wanting to move. You can verify this with <code>git log</code>, you should see your commit as the first on in the log.</p> <p>On the branch that you no longer want the commit to be do <code>git reset --hard HEAD~</code>. This remo... | 119 | git | <h1>How do I move unpushed committed code to another branch?</h1>
<p>So I have the following situation:</p>
<p>I committed some work locally, without pushing to the remote repository. I want to move this local code to another branch, because if I pull, there will be modifications that will ruin all the work I put local... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,665 | git | # How do I move unpushed committed code to another branch?
So I have the following situation:
I committed some work locally, without pushing to the remote repository. I want to move this local code to another branch, because if I pull, there will be modifications that will ruin all the work I put locally.
This is th... | If you made the branch after you committed it should contain the commit that you are wanting to move. You can verify this with `git log`, you should see your commit as the first on in the log.
On the branch that you no longer want the commit to be do `git reset --hard HEAD~`. This removes the commit from the branch an... |
15124430 | How to checkout old git commit including all submodules recursively? | 76 | 2013-02-27 23:15:42 | <p>I have a git repo with multiple submodules. One of those submodules has multiple submodules of it's own. All I'm looking to do is check out an old commit on the master repo and have it checkout the appropriate commits from all submodules to get the correct state of the code at that time.</p>
<p>I know that git cont... | 69,535 | 299,262 | 2019-07-29 15:17:20 | 15,124,462 | 69 | 2013-02-27 23:17:30 | 758,345 | 2019-07-29 15:17:20 | https://stackoverflow.com/q/15124430 | https://stackoverflow.com/a/15124462 | <p>You need two commands to achieve this:</p>
<pre><code>git checkout *oldcommit*
git submodule update --recursive
</code></pre>
<hr>
<p><strong>Update:</strong> This answer is outdated as of 2018 – see <a href="https://stackoverflow.com/questions/15124430/how-to-checkout-old-git-commit-including-all-submodules-recu... | <p>You need two commands to achieve this:</p> <pre><code>git checkout *oldcommit* git submodule update --recursive </code></pre> <hr> <p><strong>Update:</strong> This answer is outdated as of 2018 – see <a href="https://stackoverflow.com/questions/15124430/how-to-checkout-old-git-commit-including-all-submodules-recu... | 119, 41612 | git, git-submodules | <h1>How to checkout old git commit including all submodules recursively?</h1>
<p>I have a git repo with multiple submodules. One of those submodules has multiple submodules of it's own. All I'm looking to do is check out an old commit on the master repo and have it checkout the appropriate commits from all submodules t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,669 | git | # How to checkout old git commit including all submodules recursively?
I have a git repo with multiple submodules. One of those submodules has multiple submodules of it's own. All I'm looking to do is check out an old commit on the master repo and have it checkout the appropriate commits from all submodules to get the... | You need two commands to achieve this:
```
git checkout *oldcommit*
git submodule update --recursive
```
---
**Update:** This answer is outdated as of 2018 – see [VonC's answer below](https://stackoverflow.com/questions/15124430/how-to-checkout-old-git-commit-including-all-submodules-recursively/44249558#44249558) f... |
5516391 | Git rebase will not continue after a delete/modify conflict | 73 | 2011-04-01 16:49:20 | <p>I'm in the middle of a rebase of my master to a stage branch</p>
<pre><code>git checkout stage
git rebase master
</code></pre>
<p>At some time I deleted two files then modified the two files according to GIT.</p>
<pre><code>warning: too many files, skipping inexact rename detection
CONFLICT (delete/modify): test-... | 51,871 | 25,143 | 2021-11-26 18:36:32 | 5,516,684 | 69 | 2011-04-01 17:20:47 | 1,864,976 | 2021-11-26 18:36:32 | https://stackoverflow.com/q/5516391 | https://stackoverflow.com/a/5516684 | <p>do <code>git add -A</code> followed by <code>git rebase --continue</code>. This should add all changes - including your removal of the files and then continue.</p>
<p>There is no guarantee that the commit didn't have other files that did not conflict and should be merged. <code>git rebase --skip</code> would lose th... | <p>do <code>git add -A</code> followed by <code>git rebase --continue</code>. This should add all changes - including your removal of the files and then continue.</p> <p>There is no guarantee that the commit didn't have other files that did not conflict and should be merged. <code>git rebase --skip</code> would lose th... | 119, 456, 8974, 29934 | git, git-rebase, rebase, version-control | <h1>Git rebase will not continue after a delete/modify conflict</h1>
<p>I'm in the middle of a rebase of my master to a stage branch</p>
<pre><code>git checkout stage
git rebase master
</code></pre>
<p>At some time I deleted two files then modified the two files according to GIT.</p>
<pre><code>warning: too many fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,670 | git | # Git rebase will not continue after a delete/modify conflict
I'm in the middle of a rebase of my master to a stage branch
```
git checkout stage
git rebase master
```
At some time I deleted two files then modified the two files according to GIT.
```
warning: too many files, skipping inexact rename detection
CONFLI... | do `git add -A` followed by `git rebase --continue`. This should add all changes - including your removal of the files and then continue.
There is no guarantee that the commit didn't have other files that did not conflict and should be merged. `git rebase --skip` would lose those files. You don't want that. |
6191985 | Git http - securely remember credentials | 72 | 2011-05-31 18:39:23 | <p>Is there a way to securely let git remember my credentials when connecting to remote repositories over HTTP(S)? </p>
<p>I've tried the <code>core.askpass</code> approach detailed in <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>git-config</code></a> to let an external script supply my credenti... | 75,973 | 416,564 | 2018-05-01 15:22:02 | 7,181,169 | 69 | 2011-08-24 19:31:30 | 82,880 | 2012-10-17 16:22:07 | https://stackoverflow.com/q/6191985 | https://stackoverflow.com/a/7181169 | <p><code>git</code> invokes cURL when running over HTTP. You can store secure credentials by setting up a <code>.netrc</code> file in your user's home directory, and making it private to the user (0600 in Linux).</p>
<p>The contents of the file provide the username and password per remote domain.</p>
<pre><code>mach... | <p><code>git</code> invokes cURL when running over HTTP. You can store secure credentials by setting up a <code>.netrc</code> file in your user's home directory, and making it private to the user (0600 in Linux).</p> <p>The contents of the file provide the username and password per remote domain.</p> <pre><code>mach... | 119, 183 | authentication, git | <h1>Git http - securely remember credentials</h1>
<p>Is there a way to securely let git remember my credentials when connecting to remote repositories over HTTP(S)? </p>
<p>I've tried the <code>core.askpass</code> approach detailed in <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>git-config</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,671 | git | # Git http - securely remember credentials
Is there a way to securely let git remember my credentials when connecting to remote repositories over HTTP(S)?
I've tried the `core.askpass` approach detailed in [`git-config`](http://git-scm.com/docs/git-config) to let an external script supply my credentials. Although it ... | `git` invokes cURL when running over HTTP. You can store secure credentials by setting up a `.netrc` file in your user's home directory, and making it private to the user (0600 in Linux).
The contents of the file provide the username and password per remote domain.
```
machine myRemoteServer
login myUserName
password... |
6143872 | Git: Who has modified this line? | 67 | 2011-05-26 19:17:34 | <p>If I found a bug in my application, sometimes I need to know which commits have affected to the bug source code line. I'm wondering which is the best approach to do it with Git.</p>
| 38,938 | 299,897 | 2017-11-09 10:17:02 | 39,731,379 | 69 | 2016-09-27 17:58:59 | 2,356,383 | 2016-09-27 17:58:59 | https://stackoverflow.com/q/6143872 | https://stackoverflow.com/a/39731379 | <p>To see commits affecting line 40 of file foo:</p>
<pre><code>git blame -L 40,+1 foo
</code></pre>
<p>The +1 means exactly one line. To see changes for lines 40-60, it's:</p>
<pre><code>git blame -L 40,+21 foo
</code></pre>
<p>OR</p>
<pre><code>git blame -L 40,60 foo
</code></pre>
<p>The second number can be an... | <p>To see commits affecting line 40 of file foo:</p> <pre><code>git blame -L 40,+1 foo </code></pre> <p>The +1 means exactly one line. To see changes for lines 40-60, it's:</p> <pre><code>git blame -L 40,+21 foo </code></pre> <p>OR</p> <pre><code>git blame -L 40,60 foo </code></pre> <p>The second number can be an... | 119 | git | <h1>Git: Who has modified this line?</h1>
<p>If I found a bug in my application, sometimes I need to know which commits have affected to the bug source code line. I'm wondering which is the best approach to do it with Git.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,673 | git | # Git: Who has modified this line?
If I found a bug in my application, sometimes I need to know which commits have affected to the bug source code line. I'm wondering which is the best approach to do it with Git. | To see commits affecting line 40 of file foo:
```
git blame -L 40,+1 foo
```
The +1 means exactly one line. To see changes for lines 40-60, it's:
```
git blame -L 40,+21 foo
```
OR
```
git blame -L 40,60 foo
```
The second number can be an offset designated with a '+', or a line number. [git blame docs](https://g... |
6619883 | Cannot see new files added to my git working directory | 66 | 2011-07-08 04:10:27 | <p>git version 1.7.4.1</p>
<p>I am using git on Ubuntu.</p>
<p>I have copied some files from another directory to my git working directory. Normally would appear under <code>Untracked files</code>. However, they do not appear. So I cannot add them.</p>
<p>When I do a <code>git status</code> the new files are not sho... | 146,858 | 70,942 | 2024-03-15 12:17:27 | 6,710,893 | 69 | 2011-07-15 17:25:48 | 712,605 | 2011-07-15 17:25:48 | https://stackoverflow.com/q/6619883 | https://stackoverflow.com/a/6710893 | <p>If <code>git ls-files</code> shows <code>source.c</code>, then it must already be in the index. This means that it is already tracked, and possibly already committed. If <code>source.c</code> isn't showing up in <code>git status</code> at all, then the file must have been committed.</p>
<p>Try modifying the file ... | <p>If <code>git ls-files</code> shows <code>source.c</code>, then it must already be in the index. This means that it is already tracked, and possibly already committed. If <code>source.c</code> isn't showing up in <code>git status</code> at all, then the file must have been committed.</p> <p>Try modifying the file ... | 119 | git | <h1>Cannot see new files added to my git working directory</h1>
<p>git version 1.7.4.1</p>
<p>I am using git on Ubuntu.</p>
<p>I have copied some files from another directory to my git working directory. Normally would appear under <code>Untracked files</code>. However, they do not appear. So I cannot add them.</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,675 | git | # Cannot see new files added to my git working directory
git version 1.7.4.1
I am using git on Ubuntu.
I have copied some files from another directory to my git working directory. Normally would appear under `Untracked files`. However, they do not appear. So I cannot add them.
When I do a `git status` the new files... | If `git ls-files` shows `source.c`, then it must already be in the index. This means that it is already tracked, and possibly already committed. If `source.c` isn't showing up in `git status` at all, then the file must have been committed.
Try modifying the file to see if it shows up as modified in `git status`. To re... |
6490454 | Find commits that modify file names matching a pattern in a GIT repository | 66 | 2011-06-27 08:47:12 | <p>I'd like to find commits in my code base that add video files to throw them out.
Is there a way to look for these files in git ?</p>
<p>For example let's say all videos have a filename ending with the extension .wmv ; I'd like to find all commits introducing these files and get rid of them with a fixup or something... | 25,972 | 746,525 | 2024-04-12 11:02:26 | 6,490,484 | 69 | 2011-06-27 08:49:53 | 112,968 | 2024-04-12 11:02:26 | https://stackoverflow.com/q/6490454 | https://stackoverflow.com/a/6490484 | <p>You can use <a href="https://git-scm.com/docs/git-log" rel="nofollow noreferrer"><code>git log</code></a> with a pathspec:</p>
<pre><code>git log --all -- '*.wmv'
</code></pre>
<p>This will get you all commits which make changes to .wmv files. Yes, this will descend into subdirectories too (and you have to surround ... | <p>You can use <a href="https://git-scm.com/docs/git-log" rel="nofollow noreferrer"><code>git log</code></a> with a pathspec:</p> <pre><code>git log --all -- '*.wmv' </code></pre> <p>This will get you all commits which make changes to .wmv files. Yes, this will descend into subdirectories too (and you have to surround ... | 119, 1062, 10193 | filenames, find, git | <h1>Find commits that modify file names matching a pattern in a GIT repository</h1>
<p>I'd like to find commits in my code base that add video files to throw them out.
Is there a way to look for these files in git ?</p>
<p>For example let's say all videos have a filename ending with the extension .wmv ; I'd like to fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,676 | git | # Find commits that modify file names matching a pattern in a GIT repository
I'd like to find commits in my code base that add video files to throw them out.
Is there a way to look for these files in git ?
For example let's say all videos have a filename ending with the extension .wmv ; I'd like to find all commits i... | You can use [`git log`](https://git-scm.com/docs/git-log) with a pathspec:
```
git log --all -- '*.wmv'
```
This will get you all commits which make changes to .wmv files. Yes, this will descend into subdirectories too (and you have to surround your pathspec with single quotes to protect it from being expanded by you... |
12462481 | What is the difference between git push origin and git push origin master | 65 | 2012-09-17 15:28:24 | <p>Is there any difference in pushing the master branch of a local git repository to the master branch of a remote repository called origin with <code>git push origin master</code>
or with <code>git push origin</code>?</p>
| 110,035 | 1,675,418 | 2022-05-01 13:28:23 | 12,463,275 | 69 | 2012-09-17 16:17:45 | 1,119,701 | 2012-09-17 16:17:45 | https://stackoverflow.com/q/12462481 | https://stackoverflow.com/a/12463275 | <p>The default action of <code>git push</code> and <code>git push origin</code> has changed since <code>git</code> version <code>1.7.11</code>:</p>
<ul>
<li><p>Before <code>1.7.11</code>, <code>git push</code> by default pushes all branches that also exist remotely with the same name.</p></li>
<li><p>Since <code>1.7.1... | <p>The default action of <code>git push</code> and <code>git push origin</code> has changed since <code>git</code> version <code>1.7.11</code>:</p> <ul> <li><p>Before <code>1.7.11</code>, <code>git push</code> by default pushes all branches that also exist remotely with the same name.</p></li> <li><p>Since <code>1.7.1... | 119, 28898, 41346 | git, git-push, git-remote | <h1>What is the difference between git push origin and git push origin master</h1>
<p>Is there any difference in pushing the master branch of a local git repository to the master branch of a remote repository called origin with <code>git push origin master</code>
or with <code>git push origin</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,677 | git | # What is the difference between git push origin and git push origin master
Is there any difference in pushing the master branch of a local git repository to the master branch of a remote repository called origin with `git push origin master`
or with `git push origin`? | The default action of `git push` and `git push origin` has changed since `git` version `1.7.11`:
- Before `1.7.11`, `git push` by default pushes all branches that also exist remotely with the same name.
- Since `1.7.11`, `git push` by default pushes the current branch to a remote branch with the same name.
Before and... |
47401843 | git copy file, as opposed to `git mv` | 63 | 2017-11-20 22:01:35 | <p>I realize that git works by diff'ing the contents of files. I have some files that I want to copy. To absolutely prevent git from ever getting confused, is there some git command that can be used to copy the files to a different directory (not mv, but cp), and stage the files as well?</p>
| 65,296 | 1,223,975 | 2023-04-05 18:37:30 | 47,402,413 | 69 | 2017-11-20 22:47:16 | 1,256,452 | 2017-11-20 23:08:00 | https://stackoverflow.com/q/47401843 | https://stackoverflow.com/a/47402413 | <p>The short answer is just "no". But there is more to know; it just requires some background. (And as <a href="https://stackoverflow.com/questions/47401843/git-copy-file-as-opposed-to-git-mv/47402413?noredirect=1#comment81758637_47402413">JDB suggests in a comment</a>, I'll mention why <code>git mv</code> exists as ... | <p>The short answer is just "no". But there is more to know; it just requires some background. (And as <a href="https://stackoverflow.com/questions/47401843/git-copy-file-as-opposed-to-git-mv/47402413?noredirect=1#comment81758637_47402413">JDB suggests in a comment</a>, I'll mention why <code>git mv</code> exists as ... | 119, 25299, 112902 | cp, git, git-mv | <h1>git copy file, as opposed to `git mv`</h1>
<p>I realize that git works by diff'ing the contents of files. I have some files that I want to copy. To absolutely prevent git from ever getting confused, is there some git command that can be used to copy the files to a different directory (not mv, but cp), and stage the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,678 | git | # git copy file, as opposed to `git mv`
I realize that git works by diff'ing the contents of files. I have some files that I want to copy. To absolutely prevent git from ever getting confused, is there some git command that can be used to copy the files to a different directory (not mv, but cp), and stage the files as... | The short answer is just "no". But there is more to know; it just requires some background. (And as [JDB suggests in a comment](https://stackoverflow.com/questions/47401843/git-copy-file-as-opposed-to-git-mv/47402413?noredirect=1#comment81758637_47402413), I'll mention why `git mv` exists as a convenience.)
Slightly l... |
642264 | Undo change in git (not rewriting history) | 50 | 2009-03-13 11:32:39 | <p>I made a change in a script and committed it. Then I made a few other changes, and pushed them to a remote repository and such.</p>
<p>Then I realised that first change I mentioned was stupid, and want to undo it.. Can I "unapply" that commit, without manually copy/pasting the diff?</p>
<p>As an example: I have tw... | 31,191 | 745 | 2022-01-16 02:21:57 | 642,286 | 69 | 2009-03-13 11:40:17 | 3,737 | 2022-01-16 02:21:57 | https://stackoverflow.com/q/642264 | https://stackoverflow.com/a/642286 | <p>Yes, you can use <em>git revert</em> for this. See the <a href="https://git-scm.com/docs/user-manual#reverting-a-commit" rel="nofollow noreferrer">git manual section on this</a> for more information.</p>
<p>The gist is that you can say:</p>
<pre><code>git revert 4f4k2a
</code></pre>
<p>Where 4f4k2a is the id of the ... | <p>Yes, you can use <em>git revert</em> for this. See the <a href="https://git-scm.com/docs/user-manual#reverting-a-commit" rel="nofollow noreferrer">git manual section on this</a> for more information.</p> <p>The gist is that you can say:</p> <pre><code>git revert 4f4k2a </code></pre> <p>Where 4f4k2a is the id of the ... | 119, 34403 | git, git-revert | <h1>Undo change in git (not rewriting history)</h1>
<p>I made a change in a script and committed it. Then I made a few other changes, and pushed them to a remote repository and such.</p>
<p>Then I realised that first change I mentioned was stupid, and want to undo it.. Can I "unapply" that commit, without manually cop... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,680 | git | # Undo change in git (not rewriting history)
I made a change in a script and committed it. Then I made a few other changes, and pushed them to a remote repository and such.
Then I realised that first change I mentioned was stupid, and want to undo it.. Can I "unapply" that commit, without manually copy/pasting the di... | Yes, you can use *git revert* for this. See the [git manual section on this](https://git-scm.com/docs/user-manual#reverting-a-commit) for more information.
The gist is that you can say:
```
git revert 4f4k2a
```
Where 4f4k2a is the id of the commit you'd like to undo, and it will try to undo it. |
14585692 | How to use git-svn to checkout only trunk and not branches and tags? | 49 | 2013-01-29 14:52:45 | <p>I'm working on a Java legacy project which has 20 modules connected to each other. So, each module has it's own branch and tag. The structure is like this: </p>
<pre>
<code>
/projects
.svn
- module1
.svn
-trunk
-branch
-tag
- module2
.svn
-trunk
-branch
... | 48,280 | 635,162 | 2018-05-16 07:10:17 | 14,600,801 | 69 | 2013-01-30 09:43:04 | 220,155 | 2013-01-30 10:23:50 | https://stackoverflow.com/q/14585692 | https://stackoverflow.com/a/14600801 | <p><strong>Edit</strong>: I misread the question and answered what I thought you were asking, not what you actually asked.</p>
<h3>To clone just the trunk</h3>
<p>Cloning a single Subversion directory is easy, and it actually doesn't matter which directory you clone. Just don't specify any of the "layout" arguments, ... | <p><strong>Edit</strong>: I misread the question and answered what I thought you were asking, not what you actually asked.</p> <h3>To clone just the trunk</h3> <p>Cloning a single Subversion directory is easy, and it actually doesn't matter which directory you clone. Just don't specify any of the "layout" arguments, ... | 63, 119, 6452 | git, git-svn, svn | <h1>How to use git-svn to checkout only trunk and not branches and tags?</h1>
<p>I'm working on a Java legacy project which has 20 modules connected to each other. So, each module has it's own branch and tag. The structure is like this: </p>
<pre>
<code>
/projects
.svn
- module1
.svn
-trunk
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,681 | git | # How to use git-svn to checkout only trunk and not branches and tags?
I'm working on a Java legacy project which has 20 modules connected to each other. So, each module has it's own branch and tag. The structure is like this:
```
/projects
.svn
- module1
.svn
-trunk
-branch
-tag
... | **Edit**: I misread the question and answered what I thought you were asking, not what you actually asked.
### To clone just the trunk
Cloning a single Subversion directory is easy, and it actually doesn't matter which directory you clone. Just don't specify any of the "layout" arguments, and give the path to the tru... |
3156744 | Git svn rebase : checksum mismatch | 48 | 2010-07-01 10:01:33 | <p>I have a problem when I try to do a git svn rebase on my repository. It displays :</p>
<pre><code>Checksum mismatch: code/app/meta_appli/app_info.py
expected: d9cefed5d1a630273aa3742f7f414c83
got: 4eb5f3506698bdcb64347b5237ada19f
</code></pre>
<p>I searched a lot but haven't found a way to solve this problem.... | 12,862 | 119,190 | 2019-11-06 13:36:12 | 8,418,829 | 69 | 2011-12-07 16:28:39 | 3,191 | 2011-12-07 16:28:39 | https://stackoverflow.com/q/3156744 | https://stackoverflow.com/a/8418829 | <p><a href="http://www.victoriakirst.com/?p=903" rel="noreferrer">This solution</a> was the only one that worked for me:</p>
<blockquote>
<p>See what was the revision number of the last change on the file:</p>
<p><code>git svn log chrome/test/functional/search_engines.py</code></p>
<p>Reset svn to be close... | <p><a href="http://www.victoriakirst.com/?p=903" rel="noreferrer">This solution</a> was the only one that worked for me:</p> <blockquote> <p>See what was the revision number of the last change on the file:</p> <p><code>git svn log chrome/test/functional/search_engines.py</code></p> <p>Reset svn to be close... | 63, 119, 6452 | git, git-svn, svn | <h1>Git svn rebase : checksum mismatch</h1>
<p>I have a problem when I try to do a git svn rebase on my repository. It displays :</p>
<pre><code>Checksum mismatch: code/app/meta_appli/app_info.py
expected: d9cefed5d1a630273aa3742f7f414c83
got: 4eb5f3506698bdcb64347b5237ada19f
</code></pre>
<p>I searched a lot bu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,682 | git | # Git svn rebase : checksum mismatch
I have a problem when I try to do a git svn rebase on my repository. It displays :
```
Checksum mismatch: code/app/meta_appli/app_info.py
expected: d9cefed5d1a630273aa3742f7f414c83
got: 4eb5f3506698bdcb64347b5237ada19f
```
I searched a lot but haven't found a way to solve th... | [This solution](http://www.victoriakirst.com/?p=903) was the only one that worked for me:
> See what was the revision number of the last change on the file:
>
> `git svn log chrome/test/functional/search_engines.py`
>
> Reset svn to be closest parent before that revision:
>
> `git svn reset -r62248 -p`
>
> Do a `git s... |
18874281 | How to retain commit gpg-signature after interactive rebase squashing? | 42 | 2013-09-18 14:00:00 | <p>When I want to squash some commits by interactive <code>rebase</code>:</p>
<pre><code>git rebase -i HEAD~3
</code></pre>
<p>And then:</p>
<pre><code>pick cbd03e3 Final commit (signed)
s f522f5d bla-bla-bla (signed)
s 09a7b7c bla-bla (signed)
# Rebase c2e142e..09a7b7c onto c2e142e
...
</code></pre>
<p>The final ... | 20,952 | 2,648,942 | 2023-08-31 15:37:17 | 29,263,454 | 69 | 2015-03-25 18:18:15 | 1,785,834 | 2015-03-25 18:18:15 | https://stackoverflow.com/q/18874281 | https://stackoverflow.com/a/29263454 | <p>Like Cupcake stated, you can't retain the old signature from the unsquashed commits, but you <em>can</em> sign the new squashed commit if you rebase like this:</p>
<p><code>git rebase --interactive --gpg-sign=myemail@example.com HEAD~4</code></p>
<p>Adding <code>--gpg-sign=myemail@example.com</code> as an argument... | <p>Like Cupcake stated, you can't retain the old signature from the unsquashed commits, but you <em>can</em> sign the new squashed commit if you rebase like this:</p> <p><code>git rebase --interactive --gpg-sign=myemail@example.com HEAD~4</code></p> <p>Adding <code>--gpg-sign=myemail@example.com</code> as an argument... | 119, 456, 6735, 29934 | git, git-rebase, gnupg, version-control | <h1>How to retain commit gpg-signature after interactive rebase squashing?</h1>
<p>When I want to squash some commits by interactive <code>rebase</code>:</p>
<pre><code>git rebase -i HEAD~3
</code></pre>
<p>And then:</p>
<pre><code>pick cbd03e3 Final commit (signed)
s f522f5d bla-bla-bla (signed)
s 09a7b7c bla-bla (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,685 | git | # How to retain commit gpg-signature after interactive rebase squashing?
When I want to squash some commits by interactive `rebase`:
```
git rebase -i HEAD~3
```
And then:
```
pick cbd03e3 Final commit (signed)
s f522f5d bla-bla-bla (signed)
s 09a7b7c bla-bla (signed)
# Rebase c2e142e..09a7b7c onto c2e142e
...
```... | Like Cupcake stated, you can't retain the old signature from the unsquashed commits, but you *can* sign the new squashed commit if you rebase like this:
`git rebase --interactive --gpg-sign=myemail@example.com HEAD~4`
Adding `--gpg-sign=myemail@example.com` as an argument will sign the final squashed commit. |
19705313 | git rebase: copy instead of moving | 42 | 2013-10-31 11:28:57 | <p>My branches are:</p>
<pre><code>o---o support.2013.16
\
o---o---o---o---o master
\
o---o---o hotfix/A
</code></pre>
<p>I need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible to do something like</p>
<pre><code>git re... | 10,451 | 618,020 | 2018-11-29 22:33:53 | 19,705,736 | 69 | 2013-10-31 11:50:14 | 908,269 | 2013-10-31 11:50:14 | https://stackoverflow.com/q/19705313 | https://stackoverflow.com/a/19705736 | <p>Git <code>rebase</code> really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used <code>git branch</code> to add an additional branch head to the original branch, you would still have easy access to the original branch after <code>g... | <p>Git <code>rebase</code> really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used <code>git branch</code> to add an additional branch head to the original branch, you would still have easy access to the original branch after <code>g... | 119, 8974 | git, rebase | <h1>git rebase: copy instead of moving</h1>
<p>My branches are:</p>
<pre><code>o---o support.2013.16
\
o---o---o---o---o master
\
o---o---o hotfix/A
</code></pre>
<p>I need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,686 | git | # git rebase: copy instead of moving
My branches are:
```
o---o support.2013.16
\
o---o---o---o---o master
\
o---o---o hotfix/A
```
I need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible to do something like
```
git re... | Git `rebase` really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used `git branch` to add an additional branch head to the original branch, you would still have easy access to the original branch after `git rebase` had made the rebased... |
12845507 | Git confusion - how to revert local changes to latest remote push? | 42 | 2012-10-11 17:46:11 | <p>I have a local git repository, but things get wrong and complicated and I simply want to overwrite all the files in my local directory with the latest version of what is on the remote repository. This would be like a clone, but for an already setup local git repository.</p>
<p>For example: if use <code>git pull</co... | 34,524 | 1,738,984 | 2012-10-11 20:30:56 | 12,845,541 | 69 | 2012-10-11 17:48:04 | 7,230 | 2012-10-11 17:48:04 | https://stackoverflow.com/q/12845507 | https://stackoverflow.com/a/12845541 | <p>You probably want to use <code>git reset</code>. Assuming you have done a <code>git fetch</code> recently, the following will discard everything in your local and reset it to the point you specify as the final argument (in this case the current HEAD of the <code>origin/master</code> remote tracking branch):</p>
<p... | <p>You probably want to use <code>git reset</code>. Assuming you have done a <code>git fetch</code> recently, the following will discard everything in your local and reset it to the point you specify as the final argument (in this case the current HEAD of the <code>origin/master</code> remote tracking branch):</p> <p... | 119, 34403 | git, git-revert | <h1>Git confusion - how to revert local changes to latest remote push?</h1>
<p>I have a local git repository, but things get wrong and complicated and I simply want to overwrite all the files in my local directory with the latest version of what is on the remote repository. This would be like a clone, but for an alread... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,687 | git | # Git confusion - how to revert local changes to latest remote push?
I have a local git repository, but things get wrong and complicated and I simply want to overwrite all the files in my local directory with the latest version of what is on the remote repository. This would be like a clone, but for an already setup l... | You probably want to use `git reset`. Assuming you have done a `git fetch` recently, the following will discard everything in your local and reset it to the point you specify as the final argument (in this case the current HEAD of the `origin/master` remote tracking branch):
```
$ git reset --hard origin/master
``` |
6128131 | Git - easiest way to see diff with previous version if I have the sha | 42 | 2011-05-25 17:01:19 | <p>A colleague of mine checked in some changes to Git, and I want to see exactly what those changes were. In other words, the diff between his check-in and its parent.</p>
<p>What seemed logical to me was to run this command:</p>
<pre><code>git diff shaOfHisCheckIn
</code></pre>
<p>But this didn't work. It appears to... | 32,287 | 5,486 | 2025-07-31 08:17:08 | 6,128,188 | 69 | 2011-05-25 17:05:45 | 263,871 | 2011-05-25 17:11:24 | https://stackoverflow.com/q/6128131 | https://stackoverflow.com/a/6128188 | <p><code>git show</code> is your friend:</p>
<pre><code>git show shaOfHisCheckIn
</code></pre>
| <p><code>git show</code> is your friend:</p> <pre><code>git show shaOfHisCheckIn </code></pre> | 119, 9033 | git, git-diff | <h1>Git - easiest way to see diff with previous version if I have the sha</h1>
<p>A colleague of mine checked in some changes to Git, and I want to see exactly what those changes were. In other words, the diff between his check-in and its parent.</p>
<p>What seemed logical to me was to run this command:</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,688 | git | # Git - easiest way to see diff with previous version if I have the sha
A colleague of mine checked in some changes to Git, and I want to see exactly what those changes were. In other words, the diff between his check-in and its parent.
What seemed logical to me was to run this command:
```
git diff shaOfHisCheckIn
... | `git show` is your friend:
```
git show shaOfHisCheckIn
``` |
50992188 | How to push a shallow clone to a new repo? | 34 | 2018-06-22 16:32:21 | <p>I wish to get rid of a lot of my repo's old history, so I did a shallow clone to get the last 50 commits only:</p>
<pre><code>git clone --depth=50 https://my.repo
</code></pre>
<p>That worked OK, but when I create a new Gitlab repo and try to push it I get an error:</p>
<pre><code>git remote remove origin
git rem... | 24,000 | 178,757 | 2023-10-18 12:41:27 | 50,996,201 | 69 | 2018-06-22 22:14:48 | 178,757 | 2018-06-29 11:06:51 | https://stackoverflow.com/q/50992188 | https://stackoverflow.com/a/50996201 | <p>Here's what I ended up doing - it worked perfectly. Note that I was moving from my old host (Bitbucket) to my new one (Gitlab). My comments are above the commands:</p>
<pre><code># First, shallow-clone the old repo to the depth we want to keep
git clone --depth=50 https://...@bitbucket.org/....git
# Go into the ... | <p>Here's what I ended up doing - it worked perfectly. Note that I was moving from my old host (Bitbucket) to my new one (Gitlab). My comments are above the commands:</p> <pre><code># First, shallow-clone the old repo to the depth we want to keep git clone --depth=50 https://...@bitbucket.org/....git # Go into the ... | 119 | git | <h1>How to push a shallow clone to a new repo?</h1>
<p>I wish to get rid of a lot of my repo's old history, so I did a shallow clone to get the last 50 commits only:</p>
<pre><code>git clone --depth=50 https://my.repo
</code></pre>
<p>That worked OK, but when I create a new Gitlab repo and try to push it I get an err... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,690 | git | # How to push a shallow clone to a new repo?
I wish to get rid of a lot of my repo's old history, so I did a shallow clone to get the last 50 commits only:
```
git clone --depth=50 https://my.repo
```
That worked OK, but when I create a new Gitlab repo and try to push it I get an error:
```
git remote remove origin... | Here's what I ended up doing - it worked perfectly. Note that I was moving from my old host (Bitbucket) to my new one (Gitlab). My comments are above the commands:
```
# First, shallow-clone the old repo to the depth we want to keep
git clone --depth=50 https://...@bitbucket.org/....git
# Go into the directory of the... |
8085838 | How to move the changes from one branch to another branch git? | 129 | 2011-11-10 20:28:02 | <p>How can I move my work and changes from the <code>master</code> branch to a newly created branch and leave the master branch intact after the move?</p>
| 178,987 | 226,473 | 2024-09-11 18:53:36 | 8,085,875 | 68 | 2011-11-10 20:31:05 | 216,074 | 2011-11-10 20:31:05 | https://stackoverflow.com/q/8085838 | https://stackoverflow.com/a/8085875 | <p>You can create a new branch pointing to the <em>current</em> commit using <code>git branch branchname</code> (or <code>git checkout -b branchname</code> if you want to check it out directly). This will basically duplicate your master branch, so you can continue working on there.</p>
<p>If you have successfully copi... | <p>You can create a new branch pointing to the <em>current</em> commit using <code>git branch branchname</code> (or <code>git checkout -b branchname</code> if you want to check it out directly). This will basically duplicate your master branch, so you can continue working on there.</p> <p>If you have successfully copi... | 119 | git | <h1>How to move the changes from one branch to another branch git?</h1>
<p>How can I move my work and changes from the <code>master</code> branch to a newly created branch and leave the master branch intact after the move?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,694 | git | # How to move the changes from one branch to another branch git?
How can I move my work and changes from the `master` branch to a newly created branch and leave the master branch intact after the move? | You can create a new branch pointing to the *current* commit using `git branch branchname` (or `git checkout -b branchname` if you want to check it out directly). This will basically duplicate your master branch, so you can continue working on there.
If you have successfully copied the branch, you can reset `master` t... |
7199659 | How to rename git root folder? | 119 | 2011-08-26 03:15:20 | <p>I've just started using git in Vista, with my repository under <code>/path/to/project/git repo</code>.</p>
<p>I've now found that the space in the folder name is a minor irritation when working in git bash.</p>
<p>Can I just rename the folder to <code>/path/to/project/gitrepo</code>? Is everything within the git c... | 61,652 | 640,251 | 2022-07-13 18:55:43 | 7,200,624 | 68 | 2011-08-26 06:07:52 | 6,309 | 2011-08-26 06:07:52 | https://stackoverflow.com/q/7199659 | https://stackoverflow.com/a/7200624 | <p>To amend slightly <a href="https://stackoverflow.com/users/893/greg-hewgill">Greg</a>'s <a href="https://stackoverflow.com/questions/7199659/rename-git-root-folder/7199670#7199670">answer</a>, yes, everything with a git repo is relative to the <code>.git</code> parent directory, but:</p>
<p>(and this won't probably... | <p>To amend slightly <a href="https://stackoverflow.com/users/893/greg-hewgill">Greg</a>'s <a href="https://stackoverflow.com/questions/7199659/rename-git-root-folder/7199670#7199670">answer</a>, yes, everything with a git repo is relative to the <code>.git</code> parent directory, but:</p> <p>(and this won't probably... | 119, 218, 4510 | directory, git, rename | <h1>How to rename git root folder?</h1>
<p>I've just started using git in Vista, with my repository under <code>/path/to/project/git repo</code>.</p>
<p>I've now found that the space in the folder name is a minor irritation when working in git bash.</p>
<p>Can I just rename the folder to <code>/path/to/project/gitrep... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,695 | git | # How to rename git root folder?
I've just started using git in Vista, with my repository under `/path/to/project/git repo`.
I've now found that the space in the folder name is a minor irritation when working in git bash.
Can I just rename the folder to `/path/to/project/gitrepo`? Is everything within the git config... | To amend slightly [Greg](https://stackoverflow.com/users/893/greg-hewgill)'s [answer](https://stackoverflow.com/questions/7199659/rename-git-root-folder/7199670#7199670), yes, everything with a git repo is relative to the `.git` parent directory, but:
(and this won't probably affect you directly, I only mention those ... |
29810331 | Is there a quick way to "git diff" from the point or branch origin? | 114 | 2015-04-22 22:48:15 | <p>I have looked at various SO answers on using <code>git diff</code> and git revisions (HEAD, ORIG_HEAD, FETCH_HEAD, etc.) and I still haven't found an easy way to list the changes have been made since the beginning of the local branch, or since last rebase.</p>
<p>By <em>easy</em> I mean without having to look up an... | 59,129 | 776,686 | 2022-04-07 09:06:14 | 29,810,438 | 68 | 2015-04-22 22:57:42 | 1,405,588 | 2016-07-08 20:57:18 | https://stackoverflow.com/q/29810331 | https://stackoverflow.com/a/29810438 | <p>Use <code>git diff @{u}...HEAD</code>, with three dots.</p>
<p>With two dots, or with <code>HEAD</code> omitted, it will show diffs from changes on both sides.</p>
<p>With three dots, it will only show diffs from changes on your side.</p>
<p>Edit: for people with slightly different needs, you might be interested ... | <p>Use <code>git diff @{u}...HEAD</code>, with three dots.</p> <p>With two dots, or with <code>HEAD</code> omitted, it will show diffs from changes on both sides.</p> <p>With three dots, it will only show diffs from changes on your side.</p> <p>Edit: for people with slightly different needs, you might be interested ... | 119, 9033 | git, git-diff | <h1>Is there a quick way to "git diff" from the point or branch origin?</h1>
<p>I have looked at various SO answers on using <code>git diff</code> and git revisions (HEAD, ORIG_HEAD, FETCH_HEAD, etc.) and I still haven't found an easy way to list the changes have been made since the beginning of the local branch, or si... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,697 | git | # Is there a quick way to "git diff" from the point or branch origin?
I have looked at various SO answers on using `git diff` and git revisions (HEAD, ORIG_HEAD, FETCH_HEAD, etc.) and I still haven't found an easy way to list the changes have been made since the beginning of the local branch, or since last rebase.
By... | Use `git diff @{u}...HEAD`, with three dots.
With two dots, or with `HEAD` omitted, it will show diffs from changes on both sides.
With three dots, it will only show diffs from changes on your side.
Edit: for people with slightly different needs, you might be interested in `git merge-base` (note that it has plenty m... |
34265266 | ! [remote rejected] errors after mirroring a git repository | 75 | 2015-12-14 10:57:43 | <p>I'm following this documentation:
<a href="https://help.github.com/articles/duplicating-a-repository/">https://help.github.com/articles/duplicating-a-repository/</a></p>
<pre><code>git clone --mirror https://github.com/exampleuser/repository-to-mirror.git
cd repository-to-mirror.git
git push --mirror https://gith... | 99,055 | 3,323,914 | 2025-05-25 22:32:12 | 34,266,401 | 68 | 2015-12-14 11:54:11 | 6,309 | 2023-06-03 21:43:00 | https://stackoverflow.com/q/34265266 | https://stackoverflow.com/a/34266401 | <p>As mentioned in <a href="https://github.com/rtyley/bfg-repo-cleaner/issues/36#issuecomment-37877829" rel="noreferrer">this issue</a>, that happens when you mirror a GitHub repo which has <strong>pull requests</strong> made to it.</p>
<blockquote>
<p>The refs beginning '<strong><code>refs/pull</code></strong>' are sy... | <p>As mentioned in <a href="https://github.com/rtyley/bfg-repo-cleaner/issues/36#issuecomment-37877829" rel="noreferrer">this issue</a>, that happens when you mirror a GitHub repo which has <strong>pull requests</strong> made to it.</p> <blockquote> <p>The refs beginning '<strong><code>refs/pull</code></strong>' are sy... | 119, 7330, 7620 | git, mirror, repository | <h1>! [remote rejected] errors after mirroring a git repository</h1>
<p>I'm following this documentation:
<a href="https://help.github.com/articles/duplicating-a-repository/">https://help.github.com/articles/duplicating-a-repository/</a></p>
<pre><code>git clone --mirror https://github.com/exampleuser/repository-to-mi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,699 | git | # ! [remote rejected] errors after mirroring a git repository
I'm following this documentation:
<https://help.github.com/articles/duplicating-a-repository/>
```
git clone --mirror https://github.com/exampleuser/repository-to-mirror.git
cd repository-to-mirror.git
git push --mirror https://github.com/exampleuser/mir... | As mentioned in [this issue](https://github.com/rtyley/bfg-repo-cleaner/issues/36#issuecomment-37877829), that happens when you mirror a GitHub repo which has **pull requests** made to it.
> The refs beginning '**`refs/pull`**' are synthetic read-only refs created by GitHub - you can't update (and therefore 'clean') t... |
18482976 | Tell Sublime Text to ignore everything in .gitignore? | 66 | 2013-08-28 08:31:28 | <p>Vim has this <a href="http://www.vim.org/scripts/script.php?script_id=2557" rel="noreferrer">great plugin</a> to convert the current project's <code>.gitignore</code> into a syntax understandable by Vim and from there exclude all those files from opening.</p>
<p>Using Sublime Text 3's 'Go to Anything' (CMD+P), I ge... | 19,864 | 243,157 | 2022-11-22 17:58:54 | 26,372,261 | 68 | 2014-10-14 23:47:04 | 1,709,587 | 2019-01-08 16:57:42 | https://stackoverflow.com/q/18482976 | https://stackoverflow.com/a/26372261 | <p>I created a quick-and-dirty plugin, <a href="https://github.com/ExplodingCabbage/sublime-gitignorer" rel="noreferrer">sublime-gitignorer</a>, to solve exactly this problem.</p>
<p>It is currently tested on Ubuntu and Windows in Sublime Text 2 and 3. I expect it will also work on any other Linux distro or on Mac.</p... | <p>I created a quick-and-dirty plugin, <a href="https://github.com/ExplodingCabbage/sublime-gitignorer" rel="noreferrer">sublime-gitignorer</a>, to solve exactly this problem.</p> <p>It is currently tested on Ubuntu and Windows in Sublime Text 2 and 3. I expect it will also work on any other Linux distro or on Mac.</p... | 25056, 72788, 88190 | gitignore, sublimetext, sublimetext3 | <h1>Tell Sublime Text to ignore everything in .gitignore?</h1>
<p>Vim has this <a href="http://www.vim.org/scripts/script.php?script_id=2557" rel="noreferrer">great plugin</a> to convert the current project's <code>.gitignore</code> into a syntax understandable by Vim and from there exclude all those files from opening... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,700 | git | # Tell Sublime Text to ignore everything in .gitignore?
Vim has this [great plugin](http://www.vim.org/scripts/script.php?script_id=2557) to convert the current project's `.gitignore` into a syntax understandable by Vim and from there exclude all those files from opening.
Using Sublime Text 3's 'Go to Anything' (CMD+... | I created a quick-and-dirty plugin, [sublime-gitignorer](https://github.com/ExplodingCabbage/sublime-gitignorer), to solve exactly this problem.
It is currently tested on Ubuntu and Windows in Sublime Text 2 and 3. I expect it will also work on any other Linux distro or on Mac.
---
**To install, assuming you have [p... |
34597186 | Use a different user.email and user.name for Git config based upon remote clone URL | 65 | 2016-01-04 18:10:12 | <p>I configure my global <code>~/.gitconfig</code> properties <code>user.name</code> and <code>user.email</code> like this:</p>
<p></p>
<pre><code>git config --global user.email "mkobit@example.com"
git config --global user.name "mkobit"
</code></pre>
<p>This is the default configuration I want for working on perso... | 15,966 | 627,727 | 2025-12-09 19:39:03 | 36,296,990 | 68 | 2016-03-29 23:32:53 | 627,727 | 2017-08-04 11:41:09 | https://stackoverflow.com/q/34597186 | https://stackoverflow.com/a/36296990 | <p>The release of <a href="https://github.com/blog/2360-git-2-13-has-been-released" rel="noreferrer">Git 2.13</a> has introduced a feature called <em>conditional includes</em>. In 2.13 the only supported configuration is filesystem path. That is easy to use in this case because I am already separating them. </p>
<p>Th... | <p>The release of <a href="https://github.com/blog/2360-git-2-13-has-been-released" rel="noreferrer">Git 2.13</a> has introduced a feature called <em>conditional includes</em>. In 2.13 the only supported configuration is filesystem path. That is easy to use in this case because I am already separating them. </p> <p>Th... | 119 | git | <h1>Use a different user.email and user.name for Git config based upon remote clone URL</h1>
<p>I configure my global <code>~/.gitconfig</code> properties <code>user.name</code> and <code>user.email</code> like this:</p>
<p></p>
<pre><code>git config --global user.email "mkobit@example.com"
git config --global user.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,701 | git | # Use a different user.email and user.name for Git config based upon remote clone URL
I configure my global `~/.gitconfig` properties `user.name` and `user.email` like this:
```
git config --global user.email "mkobit@example.com"
git config --global user.name "mkobit"
```
This is the default configuration I want fo... | The release of [Git 2.13](https://github.com/blog/2360-git-2-13-has-been-released) has introduced a feature called *conditional includes*. In 2.13 the only supported configuration is filesystem path. That is easy to use in this case because I am already separating them.
The example provided on the release notes is:
>... |
15602037 | git rebase upstream/master vs git pull --rebase upstream master | 64 | 2013-03-24 18:01:28 | <p>Is there a difference between <code>git rebase upstream/master</code> and <code>git pull --rebase upstream master</code>, and if so, what? The remote could be any remote, not necessarily upstream.</p>
| 85,348 | 72,321 | 2015-03-17 18:53:53 | 15,602,072 | 68 | 2013-03-24 18:04:15 | 6,309 | 2015-03-17 18:53:53 | https://stackoverflow.com/q/15602037 | https://stackoverflow.com/a/15602072 | <p>The <code>git pull --rebase</code> will <a href="http://git-scm.com/docs/git-fetch" rel="noreferrer">fetch (<code>git fetch</code>)</a> first, updating <code>upstream/master</code> commits.</p>
<p>If you just rebase <em>without</em> first updating <code>upstream/master</code>, you won't get the same result.</p>
<p>I... | <p>The <code>git pull --rebase</code> will <a href="http://git-scm.com/docs/git-fetch" rel="noreferrer">fetch (<code>git fetch</code>)</a> first, updating <code>upstream/master</code> commits.</p> <p>If you just rebase <em>without</em> first updating <code>upstream/master</code>, you won't get the same result.</p> <p>I... | 119, 28896, 29934 | git, git-pull, git-rebase | <h1>git rebase upstream/master vs git pull --rebase upstream master</h1>
<p>Is there a difference between <code>git rebase upstream/master</code> and <code>git pull --rebase upstream master</code>, and if so, what? The remote could be any remote, not necessarily upstream.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,702 | git | # git rebase upstream/master vs git pull --rebase upstream master
Is there a difference between `git rebase upstream/master` and `git pull --rebase upstream master`, and if so, what? The remote could be any remote, not necessarily upstream. | The `git pull --rebase` will [fetch (`git fetch`)](http://git-scm.com/docs/git-fetch) first, updating `upstream/master` commits.
If you just rebase *without* first updating `upstream/master`, you won't get the same result.
I illustrate it in "[`master` branch and '`origin/master`' have diverged, how to 'undiverge' br... |
32927154 | Delete a remote branch with the same name as tag | 58 | 2015-10-03 20:26:57 | <p>I have a branch and a tag by the name <code>3.0.0</code>. Now how do i only delete the branch not the tag.</p>
<p>I tried </p>
<pre><code>git push origin --delete 3.0.0
error: dst refspec 3.0.0 matches more than one.
</code></pre>
| 9,495 | 406,659 | 2024-03-19 19:38:33 | 32,927,175 | 68 | 2015-10-03 20:29:49 | 6,309 | 2024-03-19 19:38:33 | https://stackoverflow.com/q/32927154 | https://stackoverflow.com/a/32927175 | <p>You can push the full <em>branch</em> <a href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec#_deleting_references" rel="nofollow noreferrer">refspec</a>:</p>
<pre><code>git push origin :refs/heads/3.0.0
# shorter:
git push origin :heads/3.0.0
git push --delete refs/heads/3.0.0
# shorter
git push -d refs/... | <p>You can push the full <em>branch</em> <a href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec#_deleting_references" rel="nofollow noreferrer">refspec</a>:</p> <pre><code>git push origin :refs/heads/3.0.0 # shorter: git push origin :heads/3.0.0 git push --delete refs/heads/3.0.0 # shorter git push -d refs/... | 119 | git | <h1>Delete a remote branch with the same name as tag</h1>
<p>I have a branch and a tag by the name <code>3.0.0</code>. Now how do i only delete the branch not the tag.</p>
<p>I tried </p>
<pre><code>git push origin --delete 3.0.0
error: dst refspec 3.0.0 matches more than one.
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,704 | git | # Delete a remote branch with the same name as tag
I have a branch and a tag by the name `3.0.0`. Now how do i only delete the branch not the tag.
I tried
```
git push origin --delete 3.0.0
error: dst refspec 3.0.0 matches more than one.
``` | You can push the full *branch* [refspec](https://git-scm.com/book/en/v2/Git-Internals-The-Refspec#_deleting_references):
```
git push origin :refs/heads/3.0.0
# shorter:
git push origin :heads/3.0.0
git push --delete refs/heads/3.0.0
# shorter
git push -d refs/heads/3.0.0
```
That would reference only a branch, not ... |
24916186 | How to do 'git checkout --theirs' for multiple files (or all unmerged files) | 58 | 2014-07-23 16:38:36 | <p>Say I have this after attempting a merge and upon entering <code>git status</code>:</p>
<pre><code># Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# added by them: myfile1.xhtml
# added by them: myfile2.xhtml
# added by them: myfile3.xhtml
</code></pre>
<p>... and... | 69,628 | 1,264,804 | 2024-01-31 14:07:48 | 27,622,128 | 68 | 2014-12-23 14:14:50 | 1,264,804 | 2021-04-07 14:29:28 | https://stackoverflow.com/q/24916186 | https://stackoverflow.com/a/27622128 | <p>The solution for my case ended up being to simply use a wildcard in the directory path, since the files were grouped:</p>
<pre><code>git checkout --theirs directory_name/*
git add directory_name/*
</code></pre>
<p>This may also work, according to <a href="https://stackoverflow.com/users/177789/helios456">helios456</... | <p>The solution for my case ended up being to simply use a wildcard in the directory path, since the files were grouped:</p> <pre><code>git checkout --theirs directory_name/* git add directory_name/* </code></pre> <p>This may also work, according to <a href="https://stackoverflow.com/users/177789/helios456">helios456</... | 119, 34792, 37230 | git, git-add, git-checkout | <h1>How to do 'git checkout --theirs' for multiple files (or all unmerged files)</h1>
<p>Say I have this after attempting a merge and upon entering <code>git status</code>:</p>
<pre><code># Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# added by them: myfile1.xhtml
# a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,705 | git | # How to do 'git checkout --theirs' for multiple files (or all unmerged files)
Say I have this after attempting a merge and upon entering `git status`:
```
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# added by them: myfile1.xhtml
# added by them: myfile2.xhtml
# added... | The solution for my case ended up being to simply use a wildcard in the directory path, since the files were grouped:
```
git checkout --theirs directory_name/*
git add directory_name/*
```
This may also work, according to [helios456](https://stackoverflow.com/users/177789/helios456):
```
git checkout --theirs direc... |
16059771 | Reverse Apply a commit to working copy | 56 | 2013-04-17 12:16:52 | <p>In order to investigate the effect introduced by a previous commit, I want to reverse- apply it to my working copy and fiddle around with the code. </p>
<p>I managed with a workflow around creating and applying a patch, but wonder if this can be done easier.</p>
<pre><code>git checkout -b "tmp-fiddle"
git diff -R ... | 17,394 | 73,673 | 2021-10-30 19:26:07 | 16,059,902 | 68 | 2013-04-17 12:22:28 | 31,582 | 2013-04-17 12:22:28 | https://stackoverflow.com/q/16059771 | https://stackoverflow.com/a/16059902 | <p>How about <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer"><code>git revert -n</code></a>?</p>
<blockquote>
<pre><code>-n
--no-commit
</code></pre>
<p>Usually the command automatically creates some commits with commit log messages stating which commits were reverted. ... | <p>How about <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer"><code>git revert -n</code></a>?</p> <blockquote> <pre><code>-n --no-commit </code></pre> <p>Usually the command automatically creates some commits with commit log messages stating which commits were reverted. ... | 119, 12309 | git, revert | <h1>Reverse Apply a commit to working copy</h1>
<p>In order to investigate the effect introduced by a previous commit, I want to reverse- apply it to my working copy and fiddle around with the code. </p>
<p>I managed with a workflow around creating and applying a patch, but wonder if this can be done easier.</p>
<pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,707 | git | # Reverse Apply a commit to working copy
In order to investigate the effect introduced by a previous commit, I want to reverse- apply it to my working copy and fiddle around with the code.
I managed with a workflow around creating and applying a patch, but wonder if this can be done easier.
```
git checkout -b "tmp-... | How about [`git revert -n`](https://www.kernel.org/pub/software/scm/git/docs/git-revert.html)?
> ```
> -n
> --no-commit
> ```
>
> Usually the command automatically creates some commits with commit log messages stating which commits were reverted. This flag applies the changes necessary to revert the named commits to y... |
34204447 | git rebase --continue no changes | 54 | 2015-12-10 14:30:48 | <p>I have two branches with two features: <code>banch_1</code> and <code>branch_2</code>.
<code>branch_2</code> uses feature from <code>branch_1</code>.
I've made changes in the <code>branch_1</code> and want to rebase <code>branch_2</code> on <code>branch_1</code> to get changes from <code>branch_1</code> into <code>b... | 24,729 | 1,858,864 | 2018-05-15 09:59:03 | 34,205,948 | 68 | 2015-12-10 15:38:31 | 325,900 | 2018-05-15 09:59:03 | https://stackoverflow.com/q/34204447 | https://stackoverflow.com/a/34205948 | <p>If I understand correctly, when you're getting the merge conflict, you're accepting all the changes from <code>branch_1</code>, meaning that that particular commit from <code>branch_2</code> is irrelevant - any changes in that commit are identical to the incoming changes from <code>branch_1</code>.</p>
<p>When git ... | <p>If I understand correctly, when you're getting the merge conflict, you're accepting all the changes from <code>branch_1</code>, meaning that that particular commit from <code>branch_2</code> is irrelevant - any changes in that commit are identical to the incoming changes from <code>branch_1</code>.</p> <p>When git ... | 119, 29934 | git, git-rebase | <h1>git rebase --continue no changes</h1>
<p>I have two branches with two features: <code>banch_1</code> and <code>branch_2</code>.
<code>branch_2</code> uses feature from <code>branch_1</code>.
I've made changes in the <code>branch_1</code> and want to rebase <code>branch_2</code> on <code>branch_1</code> to get chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,709 | git | # git rebase --continue no changes
I have two branches with two features: `banch_1` and `branch_2`.
`branch_2` uses feature from `branch_1`.
I've made changes in the `branch_1` and want to rebase `branch_2` on `branch_1` to get changes from `branch_1` into `branch_2`.
So, I'm checking out on branch_2:
```
git checko... | If I understand correctly, when you're getting the merge conflict, you're accepting all the changes from `branch_1`, meaning that that particular commit from `branch_2` is irrelevant - any changes in that commit are identical to the incoming changes from `branch_1`.
When git is saying
> No changes - did you forget to... |
26318375 | fatal: No existing author found with 'XXX' | 54 | 2014-10-11 19:22:20 | <p>I used git for the first time and I set my user name and user mail. The commands I used are below:</p>
<pre><code>git config --global user.email "bob@example.com"
git config user.email "bob@example.com"
git config --global user.name "bob"
git config user.name "bob"
</code></pre>
<p>When I run <code>git commit --au... | 74,217 | null | 2023-06-30 07:43:54 | 26,318,573 | 68 | 2014-10-11 19:42:38 | 229,044 | 2018-04-19 07:40:40 | https://stackoverflow.com/q/26318375 | https://stackoverflow.com/a/26318573 | <p>You should stop using <code>--author</code> each time you commit, and instead configure an author with <code>git config</code>. Once you've done so, you can type <code>git commit</code> and the author will be pulled from your <code>.gitconfig</code> file. </p>
<p>If you want to give <code>--author</code> a name to ... | <p>You should stop using <code>--author</code> each time you commit, and instead configure an author with <code>git config</code>. Once you've done so, you can type <code>git commit</code> and the author will be pulled from your <code>.gitconfig</code> file. </p> <p>If you want to give <code>--author</code> a name to ... | 119, 32868, 53850 | git, git-commit, git-config | <h1>fatal: No existing author found with 'XXX'</h1>
<p>I used git for the first time and I set my user name and user mail. The commands I used are below:</p>
<pre><code>git config --global user.email "bob@example.com"
git config user.email "bob@example.com"
git config --global user.name "bob"
git config user.name "bob... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,710 | git | # fatal: No existing author found with 'XXX'
I used git for the first time and I set my user name and user mail. The commands I used are below:
```
git config --global user.email "bob@example.com"
git config user.email "bob@example.com"
git config --global user.name "bob"
git config user.name "bob"
```
When I run `g... | You should stop using `--author` each time you commit, and instead configure an author with `git config`. Once you've done so, you can type `git commit` and the author will be pulled from your `.gitconfig` file.
If you want to give `--author` a name to use for authoring the commit, you need to use
`bob <bob@example.c... |
24853847 | How to install a bower package using a private git server (SSH)? | 54 | 2014-07-20 18:59:33 | <p><strong>EDIT</strong>: <a href="http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html">this guy do exactly the same with success</a>, can't figure out why it's not working for me.</p>
<p>I've just installed <code>git</code> and setup permissions/SSH authentication with public/private key... | 49,949 | 220,180 | 2016-08-02 11:20:53 | 24,854,638 | 68 | 2014-07-20 20:32:59 | 220,180 | 2014-07-20 20:32:59 | https://stackoverflow.com/q/24853847 | https://stackoverflow.com/a/24854638 | <p>Ok, found the solution here: <a href="http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html">Using Bower as the Package Management tool for Internal, Private Libraries</a>. Simply remove <code>git://</code> or <code>ssh://</code> and add <code>.git</code> suffix:</p>
<pre><code>"git@code... | <p>Ok, found the solution here: <a href="http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html">Using Bower as the Package Management tool for Internal, Private Libraries</a>. Simply remove <code>git://</code> or <code>ssh://</code> and add <code>.git</code> suffix:</p> <pre><code>"git@code... | 119, 386, 85693, 102278 | bower, bower-install, git, ssh | <h1>How to install a bower package using a private git server (SSH)?</h1>
<p><strong>EDIT</strong>: <a href="http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html">this guy do exactly the same with success</a>, can't figure out why it's not working for me.</p>
<p>I've just installed <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,711 | git | # How to install a bower package using a private git server (SSH)?
**EDIT**: [this guy do exactly the same with success](http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html), can't figure out why it's not working for me.
I've just installed `git` and setup permissions/SSH authentication ... | Ok, found the solution here: [Using Bower as the Package Management tool for Internal, Private Libraries](http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html). Simply remove `git://` or `ssh://` and add `.git` suffix:
```
"git@code.organization.com:projects/boilerplate-template.git#~1"
``... |
15210929 | EGit: Pruning Remote Tracking Branches that have been Deleted on the Remote Repo | 44 | 2013-03-04 20:53:54 | <p>I'm using EGit (for Eclipse) with a team of devs. We have been creating a lot of <code>feature</code> and <code>fix</code> branches for new work, and then merging them into our <code>release</code> branches when they are completed. Right after they are merged into the correct <code>release</code> branch, these tempo... | 24,276 | 1,507,439 | 2019-03-26 18:19:12 | 15,222,727 | 68 | 2013-03-05 11:32:55 | 6,309 | 2016-08-22 09:07:30 | https://stackoverflow.com/q/15210929 | https://stackoverflow.com/a/15222727 | <p>Update March 2014: As mentioned by <a href="https://stackoverflow.com/users/3394495/cheshire">cheshire</a>'s <a href="https://stackoverflow.com/a/22261237/6309">answer</a>, <a href="https://wiki.eclipse.org/EGit/New_and_Noteworthy/3.3" rel="noreferrer">EGit 3.3</a> added that prune feature.</p>
<p>You can see said ... | <p>Update March 2014: As mentioned by <a href="https://stackoverflow.com/users/3394495/cheshire">cheshire</a>'s <a href="https://stackoverflow.com/a/22261237/6309">answer</a>, <a href="https://wiki.eclipse.org/EGit/New_and_Noteworthy/3.3" rel="noreferrer">EGit 3.3</a> added that prune feature.</p> <p>You can see said ... | 53, 119, 41346, 43702 | eclipse, egit, git, git-remote | <h1>EGit: Pruning Remote Tracking Branches that have been Deleted on the Remote Repo</h1>
<p>I'm using EGit (for Eclipse) with a team of devs. We have been creating a lot of <code>feature</code> and <code>fix</code> branches for new work, and then merging them into our <code>release</code> branches when they are comple... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,714 | git | # EGit: Pruning Remote Tracking Branches that have been Deleted on the Remote Repo
I'm using EGit (for Eclipse) with a team of devs. We have been creating a lot of `feature` and `fix` branches for new work, and then merging them into our `release` branches when they are completed. Right after they are merged into the ... | Update March 2014: As mentioned by [cheshire](https://stackoverflow.com/users/3394495/cheshire)'s [answer](https://stackoverflow.com/a/22261237/6309), [EGit 3.3](https://wiki.eclipse.org/EGit/New_and_Noteworthy/3.3) added that prune feature.
You can see said feature introduced in this [Gerrit code review](https://git.... |
2568321 | Cloning git repository from svn repository, results in file-less, remote-branch-less git repo | 42 | 2010-04-02 18:10:21 | <h2>Working SVN repo</h2>
<p>I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.</p>
<p>Checking it out works fine:</p>
<pre><code>tchalvak:~/test/svn-test$
svn checkout --username=myUsernameHere http://www.url.to/proje... | 12,934 | 69,993 | 2013-09-08 18:32:02 | 2,568,424 | 68 | 2010-04-02 18:31:52 | 123,109 | 2010-04-02 18:31:52 | https://stackoverflow.com/q/2568321 | https://stackoverflow.com/a/2568424 | <p>You used the <code>-s</code> option to <code>git svn clone</code>, but from your example, it doesn't appear that your Subversion repository is using the standard layout (<em>i.e.</em>, trunk, branches, and tags directories at the repository root).</p>
<p>If that's the case, clone without <code>-s</code>.</p>
| <p>You used the <code>-s</code> option to <code>git svn clone</code>, but from your example, it doesn't appear that your Subversion repository is using the standard layout (<em>i.e.</em>, trunk, branches, and tags directories at the repository root).</p> <p>If that's the case, clone without <code>-s</code>.</p> | 119, 6452, 7330, 34099 | git, git-clone, git-svn, repository | <h1>Cloning git repository from svn repository, results in file-less, remote-branch-less git repo</h1>
<h2>Working SVN repo</h2>
<p>I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.</p>
<p>Checking it out works fine:</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,715 | git | # Cloning git repository from svn repository, results in file-less, remote-branch-less git repo
## Working SVN repo
I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.
Checking it out works fine:
```
tchalvak:~/test/svn-... | You used the `-s` option to `git svn clone`, but from your example, it doesn't appear that your Subversion repository is using the standard layout (*i.e.*, trunk, branches, and tags directories at the repository root).
If that's the case, clone without `-s`. |
5256769 | Git Merge and Fixing Mixed Spaces and Tabs with two Branches | 38 | 2011-03-10 07:38:46 | <p>I've gone through some similar SOQ's and have not seen an adequate solution for this case.</p>
<p>I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab currently.</p>
<p>Although this should have been addressed when it hap... | 23,387 | 599,286 | 2019-12-31 00:20:07 | 5,262,473 | 68 | 2011-03-10 16:14:43 | 158,304 | 2019-12-31 00:20:07 | https://stackoverflow.com/q/5256769 | https://stackoverflow.com/a/5262473 | <p>By default git will see each difference in a line's indentation as a change, so yes you're likely to end up with mass conflicts doing a stock merge.</p>
<p>However you can choose the merge strategy to use with the <code>-s</code> option:</p>
<pre><code>git merge -s recursive -Xignore-space-change
</code></pre>
<p>Th... | <p>By default git will see each difference in a line's indentation as a change, so yes you're likely to end up with mass conflicts doing a stock merge.</p> <p>However you can choose the merge strategy to use with the <code>-s</code> option:</p> <pre><code>git merge -s recursive -Xignore-space-change </code></pre> <p>Th... | 119, 717, 1879, 5162, 76220 | branch, git, git-branch, merge, spaces | <h1>Git Merge and Fixing Mixed Spaces and Tabs with two Branches</h1>
<p>I've gone through some similar SOQ's and have not seen an adequate solution for this case.</p>
<p>I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,717 | git | # Git Merge and Fixing Mixed Spaces and Tabs with two Branches
I've gone through some similar SOQ's and have not seen an adequate solution for this case.
I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab currently.
Althou... | By default git will see each difference in a line's indentation as a change, so yes you're likely to end up with mass conflicts doing a stock merge.
However you can choose the merge strategy to use with the `-s` option:
```
git merge -s recursive -Xignore-space-change
```
This command would use the recursive strateg... |
12823976 | How to modify git add to handle deleted files? | 34 | 2012-10-10 16:19:18 | <p>I removed a few files from my git repo and now, upon status see</p>
<pre><code># Changes not staged for commit:
# ...
# deleted: project/war/favicon.ico
# deleted: project/war/index.html
</code></pre>
<p>Usually, i would stage them by issuing <code>git add .</code> command, but doing so does not affect g... | 18,416 | 359,862 | 2013-04-23 06:47:38 | 12,824,031 | 68 | 2012-10-10 16:22:56 | 501,250 | 2013-04-23 06:47:38 | https://stackoverflow.com/q/12823976 | https://stackoverflow.com/a/12824031 | <p><code>git add .</code> will add new and modified files to the index. <code>git add -u</code> will delete files from the index when they are deleted on-disk and update modified files, but will not add new files. You need a combination of the two:</p>
<pre><code>git add . && git add -u .
</code></pre>
<p>A... | <p><code>git add .</code> will add new and modified files to the index. <code>git add -u</code> will delete files from the index when they are deleted on-disk and update modified files, but will not add new files. You need a combination of the two:</p> <pre><code>git add . && git add -u . </code></pre> <p>A... | 119 | git | <h1>How to modify git add to handle deleted files?</h1>
<p>I removed a few files from my git repo and now, upon status see</p>
<pre><code># Changes not staged for commit:
# ...
# deleted: project/war/favicon.ico
# deleted: project/war/index.html
</code></pre>
<p>Usually, i would stage them by issuing <code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,718 | git | # How to modify git add to handle deleted files?
I removed a few files from my git repo and now, upon status see
```
# Changes not staged for commit:
# ...
# deleted: project/war/favicon.ico
# deleted: project/war/index.html
```
Usually, i would stage them by issuing `git add .` command, but doing so does ... | `git add .` will add new and modified files to the index. `git add -u` will delete files from the index when they are deleted on-disk and update modified files, but will not add new files. You need a combination of the two:
```
git add . && git add -u .
```
Addendum: It appears that the `-A` switch will catch all thr... |
51365138 | Why does Git have a tea time? | 101 | 2018-07-16 15:19:27 | <p>In the <a href="https://github.com/git/git/blob/master/date.c#L958" rel="noreferrer">date.c</a> file in Git's source code, I note the following structure of special time names:</p>
<pre><code>static const struct special {
const char *name;
void (*fn)(struct tm *, struct tm *, int *);
} special[] = {
{ "... | 4,037 | 1,128,047 | 2018-07-17 06:03:31 | 51,365,336 | 67 | 2018-07-16 15:28:35 | 1,332,068 | 2018-07-16 15:28:35 | https://stackoverflow.com/q/51365138 | https://stackoverflow.com/a/51365336 | <p>This commit might give you a clue as to why it was included:
<a href="https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9" rel="noreferrer">https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9</a></p>
<p>I think it was suggested initially as a joke, but actually implemen... | <p>This commit might give you a clue as to why it was included: <a href="https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9" rel="noreferrer">https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9</a></p> <p>I think it was suggested initially as a joke, but actually implemen... | 119 | git | <h1>Why does Git have a tea time?</h1>
<p>In the <a href="https://github.com/git/git/blob/master/date.c#L958" rel="noreferrer">date.c</a> file in Git's source code, I note the following structure of special time names:</p>
<pre><code>static const struct special {
const char *name;
void (*fn)(struct tm *, struc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,723 | git | # Why does Git have a tea time?
In the [date.c](https://github.com/git/git/blob/master/date.c#L958) file in Git's source code, I note the following structure of special time names:
```
static const struct special {
const char *name;
void (*fn)(struct tm *, struct tm *, int *);
} special[] = {
{ "yesterday... | This commit might give you a clue as to why it was included:
<https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9>
I think it was suggested initially as a joke, but actually implemented to demonstrate the ability for users to include their own custom time/date periods:
```
On Fri, 18 Nov 2005, ... |
20234523 | How to discard uncommitted changes in SourceTree? | 101 | 2013-11-27 05:22:20 | <p>I'm new to the Git environment, and I'm using BitBucket with SourceTree on Mac. All I want to do now is to discard the changes since last commit. How should I do this? I haven't found anything like "discard changes", and directly pulling from the last commit doesn't seem to work. Solutions done with either... | 201,305 | 3,552,532 | 2022-07-19 00:43:50 | 20,249,116 | 67 | 2013-11-27 17:26:47 | 503,402 | 2019-10-10 08:53:22 | https://stackoverflow.com/q/20234523 | https://stackoverflow.com/a/20249116 | <p>I like to use</p>
<pre><code>git stash
</code></pre>
<p>This stores all uncommitted changes in the <a href="https://git-scm.com/docs/git-stash" rel="noreferrer">stash</a>. If you want to discard these changes later just <code>git stash drop</code> (or <code>git stash pop</code> to restore them).</p>
<p>Though thi... | <p>I like to use</p> <pre><code>git stash </code></pre> <p>This stores all uncommitted changes in the <a href="https://git-scm.com/docs/git-stash" rel="noreferrer">stash</a>. If you want to discard these changes later just <code>git stash drop</code> (or <code>git stash pop</code> to restore them).</p> <p>Though thi... | 119, 369, 8337, 90056 | atlassian-sourcetree, bitbucket, git, macos | <h1>How to discard uncommitted changes in SourceTree?</h1>
<p>I'm new to the Git environment, and I'm using BitBucket with SourceTree on Mac. All I want to do now is to discard the changes since last commit. How should I do this? I haven't found anything like "discard changes", and directly pulling from the l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,724 | git | # How to discard uncommitted changes in SourceTree?
I'm new to the Git environment, and I'm using BitBucket with SourceTree on Mac. All I want to do now is to discard the changes since last commit. How should I do this? I haven't found anything like "discard changes", and directly pulling from the last commit doesn't ... | I like to use
```
git stash
```
This stores all uncommitted changes in the [stash](https://git-scm.com/docs/git-stash). If you want to discard these changes later just `git stash drop` (or `git stash pop` to restore them).
Though this is technically not the "proper" way to discard changes (as other answers and comme... |
6311226 | Query git reflog for all commits to a specific file | 84 | 2011-06-10 19:32:59 | <p>Is it possible to check the git reflog for all commits to a specific file.</p>
<p>I made a commit to file foo.txt and now it no longer shows in the git history via</p>
<pre><code>git log foo.txt
</code></pre>
<p>I want to search the reflog to find all commits to this file so I can find my "lost" commit.</p>
| 28,893 | 96,740 | 2024-03-14 00:27:07 | 6,311,311 | 67 | 2011-06-10 19:43:09 | 106,205 | 2017-08-22 12:59:27 | https://stackoverflow.com/q/6311226 | https://stackoverflow.com/a/6311311 | <p>Try:</p>
<pre><code>git rev-list --all -- foo.txt
</code></pre>
<p>This will give you a list of all commits containing foo.txt.</p>
| <p>Try:</p> <pre><code>git rev-list --all -- foo.txt </code></pre> <p>This will give you a list of all commits containing foo.txt.</p> | 119, 59545 | git, reflog | <h1>Query git reflog for all commits to a specific file</h1>
<p>Is it possible to check the git reflog for all commits to a specific file.</p>
<p>I made a commit to file foo.txt and now it no longer shows in the git history via</p>
<pre><code>git log foo.txt
</code></pre>
<p>I want to search the reflog to find all c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,726 | git | # Query git reflog for all commits to a specific file
Is it possible to check the git reflog for all commits to a specific file.
I made a commit to file foo.txt and now it no longer shows in the git history via
```
git log foo.txt
```
I want to search the reflog to find all commits to this file so I can find my "lo... | Try:
```
git rev-list --all -- foo.txt
```
This will give you a list of all commits containing foo.txt. |
2164581 | Remove file from git repository (history) | 83 | 2010-01-29 19:27:38 | <p>(solved, see bottom of the question body)<br>
Looking for this for a long time now, what I have till now is:</p>
<ul>
<li><a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/" rel="noreferrer">http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/</a>
and</li>
<li>... | 43,097 | 262,003 | 2015-02-11 12:40:20 | 2,179,652 | 67 | 2010-02-01 20:01:13 | 95,706 | 2010-02-01 21:39:55 | https://stackoverflow.com/q/2164581 | https://stackoverflow.com/a/2179652 | <p>I can't say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran <code>git filter-branch</code>. This would explain why <code>git fsck --full --unreachable</code> doesn't call the large blob an unreachable object, ... | <p>I can't say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran <code>git filter-branch</code>. This would explain why <code>git fsck --full --unreachable</code> doesn't call the large blob an unreachable object, ... | 119, 456, 91259 | git, git-rewrite-history, version-control | <h1>Remove file from git repository (history)</h1>
<p>(solved, see bottom of the question body)<br>
Looking for this for a long time now, what I have till now is:</p>
<ul>
<li><a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/" rel="noreferrer">http://dound.com/2009/04/git-forever-remo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,727 | git | # Remove file from git repository (history)
(solved, see bottom of the question body)
Looking for this for a long time now, what I have till now is:
- <http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/>
and
- <http://progit.org/book/ch9-7.html>
Pretty much the same method, but both of th... | I can't say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran `git filter-branch`. This would explain why `git fsck --full --unreachable` doesn't call the large blob an unreachable object, even though you've expire... |
14513278 | Git merge after fetch - how, exactly? | 65 | 2013-01-25 00:19:51 | <p>I've read from various sources that it's usually a better idea to fetch <em>then</em> merge rather than simply pull as it allows for finer control. That said, I've yet to find actually how to do it. Case in point:</p>
<p>There was a small change made to some of the code in one of my GitHub repository's master bra... | 49,000 | 399,584 | 2023-09-28 16:22:55 | 14,513,325 | 67 | 2013-01-25 00:24:28 | 116,908 | 2013-01-25 00:24:28 | https://stackoverflow.com/q/14513278 | https://stackoverflow.com/a/14513325 | <p><code>git merge origin/master</code> should work. Since <code>master</code> is usually a tracking branch, you could also do <code>git pull</code> from that branch and it will do a fetch & merge for you.</p>
<p>If you have local changes on your <code>master</code> that aren't reflected on <code>origin</code>, y... | <p><code>git merge origin/master</code> should work. Since <code>master</code> is usually a tracking branch, you could also do <code>git pull</code> from that branch and it will do a fetch & merge for you.</p> <p>If you have local changes on your <code>master</code> that aren't reflected on <code>origin</code>, y... | 119, 28897, 33720 | git, git-fetch, git-merge | <h1>Git merge after fetch - how, exactly?</h1>
<p>I've read from various sources that it's usually a better idea to fetch <em>then</em> merge rather than simply pull as it allows for finer control. That said, I've yet to find actually how to do it. Case in point:</p>
<p>There was a small change made to some of the c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,730 | git | # Git merge after fetch - how, exactly?
I've read from various sources that it's usually a better idea to fetch *then* merge rather than simply pull as it allows for finer control. That said, I've yet to find actually how to do it. Case in point:
There was a small change made to some of the code in one of my GitHub r... | `git merge origin/master` should work. Since `master` is usually a tracking branch, you could also do `git pull` from that branch and it will do a fetch & merge for you.
If you have local changes on your `master` that aren't reflected on `origin`, you might want `git rebase origin/master` to make sure your commits are... |
1070496 | Having a hard time understanding git-fetch | 60 | 2009-07-01 17:54:56 | <p>I am having a hard time understanding the nuances of git-fetch. I understand that doing a <code>fetch</code>, fetches the remote refs into a local tracking branch.</p>
<p>I have a few questions though:</p>
<ol>
<li><p>Can it be possible that a local tracking branch does not exist? If so, will it then be created au... | 40,051 | 34,956 | 2022-08-03 06:05:03 | 1,070,851 | 67 | 2009-07-01 19:18:02 | 10,474 | 2022-08-03 06:05:03 | https://stackoverflow.com/q/1070496 | https://stackoverflow.com/a/1070851 | <p>First, there's no such concept of "<em>local tracking</em>" branches, only "<em>remote tracking</em>" branches. So <strong>origin/master</strong> is a remote tracking branch for <strong>master</strong> in the <strong>origin</strong> repo.</p>
<p>Typically you do <code>git fetch $remote</code> whi... | <p>First, there's no such concept of "<em>local tracking</em>" branches, only "<em>remote tracking</em>" branches. So <strong>origin/master</strong> is a remote tracking branch for <strong>master</strong> in the <strong>origin</strong> repo.</p> <p>Typically you do <code>git fetch $remote</code> whi... | 119, 33720 | git, git-fetch | <h1>Having a hard time understanding git-fetch</h1>
<p>I am having a hard time understanding the nuances of git-fetch. I understand that doing a <code>fetch</code>, fetches the remote refs into a local tracking branch.</p>
<p>I have a few questions though:</p>
<ol>
<li><p>Can it be possible that a local tracking bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,731 | git | # Having a hard time understanding git-fetch
I am having a hard time understanding the nuances of git-fetch. I understand that doing a `fetch`, fetches the remote refs into a local tracking branch.
I have a few questions though:
1. Can it be possible that a local tracking branch does not exist? If so, will it then b... | First, there's no such concept of "*local tracking*" branches, only "*remote tracking*" branches. So **origin/master** is a remote tracking branch for **master** in the **origin** repo.
Typically you do `git fetch $remote` which updates all your remote tracking branches, and creates new ones if needed.
However, you c... |
916822 | Unable to diff files in two separate branches in Git | 58 | 2009-05-27 16:47:30 | <p>I have FileA in branchA and FileB in branchB.</p>
<p>The problem is that I can access only one file at time.
I would like to be able to compare the files by FileMerge or meld, since they are the only diffTools whichI have found for Mac.</p>
<p><strong>How can you diff by meld/FileMerge the two files</strong>?</p>
<h... | 43,181 | 54,964 | 2009-05-27 21:43:23 | 917,557 | 67 | 2009-05-27 19:22:48 | 46,058 | 2009-05-27 21:43:23 | https://stackoverflow.com/q/916822 | https://stackoverflow.com/a/917557 | <p>You can use "<a href="http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html" rel="noreferrer" title="git-mergetool - Run merge conflict resolution tools to resolve merge conflicts">git mergetool</a>" for merging, and in modern git (meaning version 1.6.3 and later) "<a href="http://www.kernel.org/pub/sof... | <p>You can use "<a href="http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html" rel="noreferrer" title="git-mergetool - Run merge conflict resolution tools to resolve merge conflicts">git mergetool</a>" for merging, and in modern git (meaning version 1.6.3 and later) "<a href="http://www.kernel.org/pub/sof... | 34, 119, 606, 717 | diff, git, merge, unix | <h1>Unable to diff files in two separate branches in Git</h1>
<p>I have FileA in branchA and FileB in branchB.</p>
<p>The problem is that I can access only one file at time.
I would like to be able to compare the files by FileMerge or meld, since they are the only diffTools whichI have found for Mac.</p>
<p><strong>How... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,732 | git | # Unable to diff files in two separate branches in Git
I have FileA in branchA and FileB in branchB.
The problem is that I can access only one file at time.
I would like to be able to compare the files by FileMerge or meld, since they are the only diffTools whichI have found for Mac.
**How can you diff by meld/FileM... | You can use "[git mergetool](http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts")" for merging, and in modern git (meaning version 1.6.3 and later) "[git difftool](http://www.kernel.org/pub/software/scm/git/docs/git-difftool... |
7362709 | Git pull fails with bad pack header error | 53 | 2011-09-09 13:53:23 | <p>git pull fails with following error</p>
<pre><code>remote: Counting objects: 146, done.
remote: fatal: unable to create thread: Resource temporarily unavailable
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote... | 100,288 | 426,305 | 2022-12-05 20:51:17 | 7,363,357 | 67 | 2011-09-09 14:39:44 | 223,092 | 2016-09-10 07:56:30 | https://stackoverflow.com/q/7362709 | https://stackoverflow.com/a/7363357 | <p>The lines beginning with <code>remote</code> are output from git running on the remote system. The error:</p>
<pre><code>fatal: unable to create thread: Resource temporarily unavailable
</code></pre>
<p>... strongly suggests that you've run out of memory on the server, which can happen if you have either:</p>
<o... | <p>The lines beginning with <code>remote</code> are output from git running on the remote system. The error:</p> <pre><code>fatal: unable to create thread: Resource temporarily unavailable </code></pre> <p>... strongly suggests that you've run out of memory on the server, which can happen if you have either:</p> <o... | 119 | git | <h1>Git pull fails with bad pack header error</h1>
<p>git pull fails with following error</p>
<pre><code>remote: Counting objects: 146, done.
remote: fatal: unable to create thread: Resource temporarily unavailable
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possib... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,733 | git | # Git pull fails with bad pack header error
git pull fails with following error
```
remote: Counting objects: 146, done.
remote: fatal: unable to create thread: Resource temporarily unavailable
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corrup... | The lines beginning with `remote` are output from git running on the remote system. The error:
```
fatal: unable to create thread: Resource temporarily unavailable
```
... strongly suggests that you've run out of memory on the server, which can happen if you have either:
1. A repository with lots of large files, whi... |
10946893 | Git: name and email address configuration | 52 | 2012-06-08 10:10:34 | <p>Once in a while I get the message shown below from Git. My questions regarding this are:</p>
<ol>
<li>Why does this happen?</li>
<li>How can I prevent this from happening again?</li>
<li>How does this affect my commits or any other Git actions I may take?</li>
</ol>
<p>I realize similar questions have been posted ... | 66,408 | 385,559 | 2023-07-09 21:04:18 | 10,946,960 | 67 | 2012-06-08 10:14:53 | 259,576 | 2012-06-08 10:22:48 | https://stackoverflow.com/q/10946893 | https://stackoverflow.com/a/10946960 | <p><code>Git</code> simply detects you don't have the following section in your config files:</p>
<pre><code>[user]
name = <your name>
email = <your mail>
</code></pre>
<ul>
<li><code><project_path>/.git/config</code> for the project specific config file.</li>
<li><code>~/.gitconfig</code> t... | <p><code>Git</code> simply detects you don't have the following section in your config files:</p> <pre><code>[user] name = <your name> email = <your mail> </code></pre> <ul> <li><code><project_path>/.git/config</code> for the project specific config file.</li> <li><code>~/.gitconfig</code> t... | 119 | git | <h1>Git: name and email address configuration</h1>
<p>Once in a while I get the message shown below from Git. My questions regarding this are:</p>
<ol>
<li>Why does this happen?</li>
<li>How can I prevent this from happening again?</li>
<li>How does this affect my commits or any other Git actions I may take?</li>
</ol... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,736 | git | # Git: name and email address configuration
Once in a while I get the message shown below from Git. My questions regarding this are:
1. Why does this happen?
2. How can I prevent this from happening again?
3. How does this affect my commits or any other Git actions I may take?
I realize similar questions have been p... | `Git` simply detects you don't have the following section in your config files:
```
[user]
name = <your name>
email = <your mail>
```
- `<project_path>/.git/config` for the project specific config file.
- `~/.gitconfig` the global config file
When you do:
```
git config --global user.name "Your Name"
git co... |
60087759 | Git is moving to new hashing algorithm SHA-256 but why git community settled on SHA‑256 | 47 | 2020-02-06 04:30:07 | <p>I just learned from <a href="https://news.ycombinator.com/item?id=22233295" rel="noreferrer">this HackerNews post</a> that Git is moving to a new hashing algorithm, from <code>SHA-1</code> to <code>SHA-256</code>.</p>
<p>What makes <code>SHA-256</code> the best fit for Git's use case?
Are there any/many strong techn... | 23,936 | 6,455,628 | 2023-12-15 19:57:10 | 60,088,126 | 67 | 2020-02-06 05:16:18 | 6,309 | 2021-01-03 19:24:04 | https://stackoverflow.com/q/60087759 | https://stackoverflow.com/a/60088126 | <p>I have presented that move in "<a href="https://stackoverflow.com/a/47838703/6309">Why doesn't Git use more modern SHA?</a>" in <a href="https://stackoverflow.com/revisions/47838703/2">Aug. 2018</a></p>
<p>The reasons were <a href="https://public-inbox.org/git/20180609224913.GC38834@genre.crustytoothpaste.... | <p>I have presented that move in "<a href="https://stackoverflow.com/a/47838703/6309">Why doesn't Git use more modern SHA?</a>" in <a href="https://stackoverflow.com/revisions/47838703/2">Aug. 2018</a></p> <p>The reasons were <a href="https://public-inbox.org/git/20180609224913.GC38834@genre.crustytoothpaste.... | 119, 581, 2387 | cryptography, git, hash | <h1>Git is moving to new hashing algorithm SHA-256 but why git community settled on SHA‑256</h1>
<p>I just learned from <a href="https://news.ycombinator.com/item?id=22233295" rel="noreferrer">this HackerNews post</a> that Git is moving to a new hashing algorithm, from <code>SHA-1</code> to <code>SHA-256</code>.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,739 | git | # Git is moving to new hashing algorithm SHA-256 but why git community settled on SHA‑256
I just learned from [this HackerNews post](https://news.ycombinator.com/item?id=22233295) that Git is moving to a new hashing algorithm, from `SHA-1` to `SHA-256`.
What makes `SHA-256` the best fit for Git's use case?
Are there ... | I have presented that move in "[Why doesn't Git use more modern SHA?](https://stackoverflow.com/a/47838703/6309)" in [Aug. 2018](https://stackoverflow.com/revisions/47838703/2)
The reasons were [discussed here](https://public-inbox.org/git/20180609224913.GC38834@genre.crustytoothpaste.net/) by Brian M. Carlson:
> I'v... |
6898317 | git pull analogous to / opposite of git push -f? | 47 | 2011-08-01 12:20:46 | <p>Sometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with <code>git rebase -i</code> and <code>git push origin master -f</code>.</p>
<p>How do I do a forced <code>git pull origin master</code> without a merge? I tried it with the <code>-f</code> option, but that didn't ... | 10,050 | 242,933 | 2014-02-08 15:52:21 | 6,898,318 | 67 | 2011-08-01 12:21:12 | 242,933 | 2011-08-05 18:10:13 | https://stackoverflow.com/q/6898317 | https://stackoverflow.com/a/6898318 | <pre><code>git fetch
git reset --hard origin/master
</code></pre>
| <pre><code>git fetch git reset --hard origin/master </code></pre> | 119, 28896, 28898, 33720 | git, git-fetch, git-pull, git-push | <h1>git pull analogous to / opposite of git push -f?</h1>
<p>Sometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with <code>git rebase -i</code> and <code>git push origin master -f</code>.</p>
<p>How do I do a forced <code>git pull origin master</code> without a merge? I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,742 | git | # git pull analogous to / opposite of git push -f?
Sometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with `git rebase -i` and `git push origin master -f`.
How do I do a forced `git pull origin master` without a merge? I tried it with the `-f` option, but that didn't wo... | ```
git fetch
git reset --hard origin/master
``` |
12352049 | Always use the pager for git diff | 45 | 2012-09-10 12:47:27 | <p>I'm using <a href="https://en.wikipedia.org/wiki/Less_(Unix)" rel="noreferrer">less</a> as my Git pager.</p>
<p>If the <code>git diff</code> output is readable on one page, my Git prints the output to the screen.</p>
<p>Sometimes I'm too fast with typing <kbd>Ctrl</kbd> + <kbd>D</kbd> (half page down), which kills m... | 13,082 | 552,671 | 2021-12-06 00:59:51 | 12,352,224 | 67 | 2012-09-10 12:57:09 | 112,968 | 2012-11-22 14:23:28 | https://stackoverflow.com/q/12352049 | https://stackoverflow.com/a/12352224 | <p>This is controlled by the <code>-F</code> (<code>--quit-if-one-screen</code>) option to less.</p>
<p>Git uses the options <code>FRSX</code> for/of less by default, if none are specified by the <code>$LESS</code> or <code>$GIT_PAGER</code> environment variables. To change it, specify the <code>core.pager</code> opti... | <p>This is controlled by the <code>-F</code> (<code>--quit-if-one-screen</code>) option to less.</p> <p>Git uses the options <code>FRSX</code> for/of less by default, if none are specified by the <code>$LESS</code> or <code>$GIT_PAGER</code> environment variables. To change it, specify the <code>core.pager</code> opti... | 119, 9033, 32868 | git, git-config, git-diff | <h1>Always use the pager for git diff</h1>
<p>I'm using <a href="https://en.wikipedia.org/wiki/Less_(Unix)" rel="noreferrer">less</a> as my Git pager.</p>
<p>If the <code>git diff</code> output is readable on one page, my Git prints the output to the screen.</p>
<p>Sometimes I'm too fast with typing <kbd>Ctrl</kbd> + <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,744 | git | # Always use the pager for git diff
I'm using [less](https://en.wikipedia.org/wiki/Less_(Unix)) as my Git pager.
If the `git diff` output is readable on one page, my Git prints the output to the screen.
Sometimes I'm too fast with typing `Ctrl` + `D` (half page down), which kills my terminal. Is there an option to e... | This is controlled by the `-F` (`--quit-if-one-screen`) option to less.
Git uses the options `FRSX` for/of less by default, if none are specified by the `$LESS` or `$GIT_PAGER` environment variables. To change it, specify the `core.pager` option and set it to `RSX`:
```
git config --global core.pager 'less -+F'
```
... |
41953300 | How to delete the old git history? | 44 | 2017-01-31 08:56:24 | <p>I have git repository with many, many (2000+) commits, for example:</p>
<pre><code> l-- m -- n
/
a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- k
\
x -- y -- z
</code></pre>
<p>and I want to truncate old log history - delete all commi... | 38,084 | 671,391 | 2024-04-16 04:20:46 | 41,953,383 | 67 | 2017-01-31 09:01:15 | 2,082,964 | 2017-01-31 09:06:28 | https://stackoverflow.com/q/41953300 | https://stackoverflow.com/a/41953383 | <p>In order not to lose some history; better first take a copy of your repository :). Here we go: (<code><f></code> is the sha of the commit f that you want to be the new root commit)</p>
<pre><code>git checkout --orphan temp <f> # checkout to the status of the git repo at commit f; creating a branch ... | <p>In order not to lose some history; better first take a copy of your repository :). Here we go: (<code><f></code> is the sha of the commit f that you want to be the new root commit)</p> <pre><code>git checkout --orphan temp <f> # checkout to the status of the git repo at commit f; creating a branch ... | 119, 91259 | git, git-rewrite-history | <h1>How to delete the old git history?</h1>
<p>I have git repository with many, many (2000+) commits, for example:</p>
<pre><code> l-- m -- n
/
a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- k
\
x -- y -- z
</code></pre>
<p>and I want to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,745 | git | # How to delete the old git history?
I have git repository with many, many (2000+) commits, for example:
```
l-- m -- n
/
a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- k
\
x -- y -- z
```
and I want to truncate old log history - delet... | In order not to lose some history; better first take a copy of your repository :). Here we go: (`<f>` is the sha of the commit f that you want to be the new root commit)
```
git checkout --orphan temp <f> # checkout to the status of the git repo at commit f; creating a branch named "temp"
git commit -m "new root ... |
37187092 | Angular2 .gitignore | 40 | 2016-05-12 12:36:17 | <p>I'm setting up an Angular 2 sample project. Is my <code>.gitignore</code> enough already or did I miss anything?</p>
<pre><code>node_modules
typings
jspm_packages
bower_components
app/**/*.js
app/**/*.map
</code></pre>
| 48,426 | 239,431 | 2022-12-04 17:58:38 | 37,187,110 | 67 | 2016-05-12 12:37:20 | 217,408 | 2017-04-20 14:08:10 | https://stackoverflow.com/q/37187092 | https://stackoverflow.com/a/37187110 | <p><code>angular-cli</code> generates</p>
<pre><code># See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vsc... | <p><code>angular-cli</code> generates</p> <pre><code># See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output /dist /tmp /out-tsc # dependencies /node_modules # IDEs and editors /.idea .project .classpath .c9/ *.launch .settings/ *.sublime-workspace # IDE - VSCode .vscode/* !.vsc... | 3, 119, 25056, 125866 | angular, git, gitignore, javascript | <h1>Angular2 .gitignore</h1>
<p>I'm setting up an Angular 2 sample project. Is my <code>.gitignore</code> enough already or did I miss anything?</p>
<pre><code>node_modules
typings
jspm_packages
bower_components
app/**/*.js
app/**/*.map
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,746 | git | # Angular2 .gitignore
I'm setting up an Angular 2 sample project. Is my `.gitignore` enough already or did I miss anything?
```
node_modules
typings
jspm_packages
bower_components
app/**/*.js
app/**/*.map
``` | `angular-cli` generates
```
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscod... |
52107252 | How to take latest changes from dev branch to my current branch | 36 | 2018-08-31 01:13:18 | <p>We have below branches on which we work.</p>
<pre><code>master
dev
person A
person B
</code></pre>
<p>We both keep working on our branches i.e. <code>person A</code> or <code>person B</code> (working on same project). When <code>person A</code> finish the work, he commits changes to his branche and then create a p... | 160,464 | 6,243,129 | 2024-02-19 05:58:31 | 52,107,400 | 67 | 2018-08-31 01:41:18 | 581,076 | 2024-02-19 05:58:31 | https://stackoverflow.com/q/52107252 | https://stackoverflow.com/a/52107400 | <p>It's a good practice for the person <em>B</em> to get new changes into their branch <code>b</code>
as soon as feasible after person <em>A</em> pushes the changes to <code>dev</code>/<code>main</code>.</p>
<p>This is so that person <em>B</em> works on latest code and their eventual merge to <code>dev</code>/<code>mai... | <p>It's a good practice for the person <em>B</em> to get new changes into their branch <code>b</code> as soon as feasible after person <em>A</em> pushes the changes to <code>dev</code>/<code>main</code>.</p> <p>This is so that person <em>B</em> works on latest code and their eventual merge to <code>dev</code>/<code>mai... | 119 | git | <h1>How to take latest changes from dev branch to my current branch</h1>
<p>We have below branches on which we work.</p>
<pre><code>master
dev
person A
person B
</code></pre>
<p>We both keep working on our branches i.e. <code>person A</code> or <code>person B</code> (working on same project). When <code>person A</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,748 | git | # How to take latest changes from dev branch to my current branch
We have below branches on which we work.
```
master
dev
person A
person B
```
We both keep working on our branches i.e. `person A` or `person B` (working on same project). When `person A` finish the work, he commits changes to his branche and then cre... | It's a good practice for the person *B* to get new changes into their branch `b`
as soon as feasible after person *A* pushes the changes to `dev`/`main`.
This is so that person *B* works on latest code and their eventual merge to `dev`/`main` is easy.
### Option 1, pull
1. Commit all changes to branch `feature_branc... |
12255028 | How to show git colors on Zsh? | 36 | 2012-09-03 23:21:58 | <p>I recently started to use Zsh as my default shell. One thing that I like in git is the colors, for example, the <code>git status</code> and <code>git diff</code> used to have colors (additions in green, and deletions in red).</p>
<p>Now with Zsh it is all white (the default color). How can I put colors on git outpu... | 18,065 | 913,275 | 2016-07-21 14:46:07 | 12,255,443 | 67 | 2012-09-04 00:36:54 | 282,289 | 2014-12-03 09:32:57 | https://stackoverflow.com/q/12255028 | https://stackoverflow.com/a/12255443 | <p><code>git config --global color.diff auto</code><br>
<code>git config --global color.status auto</code></p>
| <p><code>git config --global color.diff auto</code><br> <code>git config --global color.status auto</code></p> | 119, 3791 | git, zsh | <h1>How to show git colors on Zsh?</h1>
<p>I recently started to use Zsh as my default shell. One thing that I like in git is the colors, for example, the <code>git status</code> and <code>git diff</code> used to have colors (additions in green, and deletions in red).</p>
<p>Now with Zsh it is all white (the default c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,749 | git | # How to show git colors on Zsh?
I recently started to use Zsh as my default shell. One thing that I like in git is the colors, for example, the `git status` and `git diff` used to have colors (additions in green, and deletions in red).
Now with Zsh it is all white (the default color). How can I put colors on git out... | `git config --global color.diff auto`
`git config --global color.status auto` |
20160503 | Stage all but one folder | 29 | 2013-11-23 09:02:12 | <p>I have a project containing a few modules. There were some commits previously. </p>
<p>How do I stage all the files (modified, deleted, created) and folders in the project <strong>but</strong> the one specific folder and all files in it?</p>
| 20,257 | 1,708,058 | 2013-11-23 09:05:52 | 20,160,533 | 67 | 2013-11-23 09:05:52 | 29,407 | 2013-11-23 09:05:52 | https://stackoverflow.com/q/20160503 | https://stackoverflow.com/a/20160533 | <pre><code>git add .
git reset -- somefolder_to_exclude
</code></pre>
| <pre><code>git add . git reset -- somefolder_to_exclude </code></pre> | 119 | git | <h1>Stage all but one folder</h1>
<p>I have a project containing a few modules. There were some commits previously. </p>
<p>How do I stage all the files (modified, deleted, created) and folders in the project <strong>but</strong> the one specific folder and all files in it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,750 | git | # Stage all but one folder
I have a project containing a few modules. There were some commits previously.
How do I stage all the files (modified, deleted, created) and folders in the project **but** the one specific folder and all files in it? | ```
git add .
git reset -- somefolder_to_exclude
``` |
41989300 | Does git rebase affect the remote branch or local branch | 12 | 2017-02-01 20:37:49 | <p>I am working on my branch called "role". Remote master is being updated frequently. So after I commit my changes to remote branch, I need to rebase the branch on the latest master. So here are my steps:</p>
<pre><code># from local
git add .
git commit 'Add feature'
git push origin role
# rebase
git pull --rebase o... | 13,761 | 3,358,927 | 2017-02-01 23:20:58 | 41,991,677 | 67 | 2017-02-01 23:20:58 | 1,256,452 | 2017-02-01 23:20:58 | https://stackoverflow.com/q/41989300 | https://stackoverflow.com/a/41991677 | <h3>Summary: yes, but your question is wrong. :-)</h3>
<p>There is a bunch of stuff to keep straight here. The Git terminology is not very good to start with—"remote", "tracking", "branch", and "remote-tracking branch" all mean very different things!—and you're using yet another... | <h3>Summary: yes, but your question is wrong. :-)</h3> <p>There is a bunch of stuff to keep straight here. The Git terminology is not very good to start with—"remote", "tracking", "branch", and "remote-tracking branch" all mean very different things!—and you're using yet another... | 119, 1879, 8974 | branch, git, rebase | <h1>Does git rebase affect the remote branch or local branch</h1>
<p>I am working on my branch called "role". Remote master is being updated frequently. So after I commit my changes to remote branch, I need to rebase the branch on the latest master. So here are my steps:</p>
<pre><code># from local
git add .
git commi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,753 | git | # Does git rebase affect the remote branch or local branch
I am working on my branch called "role". Remote master is being updated frequently. So after I commit my changes to remote branch, I need to rebase the branch on the latest master. So here are my steps:
```
# from local
git add .
git commit 'Add feature'
git ... | ### Summary: yes, but your question is wrong. :-)
There is a bunch of stuff to keep straight here. The Git terminology is not very good to start with—"remote", "tracking", "branch", and "remote-tracking branch" all mean very different things!—and you're using yet another set of terms, which makes things even trickier.... |
2179722 | Checking out old files WITH original create/modified timestamps | 116 | 2010-02-01 20:13:26 | <p>Is there a way to know or get the original create/modified timestamps?</p>
| 63,193 | 207,419 | 2024-08-02 20:58:27 | 2,179,876 | 66 | 2010-02-01 20:36:39 | 82,294 | 2022-02-17 00:27:30 | https://stackoverflow.com/q/2179722 | https://stackoverflow.com/a/2179876 | <p>I believe that the only timestamps recorded in the Git database are the author and commit timestamps. I don't see an option for Git to modify the file's timestamp to match the most recent commit, and it makes sense that this wouldn't be the default behavior (because if it were, Makefiles wouldn't work correctly).</... | <p>I believe that the only timestamps recorded in the Git database are the author and commit timestamps. I don't see an option for Git to modify the file's timestamp to match the most recent commit, and it makes sense that this wouldn't be the default behavior (because if it were, Makefiles wouldn't work correctly).</... | 119 | git | <h1>Checking out old files WITH original create/modified timestamps</h1>
<p>Is there a way to know or get the original create/modified timestamps?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,755 | git | # Checking out old files WITH original create/modified timestamps
Is there a way to know or get the original create/modified timestamps? | I believe that the only timestamps recorded in the Git database are the author and commit timestamps. I don't see an option for Git to modify the file's timestamp to match the most recent commit, and it makes sense that this wouldn't be the default behavior (because if it were, Makefiles wouldn't work correctly).
You ... |
2586097 | what should be in .gitignore file for a netbeans java project? | 97 | 2010-04-06 15:29:08 | <p>What should be the content of the .gitignore file for a java project in netbeans?</p>
| 62,045 | 310,167 | 2011-10-10 20:45:44 | 2,586,365 | 66 | 2010-04-06 16:10:05 | 111,331 | 2010-04-06 16:10:05 | https://stackoverflow.com/q/2586097 | https://stackoverflow.com/a/2586365 | <p>There are a fair number of files that you probably do not need to commit into git, since they are built, are generated by NB or contain environment specific information.</p>
<p>If you create a project that uses Ant as the build mechanism, you usually end up with a directory tree that looks like this...</p>
<pre><c... | <p>There are a fair number of files that you probably do not need to commit into git, since they are built, are generated by NB or contain environment specific information.</p> <p>If you create a project that uses Ant as the build mechanism, you usually end up with a directory tree that looks like this...</p> <pre><c... | 119, 2176, 25056 | git, gitignore, netbeans | <h1>what should be in .gitignore file for a netbeans java project?</h1>
<p>What should be the content of the .gitignore file for a java project in netbeans?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,756 | git | # what should be in .gitignore file for a netbeans java project?
What should be the content of the .gitignore file for a java project in netbeans? | There are a fair number of files that you probably do not need to commit into git, since they are built, are generated by NB or contain environment specific information.
If you create a project that uses Ant as the build mechanism, you usually end up with a directory tree that looks like this...
```
project-root-dire... |
2281772 | How to view remote Git revision on Heroku | 93 | 2010-02-17 15:11:49 | <p>For deploying to Heroku, I use <code>git push heroku master</code>. But how do I see which revision I pushed up to heroku? (I'm often in doubt if I pushed the recent version up)</p>
<p>For those not familiar with it, Heroku's create script generates a remote git repository that you push to. Upon push, the code is d... | 70,025 | 109,305 | 2022-01-29 17:19:52 | 2,284,736 | 66 | 2010-02-17 22:03:19 | 94,830 | 2010-02-17 22:03:19 | https://stackoverflow.com/q/2281772 | https://stackoverflow.com/a/2284736 | <p>If you've just pushed and want to make sure you're up-to-date, then you can just run <code>git remote show heroku</code> and you'll see output similar to this:</p>
<pre><code>* remote heroku
Fetch URL: git@heroku.com:XXX.git
Push URL: git@heroku.com:XXX.git
HEAD branch: master
Remote branch:
master tra... | <p>If you've just pushed and want to make sure you're up-to-date, then you can just run <code>git remote show heroku</code> and you'll see output similar to this:</p> <pre><code>* remote heroku Fetch URL: git@heroku.com:XXX.git Push URL: git@heroku.com:XXX.git HEAD branch: master Remote branch: master tra... | 119, 8279, 41346 | git, git-remote, heroku | <h1>How to view remote Git revision on Heroku</h1>
<p>For deploying to Heroku, I use <code>git push heroku master</code>. But how do I see which revision I pushed up to heroku? (I'm often in doubt if I pushed the recent version up)</p>
<p>For those not familiar with it, Heroku's create script generates a remote git re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,757 | git | # How to view remote Git revision on Heroku
For deploying to Heroku, I use `git push heroku master`. But how do I see which revision I pushed up to heroku? (I'm often in doubt if I pushed the recent version up)
For those not familiar with it, Heroku's create script generates a remote git repository that you push to. ... | If you've just pushed and want to make sure you're up-to-date, then you can just run `git remote show heroku` and you'll see output similar to this:
```
* remote heroku
Fetch URL: git@heroku.com:XXX.git
Push URL: git@heroku.com:XXX.git
HEAD branch: master
Remote branch:
master tracked
Local ref configur... |
6866838 | what should be in the git description file? | 90 | 2011-07-28 23:06:55 | <p>After initialising a new local repo there is a <code>description</code> file present.</p>
<p>What is it used for and how should I format it? Or is it simply a local helper file.</p>
<p>This thread <a href="http://lists.gnu.org/archive/html/savannah-hackers/2009-03/msg00051.html">Accessing git's `description' file<... | 38,570 | 717,355 | 2018-01-19 05:02:53 | 6,866,883 | 66 | 2011-07-28 23:12:09 | 526,535 | 2017-02-06 14:35:08 | https://stackoverflow.com/q/6866838 | https://stackoverflow.com/a/6866883 | <p><code>description</code> file is only used by the GitWeb program ( to display the description of the repo on the GitWeb page)</p>
<p><a href="https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain" rel="noreferrer">https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain</a></p>
<p>Otherwis... | <p><code>description</code> file is only used by the GitWeb program ( to display the description of the repo on the GitWeb page)</p> <p><a href="https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain" rel="noreferrer">https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain</a></p> <p>Otherwis... | 119 | git | <h1>what should be in the git description file?</h1>
<p>After initialising a new local repo there is a <code>description</code> file present.</p>
<p>What is it used for and how should I format it? Or is it simply a local helper file.</p>
<p>This thread <a href="http://lists.gnu.org/archive/html/savannah-hackers/2009-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,758 | git | # what should be in the git description file?
After initialising a new local repo there is a `description` file present.
What is it used for and how should I format it? Or is it simply a local helper file.
This thread [Accessing git's `description' file](http://lists.gnu.org/archive/html/savannah-hackers/2009-03/msg... | `description` file is only used by the GitWeb program ( to display the description of the repo on the GitWeb page)
<https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain>
Otherwise, how you use it is left to you and I don't see a point in a "style" for it. |
9915543 | GIT list of new/modified/deleted files | 77 | 2012-03-28 20:58:04 | <p>Is there a way to get the list of all new/deleted/modified directories/files in a local/remote repository with relation to each other in Git?</p>
| 101,135 | 472,485 | 2024-01-17 08:11:16 | 10,733,765 | 66 | 2012-05-24 08:27:07 | 1,414,478 | 2023-02-19 20:12:39 | https://stackoverflow.com/q/9915543 | https://stackoverflow.com/a/10733765 | <p>The best way to list these file is using <code>git status --porcelain</code>.</p>
<p>For example:</p>
<pre><code>git status --porcelain | awk 'match($1, "D"){print $2}'
</code></pre>
<p>shows you the tracked files which have been deleted from the local copy. You can delete all these files by appending an ... | <p>The best way to list these file is using <code>git status --porcelain</code>.</p> <p>For example:</p> <pre><code>git status --porcelain | awk 'match($1, "D"){print $2}' </code></pre> <p>shows you the tracked files which have been deleted from the local copy. You can delete all these files by appending an ... | 119, 606, 5310, 5608 | diff, file, git, list | <h1>GIT list of new/modified/deleted files</h1>
<p>Is there a way to get the list of all new/deleted/modified directories/files in a local/remote repository with relation to each other in Git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,759 | git | # GIT list of new/modified/deleted files
Is there a way to get the list of all new/deleted/modified directories/files in a local/remote repository with relation to each other in Git? | The best way to list these file is using `git status --porcelain`.
For example:
```
git status --porcelain | awk 'match($1, "D"){print $2}'
```
shows you the tracked files which have been deleted from the local copy. You can delete all these files by appending an appropriate command to the pipe:
```
git status --po... |
27420165 | git rebase "deleted by us" and "deleted by them" | 75 | 2014-12-11 10:10:09 | <p>Suppose I am rebasing <strong>experiment</strong> branch on <strong>master</strong> and there are conflicts in files. And of course there are files deleted in both branches. So when I am resolving the conflicts, in <code>git status</code> I see <code>deleted by us</code> and <code>deleted by them</code>. Its very co... | 46,826 | 2,879,338 | 2018-06-28 12:01:09 | 27,424,658 | 66 | 2014-12-11 14:01:17 | 2,266,481 | 2018-05-14 19:08:13 | https://stackoverflow.com/q/27420165 | https://stackoverflow.com/a/27424658 | <h2>Reference documentation</h2>
<blockquote>
<p>Note that a rebase merge works by replaying each commit from the
working branch on top of the <code><upstream></code> branch. Because of this, when
a merge conflict happens, the side reported as ours is the so-far
rebased series, starting with <code><up... | <h2>Reference documentation</h2> <blockquote> <p>Note that a rebase merge works by replaying each commit from the working branch on top of the <code><upstream></code> branch. Because of this, when a merge conflict happens, the side reported as ours is the so-far rebased series, starting with <code><up... | 119, 29934 | git, git-rebase | <h1>git rebase "deleted by us" and "deleted by them"</h1>
<p>Suppose I am rebasing <strong>experiment</strong> branch on <strong>master</strong> and there are conflicts in files. And of course there are files deleted in both branches. So when I am resolving the conflicts, in <code>git status</code> I see <code>deleted ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,760 | git | # git rebase "deleted by us" and "deleted by them"
Suppose I am rebasing **experiment** branch on **master** and there are conflicts in files. And of course there are files deleted in both branches. So when I am resolving the conflicts, in `git status` I see `deleted by us` and `deleted by them`. Its very confusing. I... | ## Reference documentation
> Note that a rebase merge works by replaying each commit from the
> working branch on top of the `<upstream>` branch. Because of this, when
> a merge conflict happens, the side reported as ours is the so-far
> rebased series, starting with `<upstream>`, and theirs is the working
> branch. I... |
56262651 | git squash older commits (not last one) | 61 | 2019-05-22 18:10:03 | <p>I have a very messy git history. I want to squash a bunch of older commits (not including the last one).</p>
<p>I know how to squash my last <code>n</code> commits. But this is different. Here I have commits consecutively <code>n1</code> to <code>n2</code> which I want to squash into one, while after <code>n2</code... | 36,679 | 855,050 | 2024-01-17 10:45:35 | 56,262,851 | 66 | 2019-05-22 18:24:16 | 11,298,742 | 2019-05-23 07:54:15 | https://stackoverflow.com/q/56262651 | https://stackoverflow.com/a/56262851 | <p>You can do an interactive rebase, per <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing" rel="noreferrer">the docs</a> and <a href="https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history#squash-commits-together" rel="noreferrer">this blog post</a>.</p>
<ol>
<l... | <p>You can do an interactive rebase, per <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing" rel="noreferrer">the docs</a> and <a href="https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history#squash-commits-together" rel="noreferrer">this blog post</a>.</p> <ol> <l... | 119, 29934 | git, git-rebase | <h1>git squash older commits (not last one)</h1>
<p>I have a very messy git history. I want to squash a bunch of older commits (not including the last one).</p>
<p>I know how to squash my last <code>n</code> commits. But this is different. Here I have commits consecutively <code>n1</code> to <code>n2</code> which I wa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,762 | git | # git squash older commits (not last one)
I have a very messy git history. I want to squash a bunch of older commits (not including the last one).
I know how to squash my last `n` commits. But this is different. Here I have commits consecutively `n1` to `n2` which I want to squash into one, while after `n2` I have a ... | You can do an interactive rebase, per [the docs](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing) and [this blog post](https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history#squash-commits-together).
1. Start an interactive rebase:
```
git rebase -i HEAD~n
```... |
14370157 | Git fetch a specific commit by hash | 54 | 2013-01-17 00:07:01 | <p>Git allows to fetch from any given remote and reference, for example</p>
<pre><code>git fetch <remote-url> <reference>
</code></pre>
<p>So that those given commits are available without having to add remotes or creating branches.</p>
<p>This however only works for references, like branch names or tags... | 35,990 | 214,373 | 2024-05-09 20:58:46 | 62,463,160 | 66 | 2020-06-19 04:15:02 | 1,797,950 | 2020-11-03 07:52:44 | https://stackoverflow.com/q/14370157 | https://stackoverflow.com/a/62463160 | <p>As today I tried:</p>
<pre><code>git fetch origin <commit-hash>
</code></pre>
<p>And it works like a charm! (git version 2.20.1)</p>
<p>Just be sure the <code><commit-hash></code> is the full length reference</p>
| <p>As today I tried:</p> <pre><code>git fetch origin <commit-hash> </code></pre> <p>And it works like a charm! (git version 2.20.1)</p> <p>Just be sure the <code><commit-hash></code> is the full length reference</p> | 119 | git | <h1>Git fetch a specific commit by hash</h1>
<p>Git allows to fetch from any given remote and reference, for example</p>
<pre><code>git fetch <remote-url> <reference>
</code></pre>
<p>So that those given commits are available without having to add remotes or creating branches.</p>
<p>This however only wo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,764 | git | # Git fetch a specific commit by hash
Git allows to fetch from any given remote and reference, for example
```
git fetch <remote-url> <reference>
```
So that those given commits are available without having to add remotes or creating branches.
This however only works for references, like branch names or tags, but n... | As today I tried:
```
git fetch origin <commit-hash>
```
And it works like a charm! (git version 2.20.1)
Just be sure the `<commit-hash>` is the full length reference |
47199828 | How to convert a file tracked by git to git-lfs? | 51 | 2017-11-09 10:46:08 | <p>How do I convert a single file (e.g. a png) which is already committed as a regular object to git-lfs?</p>
<p>I do not want to migrate the whole repo and I also do not want to rewrite the history of the repo.</p>
| 50,478 | 80,480 | 2021-03-22 10:23:46 | 47,200,501 | 66 | 2017-11-09 11:19:07 | 729,881 | 2017-11-09 11:19:07 | https://stackoverflow.com/q/47199828 | https://stackoverflow.com/a/47200501 | <p><code>git lfs track</code> will begin tracking a new file <em>or</em> an existing file that is already checked in to your repository. When you run <code>git lfs track</code> and then commit that change, it will update the file, replacing it with the LFS pointer contents.</p>
<p>Here I have a repository with a PNG ... | <p><code>git lfs track</code> will begin tracking a new file <em>or</em> an existing file that is already checked in to your repository. When you run <code>git lfs track</code> and then commit that change, it will update the file, replacing it with the LFS pointer contents.</p> <p>Here I have a repository with a PNG ... | 119, 456, 115244 | git, git-lfs, version-control | <h1>How to convert a file tracked by git to git-lfs?</h1>
<p>How do I convert a single file (e.g. a png) which is already committed as a regular object to git-lfs?</p>
<p>I do not want to migrate the whole repo and I also do not want to rewrite the history of the repo.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,765 | git | # How to convert a file tracked by git to git-lfs?
How do I convert a single file (e.g. a png) which is already committed as a regular object to git-lfs?
I do not want to migrate the whole repo and I also do not want to rewrite the history of the repo. | `git lfs track` will begin tracking a new file *or* an existing file that is already checked in to your repository. When you run `git lfs track` and then commit that change, it will update the file, replacing it with the LFS pointer contents.
Here I have a repository with a PNG checked in "normally" (without using LFS... |
28578581 | How to completely clear git repository, without deleting it | 51 | 2015-02-18 07:52:10 | <p>How can I remove all files and folders that I'm storing on git repo, but keep the repository? Is there some command for restarting git repo?
I've found many examples on this, but I've made even bigger mess. The repository is linked. So if someone is willing to explain it to me step by step I would be very thankful.<... | 126,067 | 3,265,282 | 2025-12-21 19:22:14 | 28,578,674 | 66 | 2015-02-18 07:58:17 | 2,082,964 | 2015-02-18 08:59:27 | https://stackoverflow.com/q/28578581 | https://stackoverflow.com/a/28578674 | <p><strong>if you only have a local git repository</strong></p>
<p>if you want to erase your whole history and start over again:</p>
<pre><code>cd <repo>
rm -rf .git
git init
</code></pre>
<p>and start committing again.</p>
<p>If you want to remove both files and history:</p>
<pre><code>cd <repo>
rm -r... | <p><strong>if you only have a local git repository</strong></p> <p>if you want to erase your whole history and start over again:</p> <pre><code>cd <repo> rm -rf .git git init </code></pre> <p>and start committing again.</p> <p>If you want to remove both files and history:</p> <pre><code>cd <repo> rm -r... | 119 | git | <h1>How to completely clear git repository, without deleting it</h1>
<p>How can I remove all files and folders that I'm storing on git repo, but keep the repository? Is there some command for restarting git repo?
I've found many examples on this, but I've made even bigger mess. The repository is linked. So if someone i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,766 | git | # How to completely clear git repository, without deleting it
How can I remove all files and folders that I'm storing on git repo, but keep the repository? Is there some command for restarting git repo?
I've found many examples on this, but I've made even bigger mess. The repository is linked. So if someone is willing... | **if you only have a local git repository**
if you want to erase your whole history and start over again:
```
cd <repo>
rm -rf .git
git init
```
and start committing again.
If you want to remove both files and history:
```
cd <repo>
rm -rf *
git init
```
and start adding files and committing...
**if you are link... |
2541545 | Is there a difference between "git reset --hard hash" and "git checkout hash"? | 50 | 2010-03-29 21:55:02 | <p>While <code>reset</code> and <code>checkout</code> have different usages most of the time, I can't see what difference there is between these two.</p>
<p>There probably is one or nobody would have bothered adding a <code>--hard</code> option to do something the basic <code>checkout</code> can do.</p>
<p>Maybe ther... | 21,914 | 9,951 | 2019-07-09 07:03:48 | 2,541,617 | 66 | 2010-03-29 22:10:19 | 119,963 | 2010-03-29 22:10:19 | https://stackoverflow.com/q/2541545 | https://stackoverflow.com/a/2541617 | <p>This answer is mostly quoted from my answer to a previous question: <a href="https://stackoverflow.com/questions/2530060/can-you-explain-to-me-git-reset-in-plain-english">git reset in plain english</a>.</p>
<p>The two are very different. They result in the same state for your index and work tree, but the resulting ... | <p>This answer is mostly quoted from my answer to a previous question: <a href="https://stackoverflow.com/questions/2530060/can-you-explain-to-me-git-reset-in-plain-english">git reset in plain english</a>.</p> <p>The two are very different. They result in the same state for your index and work tree, but the resulting ... | 119, 37230, 51381 | git, git-checkout, git-reset | <h1>Is there a difference between "git reset --hard hash" and "git checkout hash"?</h1>
<p>While <code>reset</code> and <code>checkout</code> have different usages most of the time, I can't see what difference there is between these two.</p>
<p>There probably is one or nobody would have bothered adding a <code>--hard<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,767 | git | # Is there a difference between "git reset --hard hash" and "git checkout hash"?
While `reset` and `checkout` have different usages most of the time, I can't see what difference there is between these two.
There probably is one or nobody would have bothered adding a `--hard` option to do something the basic `checkout... | This answer is mostly quoted from my answer to a previous question: [git reset in plain english](https://stackoverflow.com/questions/2530060/can-you-explain-to-me-git-reset-in-plain-english).
The two are very different. They result in the same state for your index and work tree, but the resulting history and current b... |
13204910 | GIT pulling or cloning repository only gets Master branch | 49 | 2012-11-03 00:42:41 | <p>I host on BitBucket when I <code>git clone</code> a repository or use <code>git pull origin master</code> and <code>git pull origin myBranch</code> it does pull second time, but when I list branches with <code>git branch -v</code> I only see <strong>master</strong>. Doing <code>git status</code> shows nothing too.</... | 58,016 | 969,792 | 2021-09-12 12:20:32 | 13,204,972 | 66 | 2012-11-03 00:54:46 | 631,619 | 2021-09-12 12:20:32 | https://stackoverflow.com/q/13204910 | https://stackoverflow.com/a/13204972 | <h3>The branches do exist but you can't see them</h3>
<p>Try using this:</p>
<pre><code>git branch -a
</code></pre>
<p>You'll now see the list of remote branches in <code>origin</code> e.g.</p>
<p>Output:</p>
<pre><code>remotes/origin/tk_removes_call_centers
remotes/origin/tk_warm_transfer_fix
remotes/origin/update_REA... | <h3>The branches do exist but you can't see them</h3> <p>Try using this:</p> <pre><code>git branch -a </code></pre> <p>You'll now see the list of remote branches in <code>origin</code> e.g.</p> <p>Output:</p> <pre><code>remotes/origin/tk_removes_call_centers remotes/origin/tk_warm_transfer_fix remotes/origin/update_REA... | 119, 3050, 4860, 8337 | bitbucket, clone, git, pull | <h1>GIT pulling or cloning repository only gets Master branch</h1>
<p>I host on BitBucket when I <code>git clone</code> a repository or use <code>git pull origin master</code> and <code>git pull origin myBranch</code> it does pull second time, but when I list branches with <code>git branch -v</code> I only see <strong>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,768 | git | # GIT pulling or cloning repository only gets Master branch
I host on BitBucket when I `git clone` a repository or use `git pull origin master` and `git pull origin myBranch` it does pull second time, but when I list branches with `git branch -v` I only see **master**. Doing `git status` shows nothing too.
How do I p... | ### The branches do exist but you can't see them
Try using this:
```
git branch -a
```
You'll now see the list of remote branches in `origin` e.g.
Output:
```
remotes/origin/tk_removes_call_centers
remotes/origin/tk_warm_transfer_fix
remotes/origin/update_README
```
and you can then
```
git checkout [any_individ... |
7274697 | how do I pull to a bare repository? | 48 | 2011-09-01 18:23:36 | <p>I have a "main" bare repository and a "personal" bare repository. I want to update changes form "main" to "personal", so I run:</p>
<pre><code>$ git pull
fatal: /home/gimenero/applib/git/libexec/git-core/git-pull cannot be used without a working tree.
</code></pre>
<p>How do I pull the changes pushed to "main"?</p... | 26,880 | 104,104 | 2019-01-24 01:37:04 | 7,274,764 | 66 | 2011-09-01 18:28:54 | 189,179 | 2011-09-01 18:40:30 | https://stackoverflow.com/q/7274697 | https://stackoverflow.com/a/7274764 | <p>A <code>git pull</code> does a <code>fetch</code> followed by a <code>merge</code>, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)</p>
<p>Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on you... | <p>A <code>git pull</code> does a <code>fetch</code> followed by a <code>merge</code>, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)</p> <p>Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on you... | 119 | git | <h1>how do I pull to a bare repository?</h1>
<p>I have a "main" bare repository and a "personal" bare repository. I want to update changes form "main" to "personal", so I run:</p>
<pre><code>$ git pull
fatal: /home/gimenero/applib/git/libexec/git-core/git-pull cannot be used without a working tree.
</code></pre>
<p>H... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,770 | git | # how do I pull to a bare repository?
I have a "main" bare repository and a "personal" bare repository. I want to update changes form "main" to "personal", so I run:
```
$ git pull
fatal: /home/gimenero/applib/git/libexec/git-core/git-pull cannot be used without a working tree.
```
How do I pull the changes pushed t... | A `git pull` does a `fetch` followed by a `merge`, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)
Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on your personal repository:
```
$ git fetch ori... |
29316225 | why should I delete feature branches when merged to master | 43 | 2015-03-28 10:47:42 | <p>Most of the git workflows I've seen suggest to delete a <code>branch</code> after it's been merged into master. For example, this <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">gitflow</a> suggests the following:</p>
<pre><code># Incorporating a finished feature on develop
$ git... | 12,148 | 2,545,680 | 2018-06-17 00:22:04 | 29,319,178 | 66 | 2015-03-28 15:52:41 | 14,660 | 2015-03-28 15:52:41 | https://stackoverflow.com/q/29316225 | https://stackoverflow.com/a/29319178 | <p>Something important to realize is Git branches are nothing more than a label pointing to a commit. Branching in Git is literally branching. Here's what a repository looks like if <code>feature</code> branched off <code>master</code> when <code>master</code> was a commit B.</p>
<pre><code>A - B - C - F - H [master... | <p>Something important to realize is Git branches are nothing more than a label pointing to a commit. Branching in Git is literally branching. Here's what a repository looks like if <code>feature</code> branched off <code>master</code> when <code>master</code> was a commit B.</p> <pre><code>A - B - C - F - H [master... | 119, 64339 | git, git-flow | <h1>why should I delete feature branches when merged to master</h1>
<p>Most of the git workflows I've seen suggest to delete a <code>branch</code> after it's been merged into master. For example, this <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">gitflow</a> suggests the following:<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,772 | git | # why should I delete feature branches when merged to master
Most of the git workflows I've seen suggest to delete a `branch` after it's been merged into master. For example, this [gitflow](http://nvie.com/posts/a-successful-git-branching-model/) suggests the following:
```
# Incorporating a finished feature on devel... | Something important to realize is Git branches are nothing more than a label pointing to a commit. Branching in Git is literally branching. Here's what a repository looks like if `feature` branched off `master` when `master` was a commit B.
```
A - B - C - F - H [master]
\
D - E - G - I[feature]
```
See? A... |
17223326 | Git Plugin for Oh-My-ZSH broken after Updating Git | 39 | 2013-06-20 20:37:31 | <p>I was using the system version of git and then updated to the latest version using homebrew. After doing so, all the git shortcuts provided by the oh-my-zsh git plugin stopped working. I tried reinstalling oh-my-zsh but don't really know what else to do.</p>
<p>The only other thing I've changed is that I recently i... | 42,161 | 1,861,076 | 2019-05-05 06:02:06 | 17,227,521 | 66 | 2013-06-21 04:04:30 | 1,084,945 | 2013-06-21 04:04:30 | https://stackoverflow.com/q/17223326 | https://stackoverflow.com/a/17227521 | <p>From the comments, the <code>oh-my-zsh</code> plugin containing the <code>git</code> aliases isn't being sourced. </p>
<p>To do fix this, you can either:</p>
<ol>
<li>Directly source the plugin by adding <code>source ~/.oh-my-zsh/plugins/git/git.plugin.zsh</code> to your <code>~/.zshrc</code>, </li>
<li>Enable the... | <p>From the comments, the <code>oh-my-zsh</code> plugin containing the <code>git</code> aliases isn't being sourced. </p> <p>To do fix this, you can either:</p> <ol> <li>Directly source the plugin by adding <code>source ~/.oh-my-zsh/plugins/git/git.plugin.zsh</code> to your <code>~/.zshrc</code>, </li> <li>Enable the... | 119, 1067, 3791, 28566 | git, homebrew, zsh, zshrc | <h1>Git Plugin for Oh-My-ZSH broken after Updating Git</h1>
<p>I was using the system version of git and then updated to the latest version using homebrew. After doing so, all the git shortcuts provided by the oh-my-zsh git plugin stopped working. I tried reinstalling oh-my-zsh but don't really know what else to do.</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,773 | git | # Git Plugin for Oh-My-ZSH broken after Updating Git
I was using the system version of git and then updated to the latest version using homebrew. After doing so, all the git shortcuts provided by the oh-my-zsh git plugin stopped working. I tried reinstalling oh-my-zsh but don't really know what else to do.
The only o... | From the comments, the `oh-my-zsh` plugin containing the `git` aliases isn't being sourced.
To do fix this, you can either:
1. Directly source the plugin by adding `source ~/.oh-my-zsh/plugins/git/git.plugin.zsh` to your `~/.zshrc`,
2. Enable the plugin the canonical way: by adding `git` to the `plugins=(...)` line i... |
39703569 | Conflict on bitbucket remote server but everything is up to date locally | 36 | 2016-09-26 12:59:41 | <p>I'm working on a project, so I pushed a feature branch to the remote repository(using Atlassian bitbucket) and opened a pull request.</p>
<p>But on one file, the bitbucket diplay a "MOVED" status, in brown and shows a conflict message :</p>
<blockquote>
<p>conflict: modified on source, modified in target.<... | 48,676 | 5,355,776 | 2024-07-28 19:11:27 | 44,822,973 | 66 | 2017-06-29 10:43:33 | 2,579,930 | 2021-01-14 06:05:20 | https://stackoverflow.com/q/39703569 | https://stackoverflow.com/a/44822973 | <p>You need to update your local master branch. Do the following steps:</p>
<ul>
<li><code>git checkout master</code></li>
<li><code>git pull origin master</code></li>
<li><code>git checkout << your branch >></code></li>
<li><code>git merge master</code></li>
</ul>
<p>After you execute the 4th command, you ... | <p>You need to update your local master branch. Do the following steps:</p> <ul> <li><code>git checkout master</code></li> <li><code>git pull origin master</code></li> <li><code>git checkout << your branch >></code></li> <li><code>git merge master</code></li> </ul> <p>After you execute the 4th command, you ... | 119, 3146, 83703 | bitbucket-server, conflict, git | <h1>Conflict on bitbucket remote server but everything is up to date locally</h1>
<p>I'm working on a project, so I pushed a feature branch to the remote repository(using Atlassian bitbucket) and opened a pull request.</p>
<p>But on one file, the bitbucket diplay a "MOVED" status, in brown and shows a conflic... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,776 | git | # Conflict on bitbucket remote server but everything is up to date locally
I'm working on a project, so I pushed a feature branch to the remote repository(using Atlassian bitbucket) and opened a pull request.
But on one file, the bitbucket diplay a "MOVED" status, in brown and shows a conflict message :
> conflict: ... | You need to update your local master branch. Do the following steps:
- `git checkout master`
- `git pull origin master`
- `git checkout << your branch >>`
- `git merge master`
After you execute the 4th command, you will get merge conflicts. Resolve them and then do:
- `git commit` |
17916101 | How many lines of code differs between two commits or two branches? | 35 | 2013-07-29 04:33:47 | <p>I want to know how many lines of code I changed between two different commits. My purpose is to understand how many lines of code I've written today but my abstract idea is to understand how many lines of code I've write from a moment to another one. Can someone help me for this stuff?</p>
| 12,672 | 1,420,625 | 2017-10-09 20:31:31 | 17,916,132 | 66 | 2013-07-29 04:36:58 | 762,073 | 2013-07-29 04:36:58 | https://stackoverflow.com/q/17916101 | https://stackoverflow.com/a/17916132 | <p><code>--shortstat</code> is what you want:</p>
<pre><code>git diff --shortstat commit1 commit2
</code></pre>
<p>You could also use it like:</p>
<pre><code>git diff --shortstat "@{1 day ago}"
</code></pre>
| <p><code>--shortstat</code> is what you want:</p> <pre><code>git diff --shortstat commit1 commit2 </code></pre> <p>You could also use it like:</p> <pre><code>git diff --shortstat "@{1 day ago}" </code></pre> | 119 | git | <h1>How many lines of code differs between two commits or two branches?</h1>
<p>I want to know how many lines of code I changed between two different commits. My purpose is to understand how many lines of code I've written today but my abstract idea is to understand how many lines of code I've write from a moment to a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,777 | git | # How many lines of code differs between two commits or two branches?
I want to know how many lines of code I changed between two different commits. My purpose is to understand how many lines of code I've written today but my abstract idea is to understand how many lines of code I've write from a moment to another one... | `--shortstat` is what you want:
```
git diff --shortstat commit1 commit2
```
You could also use it like:
```
git diff --shortstat "@{1 day ago}"
``` |
18595305 | Git log outputs in a specific revision range | 33 | 2013-09-03 14:49:17 | <p>Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.</p>
<p>I tried to write it with this line :</p>
<pre><code>git -dir=/home/Desktop/GIT_REFERENCE_REPOSITORIES/manager.git log 10000...15000
</code></pre>
<p>I assumed it gives me the l... | 41,663 | 2,653,020 | 2015-11-09 16:52:14 | 18,595,347 | 66 | 2013-09-03 14:51:18 | 520,162 | 2015-11-09 16:52:14 | https://stackoverflow.com/q/18595305 | https://stackoverflow.com/a/18595347 | <p>A revision is specified by its SHA1 hash.</p>
<p>If you want to see commits for specific files, you have to separate paths with <code>--</code>:</p>
<pre><code>git log oldhash..newhash -- path/to/inspect
</code></pre>
<p>does this.</p>
<p>Also note that you are using three dots (<code>...</code>) to specify the ... | <p>A revision is specified by its SHA1 hash.</p> <p>If you want to see commits for specific files, you have to separate paths with <code>--</code>:</p> <pre><code>git log oldhash..newhash -- path/to/inspect </code></pre> <p>does this.</p> <p>Also note that you are using three dots (<code>...</code>) to specify the ... | 119, 47913 | git, git-log | <h1>Git log outputs in a specific revision range</h1>
<p>Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.</p>
<p>I tried to write it with this line :</p>
<pre><code>git -dir=/home/Desktop/GIT_REFERENCE_REPOSITORIES/manager.git log 10000... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,778 | git | # Git log outputs in a specific revision range
Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.
I tried to write it with this line :
```
git -dir=/home/Desktop/GIT_REFERENCE_REPOSITORIES/manager.git log 10000...15000
```
I assumed it ... | A revision is specified by its SHA1 hash.
If you want to see commits for specific files, you have to separate paths with `--`:
```
git log oldhash..newhash -- path/to/inspect
```
does this.
Also note that you are using three dots (`...`) to specify the range. **Usually, you only want two dots**.
Three dots might n... |
26354472 | How can I get user's location without asking for the permission or if user permitted once so need not to ask ever again? | 32 | 2014-10-14 06:59:01 | <p>I am creating a portal using MySQL, JavaScript and Ajax and I want to fetch user's location in terms of latitude and longitude. if it is not possible to fetch the location without asking then once user grant the permission, I could fetch the location from any page without asking ever again.</p>
<p>Thanks in Advance... | 98,360 | null | 2023-01-03 10:47:17 | 26,354,847 | 66 | 2014-10-14 07:20:04 | 1,776,731 | 2018-12-19 14:32:57 | https://stackoverflow.com/q/26354472 | https://stackoverflow.com/a/26354847 | <p>3 ways to do this in this answer:</p>
<ol>
<li>Get a GPS precise location asking the user to allow access to its browser's API</li>
<li>Get an approximate location (country, city, area) using an external GeoIP service</li>
<li>Get an approximate location (country, city, area) using CDN service</li>
</ol>
<hr>
<h2... | <p>3 ways to do this in this answer:</p> <ol> <li>Get a GPS precise location asking the user to allow access to its browser's API</li> <li>Get an approximate location (country, city, area) using an external GeoIP service</li> <li>Get an approximate location (country, city, area) using CDN service</li> </ol> <hr> <h2... | 3, 5, 20301 | javascript, latitude-longitude, php | <h1>How can I get user's location without asking for the permission or if user permitted once so need not to ask ever again?</h1>
<p>I am creating a portal using MySQL, JavaScript and Ajax and I want to fetch user's location in terms of latitude and longitude. if it is not possible to fetch the location without asking ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,779 | git | # How can I get user's location without asking for the permission or if user permitted once so need not to ask ever again?
I am creating a portal using MySQL, JavaScript and Ajax and I want to fetch user's location in terms of latitude and longitude. if it is not possible to fetch the location without asking then once... | 3 ways to do this in this answer:
1. Get a GPS precise location asking the user to allow access to its browser's API
2. Get an approximate location (country, city, area) using an external GeoIP service
3. Get an approximate location (country, city, area) using CDN service
---
## Ask the user to allow access to its b... |
28483253 | ImportError: No module named git after reformatting laptop | 29 | 2015-02-12 16:54:51 | <p>My laptop has been formatted and a new OS was installed, and since then I have gotten this error:</p>
<pre><code>ImportError: No module named git
</code></pre>
<p>This refers to a Python code that simply imports git.</p>
<p>Location of git before my laptop was formatted: <code>/usr/local/bin/git</code>
Location of g... | 63,590 | 2,458,372 | 2024-02-28 14:57:15 | 28,483,318 | 66 | 2015-02-12 16:57:48 | 100,297 | 2016-12-22 09:42:50 | https://stackoverflow.com/q/28483253 | https://stackoverflow.com/a/28483318 | <p>The <code>git</code> module is <em>not the same thing</em> as the <code>git</code> command line executable. They happen to have the same name and cover related tasks, but they are distinct software packages.</p>
<p>I'm going to assume that the <code>git</code> module your code is importing is the one provided by th... | <p>The <code>git</code> module is <em>not the same thing</em> as the <code>git</code> command line executable. They happen to have the same name and cover related tasks, but they are distinct software packages.</p> <p>I'm going to assume that the <code>git</code> module your code is importing is the one provided by th... | 16, 119, 61013 | git, gitpython, python | <h1>ImportError: No module named git after reformatting laptop</h1>
<p>My laptop has been formatted and a new OS was installed, and since then I have gotten this error:</p>
<pre><code>ImportError: No module named git
</code></pre>
<p>This refers to a Python code that simply imports git.</p>
<p>Location of git before my... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,780 | git | # ImportError: No module named git after reformatting laptop
My laptop has been formatted and a new OS was installed, and since then I have gotten this error:
```
ImportError: No module named git
```
This refers to a Python code that simply imports git.
Location of git before my laptop was formatted: `/usr/local/bi... | The `git` module is *not the same thing* as the `git` command line executable. They happen to have the same name and cover related tasks, but they are distinct software packages.
I'm going to assume that the `git` module your code is importing is the one provided by the [GitPython project](http://gitpython.readthedocs... |
27340513 | How can I commit files currently displayed in Vim with fugitive? | 25 | 2014-12-07 07:05:35 | <p>I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that?</p>
| 14,951 | 4,008,283 | 2022-03-09 09:31:47 | 27,341,232 | 66 | 2014-12-07 09:12:14 | 438,329 | 2022-03-09 09:31:47 | https://stackoverflow.com/q/27340513 | https://stackoverflow.com/a/27341232 | <p>There are a few ways to accomplish this task. I will outline the most interactive method which uses <code>:Git</code>.</p>
<ul>
<li>Open up the status window via <code>:Git</code></li>
<li>Move between files via <code><c-n></code>/<code><c-p></code></li>
<li>Stage/unstage files via <code>-</code></li>
<l... | <p>There are a few ways to accomplish this task. I will outline the most interactive method which uses <code>:Git</code>.</p> <ul> <li>Open up the status window via <code>:Git</code></li> <li>Move between files via <code><c-n></code>/<code><c-p></code></li> <li>Stage/unstage files via <code>-</code></li> <l... | 119, 370, 88389 | git, vim, vim-fugitive | <h1>How can I commit files currently displayed in Vim with fugitive?</h1>
<p>I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,782 | git | # How can I commit files currently displayed in Vim with fugitive?
I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that? | There are a few ways to accomplish this task. I will outline the most interactive method which uses `:Git`.
- Open up the status window via `:Git`
- Move between files via `<c-n>`/`<c-p>`
- Stage/unstage files via `-`
- Start committing via `cc` whilst in the status window
- Create commit message and save and close wi... |
1365541 | How to move some files from one git repo to another (not a clone), preserving history | 682 | 2009-09-02 02:04:31 | <p>Our Git repositories started out as parts of a single monster SVN repository where the individual projects each had their own tree like so:</p>
<pre><code>project1/branches
/tags
/trunk
project2/branches
/tags
/trunk
</code></pre>
<p>Obviously, it was pretty easy to move files from on... | 339,131 | 150,032 | 2024-02-06 01:05:25 | 1,365,990 | 65 | 2009-09-02 05:38:50 | 119,963 | 2015-10-10 08:11:27 | https://stackoverflow.com/q/1365541 | https://stackoverflow.com/a/1365990 | <p>Yep, hitting on the <code>--subdirectory-filter</code> of <code>filter-branch</code> was key. The fact that you used it essentially proves there's no easier way - you had no choice but to rewrite history, since you wanted to end up with only a (renamed) subset of the files, and this by definition changes the hashes.... | <p>Yep, hitting on the <code>--subdirectory-filter</code> of <code>filter-branch</code> was key. The fact that you used it essentially proves there's no easier way - you had no choice but to rewrite history, since you wanted to end up with only a (renamed) subset of the files, and this by definition changes the hashes.... | 119, 7330 | git, repository | <h1>How to move some files from one git repo to another (not a clone), preserving history</h1>
<p>Our Git repositories started out as parts of a single monster SVN repository where the individual projects each had their own tree like so:</p>
<pre><code>project1/branches
/tags
/trunk
project2/branches
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,784 | git | # How to move some files from one git repo to another (not a clone), preserving history
Our Git repositories started out as parts of a single monster SVN repository where the individual projects each had their own tree like so:
```
project1/branches
/tags
/trunk
project2/branches
/tags
... | Yep, hitting on the `--subdirectory-filter` of `filter-branch` was key. The fact that you used it essentially proves there's no easier way - you had no choice but to rewrite history, since you wanted to end up with only a (renamed) subset of the files, and this by definition changes the hashes. Since none of the standa... |
4061481 | How do you push a Git tag to a branch using a refspec? | 217 | 2010-10-31 01:39:35 | <p>I want to force push, for example, my tag <code>1.0.0</code> to my remote <code>master</code> branch.</p>
<p>I'm now doing the following:</p>
<pre><code>git push production +1.0.0:master
</code></pre>
<p><strong><em>I want to force the push</em></strong>, because all I care about is that the code inside the <code... | 138,996 | 365,897 | 2014-07-30 19:04:48 | 4,061,542 | 65 | 2010-10-31 02:08:50 | 193,688 | 2013-07-15 19:45:49 | https://stackoverflow.com/q/4061481 | https://stackoverflow.com/a/4061542 | <p>It is probably failing because <code>1.0.0</code> is an annotated tag. Perhaps you saw the following error message:</p>
<blockquote>
<p>error: Trying to write non-commit object to branch refs/heads/master</p>
</blockquote>
<p>Annotated tags have their own distinct type of object that points to the tagged commit... | <p>It is probably failing because <code>1.0.0</code> is an annotated tag. Perhaps you saw the following error message:</p> <blockquote> <p>error: Trying to write non-commit object to branch refs/heads/master</p> </blockquote> <p>Annotated tags have their own distinct type of object that points to the tagged commit... | 119, 28898, 60718 | git, git-push, git-tag | <h1>How do you push a Git tag to a branch using a refspec?</h1>
<p>I want to force push, for example, my tag <code>1.0.0</code> to my remote <code>master</code> branch.</p>
<p>I'm now doing the following:</p>
<pre><code>git push production +1.0.0:master
</code></pre>
<p><strong><em>I want to force the push</em></str... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,785 | git | # How do you push a Git tag to a branch using a refspec?
I want to force push, for example, my tag `1.0.0` to my remote `master` branch.
I'm now doing the following:
```
git push production +1.0.0:master
```
***I want to force the push***, because all I care about is that the code inside the `1.0.0` tag is pushed t... | It is probably failing because `1.0.0` is an annotated tag. Perhaps you saw the following error message:
> error: Trying to write non-commit object to branch refs/heads/master
Annotated tags have their own distinct type of object that points to the tagged commit object. Branches can not usefully point to tag objects,... |
266395 | git-svn: how do I create a new svn branch via git? | 198 | 2008-11-05 19:54:48 | <p>I have a git repository which tracks an svn repository. I cloned it using <code>--stdlayout</code>.</p>
<p>I created a new local branch via <code>git checkout -b foobar</code></p>
<p>Now I want this branch to end up in <code>…/branches/foobar</code> in the svn repository.</p>
<p>How do I go about that?</p>
<p>(s... | 50,679 | 13,989 | 2010-12-05 22:30:16 | 266,561 | 65 | 2008-11-05 20:36:59 | 13,989 | 2009-01-01 14:05:04 | https://stackoverflow.com/q/266395 | https://stackoverflow.com/a/266561 | <p>as of git v1.6.1, <code>git svn branch</code> is available.</p>
<p>From the git docs:</p>
<pre>
branch
Create a branch in the SVN repository.
-m, --message
Allows to specify the commit message.
-t, --tag
Create a tag by using the tags_subdir instead of the bran... | <p>as of git v1.6.1, <code>git svn branch</code> is available.</p> <p>From the git docs:</p> <pre> branch Create a branch in the SVN repository. -m, --message Allows to specify the commit message. -t, --tag Create a tag by using the tags_subdir instead of the bran... | 119, 456, 6452 | git, git-svn, version-control | <h1>git-svn: how do I create a new svn branch via git?</h1>
<p>I have a git repository which tracks an svn repository. I cloned it using <code>--stdlayout</code>.</p>
<p>I created a new local branch via <code>git checkout -b foobar</code></p>
<p>Now I want this branch to end up in <code>…/branches/foobar</code> in th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,786 | git | # git-svn: how do I create a new svn branch via git?
I have a git repository which tracks an svn repository. I cloned it using `--stdlayout`.
I created a new local branch via `git checkout -b foobar`
Now I want this branch to end up in `…/branches/foobar` in the svn repository.
How do I go about that?
(snipped lot... | as of git v1.6.1, `git svn branch` is available.
From the git docs:
```
branch
Create a branch in the SVN repository.
-m, --message
Allows to specify the commit message.
-t, --tag
Create a tag by using the tags_subdir instead of the branches_subdir
spe... |
4479960 | Checkout to a specific folder | 185 | 2010-12-18 20:17:44 | <p>I want to use something similar to:</p>
<pre><code>git checkout -- <path>/<file>
</code></pre>
<p>but I want to checkout the file to some folder I choose, rather than the overwriting the local <code><path>/<file></code>.</p>
<p>Any idea?</p>
| 261,240 | 196,697 | 2024-06-12 06:51:01 | 4,482,919 | 65 | 2010-12-19 12:26:49 | 35,364 | 2010-12-19 12:26:49 | https://stackoverflow.com/q/4479960 | https://stackoverflow.com/a/4482919 | <p>As per <a href="https://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export/160719#160719">Do a "git export" (like "svn export")?</a></p>
<p>You can use <code>git checkout-index</code> for that, this is a low level command, if you want to export everything, you can use <cod... | <p>As per <a href="https://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export/160719#160719">Do a "git export" (like "svn export")?</a></p> <p>You can use <code>git checkout-index</code> for that, this is a low level command, if you want to export everything, you can use <cod... | 119 | git | <h1>Checkout to a specific folder</h1>
<p>I want to use something similar to:</p>
<pre><code>git checkout -- <path>/<file>
</code></pre>
<p>but I want to checkout the file to some folder I choose, rather than the overwriting the local <code><path>/<file></code>.</p>
<p>Any idea?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,787 | git | # Checkout to a specific folder
I want to use something similar to:
```
git checkout -- <path>/<file>
```
but I want to checkout the file to some folder I choose, rather than the overwriting the local `<path>/<file>`.
Any idea? | As per [Do a "git export" (like "svn export")?](https://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export/160719#160719)
You can use `git checkout-index` for that, this is a low level command, if you want to export everything, you can use `-a`,
```
git checkout-index -a -f --prefix=/destinatio... |
19937580 | Can't pop git stash, 'Your local changes to the following files would be overwritten by merge' | 105 | 2013-11-12 18:55:03 | <p>So I had a load of changes and some untracked files. I needed to tweak something, so I used <code>git stash -u</code>, modified a couple of things, committed those changes, pushed them, and then tried to <code>git stash pop</code>.</p>
<p>Because I'd modified a couple of files that I'd stashed, I got the following ... | 63,619 | 319,618 | 2022-09-24 11:45:35 | 19,953,563 | 65 | 2013-11-13 12:15:46 | 319,618 | 2013-11-13 12:15:46 | https://stackoverflow.com/q/19937580 | https://stackoverflow.com/a/19953563 | <p>I got around this, I think it must have been some kind of bug, as my working directory was clean and up to date.</p>
<p>I ran <code>git checkout .</code> and after that <code>git stash apply</code> worked fine, I got everything back no problems at all. I'd be interested to work out what actually caused it to fail t... | <p>I got around this, I think it must have been some kind of bug, as my working directory was clean and up to date.</p> <p>I ran <code>git checkout .</code> and after that <code>git stash apply</code> worked fine, I got everything back no problems at all. I'd be interested to work out what actually caused it to fail t... | 119, 13091 | git, git-stash | <h1>Can't pop git stash, 'Your local changes to the following files would be overwritten by merge'</h1>
<p>So I had a load of changes and some untracked files. I needed to tweak something, so I used <code>git stash -u</code>, modified a couple of things, committed those changes, pushed them, and then tried to <code>git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,788 | git | # Can't pop git stash, 'Your local changes to the following files would be overwritten by merge'
So I had a load of changes and some untracked files. I needed to tweak something, so I used `git stash -u`, modified a couple of things, committed those changes, pushed them, and then tried to `git stash pop`.
Because I'd... | I got around this, I think it must have been some kind of bug, as my working directory was clean and up to date.
I ran `git checkout .` and after that `git stash apply` worked fine, I got everything back no problems at all. I'd be interested to work out what actually caused it to fail though. |
2732020 | GIT repository layout for server with multiple projects | 97 | 2010-04-28 18:05:27 | <p>One of the things I like about the way I have Subversion set up is that I can have a single main repository with multiple projects. When I want to work on a project I can check out just that project. Like this</p>
<pre><code>\main
\ProductA
\ProductB
\Shared
</code></pre>
<p>then</p>
<pre><code>svn ch... | 62,793 | 76,456 | 2016-11-09 23:01:49 | 2,732,038 | 65 | 2010-04-28 18:07:54 | 6,309 | 2012-10-25 10:23:14 | https://stackoverflow.com/q/2732020 | https://stackoverflow.com/a/2732038 | <p>The guideline is simple, in regards to <strong><a href="https://stackoverflow.com/questions/984707/what-are-the-git-limits/984973#984973">Git limits</a></strong>:</p>
<ul>
<li>one repo per project</li>
<li>a main project with <strong><a href="https://stackoverflow.com/questions/1979167/git-submodule-update/1979194#... | <p>The guideline is simple, in regards to <strong><a href="https://stackoverflow.com/questions/984707/what-are-the-git-limits/984973#984973">Git limits</a></strong>:</p> <ul> <li>one repo per project</li> <li>a main project with <strong><a href="https://stackoverflow.com/questions/1979167/git-submodule-update/1979194#... | 119 | git | <h1>GIT repository layout for server with multiple projects</h1>
<p>One of the things I like about the way I have Subversion set up is that I can have a single main repository with multiple projects. When I want to work on a project I can check out just that project. Like this</p>
<pre><code>\main
\ProductA
\P... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,789 | git | # GIT repository layout for server with multiple projects
One of the things I like about the way I have Subversion set up is that I can have a single main repository with multiple projects. When I want to work on a project I can check out just that project. Like this
```
\main
\ProductA
\ProductB
\Shared
... | The guideline is simple, in regards to **[Git limits](https://stackoverflow.com/questions/984707/what-are-the-git-limits/984973#984973)**:
- one repo per project
- a main project with **[submodules](https://stackoverflow.com/questions/1979167/git-submodule-update/1979194#1979194)**.
The idea is not to store *everythi... |
14418352 | Ignore new commits for git submodule | 96 | 2013-01-19 20:07:26 | <h1>Background</h1>
<p>Using Git 1.8.1.1 on Linux. The repository looks as follows:</p>
<pre><code>master
book
</code></pre>
<p>The submodule was created as follows:</p>
<pre><code>$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book
</code></pre>
<p>The <code>book</code> submod... | 66,359 | 59,087 | 2017-11-27 03:13:54 | 14,422,494 | 65 | 2013-01-20 07:17:12 | 1,761,499 | 2013-01-20 23:46:45 | https://stackoverflow.com/q/14418352 | https://stackoverflow.com/a/14422494 | <p>To include another repository, that needn't be tracked in its super-repo, try this:</p>
<pre><code>$ cd /path/to/master/
$ rm -rf book
$ git clone https://user@bitbucket.org/user/repo.git book
$ git add book
$ echo "book" >> .gitignore
</code></pre>
<p>Then commit.</p>
<p>As stated in the linked <a href="ht... | <p>To include another repository, that needn't be tracked in its super-repo, try this:</p> <pre><code>$ cd /path/to/master/ $ rm -rf book $ git clone https://user@bitbucket.org/user/repo.git book $ git add book $ echo "book" >> .gitignore </code></pre> <p>Then commit.</p> <p>As stated in the linked <a href="ht... | 119, 4333, 6951, 41612 | git, git-submodules, ignore, status | <h1>Ignore new commits for git submodule</h1>
<h1>Background</h1>
<p>Using Git 1.8.1.1 on Linux. The repository looks as follows:</p>
<pre><code>master
book
</code></pre>
<p>The submodule was created as follows:</p>
<pre><code>$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,790 | git | # Ignore new commits for git submodule
# Background
Using Git 1.8.1.1 on Linux. The repository looks as follows:
```
master
book
```
The submodule was created as follows:
```
$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book
```
The `book` submodule is clean:
```
$ cd /path... | To include another repository, that needn't be tracked in its super-repo, try this:
```
$ cd /path/to/master/
$ rm -rf book
$ git clone https://user@bitbucket.org/user/repo.git book
$ git add book
$ echo "book" >> .gitignore
```
Then commit.
As stated in the linked [git submodule pitfalls article](http://codingkille... |
268736 | git-svn: what's the equivalent to `svn switch --relocate`? | 90 | 2008-11-06 13:44:19 | <p>An svn repository I'm mirroring through git-svn has changed URL.</p>
<p>In vanilla svn you'd just do <code>svn switch --relocate old_url_base new_url_base</code>.</p>
<p>How can I do this using git-svn? </p>
<p>Simply changing the svn url in the config file fails.</p>
| 21,475 | 13,989 | 2016-08-17 06:07:18 | 268,767 | 65 | 2008-11-06 13:55:09 | 13,989 | 2012-05-15 11:35:48 | https://stackoverflow.com/q/268736 | https://stackoverflow.com/a/268767 | <p>This handles my situation pretty well:</p>
<p><a href="https://git.wiki.kernel.org/index.php/GitSvnSwitch" rel="noreferrer">https://git.wiki.kernel.org/index.php/GitSvnSwitch</a></p>
<p>I cloned using the <code>file://</code> protocol, and wanted to switch to the <code>http://</code> protocol.</p>
<p>It is tempti... | <p>This handles my situation pretty well:</p> <p><a href="https://git.wiki.kernel.org/index.php/GitSvnSwitch" rel="noreferrer">https://git.wiki.kernel.org/index.php/GitSvnSwitch</a></p> <p>I cloned using the <code>file://</code> protocol, and wanted to switch to the <code>http://</code> protocol.</p> <p>It is tempti... | 119, 456, 6452 | git, git-svn, version-control | <h1>git-svn: what's the equivalent to `svn switch --relocate`?</h1>
<p>An svn repository I'm mirroring through git-svn has changed URL.</p>
<p>In vanilla svn you'd just do <code>svn switch --relocate old_url_base new_url_base</code>.</p>
<p>How can I do this using git-svn? </p>
<p>Simply changing the svn url in the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,792 | git | # git-svn: what's the equivalent to `svn switch --relocate`?
An svn repository I'm mirroring through git-svn has changed URL.
In vanilla svn you'd just do `svn switch --relocate old_url_base new_url_base`.
How can I do this using git-svn?
Simply changing the svn url in the config file fails. | This handles my situation pretty well:
<https://git.wiki.kernel.org/index.php/GitSvnSwitch>
I cloned using the `file://` protocol, and wanted to switch to the `http://` protocol.
It is tempting to edit the `url` setting in the `[svn-remote "svn"]` section of `.git/config`, but on its own this does not work. In gener... |
5074452 | Git - how to force merge conflict and manual merge on selected file | 87 | 2011-02-22 05:39:58 | <p>We maintain web application which has common master branch and many parallel branches, one for each installation, each have few specific changes. Source code is managed in git and it is terrific tool when we need transfer features and bugfixes from master branch into parallel ones. But are few files that are sensiti... | 40,561 | 262,724 | 2022-05-17 06:52:07 | 5,091,756 | 65 | 2011-02-23 13:50:31 | 95,706 | 2011-02-23 13:50:31 | https://stackoverflow.com/q/5074452 | https://stackoverflow.com/a/5091756 | <p>Option 5, a custom merge driver, is probably the way to get closest to what you want. It is surprisingly easy to do. Below is an example of one that I think should get you pretty close to the behavior you desire.</p>
<p>First, create a merge driver script called <code>merge-and-verify-driver</code>. Make it executa... | <p>Option 5, a custom merge driver, is probably the way to get closest to what you want. It is surprisingly easy to do. Below is an example of one that I think should get you pretty close to the behavior you desire.</p> <p>First, create a merge driver script called <code>merge-and-verify-driver</code>. Make it executa... | 119, 717, 1879, 3146, 10720 | branch, conflict, git, manual, merge | <h1>Git - how to force merge conflict and manual merge on selected file</h1>
<p>We maintain web application which has common master branch and many parallel branches, one for each installation, each have few specific changes. Source code is managed in git and it is terrific tool when we need transfer features and bugfi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,793 | git | # Git - how to force merge conflict and manual merge on selected file
We maintain web application which has common master branch and many parallel branches, one for each installation, each have few specific changes. Source code is managed in git and it is terrific tool when we need transfer features and bugfixes from ... | Option 5, a custom merge driver, is probably the way to get closest to what you want. It is surprisingly easy to do. Below is an example of one that I think should get you pretty close to the behavior you desire.
First, create a merge driver script called `merge-and-verify-driver`. Make it executable and put it in a s... |
24603649 | how to find crlf line separators with git? | 71 | 2014-07-07 05:37:21 | <p>as I want to commit to git using intellij, I get a message </p>
<p><code>You are about to commit CRLF line separators to the Git repository</code></p>
<p>and I am given 2 options: </p>
<ul>
<li>fix and commit (runs <code>git config --global core.autocrlf</code>) </li>
<li>commit as is</li>
</ul>
<p>I would like ... | 82,562 | 1,068,746 | 2021-04-13 13:20:52 | 24,604,608 | 65 | 2014-07-07 06:55:55 | 2,274,224 | 2014-07-07 07:26:56 | https://stackoverflow.com/q/24603649 | https://stackoverflow.com/a/24604608 | <p>You could use <code>git grep</code> via the command line to search for files containing the windows style newline characters.</p>
<p>Using the git bash you can find all files which contain a <code>\r</code> character via the following command (bash only!):</p>
<pre><code>git grep -Il $'\r'
</code></pre>
<p>Or alt... | <p>You could use <code>git grep</code> via the command line to search for files containing the windows style newline characters.</p> <p>Using the git bash you can find all files which contain a <code>\r</code> character via the following command (bash only!):</p> <pre><code>git grep -Il $'\r' </code></pre> <p>Or alt... | 119, 8945 | git, intellij-idea | <h1>how to find crlf line separators with git?</h1>
<p>as I want to commit to git using intellij, I get a message </p>
<p><code>You are about to commit CRLF line separators to the Git repository</code></p>
<p>and I am given 2 options: </p>
<ul>
<li>fix and commit (runs <code>git config --global core.autocrlf</code>)... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,795 | git | # how to find crlf line separators with git?
as I want to commit to git using intellij, I get a message
`You are about to commit CRLF line separators to the Git repository`
and I am given 2 options:
- fix and commit (runs `git config --global core.autocrlf`)
- commit as is
I would like to see where those line sepa... | You could use `git grep` via the command line to search for files containing the windows style newline characters.
Using the git bash you can find all files which contain a `\r` character via the following command (bash only!):
```
git grep -Il $'\r'
```
Or alternativly (which should work for all shell types - excep... |
12704568 | Undo a git commit | 60 | 2012-10-03 08:26:22 | <p>Can you undo a past commit, that has long been merged into your git repository, via a git command? Or do you have to manually undo all the changes made in that commit?</p>
| 49,873 | 509,213 | 2023-08-31 14:11:43 | 12,704,641 | 65 | 2012-10-03 08:31:14 | 85,371 | 2012-10-03 08:31:14 | https://stackoverflow.com/q/12704568 | https://stackoverflow.com/a/12704641 | <p>You can always just revert the changes from a single commit by doing:</p>
<pre><code>git revert <commit-id>
</code></pre>
<p>note that this creates a <em>new</em> commit, undoing just those changes</p>
<p>E.g. <code>git log --oneline</code></p>
<pre><code>d806fc9 two
18cdfa2 bye
62c332e hello
c7811ee initi... | <p>You can always just revert the changes from a single commit by doing:</p> <pre><code>git revert <commit-id> </code></pre> <p>note that this creates a <em>new</em> commit, undoing just those changes</p> <p>E.g. <code>git log --oneline</code></p> <pre><code>d806fc9 two 18cdfa2 bye 62c332e hello c7811ee initi... | 119, 53850 | git, git-commit | <h1>Undo a git commit</h1>
<p>Can you undo a past commit, that has long been merged into your git repository, via a git command? Or do you have to manually undo all the changes made in that commit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,796 | git | # Undo a git commit
Can you undo a past commit, that has long been merged into your git repository, via a git command? Or do you have to manually undo all the changes made in that commit? | You can always just revert the changes from a single commit by doing:
```
git revert <commit-id>
```
note that this creates a *new* commit, undoing just those changes
E.g. `git log --oneline`
```
d806fc9 two
18cdfa2 bye
62c332e hello
c7811ee initial
```
Say I want to revert changes in commit `18cdfa2`:
```
git re... |
15277708 | How do you see / show a git merge conflict resolution that was done, given a merge commit SHA1? | 58 | 2013-03-07 17:23:11 | <p>When you resolve a conflict, then stage the changes, then do a git diff, it shows you two columns of +'s and -'s, one for "ours" and one for "theirs". Given a merge commit in a repo's git history, how do I see that resolution, which was done by someone else? In other instances, I've seen it before (in gitk, I thin... | 31,972 | 28,558 | 2024-12-24 17:13:11 | 19,655,632 | 65 | 2013-10-29 10:30:48 | 2,840,436 | 2014-04-07 15:24:08 | https://stackoverflow.com/q/15277708 | https://stackoverflow.com/a/19655632 | <p>If you know the ref, then <code>git show <MERGE_COMMIT></code> will show you the resolution done (if any) for the merge commit.</p>
<p>For log, use <code>git log -p -c</code> or <code>git log -p --cc</code>. From the manpage of git log:</p>
<pre><code> -c
With this option, diff output for a merge co... | <p>If you know the ref, then <code>git show <MERGE_COMMIT></code> will show you the resolution done (if any) for the merge commit.</p> <p>For log, use <code>git log -p -c</code> or <code>git log -p --cc</code>. From the manpage of git log:</p> <pre><code> -c With this option, diff output for a merge co... | 119, 717, 3146, 4961 | conflict, git, merge, resolution | <h1>How do you see / show a git merge conflict resolution that was done, given a merge commit SHA1?</h1>
<p>When you resolve a conflict, then stage the changes, then do a git diff, it shows you two columns of +'s and -'s, one for "ours" and one for "theirs". Given a merge commit in a repo's git history, how do I see t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,797 | git | # How do you see / show a git merge conflict resolution that was done, given a merge commit SHA1?
When you resolve a conflict, then stage the changes, then do a git diff, it shows you two columns of +'s and -'s, one for "ours" and one for "theirs". Given a merge commit in a repo's git history, how do I see that resolu... | If you know the ref, then `git show <MERGE_COMMIT>` will show you the resolution done (if any) for the merge commit.
For log, use `git log -p -c` or `git log -p --cc`. From the manpage of git log:
```
-c
With this option, diff output for a merge commit shows the differences from each
of the parents ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.