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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35437253 | How to git cherrypick all changes introduced in specific branch | 111 | 2016-02-16 16:01:28 | <p><strong>Background info:</strong> </p>
<p>Due to restrictions in workflow with out existing systems, we need to set up a somewhat unorthodox git process. </p>
<pre><code>(patch) A-B---F
| |
(hotfix) C-D-E
|
(dev) 1-2-3-G
</code></pre>
<p>On the patch branch, there are s... | 184,462 | 637,811 | 2024-05-08 16:27:37 | 35,437,643 | 151 | 2016-02-16 16:19:19 | 1,755,598 | 2023-07-13 08:02:32 | https://stackoverflow.com/q/35437253 | https://stackoverflow.com/a/35437643 | <blockquote>
<p>It seems that <code>cherry-pick</code> does what we want in terms of only getting changes from selected commits, but I would really like a way to cherry-pick all commits in a given branch at once, without having to look up the commit ids every time.</p>
</blockquote>
<hr />
<h3>Using <code>cherry-pick</... | <blockquote> <p>It seems that <code>cherry-pick</code> does what we want in terms of only getting changes from selected commits, but I would really like a way to cherry-pick all commits in a given branch at once, without having to look up the commit ids every time.</p> </blockquote> <hr /> <h3>Using <code>cherry-pick</... | 119, 717, 78810 | git, git-cherry-pick, merge | <h1>How to git cherrypick all changes introduced in specific branch</h1>
<p><strong>Background info:</strong> </p>
<p>Due to restrictions in workflow with out existing systems, we need to set up a somewhat unorthodox git process. </p>
<pre><code>(patch) A-B---F
| |
(hotfix) C-D-E
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,395 | git | # How to git cherrypick all changes introduced in specific branch
**Background info:**
Due to restrictions in workflow with out existing systems, we need to set up a somewhat unorthodox git process.
```
(patch) A-B---F
| |
(hotfix) C-D-E
|
(dev) 1-2-3-G
```
On the patch b... | > It seems that `cherry-pick` does what we want in terms of only getting changes from selected commits, but I would really like a way to cherry-pick all commits in a given branch at once, without having to look up the commit ids every time.
---
### Using `cherry-pick`
`git cherry-pick` allows you to pick any commits... |
10076036 | index file smaller than expected | 106 | 2012-04-09 16:06:42 | <p>This morning, I started getting this error from git:</p>
<blockquote>
<p>fatal: index file smaller than expected</p>
<p>fatal: git status --porcelain failed</p>
</blockquote>
<p>Any idea of what is happening and how to solve it?</p>
| 96,588 | 999,540 | 2020-03-26 04:50:52 | 10,079,774 | 151 | 2012-04-09 20:57:43 | 229,044 | 2019-11-25 14:24:45 | https://stackoverflow.com/q/10076036 | https://stackoverflow.com/a/10079774 | <p>The index file has become corrupted, but it is easily re-creatable. Just remove it...</p>
<pre><code>rm .git/index
</code></pre>
<p>Then you can re-add the files you're trying to stage.</p>
| <p>The index file has become corrupted, but it is easily re-creatable. Just remove it...</p> <pre><code>rm .git/index </code></pre> <p>Then you can re-add the files you're trying to stage.</p> | 119 | git | <h1>index file smaller than expected</h1>
<p>This morning, I started getting this error from git:</p>
<blockquote>
<p>fatal: index file smaller than expected</p>
<p>fatal: git status --porcelain failed</p>
</blockquote>
<p>Any idea of what is happening and how to solve it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,396 | git | # index file smaller than expected
This morning, I started getting this error from git:
> fatal: index file smaller than expected
>
> fatal: git status --porcelain failed
Any idea of what is happening and how to solve it? | The index file has become corrupted, but it is easily re-creatable. Just remove it...
```
rm .git/index
```
Then you can re-add the files you're trying to stage. |
3458685 | How can I completely remove a file from a git repository? | 85 | 2010-08-11 13:21:15 | <p>I noticed recently that the project files my text editors use (along with some other junk) got added the git repository for the project. Since they aren't actually part of the project, I'd like to remove them, but <code>git rm</code> doesnt remove the old versions from the repository, and I couldnt find anything el... | 41,924 | 163,349 | 2022-06-02 05:32:29 | 3,459,399 | 151 | 2010-08-11 14:30:13 | 28,804 | 2019-07-03 18:45:22 | https://stackoverflow.com/q/3458685 | https://stackoverflow.com/a/3459399 | <p>The tool you want is <code>git filter-branch</code>. Its usage is described <a href="https://git-scm.com/docs/git-filter-branch" rel="noreferrer">here</a>, but basically:</p>
<pre><code>$ git filter-branch --tree-filter 'rm -f my_file' HEAD
</code></pre>
<p>will remove "my_file" from <em>every</em> commit.</p>
<p... | <p>The tool you want is <code>git filter-branch</code>. Its usage is described <a href="https://git-scm.com/docs/git-filter-branch" rel="noreferrer">here</a>, but basically:</p> <pre><code>$ git filter-branch --tree-filter 'rm -f my_file' HEAD </code></pre> <p>will remove "my_file" from <em>every</em> commit.</p> <p... | 119 | git | <h1>How can I completely remove a file from a git repository?</h1>
<p>I noticed recently that the project files my text editors use (along with some other junk) got added the git repository for the project. Since they aren't actually part of the project, I'd like to remove them, but <code>git rm</code> doesnt remove t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,397 | git | # How can I completely remove a file from a git repository?
I noticed recently that the project files my text editors use (along with some other junk) got added the git repository for the project. Since they aren't actually part of the project, I'd like to remove them, but `git rm` doesnt remove the old versions from ... | The tool you want is `git filter-branch`. Its usage is described [here](https://git-scm.com/docs/git-filter-branch), but basically:
```
$ git filter-branch --tree-filter 'rm -f my_file' HEAD
```
will remove "my_file" from *every* commit.
Notice that this rewrites every commit, so if you push into a remote repository... |
8526279 | Git allows for branch change with unstaged changes | 71 | 2011-12-15 20:39:03 | <p>Git is allowing me to change branches when I have changes not staged for commit (modified files).</p>
<p>Is there a configuration for this somewhere?</p>
<p>Edit: At first I thought this was a configuration that I needed to set to disallow changing between branches if there are modified unstaged files. But by Emi... | 40,983 | 17,234 | 2011-12-16 18:56:08 | 8,526,610 | 151 | 2011-12-15 21:09:13 | 4,376 | 2011-12-16 18:56:08 | https://stackoverflow.com/q/8526279 | https://stackoverflow.com/a/8526610 | <h2>How it decides</h2>
<p>A quick experiment shows the following.</p>
<p>Suppose you're on branch <code>dev</code> and you've modified <code>foo.txt</code>. Without committing, you try to check out <code>master</code>. One of two things will happen.</p>
<ol>
<li><p>If <code>foo.txt</code> was modified in <code>master<... | <h2>How it decides</h2> <p>A quick experiment shows the following.</p> <p>Suppose you're on branch <code>dev</code> and you've modified <code>foo.txt</code>. Without committing, you try to check out <code>master</code>. One of two things will happen.</p> <ol> <li><p>If <code>foo.txt</code> was modified in <code>master<... | 119, 456 | git, version-control | <h1>Git allows for branch change with unstaged changes</h1>
<p>Git is allowing me to change branches when I have changes not staged for commit (modified files).</p>
<p>Is there a configuration for this somewhere?</p>
<p>Edit: At first I thought this was a configuration that I needed to set to disallow changing betwee... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,399 | git | # Git allows for branch change with unstaged changes
Git is allowing me to change branches when I have changes not staged for commit (modified files).
Is there a configuration for this somewhere?
Edit: At first I thought this was a configuration that I needed to set to disallow changing between branches if there are... | ## How it decides
A quick experiment shows the following.
Suppose you're on branch `dev` and you've modified `foo.txt`. Without committing, you try to check out `master`. One of two things will happen.
1. If `foo.txt` was modified in `master` in a commit that `dev` doesn't have, you won't be allowed to switch withou... |
15407075 | How could I use Git bisect to find the first GOOD commit? | 128 | 2013-03-14 10:47:09 | <p>I have the following problem:</p>
<ul>
<li>the version at <em>master</em> works fine</li>
<li>the version of the last tag before <em>master</em> (say <em>last</em>) has a bug</li>
<li>a colleague needs a patch for his <em>last</em> revision for that certain bug</li>
</ul>
<p>Okay. Let's ask our friend <code>git bise... | 21,956 | 520,162 | 2025-07-12 15:25:35 | 17,153,598 | 150 | 2013-06-17 17:45:42 | 90,235 | 2025-07-12 15:13:33 | https://stackoverflow.com/q/15407075 | https://stackoverflow.com/a/17153598 | <p>As of Git 2.7, you can use the arguments <code>--term-old</code> and <code>--term-new</code>.</p>
<p>For instance, you can identify a problem-fixing commit thus:</p>
<pre class="lang-none prettyprint-override"><code>git bisect start --term-new=fixed --term-old=unfixed
git bisect fixed master
git bisect unfixed $some... | <p>As of Git 2.7, you can use the arguments <code>--term-old</code> and <code>--term-new</code>.</p> <p>For instance, you can identify a problem-fixing commit thus:</p> <pre class="lang-none prettyprint-override"><code>git bisect start --term-new=fixed --term-old=unfixed git bisect fixed master git bisect unfixed $some... | 119, 47326 | git, git-bisect | <h1>How could I use Git bisect to find the first GOOD commit?</h1>
<p>I have the following problem:</p>
<ul>
<li>the version at <em>master</em> works fine</li>
<li>the version of the last tag before <em>master</em> (say <em>last</em>) has a bug</li>
<li>a colleague needs a patch for his <em>last</em> revision for that ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,401 | git | # How could I use Git bisect to find the first GOOD commit?
I have the following problem:
- the version at *master* works fine
- the version of the last tag before *master* (say *last*) has a bug
- a colleague needs a patch for his *last* revision for that certain bug
Okay. Let's ask our friend `git bisect` for the ... | As of Git 2.7, you can use the arguments `--term-old` and `--term-new`.
For instance, you can identify a problem-fixing commit thus:
```
git bisect start --term-new=fixed --term-old=unfixed
git bisect fixed master
git bisect unfixed $some-old-sha1
```
As you test, say `git bisect fixed` or `git bisect unfixed` as ap... |
14352932 | View a file's history in Magit? | 117 | 2013-01-16 07:01:35 | <p><a href="https://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning">View the change history of a file using Git versioning</a> talks about other ways of viewing history of a file in Git.</p>
<p>Can it be done in Emacs Magit? </p>
| 35,805 | 433,570 | 2022-04-04 04:31:18 | 15,966,567 | 150 | 2013-04-12 08:30:07 | 486,131 | 2016-02-29 13:11:15 | https://stackoverflow.com/q/14352932 | https://stackoverflow.com/a/15966567 | <p>Since magit 2.1: <code>magit-log-buffer-file</code> (as per comment below)</p>
<p>Before magit 2.1: <code>magit-file-log</code> is what you are looking for. It will show you all commits for the file in the current buffer in the standard magit log view.</p>
| <p>Since magit 2.1: <code>magit-log-buffer-file</code> (as per comment below)</p> <p>Before magit 2.1: <code>magit-file-log</code> is what you are looking for. It will show you all commits for the file in the current buffer in the standard magit log view.</p> | 119, 371, 41829 | emacs, git, magit | <h1>View a file's history in Magit?</h1>
<p><a href="https://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning">View the change history of a file using Git versioning</a> talks about other ways of viewing history of a file in Git.</p>
<p>Can it be done in Emacs Magit? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,402 | git | # View a file's history in Magit?
[View the change history of a file using Git versioning](https://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning) talks about other ways of viewing history of a file in Git.
Can it be done in Emacs Magit? | Since magit 2.1: `magit-log-buffer-file` (as per comment below)
Before magit 2.1: `magit-file-log` is what you are looking for. It will show you all commits for the file in the current buffer in the standard magit log view. |
18131515 | How can I see a "three way diff" for a Git merge conflict? | 107 | 2013-08-08 16:42:53 | <p>Suppose I'm on Git branch <code>master</code> and I <code>git merge featurebranch</code>. There is a conflict in <code>foo.html</code>.</p>
<p>When I open <code>foo.html</code>, I see, in the area of the conflict, what <code>master</code> has and what <code>featurebranch</code> has. But I can't really tell <strong>... | 41,768 | 4,376 | 2025-02-25 10:33:32 | 18,131,595 | 150 | 2013-08-08 16:46:26 | 2,093,785 | 2025-02-25 10:33:32 | https://stackoverflow.com/q/18131515 | https://stackoverflow.com/a/18131595 | <p>From <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">git-merge(1)</a>,</p>
<blockquote>
<p>An alternative style can be used by setting the "merge.conflictstyle" configuration variable to either "diff3" or "zdiff3".</p>
<p>In addition to the <co... | <p>From <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">git-merge(1)</a>,</p> <blockquote> <p>An alternative style can be used by setting the "merge.conflictstyle" configuration variable to either "diff3" or "zdiff3".</p> <p>In addition to the <co... | 119 | git | <h1>How can I see a "three way diff" for a Git merge conflict?</h1>
<p>Suppose I'm on Git branch <code>master</code> and I <code>git merge featurebranch</code>. There is a conflict in <code>foo.html</code>.</p>
<p>When I open <code>foo.html</code>, I see, in the area of the conflict, what <code>master</code> has and w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,404 | git | # How can I see a "three way diff" for a Git merge conflict?
Suppose I'm on Git branch `master` and I `git merge featurebranch`. There is a conflict in `foo.html`.
When I open `foo.html`, I see, in the area of the conflict, what `master` has and what `featurebranch` has. But I can't really tell **what change** was ma... | From [git-merge(1)](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html),
> An alternative style can be used by setting the "merge.conflictstyle" configuration variable to either "diff3" or "zdiff3".
>
> In addition to the `<<<<<<<`, `=======`, and `>>>>>>>` markers, it uses another `|||||||` marker that i... |
20872829 | How to cherry-pick the last sha from another branch in Git with 1 command? | 81 | 2014-01-01 20:18:59 | <p>I find myself doing this a lot when cherry-picking a commit from another branch.</p>
<pre><code>$ git log -1 another_branch
commit <commit_sha>
// copy <commit_sha>
$ git cherry-pick <commit_sha>
</code></pre>
<p>Can I do all of this in one command, if so, what is it?</p>
| 25,442 | 3,056,233 | 2014-01-01 20:22:50 | 20,872,869 | 150 | 2014-01-01 20:22:50 | 1,143,030 | 2014-01-01 20:22:50 | https://stackoverflow.com/q/20872829 | https://stackoverflow.com/a/20872869 | <p>Just go with:</p>
<pre><code>$ git cherry-pick another_branch
</code></pre>
<p>This will cherry-pick the last commit from another_branch.</p>
<p>Branches in git are just references to the last commit in that branch, you can use them instead of commit SHAs in your commands.</p>
| <p>Just go with:</p> <pre><code>$ git cherry-pick another_branch </code></pre> <p>This will cherry-pick the last commit from another_branch.</p> <p>Branches in git are just references to the last commit in that branch, you can use them instead of commit SHAs in your commands.</p> | 119, 10188, 76220, 78810 | git, git-branch, git-cherry-pick, sha | <h1>How to cherry-pick the last sha from another branch in Git with 1 command?</h1>
<p>I find myself doing this a lot when cherry-picking a commit from another branch.</p>
<pre><code>$ git log -1 another_branch
commit <commit_sha>
// copy <commit_sha>
$ git cherry-pick <commit_sha>
</code></pre>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,405 | git | # How to cherry-pick the last sha from another branch in Git with 1 command?
I find myself doing this a lot when cherry-picking a commit from another branch.
```
$ git log -1 another_branch
commit <commit_sha>
// copy <commit_sha>
$ git cherry-pick <commit_sha>
```
Can I do all of this in one command, if so, what is... | Just go with:
```
$ git cherry-pick another_branch
```
This will cherry-pick the last commit from another_branch.
Branches in git are just references to the last commit in that branch, you can use them instead of commit SHAs in your commands. |
56490194 | VS Code / Bitbucket / SSH - Permission denied (publickey) | 62 | 2019-06-07 07:55:24 | <p>I'm trying to access bitbucket via ssh from vscode but always get <em>permission denied (publickey)</em>. </p>
<p>SSH key(s) are located under <code>~\.ssh\</code>, public key(s) are correctly setup in <code>bitbucket/settings/security/sshkeys</code>. The keys are tested and do work! </p>
<p>After booting, I can a... | 76,860 | 1,054,981 | 2022-09-18 10:33:28 | 56,579,798 | 150 | 2019-06-13 11:48:02 | 5,268,585 | 2021-03-28 19:07:20 | https://stackoverflow.com/q/56490194 | https://stackoverflow.com/a/56579798 | <p>Windows 10 allows using all default OpenSSH tools. However, git was throwing permission denied for every time when I tried to clone repositories from Github, Gitlab or Bitbucket over SSH. You need to perform a few tweaks to make it work.</p>
<ol>
<li>Make sure ssh-agent service enabled, or run in Powershell (as admi... | <p>Windows 10 allows using all default OpenSSH tools. However, git was throwing permission denied for every time when I tried to clone repositories from Github, Gitlab or Bitbucket over SSH. You need to perform a few tweaks to make it work.</p> <ol> <li>Make sure ssh-agent service enabled, or run in Powershell (as admi... | 119, 386, 8337, 107329, 111608 | bitbucket, git, ssh, visual-studio-code, windows-10 | <h1>VS Code / Bitbucket / SSH - Permission denied (publickey)</h1>
<p>I'm trying to access bitbucket via ssh from vscode but always get <em>permission denied (publickey)</em>. </p>
<p>SSH key(s) are located under <code>~\.ssh\</code>, public key(s) are correctly setup in <code>bitbucket/settings/security/sshkeys</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,407 | git | # VS Code / Bitbucket / SSH - Permission denied (publickey)
I'm trying to access bitbucket via ssh from vscode but always get *permission denied (publickey)*.
SSH key(s) are located under `~\.ssh\`, public key(s) are correctly setup in `bitbucket/settings/security/sshkeys`. The keys are tested and do work!
After boo... | Windows 10 allows using all default OpenSSH tools. However, git was throwing permission denied for every time when I tried to clone repositories from Github, Gitlab or Bitbucket over SSH. You need to perform a few tweaks to make it work.
1. Make sure ssh-agent service enabled, or run in Powershell (as administrator):
... |
379081 | How to track all remote Git branches as local branches? | 217 | 2008-12-18 20:11:55 | <p>Tracking a single remote branch as a local branch is straightforward enough.</p>
<pre class="lang-none prettyprint-override"><code>git checkout --track -b ${branch_name} origin/${branch_name}
</code></pre>
<p>Pushing all local branches up to the remote, creating new remote branches as needed is also easy.</p>
<pre c... | 104,657 | 47,532 | 2024-07-18 21:34:42 | 379,842 | 149 | 2008-12-19 01:03:15 | 9,594 | 2024-05-13 23:47:10 | https://stackoverflow.com/q/379081 | https://stackoverflow.com/a/379842 | <p>Using Bash:</p>
<h4><strong>After Git 1.9.1</strong></h4>
<pre class="lang-none prettyprint-override"><code>for i in `git branch -a | grep remote | grep -v HEAD | grep -v master`; do git branch --track ${i#remotes/origin/} $i; done
</code></pre>
<blockquote>
<p><strong>credits:</strong> Val Blant, elias, and Hugo</p... | <p>Using Bash:</p> <h4><strong>After Git 1.9.1</strong></h4> <pre class="lang-none prettyprint-override"><code>for i in `git branch -a | grep remote | grep -v HEAD | grep -v master`; do git branch --track ${i#remotes/origin/} $i; done </code></pre> <blockquote> <p><strong>credits:</strong> Val Blant, elias, and Hugo</p... | 119, 1879 | branch, git | <h1>How to track all remote Git branches as local branches?</h1>
<p>Tracking a single remote branch as a local branch is straightforward enough.</p>
<pre class="lang-none prettyprint-override"><code>git checkout --track -b ${branch_name} origin/${branch_name}
</code></pre>
<p>Pushing all local branches up to the remote... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,408 | git | # How to track all remote Git branches as local branches?
Tracking a single remote branch as a local branch is straightforward enough.
```
git checkout --track -b ${branch_name} origin/${branch_name}
```
Pushing all local branches up to the remote, creating new remote branches as needed is also easy.
```
git push -... | Using Bash:
#### **After Git 1.9.1**
```
for i in `git branch -a | grep remote | grep -v HEAD | grep -v master`; do git branch --track ${i#remotes/origin/} $i; done
```
> **credits:** Val Blant, elias, and Hugo
#### **Before Git 1.9.1**
> **Note:** the following code if used in later versions of Git (>v1.9.1) caus... |
8904327 | Case sensitivity in Git | 122 | 2012-01-18 02:14:14 | <p>I've run into a problem with git. Basically I set to false <code>core.ignorecase</code> because I wanted to change the case of the names of some folders (since I'm under OSX with a case-insensitive filesystem, the changes weren't shown otherwise). When I pulled my data, I've noticed that now every renamed folder app... | 90,278 | 959,019 | 2017-05-02 15:44:08 | 8,906,460 | 149 | 2012-01-18 07:11:54 | 6,309 | 2015-03-27 06:42:51 | https://stackoverflow.com/q/8904327 | https://stackoverflow.com/a/8906460 | <p>May be a workaround similar to <a href="http://code.google.com/p/msysgit/issues/detail?id=286#c10" rel="noreferrer">this comment in an msysgit issue</a> (for another case-insensitive OS: Windows) could help?</p>
<blockquote>
<p>I've encountered this same issue. Refactored a package name in Eclipse and switching to ... | <p>May be a workaround similar to <a href="http://code.google.com/p/msysgit/issues/detail?id=286#c10" rel="noreferrer">this comment in an msysgit issue</a> (for another case-insensitive OS: Windows) could help?</p> <blockquote> <p>I've encountered this same issue. Refactored a package name in Eclipse and switching to ... | 119, 9708 | case-sensitive, git | <h1>Case sensitivity in Git</h1>
<p>I've run into a problem with git. Basically I set to false <code>core.ignorecase</code> because I wanted to change the case of the names of some folders (since I'm under OSX with a case-insensitive filesystem, the changes weren't shown otherwise). When I pulled my data, I've noticed ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,409 | git | # Case sensitivity in Git
I've run into a problem with git. Basically I set to false `core.ignorecase` because I wanted to change the case of the names of some folders (since I'm under OSX with a case-insensitive filesystem, the changes weren't shown otherwise). When I pulled my data, I've noticed that now every renam... | May be a workaround similar to [this comment in an msysgit issue](http://code.google.com/p/msysgit/issues/detail?id=286#c10) (for another case-insensitive OS: Windows) could help?
> I've encountered this same issue. Refactored a package name in Eclipse and switching to a previous build broke due to the folder name not... |
6963129 | Is it possible to git-checkout a single line instead of the entire file? | 113 | 2011-08-05 22:09:24 | <p>If I have modified several lines of a versioned file, is it possible to undo the changes of <strong>a line</strong> by command-line?</p>
<p>Just like I would do for an entire file with:</p>
<pre><code>git checkout /path/to/file.extension
</code></pre>
<p>but doing something like, say</p>
<pre><code>git checkout ... | 23,615 | 512,433 | 2016-09-09 00:06:53 | 6,963,150 | 149 | 2011-08-05 22:12:30 | 2,726 | 2011-08-05 22:12:30 | https://stackoverflow.com/q/6963129 | https://stackoverflow.com/a/6963150 | <p>You can use <code>git checkout -p</code> to see each hunk individually and decide whether to check them out or leave them as is (and that takes an optional path argument as well if you'd like to narrow it down further).</p>
| <p>You can use <code>git checkout -p</code> to see each hunk individually and decide whether to check them out or leave them as is (and that takes an optional path argument as well if you'd like to narrow it down further).</p> | 119, 37230 | git, git-checkout | <h1>Is it possible to git-checkout a single line instead of the entire file?</h1>
<p>If I have modified several lines of a versioned file, is it possible to undo the changes of <strong>a line</strong> by command-line?</p>
<p>Just like I would do for an entire file with:</p>
<pre><code>git checkout /path/to/file.exten... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,410 | git | # Is it possible to git-checkout a single line instead of the entire file?
If I have modified several lines of a versioned file, is it possible to undo the changes of **a line** by command-line?
Just like I would do for an entire file with:
```
git checkout /path/to/file.extension
```
but doing something like, say
... | You can use `git checkout -p` to see each hunk individually and decide whether to check them out or leave them as is (and that takes an optional path argument as well if you'd like to narrow it down further). |
4024095 | Push a commit in two branches with Git | 85 | 2010-10-26 13:24:20 | <p>how do I push a commit in two branches? </p>
<p>I can't use "git push", because then it pushes to three branches, and i just want the commit in two of them.. </p>
<p>Ive tried a "git merge HEAD --commit id from branch A--" in branch B, but then it takes everything from branch A and merges with branch B. I just wan... | 73,867 | 183,246 | 2016-12-27 09:14:03 | 4,024,138 | 149 | 2010-10-26 13:29:26 | 356,716 | 2016-03-29 23:09:22 | https://stackoverflow.com/q/4024095 | https://stackoverflow.com/a/4024138 | <h2>Short answer</h2>
<p>You can apply already existing commit to another branch using <a href="http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" rel="noreferrer"><code>cherry-pick</code></a> command, and then push both branches using <code>git push origin branchA branchB</code>.</p>
<hr>
<h2>Why... | <h2>Short answer</h2> <p>You can apply already existing commit to another branch using <a href="http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" rel="noreferrer"><code>cherry-pick</code></a> command, and then push both branches using <code>git push origin branchA branchB</code>.</p> <hr> <h2>Why... | 119, 1879, 4236 | branch, git, push | <h1>Push a commit in two branches with Git</h1>
<p>how do I push a commit in two branches? </p>
<p>I can't use "git push", because then it pushes to three branches, and i just want the commit in two of them.. </p>
<p>Ive tried a "git merge HEAD --commit id from branch A--" in branch B, but then it takes everything fr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,411 | git | # Push a commit in two branches with Git
how do I push a commit in two branches?
I can't use "git push", because then it pushes to three branches, and i just want the commit in two of them..
Ive tried a "git merge HEAD --commit id from branch A--" in branch B, but then it takes everything from branch A and merges wi... | ## Short answer
You can apply already existing commit to another branch using [`cherry-pick`](http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html) command, and then push both branches using `git push origin branchA branchB`.
---
## Why pushing a commit in two branches might be useful
Assume you hav... |
26056130 | Git clone verbose output? | 84 | 2014-09-26 09:19:42 | <p>I have to clone a couple of big repos in my Dockerfile. It really can take an hour to clone a single repo and I want to see standard Git progress output to understand what's going on.</p>
<p>However, when Git is started from the Dockerfile, I see no git clone output whatsoever. The only thing printed to console is:... | 146,701 | 1,645,784 | 2022-06-03 13:38:17 | 26,056,289 | 149 | 2014-09-26 09:27:58 | 1,075,459 | 2022-06-03 13:38:17 | https://stackoverflow.com/q/26056130 | https://stackoverflow.com/a/26056289 | <p>As far as I understand it's not the issue of Docker, but the issue of <code>git</code>. By default, git shows progress if you are in an <em>interactive console</em>.</p>
<p>If you are not, you could specify additional parameters to <code>git clone</code> to output progress to stdout:</p>
<pre><code>git clone --progr... | <p>As far as I understand it's not the issue of Docker, but the issue of <code>git</code>. By default, git shows progress if you are in an <em>interactive console</em>.</p> <p>If you are not, you could specify additional parameters to <code>git clone</code> to output progress to stdout:</p> <pre><code>git clone --progr... | 119, 34099, 35061, 115136 | docker-build, git, git-clone, verbose | <h1>Git clone verbose output?</h1>
<p>I have to clone a couple of big repos in my Dockerfile. It really can take an hour to clone a single repo and I want to see standard Git progress output to understand what's going on.</p>
<p>However, when Git is started from the Dockerfile, I see no git clone output whatsoever. Th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,412 | git | # Git clone verbose output?
I have to clone a couple of big repos in my Dockerfile. It really can take an hour to clone a single repo and I want to see standard Git progress output to understand what's going on.
However, when Git is started from the Dockerfile, I see no git clone output whatsoever. The only thing pri... | As far as I understand it's not the issue of Docker, but the issue of `git`. By default, git shows progress if you are in an *interactive console*.
If you are not, you could specify additional parameters to `git clone` to output progress to stdout:
```
git clone --progress --verbose .....
``` |
9236219 | Git: List git branches, sort by (and show) date | 81 | 2012-02-10 23:20:52 | <p>How can I list git branches showing and sorting by their last commits' dates?</p>
<p>I've found <a href="http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches" rel="noreferrer">this</a>:</p>
<pre><code>for k in `git branch | sed s/^..//`; do
echo -e `git l... | 38,646 | 145,989 | 2017-11-14 12:13:47 | 16,961,359 | 149 | 2013-06-06 11:49:08 | 137,948 | 2013-06-06 11:49:08 | https://stackoverflow.com/q/9236219 | https://stackoverflow.com/a/16961359 | <p>This appears to be a built-in way to achieve that (v1.7.4):</p>
<pre><code>git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'
</code></pre>
| <p>This appears to be a built-in way to achieve that (v1.7.4):</p> <pre><code>git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' </code></pre> | 119, 134, 1879, 5002, 5608 | branch, date, git, list, sorting | <h1>Git: List git branches, sort by (and show) date</h1>
<p>How can I list git branches showing and sorting by their last commits' dates?</p>
<p>I've found <a href="http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches" rel="noreferrer">this</a>:</p>
<pre><code>f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,413 | git | # Git: List git branches, sort by (and show) date
How can I list git branches showing and sorting by their last commits' dates?
I've found [this](http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches):
```
for k in `git branch | sed s/^..//`; do
echo -e `git... | This appears to be a built-in way to achieve that (v1.7.4):
```
git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'
``` |
7466709 | List all commits (across all branches) for a given file | 119 | 2011-09-19 05:14:49 | <p>This question is closely related to <a href="https://stackoverflow.com/questions/3701404/git-list-all-commits-for-a-specific-file">List all commits for a specific file</a> however it is different. I want to find out which commits, <strong>across all branches</strong>, had modified a given file.</p>
<p>To make it mo... | 45,698 | 534,481 | 2017-01-14 13:55:57 | 7,466,798 | 148 | 2011-09-19 05:29:59 | 526,535 | 2011-09-19 05:29:59 | https://stackoverflow.com/q/7466709 | https://stackoverflow.com/a/7466798 | <p>Try this:</p>
<pre><code>git log --all -- path
</code></pre>
| <p>Try this:</p> <pre><code>git log --all -- path </code></pre> | 119 | git | <h1>List all commits (across all branches) for a given file</h1>
<p>This question is closely related to <a href="https://stackoverflow.com/questions/3701404/git-list-all-commits-for-a-specific-file">List all commits for a specific file</a> however it is different. I want to find out which commits, <strong>across all br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,416 | git | # List all commits (across all branches) for a given file
This question is closely related to [List all commits for a specific file](https://stackoverflow.com/questions/3701404/git-list-all-commits-for-a-specific-file) however it is different. I want to find out which commits, **across all branches**, had modified a g... | Try this:
```
git log --all -- path
``` |
46913896 | Is there a way to revert to a previous commit in VS code? | 117 | 2017-10-24 15:01:52 | <p>Is there a way to revert to a previous git commit in VS code?</p>
<p>I know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commit in visual studio code.</p>
| 306,316 | 7,587,070 | 2025-03-14 08:24:39 | 46,914,270 | 148 | 2017-10-24 15:20:06 | 836,330 | 2020-08-09 15:27:14 | https://stackoverflow.com/q/46913896 | https://stackoverflow.com/a/46914270 | <p>With the source control icon selected, if you then click the ellipsis ... at the top right.</p>
<p>With v1.48 you will see a list of options for submenus: under <code>Commit</code> is <code>Undo Last Commit</code>. Under <code>Changes</code> is <code>Discard All Changes</code>.</p>
<p><a href="https://i.sstatic.net... | <p>With the source control icon selected, if you then click the ellipsis ... at the top right.</p> <p>With v1.48 you will see a list of options for submenus: under <code>Commit</code> is <code>Undo Last Commit</code>. Under <code>Changes</code> is <code>Discard All Changes</code>.</p> <p><a href="https://i.sstatic.net... | 119, 111608 | git, visual-studio-code | <h1>Is there a way to revert to a previous commit in VS code?</h1>
<p>Is there a way to revert to a previous git commit in VS code?</p>
<p>I know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commit in visual studio code.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,417 | git | # Is there a way to revert to a previous commit in VS code?
Is there a way to revert to a previous git commit in VS code?
I know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commit in visual studio code. | With the source control icon selected, if you then click the ellipsis ... at the top right.
With v1.48 you will see a list of options for submenus: under `Commit` is `Undo Last Commit`. Under `Changes` is `Discard All Changes`.
[](https://i.sstatic.net/XTo1z.png) |
21848 | Switch branch names in git | 110 | 2008-08-22 05:39:54 | <p>There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have... | 50,346 | 2,427 | 2012-08-18 18:28:45 | 21,932 | 148 | 2008-08-22 07:33:28 | 893 | 2008-08-22 07:33:28 | https://stackoverflow.com/q/21848 | https://stackoverflow.com/a/21932 | <p>In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master:</p>
<pre><code>git branch -m master crap_work
git branch -m previous_master master
</code></pre>
| <p>In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master:</p> <pre><code>git branch -m master crap_work git branch -m previous_master master </code></pre> | 119, 1879 | branch, git | <h1>Switch branch names in git</h1>
<p>There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practica... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,418 | git | # Switch branch names in git
There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this ... | In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master:
```
git branch -m master crap_work
git branch -m previous_master master
``` |
4624881 | How can I uncommit the last commit in a git bare repository? | 103 | 2011-01-07 11:13:07 | <p>Taking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory), </p>
<pre><code>git reset --hard HEAD^
</code></pre>
<p>is not a solution to uncommit the last change in such a repository.</p>
... | 43,839 | 566,795 | 2022-02-28 00:28:12 | 4,625,424 | 148 | 2011-01-07 12:24:56 | 5,353 | 2012-04-10 03:00:15 | https://stackoverflow.com/q/4624881 | https://stackoverflow.com/a/4625424 | <p>You can use the <code>git update-ref</code> command. To remove the last commit, you would use:</p>
<pre><code>$ git update-ref HEAD HEAD^
</code></pre>
<p>Or if you're not in the branch from which you cant to remove the last commit:</p>
<pre><code>$ git update-ref refs/heads/branch-name branch-name^
</code></pre>... | <p>You can use the <code>git update-ref</code> command. To remove the last commit, you would use:</p> <pre><code>$ git update-ref HEAD HEAD^ </code></pre> <p>Or if you're not in the branch from which you cant to remove the last commit:</p> <pre><code>$ git update-ref refs/heads/branch-name branch-name^ </code></pre>... | 119, 5597, 7330, 12626, 64465 | commit, git, git-bare, repository, reset | <h1>How can I uncommit the last commit in a git bare repository?</h1>
<p>Taking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory), </p>
<pre><code>git reset --hard HEAD^
</code></pre>
<p>is ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,419 | git | # How can I uncommit the last commit in a git bare repository?
Taking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory),
```
git reset --hard HEAD^
```
is not a solution to uncommit the last... | You can use the `git update-ref` command. To remove the last commit, you would use:
```
$ git update-ref HEAD HEAD^
```
Or if you're not in the branch from which you cant to remove the last commit:
```
$ git update-ref refs/heads/branch-name branch-name^
```
You could also pass a sha1 if you want:
```
$ git update... |
4255865 | git push to multiple repositories simultaneously | 90 | 2010-11-23 12:10:19 | <p>How can I make <code>git push</code> to push not only to <code>origin</code> but also another remote repository?</p>
<p>as <code>git push</code> is only an alias for <code>git push origin</code>, can I alias git push to push to 2 remote repositories at once (with just that one command)?</p>
<p>I’m not looking for ... | 56,724 | 392,626 | 2022-02-27 10:27:38 | 4,255,934 | 148 | 2010-11-23 12:18:30 | 496,405 | 2014-07-07 12:28:49 | https://stackoverflow.com/q/4255865 | https://stackoverflow.com/a/4255934 | <p>I don't think you can do it just by setting a flag on git, but you can modify a config file that will allow you to push to multiple remote repositories without manually typing them all in (well only typing them in the first time and not after)</p>
<p>In the <code>.git/config</code> file you can add multiple urls to... | <p>I don't think you can do it just by setting a flag on git, but you can modify a config file that will allow you to push to multiple remote repositories without manually typing them all in (well only typing them in the first time and not after)</p> <p>In the <code>.git/config</code> file you can add multiple urls to... | 119, 456, 3346 | dvcs, git, version-control | <h1>git push to multiple repositories simultaneously</h1>
<p>How can I make <code>git push</code> to push not only to <code>origin</code> but also another remote repository?</p>
<p>as <code>git push</code> is only an alias for <code>git push origin</code>, can I alias git push to push to 2 remote repositories at once ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,421 | git | # git push to multiple repositories simultaneously
How can I make `git push` to push not only to `origin` but also another remote repository?
as `git push` is only an alias for `git push origin`, can I alias git push to push to 2 remote repositories at once (with just that one command)?
I’m not looking for a non-git... | I don't think you can do it just by setting a flag on git, but you can modify a config file that will allow you to push to multiple remote repositories without manually typing them all in (well only typing them in the first time and not after)
In the `.git/config` file you can add multiple urls to a defined remote:
`... |
6810059 | Git on Mac OS X v10.7 (Lion) | 80 | 2011-07-24 22:03:43 | <p>I just upgraded my Mac to <a href="https://en.wikipedia.org/wiki/Mac_OS_X_Lion" rel="nofollow noreferrer">Mac OS X v10.7</a> (Lion), and now Git is gone:</p>
<pre><code>$ git
-bash: git: command not found
</code></pre>
<p>How can I get Git back?</p>
| 111,132 | 149,080 | 2020-11-13 20:59:20 | 6,810,082 | 148 | 2011-07-24 22:08:10 | 204,927 | 2020-11-13 20:28:43 | https://stackoverflow.com/q/6810059 | https://stackoverflow.com/a/6810082 | <p>The default install location is <em>/usr/local</em>, so add this to your <em>~/.bash_profile</em> file:</p>
<pre><code>export PATH=$PATH:/usr/local/git/bin/
</code></pre>
<p>Then run <code>source ~/.bash_profile</code> in Terminal.</p>
| <p>The default install location is <em>/usr/local</em>, so add this to your <em>~/.bash_profile</em> file:</p> <pre><code>export PATH=$PATH:/usr/local/git/bin/ </code></pre> <p>Then run <code>source ~/.bash_profile</code> in Terminal.</p> | 119, 369, 71219 | git, macos, osx-lion | <h1>Git on Mac OS X v10.7 (Lion)</h1>
<p>I just upgraded my Mac to <a href="https://en.wikipedia.org/wiki/Mac_OS_X_Lion" rel="nofollow noreferrer">Mac OS X v10.7</a> (Lion), and now Git is gone:</p>
<pre><code>$ git
-bash: git: command not found
</code></pre>
<p>How can I get Git back?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,423 | git | # Git on Mac OS X v10.7 (Lion)
I just upgraded my Mac to [Mac OS X v10.7](https://en.wikipedia.org/wiki/Mac_OS_X_Lion) (Lion), and now Git is gone:
```
$ git
-bash: git: command not found
```
How can I get Git back? | The default install location is */usr/local*, so add this to your *~/.bash_profile* file:
```
export PATH=$PATH:/usr/local/git/bin/
```
Then run `source ~/.bash_profile` in Terminal. |
10170163 | Reset local repo to be exactly the same as remote repo | 71 | 2012-04-16 07:28:46 | <p>How do I reset my local git repo to be exactly the same as the remote repo?</p>
<p>I've tried:</p>
<pre><code>git reset --hard HEAD^
</code></pre>
<p>But now <code>git status</code> says I have diverging commits. I basically want to just wipe anything I've got locally and get the exact remote repo on my local mac... | 95,389 | 21,677 | 2012-04-16 07:42:42 | 10,170,195 | 148 | 2012-04-16 07:31:31 | 11,343 | 2012-04-16 07:42:42 | https://stackoverflow.com/q/10170163 | https://stackoverflow.com/a/10170195 | <p><code>git reset --hard HEAD^</code> will only reset your working copy to the previous (parent) commit. Instead, you want to run</p>
<pre><code>git reset --hard origin/master
</code></pre>
<p>Assuming remote is <code>origin</code> and the branch you want to reset to is <code>master</code></p>
| <p><code>git reset --hard HEAD^</code> will only reset your working copy to the previous (parent) commit. Instead, you want to run</p> <pre><code>git reset --hard origin/master </code></pre> <p>Assuming remote is <code>origin</code> and the branch you want to reset to is <code>master</code></p> | 119 | git | <h1>Reset local repo to be exactly the same as remote repo</h1>
<p>How do I reset my local git repo to be exactly the same as the remote repo?</p>
<p>I've tried:</p>
<pre><code>git reset --hard HEAD^
</code></pre>
<p>But now <code>git status</code> says I have diverging commits. I basically want to just wipe anythin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,424 | git | # Reset local repo to be exactly the same as remote repo
How do I reset my local git repo to be exactly the same as the remote repo?
I've tried:
```
git reset --hard HEAD^
```
But now `git status` says I have diverging commits. I basically want to just wipe anything I've got locally and get the exact remote repo on... | `git reset --hard HEAD^` will only reset your working copy to the previous (parent) commit. Instead, you want to run
```
git reset --hard origin/master
```
Assuming remote is `origin` and the branch you want to reset to is `master` |
12920652 | git update-index --assume-unchanged returns "fatal unable to mark file" | 194 | 2012-10-16 17:56:25 | <p>I am having the same problem as the OP on <a href="https://stackoverflow.com/q/8598937">this</a> post, but I don't understand the answer marked as correct (I don't see that it explains how to fix the situation)</p>
<p>I do this and get this error:</p>
<pre><code>$ git update-index --assume-unchanged web.config
fatal... | 87,947 | 218,761 | 2024-07-23 11:09:37 | 13,319,253 | 147 | 2012-11-10 04:30:31 | 514,228 | 2014-07-26 02:49:24 | https://stackoverflow.com/q/12920652 | https://stackoverflow.com/a/13319253 | <p>I was having the same problem as you, and had followed the same four steps that you indicated above, and had the same results. This included the fact that my file was listed when executing <code>git ls-files -o</code>. However in my case, I also tried executing <code>git update-index --assume-unchanged</code> again... | <p>I was having the same problem as you, and had followed the same four steps that you indicated above, and had the same results. This included the fact that my file was listed when executing <code>git ls-files -o</code>. However in my case, I also tried executing <code>git update-index --assume-unchanged</code> again... | 119 | git | <h1>git update-index --assume-unchanged returns "fatal unable to mark file"</h1>
<p>I am having the same problem as the OP on <a href="https://stackoverflow.com/q/8598937">this</a> post, but I don't understand the answer marked as correct (I don't see that it explains how to fix the situation)</p>
<p>I do this and get ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,427 | git | # git update-index --assume-unchanged returns "fatal unable to mark file"
I am having the same problem as the OP on [this](https://stackoverflow.com/q/8598937) post, but I don't understand the answer marked as correct (I don't see that it explains how to fix the situation)
I do this and get this error:
```
$ git upd... | I was having the same problem as you, and had followed the same four steps that you indicated above, and had the same results. This included the fact that my file was listed when executing `git ls-files -o`. However in my case, I also tried executing `git update-index --assume-unchanged` against a file that was not lis... |
2916849 | What do these words mean in Git: Repository, fork, branch, clone, track? | 130 | 2010-05-26 21:12:28 | <p>I'm honestly not clear on the semantics here. They're all about copies/variants of a code+history unit, but past that I'm not sure I could say. Is this logical structure explained somewhere?</p>
| 58,426 | 252,287 | 2017-04-04 18:05:35 | 2,917,421 | 147 | 2010-05-26 22:52:12 | 117,104 | 2014-09-01 19:56:08 | https://stackoverflow.com/q/2916849 | https://stackoverflow.com/a/2917421 | <p>A repository is simply a place where the history of your work is stored. It often lives in a <code>.git</code> subdirectory of your working copy - a copy of the most recent state of the files you're working on.</p>
<p>To fork a project (take the source from someone's repository at certain point in time, and apply y... | <p>A repository is simply a place where the history of your work is stored. It often lives in a <code>.git</code> subdirectory of your working copy - a copy of the most recent state of the files you're working on.</p> <p>To fork a project (take the source from someone's repository at certain point in time, and apply y... | 119, 1879, 3050 | branch, clone, git | <h1>What do these words mean in Git: Repository, fork, branch, clone, track?</h1>
<p>I'm honestly not clear on the semantics here. They're all about copies/variants of a code+history unit, but past that I'm not sure I could say. Is this logical structure explained somewhere?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,429 | git | # What do these words mean in Git: Repository, fork, branch, clone, track?
I'm honestly not clear on the semantics here. They're all about copies/variants of a code+history unit, but past that I'm not sure I could say. Is this logical structure explained somewhere? | A repository is simply a place where the history of your work is stored. It often lives in a `.git` subdirectory of your working copy - a copy of the most recent state of the files you're working on.
To fork a project (take the source from someone's repository at certain point in time, and apply your own diverging cha... |
12462538 | How to grep the git diff? | 119 | 2012-09-17 15:31:38 | <p>Is there a way to show the git-diff filtered by a given pattern.</p>
<p>Something like </p>
<pre><code>git grepdiff pattern
changed file
+++ some sentence with pattern
changed file 2
--- some other pattern
</code></pre>
<p>Unfortunately the simplest solution is not good enough</p>
<pre><code>git diff | grep pat... | 59,479 | 766,551 | 2023-06-06 07:31:18 | 12,462,691 | 147 | 2012-09-17 15:41:57 | 11,343 | 2012-09-17 15:41:57 | https://stackoverflow.com/q/12462538 | https://stackoverflow.com/a/12462691 | <p>Not sure but isn't <code>git diff -G <regex></code> flag OK?</p>
<blockquote>
<p>-G < regex></p>
<pre><code>Look for differences whose added or removed line matches the given <regex>.
</code></pre>
</blockquote>
| <p>Not sure but isn't <code>git diff -G <regex></code> flag OK?</p> <blockquote> <p>-G < regex></p> <pre><code>Look for differences whose added or removed line matches the given <regex>. </code></pre> </blockquote> | 119, 606, 1271 | diff, git, grep | <h1>How to grep the git diff?</h1>
<p>Is there a way to show the git-diff filtered by a given pattern.</p>
<p>Something like </p>
<pre><code>git grepdiff pattern
changed file
+++ some sentence with pattern
changed file 2
--- some other pattern
</code></pre>
<p>Unfortunately the simplest solution is not good enough<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,430 | git | # How to grep the git diff?
Is there a way to show the git-diff filtered by a given pattern.
Something like
```
git grepdiff pattern
changed file
+++ some sentence with pattern
changed file 2
--- some other pattern
```
Unfortunately the simplest solution is not good enough
```
git diff | grep pattern
+++ some s... | Not sure but isn't `git diff -G <regex>` flag OK?
> -G < regex>
>
> ```
> Look for differences whose added or removed line matches the given <regex>.
> ``` |
10637378 | How do I convert a bare git repository into a normal one (in-place)? | 102 | 2012-05-17 14:12:31 | <p>I have a bare git repository, but need to access and browse its contents over ssh (in a file manager like user experience).</p>
<p>I assume I could clone it:</p>
<pre><code>git clone -l <path_to_bare_repo> <new_normal_repo>
</code></pre>
<p>However, my repository is about 20GB in size and I don't have... | 59,621 | 1,023,963 | 2024-09-11 14:37:19 | 10,637,882 | 147 | 2012-05-17 14:39:39 | 1,084,945 | 2021-07-28 11:31:00 | https://stackoverflow.com/q/10637378 | https://stackoverflow.com/a/10637882 | <p><strong>Note</strong>: I tested this on a <em>very simple</em> 1-commit repository. Double-check this, read the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">man pages</a>, and always be happy you've backed up before following advice you found on StackOverflow. (You do b... | <p><strong>Note</strong>: I tested this on a <em>very simple</em> 1-commit repository. Double-check this, read the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">man pages</a>, and always be happy you've backed up before following advice you found on StackOverflow. (You do b... | 119, 64465 | git, git-bare | <h1>How do I convert a bare git repository into a normal one (in-place)?</h1>
<p>I have a bare git repository, but need to access and browse its contents over ssh (in a file manager like user experience).</p>
<p>I assume I could clone it:</p>
<pre><code>git clone -l <path_to_bare_repo> <new_normal_repo>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,431 | git | # How do I convert a bare git repository into a normal one (in-place)?
I have a bare git repository, but need to access and browse its contents over ssh (in a file manager like user experience).
I assume I could clone it:
```
git clone -l <path_to_bare_repo> <new_normal_repo>
```
However, my repository is about 20G... | **Note**: I tested this on a *very simple* 1-commit repository. Double-check this, read the [man pages](https://www.kernel.org/pub/software/scm/git/docs/git-config.html), and always be happy you've backed up before following advice you found on StackOverflow. (You do back up, right?)
To convert a `--bare` repository t... |
8024924 | .gitignore ignore all files then recursively allow *.foo | 69 | 2011-11-06 02:51:10 | <p>There's already several questions similar to this, but none of the answers work for me.</p>
<p>I want to ignore everything in the folders below my repository except files with *.foo</p>
<p>(If anyone is wondering how this can be justified - I'm actually making a git repository for all my "Logic" projects - music s... | 31,257 | 43,453 | 2020-11-12 19:40:53 | 8,025,106 | 147 | 2011-11-06 03:45:12 | 23,744 | 2011-11-06 03:45:12 | https://stackoverflow.com/q/8024924 | https://stackoverflow.com/a/8025106 | <p>Your problem is that the <code>/*</code> pattern at the beginning is matching all files and directories at the top level - including <code>testdir</code>, so everything inside <code>testdir</code> is ignored.</p>
<p>This is what you want:</p>
<pre><code># Ignore everything
*
# Don't ignore directories, so we can r... | <p>Your problem is that the <code>/*</code> pattern at the beginning is matching all files and directories at the top level - including <code>testdir</code>, so everything inside <code>testdir</code> is ignored.</p> <p>This is what you want:</p> <pre><code># Ignore everything * # Don't ignore directories, so we can r... | 119 | git | <h1>.gitignore ignore all files then recursively allow *.foo</h1>
<p>There's already several questions similar to this, but none of the answers work for me.</p>
<p>I want to ignore everything in the folders below my repository except files with *.foo</p>
<p>(If anyone is wondering how this can be justified - I'm actu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,432 | git | # .gitignore ignore all files then recursively allow *.foo
There's already several questions similar to this, but none of the answers work for me.
I want to ignore everything in the folders below my repository except files with *.foo
(If anyone is wondering how this can be justified - I'm actually making a git repos... | Your problem is that the `/*` pattern at the beginning is matching all files and directories at the top level - including `testdir`, so everything inside `testdir` is ignored.
This is what you want:
```
# Ignore everything
*
# Don't ignore directories, so we can recurse into them
!*/
# Don't ignore .gitignore and *.f... |
8879375 | git push: Push all commits except the last one | 116 | 2012-01-16 11:30:03 | <p>Is there a way to push all my local commits to the remote repository <em>except the most recent one</em>? I'd like to keep the last one locally just in case I need to do an amend.</p>
| 26,948 | 153,737 | 2025-11-27 23:08:38 | 8,879,428 | 146 | 2012-01-16 11:34:04 | 357,743 | 2025-11-27 23:08:38 | https://stackoverflow.com/q/8879375 | https://stackoverflow.com/a/8879428 | <p>Try this (assuming you're working with <code>master</code> branch and your remote is called <code>origin</code>):</p>
<pre><code>git push origin HEAD^:master
</code></pre>
<p><code>HEAD^</code> points to the commit before the last one in the current branch (the last commit can be referred as <code>HEAD</code>) so th... | <p>Try this (assuming you're working with <code>master</code> branch and your remote is called <code>origin</code>):</p> <pre><code>git push origin HEAD^:master </code></pre> <p><code>HEAD^</code> points to the commit before the last one in the current branch (the last commit can be referred as <code>HEAD</code>) so th... | 119, 4236 | git, push | <h1>git push: Push all commits except the last one</h1>
<p>Is there a way to push all my local commits to the remote repository <em>except the most recent one</em>? I'd like to keep the last one locally just in case I need to do an amend.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,434 | git | # git push: Push all commits except the last one
Is there a way to push all my local commits to the remote repository *except the most recent one*? I'd like to keep the last one locally just in case I need to do an amend. | Try this (assuming you're working with `master` branch and your remote is called `origin`):
```
git push origin HEAD^:master
```
`HEAD^` points to the commit before the last one in the current branch (the last commit can be referred as `HEAD`) so this command pushes this commit (with all previous commits) to remote `... |
18845799 | Show SSH key file in Git Bash | 99 | 2013-09-17 09:14:17 | <p>How can I see which SSH key file is used in Git Bash?</p>
<p>I tried "git config --get-all", but I get the error message </p>
<blockquote>
<p>error: wrong number of arguments; usage: git config [options]</p>
</blockquote>
| 195,957 | 1,614,362 | 2024-10-09 16:12:17 | 18,845,990 | 146 | 2013-09-17 09:23:33 | 12,471 | 2019-08-03 23:44:05 | https://stackoverflow.com/q/18845799 | https://stackoverflow.com/a/18845990 | <p>Which SSH key is used isn't determined by Git, but by the SSH client itself. Either the appropriate key is configured in <code>~/.ssh/config</code>, or <code>ssh</code> just tries all keys it can find when connecting to the host. You can see which key ultimately succeeded by connecting to the host with the standard ... | <p>Which SSH key is used isn't determined by Git, but by the SSH client itself. Either the appropriate key is configured in <code>~/.ssh/config</code>, or <code>ssh</code> just tries all keys it can find when connecting to the host. You can see which key ultimately succeeded by connecting to the host with the standard ... | 119 | git | <h1>Show SSH key file in Git Bash</h1>
<p>How can I see which SSH key file is used in Git Bash?</p>
<p>I tried "git config --get-all", but I get the error message </p>
<blockquote>
<p>error: wrong number of arguments; usage: git config [options]</p>
</blockquote>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,435 | git | # Show SSH key file in Git Bash
How can I see which SSH key file is used in Git Bash?
I tried "git config --get-all", but I get the error message
> error: wrong number of arguments; usage: git config [options] | Which SSH key is used isn't determined by Git, but by the SSH client itself. Either the appropriate key is configured in `~/.ssh/config`, or `ssh` just tries all keys it can find when connecting to the host. You can see which key ultimately succeeded by connecting to the host with the standard SSH client. For example, ... |
27325747 | Xcode - error: pathspec '...' did not match any file(s) known to git | 75 | 2014-12-05 22:31:09 | <p>I am using a local git repo. When I try to commit changes to the core data model file (.xcdatamodel), I get this message:</p>
<pre><code>error: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s) known to git.
</code></pre>
<p>How to fix this and commit the model as I do ... | 56,515 | 1,149,647 | 2020-12-28 21:09:55 | 32,794,499 | 146 | 2015-09-26 06:54:57 | 5,377,276 | 2020-12-28 19:16:07 | https://stackoverflow.com/q/27325747 | https://stackoverflow.com/a/32794499 | <p>The problem is, indeed, the changing of a filename's case. For me this was because of my Macbook/OSX. Apparently Windows has the same 'thing'.</p>
<p><strong>Cause:</strong> git isn't able to recognise a change from 'filename' to 'FileName'.</p>
<p>Here's a list of solutions for anyone stumbling upon this. All the s... | <p>The problem is, indeed, the changing of a filename's case. For me this was because of my Macbook/OSX. Apparently Windows has the same 'thing'.</p> <p><strong>Cause:</strong> git isn't able to recognise a change from 'filename' to 'FileName'.</p> <p>Here's a list of solutions for anyone stumbling upon this. All the s... | 119, 908, 5263 | core-data, git, xcode | <h1>Xcode - error: pathspec '...' did not match any file(s) known to git</h1>
<p>I am using a local git repo. When I try to commit changes to the core data model file (.xcdatamodel), I get this message:</p>
<pre><code>error: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s)... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,436 | git | # Xcode - error: pathspec '...' did not match any file(s) known to git
I am using a local git repo. When I try to commit changes to the core data model file (.xcdatamodel), I get this message:
```
error: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s) known to git.
```
... | The problem is, indeed, the changing of a filename's case. For me this was because of my Macbook/OSX. Apparently Windows has the same 'thing'.
**Cause:** git isn't able to recognise a change from 'filename' to 'FileName'.
Here's a list of solutions for anyone stumbling upon this. All the solutions should be run at th... |
11487811 | How can I start a clean branch with no ancestry, then commit files progressively? | 74 | 2012-07-14 22:20:34 | <p>I have a PHP framework versioned with GIT and I'm planning several (drastic) changes to its core. </p>
<p>What I want to do is to start working on the new core in a new branch, but since this change might require some restructuring on the filesystem too, I'd like to start this new branch as cleanly as possible.</p>... | 38,722 | 538,294 | 2014-09-02 08:08:35 | 11,487,993 | 146 | 2012-07-14 22:52:22 | 1,301,972 | 2012-07-15 00:14:52 | https://stackoverflow.com/q/11487811 | https://stackoverflow.com/a/11487993 | <h3>Branch with No Ancestors</h3>
<p>You want the <strong>--orphan</strong> flag. For example:</p>
<pre><code>git checkout master
git checkout --orphan foo
# Unstage all the files in your working tree.
git rm --cached $(git ls-files)
</code></pre>
<p>will create a new branch named <em>foo</em> with no ancestors, bu... | <h3>Branch with No Ancestors</h3> <p>You want the <strong>--orphan</strong> flag. For example:</p> <pre><code>git checkout master git checkout --orphan foo # Unstage all the files in your working tree. git rm --cached $(git ls-files) </code></pre> <p>will create a new branch named <em>foo</em> with no ancestors, bu... | 119, 1879 | branch, git | <h1>How can I start a clean branch with no ancestry, then commit files progressively?</h1>
<p>I have a PHP framework versioned with GIT and I'm planning several (drastic) changes to its core. </p>
<p>What I want to do is to start working on the new core in a new branch, but since this change might require some restruc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,437 | git | # How can I start a clean branch with no ancestry, then commit files progressively?
I have a PHP framework versioned with GIT and I'm planning several (drastic) changes to its core.
What I want to do is to start working on the new core in a new branch, but since this change might require some restructuring on the fil... | ### Branch with No Ancestors
You want the **--orphan** flag. For example:
```
git checkout master
git checkout --orphan foo
# Unstage all the files in your working tree.
git rm --cached $(git ls-files)
```
will create a new branch named *foo* with no ancestors, but it will preserve the current working tree from wha... |
2016404 | git status shows modifications, git checkout -- <file> doesn't remove them | 269 | 2010-01-06 21:31:49 | <p>I would like to remove all changes to my working copy.<br />
Running <code>git status</code> shows files modified.<br />
Nothing I do seems to remove these modifications.<br />
E.g.:<br /></p>
<pre><code>rbellamy@PROMETHEUS /d/Development/rhino-etl (master)
$ git status
# On branch master
# Changed but not updated:... | 164,590 | 208,939 | 2023-08-21 11:47:18 | 2,016,426 | 145 | 2010-01-06 21:34:25 | 20,261 | 2022-03-02 20:25:46 | https://stackoverflow.com/q/2016404 | https://stackoverflow.com/a/2016426 | <p>There are multiple problems that can cause this behaviour:</p>
<p><strong>Line ending normalization</strong></p>
<p>I've had these kinds of problems too. It comes down to git automatically converting crlf to lf. This is typically caused by mixed line endings in a single file. The file gets normalized in the index, b... | <p>There are multiple problems that can cause this behaviour:</p> <p><strong>Line ending normalization</strong></p> <p>I've had these kinds of problems too. It comes down to git automatically converting crlf to lf. This is typically caused by mixed line endings in a single file. The file gets normalized in the index, b... | 119, 12309, 19697, 54839 | git, git-status, revert, working-copy | <h1>git status shows modifications, git checkout -- <file> doesn't remove them</h1>
<p>I would like to remove all changes to my working copy.<br />
Running <code>git status</code> shows files modified.<br />
Nothing I do seems to remove these modifications.<br />
E.g.:<br /></p>
<pre><code>rbellamy@PROMETHEUS /d/Devel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,438 | git | # git status shows modifications, git checkout -- doesn't remove them
I would like to remove all changes to my working copy.
Running `git status` shows files modified.
Nothing I do seems to remove these modifications.
E.g.:
```
rbellamy@PROMETHEUS /d/Development/rhino-etl (master)
$ git status
# On branch maste... | There are multiple problems that can cause this behaviour:
**Line ending normalization**
I've had these kinds of problems too. It comes down to git automatically converting crlf to lf. This is typically caused by mixed line endings in a single file. The file gets normalized in the index, but when git then denormalize... |
1856499 | Differences between git remote update and fetch? | 209 | 2009-12-06 20:27:28 | <p>Is <code>git remote update</code> the equivalent of <code>git fetch</code>?</p>
| 95,624 | 136,562 | 2024-09-22 14:39:25 | 17,512,004 | 145 | 2013-07-07 12:06:32 | null | 2020-05-11 21:59:04 | https://stackoverflow.com/q/1856499 | https://stackoverflow.com/a/17512004 | <p><strong>UPDATE: more information!</strong></p>
<p>I should have done this from the start: I grepped the Git release notes in Git's Git repo (so meta!)</p>
<pre><code>grep --color=always -R -C30 fetch Documentation/RelNotes/* | less
</code></pre>
<p>Then I did a <code>less</code> search for <code>--all</code>, and... | <p><strong>UPDATE: more information!</strong></p> <p>I should have done this from the start: I grepped the Git release notes in Git's Git repo (so meta!)</p> <pre><code>grep --color=always -R -C30 fetch Documentation/RelNotes/* | less </code></pre> <p>Then I did a <code>less</code> search for <code>--all</code>, and... | 119, 33720, 41346 | git, git-fetch, git-remote | <h1>Differences between git remote update and fetch?</h1>
<p>Is <code>git remote update</code> the equivalent of <code>git fetch</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,439 | git | # Differences between git remote update and fetch?
Is `git remote update` the equivalent of `git fetch`? | **UPDATE: more information!**
I should have done this from the start: I grepped the Git release notes in Git's Git repo (so meta!)
```
grep --color=always -R -C30 fetch Documentation/RelNotes/* | less
```
Then I did a `less` search for `--all`, and this is what I found under the [release notes for Git version 1.6.6]... |
15931238 | unable to remove file that really exists - fatal: pathspec ... did not match any files | 186 | 2013-04-10 16:19:44 | <blockquote>
<p>unable to remove file that really exists - fatal: pathspec ... did not match any files</p>
</blockquote>
<p>I have a file under git control that simply will not be deleted. The failing command is:</p>
<pre class="lang-sh prettyprint-override"><code>$ git rm .idea/workspace.xml
fatal: pathspec '.idea/wo... | 224,916 | 1,082,367 | 2022-07-17 11:44:52 | 15,931,542 | 145 | 2013-04-10 16:35:36 | 1,860,309 | 2013-04-10 16:35:36 | https://stackoverflow.com/q/15931238 | https://stackoverflow.com/a/15931542 | <p>Your file <code>.idea/workspace.xml</code> is not under git version control. You have either not added it yet (check git status/Untracked files) or ignored it (using .gitignore or .git/info/exclude files)</p>
<p>You can verify it using following git command, that lists all ignored files:</p>
<pre><code>git ls-file... | <p>Your file <code>.idea/workspace.xml</code> is not under git version control. You have either not added it yet (check git status/Untracked files) or ignored it (using .gitignore or .git/info/exclude files)</p> <p>You can verify it using following git command, that lists all ignored files:</p> <pre><code>git ls-file... | 119, 8945 | git, intellij-idea | <h1>unable to remove file that really exists - fatal: pathspec ... did not match any files</h1>
<blockquote>
<p>unable to remove file that really exists - fatal: pathspec ... did not match any files</p>
</blockquote>
<p>I have a file under git control that simply will not be deleted. The failing command is:</p>
<pre c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,440 | git | # unable to remove file that really exists - fatal: pathspec ... did not match any files
> unable to remove file that really exists - fatal: pathspec ... did not match any files
I have a file under git control that simply will not be deleted. The failing command is:
```
$ git rm .idea/workspace.xml
fatal: pathspec '... | Your file `.idea/workspace.xml` is not under git version control. You have either not added it yet (check git status/Untracked files) or ignored it (using .gitignore or .git/info/exclude files)
You can verify it using following git command, that lists all ignored files:
```
git ls-files --others -i --exclude-standard... |
931882 | How to apply a git patch from one repository to another? | 112 | 2009-05-31 11:32:37 | <p>I have two repositories, one is the main repo for a library, and the other is a project using that library.</p>
<p>If I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream.</p>
<p>The file's location is different in each repository.</p>
<ul>
<li>Main repo: <strong>... | 77,247 | 115,076 | 2017-12-11 14:56:09 | 11,263,899 | 145 | 2012-06-29 14:43:36 | 718,180 | 2014-06-26 18:46:49 | https://stackoverflow.com/q/931882 | https://stackoverflow.com/a/11263899 | <p>If manually editing the patch file is out of the question or infeasible, this can be done with standard options (available in <code>git apply</code>, <code>git format-patch</code> and GNU <code>patch</code>).</p>
<ol>
<li><p><code>-p<n></code> removes <code>n</code> leading directories from the paths in the p... | <p>If manually editing the patch file is out of the question or infeasible, this can be done with standard options (available in <code>git apply</code>, <code>git format-patch</code> and GNU <code>patch</code>).</p> <ol> <li><p><code>-p<n></code> removes <code>n</code> leading directories from the paths in the p... | 119, 2132, 41612, 62078 | git, git-patch, git-submodules, patch | <h1>How to apply a git patch from one repository to another?</h1>
<p>I have two repositories, one is the main repo for a library, and the other is a project using that library.</p>
<p>If I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream.</p>
<p>The file's location ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,441 | git | # How to apply a git patch from one repository to another?
I have two repositories, one is the main repo for a library, and the other is a project using that library.
If I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream.
The file's location is different in each re... | If manually editing the patch file is out of the question or infeasible, this can be done with standard options (available in `git apply`, `git format-patch` and GNU `patch`).
1. `-p<n>` removes `n` leading directories from the paths in the patch.
2. After processing `-p`, `--directory=<root>` prepends `root` to each ... |
34175799 | Differencies between git add and git stage command | 107 | 2015-12-09 09:58:49 | <p>What is the difference between <code>git add filename</code> and <code>git stage filename</code>? Because when I tried them both it looks that they do the same thing. </p>
| 32,150 | null | 2015-12-09 13:15:10 | 34,175,877 | 145 | 2015-12-09 10:02:53 | 1,256,452 | 2015-12-09 10:02:53 | https://stackoverflow.com/q/34175799 | https://stackoverflow.com/a/34175877 | <p>As <a href="https://www.kernel.org/pub/software/scm/git/docs/git-stage.html" rel="noreferrer">the documentation says</a>, <code>git stage</code> is just a synonym for <code>git add</code>, so there is no difference in usage.</p>
| <p>As <a href="https://www.kernel.org/pub/software/scm/git/docs/git-stage.html" rel="noreferrer">the documentation says</a>, <code>git stage</code> is just a synonym for <code>git add</code>, so there is no difference in usage.</p> | 119 | git | <h1>Differencies between git add and git stage command</h1>
<p>What is the difference between <code>git add filename</code> and <code>git stage filename</code>? Because when I tried them both it looks that they do the same thing. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,442 | git | # Differencies between git add and git stage command
What is the difference between `git add filename` and `git stage filename`? Because when I tried them both it looks that they do the same thing. | As [the documentation says](https://www.kernel.org/pub/software/scm/git/docs/git-stage.html), `git stage` is just a synonym for `git add`, so there is no difference in usage. |
6030530 | Why isn't my updated .gitignore working for files that are being tracked? | 96 | 2011-05-17 12:07:05 | <p>I have the following .gitignore file</p>
<pre><code># file named .gitignore
system/application/config/database.php
system/application/config/config.php
system/logs
modules/recaptcha/config/*
</code></pre>
<p>However when I add any changes in config and recapcha.php, git status warns me as following.
When I add any ... | 81,901 | 119,198 | 2022-12-19 19:59:28 | 6,030,686 | 145 | 2011-05-17 12:20:35 | 685,939 | 2020-05-15 09:11:30 | https://stackoverflow.com/q/6030530 | https://stackoverflow.com/a/6030686 | <p>The files are already stored in your local commit tree. You'll need to first remove them from the repository. This can be done via:</p>
<pre><code>git rm --cached system/application/config/config.php modules/recaptcha/config/recaptcha.php
</code></pre>
<p>After that you'll need to make one more commit and you're g... | <p>The files are already stored in your local commit tree. You'll need to first remove them from the repository. This can be done via:</p> <pre><code>git rm --cached system/application/config/config.php modules/recaptcha/config/recaptcha.php </code></pre> <p>After that you'll need to make one more commit and you're g... | 119 | git | <h1>Why isn't my updated .gitignore working for files that are being tracked?</h1>
<p>I have the following .gitignore file</p>
<pre><code># file named .gitignore
system/application/config/database.php
system/application/config/config.php
system/logs
modules/recaptcha/config/*
</code></pre>
<p>However when I add any ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,443 | git | # Why isn't my updated .gitignore working for files that are being tracked?
I have the following .gitignore file
```
# file named .gitignore
system/application/config/database.php
system/application/config/config.php
system/logs
modules/recaptcha/config/*
```
However when I add any changes in config and recapcha.ph... | The files are already stored in your local commit tree. You'll need to first remove them from the repository. This can be done via:
```
git rm --cached system/application/config/config.php modules/recaptcha/config/recaptcha.php
```
After that you'll need to make one more commit and you're good to go. |
1655361 | how to clone an old git-commit (and some more questions about git) | 90 | 2009-10-31 19:32:05 | <p>I have a git-repository of my project with about 20 commits. I know how to clone the actual commit with <code>git clone</code>, </p>
<ul>
<li>but how can I "clone" an old commit? </li>
<li>is there a really good git-GUI (imho <code>qgit</code> is not a good GUI)? </li>
<li>what exactly are "branches"?</li>
<li>w... | 127,240 | 150,667 | 2016-02-26 13:45:39 | 1,655,666 | 145 | 2009-10-31 21:20:32 | 6,309 | 2013-01-30 08:07:43 | https://stackoverflow.com/q/1655361 | https://stackoverflow.com/a/1655666 | <p>A git repository contains the all history at all time.<br>
So when you are cloning a repository, you are cloning it with its full history, and <em>then</em>, you can make a branch from whatever commit you want:</p>
<pre><code> $ git checkout -b aNewBranch SHA1
</code></pre>
<p>with SHA1 representing the commit id ... | <p>A git repository contains the all history at all time.<br> So when you are cloning a repository, you are cloning it with its full history, and <em>then</em>, you can make a branch from whatever commit you want:</p> <pre><code> $ git checkout -b aNewBranch SHA1 </code></pre> <p>with SHA1 representing the commit id ... | 119 | git | <h1>how to clone an old git-commit (and some more questions about git)</h1>
<p>I have a git-repository of my project with about 20 commits. I know how to clone the actual commit with <code>git clone</code>, </p>
<ul>
<li>but how can I "clone" an old commit? </li>
<li>is there a really good git-GUI (imho <code>qgit</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,444 | git | # how to clone an old git-commit (and some more questions about git)
I have a git-repository of my project with about 20 commits. I know how to clone the actual commit with `git clone`,
- but how can I "clone" an old commit?
- is there a really good git-GUI (imho `qgit` is not a good GUI)?
- what exactly are "branche... | A git repository contains the all history at all time.
So when you are cloning a repository, you are cloning it with its full history, and *then*, you can make a branch from whatever commit you want:
```
$ git checkout -b aNewBranch SHA1
```
with SHA1 representing the commit id from which you want to proceed.
---... |
31252363 | How to get rid of "You are currently editing a commit"? | 75 | 2015-07-06 17:45:57 | <p>Suddenly appeared:</p>
<pre><code>MacBook-Pro: $ git status
On branch dev
Your branch is up-to-date with 'dropbox/dev'.
You are currently editing a commit while rebasing branch 'Releases' on '72ca998'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied wit... | 55,846 | 1,692,333 | 2023-01-24 20:24:03 | 31,252,460 | 145 | 2015-07-06 17:51:42 | 3,872,702 | 2015-07-06 18:11:35 | https://stackoverflow.com/q/31252363 | https://stackoverflow.com/a/31252460 | <p><code>git rebase --abort</code> should abort the rebase operation and return to the previous state. But to be sure, what commands did you enter before?</p>
<p>edit: the output of <code>git reflog</code> can show you where the rebase started, it would look something like</p>
<pre><code>7d0b010 HEAD@{0}: rebase fini... | <p><code>git rebase --abort</code> should abort the rebase operation and return to the previous state. But to be sure, what commands did you enter before?</p> <p>edit: the output of <code>git reflog</code> can show you where the rebase started, it would look something like</p> <pre><code>7d0b010 HEAD@{0}: rebase fini... | 119 | git | <h1>How to get rid of "You are currently editing a commit"?</h1>
<p>Suddenly appeared:</p>
<pre><code>MacBook-Pro: $ git status
On branch dev
Your branch is up-to-date with 'dropbox/dev'.
You are currently editing a commit while rebasing branch 'Releases' on '72ca998'.
(use "git commit --amend" to amend the current ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,445 | git | # How to get rid of "You are currently editing a commit"?
Suddenly appeared:
```
MacBook-Pro: $ git status
On branch dev
Your branch is up-to-date with 'dropbox/dev'.
You are currently editing a commit while rebasing branch 'Releases' on '72ca998'.
(use "git commit --amend" to amend the current commit)
(use "git ... | `git rebase --abort` should abort the rebase operation and return to the previous state. But to be sure, what commands did you enter before?
edit: the output of `git reflog` can show you where the rebase started, it would look something like
```
7d0b010 HEAD@{0}: rebase finished: returning to refs/heads/bran
7d0b010 ... |
420143 | Making git auto-commit | 195 | 2009-01-07 12:34:18 | <p>I'd like to use git to record all the changes to a file. </p>
<p>Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file?</p>
<p>Ideally I'd like my users to not even know that git is running behind the scenes. A user coul... | 125,800 | 52,416 | 2025-06-16 23:18:14 | 420,172 | 144 | 2009-01-07 12:40:30 | 13,051 | 2023-09-21 14:22:12 | https://stackoverflow.com/q/420143 | https://stackoverflow.com/a/420172 | <p>On Linux you could use <code>inotifywait</code> to automatically execute a command every time a file's content is changed.</p>
<p>The following command commits <code>file.txt</code> as soon as it is saved:</p>
<pre><code>inotifywait -q -m -e CLOSE_WRITE --format="git commit -m 'autocommit on change' %w" fi... | <p>On Linux you could use <code>inotifywait</code> to automatically execute a command every time a file's content is changed.</p> <p>The following command commits <code>file.txt</code> as soon as it is saved:</p> <pre><code>inotifywait -q -m -e CLOSE_WRITE --format="git commit -m 'autocommit on change' %w" fi... | 119 | git | <h1>Making git auto-commit</h1>
<p>I'd like to use git to record all the changes to a file. </p>
<p>Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file?</p>
<p>Ideally I'd like my users to not even know that git is runnin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,447 | git | # Making git auto-commit
I'd like to use git to record all the changes to a file.
Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file?
Ideally I'd like my users to not even know that git is running behind the scenes. A u... | On Linux you could use `inotifywait` to automatically execute a command every time a file's content is changed.
The following command commits `file.txt` as soon as it is saved:
```
inotifywait -q -m -e CLOSE_WRITE --format="git commit -m 'autocommit on change' %w" file.txt | sh
``` |
21639437 | Git flow release branches and tags - with or without "v" prefix | 168 | 2014-02-07 23:09:17 | <p>I have seen multiple contradicting definitions on various git flow related websites. Is there an official recommendation or single source of truth?</p>
<p>Branches: <code>release-1.2.3</code> or <code>release-v1.2.3</code></p>
<p>Tags: <code>1.2.3</code> or <code>v1.2.3</code></p>
| 67,822 | 154,133 | 2024-12-30 00:45:39 | 21,639,868 | 144 | 2014-02-07 23:52:27 | 782,822 | 2021-08-16 09:53:28 | https://stackoverflow.com/q/21639437 | https://stackoverflow.com/a/21639868 | <p>Well, basically it is a matter of preference, but I prefer the version with the <code>v</code>, as <a href="http://semver.org/" rel="noreferrer">Semver</a> does it <a href="https://github.com/semver/semver/releases/tag/v2.0.0" rel="noreferrer">that way</a> and I try to follow that specification as close as possible ... | <p>Well, basically it is a matter of preference, but I prefer the version with the <code>v</code>, as <a href="http://semver.org/" rel="noreferrer">Semver</a> does it <a href="https://github.com/semver/semver/releases/tag/v2.0.0" rel="noreferrer">that way</a> and I try to follow that specification as close as possible ... | 119, 7028, 64339 | git, git-flow, naming-conventions | <h1>Git flow release branches and tags - with or without "v" prefix</h1>
<p>I have seen multiple contradicting definitions on various git flow related websites. Is there an official recommendation or single source of truth?</p>
<p>Branches: <code>release-1.2.3</code> or <code>release-v1.2.3</code></p>
<p>Tags: <code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,448 | git | # Git flow release branches and tags - with or without "v" prefix
I have seen multiple contradicting definitions on various git flow related websites. Is there an official recommendation or single source of truth?
Branches: `release-1.2.3` or `release-v1.2.3`
Tags: `1.2.3` or `v1.2.3` | Well, basically it is a matter of preference, but I prefer the version with the `v`, as [Semver](http://semver.org/) does it [that way](https://github.com/semver/semver/releases/tag/v2.0.0) and I try to follow that specification as close as possible to get a sane versioning.
It also makes filtering for those Tags easi... |
11552437 | git pull remote branch cannot find remote ref | 165 | 2012-07-19 00:41:29 | <p>I'm not sure why this doesn't work. When I do <code>git branch -a</code>, this is what I see:</p>
<p><img src="https://i.sstatic.net/E2Lxn.png" alt="enter image description here" /></p>
<p>I'm trying to pull from the DownloadManager on the online GitHub repository. I have tried</p>
<ul>
<li><code>git pull</code>, ... | 803,994 | 207,524 | 2024-09-17 10:20:46 | 11,558,287 | 144 | 2012-07-19 09:56:41 | 907,576 | 2016-02-24 09:42:21 | https://stackoverflow.com/q/11552437 | https://stackoverflow.com/a/11558287 | <p><strong><em>Be careful - you have case mixing between local and remote branch!</em></strong></p>
<p>Suppose you are in local branch <em>downloadmanager</em> now (<code>git checkout downloadmanager</code>)</p>
<p>You have next options:</p>
<ol>
<li><p>Specify remote branch in <em>pull/push</em> commands every time... | <p><strong><em>Be careful - you have case mixing between local and remote branch!</em></strong></p> <p>Suppose you are in local branch <em>downloadmanager</em> now (<code>git checkout downloadmanager</code>)</p> <p>You have next options:</p> <ol> <li><p>Specify remote branch in <em>pull/push</em> commands every time... | 119 | git | <h1>git pull remote branch cannot find remote ref</h1>
<p>I'm not sure why this doesn't work. When I do <code>git branch -a</code>, this is what I see:</p>
<p><img src="https://i.sstatic.net/E2Lxn.png" alt="enter image description here" /></p>
<p>I'm trying to pull from the DownloadManager on the online GitHub reposit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,449 | git | # git pull remote branch cannot find remote ref
I'm not sure why this doesn't work. When I do `git branch -a`, this is what I see:

I'm trying to pull from the DownloadManager on the online GitHub repository. I have tried
- `git pull`, but then it comp... | ***Be careful - you have case mixing between local and remote branch!***
Suppose you are in local branch *downloadmanager* now (`git checkout downloadmanager`)
You have next options:
1. Specify remote branch in *pull/push* commands every time (case sensitive):
`git pull origin DownloadManager`
or
`git pu... |
7225313 | How does Git compute file hashes? | 145 | 2011-08-29 01:37:11 | <p>The SHA1 hashes stored in the tree objects (as returned by <code>git ls-tree</code>) do not match the SHA1 hashes of the file content (as returned by <code>sha1sum</code>):</p>
<pre><code>$ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sum
de20247992af0f949ae8df4fa9a37e4a03d7063e -
</code></pre>
... | 53,805 | 250,827 | 2024-04-01 03:43:15 | 7,225,329 | 144 | 2011-08-29 01:42:14 | 52,176 | 2020-04-23 00:59:38 | https://stackoverflow.com/q/7225313 | https://stackoverflow.com/a/7225329 | <blockquote>
<p>Git prefixes the object with "blob ", followed by the length (as a
human-readable integer), followed by a NUL character</p>
</blockquote>
<p><code>$ echo -e 'blob 14\0Hello, World!' | shasum
8ab686eafeb1f44702738c8b0f24f2567c36da6d</code></p>
<p>Source: <a href="http://alblue.bandlem.com/2011/08/g... | <blockquote> <p>Git prefixes the object with "blob ", followed by the length (as a human-readable integer), followed by a NUL character</p> </blockquote> <p><code>$ echo -e 'blob 14\0Hello, World!' | shasum 8ab686eafeb1f44702738c8b0f24f2567c36da6d</code></p> <p>Source: <a href="http://alblue.bandlem.com/2011/08/g... | 119, 581, 2179, 3190, 117987 | checksum, git, git-hash, hash, sha1 | <h1>How does Git compute file hashes?</h1>
<p>The SHA1 hashes stored in the tree objects (as returned by <code>git ls-tree</code>) do not match the SHA1 hashes of the file content (as returned by <code>sha1sum</code>):</p>
<pre><code>$ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sum
de20247992af0f9... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,450 | git | # How does Git compute file hashes?
The SHA1 hashes stored in the tree objects (as returned by `git ls-tree`) do not match the SHA1 hashes of the file content (as returned by `sha1sum`):
```
$ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sum
de20247992af0f949ae8df4fa9a37e4a03d7063e -
```
How doe... | > Git prefixes the object with "blob ", followed by the length (as a
> human-readable integer), followed by a NUL character
`$ echo -e 'blob 14\0Hello, World!' | shasum
8ab686eafeb1f44702738c8b0f24f2567c36da6d`
Source: <http://alblue.bandlem.com/2011/08/git-tip-of-week-objects.html> |
6836461 | Updating the current branch from parent branch | 128 | 2011-07-26 20:51:45 | <p>I created a new git branch <code>B</code> from branch <code>A</code> with tracking option.</p>
<p>Now, when <code>A</code> branch gets updated by few commits, I want to pull the commits to <code>B</code> as well, so I can keep track of it, and do not have to face big change sometimes later.</p>
<p>How should I app... | 190,355 | 482,594 | 2023-06-02 06:07:10 | 6,836,520 | 144 | 2011-07-26 20:57:50 | 269,687 | 2011-07-26 20:57:50 | https://stackoverflow.com/q/6836461 | https://stackoverflow.com/a/6836520 | <p>This is not made automatically. You have to manually merge your changes from A to B, which is pretty simple. Just switch to branch B and do</p>
<pre><code>git merge A
</code></pre>
<p>Which will automatically merge your changes from A to B. As long as you don't have any conflicts, all of the changes in A will be m... | <p>This is not made automatically. You have to manually merge your changes from A to B, which is pretty simple. Just switch to branch B and do</p> <pre><code>git merge A </code></pre> <p>Which will automatically merge your changes from A to B. As long as you don't have any conflicts, all of the changes in A will be m... | 119 | git | <h1>Updating the current branch from parent branch</h1>
<p>I created a new git branch <code>B</code> from branch <code>A</code> with tracking option.</p>
<p>Now, when <code>A</code> branch gets updated by few commits, I want to pull the commits to <code>B</code> as well, so I can keep track of it, and do not have to f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,452 | git | # Updating the current branch from parent branch
I created a new git branch `B` from branch `A` with tracking option.
Now, when `A` branch gets updated by few commits, I want to pull the commits to `B` as well, so I can keep track of it, and do not have to face big change sometimes later.
How should I approach this?... | This is not made automatically. You have to manually merge your changes from A to B, which is pretty simple. Just switch to branch B and do
```
git merge A
```
Which will automatically merge your changes from A to B. As long as you don't have any conflicts, all of the changes in A will be marked as merged in B. A com... |
4124792 | Remove an Existing File from a Git Repo | 127 | 2010-11-08 14:35:38 | <p>I want git to stop tracking my local development log (log/development.log) in our repositories. Is this possible and how can I do it?</p>
| 31,297 | 94,150 | 2013-04-11 19:41:54 | 4,125,950 | 144 | 2010-11-08 16:44:25 | 16,562 | 2010-11-09 17:50:02 | https://stackoverflow.com/q/4124792 | https://stackoverflow.com/a/4125950 | <p>Just to give the full answer all at once:</p>
<ol>
<li><p>from klemens: You need to add the file to your <code>.gitignore</code> file somewhere above the undesired file in the repo. i.e.</p>
<p>$ cd
$ cat >> .gitignore
development.log
C-d</p></li>
<li><p>from m. narebski: You then need to remove the file from the... | <p>Just to give the full answer all at once:</p> <ol> <li><p>from klemens: You need to add the file to your <code>.gitignore</code> file somewhere above the undesired file in the repo. i.e.</p> <p>$ cd $ cat >> .gitignore development.log C-d</p></li> <li><p>from m. narebski: You then need to remove the file from the... | 119 | git | <h1>Remove an Existing File from a Git Repo</h1>
<p>I want git to stop tracking my local development log (log/development.log) in our repositories. Is this possible and how can I do it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,453 | git | # Remove an Existing File from a Git Repo
I want git to stop tracking my local development log (log/development.log) in our repositories. Is this possible and how can I do it? | Just to give the full answer all at once:
1. from klemens: You need to add the file to your `.gitignore` file somewhere above the undesired file in the repo. i.e.
$ cd
$ cat >> .gitignore
development.log
C-d
2. from m. narebski: You then need to remove the file from the repo by executing "`git rm --cached... |
9437182 | Git show all branches (but not stashes) in log | 107 | 2012-02-24 19:56:33 | <p>I have a Git alias that expands to:</p>
<pre><code>git log --graph --oneline --all --decorate
</code></pre>
<p>According to <code>man git log</code> there are a couple of suspicious options: <code>--not</code> and <code>--branches</code>; but I can't make it work properly.</p>
<p>How should I edit that to hide the s... | 29,836 | 477,168 | 2025-02-14 02:36:39 | 9,438,578 | 144 | 2012-02-24 21:51:38 | 211,563 | 2012-02-24 23:21:10 | https://stackoverflow.com/q/9437182 | https://stackoverflow.com/a/9438578 | <p>Instead of doing <code>--all</code> and then trying to filter out the stashes, don't ever include them in the first place:</p>
<pre><code>git log --branches --remotes --tags --graph --oneline --decorate
</code></pre>
<p>The main problem that arises from trying to filter them out afterwards is that if the stash is ... | <p>Instead of doing <code>--all</code> and then trying to filter out the stashes, don't ever include them in the first place:</p> <pre><code>git log --branches --remotes --tags --graph --oneline --decorate </code></pre> <p>The main problem that arises from trying to filter them out afterwards is that if the stash is ... | 119, 13091, 47913 | git, git-log, git-stash | <h1>Git show all branches (but not stashes) in log</h1>
<p>I have a Git alias that expands to:</p>
<pre><code>git log --graph --oneline --all --decorate
</code></pre>
<p>According to <code>man git log</code> there are a couple of suspicious options: <code>--not</code> and <code>--branches</code>; but I can't make it wo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,455 | git | # Git show all branches (but not stashes) in log
I have a Git alias that expands to:
```
git log --graph --oneline --all --decorate
```
According to `man git log` there are a couple of suspicious options: `--not` and `--branches`; but I can't make it work properly.
How should I edit that to hide the stashes?
---
... | Instead of doing `--all` and then trying to filter out the stashes, don't ever include them in the first place:
```
git log --branches --remotes --tags --graph --oneline --decorate
```
The main problem that arises from trying to filter them out afterwards is that if the stash is the latest commit on that branch (beca... |
44933306 | How to prevent eslint from blocking git commit? | 67 | 2017-07-05 18:15:08 | <p>I'm new to eslint and am using it to enforce coding style. However, when I write a <code>TODO</code> item into my code I get an eslint warning, alright that's fine. But, now when I try to git commit, it comes back with:</p>
<pre><code>**** ESLint errors found :
line 145, col 9, Warning - Unexpected 'todo' comme... | 117,862 | 6,292,923 | 2024-07-25 09:41:35 | 44,937,477 | 144 | 2017-07-05 23:24:19 | 7,976,758 | 2021-07-30 07:09:45 | https://stackoverflow.com/q/44933306 | https://stackoverflow.com/a/44937477 | <p>You have a pre-commit hook.</p>
<pre><code>git commit --no-verify
</code></pre>
<p>allows to avoid it once. Or you can remove it completely from .git/hooks.</p>
| <p>You have a pre-commit hook.</p> <pre><code>git commit --no-verify </code></pre> <p>allows to avoid it once. Or you can remove it completely from .git/hooks.</p> | 119, 94800 | eslint, git | <h1>How to prevent eslint from blocking git commit?</h1>
<p>I'm new to eslint and am using it to enforce coding style. However, when I write a <code>TODO</code> item into my code I get an eslint warning, alright that's fine. But, now when I try to git commit, it comes back with:</p>
<pre><code>**** ESLint errors found ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,458 | git | # How to prevent eslint from blocking git commit?
I'm new to eslint and am using it to enforce coding style. However, when I write a `TODO` item into my code I get an eslint warning, alright that's fine. But, now when I try to git commit, it comes back with:
```
**** ESLint errors found :
line 145, col 9, Warnin... | You have a pre-commit hook.
```
git commit --no-verify
```
allows to avoid it once. Or you can remove it completely from .git/hooks. |
6258440 | Find a Git branch containing changes to a given file | 171 | 2011-06-06 21:50:22 | <p>I have 57 local branches. I know I made a change to a certain file in one of them, but I'm not sure which one. Is there some kind of command I can run to find which branches contain changes to a certain file?</p>
| 58,064 | 292,709 | 2024-10-16 03:30:58 | 6,258,472 | 143 | 2011-06-06 21:53:22 | 719,673 | 2017-03-28 01:10:57 | https://stackoverflow.com/q/6258440 | https://stackoverflow.com/a/6258472 | <p>Find all branches which contain a change to FILENAME (even if before the (non-recorded) branch point)</p>
<pre><code>FILENAME="<filename>"
git log --all --format=%H $FILENAME | while read f; do git branch --contains $f; done | sort -u
</code></pre>
<p>Manually inspect:</p>
<pre><code>gitk --all --date-order... | <p>Find all branches which contain a change to FILENAME (even if before the (non-recorded) branch point)</p> <pre><code>FILENAME="<filename>" git log --all --format=%H $FILENAME | while read f; do git branch --contains $f; done | sort -u </code></pre> <p>Manually inspect:</p> <pre><code>gitk --all --date-order... | 119 | git | <h1>Find a Git branch containing changes to a given file</h1>
<p>I have 57 local branches. I know I made a change to a certain file in one of them, but I'm not sure which one. Is there some kind of command I can run to find which branches contain changes to a certain file?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,460 | git | # Find a Git branch containing changes to a given file
I have 57 local branches. I know I made a change to a certain file in one of them, but I'm not sure which one. Is there some kind of command I can run to find which branches contain changes to a certain file? | Find all branches which contain a change to FILENAME (even if before the (non-recorded) branch point)
```
FILENAME="<filename>"
git log --all --format=%H $FILENAME | while read f; do git branch --contains $f; done | sort -u
```
Manually inspect:
```
gitk --all --date-order -- $FILENAME
```
Find all changes to FILEN... |
36082788 | What is Git pruning? | 143 | 2016-03-18 11:05:57 | <p>I've accidentally pruned some remote branches and I don't really know what the consequence of this is (I clicked the "Prune remote branches" button in Git Extensions, thinking it would delete a remote branch).</p>
<p>The official documentation says "git-prune - Prune all unreachable objects from the object database... | 163,896 | 213,590 | 2021-10-28 07:45:46 | 36,083,638 | 143 | 2016-03-18 11:51:23 | 1,615,903 | 2021-10-28 07:45:46 | https://stackoverflow.com/q/36082788 | https://stackoverflow.com/a/36083638 | <p>"Prune remote branches" in Git Extensions executes <code>git remote prune</code> command, which removes your local remote tracking branches where the branch no longer exists on the remote.</p>
<p>See here: <a href="https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem" rel="noreferrer"... | <p>"Prune remote branches" in Git Extensions executes <code>git remote prune</code> command, which removes your local remote tracking branches where the branch no longer exists on the remote.</p> <p>See here: <a href="https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem" rel="noreferrer"... | 119, 39597 | git, git-extensions | <h1>What is Git pruning?</h1>
<p>I've accidentally pruned some remote branches and I don't really know what the consequence of this is (I clicked the "Prune remote branches" button in Git Extensions, thinking it would delete a remote branch).</p>
<p>The official documentation says "git-prune - Prune all unreachable ob... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,461 | git | # What is Git pruning?
I've accidentally pruned some remote branches and I don't really know what the consequence of this is (I clicked the "Prune remote branches" button in Git Extensions, thinking it would delete a remote branch).
The official documentation says "git-prune - Prune all unreachable objects from the o... | "Prune remote branches" in Git Extensions executes `git remote prune` command, which removes your local remote tracking branches where the branch no longer exists on the remote.
See here: <https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem>
> Deletes stale references associated with <name>. By... |
26961371 | Switch on another branch (create if not exists), without checking if already exists? | 138 | 2014-11-16 19:54:46 | <p><code>git checkout -b foo</code> switches on <code>foo</code> branch (even if it doesn't exist, it is created), but if the <code>foo</code> branch already exists it throws an error like this:</p>
<pre><code>fatal: A branch named 'foo' already exists.
</code></pre>
<p>What's the command that does the following chec... | 118,896 | 1,420,197 | 2024-09-22 10:39:24 | 26,961,416 | 143 | 2014-11-16 19:59:11 | 6,309 | 2024-01-31 07:40:30 | https://stackoverflow.com/q/26961371 | https://stackoverflow.com/a/26961416 | <p>Update Q3 2019 (Git 2.23): there now actually is a <a href="https://stackoverflow.com/a/57066202/6309"><code>git switch</code> command</a>!</p>
<pre><code>git switch -c aBranch
</code></pre>
<p>Or, if the branch already exists:</p>
<pre><code>git switch aBranch
</code></pre>
<p>As I <a href="https://stackoverflow.c... | <p>Update Q3 2019 (Git 2.23): there now actually is a <a href="https://stackoverflow.com/a/57066202/6309"><code>git switch</code> command</a>!</p> <pre><code>git switch -c aBranch </code></pre> <p>Or, if the branch already exists:</p> <pre><code>git switch aBranch </code></pre> <p>As I <a href="https://stackoverflow.c... | 119, 1879 | branch, git | <h1>Switch on another branch (create if not exists), without checking if already exists?</h1>
<p><code>git checkout -b foo</code> switches on <code>foo</code> branch (even if it doesn't exist, it is created), but if the <code>foo</code> branch already exists it throws an error like this:</p>
<pre><code>fatal: A branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,462 | git | # Switch on another branch (create if not exists), without checking if already exists?
`git checkout -b foo` switches on `foo` branch (even if it doesn't exist, it is created), but if the `foo` branch already exists it throws an error like this:
```
fatal: A branch named 'foo' already exists.
```
What's the command ... | Update Q3 2019 (Git 2.23): there now actually is a [`git switch` command](https://stackoverflow.com/a/57066202/6309)!
```
git switch -c aBranch
```
Or, if the branch already exists:
```
git switch aBranch
```
As I [explained in 2020](https://stackoverflow.com/questions/58003030/what-is-the-git-restore-command-and-w... |
1402390 | Git push/clone to new server | 134 | 2009-09-09 22:06:26 | <p>I'm just learning Git and there is something I can't work out. After creating and using a git repository locally on my Mac, can I push a copy to another server somewhere else? I am behind a firewall so unfortunately I can't run <code>git clone</code> from the other machine.</p>
| 138,100 | null | 2019-05-15 00:09:55 | 1,402,445 | 143 | 2009-09-09 22:20:39 | 152,948 | 2015-06-02 06:25:44 | https://stackoverflow.com/q/1402390 | https://stackoverflow.com/a/1402445 | <ol>
<li><code>git remote add</code> <em>name</em> <em>url</em></li>
<li><code>git push</code> <em>name</em> <em>branch</em></li>
</ol>
<p>Example:</p>
<pre><code>git remote add origin git@github.com:foo/bar.git
git push origin master
</code></pre>
<p>See the docs for <code>git push</code> -- you can set a remote as... | <ol> <li><code>git remote add</code> <em>name</em> <em>url</em></li> <li><code>git push</code> <em>name</em> <em>branch</em></li> </ol> <p>Example:</p> <pre><code>git remote add origin git@github.com:foo/bar.git git push origin master </code></pre> <p>See the docs for <code>git push</code> -- you can set a remote as... | 119 | git | <h1>Git push/clone to new server</h1>
<p>I'm just learning Git and there is something I can't work out. After creating and using a git repository locally on my Mac, can I push a copy to another server somewhere else? I am behind a firewall so unfortunately I can't run <code>git clone</code> from the other machine.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,463 | git | # Git push/clone to new server
I'm just learning Git and there is something I can't work out. After creating and using a git repository locally on my Mac, can I push a copy to another server somewhere else? I am behind a firewall so unfortunately I can't run `git clone` from the other machine. | 1. `git remote add` *name* *url*
2. `git push` *name* *branch*
Example:
```
git remote add origin git@github.com:foo/bar.git
git push origin master
```
See the docs for `git push` -- you can set a remote as the default remote for a given branch; if you don't, the name `origin` is special. Just `git push` alone will ... |
1677121 | Is there an ignore command for git like there is for svn? | 132 | 2009-11-04 22:30:03 | <p>I am a new user to <code>git</code> and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for <code>git</code> like there is for <code>svn</code>?</p>
| 135,320 | 165,119 | 2020-12-18 13:26:51 | 1,677,198 | 143 | 2009-11-04 22:43:29 | 182,675 | 2012-02-12 13:46:52 | https://stackoverflow.com/q/1677121 | https://stackoverflow.com/a/1677198 | <p>There is no special <code>git ignore</code> command.</p>
<p>Edit a <code>.gitignore</code> file located in the appropriate place within the working copy. You should then add this <code>.gitignore</code> and commit it. Everyone who clones that repo will than have those files ignored.</p>
<p>Note that only file name... | <p>There is no special <code>git ignore</code> command.</p> <p>Edit a <code>.gitignore</code> file located in the appropriate place within the working copy. You should then add this <code>.gitignore</code> and commit it. Everyone who clones that repo will than have those files ignored.</p> <p>Note that only file name... | 119, 4333, 25056 | git, gitignore, ignore | <h1>Is there an ignore command for git like there is for svn?</h1>
<p>I am a new user to <code>git</code> and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for <code>git</code> like there is for <code>svn</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,464 | git | # Is there an ignore command for git like there is for svn?
I am a new user to `git` and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for `git` like there is for `svn`? | There is no special `git ignore` command.
Edit a `.gitignore` file located in the appropriate place within the working copy. You should then add this `.gitignore` and commit it. Everyone who clones that repo will than have those files ignored.
Note that only file names starting with `/` will be relative to the direct... |
9701238 | Git - how delete file from remote repository | 112 | 2012-03-14 11:39:44 | <p>How can I delete a file from a remote git repository?
I have a file that I just deleted from a local repository, and I want to delete it from its corresponding remote repository.</p>
| 239,172 | 916,242 | 2023-02-15 21:31:25 | 9,701,296 | 143 | 2012-03-14 11:43:31 | 487,534 | 2012-03-14 11:43:31 | https://stackoverflow.com/q/9701238 | https://stackoverflow.com/a/9701296 | <p>If you deleted a file from the working tree, then commit the deletion:</p>
<pre><code>git commit -a -m "A file was deleted"
</code></pre>
<p>And push your commit upstream:</p>
<pre><code>git push
</code></pre>
| <p>If you deleted a file from the working tree, then commit the deletion:</p> <pre><code>git commit -a -m "A file was deleted" </code></pre> <p>And push your commit upstream:</p> <pre><code>git push </code></pre> | 119 | git | <h1>Git - how delete file from remote repository</h1>
<p>How can I delete a file from a remote git repository?
I have a file that I just deleted from a local repository, and I want to delete it from its corresponding remote repository.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,466 | git | # Git - how delete file from remote repository
How can I delete a file from a remote git repository?
I have a file that I just deleted from a local repository, and I want to delete it from its corresponding remote repository. | If you deleted a file from the working tree, then commit the deletion:
```
git commit -a -m "A file was deleted"
```
And push your commit upstream:
```
git push
``` |
11258737 | Restore git submodules from .gitmodules | 111 | 2012-06-29 08:50:21 | <p>I have a folder, which was a git repo. It contains some files and .gitmodules file. Now, when I do <code>git init</code> and then <code>git submodule init</code>, the latter command output is nothing. How can I help git to see submodules, defined in .gitmodules file without running <code>git submodule add</code> by ... | 55,790 | 229,151 | 2025-07-31 10:19:09 | 11,258,810 | 143 | 2012-06-29 08:54:32 | 223,092 | 2022-08-24 18:00:36 | https://stackoverflow.com/q/11258737 | https://stackoverflow.com/a/11258810 | <p><code>git submodule init</code> only considers submodules that already are in the index (i.e. "staged") for initialization. I would write a short script that parses <code>.gitmodules</code>, and for each <code>url</code> and <code>path</code> pair runs:</p>
<pre><code>git submodule add <url> <pat... | <p><code>git submodule init</code> only considers submodules that already are in the index (i.e. "staged") for initialization. I would write a short script that parses <code>.gitmodules</code>, and for each <code>url</code> and <code>path</code> pair runs:</p> <pre><code>git submodule add <url> <pat... | 119, 41612 | git, git-submodules | <h1>Restore git submodules from .gitmodules</h1>
<p>I have a folder, which was a git repo. It contains some files and .gitmodules file. Now, when I do <code>git init</code> and then <code>git submodule init</code>, the latter command output is nothing. How can I help git to see submodules, defined in .gitmodules file w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,467 | git | # Restore git submodules from .gitmodules
I have a folder, which was a git repo. It contains some files and .gitmodules file. Now, when I do `git init` and then `git submodule init`, the latter command output is nothing. How can I help git to see submodules, defined in .gitmodules file without running `git submodule a... | `git submodule init` only considers submodules that already are in the index (i.e. "staged") for initialization. I would write a short script that parses `.gitmodules`, and for each `url` and `path` pair runs:
```
git submodule add <url> <path>
```
For example, you could use the following script:
```
#!/bin/sh
set ... |
16562121 | What is the difference between git diff HEAD vs. git diff --staged? | 109 | 2013-05-15 10:01:55 | <p>What is the difference between <code>git diff HEAD</code> and <code>git diff --staged</code>? I tried both but both give the same output.</p>
| 113,745 | 2,227,093 | 2021-12-23 19:34:16 | 16,562,782 | 143 | 2013-05-15 10:35:13 | 592,540 | 2013-05-15 10:35:13 | https://stackoverflow.com/q/16562121 | https://stackoverflow.com/a/16562782 | <p>Suppose this output for <code>git status</code>:</p>
<pre><code>$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: y
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git c... | <p>Suppose this output for <code>git status</code>:</p> <pre><code>$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: y # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git c... | 119 | git | <h1>What is the difference between git diff HEAD vs. git diff --staged?</h1>
<p>What is the difference between <code>git diff HEAD</code> and <code>git diff --staged</code>? I tried both but both give the same output.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,468 | git | # What is the difference between git diff HEAD vs. git diff --staged?
What is the difference between `git diff HEAD` and `git diff --staged`? I tried both but both give the same output. | Suppose this output for `git status`:
```
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: y
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard chan... |
12293944 | How to find the path of the local git repository when I am possibly in a subdirectory | 97 | 2012-09-06 06:11:05 | <p>I'm looking for something like <code>git list-path</code> printing the
path of the associated repository (the <code>.git</code> directory).</p>
<p>A bit of background: I have set up git version control on quite a few of my
projects/folders. Some of them are nested, so one directory with echo own repository is a su... | 208,796 | 65,889 | 2012-09-06 07:29:47 | 12,293,994 | 143 | 2012-09-06 06:15:04 | 6,309 | 2012-09-06 07:29:47 | https://stackoverflow.com/q/12293944 | https://stackoverflow.com/a/12293994 | <pre><code>git rev-parse --show-toplevel
</code></pre>
<p>could be enough if executed within a git repo.<br>
From <a href="http://git-scm.com/docs/git-rev-parse" rel="noreferrer"><code>git rev-parse</code></a> man page:</p>
<pre><code>--show-toplevel
</code></pre>
<blockquote>
<p>Show the absolute path of the top-... | <pre><code>git rev-parse --show-toplevel </code></pre> <p>could be enough if executed within a git repo.<br> From <a href="http://git-scm.com/docs/git-rev-parse" rel="noreferrer"><code>git rev-parse</code></a> man page:</p> <pre><code>--show-toplevel </code></pre> <blockquote> <p>Show the absolute path of the top-... | 119, 421, 6268 | environment, git, path | <h1>How to find the path of the local git repository when I am possibly in a subdirectory</h1>
<p>I'm looking for something like <code>git list-path</code> printing the
path of the associated repository (the <code>.git</code> directory).</p>
<p>A bit of background: I have set up git version control on quite a few of m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,469 | git | # How to find the path of the local git repository when I am possibly in a subdirectory
I'm looking for something like `git list-path` printing the
path of the associated repository (the `.git` directory).
A bit of background: I have set up git version control on quite a few of my
projects/folders. Some of them are n... | ```
git rev-parse --show-toplevel
```
could be enough if executed within a git repo.
From [`git rev-parse`](http://git-scm.com/docs/git-rev-parse) man page:
```
--show-toplevel
```
> Show the absolute path of the top-level directory.
For older versions (before 1.7.x), the other options are listed in "[Is there a ... |
978052 | How can I make my local repository available for git-pull? | 94 | 2009-06-10 20:45:41 | <p>I have a working copy repository that I've been working in no problem; the origin for this repository is on GitHub. </p>
<p>I'd like to make my working copy repository available as the origin for my build machine (a VM on another physical host), so that commits I make to my working copy can be built and tested on ... | 85,455 | 5,296 | 2015-11-11 07:44:36 | 978,417 | 143 | 2009-06-10 22:13:13 | 46,058 | 2014-06-11 23:07:46 | https://stackoverflow.com/q/978052 | https://stackoverflow.com/a/978417 | <p>Five possibilities exist to set up a repository for pull from:</p>
<ul>
<li><strong>local filesystem</strong>: <code>git clone /path/to/repo</code> or <code>git clone file://path/to/repo</code>. Least work if you have networked filesystem, but not very efficient use of network. <em>(This is almost exactly solution ... | <p>Five possibilities exist to set up a repository for pull from:</p> <ul> <li><strong>local filesystem</strong>: <code>git clone /path/to/repo</code> or <code>git clone file://path/to/repo</code>. Least work if you have networked filesystem, but not very efficient use of network. <em>(This is almost exactly solution ... | 119, 4860, 19697, 28896 | git, git-pull, pull, working-copy | <h1>How can I make my local repository available for git-pull?</h1>
<p>I have a working copy repository that I've been working in no problem; the origin for this repository is on GitHub. </p>
<p>I'd like to make my working copy repository available as the origin for my build machine (a VM on another physical host), s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,472 | git | # How can I make my local repository available for git-pull?
I have a working copy repository that I've been working in no problem; the origin for this repository is on GitHub.
I'd like to make my working copy repository available as the origin for my build machine (a VM on another physical host), so that commits I m... | Five possibilities exist to set up a repository for pull from:
- **local filesystem**: `git clone /path/to/repo` or `git clone file://path/to/repo`. Least work if you have networked filesystem, but not very efficient use of network. *(This is almost exactly solution proposed by [Joakim Elofsson](https://stackoverflow.... |
8170436 | Git Remote: Error: fatal: protocol error: bad line length character: Unab | 164 | 2011-11-17 16:11:52 | <p>I set up a git server and want now to push initially my repo from the client.
I used <code>git push origin master</code> and get this error message:</p>
<pre><code>fatal: protocol error: bad line length character: Unab
</code></pre>
<p>I don't know what's wrong. I don't know what "Unab" is. I tried to resize the s... | 277,127 | 437,899 | 2024-11-18 07:10:50 | 8,175,315 | 142 | 2011-11-17 22:29:15 | 729,881 | 2017-04-19 16:18:15 | https://stackoverflow.com/q/8170436 | https://stackoverflow.com/a/8175315 | <p>This error message is a bit obtuse, but what it's actually trying to tell you is that the remote server didn't reply with a proper git response. Ultimately, there was a problem on the server running the <code>git-receive-pack</code> process.</p>
<p>In the Git protocol, the first four bytes should be the line lengt... | <p>This error message is a bit obtuse, but what it's actually trying to tell you is that the remote server didn't reply with a proper git response. Ultimately, there was a problem on the server running the <code>git-receive-pack</code> process.</p> <p>In the Git protocol, the first four bytes should be the line lengt... | 119, 386, 51877 | authorized-keys, git, ssh | <h1>Git Remote: Error: fatal: protocol error: bad line length character: Unab</h1>
<p>I set up a git server and want now to push initially my repo from the client.
I used <code>git push origin master</code> and get this error message:</p>
<pre><code>fatal: protocol error: bad line length character: Unab
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,476 | git | # Git Remote: Error: fatal: protocol error: bad line length character: Unab
I set up a git server and want now to push initially my repo from the client.
I used `git push origin master` and get this error message:
```
fatal: protocol error: bad line length character: Unab
```
I don't know what's wrong. I don't know ... | This error message is a bit obtuse, but what it's actually trying to tell you is that the remote server didn't reply with a proper git response. Ultimately, there was a problem on the server running the `git-receive-pack` process.
In the Git protocol, the first four bytes should be the line length. Instead, they were ... |
5480069 | autosetuprebase vs autosetupmerge | 89 | 2011-03-29 23:16:58 | <p>I was just knocking around in my global <code>.gitconfig</code> file and I noticed that I've managed to end up with this:</p>
<pre><code>[branch]
autosetupmerge = always
autosetuprebase = always
</code></pre>
<p>That seemed more than a little counterintuitive, but after doing some reading, I still have no idea... | 52,377 | 1,665 | 2020-11-12 15:40:18 | 22,147,540 | 142 | 2014-03-03 13:02:13 | 1,147,783 | 2014-03-03 13:02:13 | https://stackoverflow.com/q/5480069 | https://stackoverflow.com/a/22147540 | <p>What is counterintuitive here is the naming of these preferences. They do look like they refer to the same functionality, but in fact they don't:</p>
<ul>
<li><code>autosetupmerge</code> controls whether <code>git branch</code> and <code>git checkout -b</code> imply the <code>--track</code> option, i.e. with your s... | <p>What is counterintuitive here is the naming of these preferences. They do look like they refer to the same functionality, but in fact they don't:</p> <ul> <li><code>autosetupmerge</code> controls whether <code>git branch</code> and <code>git checkout -b</code> imply the <code>--track</code> option, i.e. with your s... | 119 | git | <h1>autosetuprebase vs autosetupmerge</h1>
<p>I was just knocking around in my global <code>.gitconfig</code> file and I noticed that I've managed to end up with this:</p>
<pre><code>[branch]
autosetupmerge = always
autosetuprebase = always
</code></pre>
<p>That seemed more than a little counterintuitive, but aft... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,479 | git | # autosetuprebase vs autosetupmerge
I was just knocking around in my global `.gitconfig` file and I noticed that I've managed to end up with this:
```
[branch]
autosetupmerge = always
autosetuprebase = always
```
That seemed more than a little counterintuitive, but after doing some reading, I still have no idea ... | What is counterintuitive here is the naming of these preferences. They do look like they refer to the same functionality, but in fact they don't:
- `autosetupmerge` controls whether `git branch` and `git checkout -b` imply the `--track` option, i.e. with your setting of `always`,
- `git checkout branchname`, if `bra... |
2004024 | How can I permanently delete a file stored in Git? | 78 | 2010-01-05 03:36:27 | <p>I backed up my database to Git just so I could get the database at my home computer.</p>
<p>I don't want this file to be versioned. It was just a one-time thing really.</p>
<p>Can I delete it for good, so Git doesn't keep track of it going forward or historically?</p>
| 70,555 | 68,183 | 2025-06-18 00:04:39 | 2,004,311 | 142 | 2010-01-05 05:18:13 | 66,353 | 2014-03-27 17:21:19 | https://stackoverflow.com/q/2004024 | https://stackoverflow.com/a/2004311 | <p>I always find <a href="http://github.com/guides/completely-remove-a-file-from-all-revisions" rel="noreferrer">Guides: Completely remove a file from all revisions feed</a> helpful.</p>
<blockquote>
<p>To remove the file called <code>Rakefile</code>:</p>
<pre><code>git filter-branch --force --index-filter \
'git... | <p>I always find <a href="http://github.com/guides/completely-remove-a-file-from-all-revisions" rel="noreferrer">Guides: Completely remove a file from all revisions feed</a> helpful.</p> <blockquote> <p>To remove the file called <code>Rakefile</code>:</p> <pre><code>git filter-branch --force --index-filter \ 'git... | 119 | git | <h1>How can I permanently delete a file stored in Git?</h1>
<p>I backed up my database to Git just so I could get the database at my home computer.</p>
<p>I don't want this file to be versioned. It was just a one-time thing really.</p>
<p>Can I delete it for good, so Git doesn't keep track of it going forward or histor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,480 | git | # How can I permanently delete a file stored in Git?
I backed up my database to Git just so I could get the database at my home computer.
I don't want this file to be versioned. It was just a one-time thing really.
Can I delete it for good, so Git doesn't keep track of it going forward or historically? | I always find [Guides: Completely remove a file from all revisions feed](http://github.com/guides/completely-remove-a-file-from-all-revisions) helpful.
> To remove the file called `Rakefile`:
>
> ```
> git filter-branch --force --index-filter \
> 'git rm --cached --ignore-unmatch Rakefile' \
> --prune-empty --tag-... |
50837605 | git install fails in Dockerfile | 67 | 2018-06-13 12:42:57 | <p>I'm trying to pull the repository I'm working on while doing a docker build, so I followed <a href="https://vsupalov.com/build-docker-image-clone-private-repo-ssh-key/" rel="noreferrer">this tutorial</a> so I added in my <code>Dockerfile</code></p>
<pre><code># this is our first build stage, it will not persist in t... | 125,234 | 629,127 | 2020-05-18 18:47:07 | 50,837,652 | 142 | 2018-06-13 12:45:02 | 3,324,556 | 2018-12-01 01:35:02 | https://stackoverflow.com/q/50837605 | https://stackoverflow.com/a/50837652 | <p>You are overanalyzing this. It's just a simple typo. Should be:</p>
<pre><code>RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git
</code></pre>
<p>Those are 3 separate commands.</p>
| <p>You are overanalyzing this. It's just a simple typo. Should be:</p> <pre><code>RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y git </code></pre> <p>Those are 3 separate commands.</p> | 119, 90304 | docker, git | <h1>git install fails in Dockerfile</h1>
<p>I'm trying to pull the repository I'm working on while doing a docker build, so I followed <a href="https://vsupalov.com/build-docker-image-clone-private-repo-ssh-key/" rel="noreferrer">this tutorial</a> so I added in my <code>Dockerfile</code></p>
<pre><code># this is our fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,481 | git | # git install fails in Dockerfile
I'm trying to pull the repository I'm working on while doing a docker build, so I followed [this tutorial](https://vsupalov.com/build-docker-image-clone-private-repo-ssh-key/) so I added in my `Dockerfile`
```
# this is our first build stage, it will not persist in the final image
FR... | You are overanalyzing this. It's just a simple typo. Should be:
```
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git
```
Those are 3 separate commands. |
8550586 | How to push from one branch to another and checkout? | 59 | 2011-12-18 08:20:11 | <p>I am trying to implement the setup outlined here <a href="http://toroid.org/ams/git-website-howto" rel="noreferrer">http://toroid.org/ams/git-website-howto</a> but with one difference. On my local repository I want to use a branch different to master.</p>
<p>So when I go to push the initial files rather than push t... | 54,548 | 398,706 | 2011-12-18 08:44:02 | 8,550,664 | 142 | 2011-12-18 08:44:02 | 903,194 | 2011-12-18 08:44:02 | https://stackoverflow.com/q/8550586 | https://stackoverflow.com/a/8550664 | <p>If the local branch is called "demo" and you want to push to branch called "master" on the remote called "web", then do the following:</p>
<pre><code>git push web demo:master
</code></pre>
<p>If you want to merge from the "master" branch on the remote "web" into your current branch, you can do the following:</p>
... | <p>If the local branch is called "demo" and you want to push to branch called "master" on the remote called "web", then do the following:</p> <pre><code>git push web demo:master </code></pre> <p>If you want to merge from the "master" branch on the remote "web" into your current branch, you can do the following:</p> ... | 119 | git | <h1>How to push from one branch to another and checkout?</h1>
<p>I am trying to implement the setup outlined here <a href="http://toroid.org/ams/git-website-howto" rel="noreferrer">http://toroid.org/ams/git-website-howto</a> but with one difference. On my local repository I want to use a branch different to master.</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,482 | git | # How to push from one branch to another and checkout?
I am trying to implement the setup outlined here <http://toroid.org/ams/git-website-howto> but with one difference. On my local repository I want to use a branch different to master.
So when I go to push the initial files rather than push the master files I want ... | If the local branch is called "demo" and you want to push to branch called "master" on the remote called "web", then do the following:
```
git push web demo:master
```
If you want to merge from the "master" branch on the remote "web" into your current branch, you can do the following:
```
git fetch web
git merge web... |
20467179 | Git push rejected "non-fast-forward" | 187 | 2013-12-09 09:26:54 | <p>I am fairly new to <code>git</code>, yet currently using it to manage our code in a team environment. I had some rebasing issues, and I fixed them using:</p>
<pre><code>git checkout --ours filename.txt
git add filename.txt
git rebase --continue
</code></pre>
<p>Now I wish to push my changes, and so running the follo... | 681,974 | 1,068,879 | 2024-05-17 14:18:59 | 20,467,414 | 141 | 2013-12-09 09:37:51 | 1,860,309 | 2013-12-09 11:53:02 | https://stackoverflow.com/q/20467179 | https://stackoverflow.com/a/20467414 | <p>It looks, that someone pushed new commits between your last <code>git fetch</code> and <code>git push</code>. In this case you need to repeat your steps and rebase <code>my_feature_branch</code> one more time.</p>
<pre><code>git fetch
git rebase feature/my_feature_branch
git push origin feature/my_feature_branch
</... | <p>It looks, that someone pushed new commits between your last <code>git fetch</code> and <code>git push</code>. In this case you need to repeat your steps and rebase <code>my_feature_branch</code> one more time.</p> <pre><code>git fetch git rebase feature/my_feature_branch git push origin feature/my_feature_branch </... | 119, 4236, 8974 | git, push, rebase | <h1>Git push rejected "non-fast-forward"</h1>
<p>I am fairly new to <code>git</code>, yet currently using it to manage our code in a team environment. I had some rebasing issues, and I fixed them using:</p>
<pre><code>git checkout --ours filename.txt
git add filename.txt
git rebase --continue
</code></pre>
<p>Now I wis... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,483 | git | # Git push rejected "non-fast-forward"
I am fairly new to `git`, yet currently using it to manage our code in a team environment. I had some rebasing issues, and I fixed them using:
```
git checkout --ours filename.txt
git add filename.txt
git rebase --continue
```
Now I wish to push my changes, and so running the f... | It looks, that someone pushed new commits between your last `git fetch` and `git push`. In this case you need to repeat your steps and rebase `my_feature_branch` one more time.
```
git fetch
git rebase feature/my_feature_branch
git push origin feature/my_feature_branch
```
After the `git fetch` I recommend to examine... |
2020812 | How can I view all the git repositories on my machine? | 186 | 2010-01-07 14:03:54 | <p>Is there a way in which I can see all the git repositories that exist on my machine? Any command for that?</p>
| 197,951 | 235,246 | 2024-02-17 06:29:40 | 2,020,820 | 141 | 2010-01-07 14:04:50 | 78,667 | 2010-01-07 14:04:50 | https://stackoverflow.com/q/2020812 | https://stackoverflow.com/a/2020820 | <p>If you are in Linux <code>find / -name ".git"</code>, otherwise there is no way, they are standard directories, just use your OS file/folder find program to find <code>.git</code> named folders.</p>
| <p>If you are in Linux <code>find / -name ".git"</code>, otherwise there is no way, they are standard directories, just use your OS file/folder find program to find <code>.git</code> named folders.</p> | 119 | git | <h1>How can I view all the git repositories on my machine?</h1>
<p>Is there a way in which I can see all the git repositories that exist on my machine? Any command for that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,484 | git | # How can I view all the git repositories on my machine?
Is there a way in which I can see all the git repositories that exist on my machine? Any command for that? | If you are in Linux `find / -name ".git"`, otherwise there is no way, they are standard directories, just use your OS file/folder find program to find `.git` named folders. |
5519007 | How do I make git merge's default be --no-ff --no-commit? | 117 | 2011-04-01 21:21:16 | <p>Company policy is to use <code>--no-ff</code> for merge commits. I personally like to adjust merge log messages so I use <code>--no-commit</code>. Plus I like to actually compile and test before I let the commit go.</p>
<p>How do I make <code>--no-ff</code> and <code>--no-commit</code> the default for me for all br... | 56,190 | 431,272 | 2024-06-20 15:46:31 | 5,519,141 | 141 | 2011-04-01 21:36:00 | 140,750 | 2013-05-22 13:38:46 | https://stackoverflow.com/q/5519007 | https://stackoverflow.com/a/5519141 | <p>Put this in $HOME/.gitconfig:</p>
<pre><code>[merge]
ff = no
commit = no
</code></pre>
<p>You can use git-config to do this:</p>
<pre><code> git config --global merge.commit no
git config --global merge.ff no
</code></pre>
| <p>Put this in $HOME/.gitconfig:</p> <pre><code>[merge] ff = no commit = no </code></pre> <p>You can use git-config to do this:</p> <pre><code> git config --global merge.commit no git config --global merge.ff no </code></pre> | 119, 717 | git, merge | <h1>How do I make git merge's default be --no-ff --no-commit?</h1>
<p>Company policy is to use <code>--no-ff</code> for merge commits. I personally like to adjust merge log messages so I use <code>--no-commit</code>. Plus I like to actually compile and test before I let the commit go.</p>
<p>How do I make <code>--no-f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,486 | git | # How do I make git merge's default be --no-ff --no-commit?
Company policy is to use `--no-ff` for merge commits. I personally like to adjust merge log messages so I use `--no-commit`. Plus I like to actually compile and test before I let the commit go.
How do I make `--no-ff` and `--no-commit` the default for me for... | Put this in $HOME/.gitconfig:
```
[merge]
ff = no
commit = no
```
You can use git-config to do this:
```
git config --global merge.commit no
git config --global merge.ff no
``` |
14939953 | Sum the digits of a number | 111 | 2013-02-18 15:41:06 | <p>If I want to find the sum of the digits of a number, i.e.:</p>
<ul>
<li>Input: <code>932</code></li>
<li>Output: <code>14</code>, which is <code>(9 + 3 + 2)</code></li>
</ul>
<p>What is the fastest way of doing this?</p>
<p>I instinctively did:</p>
<pre><code>sum(int(digit) for digit in str(number))
</code></pre>
<p... | 305,968 | 2,076,507 | 2025-01-26 22:53:54 | 14,940,026 | 141 | 2013-02-18 15:45:41 | 830,012 | 2022-03-22 01:19:04 | https://stackoverflow.com/q/14939953 | https://stackoverflow.com/a/14940026 | <p>Both lines you posted are fine, but you can do it purely in integers, and it will be the most efficient:</p>
<pre><code>def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
</code></pre>
<p>or with <code>divmod</code>:</p>
<pre><code>def sum_digits2(n):
s = 0
while n:
... | <p>Both lines you posted are fine, but you can do it purely in integers, and it will be the most efficient:</p> <pre><code>def sum_digits(n): s = 0 while n: s += n % 10 n //= 10 return s </code></pre> <p>or with <code>divmod</code>:</p> <pre><code>def sum_digits2(n): s = 0 while n: ... | 16, 4928, 9914 | digits, python, sum | <h1>Sum the digits of a number</h1>
<p>If I want to find the sum of the digits of a number, i.e.:</p>
<ul>
<li>Input: <code>932</code></li>
<li>Output: <code>14</code>, which is <code>(9 + 3 + 2)</code></li>
</ul>
<p>What is the fastest way of doing this?</p>
<p>I instinctively did:</p>
<pre><code>sum(int(digit) for di... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,488 | git | # Sum the digits of a number
If I want to find the sum of the digits of a number, i.e.:
- Input: `932`
- Output: `14`, which is `(9 + 3 + 2)`
What is the fastest way of doing this?
I instinctively did:
```
sum(int(digit) for digit in str(number))
```
and I found this online:
```
sum(map(int, str(number)))
```
W... | Both lines you posted are fine, but you can do it purely in integers, and it will be the most efficient:
```
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
```
or with `divmod`:
```
def sum_digits2(n):
s = 0
while n:
n, remainder = divmod(n, 10)
s ... |
6117109 | Is it possible to have a custom .gitignore? Read only access? | 89 | 2011-05-24 21:26:00 | <p>I am working in a team environment, and there is already a <code>.gitignore</code> file.</p>
<p>I want to add more items to the <code>.gitignore</code> file, but I don't want to check this file in either. It is possible to set custom ignore files which only apply to me?</p>
<p>Also, I want to give someone read onl... | 24,892 | 39,677 | 2017-11-07 16:18:40 | 6,117,232 | 141 | 2011-05-24 21:38:33 | 166,749 | 2011-05-25 06:15:51 | https://stackoverflow.com/q/6117109 | https://stackoverflow.com/a/6117232 | <ol>
<li>Put your private ignore rules in <code>.git/info/exclude</code>. See <a href="http://git-scm.com/docs/gitignore"><code>gitignore(5)</code></a>.</li>
<li>For read-only access, use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html"><code>git-daemon</code></a>, a <a href="http://progit.org/... | <ol> <li>Put your private ignore rules in <code>.git/info/exclude</code>. See <a href="http://git-scm.com/docs/gitignore"><code>gitignore(5)</code></a>.</li> <li>For read-only access, use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html"><code>git-daemon</code></a>, a <a href="http://progit.org/... | 119, 25056 | git, gitignore | <h1>Is it possible to have a custom .gitignore? Read only access?</h1>
<p>I am working in a team environment, and there is already a <code>.gitignore</code> file.</p>
<p>I want to add more items to the <code>.gitignore</code> file, but I don't want to check this file in either. It is possible to set custom ignore file... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,489 | git | # Is it possible to have a custom .gitignore? Read only access?
I am working in a team environment, and there is already a `.gitignore` file.
I want to add more items to the `.gitignore` file, but I don't want to check this file in either. It is possible to set custom ignore files which only apply to me?
Also, I wan... | 1. Put your private ignore rules in `.git/info/exclude`. See [`gitignore(5)`](http://git-scm.com/docs/gitignore).
2. For read-only access, use [`git-daemon`](http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html), a [web server](http://progit.org/book/ch4-5.html), or Gitosis, or Gitolite. |
25458306 | git rm - fatal: pathspec did not match any files | 151 | 2014-08-23 04:00:32 | <p>I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from the disk. Committed.</p>
<p>Now I try to push changes to the git server. But it takes too long and tries to send 12 GB of data.</p>
<p>I checked files size on the disk and saw that really <code>.git</code> folder t... | 374,263 | 1,024,794 | 2024-06-19 16:32:27 | 25,458,504 | 140 | 2014-08-23 04:40:36 | 1,860,929 | 2024-06-19 16:32:27 | https://stackoverflow.com/q/25458306 | https://stackoverflow.com/a/25458504 | <p>In your case, use <a href="http://git-scm.com/docs/git-filter-branch" rel="nofollow noreferrer"><code>git filter-branch</code></a> instead of <code>git rm</code>.</p>
<p><code>git rm</code> will delete the files in the sense that they will not be tracked by git any more, but that does not remove the old commit objec... | <p>In your case, use <a href="http://git-scm.com/docs/git-filter-branch" rel="nofollow noreferrer"><code>git filter-branch</code></a> instead of <code>git rm</code>.</p> <p><code>git rm</code> will delete the files in the sense that they will not be tracked by git any more, but that does not remove the old commit objec... | 119, 46509 | git, git-filter-branch | <h1>git rm - fatal: pathspec did not match any files</h1>
<p>I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from the disk. Committed.</p>
<p>Now I try to push changes to the git server. But it takes too long and tries to send 12 GB of data.</p>
<p>I checked files size ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,493 | git | # git rm - fatal: pathspec did not match any files
I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from the disk. Committed.
Now I try to push changes to the git server. But it takes too long and tries to send 12 GB of data.
I checked files size on the disk and saw th... | In your case, use [`git filter-branch`](http://git-scm.com/docs/git-filter-branch) instead of `git rm`.
`git rm` will delete the files in the sense that they will not be tracked by git any more, but that does not remove the old commit objects corresponding to those images, and so you will still be stuck with pushing t... |
588414 | Rolling back a remote Git repository | 115 | 2009-02-25 23:33:52 | <p>I have a remote Git repository, and I need to roll back the last <code>n</code> commits into cold oblivion.</p>
| 109,932 | 10,675 | 2014-06-24 18:34:57 | 588,471 | 140 | 2009-02-25 23:51:17 | 1,277,510 | 2011-02-07 18:21:15 | https://stackoverflow.com/q/588414 | https://stackoverflow.com/a/588471 | <p>You can use <code>git revert <commit>…</code> for all the n commits, and then push as usual, keeping history unchanged.</p>
<p>Or you can "roll back" with <code>git reset --hard HEAD~n</code>. If you are pushing in a public or shared repository, you may diverge and break others work based on your original bra... | <p>You can use <code>git revert <commit>…</code> for all the n commits, and then push as usual, keeping history unchanged.</p> <p>Or you can "roll back" with <code>git reset --hard HEAD~n</code>. If you are pushing in a public or shared repository, you may diverge and break others work based on your original bra... | 119 | git | <h1>Rolling back a remote Git repository</h1>
<p>I have a remote Git repository, and I need to roll back the last <code>n</code> commits into cold oblivion.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,495 | git | # Rolling back a remote Git repository
I have a remote Git repository, and I need to roll back the last `n` commits into cold oblivion. | You can use `git revert <commit>…` for all the n commits, and then push as usual, keeping history unchanged.
Or you can "roll back" with `git reset --hard HEAD~n`. If you are pushing in a public or shared repository, you may diverge and break others work based on your original branch. Git will prevent you doing so, bu... |
2615378 | How to use Git properly with Xcode? | 99 | 2010-04-10 23:11:32 | <p>I have been an iphone developer for a while, and I have recently been including git in my workflow. I have used git settings found on <a href="http://shanesbrain.net/2008/7/9/using-xcode-with-git" rel="noreferrer">http://shanesbrain.net/2008/7/9/using-xcode-with-git</a> for my workflow so far.</p>
<p>Those setting... | 46,985 | 205,007 | 2018-11-22 03:18:14 | 2,615,786 | 140 | 2010-04-11 02:00:04 | 6,330 | 2014-10-09 15:37:04 | https://stackoverflow.com/q/2615378 | https://stackoverflow.com/a/2615786 | <p>I have worked on iPhone applications full time since the SDK launch, most of that time spent working on teams with multiple developers.</p>
<p>The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful. As you say, when you add a file unless other people get that file, the... | <p>I have worked on iPhone applications full time since the SDK launch, most of that time spent working on teams with multiple developers.</p> <p>The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful. As you say, when you add a file unless other people get that file, the... | 119, 908, 7003, 58338 | git, ios, objective-c, xcode | <h1>How to use Git properly with Xcode?</h1>
<p>I have been an iphone developer for a while, and I have recently been including git in my workflow. I have used git settings found on <a href="http://shanesbrain.net/2008/7/9/using-xcode-with-git" rel="noreferrer">http://shanesbrain.net/2008/7/9/using-xcode-with-git</a> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,497 | git | # How to use Git properly with Xcode?
I have been an iphone developer for a while, and I have recently been including git in my workflow. I have used git settings found on <http://shanesbrain.net/2008/7/9/using-xcode-with-git> for my workflow so far.
Those settings tell git to exclude *.pbxproj from merges? Is there ... | I have worked on iPhone applications full time since the SDK launch, most of that time spent working on teams with multiple developers.
The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful. As you say, when you add a file unless other people get that file, they have to a... |
6151970 | How do you remove a tag from a remote repository | 98 | 2011-05-27 12:01:20 | <p>Is it possible to untag a revision that has been push upstream using git.</p>
<p>This is what has happened:</p>
<pre><code>git tag 1.1
git push --tags origin master
</code></pre>
<p>Doh! That was meant to be version 1.1beta</p>
<p>Can you rebase and repush upstream. No other member of my team has pulled from origin ... | 58,286 | 730,098 | 2024-01-22 09:32:04 | 6,151,985 | 140 | 2011-05-27 12:03:02 | 41,116 | 2011-05-28 10:53:25 | https://stackoverflow.com/q/6151970 | https://stackoverflow.com/a/6151985 | <p>You can delete a remote tag the same way that you <a href="http://365git.tumblr.com/post/508913253/deleting-branches-on-a-remote" rel="noreferrer">delete a remote branch</a>.</p>
<pre><code>git push origin :1.1
</code></pre>
<p>And delete your local tag with:</p>
<pre><code>git tag -d 1.1
</code></pre>
| <p>You can delete a remote tag the same way that you <a href="http://365git.tumblr.com/post/508913253/deleting-branches-on-a-remote" rel="noreferrer">delete a remote branch</a>.</p> <pre><code>git push origin :1.1 </code></pre> <p>And delete your local tag with:</p> <pre><code>git tag -d 1.1 </code></pre> | 119, 60718 | git, git-tag | <h1>How do you remove a tag from a remote repository</h1>
<p>Is it possible to untag a revision that has been push upstream using git.</p>
<p>This is what has happened:</p>
<pre><code>git tag 1.1
git push --tags origin master
</code></pre>
<p>Doh! That was meant to be version 1.1beta</p>
<p>Can you rebase and repush up... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,498 | git | # How do you remove a tag from a remote repository
Is it possible to untag a revision that has been push upstream using git.
This is what has happened:
```
git tag 1.1
git push --tags origin master
```
Doh! That was meant to be version 1.1beta
Can you rebase and repush upstream. No other member of my team has pull... | You can delete a remote tag the same way that you [delete a remote branch](http://365git.tumblr.com/post/508913253/deleting-branches-on-a-remote).
```
git push origin :1.1
```
And delete your local tag with:
```
git tag -d 1.1
``` |
14365736 | Warning: you are leaving 1 commit behind, not connected to any of your branches | 94 | 2013-01-16 19:01:27 | <p>EGit strikes again. I made the mistake of trying to switch to a different branch in EGit and it somehow messed up and checked out no branch. I then made a commit to this non-branch, and then when I realized I wasn't tracking the right branch, I ran the following:</p>
<pre><code>$ git checkout issue2
Warning: you ar... | 59,273 | 128,967 | 2022-02-08 20:40:21 | 14,365,803 | 140 | 2013-01-16 19:05:17 | 1,864,976 | 2013-01-16 19:05:17 | https://stackoverflow.com/q/14365736 | https://stackoverflow.com/a/14365803 | <p>you can <code>git cherry-pick bada553d</code> if it's just the one commit.</p>
<p>You can also reference anywhere you've been by using the reflog:</p>
<pre><code>git reflog
</code></pre>
<p>then use one of those commits:</p>
<pre><code>git checkout -b temp HEAD@{3}
</code></pre>
<p>to checkout and make a branch... | <p>you can <code>git cherry-pick bada553d</code> if it's just the one commit.</p> <p>You can also reference anywhere you've been by using the reflog:</p> <pre><code>git reflog </code></pre> <p>then use one of those commits:</p> <pre><code>git checkout -b temp HEAD@{3} </code></pre> <p>to checkout and make a branch... | 119, 456, 53847 | branching-and-merging, git, version-control | <h1>Warning: you are leaving 1 commit behind, not connected to any of your branches</h1>
<p>EGit strikes again. I made the mistake of trying to switch to a different branch in EGit and it somehow messed up and checked out no branch. I then made a commit to this non-branch, and then when I realized I wasn't tracking the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,499 | git | # Warning: you are leaving 1 commit behind, not connected to any of your branches
EGit strikes again. I made the mistake of trying to switch to a different branch in EGit and it somehow messed up and checked out no branch. I then made a commit to this non-branch, and then when I realized I wasn't tracking the right br... | you can `git cherry-pick bada553d` if it's just the one commit.
You can also reference anywhere you've been by using the reflog:
```
git reflog
```
then use one of those commits:
```
git checkout -b temp HEAD@{3}
```
to checkout and make a branch temp from where your current commit was 3 "times" ago. It's a bread ... |
14787776 | How to pull after a forced git push? | 77 | 2013-02-09 11:46:47 | <p>Suppose I pull changes from a git repo. Then the author of the repo force pushes to the central repo. Now I can't pull since the history is rewritten.</p>
<p>How can I pull the new commits (and abandon the old ones), assuming that the author force-pushed the correct version?</p>
<p>I know this is bad git workflow,... | 37,364 | 1,922,239 | 2024-10-23 13:43:22 | 14,787,801 | 140 | 2013-02-09 11:48:50 | 82,294 | 2017-08-02 18:03:08 | https://stackoverflow.com/q/14787776 | https://stackoverflow.com/a/14787801 | <h2>Throwing away your local changes</h2>
<p>If you want to discard your work, <code>fetch</code> and <code>reset</code>. For example, if you have a remote named <code>origin</code> and a branch named <code>master</code>:</p>
<pre><code>$ git fetch origin
$ git reset --hard origin/master # Destroys your work
</code>... | <h2>Throwing away your local changes</h2> <p>If you want to discard your work, <code>fetch</code> and <code>reset</code>. For example, if you have a remote named <code>origin</code> and a branch named <code>master</code>:</p> <pre><code>$ git fetch origin $ git reset --hard origin/master # Destroys your work </code>... | 119 | git | <h1>How to pull after a forced git push?</h1>
<p>Suppose I pull changes from a git repo. Then the author of the repo force pushes to the central repo. Now I can't pull since the history is rewritten.</p>
<p>How can I pull the new commits (and abandon the old ones), assuming that the author force-pushed the correct ver... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,500 | git | # How to pull after a forced git push?
Suppose I pull changes from a git repo. Then the author of the repo force pushes to the central repo. Now I can't pull since the history is rewritten.
How can I pull the new commits (and abandon the old ones), assuming that the author force-pushed the correct version?
I know th... | ## Throwing away your local changes
If you want to discard your work, `fetch` and `reset`. For example, if you have a remote named `origin` and a branch named `master`:
```
$ git fetch origin
$ git reset --hard origin/master # Destroys your work
```
## Keeping your local changes
If you don't want to throw away your... |
51979534 | How can I change the origin remote in VSCode? | 66 | 2018-08-23 06:27:41 | <p>VS Code is my actual IDE and git client for all my projects.
I'd like to change the origin remote of an actual repository.</p>
<p>How can i do it?</p>
| 95,311 | 1,834,361 | 2023-05-11 01:36:23 | 51,980,187 | 140 | 2018-08-23 07:10:50 | 5,698,740 | 2022-02-01 09:37:46 | https://stackoverflow.com/q/51979534 | https://stackoverflow.com/a/51980187 | <p>It can be done over the terminal. (VS code has a terminal)</p>
<ol>
<li><p>Go to the root of the directory.</p>
</li>
<li><p>List your existing remotes in order to get the name of the remote you want to change.</p>
<pre><code>$ git remote -v
origin git@github.com:USERNAME/REPOSITORY.git (fetch)
origin git@github.c... | <p>It can be done over the terminal. (VS code has a terminal)</p> <ol> <li><p>Go to the root of the directory.</p> </li> <li><p>List your existing remotes in order to get the name of the remote you want to change.</p> <pre><code>$ git remote -v origin git@github.com:USERNAME/REPOSITORY.git (fetch) origin git@github.c... | 119, 111608 | git, visual-studio-code | <h1>How can I change the origin remote in VSCode?</h1>
<p>VS Code is my actual IDE and git client for all my projects.
I'd like to change the origin remote of an actual repository.</p>
<p>How can i do it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,502 | git | # How can I change the origin remote in VSCode?
VS Code is my actual IDE and git client for all my projects.
I'd like to change the origin remote of an actual repository.
How can i do it? | It can be done over the terminal. (VS code has a terminal)
1. Go to the root of the directory.
2. List your existing remotes in order to get the name of the remote you want to change.
```
$ git remote -v
origin git@github.com:USERNAME/REPOSITORY.git (fetch)
origin git@github.com:USERNAME/REPOSITORY.git ... |
52195877 | How can I fix git commit error "Waiting for your editor to close the file..." with VS Code? | 159 | 2018-09-06 02:58:18 | <p>I'm trying just <code>git commit</code> and Git is giving this message:</p>
<blockquote>
<p>hint: Waiting for your editor to close the file...
/c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line
28: /Code.exe: No such file or directory error: There was a problem
with the editor 'code --wait... | 295,217 | 9,604,994 | 2025-07-15 18:33:58 | 52,196,507 | 139 | 2018-09-06 04:27:29 | 581,076 | 2022-04-27 13:09:50 | https://stackoverflow.com/q/52195877 | https://stackoverflow.com/a/52196507 | <p>Have you confirmed that <code>code</code> is accessible from the command line where you execute git commands?</p>
<p>You could run <code>code --version</code></p>
<p>BTW. When I execute <code>where code</code> I get <code>C:\Program Files\Microsoft VS Code\bin\code</code> - it's no longer installed in the %App_Data%... | <p>Have you confirmed that <code>code</code> is accessible from the command line where you execute git commands?</p> <p>You could run <code>code --version</code></p> <p>BTW. When I execute <code>where code</code> I get <code>C:\Program Files\Microsoft VS Code\bin\code</code> - it's no longer installed in the %App_Data%... | 119, 53850, 111608 | git, git-commit, visual-studio-code | <h1>How can I fix git commit error "Waiting for your editor to close the file..." with VS Code?</h1>
<p>I'm trying just <code>git commit</code> and Git is giving this message:</p>
<blockquote>
<p>hint: Waiting for your editor to close the file...
/c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,505 | git | # How can I fix git commit error "Waiting for your editor to close the file..." with VS Code?
I'm trying just `git commit` and Git is giving this message:
> hint: Waiting for your editor to close the file...
> /c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line
> 28: /Code.exe: No such file or direct... | Have you confirmed that `code` is accessible from the command line where you execute git commands?
You could run `code --version`
BTW. When I execute `where code` I get `C:\Program Files\Microsoft VS Code\bin\code` - it's no longer installed in the %App_Data% folder. **However**, this should be irrelevant if you only... |
1044446 | How to get git-status of a single subfolder? | 105 | 2009-06-25 15:01:30 | <p>When I do git status in a subfolder of my repository it includes the status of parent folders also.</p>
<p>Is there a way to constrain git-status to just a particular folder?</p>
| 44,081 | 6,691 | 2022-01-28 09:47:32 | 5,439,180 | 139 | 2011-03-25 23:30:54 | 17,221 | 2017-02-03 19:51:38 | https://stackoverflow.com/q/1044446 | https://stackoverflow.com/a/5439180 | <pre><code>git status .
</code></pre>
<p>will show the status of the current directory and subdirectories.</p>
<p>For instance, given files (numbers) in this tree:</p>
<pre><code>a/1
a/2
b/3
b/4
b/c/5
b/c/6
</code></pre>
<p>from subdirectory "b", <code>git status</code> shows new files in the whole tree:</p>
<pre>... | <pre><code>git status . </code></pre> <p>will show the status of the current directory and subdirectories.</p> <p>For instance, given files (numbers) in this tree:</p> <pre><code>a/1 a/2 b/3 b/4 b/c/5 b/c/6 </code></pre> <p>from subdirectory "b", <code>git status</code> shows new files in the whole tree:</p> <pre>... | 119 | git | <h1>How to get git-status of a single subfolder?</h1>
<p>When I do git status in a subfolder of my repository it includes the status of parent folders also.</p>
<p>Is there a way to constrain git-status to just a particular folder?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,506 | git | # How to get git-status of a single subfolder?
When I do git status in a subfolder of my repository it includes the status of parent folders also.
Is there a way to constrain git-status to just a particular folder? | ```
git status .
```
will show the status of the current directory and subdirectories.
For instance, given files (numbers) in this tree:
```
a/1
a/2
b/3
b/4
b/c/5
b/c/6
```
from subdirectory "b", `git status` shows new files in the whole tree:
```
% git status
# On branch master
#
# Initial commit
#
# Changes to b... |
36139275 | Git pushing to remote branch | 103 | 2016-03-21 18:50:53 | <p>I tried to follow <a href="https://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch">this post</a> but got confused rather than getting my problem solved. </p>
<p>Here is the scenario. </p>
<p>I have created a branch like <code>git checkout -b <branch_name></code>. I then worked on s... | 404,160 | 504,717 | 2023-02-09 10:08:36 | 36,139,325 | 139 | 2016-03-21 18:54:23 | 3,257,786 | 2022-08-12 11:36:44 | https://stackoverflow.com/q/36139275 | https://stackoverflow.com/a/36139325 | <p>Simply push this branch to a different branch name</p>
<pre><code> git push -u origin localBranch:remoteBranch
</code></pre>
<p>If you don't want to <code>set-upstream</code>, just</p>
<pre><code> git push origin localBranch:remoteBranch
</code></pre>
| <p>Simply push this branch to a different branch name</p> <pre><code> git push -u origin localBranch:remoteBranch </code></pre> <p>If you don't want to <code>set-upstream</code>, just</p> <pre><code> git push origin localBranch:remoteBranch </code></pre> | 119 | git | <h1>Git pushing to remote branch</h1>
<p>I tried to follow <a href="https://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch">this post</a> but got confused rather than getting my problem solved. </p>
<p>Here is the scenario. </p>
<p>I have created a branch like <code>git checkout -b <bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,507 | git | # Git pushing to remote branch
I tried to follow [this post](https://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch) but got confused rather than getting my problem solved.
Here is the scenario.
I have created a branch like `git checkout -b <branch_name>`. I then worked on some changes and... | Simply push this branch to a different branch name
```
git push -u origin localBranch:remoteBranch
```
If you don't want to `set-upstream`, just
```
git push origin localBranch:remoteBranch
``` |
3068397 | Finding the length of an integer in C | 96 | 2010-06-18 09:08:49 | <p>I would like to know how I can find the length of an integer in C.</p>
<p>For instance:</p>
<ul>
<li>1 => 1 </li>
<li>25 => 2 </li>
<li>12512 => 5</li>
<li>0 => 1</li>
</ul>
<p>and so on.</p>
<p>How can I do this in C?</p>
| 346,740 | 325,776 | 2026-01-04 10:48:47 | 3,068,420 | 139 | 2010-06-18 09:13:47 | 73,632 | 2023-01-20 22:41:07 | https://stackoverflow.com/q/3068397 | https://stackoverflow.com/a/3068420 | <h2>C:</h2>
<p>You could take the base-10 log of the absolute value of the number, round it down, and add one. This works for positive and negative numbers that aren't 0, and avoids having to use any string conversion functions.</p>
<p>The <code>log10</code>, <code>abs</code>, and <code>floor</code> functions are provi... | <h2>C:</h2> <p>You could take the base-10 log of the absolute value of the number, round it down, and add one. This works for positive and negative numbers that aren't 0, and avoids having to use any string conversion functions.</p> <p>The <code>log10</code>, <code>abs</code>, and <code>floor</code> functions are provi... | 8, 2054, 48894 | c, digit, integer | <h1>Finding the length of an integer in C</h1>
<p>I would like to know how I can find the length of an integer in C.</p>
<p>For instance:</p>
<ul>
<li>1 => 1 </li>
<li>25 => 2 </li>
<li>12512 => 5</li>
<li>0 => 1</li>
</ul>
<p>and so on.</p>
<p>How can I do this in C?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,508 | git | # Finding the length of an integer in C
I would like to know how I can find the length of an integer in C.
For instance:
- 1 => 1
- 25 => 2
- 12512 => 5
- 0 => 1
and so on.
How can I do this in C? | ## C:
You could take the base-10 log of the absolute value of the number, round it down, and add one. This works for positive and negative numbers that aren't 0, and avoids having to use any string conversion functions.
The `log10`, `abs`, and `floor` functions are provided by `math.h`. For example:
```
int nDigits ... |
41101998 | "git checkout --" . vs git checkout | 93 | 2016-12-12 13:28:44 | <p>I always used <code>git checkout -- .</code> to clear my working directory. I thought I read somewhere that the <code>--</code> was required to avoid git thinking you are passing parameters (or something)</p>
<p>Now a colleague told me I could drop the <code>--</code>, and indeed, a quick test did exactly the same.... | 81,664 | 540,352 | 2019-09-18 11:18:05 | 41,102,120 | 139 | 2016-12-12 13:36:06 | 1,863,229 | 2016-12-12 13:41:53 | https://stackoverflow.com/q/41101998 | https://stackoverflow.com/a/41102120 | <p>I seem to recall that the <code>--</code> is a way to tell Git to treat what follows <code>checkout</code> as a file and not as a branch. Suppose that you had both a file and a branch called <code>stuff</code>. Then the following command would seem ambiguous:</p>
<pre><code>git checkout stuff
</code></pre>
<p>be... | <p>I seem to recall that the <code>--</code> is a way to tell Git to treat what follows <code>checkout</code> as a file and not as a branch. Suppose that you had both a file and a branch called <code>stuff</code>. Then the following command would seem ambiguous:</p> <pre><code>git checkout stuff </code></pre> <p>be... | 119 | git | <h1>"git checkout --" . vs git checkout</h1>
<p>I always used <code>git checkout -- .</code> to clear my working directory. I thought I read somewhere that the <code>--</code> was required to avoid git thinking you are passing parameters (or something)</p>
<p>Now a colleague told me I could drop the <code>--</code>, a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,509 | git | # "git checkout --" . vs git checkout
I always used `git checkout -- .` to clear my working directory. I thought I read somewhere that the `--` was required to avoid git thinking you are passing parameters (or something)
Now a colleague told me I could drop the `--`, and indeed, a quick test did exactly the same.
Is... | I seem to recall that the `--` is a way to tell Git to treat what follows `checkout` as a file and not as a branch. Suppose that you had both a file and a branch called `stuff`. Then the following command would seem ambiguous:
```
git checkout stuff
```
because it is not clear whether you are asking to checkout a fil... |
23227927 | How do I move master back several commits in git? | 73 | 2014-04-22 18:54:11 | <p>I have a git repository which holds a Drupal site. I spent the last day trying to build a feature using several different modules. I have given up on my current approach and have decided to try a different combination of modules. However, my repository has several commits on the master branch that contain this fe... | 61,678 | 2,370,337 | 2024-06-06 04:31:07 | 23,228,064 | 139 | 2014-04-22 19:02:40 | 391,161 | 2014-04-22 19:02:40 | https://stackoverflow.com/q/23227927 | https://stackoverflow.com/a/23228064 | <p>In order to do it locally, you can do the following commands to go to master and move it to the old commit.</p>
<pre><code>git checkout master
git reset --hard <old_commit_id>
</code></pre>
<p>If you then want to push it to the remote, you need to use the <code>-f</code> option.</p>
<pre><code>git push -f o... | <p>In order to do it locally, you can do the following commands to go to master and move it to the old commit.</p> <pre><code>git checkout master git reset --hard <old_commit_id> </code></pre> <p>If you then want to push it to the remote, you need to use the <code>-f</code> option.</p> <pre><code>git push -f o... | 119, 51381 | git, git-reset | <h1>How do I move master back several commits in git?</h1>
<p>I have a git repository which holds a Drupal site. I spent the last day trying to build a feature using several different modules. I have given up on my current approach and have decided to try a different combination of modules. However, my repository ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,510 | git | # How do I move master back several commits in git?
I have a git repository which holds a Drupal site. I spent the last day trying to build a feature using several different modules. I have given up on my current approach and have decided to try a different combination of modules. However, my repository has several co... | In order to do it locally, you can do the following commands to go to master and move it to the old commit.
```
git checkout master
git reset --hard <old_commit_id>
```
If you then want to push it to the remote, you need to use the `-f` option.
```
git push -f origin master
``` |
4766391 | What is the CouchDB replication protocol? Is it like Git? | 72 | 2011-01-22 05:42:10 | <p>Is there technical documentation describing how replication between two Couches works?</p>
<p>What is the basic overview of CouchDB replication? What are some noteworthy characteristics about it?</p>
| 9,615 | 2,938 | 2016-08-24 09:59:48 | 4,766,398 | 139 | 2011-01-22 05:45:55 | 2,938 | 2011-01-29 03:13:44 | https://stackoverflow.com/q/4766391 | https://stackoverflow.com/a/4766398 | <p>Unfortunately there is no detailed documentation describing the replication protocol. There is only the reference implementation built into CouchDB, and Filipe Manana's rewrite of the same which will probably become the new implmentation in the future.</p>
<p>However, this is the general idea:</p>
<h2>Key points</... | <p>Unfortunately there is no detailed documentation describing the replication protocol. There is only the reference implementation built into CouchDB, and Filipe Manana's rewrite of the same which will probably become the new implmentation in the future.</p> <p>However, this is the general idea:</p> <h2>Key points</... | 119, 2816 | couchdb, git | <h1>What is the CouchDB replication protocol? Is it like Git?</h1>
<p>Is there technical documentation describing how replication between two Couches works?</p>
<p>What is the basic overview of CouchDB replication? What are some noteworthy characteristics about it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,511 | git | # What is the CouchDB replication protocol? Is it like Git?
Is there technical documentation describing how replication between two Couches works?
What is the basic overview of CouchDB replication? What are some noteworthy characteristics about it? | Unfortunately there is no detailed documentation describing the replication protocol. There is only the reference implementation built into CouchDB, and Filipe Manana's rewrite of the same which will probably become the new implmentation in the future.
However, this is the general idea:
## Key points
**If you know G... |
11093358 | Git and SSH, which key is used? | 207 | 2012-06-19 01:46:45 | <p>Say your <code>.ssh</code> directory contains 30 keys (15 private and 15 public).</p>
<p>Where in Git can one check which one is used to connect to a given remote repository?</p>
| 218,231 | 359,862 | 2022-06-29 16:19:06 | 11,093,562 | 138 | 2012-06-19 02:20:42 | 359,862 | 2015-05-14 20:09:33 | https://stackoverflow.com/q/11093358 | https://stackoverflow.com/a/11093562 | <p>The following entry in <code>.ssh/config</code> file solves the problem</p>
<pre><code> host git.assembla.com
user git
identityfile ~/.ssh/whatever
</code></pre>
<p>Where <code>~/.ssh/whatever</code> is a path to your private key</p>
<p>Additionally, user and host can be picked up from</p>
<pre><code>git pu... | <p>The following entry in <code>.ssh/config</code> file solves the problem</p> <pre><code> host git.assembla.com user git identityfile ~/.ssh/whatever </code></pre> <p>Where <code>~/.ssh/whatever</code> is a path to your private key</p> <p>Additionally, user and host can be picked up from</p> <pre><code>git pu... | 119, 386 | git, ssh | <h1>Git and SSH, which key is used?</h1>
<p>Say your <code>.ssh</code> directory contains 30 keys (15 private and 15 public).</p>
<p>Where in Git can one check which one is used to connect to a given remote repository?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,513 | git | # Git and SSH, which key is used?
Say your `.ssh` directory contains 30 keys (15 private and 15 public).
Where in Git can one check which one is used to connect to a given remote repository? | The following entry in `.ssh/config` file solves the problem
```
host git.assembla.com
user git
identityfile ~/.ssh/whatever
```
Where `~/.ssh/whatever` is a path to your private key
Additionally, user and host can be picked up from
```
git push git@git.assembla.com:repo_name.git
^__ ^_______________... |
8527139 | Showing commits made directly to a branch, ignoring merges in Git | 96 | 2011-12-15 21:53:23 | <p>When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging? </p>
<p>I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged in. I know it's damn near impossible to show a diff in that... | 27,214 | 1,100,832 | 2019-01-02 13:42:17 | 8,527,200 | 138 | 2011-12-15 21:59:10 | 19,563 | 2019-01-02 13:42:17 | https://stackoverflow.com/q/8527139 | https://stackoverflow.com/a/8527200 | <h3><code>--no-merges</code></h3>
<p>Both parents have equal weight in many contexts in git. If you've always been consistent in merging other changes in then you may find that this gives you what you want.</p>
<pre><code>git log --no-merges --first-parent
</code></pre>
<p>Otherwise you may be able to exclude commit... | <h3><code>--no-merges</code></h3> <p>Both parents have equal weight in many contexts in git. If you've always been consistent in merging other changes in then you may find that this gives you what you want.</p> <pre><code>git log --no-merges --first-parent </code></pre> <p>Otherwise you may be able to exclude commit... | 119, 606, 717, 1879 | branch, diff, git, merge | <h1>Showing commits made directly to a branch, ignoring merges in Git</h1>
<p>When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging? </p>
<p>I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,516 | git | # Showing commits made directly to a branch, ignoring merges in Git
When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging?
I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged in.... | ### `--no-merges`
Both parents have equal weight in many contexts in git. If you've always been consistent in merging other changes in then you may find that this gives you what you want.
```
git log --no-merges --first-parent
```
Otherwise you may be able to exclude commits from other named branches.
```
git log -... |
26046698 | git refname 'origin/master' is ambiguous | 94 | 2014-09-25 19:37:21 | <p>I have a git repository that is tracking several remote branches:</p>
<pre><code>$ git branch -a
* master
remotes/git-svn
remotes/origin/master
remotes/trunk
</code></pre>
<p>When I try to setup a default one I get the following error:</p>
<pre><code>$ git branch --set-upstream-to=origin/master master
warni... | 88,387 | 605,436 | 2021-09-15 09:22:08 | 26,047,558 | 138 | 2014-09-25 20:30:13 | 2,541,573 | 2018-06-11 07:18:33 | https://stackoverflow.com/q/26046698 | https://stackoverflow.com/a/26047558 | <p>The output of <code>git branch -a</code> shows that you have a remote-tracking branch called <code>origin/master</code>. Perfectly normal.</p>
<p>However, the output of <code>git show-ref master</code> contains</p>
<pre><code>6726b4985107e2ddc7539f95e1a6aba536d35bc6 refs/origin/master
</code></pre>
<p>which indic... | <p>The output of <code>git branch -a</code> shows that you have a remote-tracking branch called <code>origin/master</code>. Perfectly normal.</p> <p>However, the output of <code>git show-ref master</code> contains</p> <pre><code>6726b4985107e2ddc7539f95e1a6aba536d35bc6 refs/origin/master </code></pre> <p>which indic... | 119, 6452 | git, git-svn | <h1>git refname 'origin/master' is ambiguous</h1>
<p>I have a git repository that is tracking several remote branches:</p>
<pre><code>$ git branch -a
* master
remotes/git-svn
remotes/origin/master
remotes/trunk
</code></pre>
<p>When I try to setup a default one I get the following error:</p>
<pre><code>$ git b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,517 | git | # git refname 'origin/master' is ambiguous
I have a git repository that is tracking several remote branches:
```
$ git branch -a
* master
remotes/git-svn
remotes/origin/master
remotes/trunk
```
When I try to setup a default one I get the following error:
```
$ git branch --set-upstream-to=origin/master master... | The output of `git branch -a` shows that you have a remote-tracking branch called `origin/master`. Perfectly normal.
However, the output of `git show-ref master` contains
```
6726b4985107e2ddc7539f95e1a6aba536d35bc6 refs/origin/master
```
which indicates that you most likely ran something like the following low-leve... |
18955149 | Ignore .classpath and .project from Git | 91 | 2013-09-23 08:49:25 | <blockquote>
<p>I keep myself telling me and others not to commit .classpath and
.project files and use Maven.</p>
</blockquote>
<p>Somehow, Junior developers always ignore certain rules and commits those files and it's much better to have such files for newbies who can jump and start using the code.</p>
<p>Now f... | 138,978 | 1,503,535 | 2023-04-27 11:49:10 | 18,955,478 | 138 | 2013-09-23 09:06:58 | 6,309 | 2020-03-09 17:22:55 | https://stackoverflow.com/q/18955149 | https://stackoverflow.com/a/18955478 | <p>If the <code>.project</code> and <code>.classpath</code> are already committed, then they need to be removed from the index (but not the disk)</p>
<pre><code>git rm --cached .project
git rm --cached .classpath
</code></pre>
<p>Then the <code>.gitignore</code> would work (and that file can be added and shared throu... | <p>If the <code>.project</code> and <code>.classpath</code> are already committed, then they need to be removed from the index (but not the disk)</p> <pre><code>git rm --cached .project git rm --cached .classpath </code></pre> <p>Then the <code>.gitignore</code> would work (and that file can be added and shared throu... | 17, 53, 119, 25056 | eclipse, git, gitignore, java | <h1>Ignore .classpath and .project from Git</h1>
<blockquote>
<p>I keep myself telling me and others not to commit .classpath and
.project files and use Maven.</p>
</blockquote>
<p>Somehow, Junior developers always ignore certain rules and commits those files and it's much better to have such files for newbies who... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,519 | git | # Ignore .classpath and .project from Git
> I keep myself telling me and others not to commit .classpath and
> .project files and use Maven.
Somehow, Junior developers always ignore certain rules and commits those files and it's much better to have such files for newbies who can jump and start using the code.
Now fr... | If the `.project` and `.classpath` are already committed, then they need to be removed from the index (but not the disk)
```
git rm --cached .project
git rm --cached .classpath
```
Then the `.gitignore` would work (and that file can be added and shared through clones).
For instance, this [`gitignore.io/api/eclipse`... |
10063407 | Git log output log file | 89 | 2012-04-08 14:07:53 | <p>I am doing an assignment in a university course and I am using Git as version control for this assignment. The game I have been working on is complete. However, along with the hand in I would like to submit the Git log, effectively showing my progress during the time I have been working on it.</p>
<p>I have tried th... | 104,507 | 604,349 | 2021-12-06 04:09:14 | 10,063,456 | 138 | 2012-04-08 14:15:40 | 385,913 | 2021-12-06 04:09:14 | https://stackoverflow.com/q/10063407 | https://stackoverflow.com/a/10063456 | <p>I would recommend using a different format than the default. My usual choice is a summary with the graph, but a one-line summary alone usually does the trick.</p>
<p><strong>Option 1:</strong> <em>One-line summary with a graph</em></p>
<pre><code>git log --pretty=format:'%h : %s' --graph > log.log
</code></pre>
<... | <p>I would recommend using a different format than the default. My usual choice is a summary with the graph, but a one-line summary alone usually does the trick.</p> <p><strong>Option 1:</strong> <em>One-line summary with a graph</em></p> <pre><code>git log --pretty=format:'%h : %s' --graph > log.log </code></pre> <... | 119, 942 | git, logging | <h1>Git log output log file</h1>
<p>I am doing an assignment in a university course and I am using Git as version control for this assignment. The game I have been working on is complete. However, along with the hand in I would like to submit the Git log, effectively showing my progress during the time I have been work... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,520 | git | # Git log output log file
I am doing an assignment in a university course and I am using Git as version control for this assignment. The game I have been working on is complete. However, along with the hand in I would like to submit the Git log, effectively showing my progress during the time I have been working on it... | I would recommend using a different format than the default. My usual choice is a summary with the graph, but a one-line summary alone usually does the trick.
**Option 1:** *One-line summary with a graph*
```
git log --pretty=format:'%h : %s' --graph > log.log
```
***Results in:***
```
* 2d3acf9 : ignore errors fro... |
1453129 | Git create branch from current checked out master? | 79 | 2009-09-21 06:41:09 | <p>There is a git controlled folder on a server where the main branch is checked out and a whole pile of files have been modified and not committed. Is there a way for me to commit the changes to a separate branch so I can go back to a clean version?</p>
<p>ie I want to effecitvely undo all this persons changes but ... | 98,002 | 150,172 | 2016-01-17 14:05:30 | 1,453,147 | 138 | 2009-09-21 06:52:28 | 19,563 | 2009-09-21 06:52:28 | https://stackoverflow.com/q/1453129 | https://stackoverflow.com/a/1453147 | <p>First of all moving to a different branch based in the current HEAD is performed like this:</p>
<pre><code>git checkout -b newbranch
</code></pre>
<p>Commit all the changes (assuming no newly added files, otherwise <code>git add</code> them):</p>
<pre><code>git commit -a
</code></pre>
<p>Go back to the master br... | <p>First of all moving to a different branch based in the current HEAD is performed like this:</p> <pre><code>git checkout -b newbranch </code></pre> <p>Commit all the changes (assuming no newly added files, otherwise <code>git add</code> them):</p> <pre><code>git commit -a </code></pre> <p>Go back to the master br... | 119, 456, 3346, 76220 | dvcs, git, git-branch, version-control | <h1>Git create branch from current checked out master?</h1>
<p>There is a git controlled folder on a server where the main branch is checked out and a whole pile of files have been modified and not committed. Is there a way for me to commit the changes to a separate branch so I can go back to a clean version?</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,521 | git | # Git create branch from current checked out master?
There is a git controlled folder on a server where the main branch is checked out and a whole pile of files have been modified and not committed. Is there a way for me to commit the changes to a separate branch so I can go back to a clean version?
ie I want to effe... | First of all moving to a different branch based in the current HEAD is performed like this:
```
git checkout -b newbranch
```
Commit all the changes (assuming no newly added files, otherwise `git add` them):
```
git commit -a
```
Go back to the master branch:
```
git checkout master
```
The previously uncommitted... |
3293607 | Difference between git HEAD and the current project state? | 61 | 2010-07-20 19:28:35 | <p>I quote a git tutorial:</p>
<pre><code>git diff shows the diff between HEAD and the current project state
</code></pre>
<p>I wonder what that means. Isn't the HEAD the current active project?</p>
<p>Thanks</p>
| 74,022 | 224,922 | 2016-02-23 15:40:04 | 3,293,804 | 138 | 2010-07-20 19:52:28 | 6,309 | 2016-02-23 15:40:04 | https://stackoverflow.com/q/3293607 | https://stackoverflow.com/a/3293804 | <p>From "<a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html#_specifying_revisions" rel="noreferrer">Specifying revisions</a>"</p>
<blockquote>
<p><code>HEAD</code> names the commit on which you based the changes in the working tree.</p>
</blockquote>
<p>There are other heads (<code>FETCH_HE... | <p>From "<a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html#_specifying_revisions" rel="noreferrer">Specifying revisions</a>"</p> <blockquote> <p><code>HEAD</code> names the commit on which you based the changes in the working tree.</p> </blockquote> <p>There are other heads (<code>FETCH_HE... | 119 | git | <h1>Difference between git HEAD and the current project state?</h1>
<p>I quote a git tutorial:</p>
<pre><code>git diff shows the diff between HEAD and the current project state
</code></pre>
<p>I wonder what that means. Isn't the HEAD the current active project?</p>
<p>Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,522 | git | # Difference between git HEAD and the current project state?
I quote a git tutorial:
```
git diff shows the diff between HEAD and the current project state
```
I wonder what that means. Isn't the HEAD the current active project?
Thanks | From "[Specifying revisions](http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html#_specifying_revisions)"
> `HEAD` names the commit on which you based the changes in the working tree.
There are other heads (`FETCH_HEAD`, `ORIG_HEAD` and `MERGE_HEAD`). See [Jefromi's answer](https://stackoverflow.com/que... |
1249932 | Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination | 47 | 2009-08-08 21:20:07 | <p>I am installing msysgit 1.6.4 beta on my Windows Vista development VPC. An install screen is requesting whether I want to use Unix line termination or DOS line termination. Ordinarily, I'd choose DOS, but the setup text indicates that DOS termination may mean files do not work with all of Git's command line tools. T... | 33,293 | 135,306 | 2022-07-05 09:10:56 | 1,250,133 | 138 | 2009-08-08 23:26:51 | 6,309 | 2014-07-09 11:05:22 | https://stackoverflow.com/q/1249932 | https://stackoverflow.com/a/1250133 | <p>That settings during the install process of msysgit is actually here to fix the value of the <code>core.autocrlf</code> <a href="http://git-scm.com/docs/git-config#_variables" rel="noreferrer">config</a>.</p>
<pre><code>core.autocrlf
</code></pre>
<blockquote>
<p>If true, makes git convert <code>CRLF</code> at t... | <p>That settings during the install process of msysgit is actually here to fix the value of the <code>core.autocrlf</code> <a href="http://git-scm.com/docs/git-config#_variables" rel="noreferrer">config</a>.</p> <pre><code>core.autocrlf </code></pre> <blockquote> <p>If true, makes git convert <code>CRLF</code> at t... | 119, 21628 | git, msysgit | <h1>Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination</h1>
<p>I am installing msysgit 1.6.4 beta on my Windows Vista development VPC. An install screen is requesting whether I want to use Unix line termination or DOS line termination. Ordinarily, I'd choose DOS, but the setup text indicates that DOS te... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,523 | git | # Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination
I am installing msysgit 1.6.4 beta on my Windows Vista development VPC. An install screen is requesting whether I want to use Unix line termination or DOS line termination. Ordinarily, I'd choose DOS, but the setup text indicates that DOS termination... | That settings during the install process of msysgit is actually here to fix the value of the `core.autocrlf` [config](http://git-scm.com/docs/git-config#_variables).
```
core.autocrlf
```
> If true, makes git convert `CRLF` at the end of lines in text files to `LF` when reading from the filesystem, and convert in rev... |
861995 | Is it possible for git-merge to ignore line-ending differences? | 184 | 2009-05-14 07:25:04 | <p>Is it possible for <code>git merge</code> to ignore line-ending differences?</p>
<p>Maybe I'm asking the wrong question ... but:</p>
<p>I tried uisng <code>config.crlf input</code> but things got a bit messy and out of control, specially when I applied it <em>after the fact</em>.</p>
<p>For one thing, applying th... | 92,261 | 35,364 | 2025-12-09 14:31:59 | 862,920 | 137 | 2009-05-14 11:57:44 | 6,309 | 2020-08-19 20:28:37 | https://stackoverflow.com/q/861995 | https://stackoverflow.com/a/862920 | <p>Update 2013:</p>
<p>More recent git versions authorize using merge with strategy <code>recursive</code> and strategy <em>option</em> (<code>-X</code>):</p>
<ul>
<li>from "<a href="https://stackoverflow.com/a/5262473/6309">Git Merge and Fixing Mixed Spaces and Tabs with two Branches</a>":
<pre><code>git mer... | <p>Update 2013:</p> <p>More recent git versions authorize using merge with strategy <code>recursive</code> and strategy <em>option</em> (<code>-X</code>):</p> <ul> <li>from "<a href="https://stackoverflow.com/a/5262473/6309">Git Merge and Fixing Mixed Spaces and Tabs with two Branches</a>": <pre><code>git mer... | 119, 717, 6452, 8329, 12863 | eol, git, git-svn, line-endings, merge | <h1>Is it possible for git-merge to ignore line-ending differences?</h1>
<p>Is it possible for <code>git merge</code> to ignore line-ending differences?</p>
<p>Maybe I'm asking the wrong question ... but:</p>
<p>I tried uisng <code>config.crlf input</code> but things got a bit messy and out of control, specially when... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,524 | git | # Is it possible for git-merge to ignore line-ending differences?
Is it possible for `git merge` to ignore line-ending differences?
Maybe I'm asking the wrong question ... but:
I tried uisng `config.crlf input` but things got a bit messy and out of control, specially when I applied it *after the fact*.
For one thin... | Update 2013:
More recent git versions authorize using merge with strategy `recursive` and strategy *option* (`-X`):
- from "[Git Merge and Fixing Mixed Spaces and Tabs with two Branches](https://stackoverflow.com/a/5262473/6309)":
```
git merge -s recursive -Xignore-space-at-eol
```
But using "`-Xignore-space... |
9765453 | Is git's semi-secret empty tree object reliable, and why is there not a symbolic name for it? | 158 | 2012-03-19 05:32:57 | <p>Git has a well-known, or at least sort-of-well-known, empty tree whose SHA1 is:</p>
<pre><code>4b825dc642cb6eb9a060e54bf8d69288fbee4904
</code></pre>
<p>(you can see this in any repo, even a newly created one, with <code>git cat-file -t</code> and <code>git cat-file -p</code>). [<strong>Edit made in 2020</strong>: ... | 31,448 | 1,256,452 | 2022-07-24 09:48:47 | 9,766,506 | 137 | 2012-03-19 07:35:27 | 6,309 | 2022-07-24 09:48:47 | https://stackoverflow.com/q/9765453 | https://stackoverflow.com/a/9766506 | <p><a href="http://comments.gmane.org/gmane.comp.version-control.git/180511" rel="noreferrer">This thread</a> mentions:</p>
<blockquote>
<p>If you don't remember the empty tree sha1, you can always derive it with:</p>
</blockquote>
<pre><code>git hash-object -t tree /dev/null
</code></pre>
<p>Or, as <a href="https://st... | <p><a href="http://comments.gmane.org/gmane.comp.version-control.git/180511" rel="noreferrer">This thread</a> mentions:</p> <blockquote> <p>If you don't remember the empty tree sha1, you can always derive it with:</p> </blockquote> <pre><code>git hash-object -t tree /dev/null </code></pre> <p>Or, as <a href="https://st... | 119 | git | <h1>Is git's semi-secret empty tree object reliable, and why is there not a symbolic name for it?</h1>
<p>Git has a well-known, or at least sort-of-well-known, empty tree whose SHA1 is:</p>
<pre><code>4b825dc642cb6eb9a060e54bf8d69288fbee4904
</code></pre>
<p>(you can see this in any repo, even a newly created one, with... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,525 | git | # Is git's semi-secret empty tree object reliable, and why is there not a symbolic name for it?
Git has a well-known, or at least sort-of-well-known, empty tree whose SHA1 is:
```
4b825dc642cb6eb9a060e54bf8d69288fbee4904
```
(you can see this in any repo, even a newly created one, with `git cat-file -t` and `git cat... | [This thread](http://comments.gmane.org/gmane.comp.version-control.git/180511) mentions:
> If you don't remember the empty tree sha1, you can always derive it with:
```
git hash-object -t tree /dev/null
```
Or, as [Ciro Santilli](https://stackoverflow.com/users/895245/ciro-santilli-709%E5%A4%A7%E6%8A%93%E6%8D%95-%E5... |
42597408 | Git (LFS): what is locking support? And should I enable it? | 146 | 2017-03-04 14:56:44 | <h1>"New" Git Comment:</h1>
<p>Just today I ran across the following comment from Git for the first time (at least the first time I saw it):</p>
<pre><code>Mikes-Mac$ git push
Locking support detected on remote "origin". Consider enabling it with:
$ git config 'lfs.https://github.com/<my_repo>.git/info/lfs.lo... | 144,278 | 534,238 | 2021-12-28 04:27:19 | 42,597,577 | 137 | 2017-03-04 15:11:58 | 224,671 | 2021-02-06 00:25:35 | https://stackoverflow.com/q/42597408 | https://stackoverflow.com/a/42597577 | <p>Locking support of Git LFS is documented here <a href="https://github.com/git-lfs/git-lfs/wiki/File-Locking" rel="noreferrer">https://github.com/git-lfs/git-lfs/wiki/File-Locking</a>.</p>
<blockquote>
<p>Git LFS v2.0.0 includes an early release of File Locking. File Locking lets developers lock files they are updati... | <p>Locking support of Git LFS is documented here <a href="https://github.com/git-lfs/git-lfs/wiki/File-Locking" rel="noreferrer">https://github.com/git-lfs/git-lfs/wiki/File-Locking</a>.</p> <blockquote> <p>Git LFS v2.0.0 includes an early release of File Locking. File Locking lets developers lock files they are updati... | 119, 115244 | git, git-lfs | <h1>Git (LFS): what is locking support? And should I enable it?</h1>
<h1>"New" Git Comment:</h1>
<p>Just today I ran across the following comment from Git for the first time (at least the first time I saw it):</p>
<pre><code>Mikes-Mac$ git push
Locking support detected on remote "origin". Consider enabling it with:
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,526 | git | # Git (LFS): what is locking support? And should I enable it?
# "New" Git Comment:
Just today I ran across the following comment from Git for the first time (at least the first time I saw it):
```
Mikes-Mac$ git push
Locking support detected on remote "origin". Consider enabling it with:
$ git config 'lfs.https://... | Locking support of Git LFS is documented here <https://github.com/git-lfs/git-lfs/wiki/File-Locking>.
> Git LFS v2.0.0 includes an early release of File Locking. File Locking lets developers lock files they are updating to prevent other users from updating them at the same time. Concurrent edits in Git repositories wi... |
7222382 | Get lat/long given current point, distance and bearing | 121 | 2011-08-28 16:56:14 | <p>Given an existing point in lat/long, distance in (in KM) and bearing (in degrees converted to radians), I would like to calculate the new lat/long. <a href="http://www.movable-type.co.uk/scripts/latlong.html" rel="noreferrer">This</a> site crops up over and over again, but I just can't get the formula to work for me... | 159,634 | 493,559 | 2023-06-16 02:37:20 | 7,835,325 | 137 | 2011-10-20 11:34:51 | 493,559 | 2023-02-07 21:41:11 | https://stackoverflow.com/q/7222382 | https://stackoverflow.com/a/7835325 | <p>Needed to convert answers from radians back to degrees. Working code below:</p>
<pre class="lang-py prettyprint-override"><code>from math import asin, atan2, cos, degrees, radians, sin
def get_point_at_distance(lat1, lon1, d, bearing, R=6371):
"""
lat: initial latitude, in degrees
lon: in... | <p>Needed to convert answers from radians back to degrees. Working code below:</p> <pre class="lang-py prettyprint-override"><code>from math import asin, atan2, cos, degrees, radians, sin def get_point_at_distance(lat1, lon1, d, bearing, R=6371): """ lat: initial latitude, in degrees lon: in... | 16, 241, 6238, 20301 | distance, gis, latitude-longitude, python | <h1>Get lat/long given current point, distance and bearing</h1>
<p>Given an existing point in lat/long, distance in (in KM) and bearing (in degrees converted to radians), I would like to calculate the new lat/long. <a href="http://www.movable-type.co.uk/scripts/latlong.html" rel="noreferrer">This</a> site crops up over... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,527 | git | # Get lat/long given current point, distance and bearing
Given an existing point in lat/long, distance in (in KM) and bearing (in degrees converted to radians), I would like to calculate the new lat/long. [This](http://www.movable-type.co.uk/scripts/latlong.html) site crops up over and over again, but I just can't get... | Needed to convert answers from radians back to degrees. Working code below:
```
from math import asin, atan2, cos, degrees, radians, sin
def get_point_at_distance(lat1, lon1, d, bearing, R=6371):
"""
lat: initial latitude, in degrees
lon: initial longitude, in degrees
d: target distance from initial
... |
19579398 | How to Abort Git Bisect | 113 | 2013-10-25 01:03:49 | <p>I started my git bisect by specifying good and bad revisions but I don't think they registered. Additionally, as I am attempting to specify git bisect good and bad, I don't think git is doing anything. I would like to abort the entire bisect so that I can re-initiate the operation. <code>git bisect reset</code> seem... | 18,859 | 347,339 | 2013-10-25 01:09:35 | 19,579,450 | 137 | 2013-10-25 01:09:35 | 893 | 2013-10-25 01:09:35 | https://stackoverflow.com/q/19579398 | https://stackoverflow.com/a/19579450 | <p><code>git bisect reset</code> is the correct command. From <a href="https://www.kernel.org/pub/software/scm/git/docs/git-bisect.html" rel="noreferrer">the documentation</a>:</p>
<blockquote>
<p>After a bisect session, to clean up the bisection state and return to the original HEAD, issue the following command:</p>
<... | <p><code>git bisect reset</code> is the correct command. From <a href="https://www.kernel.org/pub/software/scm/git/docs/git-bisect.html" rel="noreferrer">the documentation</a>:</p> <blockquote> <p>After a bisect session, to clean up the bisection state and return to the original HEAD, issue the following command:</p> <... | 119, 16746, 47326 | abort, git, git-bisect | <h1>How to Abort Git Bisect</h1>
<p>I started my git bisect by specifying good and bad revisions but I don't think they registered. Additionally, as I am attempting to specify git bisect good and bad, I don't think git is doing anything. I would like to abort the entire bisect so that I can re-initiate the operation. <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,528 | git | # How to Abort Git Bisect
I started my git bisect by specifying good and bad revisions but I don't think they registered. Additionally, as I am attempting to specify git bisect good and bad, I don't think git is doing anything. I would like to abort the entire bisect so that I can re-initiate the operation. `git bisec... | `git bisect reset` is the correct command. From [the documentation](https://www.kernel.org/pub/software/scm/git/docs/git-bisect.html):
> After a bisect session, to clean up the bisection state and return to the original HEAD, issue the following command:
>
> ```
> $ git bisect reset
> ```
>
> By default, this will ret... |
7470385 | Git in Powershell saying 'Could not find ssh-agent' | 98 | 2011-09-19 11:43:51 | <p>I have git installed and it works great in the command prompt, but when I open up powershell it gives me this warning:</p>
<pre><code>WARNING: Could not find ssh-agent
</code></pre>
<p>I have pageant running and loaded with my private key. This works in all the gui tools and the command prompt but not in Powershel... | 40,457 | 86,411 | 2015-08-28 19:19:15 | 10,168,714 | 137 | 2012-04-16 04:28:05 | 104,261 | 2015-01-15 22:33:37 | https://stackoverflow.com/q/7470385 | https://stackoverflow.com/a/10168714 | <p>For those looking for a detailed explanation have a read of <a href="http://haacked.com/archive/2011/12/19/get-git-for-windows.aspx" rel="noreferrer">this blog post</a>. Below is a quote from the blog post. Ultimately the <code>ssh-agent.exe</code> needs to be in the path, or resolved some other way.</p>
<p><strong>... | <p>For those looking for a detailed explanation have a read of <a href="http://haacked.com/archive/2011/12/19/get-git-for-windows.aspx" rel="noreferrer">this blog post</a>. Below is a quote from the blog post. Ultimately the <code>ssh-agent.exe</code> needs to be in the path, or resolved some other way.</p> <p><strong>... | 119, 386 | git, ssh | <h1>Git in Powershell saying 'Could not find ssh-agent'</h1>
<p>I have git installed and it works great in the command prompt, but when I open up powershell it gives me this warning:</p>
<pre><code>WARNING: Could not find ssh-agent
</code></pre>
<p>I have pageant running and loaded with my private key. This works in ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,529 | git | # Git in Powershell saying 'Could not find ssh-agent'
I have git installed and it works great in the command prompt, but when I open up powershell it gives me this warning:
```
WARNING: Could not find ssh-agent
```
I have pageant running and loaded with my private key. This works in all the gui tools and the command... | For those looking for a detailed explanation have a read of [this blog post](http://haacked.com/archive/2011/12/19/get-git-for-windows.aspx). Below is a quote from the blog post. Ultimately the `ssh-agent.exe` needs to be in the path, or resolved some other way.
**EDIT:**
It appears most of the people don't bother rea... |
31190474 | How to count git commits per user in a date range? | 77 | 2015-07-02 16:55:34 | <p>The command <code>git shortlog -sne</code> is exactly what I need, but I want to be able to specify a date range for that which isn't an option for <code>shortlog</code>. Is there another way to accomplish this same thing, but for a specific date range?</p>
| 40,228 | 1,406,734 | 2025-03-07 14:31:34 | 31,190,624 | 137 | 2015-07-02 17:04:21 | 2,422,776 | 2025-03-07 14:31:34 | https://stackoverflow.com/q/31190474 | https://stackoverflow.com/a/31190624 | <p>Although <code>git shortlog --help</code> doesn't seem to specify it, <code>shortlog</code> takes the same <code>--since</code>, <code>--after</code>, <code>--before</code> and <code>--until</code> parameters that <code>git log</code> does. So, for example:</p>
<pre><code>git shortlog -sne --since="01 Jan 2025&... | <p>Although <code>git shortlog --help</code> doesn't seem to specify it, <code>shortlog</code> takes the same <code>--since</code>, <code>--after</code>, <code>--before</code> and <code>--until</code> parameters that <code>git log</code> does. So, for example:</p> <pre><code>git shortlog -sne --since="01 Jan 2025&... | 119 | git | <h1>How to count git commits per user in a date range?</h1>
<p>The command <code>git shortlog -sne</code> is exactly what I need, but I want to be able to specify a date range for that which isn't an option for <code>shortlog</code>. Is there another way to accomplish this same thing, but for a specific date range?</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,530 | git | # How to count git commits per user in a date range?
The command `git shortlog -sne` is exactly what I need, but I want to be able to specify a date range for that which isn't an option for `shortlog`. Is there another way to accomplish this same thing, but for a specific date range? | Although `git shortlog --help` doesn't seem to specify it, `shortlog` takes the same `--since`, `--after`, `--before` and `--until` parameters that `git log` does. So, for example:
```
git shortlog -sne --since="01 Jan 2025" --before="01 Feb 2025"
```
Note:
This was verified on git 2.1.0 running on Fedora 21 and on... |
46724078 | How to remove specific commits from Git? | 70 | 2017-10-13 06:51:58 | <p>I want to remove few commits from my remote repository. I have few commits like this in my repo:</p>
<pre><code>commits messages
abcd123 some message
xyze456 another commit message
98y65r4 this commit is not required
987xcrt this commit is not required
bl8976t initial commit
</code></pre>
<p>I w... | 118,844 | 7,156,080 | 2019-05-20 19:47:46 | 46,724,280 | 137 | 2017-10-13 07:04:38 | 303,914 | 2018-09-04 16:31:39 | https://stackoverflow.com/q/46724078 | https://stackoverflow.com/a/46724280 | <p>There are two alternatives to this: the safe one that leaves you with a dirty git history, or the unsafe one that leaves you with a clean git history. You pick:</p>
<h1>Option 1: Revert</h1>
<p>You can tell git to "Revert a commit". This means it will introduce a change that reverts each change you made in a commi... | <p>There are two alternatives to this: the safe one that leaves you with a dirty git history, or the unsafe one that leaves you with a clean git history. You pick:</p> <h1>Option 1: Revert</h1> <p>You can tell git to "Revert a commit". This means it will introduce a change that reverts each change you made in a commi... | 119 | git | <h1>How to remove specific commits from Git?</h1>
<p>I want to remove few commits from my remote repository. I have few commits like this in my repo:</p>
<pre><code>commits messages
abcd123 some message
xyze456 another commit message
98y65r4 this commit is not required
987xcrt this commit is not requir... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,532 | git | # How to remove specific commits from Git?
I want to remove few commits from my remote repository. I have few commits like this in my repo:
```
commits messages
abcd123 some message
xyze456 another commit message
98y65r4 this commit is not required
987xcrt this commit is not required
bl8976t initia... | There are two alternatives to this: the safe one that leaves you with a dirty git history, or the unsafe one that leaves you with a clean git history. You pick:
# Option 1: Revert
You can tell git to "Revert a commit". This means it will introduce a change that reverts each change you made in a commit. You would need... |
25311743 | Undo git rm -r --cached | 69 | 2014-08-14 15:20:41 | <p>My <code>.gitignore</code> file wasn't working, so I followed this <a href="https://stackoverflow.com/questions/11451535/gitignore-not-working">question</a>.</p>
<p>And now I have bunch of files that I need to commit, in order to proceed.
I made a mistake and committed those, because I couldn't find a way to get ri... | 41,803 | 801,354 | 2020-12-02 15:48:58 | 25,312,056 | 137 | 2014-08-14 15:36:37 | 1,860,929 | 2014-08-14 15:36:37 | https://stackoverflow.com/q/25311743 | https://stackoverflow.com/a/25312056 | <p>If you've run only <code>git rm -r --cached</code>, try doing a <code>git reset HEAD .</code> from within your repo root.</p>
<p>If you did a <code>git commit -m "msg"</code> after doing a <code>git rm -r --cached</code>, i.e., you committed the changes, then do <code>git reset HEAD~1</code> to <a href="https://sta... | <p>If you've run only <code>git rm -r --cached</code>, try doing a <code>git reset HEAD .</code> from within your repo root.</p> <p>If you did a <code>git commit -m "msg"</code> after doing a <code>git rm -r --cached</code>, i.e., you committed the changes, then do <code>git reset HEAD~1</code> to <a href="https://sta... | 119 | git | <h1>Undo git rm -r --cached</h1>
<p>My <code>.gitignore</code> file wasn't working, so I followed this <a href="https://stackoverflow.com/questions/11451535/gitignore-not-working">question</a>.</p>
<p>And now I have bunch of files that I need to commit, in order to proceed.
I made a mistake and committed those, becaus... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,533 | git | # Undo git rm -r --cached
My `.gitignore` file wasn't working, so I followed this [question](https://stackoverflow.com/questions/11451535/gitignore-not-working).
And now I have bunch of files that I need to commit, in order to proceed.
I made a mistake and committed those, because I couldn't find a way to get rid of ... | If you've run only `git rm -r --cached`, try doing a `git reset HEAD .` from within your repo root.
If you did a `git commit -m "msg"` after doing a `git rm -r --cached`, i.e., you committed the changes, then do `git reset HEAD~1` to [undo your last commit](https://stackoverflow.com/q/927358/1860929). |
19341975 | Heroku + Node: Cannot find module error | 59 | 2013-10-13 04:49:29 | <p>My Node app is running fine locally, but has run into an error when deploying to Heroku. The app uses Sequelize in a <code>/models</code> folder, which contains <code>index.js</code>, <code>Company.js</code> and <code>Users.js</code>. Locally, I am able to import the models using the following code in <code>/models/... | 42,830 | 2,291,517 | 2022-05-04 06:36:51 | 19,348,043 | 137 | 2013-10-13 17:22:08 | 2,291,517 | 2021-01-14 17:45:22 | https://stackoverflow.com/q/19341975 | https://stackoverflow.com/a/19348043 | <p>The problem was due to case sensitivity and file naming. Mac OS X is case insensitive (but aware) whereas Heroku is based on Linux and is case sensitive. By running <code>heroku run bash</code> from my terminal, I was able to see how the <code>/models</code> folder appeared on Heroku's file system. The solution was ... | <p>The problem was due to case sensitivity and file naming. Mac OS X is case insensitive (but aware) whereas Heroku is based on Linux and is case sensitive. By running <code>heroku run bash</code> from my terminal, I was able to see how the <code>/models</code> folder appeared on Heroku's file system. The solution was ... | 3, 119, 8279, 46426, 70036 | git, heroku, javascript, node.js, sequelize.js | <h1>Heroku + Node: Cannot find module error</h1>
<p>My Node app is running fine locally, but has run into an error when deploying to Heroku. The app uses Sequelize in a <code>/models</code> folder, which contains <code>index.js</code>, <code>Company.js</code> and <code>Users.js</code>. Locally, I am able to import the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,535 | git | # Heroku + Node: Cannot find module error
My Node app is running fine locally, but has run into an error when deploying to Heroku. The app uses Sequelize in a `/models` folder, which contains `index.js`, `Company.js` and `Users.js`. Locally, I am able to import the models using the following code in `/models/index.js`... | The problem was due to case sensitivity and file naming. Mac OS X is case insensitive (but aware) whereas Heroku is based on Linux and is case sensitive. By running `heroku run bash` from my terminal, I was able to see how the `/models` folder appeared on Heroku's file system. The solution was to rename `User.js` and `... |
5091017 | How to track directories but not their files with Git? | 109 | 2011-02-23 12:39:06 | <p>I've recently started using Git and am having trouble with just one thing. How can I track directories without tracking their contents?</p>
<p>For example the site I'm working on allows uploads. I want to track the uploads directory so that it is created when branching, etc. but obviously not the files within it (t... | 53,758 | 446,624 | 2022-02-10 13:28:08 | 5,091,158 | 136 | 2011-02-23 12:51:13 | 66,020 | 2011-02-23 12:51:13 | https://stackoverflow.com/q/5091017 | https://stackoverflow.com/a/5091158 | <p>Git doesn't track directories, it tracks files, so to acheive this you need to track at least one file. So assuming your <code>.gitignore</code> file looks something like this:</p>
<pre><code>upload/*
</code></pre>
<p>You can do this:</p>
<pre><code>$ touch upload/.placeholder
$ git add -f upload/.placeholder
</c... | <p>Git doesn't track directories, it tracks files, so to acheive this you need to track at least one file. So assuming your <code>.gitignore</code> file looks something like this:</p> <pre><code>upload/* </code></pre> <p>You can do this:</p> <pre><code>$ touch upload/.placeholder $ git add -f upload/.placeholder </c... | 119, 218, 25056 | directory, git, gitignore | <h1>How to track directories but not their files with Git?</h1>
<p>I've recently started using Git and am having trouble with just one thing. How can I track directories without tracking their contents?</p>
<p>For example the site I'm working on allows uploads. I want to track the uploads directory so that it is creat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,538 | git | # How to track directories but not their files with Git?
I've recently started using Git and am having trouble with just one thing. How can I track directories without tracking their contents?
For example the site I'm working on allows uploads. I want to track the uploads directory so that it is created when branchin... | Git doesn't track directories, it tracks files, so to acheive this you need to track at least one file. So assuming your `.gitignore` file looks something like this:
```
upload/*
```
You can do this:
```
$ touch upload/.placeholder
$ git add -f upload/.placeholder
```
If you forget the `-f` you'll see:
```
$ git a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.