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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2999353 | How do you hide .git project directories? | 62 | 2010-06-08 16:36:46 | <p>Now that I have nginx setup I need to be able to hide my <code>.git</code> directories. What kind of rewrite would I need to stop prying eyes? And where in the <code>server {}</code> or <code>http {}</code> block would it go?</p>
| 21,144 | 99,923 | 2018-07-28 20:44:13 | 2,999,690 | 80 | 2010-06-08 17:26:38 | 66,978 | 2016-08-27 01:48:46 | https://stackoverflow.com/q/2999353 | https://stackoverflow.com/a/2999690 | <pre><code>http {
server {
location ~ /\.git {
deny all;
}
}
}
</code></pre>
<p>This <code>location</code> directive will deny access to any <code>.git</code> directory in any subdirectory.</p>
<p><strong>Note:</strong> This location block must be before your main location block, so that it can be e... | <pre><code>http { server { location ~ /\.git { deny all; } } } </code></pre> <p>This <code>location</code> directive will deny access to any <code>.git</code> directory in any subdirectory.</p> <p><strong>Note:</strong> This location block must be before your main location block, so that it can be e... | 18, 119, 6605 | git, nginx, regex | <h1>How do you hide .git project directories?</h1>
<p>Now that I have nginx setup I need to be able to hide my <code>.git</code> directories. What kind of rewrite would I need to stop prying eyes? And where in the <code>server {}</code> or <code>http {}</code> block would it go?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,366 | git | # How do you hide .git project directories?
Now that I have nginx setup I need to be able to hide my `.git` directories. What kind of rewrite would I need to stop prying eyes? And where in the `server {}` or `http {}` block would it go? | ```
http {
server {
location ~ /\.git {
deny all;
}
}
}
```
This `location` directive will deny access to any `.git` directory in any subdirectory.
**Note:** This location block must be before your main location block, so that it can be evaluated first. |
30696930 | How to hide .env file from Github | 58 | 2015-06-07 18:20:05 | <p>I'm using dotenv for my rails project to store API keys. I have the dotenv gem in my gemfile, created a .env in the root of my app and have my API keys listed in there. However, when I push up to github, I notice that the .env file is still there. Am I missing a step? How can I hide the .env file from being uploaded... | 159,089 | 2,778,483 | 2024-02-25 15:27:13 | 30,697,067 | 80 | 2015-06-07 18:33:55 | 2,340,657 | 2015-06-07 18:33:55 | https://stackoverflow.com/q/30696930 | https://stackoverflow.com/a/30697067 | <p>Create a file called <code>.gitignore</code> in the root directory of your project (<em>it's possible one is already there</em>) and add <code>.env</code> on its own line in the file.</p>
<p>Also, if you have already added it to your repository, then you will have to add the file to <code>.gitignore</code> as state... | <p>Create a file called <code>.gitignore</code> in the root directory of your project (<em>it's possible one is already there</em>) and add <code>.env</code> on its own line in the file.</p> <p>Also, if you have already added it to your repository, then you will have to add the file to <code>.gitignore</code> as state... | 119, 25056 | git, gitignore | <h1>How to hide .env file from Github</h1>
<p>I'm using dotenv for my rails project to store API keys. I have the dotenv gem in my gemfile, created a .env in the root of my app and have my API keys listed in there. However, when I push up to github, I notice that the .env file is still there. Am I missing a step? How c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,371 | git | # How to hide .env file from Github
I'm using dotenv for my rails project to store API keys. I have the dotenv gem in my gemfile, created a .env in the root of my app and have my API keys listed in there. However, when I push up to github, I notice that the .env file is still there. Am I missing a step? How can I hide... | Create a file called `.gitignore` in the root directory of your project (*it's possible one is already there*) and add `.env` on its own line in the file.
Also, if you have already added it to your repository, then you will have to add the file to `.gitignore` as stated above and then clear Git's cache. You can find i... |
48371911 | Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch." | 56 | 2018-01-21 21:29:26 | <p>I have created a branch named dev.</p>
<p>I have done a pull request to send dev code to master, when I do this pull request it tell me:
<a href="https://i.sstatic.net/Y5yOL.png" rel="noreferrer"><img src="https://i.sstatic.net/Y5yOL.png" alt="enter image description here"></a></p>
<p>50+ conflicts prevent automat... | 43,240 | 3,017,963 | 2022-07-21 05:46:06 | 48,375,272 | 80 | 2018-01-22 05:41:28 | 1,382,872 | 2020-05-23 14:07:49 | https://stackoverflow.com/q/48371911 | https://stackoverflow.com/a/48375272 | <p>You will have to do the following on your PC</p>
<p>On branch <code>dev</code></p>
<p><code>$ git pull --no-rebase origin master</code> - This will create a merge commit and you will have to resolve the conflicts in the files which are changed both on dev and master. <code>git status</code> will show the list of f... | <p>You will have to do the following on your PC</p> <p>On branch <code>dev</code></p> <p><code>$ git pull --no-rebase origin master</code> - This will create a merge commit and you will have to resolve the conflicts in the files which are changed both on dev and master. <code>git status</code> will show the list of f... | 119, 116537 | azure-devops, git | <h1>Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."</h1>
<p>I have created a branch named dev.</p>
<p>I have done a pull request to send dev code to master, when I do this pull request it tell me:
<a href="https://i.sstatic.net/Y5yOL.png" rel="n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,373 | git | # Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."
I have created a branch named dev.
I have done a pull request to send dev code to master, when I do this pull request it tell me:
[ seems Unix-only (redirect to <code>/bin/t... | 18,562 | 281,545 | 2022-10-04 20:25:06 | 39,937,070 | 80 | 2016-10-08 20:30:46 | 1,256,452 | 2019-08-21 16:18:32 | https://stackoverflow.com/q/39931781 | https://stackoverflow.com/a/39937070 | <p>The exclude pathspec trick, described in <a href="https://stackoverflow.com/q/5685007/1256452">Making 'git log' ignore changes for certain paths</a>, works here:</p>
<pre><code>git diff --stat -- . ':(exclude)file/to/exclude.txt'
</code></pre>
<p>or, if you are in a subdirectory:</p>
<pre><code>git diff -... | <p>The exclude pathspec trick, described in <a href="https://stackoverflow.com/q/5685007/1256452">Making 'git log' ignore changes for certain paths</a>, works here:</p> <pre><code>git diff --stat -- . ':(exclude)file/to/exclude.txt' </code></pre> <p>or, if you are in a subdirectory:</p> <pre><code>git diff -... | 119, 9033 | git, git-diff | <h1>`git diff --stat` exclude certain files</h1>
<p>I'm trying to adapt the answers from <a href="https://stackoverflow.com/q/10415100/281545">Exclude file from "git diff"</a> for the <code>--stat</code> flag and failing. The <a href="https://stackoverflow.com/a/10421385/281545">accepted answer</a> (create a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,379 | git | # `git diff --stat` exclude certain files
I'm trying to adapt the answers from [Exclude file from "git diff"](https://stackoverflow.com/q/10415100/281545) for the `--stat` flag and failing. The [accepted answer](https://stackoverflow.com/a/10421385/281545) (create a driver) seems Unix-only (redirect to `/bin/true`, wh... | The exclude pathspec trick, described in [Making 'git log' ignore changes for certain paths](https://stackoverflow.com/q/5685007/1256452), works here:
```
git diff --stat -- . ':(exclude)file/to/exclude.txt'
```
or, if you are in a subdirectory:
```
git diff --stat -- :/ ':(exclude,top)file/to/exclude.txt'
```
The ... |
2420056 | What's the best way to replace remote.origin.url in Git? | 35 | 2010-03-10 19:53:11 | <p>I'm new to Git. Let's say Alice and Bob had been developing their project by using two Git repositories for each. And, Alice at certain times want to set up a new repository to manage their common progress. Do you think what is the best way to replace remote.origin.url in the configuration of Git?</p>
<ul>
<li>to r... | 23,749 | 273,182 | 2020-12-10 04:36:39 | 2,420,118 | 80 | 2010-03-10 20:00:23 | 19,563 | 2012-04-09 20:44:37 | https://stackoverflow.com/q/2420056 | https://stackoverflow.com/a/2420118 | <p>If they already have a remote called <code>origin</code> but want the new remote to be called <code>origin</code> then the most logical thing to do is rename or remove the existing remote called <code>origin</code> and add a new one:</p>
<pre><code>git remote rename origin old_origin
git remote add origin url://ne... | <p>If they already have a remote called <code>origin</code> but want the new remote to be called <code>origin</code> then the most logical thing to do is rename or remove the existing remote called <code>origin</code> and add a new one:</p> <pre><code>git remote rename origin old_origin git remote add origin url://ne... | 119, 456 | git, version-control | <h1>What's the best way to replace remote.origin.url in Git?</h1>
<p>I'm new to Git. Let's say Alice and Bob had been developing their project by using two Git repositories for each. And, Alice at certain times want to set up a new repository to manage their common progress. Do you think what is the best way to replace... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,380 | git | # What's the best way to replace remote.origin.url in Git?
I'm new to Git. Let's say Alice and Bob had been developing their project by using two Git repositories for each. And, Alice at certain times want to set up a new repository to manage their common progress. Do you think what is the best way to replace remote.o... | If they already have a remote called `origin` but want the new remote to be called `origin` then the most logical thing to do is rename or remove the existing remote called `origin` and add a new one:
```
git remote rename origin old_origin
git remote add origin url://new/url.git
```
If you don't care about the old ... |
6543519 | Undoing accidental git stash pop | 227 | 2011-07-01 04:15:27 | <p>I stashed some local changes before doing a complicated merge, did the merge, then stupidly forgot to commit before running <code>git stash pop</code>. The pop created some problems (bad method calls in a big codebase) that are proving hard to track down. I ran <code>git stash show</code>, so I at least know which... | 140,137 | 742,719 | 2021-04-14 21:21:54 | 6,543,671 | 79 | 2011-07-01 04:44:42 | 479,989 | 2011-07-01 04:44:42 | https://stackoverflow.com/q/6543519 | https://stackoverflow.com/a/6543671 | <p>Try using <a href="https://stackoverflow.com/questions/89332/recover-dropped-stash-in-git">How to recover a dropped stash in Git?</a> to find the stash you popped. I think there are always two commits for a stash, since it preserves the index and the working copy (so often the index commit will be empty). Then <co... | <p>Try using <a href="https://stackoverflow.com/questions/89332/recover-dropped-stash-in-git">How to recover a dropped stash in Git?</a> to find the stash you popped. I think there are always two commits for a stash, since it preserves the index and the working copy (so often the index commit will be empty). Then <co... | 119, 13091 | git, git-stash | <h1>Undoing accidental git stash pop</h1>
<p>I stashed some local changes before doing a complicated merge, did the merge, then stupidly forgot to commit before running <code>git stash pop</code>. The pop created some problems (bad method calls in a big codebase) that are proving hard to track down. I ran <code>git s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,382 | git | # Undoing accidental git stash pop
I stashed some local changes before doing a complicated merge, did the merge, then stupidly forgot to commit before running `git stash pop`. The pop created some problems (bad method calls in a big codebase) that are proving hard to track down. I ran `git stash show`, so I at least k... | Try using [How to recover a dropped stash in Git?](https://stackoverflow.com/questions/89332/recover-dropped-stash-in-git) to find the stash you popped. I think there are always two commits for a stash, since it preserves the index and the working copy (so often the index commit will be empty). Then `git show` them to ... |
5578270 | Fully backup a git repo? | 202 | 2011-04-07 08:39:57 | <p>Is there a simple way to backup an entire git repo including all branches and tags?</p>
| 198,933 | 415,286 | 2024-12-15 20:51:33 | 5,578,315 | 79 | 2011-04-07 08:44:00 | 421,223 | 2018-10-03 14:10:00 | https://stackoverflow.com/q/5578270 | https://stackoverflow.com/a/5578315 | <p>Whats about just make a clone of it?</p>
<pre><code>git clone --mirror other/repo.git
</code></pre>
<p>Every repository is a backup of its remote.</p>
| <p>Whats about just make a clone of it?</p> <pre><code>git clone --mirror other/repo.git </code></pre> <p>Every repository is a backup of its remote.</p> | 119, 493 | backup, git | <h1>Fully backup a git repo?</h1>
<p>Is there a simple way to backup an entire git repo including all branches and tags?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,383 | git | # Fully backup a git repo?
Is there a simple way to backup an entire git repo including all branches and tags? | Whats about just make a clone of it?
```
git clone --mirror other/repo.git
```
Every repository is a backup of its remote. |
20151158 | Using git repository as a database backend | 168 | 2013-11-22 17:41:48 | <p>I'm doing a project that deals with structured document database. I have a tree of categories (~1000 categories, up to ~50 categories on each level), each category contains several thousands (up to, say, ~10000) of structured documents. Each document is several kilobytes of data in some structured form (I'd prefer Y... | 44,217 | 487,064 | 2024-12-25 00:29:36 | 24,176,565 | 79 | 2014-06-12 04:43:07 | 487,064 | 2014-06-12 04:43:07 | https://stackoverflow.com/q/20151158 | https://stackoverflow.com/a/24176565 | <p>Answering my own question is not the best thing to do, but, as I ultimately dropped the idea, I'd like to share on the rationale that worked in my case. I'd like to emphasize that this rationale might not apply to all cases, so it's up to architect to decide.</p>
<p>Generally, the first main point my question misse... | <p>Answering my own question is not the best thing to do, but, as I ultimately dropped the idea, I'd like to share on the rationale that worked in my case. I'd like to emphasize that this rationale might not apply to all cases, so it's up to architect to decide.</p> <p>Generally, the first main point my question misse... | 30, 119, 33018, 36285, 49146 | database, database-performance, database-replication, document-database, git | <h1>Using git repository as a database backend</h1>
<p>I'm doing a project that deals with structured document database. I have a tree of categories (~1000 categories, up to ~50 categories on each level), each category contains several thousands (up to, say, ~10000) of structured documents. Each document is several kil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,384 | git | # Using git repository as a database backend
I'm doing a project that deals with structured document database. I have a tree of categories (~1000 categories, up to ~50 categories on each level), each category contains several thousands (up to, say, ~10000) of structured documents. Each document is several kilobytes of... | Answering my own question is not the best thing to do, but, as I ultimately dropped the idea, I'd like to share on the rationale that worked in my case. I'd like to emphasize that this rationale might not apply to all cases, so it's up to architect to decide.
Generally, the first main point my question misses is that ... |
7830728 | Warning on "diff.renamelimit variable" when doing git push | 117 | 2011-10-20 03:15:41 | <p>I'm pushing the local commit to the remote git server and got the following warning messages:</p>
<pre><code>remote: warning: only found copies from modified paths due to too many files.
remote: warning: you may want to set your diff.renamelimit variable to at least 19824 and retry the command.
</code></pre>
<p>Bu... | 116,708 | 628,365 | 2023-04-03 15:22:42 | 7,831,027 | 79 | 2011-10-20 04:04:34 | 6,309 | 2021-08-08 01:34:37 | https://stackoverflow.com/q/7830728 | https://stackoverflow.com/a/7831027 | <p>The <a href="http://linux.die.net/man/1/git-config" rel="noreferrer">documentation</a> doesn't mention 0 as a special value for <code>diff.renamelimit</code>.<br />
So you should set that limit to the value recommended.<br />
Or you can try deactivating the rename detection altogether. (<code>git config diff.renames... | <p>The <a href="http://linux.die.net/man/1/git-config" rel="noreferrer">documentation</a> doesn't mention 0 as a special value for <code>diff.renamelimit</code>.<br /> So you should set that limit to the value recommended.<br /> Or you can try deactivating the rename detection altogether. (<code>git config diff.renames... | 119, 1716, 4236 | git, push, warnings | <h1>Warning on "diff.renamelimit variable" when doing git push</h1>
<p>I'm pushing the local commit to the remote git server and got the following warning messages:</p>
<pre><code>remote: warning: only found copies from modified paths due to too many files.
remote: warning: you may want to set your diff.renamelimit va... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,385 | git | # Warning on "diff.renamelimit variable" when doing git push
I'm pushing the local commit to the remote git server and got the following warning messages:
```
remote: warning: only found copies from modified paths due to too many files.
remote: warning: you may want to set your diff.renamelimit variable to at least 1... | The [documentation](http://linux.die.net/man/1/git-config) doesn't mention 0 as a special value for `diff.renamelimit`.
So you should set that limit to the value recommended.
Or you can try deactivating the rename detection altogether. (`git config diff.renames 0`)
You will find a similar example in this blog post... |
11872984 | What is the difference between git push.default=current and push.default=upstream? | 97 | 2012-08-08 20:52:23 | <p>The man page for git-config lists these options for push.default:</p>
<pre><code>nothing - do not push anything.
matching - push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
upstream - push the current branch to its upstream branch.
trackin... | 53,652 | 241,142 | 2023-09-07 14:32:42 | 11,873,386 | 79 | 2012-08-08 21:23:19 | 877,115 | 2015-10-07 18:46:59 | https://stackoverflow.com/q/11872984 | https://stackoverflow.com/a/11873386 | <p>You've summarized the difference in your question. <code>upstream</code> pushes to the <em>configured</em> upstream branch, while <code>current</code> assumes the upstream branch has the same name as the <em>current</em> local branch, and pushes to that specific name. In reality, there's no reason to assume a local ... | <p>You've summarized the difference in your question. <code>upstream</code> pushes to the <em>configured</em> upstream branch, while <code>current</code> assumes the upstream branch has the same name as the <em>current</em> local branch, and pushes to that specific name. In reality, there's no reason to assume a local ... | 119, 28898, 76220 | git, git-branch, git-push | <h1>What is the difference between git push.default=current and push.default=upstream?</h1>
<p>The man page for git-config lists these options for push.default:</p>
<pre><code>nothing - do not push anything.
matching - push all matching branches. All branches having the same name in both ends are considered to be match... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,387 | git | # What is the difference between git push.default=current and push.default=upstream?
The man page for git-config lists these options for push.default:
```
nothing - do not push anything.
matching - push all matching branches. All branches having the same name in both ends are considered to be matching. This is the de... | You've summarized the difference in your question. `upstream` pushes to the *configured* upstream branch, while `current` assumes the upstream branch has the same name as the *current* local branch, and pushes to that specific name. In reality, there's no reason to assume a local branch's upstream tracking branch has t... |
45818817 | Delete multiple git remote tags and push once | 71 | 2017-08-22 13:19:47 | <p>In Git, how can I delete multiple tags before pushing?</p>
<p>I know how to do it with one tag at a time. Not sure if it's possible to do multiple.</p>
| 37,021 | 2,913,563 | 2025-03-27 06:33:26 | 45,818,918 | 79 | 2017-08-22 13:24:34 | 439,790 | 2019-11-25 20:16:36 | https://stackoverflow.com/q/45818817 | https://stackoverflow.com/a/45818918 | <p>To delete locally multiple tags: <a href="https://git-scm.com/docs/git-tag" rel="noreferrer">git tag</a>:</p>
<blockquote>
<p>git tag -d <tagname>...</p>
</blockquote>
<p>So simply:</p>
<pre><code>git tag -d TAG1 TAG2 TAG3
</code></pre>
<p>To delete multiple tags remotely: <a href="https://git-scm.com/docs/... | <p>To delete locally multiple tags: <a href="https://git-scm.com/docs/git-tag" rel="noreferrer">git tag</a>:</p> <blockquote> <p>git tag -d <tagname>...</p> </blockquote> <p>So simply:</p> <pre><code>git tag -d TAG1 TAG2 TAG3 </code></pre> <p>To delete multiple tags remotely: <a href="https://git-scm.com/docs/... | 115, 119 | git, tags | <h1>Delete multiple git remote tags and push once</h1>
<p>In Git, how can I delete multiple tags before pushing?</p>
<p>I know how to do it with one tag at a time. Not sure if it's possible to do multiple.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,390 | git | # Delete multiple git remote tags and push once
In Git, how can I delete multiple tags before pushing?
I know how to do it with one tag at a time. Not sure if it's possible to do multiple. | To delete locally multiple tags: [git tag](https://git-scm.com/docs/git-tag):
> git tag -d <tagname>...
So simply:
```
git tag -d TAG1 TAG2 TAG3
```
To delete multiple tags remotely: [git push](https://git-scm.com/docs/git-push):
> git push [-d | --delete] [<repository> [<refspec>...]]
So simply:
```
git push ${... |
35851671 | Is there a way to list the commit's author in `git rebase -i` (interactive)? | 71 | 2016-03-07 18:55:09 | <p>When I do a <code>git rebase -i</code> on a branch shared with a co-worker, I often want to just rebase my own commits. However, because the interactive rebase tool doesn't add the author information to the rebasing file (all t gives is the commit hash and description), I wind up having to go check commits in anoth... | 8,228 | 5,921 | 2025-01-09 22:26:29 | 35,851,846 | 79 | 2016-03-07 19:03:33 | 1,256,452 | 2025-01-09 22:26:29 | https://stackoverflow.com/q/35851671 | https://stackoverflow.com/a/35851846 | <p>As of git 2.6, <code>git rebase -i</code> uses <code>rebase.instructionFormat</code> (default <code>%s</code>) to generate the text after <code>pick NNNNN...</code>.</p>
<p>Quoting the documentation:</p>
<blockquote>
<p><a href="https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt-rebaseinstructionFormat... | <p>As of git 2.6, <code>git rebase -i</code> uses <code>rebase.instructionFormat</code> (default <code>%s</code>) to generate the text after <code>pick NNNNN...</code>.</p> <p>Quoting the documentation:</p> <blockquote> <p><a href="https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt-rebaseinstructionFormat... | 119, 29934 | git, git-rebase | <h1>Is there a way to list the commit's author in `git rebase -i` (interactive)?</h1>
<p>When I do a <code>git rebase -i</code> on a branch shared with a co-worker, I often want to just rebase my own commits. However, because the interactive rebase tool doesn't add the author information to the rebasing file (all t gi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,391 | git | # Is there a way to list the commit's author in `git rebase -i` (interactive)?
When I do a `git rebase -i` on a branch shared with a co-worker, I often want to just rebase my own commits. However, because the interactive rebase tool doesn't add the author information to the rebasing file (all t gives is the commit has... | As of git 2.6, `git rebase -i` uses `rebase.instructionFormat` (default `%s`) to generate the text after `pick NNNNN...`.
Quoting the documentation:
> [rebase.instructionFormat](https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt-rebaseinstructionFormat)
>
> A format string, as specified in [git-log](htt... |
17558221 | How can I view the output of `git show` in a diff viewer like meld, kdiff3, etc | 70 | 2013-07-09 21:07:51 | <p>There are many SO questions that show how to view the output of a <code>git diff</code> command in a diff viewer like meld using <code>git difftool</code> or otherwise. I am not asking about <code>git diff</code> though.</p>
<p>I want to see the output of <code>git show <previous commit sha1></code> in a dif... | 18,513 | 565,879 | 2025-06-20 19:54:31 | 17,558,716 | 79 | 2013-07-09 21:37:07 | 5,168 | 2013-07-09 21:37:07 | https://stackoverflow.com/q/17558221 | https://stackoverflow.com/a/17558716 | <p>You can use <code>git difftool</code> to show a single commit.</p>
<p>Say you want to see the commit with the sha1 <code>abc123</code>:</p>
<pre><code>git difftool abc123~1 abc123
</code></pre>
<p>(<code>~1</code> tells git to move to the previous commit, so <code>abc123~1</code> is the commit before <code>abc123... | <p>You can use <code>git difftool</code> to show a single commit.</p> <p>Say you want to see the commit with the sha1 <code>abc123</code>:</p> <pre><code>git difftool abc123~1 abc123 </code></pre> <p>(<code>~1</code> tells git to move to the previous commit, so <code>abc123~1</code> is the commit before <code>abc123... | 119, 456, 606, 3346 | diff, dvcs, git, version-control | <h1>How can I view the output of `git show` in a diff viewer like meld, kdiff3, etc</h1>
<p>There are many SO questions that show how to view the output of a <code>git diff</code> command in a diff viewer like meld using <code>git difftool</code> or otherwise. I am not asking about <code>git diff</code> though.</p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,392 | git | # How can I view the output of `git show` in a diff viewer like meld, kdiff3, etc
There are many SO questions that show how to view the output of a `git diff` command in a diff viewer like meld using `git difftool` or otherwise. I am not asking about `git diff` though.
I want to see the output of `git show <previous ... | You can use `git difftool` to show a single commit.
Say you want to see the commit with the sha1 `abc123`:
```
git difftool abc123~1 abc123
```
(`~1` tells git to move to the previous commit, so `abc123~1` is the commit before `abc123`)
If you use this regularly, you could make a custom git command to make it easie... |
41406903 | Remote Git branches not visible | 60 | 2016-12-31 08:59:49 | <p>After <code>git pull</code> I've always been able to see all branches by doing a <code>git branch</code>.</p>
<p>Right now (for some reason) running <code>git branch</code> shows me master and one other branch, that I am actively working on,.</p>
<p><code>git remote show origin</code> shows me all branches. If I do... | 152,819 | 4,569,506 | 2021-03-16 07:56:07 | 41,407,485 | 79 | 2016-12-31 10:28:34 | 1,256,452 | 2016-12-31 10:28:34 | https://stackoverflow.com/q/41406903 | https://stackoverflow.com/a/41407485 | <p>TL;DR: just use <code>git branch -r</code> or <code>git branch -a</code> (after <code>git fetch</code> to update). It's not at all clear why you've been seeing remote-tracking branches without these flags (perhaps you have been using a GUI that shows them automatically?).</p>
<p>You do, however, have at least one ... | <p>TL;DR: just use <code>git branch -r</code> or <code>git branch -a</code> (after <code>git fetch</code> to update). It's not at all clear why you've been seeing remote-tracking branches without these flags (perhaps you have been using a GUI that shows them automatically?).</p> <p>You do, however, have at least one ... | 119 | git | <h1>Remote Git branches not visible</h1>
<p>After <code>git pull</code> I've always been able to see all branches by doing a <code>git branch</code>.</p>
<p>Right now (for some reason) running <code>git branch</code> shows me master and one other branch, that I am actively working on,.</p>
<p><code>git remote show ori... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,395 | git | # Remote Git branches not visible
After `git pull` I've always been able to see all branches by doing a `git branch`.
Right now (for some reason) running `git branch` shows me master and one other branch, that I am actively working on,.
`git remote show origin` shows me all branches. If I do a `git checkout` on one ... | TL;DR: just use `git branch -r` or `git branch -a` (after `git fetch` to update). It's not at all clear why you've been seeing remote-tracking branches without these flags (perhaps you have been using a GUI that shows them automatically?).
You do, however, have at least one small misconception built in to your questio... |
5341077 | Git doesn't show how many commits ahead of origin I am, and I want it to | 59 | 2011-03-17 15:16:18 | <p>There are plenty of questions here about Git saying people are ahead of a remote branch by X commits, and they want it to stop.</p>
<p>I have the opposite problem. I want Git to tell me how many commits ahead I am, but it doesn't.</p>
<p>When I created my remote bare repository first, then cloned from it, this wo... | 6,524 | 5,486 | 2021-06-14 14:15:26 | 5,341,092 | 79 | 2011-03-17 15:17:43 | 43,582 | 2013-02-22 18:18:16 | https://stackoverflow.com/q/5341077 | https://stackoverflow.com/a/5341092 | <p><code>git branch --set-upstream <em>local</em> origin/<em>remote</em></code></p>
<p><em>local</em> and <em>remote</em> are the names of your local resp. remote branches.</p>
<p>In Git version 1.8 and later, it's even easier. Make sure you're on the local branch, and then:</p>
<p><code>git branch --set-upstream-t... | <p><code>git branch --set-upstream <em>local</em> origin/<em>remote</em></code></p> <p><em>local</em> and <em>remote</em> are the names of your local resp. remote branches.</p> <p>In Git version 1.8 and later, it's even easier. Make sure you're on the local branch, and then:</p> <p><code>git branch --set-upstream-t... | 119 | git | <h1>Git doesn't show how many commits ahead of origin I am, and I want it to</h1>
<p>There are plenty of questions here about Git saying people are ahead of a remote branch by X commits, and they want it to stop.</p>
<p>I have the opposite problem. I want Git to tell me how many commits ahead I am, but it doesn't.</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,396 | git | # Git doesn't show how many commits ahead of origin I am, and I want it to
There are plenty of questions here about Git saying people are ahead of a remote branch by X commits, and they want it to stop.
I have the opposite problem. I want Git to tell me how many commits ahead I am, but it doesn't.
When I created my ... | `git branch --set-upstream local origin/remote`
*local* and *remote* are the names of your local resp. remote branches.
In Git version 1.8 and later, it's even easier. Make sure you're on the local branch, and then:
`git branch --set-upstream-to origin/remote` |
366093 | Git commit against tag with no branch | 57 | 2008-12-14 02:36:17 | <p>If I check out a tagged version of my source code without creating a branch, Git indicates that I'm not associated with any branch at all. It's happy to let me make changes and check them in though. Where do those changes go? If I switch back to 'master' they disappear (overwritten by what was in master) and I can't... | 23,758 | 826 | 2012-01-06 16:08:21 | 366,147 | 79 | 2008-12-14 03:47:18 | 23,356 | 2011-09-12 15:07:12 | https://stackoverflow.com/q/366093 | https://stackoverflow.com/a/366147 | <p>Because your <strong>commit isn't on any branch</strong>, you can't see it in the working directory unless you checkout that specific commit, using its SHA1. You can find the commit by looking at the <code>reflog</code> which tracks changes in what you have checked out from the repo. If your tag was <code>XXX</code... | <p>Because your <strong>commit isn't on any branch</strong>, you can't see it in the working directory unless you checkout that specific commit, using its SHA1. You can find the commit by looking at the <code>reflog</code> which tracks changes in what you have checked out from the repo. If your tag was <code>XXX</code... | 115, 119, 1879, 5597 | branch, commit, git, tags | <h1>Git commit against tag with no branch</h1>
<p>If I check out a tagged version of my source code without creating a branch, Git indicates that I'm not associated with any branch at all. It's happy to let me make changes and check them in though. Where do those changes go? If I switch back to 'master' they disappear ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,398 | git | # Git commit against tag with no branch
If I check out a tagged version of my source code without creating a branch, Git indicates that I'm not associated with any branch at all. It's happy to let me make changes and check them in though. Where do those changes go? If I switch back to 'master' they disappear (overwrit... | Because your **commit isn't on any branch**, you can't see it in the working directory unless you checkout that specific commit, using its SHA1. You can find the commit by looking at the `reflog` which tracks changes in what you have checked out from the repo. If your tag was `XXX` you'll see something like:
```
$ git... |
49912695 | git pre- and post- commit hooks not running | 55 | 2018-04-19 04:21:37 | <p>What could cause my git pre- and post- commit hooks to not run?</p>
<p>(please note: this question is not a duplicate; the answer to each of the other questions is either <code>chmod +x</code> or "don't have a file extension", and neither are the issue here)</p>
<p>They are executable:</p>
<p><code>$ ls -alh .git... | 70,744 | 71,522 | 2024-02-13 04:29:13 | 49,912,720 | 79 | 2018-04-19 04:24:34 | 6,309 | 2018-04-20 20:15:44 | https://stackoverflow.com/q/49912695 | https://stackoverflow.com/a/49912720 | <p>I have seen for instance the config <code>core.hooksPath</code> being set to another path than <code>$GIT_DIR/hooks</code>, making your hooks in that folder ignored.</p>
<p>Check your <code>git config core.hooksPath</code> output, and more generally <code>git config -l</code> for any out of the ordinary settings.... | <p>I have seen for instance the config <code>core.hooksPath</code> being set to another path than <code>$GIT_DIR/hooks</code>, making your hooks in that folder ignored.</p> <p>Check your <code>git config core.hooksPath</code> output, and more generally <code>git config -l</code> for any out of the ordinary settings.... | 119 | git | <h1>git pre- and post- commit hooks not running</h1>
<p>What could cause my git pre- and post- commit hooks to not run?</p>
<p>(please note: this question is not a duplicate; the answer to each of the other questions is either <code>chmod +x</code> or "don't have a file extension", and neither are the issue here)</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,399 | git | # git pre- and post- commit hooks not running
What could cause my git pre- and post- commit hooks to not run?
(please note: this question is not a duplicate; the answer to each of the other questions is either `chmod +x` or "don't have a file extension", and neither are the issue here)
They are executable:
`$ ls -a... | I have seen for instance the config `core.hooksPath` being set to another path than `$GIT_DIR/hooks`, making your hooks in that folder ignored.
Check your `git config core.hooksPath` output, and more generally `git config -l` for any out of the ordinary settings.
Note that a [`git commit -n` would skip the pre-commit... |
14365946 | Create a branch alias? | 55 | 2013-01-16 19:11:47 | <p>I am researching switching from starteam to Git.</p>
<p>Currently, in starteam, we use "floating views" with special names. These floating views basically work like aliases. Therefore, we can specify a specific alias to checkout from and we'll get the branch that we're currently model testing.</p>
<p>How w... | 40,110 | 606,723 | 2021-07-28 12:20:28 | 17,236,679 | 79 | 2013-06-21 13:37:08 | 606,723 | 2015-01-26 11:00:23 | https://stackoverflow.com/q/14365946 | https://stackoverflow.com/a/17236679 | <p>Please see here: <a href="https://stackoverflow.com/a/549949/606723">https://stackoverflow.com/a/549949/606723</a></p>
<blockquote>
<p>You can rename the master branch trunk as Greg has suggested, or you
can also create a trunk that is a symbolic reference to the master
branch so that both git and svn users h... | <p>Please see here: <a href="https://stackoverflow.com/a/549949/606723">https://stackoverflow.com/a/549949/606723</a></p> <blockquote> <p>You can rename the master branch trunk as Greg has suggested, or you can also create a trunk that is a symbolic reference to the master branch so that both git and svn users h... | 119, 456, 40701, 53847 | branching-and-merging, feature-branch, git, version-control | <h1>Create a branch alias?</h1>
<p>I am researching switching from starteam to Git.</p>
<p>Currently, in starteam, we use "floating views" with special names. These floating views basically work like aliases. Therefore, we can specify a specific alias to checkout from and we'll get the branch that we're curre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,400 | git | # Create a branch alias?
I am researching switching from starteam to Git.
Currently, in starteam, we use "floating views" with special names. These floating views basically work like aliases. Therefore, we can specify a specific alias to checkout from and we'll get the branch that we're currently model testing.
How ... | Please see here: <https://stackoverflow.com/a/549949/606723>
> You can rename the master branch trunk as Greg has suggested, or you
> can also create a trunk that is a symbolic reference to the master
> branch so that both git and svn users have the 'main' branch that they
> are used to.
>
> ```
> git symbolic-ref ref... |
14460595 | Git checkout with dot | 55 | 2013-01-22 14:14:40 | <p>What is the difference between the following <code>git</code> commands:</p>
<pre><code>git checkout branch
git checkout branch .
git checkout . #<-- used at the branch
</code></pre>
<p>Why when I checkout different branches into different folders with first one I missed some files.<br />
But when I am using ... | 34,059 | 1,446,154 | 2023-11-13 02:49:20 | 14,460,890 | 79 | 2013-01-22 14:30:45 | 201,725 | 2021-06-01 07:50:49 | https://stackoverflow.com/q/14460595 | https://stackoverflow.com/a/14460890 | <p><a href="http://git-scm.com/docs/git-checkout.html" rel="noreferrer"><code>git checkout</code>(1)</a> does very different things whether given path specifier or not.</p>
<ol>
<li>With <strong>branch specifier only</strong> (<code>git checkout branch</code>) it will switch current working directory to specified branc... | <p><a href="http://git-scm.com/docs/git-checkout.html" rel="noreferrer"><code>git checkout</code>(1)</a> does very different things whether given path specifier or not.</p> <ol> <li>With <strong>branch specifier only</strong> (<code>git checkout branch</code>) it will switch current working directory to specified branc... | 119 | git | <h1>Git checkout with dot</h1>
<p>What is the difference between the following <code>git</code> commands:</p>
<pre><code>git checkout branch
git checkout branch .
git checkout . #<-- used at the branch
</code></pre>
<p>Why when I checkout different branches into different folders with first one I missed some fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,401 | git | # Git checkout with dot
What is the difference between the following `git` commands:
```
git checkout branch
git checkout branch .
git checkout . #<-- used at the branch
```
Why when I checkout different branches into different folders with first one I missed some files.
But when I am using the second command... | [`git checkout`(1)](http://git-scm.com/docs/git-checkout.html) does very different things whether given path specifier or not.
1. With **branch specifier only** (`git checkout branch`) it will switch current working directory to specified branch, *keeping local changes if possible and failing otherwise*. If you alread... |
5032188 | How can I get content of a file from git index? | 46 | 2011-02-17 17:13:11 | <p>I have a file which has been already added to my local repository. I've modified it in the working tree, so <code>git status</code> shows me the file as modified. I would like to know what is the <em>file content</em> kept in the index before I stage the file.</p>
<p>I can think of two ways of doing that:</p>
<ol>... | 10,964 | 209,508 | 2017-09-19 14:16:32 | 5,153,415 | 79 | 2011-03-01 10:45:44 | 49,849 | 2017-09-19 14:14:56 | https://stackoverflow.com/q/5032188 | https://stackoverflow.com/a/5153415 | <p>Use the <code>:</code> prefix to access objects in the current index (staged but not yet commited).</p>
<pre><code>git show :file
</code></pre>
<p>See the <a href="https://git-scm.com/docs/gitrevisions#gitrevisions-emltngtltpathgtemegem0READMEememREADMEem" rel="noreferrer">gitrevisions manual</a> for more informat... | <p>Use the <code>:</code> prefix to access objects in the current index (staged but not yet commited).</p> <pre><code>git show :file </code></pre> <p>See the <a href="https://git-scm.com/docs/gitrevisions#gitrevisions-emltngtltpathgtemegem0READMEememREADMEem" rel="noreferrer">gitrevisions manual</a> for more informat... | 119, 9033, 54839 | git, git-diff, git-status | <h1>How can I get content of a file from git index?</h1>
<p>I have a file which has been already added to my local repository. I've modified it in the working tree, so <code>git status</code> shows me the file as modified. I would like to know what is the <em>file content</em> kept in the index before I stage the file.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,402 | git | # How can I get content of a file from git index?
I have a file which has been already added to my local repository. I've modified it in the working tree, so `git status` shows me the file as modified. I would like to know what is the *file content* kept in the index before I stage the file.
I can think of two ways o... | Use the `:` prefix to access objects in the current index (staged but not yet commited).
```
git show :file
```
See the [gitrevisions manual](https://git-scm.com/docs/gitrevisions#gitrevisions-emltngtltpathgtemegem0READMEememREADMEem) for more information. |
27393010 | Git add a folder with spaces in the name | 41 | 2014-12-10 03:48:09 | <h1>Problem</h1>
<p>When I want to add something to the staging area I normally type git add < folder-name >. However, I can't add folders with spaces in the name. My <code>git add</code> auto complete doesn't correctly escape the spaces.</p>
<h2>For example</h2>
<p>I have a folder named: <em>Folder A</em> </p>
... | 63,618 | 4,272,959 | 2016-07-14 15:46:23 | 38,378,698 | 79 | 2016-07-14 15:46:23 | 4,156,040 | 2016-07-14 15:46:23 | https://stackoverflow.com/q/27393010 | https://stackoverflow.com/a/38378698 | <p>The solution is to wrap the folder name inside ' and ' (single quotes).<br />
In your example, try the following:</p>
<pre><code>git add 'Folder A'
</code></pre>
<p>I hope this helps :)</p>
| <p>The solution is to wrap the folder name inside ' and ' (single quotes).<br /> In your example, try the following:</p> <pre><code>git add 'Folder A' </code></pre> <p>I hope this helps :)</p> | 119, 218, 4487, 14215 | addition, directory, git, space | <h1>Git add a folder with spaces in the name</h1>
<h1>Problem</h1>
<p>When I want to add something to the staging area I normally type git add < folder-name >. However, I can't add folders with spaces in the name. My <code>git add</code> auto complete doesn't correctly escape the spaces.</p>
<h2>For example</h2>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,403 | git | # Git add a folder with spaces in the name
# Problem
When I want to add something to the staging area I normally type git add < folder-name >. However, I can't add folders with spaces in the name. My `git add` auto complete doesn't correctly escape the spaces.
## For example
I have a folder named: *Folder A*
I run... | The solution is to wrap the folder name inside ' and ' (single quotes).
In your example, try the following:
```
git add 'Folder A'
```
I hope this helps :) |
6073507 | git checkout branch from outside | 41 | 2011-05-20 14:38:35 | <p>Problem: I need somehow to checkout an existing branch of a project that is already cloned locally on my file system without being in that particular folder of this project.</p>
<p>Solution: I'm trying to do the following:</p>
<ol>
<li><code>git clone 'github-project-url' 'file-system-folder'</code></li>
<li><code>g... | 25,030 | 762,896 | 2020-09-04 23:54:42 | 6,073,628 | 79 | 2011-05-20 14:46:51 | 69,755 | 2011-05-20 14:46:51 | https://stackoverflow.com/q/6073507 | https://stackoverflow.com/a/6073628 | <p>You can use <code>--git-dir</code> to specify the <code>.git</code> directory to use as the repository, and <code>--work-tree</code> to specify the working tree to to the checkout in. See the <a href="http://www.kernel.org/pub/software/scm/git/docs/" rel="noreferrer"><code>git</code> man page</a> for details.</p>
<... | <p>You can use <code>--git-dir</code> to specify the <code>.git</code> directory to use as the repository, and <code>--work-tree</code> to specify the working tree to to the checkout in. See the <a href="http://www.kernel.org/pub/software/scm/git/docs/" rel="noreferrer"><code>git</code> man page</a> for details.</p> <... | 119, 1879, 3050, 37230 | branch, clone, git, git-checkout | <h1>git checkout branch from outside</h1>
<p>Problem: I need somehow to checkout an existing branch of a project that is already cloned locally on my file system without being in that particular folder of this project.</p>
<p>Solution: I'm trying to do the following:</p>
<ol>
<li><code>git clone 'github-project-url' 'f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,404 | git | # git checkout branch from outside
Problem: I need somehow to checkout an existing branch of a project that is already cloned locally on my file system without being in that particular folder of this project.
Solution: I'm trying to do the following:
1. `git clone 'github-project-url' 'file-system-folder'`
2. `git c... | You can use `--git-dir` to specify the `.git` directory to use as the repository, and `--work-tree` to specify the working tree to to the checkout in. See the [`git` man page](http://www.kernel.org/pub/software/scm/git/docs/) for details.
```
git --git-dir=file-system-folder/.git --work-tree=file-system-folder checkou... |
2268172 | git merge recursive theirs, how does it work? | 41 | 2010-02-15 18:44:40 | <p>I'm having a bit of a problem. We have our own CMS which is using git for collaboration and versioning and stuff.</p>
<p>Now I have two git repositories A and B, A which is a project and B which is the CMS itself. Now i want to get B into A, but when i do this i get alot of merge-conflicts and the solution for the ... | 34,955 | 184,326 | 2019-03-28 21:24:03 | 2,270,160 | 79 | 2010-02-16 01:47:21 | 137,317 | 2019-03-28 21:24:03 | https://stackoverflow.com/q/2268172 | https://stackoverflow.com/a/2270160 | <p>You must use this form to pass merge strategy options:</p>
<pre><code>git merge -s recursive -Xtheirs # short options
git merge --strategy recursive --strategy-option theirs # long options
</code></pre>
<p>Also make sure your version supports <code>-Xtheirs</code>, that's a quite recent feature(?)</p>
| <p>You must use this form to pass merge strategy options:</p> <pre><code>git merge -s recursive -Xtheirs # short options git merge --strategy recursive --strategy-option theirs # long options </code></pre> <p>Also make sure your version supports <code>-Xtheirs</code>, that's a quite recent feature(?)</p> | 119, 717 | git, merge | <h1>git merge recursive theirs, how does it work?</h1>
<p>I'm having a bit of a problem. We have our own CMS which is using git for collaboration and versioning and stuff.</p>
<p>Now I have two git repositories A and B, A which is a project and B which is the CMS itself. Now i want to get B into A, but when i do this ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,405 | git | # git merge recursive theirs, how does it work?
I'm having a bit of a problem. We have our own CMS which is using git for collaboration and versioning and stuff.
Now I have two git repositories A and B, A which is a project and B which is the CMS itself. Now i want to get B into A, but when i do this i get alot of me... | You must use this form to pass merge strategy options:
```
git merge -s recursive -Xtheirs # short options
git merge --strategy recursive --strategy-option theirs # long options
```
Also make sure your version supports `-Xtheirs`, that's a quite recent feature(?) |
165092 | Can I push to more than one repository in a single command in git? | 41 | 2008-10-02 23:45:28 | <p>Basically I wanted to do something like <code>git push mybranch to repo1, repo2, repo3</code></p>
<p>right now I'm just typing push many times, and if I'm in a hurry to the the pushing done, I just send them all to the background <code>git push repo1 & git push repo2 &</code></p>
<p>I'm just wondering if <... | 7,174 | 13,989 | 2008-10-03 22:01:36 | 166,043 | 79 | 2008-10-03 09:10:20 | 9,410 | 2008-10-03 09:10:20 | https://stackoverflow.com/q/165092 | https://stackoverflow.com/a/166043 | <p>You can have several URLs per remote in git, even though the <code>git remote</code> command did not appear to expose this last I checked. In <code>.git/config</code>, put something like this:</p>
<pre><code>[remote "public"]
url = git@github.com:kch/inheritable_templates.git
url = kch@homeserver:projects/i... | <p>You can have several URLs per remote in git, even though the <code>git remote</code> command did not appear to expose this last I checked. In <code>.git/config</code>, put something like this:</p> <pre><code>[remote "public"] url = git@github.com:kch/inheritable_templates.git url = kch@homeserver:projects/i... | 119, 456 | git, version-control | <h1>Can I push to more than one repository in a single command in git?</h1>
<p>Basically I wanted to do something like <code>git push mybranch to repo1, repo2, repo3</code></p>
<p>right now I'm just typing push many times, and if I'm in a hurry to the the pushing done, I just send them all to the background <code>git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,406 | git | # Can I push to more than one repository in a single command in git?
Basically I wanted to do something like `git push mybranch to repo1, repo2, repo3`
right now I'm just typing push many times, and if I'm in a hurry to the the pushing done, I just send them all to the background `git push repo1 & git push repo2 &`
... | You can have several URLs per remote in git, even though the `git remote` command did not appear to expose this last I checked. In `.git/config`, put something like this:
```
[remote "public"]
url = git@github.com:kch/inheritable_templates.git
url = kch@homeserver:projects/inheritable_templates.git
```
Now yo... |
32649277 | The working copy '<Project Name>' failed to commit files - Couldnt communicate with helper application | 39 | 2015-09-18 10:03:19 | <p>I've just updated to Xcode 7 general release and ive tried committing files. Its failing however, and im getting the following message;</p>
<p><a href="https://i.sstatic.net/4xYz1.png" rel="noreferrer"><img src="https://i.sstatic.net/4xYz1.png" alt="enter image description here"></a></p>
<p>Ive seen this question ... | 15,462 | 2,654,425 | 2024-01-21 20:04:26 | 32,712,668 | 79 | 2015-09-22 08:57:21 | 809,821 | 2015-09-22 08:57:21 | https://stackoverflow.com/q/32649277 | https://stackoverflow.com/a/32712668 | <p>Turns out the “helper application” is in fact Git. For some reason Xcode 7 is eager to associate you (the committer) with a name and an email address. </p>
<p>To fix it, on the command line, type the following:</p>
<pre><code>xcrun git config --global user.email you@yourdomain.com
xcrun git config --global user.na... | <p>Turns out the “helper application” is in fact Git. For some reason Xcode 7 is eager to associate you (the committer) with a name and an email address. </p> <p>To fix it, on the command line, type the following:</p> <pre><code>xcrun git config --global user.email you@yourdomain.com xcrun git config --global user.na... | 119, 908, 5597, 112538 | commit, git, xcode, xcode7 | <h1>The working copy '<Project Name>' failed to commit files - Couldnt communicate with helper application</h1>
<p>I've just updated to Xcode 7 general release and ive tried committing files. Its failing however, and im getting the following message;</p>
<p><a href="https://i.sstatic.net/4xYz1.png" rel="noreferrer"><i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,407 | git | # The working copy '' failed to commit files - Couldnt communicate with helper application
I've just updated to Xcode 7 general release and ive tried committing files. Its failing however, and im getting the following message;
[](https://i.sstatic.net/4x... | Turns out the “helper application” is in fact Git. For some reason Xcode 7 is eager to associate you (the committer) with a name and an email address.
To fix it, on the command line, type the following:
```
xcrun git config --global user.email you@yourdomain.com
xcrun git config --global user.name "Your Name Here"
``... |
52761305 | How can I undo my last commit in Git and stash those changes instead? | 34 | 2018-10-11 13:29:13 | <p>I have a branch called <code>feat-a</code> and I essentially want to "undo" my last local commit and just have those files staged. Then when they are all staged I want to stash those changes.</p>
<p>Now what I'm doing does sound a bit backwards, but the cause of this issue was a force push on master to re-write som... | 35,507 | 1,048,909 | 2018-10-11 13:30:39 | 52,761,334 | 79 | 2018-10-11 13:30:31 | 2,437,508 | 2018-10-11 13:30:31 | https://stackoverflow.com/q/52761305 | https://stackoverflow.com/a/52761334 | <pre><code>git reset --soft HEAD~1
git stash save "Saving instead" # or something like that
</code></pre>
| <pre><code>git reset --soft HEAD~1 git stash save "Saving instead" # or something like that </code></pre> | 119 | git | <h1>How can I undo my last commit in Git and stash those changes instead?</h1>
<p>I have a branch called <code>feat-a</code> and I essentially want to "undo" my last local commit and just have those files staged. Then when they are all staged I want to stash those changes.</p>
<p>Now what I'm doing does sound a bit ba... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,408 | git | # How can I undo my last commit in Git and stash those changes instead?
I have a branch called `feat-a` and I essentially want to "undo" my last local commit and just have those files staged. Then when they are all staged I want to stash those changes.
Now what I'm doing does sound a bit backwards, but the cause of t... | ```
git reset --soft HEAD~1
git stash save "Saving instead" # or something like that
``` |
15232000 | Git - Ignore files during merge | 210 | 2013-03-05 19:04:14 | <p>I have a repo called <code>myrepo</code> on the remote <code>beanstalk</code> server.</p>
<p>I cloned it to my local machine. Created two additional branches: <code>staging</code> and <code>dev</code>.
Pushed these branches to remote as well.</p>
<p>Now:</p>
<pre><code> local remote ... | 238,708 | 668,650 | 2025-01-10 11:09:48 | 15,233,458 | 78 | 2013-03-05 20:29:38 | 668,650 | 2018-07-21 09:53:53 | https://stackoverflow.com/q/15232000 | https://stackoverflow.com/a/15233458 | <p>I ended up finding git <code>attributes</code>. Trying it. Working so far. Did not check all scenarios yet. But it should be the solution.</p>
<p><a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies" rel="noreferrer" title="Merge Strategies - Git attributes">Merge Strategies - Gi... | <p>I ended up finding git <code>attributes</code>. Trying it. Working so far. Did not check all scenarios yet. But it should be the solution.</p> <p><a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies" rel="noreferrer" title="Merge Strategies - Git attributes">Merge Strategies - Gi... | 119, 717, 4236, 4333, 7330 | git, ignore, merge, push, repository | <h1>Git - Ignore files during merge</h1>
<p>I have a repo called <code>myrepo</code> on the remote <code>beanstalk</code> server.</p>
<p>I cloned it to my local machine. Created two additional branches: <code>staging</code> and <code>dev</code>.
Pushed these branches to remote as well.</p>
<p>Now:</p>
<pre><code> local... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,410 | git | # Git - Ignore files during merge
I have a repo called `myrepo` on the remote `beanstalk` server.
I cloned it to my local machine. Created two additional branches: `staging` and `dev`.
Pushed these branches to remote as well.
Now:
```
local remote server
-----------------------... | I ended up finding git `attributes`. Trying it. Working so far. Did not check all scenarios yet. But it should be the solution.
[Merge Strategies - Git attributes](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies "Merge Strategies - Git attributes") |
10345182 | How to log first 10 commits in Git | 185 | 2012-04-27 05:25:49 | <p>Two questions:</p>
<ol>
<li>How to show the first 10 commit in git from beginning to end. (no branch)</li>
<li>How the specify the commit index and log it. (show the second or third)</li>
</ol>
<p>I know that git use parent to link the commit, it's easy to log the commit from end to start.
like: <code>git log HEAD... | 146,520 | 818,818 | 2024-09-12 21:56:06 | 10,346,226 | 78 | 2012-04-27 07:04:45 | 11,343 | 2012-04-27 07:04:45 | https://stackoverflow.com/q/10345182 | https://stackoverflow.com/a/10346226 | <p>Simply log everything with one line format and tail the output:</p>
<pre><code>git log --pretty=oneline | tail -n 10
</code></pre>
| <p>Simply log everything with one line format and tail the output:</p> <pre><code>git log --pretty=oneline | tail -n 10 </code></pre> | 119, 942, 47913 | git, git-log, logging | <h1>How to log first 10 commits in Git</h1>
<p>Two questions:</p>
<ol>
<li>How to show the first 10 commit in git from beginning to end. (no branch)</li>
<li>How the specify the commit index and log it. (show the second or third)</li>
</ol>
<p>I know that git use parent to link the commit, it's easy to log the commit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,411 | git | # How to log first 10 commits in Git
Two questions:
1. How to show the first 10 commit in git from beginning to end. (no branch)
2. How the specify the commit index and log it. (show the second or third)
I know that git use parent to link the commit, it's easy to log the commit from end to start.
like: `git log HEAD... | Simply log everything with one line format and tail the output:
```
git log --pretty=oneline | tail -n 10
``` |
238260 | How to calculate the bounding box for a given lat/lng location? | 128 | 2008-10-26 17:00:07 | <p>I have given a location defined by latitude and longitude.
Now i want to calculate a bounding box within e.g. 10 kilometers of that point.</p>
<p>The bounding box should be defined as latmin, lngmin and latmax, lngmax.</p>
<p>I need this stuff in order to use the <a href="http://www.panoramio.com/api/" rel="norefe... | 146,247 | 21,672 | 2023-12-10 17:39:19 | 238,558 | 78 | 2008-10-26 20:21:09 | 18,770 | 2016-03-14 17:18:59 | https://stackoverflow.com/q/238260 | https://stackoverflow.com/a/238558 | <p>I suggest to approximate locally the Earth surface as a sphere with radius given by the WGS84 ellipsoid at the given latitude. I suspect that the exact computation of latMin and latMax would require elliptic functions and would not yield an appreciable increase in accuracy (WGS84 is itself an approximation).</p>
<p... | <p>I suggest to approximate locally the Earth surface as a sphere with radius given by the WGS84 ellipsoid at the given latitude. I suspect that the exact computation of latMin and latMax would require elliptic functions and would not yield an appreciable increase in accuracy (WGS84 is itself an approximation).</p> <p... | 2965, 14004, 20301 | geocoding, latitude-longitude, panoramio | <h1>How to calculate the bounding box for a given lat/lng location?</h1>
<p>I have given a location defined by latitude and longitude.
Now i want to calculate a bounding box within e.g. 10 kilometers of that point.</p>
<p>The bounding box should be defined as latmin, lngmin and latmax, lngmax.</p>
<p>I need this stuf... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,413 | git | # How to calculate the bounding box for a given lat/lng location?
I have given a location defined by latitude and longitude.
Now i want to calculate a bounding box within e.g. 10 kilometers of that point.
The bounding box should be defined as latmin, lngmin and latmax, lngmax.
I need this stuff in order to use the [... | I suggest to approximate locally the Earth surface as a sphere with radius given by the WGS84 ellipsoid at the given latitude. I suspect that the exact computation of latMin and latMax would require elliptic functions and would not yield an appreciable increase in accuracy (WGS84 is itself an approximation).
My implem... |
31579670 | change xcrun developer path for Android Studio/IntelliJ | 67 | 2015-07-23 06:27:57 | <p>I'm using <strong>GIT</strong> and am trying to push my code and getting the following error when using the <strong><em>Terminal</em></strong>. I don't use <strong>XCode</strong>, I'm using <strong><em>Android Studio</em></strong>.</p>
<p>The command I tried using was: </p>
<blockquote>
<p>git branch Networking<... | 22,383 | 4,578,531 | 2019-10-11 10:58:18 | 33,386,397 | 78 | 2015-10-28 08:44:33 | 1,752,193 | 2015-10-28 08:44:33 | https://stackoverflow.com/q/31579670 | https://stackoverflow.com/a/33386397 | <p>Instead of installing xcode you can install git from <a href="http://git-scm.com/download/mac">here</a> and change the path in android studio to <code>/usr/local/git/bin/git</code> as shown in the image below. </p>
<p><a href="https://i.sstatic.net/Re4cH.png"><img src="https://i.sstatic.net/Re4cH.png" alt="studio p... | <p>Instead of installing xcode you can install git from <a href="http://git-scm.com/download/mac">here</a> and change the path in android studio to <code>/usr/local/git/bin/git</code> as shown in the image below. </p> <p><a href="https://i.sstatic.net/Re4cH.png"><img src="https://i.sstatic.net/Re4cH.png" alt="studio p... | 119, 8945, 79831, 91905, 112573 | android-studio, git, intellij-idea, osx-elcapitan, xcrun | <h1>change xcrun developer path for Android Studio/IntelliJ</h1>
<p>I'm using <strong>GIT</strong> and am trying to push my code and getting the following error when using the <strong><em>Terminal</em></strong>. I don't use <strong>XCode</strong>, I'm using <strong><em>Android Studio</em></strong>.</p>
<p>The command ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,417 | git | # change xcrun developer path for Android Studio/IntelliJ
I'm using **GIT** and am trying to push my code and getting the following error when using the ***Terminal***. I don't use **XCode**, I'm using ***Android Studio***.
The command I tried using was:
> git branch Networking
Error:
> xcrun: error: invalid activ... | Instead of installing xcode you can install git from [here](http://git-scm.com/download/mac) and change the path in android studio to `/usr/local/git/bin/git` as shown in the image below.
[](https://i.sstatic.net/Re4cH.png)
This way you save time and memory. |
36839838 | gitignore does not ignore .idea directory | 61 | 2016-04-25 11:55:13 | <p>Working on a Symfony2 project using PhpStorm IDE, I have added couple of files to git ignore but one file despite being added to git ignore is always appearing. I have tried multiple times but its always there</p>
<p><code>.gitignore</code> file:</p>
<pre><code>/app/config/parameters.yml
/bin/
/build/
/composer.phar... | 77,787 | 5,127,919 | 2024-04-03 13:29:11 | 36,839,990 | 78 | 2016-04-25 12:01:29 | 589,329 | 2016-04-25 12:01:29 | https://stackoverflow.com/q/36839838 | https://stackoverflow.com/a/36839990 | <p>Git never ignores changes to tracked files. As it appears as modified, the file is under version control (the idea/workspace.xml file usually should not be) and thus changes to it are tracked. Delete it from the index, leaving your local copy intact with <code>git rm --cached .idea/workspace.xml</code> and commit th... | <p>Git never ignores changes to tracked files. As it appears as modified, the file is under version control (the idea/workspace.xml file usually should not be) and thus changes to it are tracked. Delete it from the index, leaving your local copy intact with <code>git rm --cached .idea/workspace.xml</code> and commit th... | 119, 25056 | git, gitignore | <h1>gitignore does not ignore .idea directory</h1>
<p>Working on a Symfony2 project using PhpStorm IDE, I have added couple of files to git ignore but one file despite being added to git ignore is always appearing. I have tried multiple times but its always there</p>
<p><code>.gitignore</code> file:</p>
<pre><code>/app... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,418 | git | # gitignore does not ignore .idea directory
Working on a Symfony2 project using PhpStorm IDE, I have added couple of files to git ignore but one file despite being added to git ignore is always appearing. I have tried multiple times but its always there
`.gitignore` file:
```
/app/config/parameters.yml
/bin/
/build/... | Git never ignores changes to tracked files. As it appears as modified, the file is under version control (the idea/workspace.xml file usually should not be) and thus changes to it are tracked. Delete it from the index, leaving your local copy intact with `git rm --cached .idea/workspace.xml` and commit this change. Fro... |
2460558 | Creating a patch file from a diff of 2 folders | 59 | 2010-03-17 07:44:38 | <p>I made some changes to an open source project without taking time to create proper patch files.</p>
<p>Now, the maintainer of the project released a new version, and among new and edited files, there are a bunch of renamed files.</p>
<p>What is the best way to apply my changes to the new version ?<br />
I'm complete... | 62,889 | 57,569 | 2022-03-07 10:19:11 | 2,463,534 | 78 | 2010-03-17 15:27:11 | 140,750 | 2015-11-05 18:02:11 | https://stackoverflow.com/q/2460558 | https://stackoverflow.com/a/2463534 | <p>If you have two directories <code>a</code> and <code>b</code> that are similar, and you want <code>b</code> to be the same as <code>a</code>, you can create and apply a patch with:</p>
<pre><code>$ diff -ur b a > ba.diff
$ patch -i ba.diff
</code></pre>
<p>Suppose you have directories <code>local</code> (contai... | <p>If you have two directories <code>a</code> and <code>b</code> that are similar, and you want <code>b</code> to be the same as <code>a</code>, you can create and apply a patch with:</p> <pre><code>$ diff -ur b a > ba.diff $ patch -i ba.diff </code></pre> <p>Suppose you have directories <code>local</code> (contai... | 119, 606, 2132 | diff, git, patch | <h1>Creating a patch file from a diff of 2 folders</h1>
<p>I made some changes to an open source project without taking time to create proper patch files.</p>
<p>Now, the maintainer of the project released a new version, and among new and edited files, there are a bunch of renamed files.</p>
<p>What is the best way to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,419 | git | # Creating a patch file from a diff of 2 folders
I made some changes to an open source project without taking time to create proper patch files.
Now, the maintainer of the project released a new version, and among new and edited files, there are a bunch of renamed files.
What is the best way to apply my changes to t... | If you have two directories `a` and `b` that are similar, and you want `b` to be the same as `a`, you can create and apply a patch with:
```
$ diff -ur b a > ba.diff
$ patch -i ba.diff
```
Suppose you have directories `local` (containing your local version of upstream1.0), `upstream1.0`, and `upstream1.1`. To create ... |
42584934 | Where is my remote git repository password stored on the local machine? | 55 | 2017-03-03 17:20:16 | <p>I have a git repository set up on bitbucket</p>
<pre><code>$ git remote -v
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (fetch)
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (push)
</code></pre>
<p>I pull and push to the repository from my office workstati... | 152,837 | 5,093,536 | 2022-01-28 15:41:12 | 42,595,596 | 78 | 2017-03-04 11:42:54 | 5,093,536 | 2017-03-04 11:42:54 | https://stackoverflow.com/q/42584934 | https://stackoverflow.com/a/42595596 | <p>if <code>$ git config credential.helper</code> returns <code>manager</code>, the password is stored in the windows credential manager, if it returns <code>store</code>, password is stored in a <code>.git-credentials</code> file in the user folder.</p>
| <p>if <code>$ git config credential.helper</code> returns <code>manager</code>, the password is stored in the windows credential manager, if it returns <code>store</code>, password is stored in a <code>.git-credentials</code> file in the user folder.</p> | 119, 5357, 101666 | credential-manager, credentials, git | <h1>Where is my remote git repository password stored on the local machine?</h1>
<p>I have a git repository set up on bitbucket</p>
<pre><code>$ git remote -v
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (fetch)
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,420 | git | # Where is my remote git repository password stored on the local machine?
I have a git repository set up on bitbucket
```
$ git remote -v
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (fetch)
origin https://myusername@bitbucket.org/myusername/my_repository_name.git (push)
```
I pull and... | if `$ git config credential.helper` returns `manager`, the password is stored in the windows credential manager, if it returns `store`, password is stored in a `.git-credentials` file in the user folder. |
4949652 | git checkout: what does this weird output mean? | 55 | 2011-02-09 19:43:08 | <p>When I checkout, I get:</p>
<pre><code>me@localhost# git checkout master
D deps/example
M deps/example2
Switched to branch "master"
</code></pre>
<p>The man page doesn't mention this cryptic output. What does it mean?</p>
| 33,349 | 610,314 | 2011-02-09 19:46:39 | 4,949,690 | 78 | 2011-02-09 19:46:39 | 229,044 | 2011-02-09 19:46:39 | https://stackoverflow.com/q/4949652 | https://stackoverflow.com/a/4949690 | <p>That's the output of <code>git status</code>; git is showing you that after checking out <code>master</code> there are still uncommited changes to your working copy (one modified file and one deleted file).</p>
<p>Check <code>man git-status</code>:</p>
<pre><code>M = modified
A = added
D = deleted
R = renamed
C = ... | <p>That's the output of <code>git status</code>; git is showing you that after checking out <code>master</code> there are still uncommited changes to your working copy (one modified file and one deleted file).</p> <p>Check <code>man git-status</code>:</p> <pre><code>M = modified A = added D = deleted R = renamed C = ... | 119 | git | <h1>git checkout: what does this weird output mean?</h1>
<p>When I checkout, I get:</p>
<pre><code>me@localhost# git checkout master
D deps/example
M deps/example2
Switched to branch "master"
</code></pre>
<p>The man page doesn't mention this cryptic output. What does it mean?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,421 | git | # git checkout: what does this weird output mean?
When I checkout, I get:
```
me@localhost# git checkout master
D deps/example
M deps/example2
Switched to branch "master"
```
The man page doesn't mention this cryptic output. What does it mean? | That's the output of `git status`; git is showing you that after checking out `master` there are still uncommited changes to your working copy (one modified file and one deleted file).
Check `man git-status`:
```
M = modified
A = added
D = deleted
R = renamed
C = copied
U = updated but unmerged
``` |
9072792 | Unmerge a git branch, keeping post-merge commits | 40 | 2012-01-31 00:24:20 | <p>Say there are two branches <code>master</code> and <code>branchA</code>. </p>
<p>I work on <code>master</code>, a friend on <code>branchA</code>.
Once things are finalized, we merge <code>branchA</code> with <code>master</code>. </p>
<p>After several commits on the merged <code>master</code>, the client wants the... | 31,756 | 648,866 | 2018-10-10 13:31:26 | 9,072,988 | 78 | 2012-01-31 00:48:49 | 265,575 | 2018-10-10 13:31:26 | https://stackoverflow.com/q/9072792 | https://stackoverflow.com/a/9072988 | <p>Read through <a href="https://web.archive.org/web/20120411131029/http://progit.org/2010/03/02/undoing-merges.html" rel="noreferrer">Pro Git - Undoing Merges</a>.</p>
<p>Basically, you <code>git revert</code> the merge commit:</p>
<pre><code>git revert -m 1 hash_of_merge_commit
</code></pre>
<p>You may end up with... | <p>Read through <a href="https://web.archive.org/web/20120411131029/http://progit.org/2010/03/02/undoing-merges.html" rel="noreferrer">Pro Git - Undoing Merges</a>.</p> <p>Basically, you <code>git revert</code> the merge commit:</p> <pre><code>git revert -m 1 hash_of_merge_commit </code></pre> <p>You may end up with... | 119, 28897 | git, git-merge | <h1>Unmerge a git branch, keeping post-merge commits</h1>
<p>Say there are two branches <code>master</code> and <code>branchA</code>. </p>
<p>I work on <code>master</code>, a friend on <code>branchA</code>.
Once things are finalized, we merge <code>branchA</code> with <code>master</code>. </p>
<p>After several commi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,424 | git | # Unmerge a git branch, keeping post-merge commits
Say there are two branches `master` and `branchA`.
I work on `master`, a friend on `branchA`.
Once things are finalized, we merge `branchA` with `master`.
After several commits on the merged `master`, the client wants the
work done on `branchA` removed, but **NOT th... | Read through [Pro Git - Undoing Merges](https://web.archive.org/web/20120411131029/http://progit.org/2010/03/02/undoing-merges.html).
Basically, you `git revert` the merge commit:
```
git revert -m 1 hash_of_merge_commit
```
You may end up with some conflicts that you'll have to manually unmerge, just like when merg... |
2570899 | Does `git` name only as "origin" any remote upon cloning? | 35 | 2010-04-03 10:11:56 | <p>Does Git only use the remote name "origin" for a repository which was created by cloning?</p>
<p>For example, say I create a repository, placed it on a remote, and try to clone it again into the same directory, which one would Git name origin?</p>
| 19,710 | 172,406 | 2021-03-27 13:38:05 | 2,570,916 | 78 | 2010-04-03 10:17:41 | 6,309 | 2020-11-01 01:05:23 | https://stackoverflow.com/q/2570899 | https://stackoverflow.com/a/2570916 | <p>2010: <code>origin</code> is the default name used by <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a>, but you can use any other name when cloning:</p>
<pre><code>--origin <name>
-o <name>
</code></pre>
<blockquote>
<p>Instead of using the remote name <code>origin<... | <p>2010: <code>origin</code> is the default name used by <a href="http://git-scm.com/docs/git-clone" rel="noreferrer"><code>git clone</code></a>, but you can use any other name when cloning:</p> <pre><code>--origin <name> -o <name> </code></pre> <blockquote> <p>Instead of using the remote name <code>origin<... | 119 | git | <h1>Does `git` name only as "origin" any remote upon cloning?</h1>
<p>Does Git only use the remote name "origin" for a repository which was created by cloning?</p>
<p>For example, say I create a repository, placed it on a remote, and try to clone it again into the same directory, which one would Git name origin?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,425 | git | # Does `git` name only as "origin" any remote upon cloning?
Does Git only use the remote name "origin" for a repository which was created by cloning?
For example, say I create a repository, placed it on a remote, and try to clone it again into the same directory, which one would Git name origin? | 2010: `origin` is the default name used by [`git clone`](http://git-scm.com/docs/git-clone), but you can use any other name when cloning:
```
--origin <name>
-o <name>
```
> Instead of using the remote name `origin` to keep track of the upstream repository, use `<name>`.
If you don't, any time you clone a repo, that... |
5787937 | Git status shows files as changed even though contents are the same | 372 | 2011-04-26 08:43:48 | <p>I received a Git checkout from someone else and am trying to commit the unstaged changes to the local repository. However, a <em>lot</em> (if not every) file appears as <em>modified</em> even though the contents are exactly the same.</p>
<p>I already set <code>core.fileMode</code> to false and also set <code>core.au... | 384,481 | 11,568 | 2025-08-27 22:07:44 | 5,788,054 | 77 | 2011-04-26 08:54:13 | 85,371 | 2016-05-09 07:43:36 | https://stackoverflow.com/q/5787937 | https://stackoverflow.com/a/5788054 | <p><strong>Update: as per the comment on this question, the problem has been solved:</strong></p>
<blockquote>
<p>That is easy: the first file has CRLF line-ends (windows), the second
LF (Unix). The <code>file</code> util (available in git\usr\bin) will show you that (<code>file a b</code> will reply
something l... | <p><strong>Update: as per the comment on this question, the problem has been solved:</strong></p> <blockquote> <p>That is easy: the first file has CRLF line-ends (windows), the second LF (Unix). The <code>file</code> util (available in git\usr\bin) will show you that (<code>file a b</code> will reply something l... | 119 | git | <h1>Git status shows files as changed even though contents are the same</h1>
<p>I received a Git checkout from someone else and am trying to commit the unstaged changes to the local repository. However, a <em>lot</em> (if not every) file appears as <em>modified</em> even though the contents are exactly the same.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,427 | git | # Git status shows files as changed even though contents are the same
I received a Git checkout from someone else and am trying to commit the unstaged changes to the local repository. However, a *lot* (if not every) file appears as *modified* even though the contents are exactly the same.
I already set `core.fileMode... | **Update: as per the comment on this question, the problem has been solved:**
> That is easy: the first file has CRLF line-ends (windows), the second
> LF (Unix). The `file` util (available in git\usr\bin) will show you that (`file a b` will reply
> something like `a: ASCII text, with CRLF line terminators b: ASCII
> ... |
1634161 | How do I use Notepad++ (or other) with msysgit? | 213 | 2009-10-27 22:59:28 | <p>How do I use Notepad++ (or any other editor besides vim) with msysgit?</p>
<p>I tried all of the following to no avail:</p>
<pre><code>git config --global core.editor C:\Program Files\Notepad++\notepad++.exe
git config --global core.editor "C:\Program Files\Notepad++\notepad++.exe"
git config --global core.edito... | 104,702 | 27,025 | 2022-03-16 18:34:39 | 1,635,493 | 77 | 2009-10-28 06:28:28 | 6,309 | 2022-03-16 18:34:39 | https://stackoverflow.com/q/1634161 | https://stackoverflow.com/a/1635493 | <p>Update 2010-2011:</p>
<p><a href="https://stackoverflow.com/users/75129/zumalifeguard">zumalifeguard</a>'s <a href="https://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit/2486342#2486342">solution</a> (upvoted) is simpler than the original one, as it no longer needs a shell wrapper sc... | <p>Update 2010-2011:</p> <p><a href="https://stackoverflow.com/users/75129/zumalifeguard">zumalifeguard</a>'s <a href="https://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit/2486342#2486342">solution</a> (upvoted) is simpler than the original one, as it no longer needs a shell wrapper sc... | 119, 725, 4893, 8193, 21628 | configuration, git, msysgit, notepad++, text-editor | <h1>How do I use Notepad++ (or other) with msysgit?</h1>
<p>How do I use Notepad++ (or any other editor besides vim) with msysgit?</p>
<p>I tried all of the following to no avail:</p>
<pre><code>git config --global core.editor C:\Program Files\Notepad++\notepad++.exe
git config --global core.editor "C:\Program Files... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,428 | git | # How do I use Notepad++ (or other) with msysgit?
How do I use Notepad++ (or any other editor besides vim) with msysgit?
I tried all of the following to no avail:
```
git config --global core.editor C:\Program Files\Notepad++\notepad++.exe
git config --global core.editor "C:\Program Files\Notepad++\notepad++.exe"
... | Update 2010-2011:
[zumalifeguard](https://stackoverflow.com/users/75129/zumalifeguard)'s [solution](https://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit/2486342#2486342) (upvoted) is simpler than the original one, as it no longer needs a shell wrapper script.
As I explain in "[How ca... |
3973994 | How can I recover from an erronous git push -f origin master? | 151 | 2010-10-20 00:54:59 | <p>I just committed the wrong source to my project using <code>--force</code> option.</p>
<p>Is it possible to revert? I understand that all previous branches have been overwritten using <code>-f</code> option, so I may have screwed up my previous revisions.</p>
| 162,611 | 297,201 | 2024-09-24 15:28:28 | 3,974,056 | 77 | 2010-10-20 01:11:45 | 474,283 | 2016-11-25 17:45:04 | https://stackoverflow.com/q/3973994 | https://stackoverflow.com/a/3974056 | <p>Git generally doesn't throw anything away, but recovering from this may still be tricky.</p>
<p>If you have the correct source then you could just push it into the remote with the <code>--force</code> option. Git won't have deleted any branches unless you told it to. If you have actually lost commits then take a lo... | <p>Git generally doesn't throw anything away, but recovering from this may still be tricky.</p> <p>If you have the correct source then you could just push it into the remote with the <code>--force</code> option. Git won't have deleted any branches unless you told it to. If you have actually lost commits then take a lo... | 119, 28898, 53850 | git, git-commit, git-push | <h1>How can I recover from an erronous git push -f origin master?</h1>
<p>I just committed the wrong source to my project using <code>--force</code> option.</p>
<p>Is it possible to revert? I understand that all previous branches have been overwritten using <code>-f</code> option, so I may have screwed up my previous ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,429 | git | # How can I recover from an erronous git push -f origin master?
I just committed the wrong source to my project using `--force` option.
Is it possible to revert? I understand that all previous branches have been overwritten using `-f` option, so I may have screwed up my previous revisions. | Git generally doesn't throw anything away, but recovering from this may still be tricky.
If you have the correct source then you could just push it into the remote with the `--force` option. Git won't have deleted any branches unless you told it to. If you have actually lost commits then take a look at [this useful gu... |
233421 | Hosting Git Repository in Windows | 113 | 2008-10-24 12:57:56 | <p>Is there currently a way to host a shared Git repository in Windows? I understand that you can configure the Git service in Linux with:</p>
<pre><code>git daemon
</code></pre>
<p>Is there a native Windows option, short of sharing folders, to host a Git service?</p>
<p>EDIT:
I am currently using the cygwin instal... | 84,757 | 29,156 | 2017-03-01 20:34:32 | 2,275,844 | 77 | 2010-02-16 19:52:22 | 1,219,618 | 2017-03-01 20:34:32 | https://stackoverflow.com/q/233421 | https://stackoverflow.com/a/2275844 | <p>Here are some steps you can follow to get the git daemon running under Windows:</p>
<p><em>(Prerequisites: A default Cygwin installation and a git client that supports git daemon)</em></p>
<p><strong>Step 1</strong>: Open a bash shell</p>
<p><strong>Step 2</strong>: In the directory /cygdrive/c/cygwin64/usr/local... | <p>Here are some steps you can follow to get the git daemon running under Windows:</p> <p><em>(Prerequisites: A default Cygwin installation and a git client that supports git daemon)</em></p> <p><strong>Step 1</strong>: Open a bash shell</p> <p><strong>Step 2</strong>: In the directory /cygdrive/c/cygwin64/usr/local... | 64, 119 | git, windows | <h1>Hosting Git Repository in Windows</h1>
<p>Is there currently a way to host a shared Git repository in Windows? I understand that you can configure the Git service in Linux with:</p>
<pre><code>git daemon
</code></pre>
<p>Is there a native Windows option, short of sharing folders, to host a Git service?</p>
<p>E... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,430 | git | # Hosting Git Repository in Windows
Is there currently a way to host a shared Git repository in Windows? I understand that you can configure the Git service in Linux with:
```
git daemon
```
Is there a native Windows option, short of sharing folders, to host a Git service?
EDIT:
I am currently using the cygwin inst... | Here are some steps you can follow to get the git daemon running under Windows:
*(Prerequisites: A default Cygwin installation and a git client that supports git daemon)*
**Step 1**: Open a bash shell
**Step 2**: In the directory /cygdrive/c/cygwin64/usr/local/bin/, create a file named "gitd" with the following cont... |
8481488 | Is git not case sensitive? | 111 | 2011-12-12 22:00:25 | <p>In the first commitment of my partial called <code>_Electronics</code> it was written beginning with a capital letters, then I changed it to <code>_electronics</code>.</p>
<p>Git under cygwin ignored the case after commiting the new name, so I changed the name by hand in the target repo.</p>
<p>Now it sometimes ch... | 64,410 | 1,092,656 | 2022-05-03 11:18:30 | 8,481,559 | 77 | 2011-12-12 22:06:51 | 1,864,976 | 2013-07-23 19:40:06 | https://stackoverflow.com/q/8481488 | https://stackoverflow.com/a/8481559 | <p>It will be seen as 2 different things but will cause you issues on a non-case-sensitive system. If this is the case, ensure you are tab-completing any paths or file names. Further, to change the name of something in just the case, do this:</p>
<pre><code>mv file.txt temp.txt
git add -A
git commit -m "renaming..."
m... | <p>It will be seen as 2 different things but will cause you issues on a non-case-sensitive system. If this is the case, ensure you are tab-completing any paths or file names. Further, to change the name of something in just the case, do this:</p> <pre><code>mv file.txt temp.txt git add -A git commit -m "renaming..." m... | 119, 456, 9708 | case-sensitive, git, version-control | <h1>Is git not case sensitive?</h1>
<p>In the first commitment of my partial called <code>_Electronics</code> it was written beginning with a capital letters, then I changed it to <code>_electronics</code>.</p>
<p>Git under cygwin ignored the case after commiting the new name, so I changed the name by hand in the targ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,431 | git | # Is git not case sensitive?
In the first commitment of my partial called `_Electronics` it was written beginning with a capital letters, then I changed it to `_electronics`.
Git under cygwin ignored the case after commiting the new name, so I changed the name by hand in the target repo.
Now it sometimes changes the... | It will be seen as 2 different things but will cause you issues on a non-case-sensitive system. If this is the case, ensure you are tab-completing any paths or file names. Further, to change the name of something in just the case, do this:
```
mv file.txt temp.txt
git add -A
git commit -m "renaming..."
mv temp.txt Fil... |
7550376 | How can sbt pull dependency artifacts from git? | 110 | 2011-09-26 03:24:54 | <p>I've heard (and I know I've seen examples too, if only I can remember where) that <code>sbt</code> can obtain dependencies from a git repo.</p>
<p>I am looking to obtain the dependency <a href="https://github.com/harrah/up" rel="noreferrer">harrah/up</a> from github. The repository does not provide any artifact JAR... | 34,023 | 371,739 | 2020-04-28 22:10:16 | 7,550,450 | 77 | 2011-09-26 03:40:45 | 500,314 | 2011-09-26 03:40:45 | https://stackoverflow.com/q/7550376 | https://stackoverflow.com/a/7550450 | <p>Yes indeed. You can give your <code>Project</code> a dependency with the <code>dependsOn</code> operator, and you can reference a Github project by its URI, for example <code>RootProject(uri("git://github.com/dragos/dupcheck.git"))</code>. Alternatively, you can <code>git clone</code> the project, and then reference... | <p>Yes indeed. You can give your <code>Project</code> a dependency with the <code>dependsOn</code> operator, and you can reference a Github project by its URI, for example <code>RootProject(uri("git://github.com/dragos/dupcheck.git"))</code>. Alternatively, you can <code>git clone</code> the project, and then reference... | 119, 3143, 5647, 41325, 60182 | build, build-dependencies, git, sbt, scala | <h1>How can sbt pull dependency artifacts from git?</h1>
<p>I've heard (and I know I've seen examples too, if only I can remember where) that <code>sbt</code> can obtain dependencies from a git repo.</p>
<p>I am looking to obtain the dependency <a href="https://github.com/harrah/up" rel="noreferrer">harrah/up</a> from... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,432 | git | # How can sbt pull dependency artifacts from git?
I've heard (and I know I've seen examples too, if only I can remember where) that `sbt` can obtain dependencies from a git repo.
I am looking to obtain the dependency [harrah/up](https://github.com/harrah/up) from github. The repository does not provide any artifact J... | Yes indeed. You can give your `Project` a dependency with the `dependsOn` operator, and you can reference a Github project by its URI, for example `RootProject(uri("git://github.com/dragos/dupcheck.git"))`. Alternatively, you can `git clone` the project, and then reference your local copy with `RootProject(file(...))`.... |
12938972 | What does ^{} mean in git? | 89 | 2012-10-17 16:30:27 | <p>I stumbled upon two odd characters at the end of a git ls-remote command and I wonder what this means?</p>
<pre><code>0e4c39557ccb6789173c refs/tags/2011-11-04
966f8df553f18c486820 refs/tags/2011-11-04^{}
</code></pre>
<p>Do you happen to know what this ^{} means? Also, why does this git tag seems duplicated?</p... | 12,852 | 1,113,341 | 2019-04-19 07:25:00 | 12,939,216 | 77 | 2012-10-17 16:44:58 | 526,535 | 2019-04-19 07:25:00 | https://stackoverflow.com/q/12938972 | https://stackoverflow.com/a/12939216 | <p>The <code>^{}</code> notation is explained in the <a href="http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html" rel="noreferrer"><code>gitrevisions</code></a> manual:</p>
<pre><code><rev>^{}, e.g. v0.99.8^{}
</code></pre>
<blockquote>
<p>A suffix ^ followed by an empty brace pair means the o... | <p>The <code>^{}</code> notation is explained in the <a href="http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html" rel="noreferrer"><code>gitrevisions</code></a> manual:</p> <pre><code><rev>^{}, e.g. v0.99.8^{} </code></pre> <blockquote> <p>A suffix ^ followed by an empty brace pair means the o... | 119 | git | <h1>What does ^{} mean in git?</h1>
<p>I stumbled upon two odd characters at the end of a git ls-remote command and I wonder what this means?</p>
<pre><code>0e4c39557ccb6789173c refs/tags/2011-11-04
966f8df553f18c486820 refs/tags/2011-11-04^{}
</code></pre>
<p>Do you happen to know what this ^{} means? Also, why do... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,433 | git | # What does ^{} mean in git?
I stumbled upon two odd characters at the end of a git ls-remote command and I wonder what this means?
```
0e4c39557ccb6789173c refs/tags/2011-11-04
966f8df553f18c486820 refs/tags/2011-11-04^{}
```
Do you happen to know what this ^{} means? Also, why does this git tag seems duplicated? | The `^{}` notation is explained in the [`gitrevisions`](http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html) manual:
```
<rev>^{}, e.g. v0.99.8^{}
```
> A suffix ^ followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non-tag object is found.
In th... |
6031494 | Git submodules and ssh access | 84 | 2011-05-17 13:28:28 | <p>I have some trouble with a git repository that contains several submodules.</p>
<p>The super git repository was constructed with the commands</p>
<pre><code>mkdir projectname
cd projectname
git init
git submodule add ssh://myusername@server/pathtorepos
</code></pre>
<p>When a different user ("otheruser") then clo... | 140,215 | 185,475 | 2025-02-18 10:08:42 | 6,031,607 | 77 | 2011-05-17 13:36:20 | 223,092 | 2011-05-19 10:54:33 | https://stackoverflow.com/q/6031494 | https://stackoverflow.com/a/6031607 | <p>If possible, it's best to make sure that the <code>.gitmodules</code> file contains a URL for the repository that can be cloned by anyone, typically either a <code>git://</code> or <code>http://</code> URL. Then users that have SSH access themselves can change into the submodule after cloning and change the URL in ... | <p>If possible, it's best to make sure that the <code>.gitmodules</code> file contains a URL for the repository that can be cloned by anyone, typically either a <code>git://</code> or <code>http://</code> URL. Then users that have SSH access themselves can change into the submodule after cloning and change the URL in ... | 119, 386, 41612 | git, git-submodules, ssh | <h1>Git submodules and ssh access</h1>
<p>I have some trouble with a git repository that contains several submodules.</p>
<p>The super git repository was constructed with the commands</p>
<pre><code>mkdir projectname
cd projectname
git init
git submodule add ssh://myusername@server/pathtorepos
</code></pre>
<p>When ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,434 | git | # Git submodules and ssh access
I have some trouble with a git repository that contains several submodules.
The super git repository was constructed with the commands
```
mkdir projectname
cd projectname
git init
git submodule add ssh://myusername@server/pathtorepos
```
When a different user ("otheruser") then clon... | If possible, it's best to make sure that the `.gitmodules` file contains a URL for the repository that can be cloned by anyone, typically either a `git://` or `http://` URL. Then users that have SSH access themselves can change into the submodule after cloning and change the URL in `remote.origin.url` to point to an SS... |
14142609 | Git: discover which commits ever touched a range of lines | 72 | 2013-01-03 16:07:50 | <p>I'm having trouble figuring out how to use <code>git blame</code> for getting the set of commits that <em>ever</em> touched a given range of lines. There are similar questions like <a href="https://stackoverflow.com/questions/5098256/git-blame-prior-commits">this one</a> but the accepted answer doesn't bring me much... | 15,298 | 177,259 | 2016-12-17 00:28:58 | 19,757,441 | 77 | 2013-11-03 20:03:03 | 168,740 | 2016-12-17 00:28:58 | https://stackoverflow.com/q/14142609 | https://stackoverflow.com/a/19757441 | <p><a href="https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210" rel="noreferrer">Since Git 1.8.4</a>, <code>git log</code> has <a href="https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210" rel="noreferrer"><code>-L</code></a> to view the evolution of a range of lines.<... | <p><a href="https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210" rel="noreferrer">Since Git 1.8.4</a>, <code>git log</code> has <a href="https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210" rel="noreferrer"><code>-L</code></a> to view the evolution of a range of lines.<... | 119, 21455 | blame, git | <h1>Git: discover which commits ever touched a range of lines</h1>
<p>I'm having trouble figuring out how to use <code>git blame</code> for getting the set of commits that <em>ever</em> touched a given range of lines. There are similar questions like <a href="https://stackoverflow.com/questions/5098256/git-blame-prior-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,435 | git | # Git: discover which commits ever touched a range of lines
I'm having trouble figuring out how to use `git blame` for getting the set of commits that *ever* touched a given range of lines. There are similar questions like [this one](https://stackoverflow.com/questions/5098256/git-blame-prior-commits) but the accepted... | [Since Git 1.8.4](https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210), `git log` has [`-L`](https://github.com/git/git/blob/v1.8.4/Documentation/RelNotes/1.8.4.txt#L210) to view the evolution of a range of lines.
For example, suppose you look at `git blame`'s output:
```
((aa27064...))[mlm@m... |
3743999 | Write git commit message before 'git commit' | 72 | 2010-09-19 00:01:24 | <p>I'm learning Git coming from Perforce.</p>
<p>As far as I can tell you must write the commit message in the same step as when you commit. Or am I missing how I might write the message earlier and have it hang around until I'm ready to commit.</p>
<p>I really liked the workflow in perforce where you can edit the c... | 12,447 | 32,840 | 2020-06-26 07:06:33 | 3,744,070 | 77 | 2010-09-19 00:33:45 | 41,116 | 2010-09-19 01:02:05 | https://stackoverflow.com/q/3743999 | https://stackoverflow.com/a/3744070 | <p>Have a look at the <code>-t <file></code> flag with <code>git commit</code></p>
<p>This lets you specify a file to use as the basis for the commit message. The editor is still invoked but at least you can use a commit message which you create in advance.</p>
<p><strong>Alternatively</strong>, there is anothe... | <p>Have a look at the <code>-t <file></code> flag with <code>git commit</code></p> <p>This lets you specify a file to use as the basis for the commit message. The editor is still invoked but at least you can use a commit message which you create in advance.</p> <p><strong>Alternatively</strong>, there is anothe... | 119 | git | <h1>Write git commit message before 'git commit'</h1>
<p>I'm learning Git coming from Perforce.</p>
<p>As far as I can tell you must write the commit message in the same step as when you commit. Or am I missing how I might write the message earlier and have it hang around until I'm ready to commit.</p>
<p>I really l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,436 | git | # Write git commit message before 'git commit'
I'm learning Git coming from Perforce.
As far as I can tell you must write the commit message in the same step as when you commit. Or am I missing how I might write the message earlier and have it hang around until I'm ready to commit.
I really liked the workflow in per... | Have a look at the `-t <file>` flag with `git commit`
This lets you specify a file to use as the basis for the commit message. The editor is still invoked but at least you can use a commit message which you create in advance.
**Alternatively**, there is another workflow that you can use with git that might better sui... |
7866353 | git list all available commands | 60 | 2011-10-23 13:16:30 | <p>Is there command which can show me list of all available commands in GIT? There is <code>git help</code> but it shows:</p>
<pre><code>usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tr... | 31,654 | 725,400 | 2024-01-16 19:21:15 | 7,866,381 | 77 | 2011-10-23 13:21:46 | 19,563 | 2011-10-23 13:21:46 | https://stackoverflow.com/q/7866353 | https://stackoverflow.com/a/7866381 | <p>Try:</p>
<pre><code>git help -a
</code></pre>
<hr>
| <p>Try:</p> <pre><code>git help -a </code></pre> <hr> | 119, 549 | git, ubuntu | <h1>git list all available commands</h1>
<p>Is there command which can show me list of all available commands in GIT? There is <code>git help</code> but it shows:</p>
<pre><code>usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,437 | git | # git list all available commands
Is there command which can show me list of all available commands in GIT? There is `git help` but it shows:
```
usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree... | Try:
```
git help -a
```
--- |
13262465 | How do I squash commits in git with a commit date that is not in the past? | 58 | 2012-11-07 02:46:27 | <p>So, I have a very simple use case; I want to squash all the commits that need to go back into master from my 'todays working' branch.</p>
<p>Until now I've been using <code>git rebase -i</code> for this, but it doesn't work quite right; the timestamp on the final commit isn't right.</p>
<p>Here's an example of doi... | 15,373 | 353,820 | 2023-06-23 16:11:46 | 13,269,766 | 77 | 2012-11-07 12:25:39 | 575,982 | 2012-11-07 12:25:39 | https://stackoverflow.com/q/13262465 | https://stackoverflow.com/a/13269766 | <p>Hack: You can use</p>
<pre><code>git commit --amend --reset-author
</code></pre>
<p>The git commit man page says that this "also renews the author timestamp". You don't have to make any changes to the commit (I tried it locally), and it will update the timestamp to the current time. Definitely kind of an abuse, bu... | <p>Hack: You can use</p> <pre><code>git commit --amend --reset-author </code></pre> <p>The git commit man page says that this "also renews the author timestamp". You don't have to make any changes to the commit (I tried it locally), and it will update the timestamp to the current time. Definitely kind of an abuse, bu... | 119, 29934 | git, git-rebase | <h1>How do I squash commits in git with a commit date that is not in the past?</h1>
<p>So, I have a very simple use case; I want to squash all the commits that need to go back into master from my 'todays working' branch.</p>
<p>Until now I've been using <code>git rebase -i</code> for this, but it doesn't work quite ri... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,439 | git | # How do I squash commits in git with a commit date that is not in the past?
So, I have a very simple use case; I want to squash all the commits that need to go back into master from my 'todays working' branch.
Until now I've been using `git rebase -i` for this, but it doesn't work quite right; the timestamp on the f... | Hack: You can use
```
git commit --amend --reset-author
```
The git commit man page says that this "also renews the author timestamp". You don't have to make any changes to the commit (I tried it locally), and it will update the timestamp to the current time. Definitely kind of an abuse, but it seems to work. |
25937730 | Git Force push syntax, "-f" versus "+branch" | 50 | 2014-09-19 15:45:10 | <p>What is the difference between these two git commands when force pushing changes?</p>
<p><code>git push -f origin branch</code> and <code>git push origin +branch</code></p>
| 9,490 | 8,873 | 2019-03-20 17:11:30 | 25,937,833 | 77 | 2014-09-19 15:51:02 | 2,541,573 | 2019-03-20 17:11:30 | https://stackoverflow.com/q/25937730 | https://stackoverflow.com/a/25937833 | <h1>TL;DR</h1>
<p>If you're only pushing one branch, there is no difference.</p>
<pre><code>git push -f origin branch
</code></pre>
<p>and</p>
<pre><code>git push origin +branch
</code></pre>
<p>are exact equivalents. The difference arises when you're pushing <em>more than one</em> branch with a single <code>git p... | <h1>TL;DR</h1> <p>If you're only pushing one branch, there is no difference.</p> <pre><code>git push -f origin branch </code></pre> <p>and</p> <pre><code>git push origin +branch </code></pre> <p>are exact equivalents. The difference arises when you're pushing <em>more than one</em> branch with a single <code>git p... | 119 | git | <h1>Git Force push syntax, "-f" versus "+branch"</h1>
<p>What is the difference between these two git commands when force pushing changes?</p>
<p><code>git push -f origin branch</code> and <code>git push origin +branch</code></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,442 | git | # Git Force push syntax, "-f" versus "+branch"
What is the difference between these two git commands when force pushing changes?
`git push -f origin branch` and `git push origin +branch` | # TL;DR
If you're only pushing one branch, there is no difference.
```
git push -f origin branch
```
and
```
git push origin +branch
```
are exact equivalents. The difference arises when you're pushing *more than one* branch with a single `git push`.
In a nutshell, **the optional `+` gives you finer control than ... |
27810758 | How to replace crlf with lf in a single file | 49 | 2015-01-07 02:53:04 | <p>How do I convert a single file that has crlf line returns to have lf line returns?</p>
<p>git is already correctly handling crlf to lf conversion automatically for files when I push them to a remote repository, but in this particular case I am not doing a push to a repository. Rather, I am uploading a file, using a... | 129,455 | 3,483,036 | 2026-01-20 08:18:03 | 27,814,403 | 77 | 2015-01-07 07:27:34 | 974,186 | 2018-03-12 13:52:30 | https://stackoverflow.com/q/27810758 | https://stackoverflow.com/a/27814403 | <p>The git installation on windows usually includes the <a href="http://manpages.ubuntu.com/manpages/trusty/man1/dos2unix.1.html" rel="noreferrer"><code>dos2unix</code></a> tool.</p>
<pre><code>dos2unix <file>
</code></pre>
<p>But in your case you should use <a href="http://git-scm.com/docs/gitattributes" rel="... | <p>The git installation on windows usually includes the <a href="http://manpages.ubuntu.com/manpages/trusty/man1/dos2unix.1.html" rel="noreferrer"><code>dos2unix</code></a> tool.</p> <pre><code>dos2unix <file> </code></pre> <p>But in your case you should use <a href="http://git-scm.com/docs/gitattributes" rel="... | 64, 119 | git, windows | <h1>How to replace crlf with lf in a single file</h1>
<p>How do I convert a single file that has crlf line returns to have lf line returns?</p>
<p>git is already correctly handling crlf to lf conversion automatically for files when I push them to a remote repository, but in this particular case I am not doing a push t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,444 | git | # How to replace crlf with lf in a single file
How do I convert a single file that has crlf line returns to have lf line returns?
git is already correctly handling crlf to lf conversion automatically for files when I push them to a remote repository, but in this particular case I am not doing a push to a repository. ... | The git installation on windows usually includes the [`dos2unix`](http://manpages.ubuntu.com/manpages/trusty/man1/dos2unix.1.html) tool.
```
dos2unix <file>
```
But in your case you should use [`.gitattributes`](http://git-scm.com/docs/gitattributes) to prevent the file from being converted on windows.
A [`.gitattri... |
43856285 | Failed to get absolute path to installed module | 32 | 2017-05-08 19:56:09 | <p>I'm with a problem that I believe that is something related to my package.json or the version of the cordova platform.</p>
<p>When I try to run an <code>ionic state restore</code> it returns the following output:</p>
<pre><code>Attempting to restore your Ionic application from package.json
Restoring Platforms
co... | 14,421 | 1,899,642 | 2019-07-08 19:27:56 | 44,020,193 | 77 | 2017-05-17 09:02:06 | 6,487,993 | 2017-05-17 09:02:06 | https://stackoverflow.com/q/43856285 | https://stackoverflow.com/a/44020193 | <p>I got the same error message when adding a local plugin: <code>Error: Failed to get absolute path to installed module</code>.</p>
<p>Using the option <code>--nofetch</code> (cordova@7.0.1) fixed it:</p>
<p><code>cordova plugin add ../my-plugin --nofetch</code></p>
<p>According to <a href="https://github.com/apach... | <p>I got the same error message when adding a local plugin: <code>Error: Failed to get absolute path to installed module</code>.</p> <p>Using the option <code>--nofetch</code> (cordova@7.0.1) fixed it:</p> <p><code>cordova plugin add ../my-plugin --nofetch</code></p> <p>According to <a href="https://github.com/apach... | 119, 78331, 100064 | cordova, git, ionic-framework | <h1>Failed to get absolute path to installed module</h1>
<p>I'm with a problem that I believe that is something related to my package.json or the version of the cordova platform.</p>
<p>When I try to run an <code>ionic state restore</code> it returns the following output:</p>
<pre><code>Attempting to restore your Ion... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,447 | git | # Failed to get absolute path to installed module
I'm with a problem that I believe that is something related to my package.json or the version of the cordova platform.
When I try to run an `ionic state restore` it returns the following output:
```
Attempting to restore your Ionic application from package.json
Rest... | I got the same error message when adding a local plugin: `Error: Failed to get absolute path to installed module`.
Using the option `--nofetch` (cordova@7.0.1) fixed it:
`cordova plugin add ../my-plugin --nofetch`
According to <https://github.com/apache/cordova-cli/blob/master/RELEASENOTES.md> :
Use `--nofetch` flag... |
1528513 | Find where code was deleted in a Git repository | 123 | 2009-10-06 22:53:51 | <p>How do I find code that was deleted?</p>
<p>I ended up finding where it was created with this:</p>
<pre><code>$ git log --pretty=oneline -S'some code'
</code></pre>
<p>And that's good enough, but I was also curious to find where it got deleted, and so far, no dice.</p>
<p>First, I tried <code>git diff HEAD..HEAD^ | ... | 50,953 | 16,957 | 2024-11-22 04:41:42 | 1,528,644 | 76 | 2009-10-06 23:27:07 | 825 | 2021-11-26 11:12:22 | https://stackoverflow.com/q/1528513 | https://stackoverflow.com/a/1528644 | <p>Hmph, this works for me:</p>
<pre class="lang-sh prettyprint-override"><code>$ git init
Initialized empty Git repository in /Users/pknotz/foo/.git/
$ echo "Hello" > a
$ git add a
$ git commit -am "initial commit"
[master (root-commit) 7e52a51] initial commit
1 files changed, 1 insertions(+... | <p>Hmph, this works for me:</p> <pre class="lang-sh prettyprint-override"><code>$ git init Initialized empty Git repository in /Users/pknotz/foo/.git/ $ echo "Hello" > a $ git add a $ git commit -am "initial commit" [master (root-commit) 7e52a51] initial commit 1 files changed, 1 insertions(+... | 119 | git | <h1>Find where code was deleted in a Git repository</h1>
<p>How do I find code that was deleted?</p>
<p>I ended up finding where it was created with this:</p>
<pre><code>$ git log --pretty=oneline -S'some code'
</code></pre>
<p>And that's good enough, but I was also curious to find where it got deleted, and so far, no ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,448 | git | # Find where code was deleted in a Git repository
How do I find code that was deleted?
I ended up finding where it was created with this:
```
$ git log --pretty=oneline -S'some code'
```
And that's good enough, but I was also curious to find where it got deleted, and so far, no dice.
First, I tried `git diff HEAD.... | Hmph, this works for me:
```
$ git init
Initialized empty Git repository in /Users/pknotz/foo/.git/
$ echo "Hello" > a
$ git add a
$ git commit -am "initial commit"
[master (root-commit) 7e52a51] initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 a
$ echo " World" >> a
$ git comm... |
4084868 | How do I recover/resynchronise after someone pushes a rebase or a reset to a published branch? | 93 | 2010-11-03 07:08:19 | <p>We have all heard that one should never rebase published work, that it’s dangerous, etc. However, I have not seen any recipes posted for how to deal with the situation in case a rebase <em>is</em> published.</p>
<p>Now, do note that this is only really feasible if the repository is only cloned by a known (and prefe... | 19,045 | 9,410 | 2022-03-23 07:26:37 | 4,084,870 | 76 | 2010-11-03 07:08:40 | 9,410 | 2010-11-03 07:08:40 | https://stackoverflow.com/q/4084868 | https://stackoverflow.com/a/4084870 | <p>Getting back in synch after a pushed rebase is really not that complicated in most cases.</p>
<pre><code>git checkout foo
git branch old-foo origin/foo # BEFORE fetching!!
git fetch
git rebase --onto origin/foo old-foo foo
git branch -D old-foo
</code></pre>
<p>Ie. first you set up a bookmark for where the remote ... | <p>Getting back in synch after a pushed rebase is really not that complicated in most cases.</p> <pre><code>git checkout foo git branch old-foo origin/foo # BEFORE fetching!! git fetch git rebase --onto origin/foo old-foo foo git branch -D old-foo </code></pre> <p>Ie. first you set up a bookmark for where the remote ... | 119, 8974, 29934, 51381 | git, git-rebase, git-reset, rebase | <h1>How do I recover/resynchronise after someone pushes a rebase or a reset to a published branch?</h1>
<p>We have all heard that one should never rebase published work, that it’s dangerous, etc. However, I have not seen any recipes posted for how to deal with the situation in case a rebase <em>is</em> published.</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,449 | git | # How do I recover/resynchronise after someone pushes a rebase or a reset to a published branch?
We have all heard that one should never rebase published work, that it’s dangerous, etc. However, I have not seen any recipes posted for how to deal with the situation in case a rebase *is* published.
Now, do note that th... | Getting back in synch after a pushed rebase is really not that complicated in most cases.
```
git checkout foo
git branch old-foo origin/foo # BEFORE fetching!!
git fetch
git rebase --onto origin/foo old-foo foo
git branch -D old-foo
```
Ie. first you set up a bookmark for where the remote branch originally was, then... |
9478023 | Is the git binary diff algorithm (delta storage) standardized? | 64 | 2012-02-28 07:30:32 | <p>Git uses a delta compression to store objects that are similar to each-other. </p>
<p>Is this algorithm standardized and used in other tools as well? Is there documentation describing the format? Is it compatible with xdelta/VCDIFF/RFC 3284? </p>
| 23,134 | 14,955 | 2018-05-23 20:07:07 | 9,478,566 | 76 | 2012-02-28 08:25:49 | 6,309 | 2018-05-23 20:07:07 | https://stackoverflow.com/q/9478023 | https://stackoverflow.com/a/9478566 | <p>I think the diff algo used for <a href="http://progit.org/book/ch9-4.html" rel="noreferrer">pack files</a> was linked to one of the <a href="http://en.wikipedia.org/wiki/Delta_encoding" rel="noreferrer">delta encoding</a> out there: <a href="http://www.gelato.unsw.edu.au/archives/git/0505/2832.html" rel="noreferrer"... | <p>I think the diff algo used for <a href="http://progit.org/book/ch9-4.html" rel="noreferrer">pack files</a> was linked to one of the <a href="http://en.wikipedia.org/wiki/Delta_encoding" rel="noreferrer">delta encoding</a> out there: <a href="http://www.gelato.unsw.edu.au/archives/git/0505/2832.html" rel="noreferrer"... | 76, 119, 27527, 29234 | binary-diff, compression, git, vcdiff | <h1>Is the git binary diff algorithm (delta storage) standardized?</h1>
<p>Git uses a delta compression to store objects that are similar to each-other. </p>
<p>Is this algorithm standardized and used in other tools as well? Is there documentation describing the format? Is it compatible with xdelta/VCDIFF/RFC 3284? </... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,450 | git | # Is the git binary diff algorithm (delta storage) standardized?
Git uses a delta compression to store objects that are similar to each-other.
Is this algorithm standardized and used in other tools as well? Is there documentation describing the format? Is it compatible with xdelta/VCDIFF/RFC 3284? | I think the diff algo used for [pack files](http://progit.org/book/ch9-4.html) was linked to one of the [delta encoding](http://en.wikipedia.org/wiki/Delta_encoding) out there: [initially (2005) xdelta](http://www.gelato.unsw.edu.au/archives/git/0505/2832.html), and then [libXDiff](http://www.xmailserver.org/xdiff.html... |
3719068 | Move commits from master onto a branch using git | 62 | 2010-09-15 15:15:20 | <p>I'm trying to learn how to use Git effectively and I'm wondering how I should (good practice/bad practice?) solve the following case:</p>
<p>Say I have the following chain of commits in master:</p>
<ul>
<li>Initial commit</li>
<li>Commit 1</li>
<li>Commit 2</li>
<li>Commit 3</li>
</ul>
<p>Then I realize that what... | 20,073 | 265,249 | 2012-02-15 06:48:33 | 3,719,166 | 76 | 2010-09-15 15:26:42 | 6,309 | 2012-02-15 06:48:33 | https://stackoverflow.com/q/3719068 | https://stackoverflow.com/a/3719166 | <pre><code>git branch tmp # mark the current commit with a tmp branch
git reset --hard Commit1 # revert to Commit1
</code></pre>
<p>The SO answer "<a href="https://stackoverflow.com/questions/3639342/whats-the-difference-between-git-reset-and-git-checkout-in-git">What's the difference between 'git reset' a... | <pre><code>git branch tmp # mark the current commit with a tmp branch git reset --hard Commit1 # revert to Commit1 </code></pre> <p>The SO answer "<a href="https://stackoverflow.com/questions/3639342/whats-the-difference-between-git-reset-and-git-checkout-in-git">What's the difference between 'git reset' a... | 119, 5597, 51381, 76220 | commit, git, git-branch, git-reset | <h1>Move commits from master onto a branch using git</h1>
<p>I'm trying to learn how to use Git effectively and I'm wondering how I should (good practice/bad practice?) solve the following case:</p>
<p>Say I have the following chain of commits in master:</p>
<ul>
<li>Initial commit</li>
<li>Commit 1</li>
<li>Commit 2... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,451 | git | # Move commits from master onto a branch using git
I'm trying to learn how to use Git effectively and I'm wondering how I should (good practice/bad practice?) solve the following case:
Say I have the following chain of commits in master:
- Initial commit
- Commit 1
- Commit 2
- Commit 3
Then I realize that what's d... | ```
git branch tmp # mark the current commit with a tmp branch
git reset --hard Commit1 # revert to Commit1
```
The SO answer "[What's the difference between 'git reset' and 'git checkout' in git?](https://stackoverflow.com/questions/3639342/whats-the-difference-between-git-reset-and-git-checkout-in-git)" ... |
9672975 | Switching between multiple ssh keys in Git on Windows | 60 | 2012-03-12 18:47:50 | <p>I need to have multiple keys in my client to access two different accounts on Repository hosting. See <a href="https://redefy.repositoryhosting.com/support" rel="noreferrer">https://redefy.repositoryhosting.com/support</a> -> How do I manage multiple accounts with multiple keypairs on my client?</p>
<p>I do not und... | 47,771 | 666,148 | 2022-06-06 08:22:25 | 9,680,717 | 76 | 2012-03-13 08:43:24 | 252,384 | 2012-03-13 08:43:24 | https://stackoverflow.com/q/9672975 | https://stackoverflow.com/a/9680717 | <p>I assume you use git bash and openssh.</p>
<p>Like what it's written in the article, you can make a configuration file for ssh client that lists all of your accounts. You can write the following configuration in your own ssh client configuration file in <code>~/.ssh/config</code></p>
<pre><code>Host account-one
Ho... | <p>I assume you use git bash and openssh.</p> <p>Like what it's written in the article, you can make a configuration file for ssh client that lists all of your accounts. You can write the following configuration in your own ssh client configuration file in <code>~/.ssh/config</code></p> <pre><code>Host account-one Ho... | 64, 119, 386, 7330 | git, repository, ssh, windows | <h1>Switching between multiple ssh keys in Git on Windows</h1>
<p>I need to have multiple keys in my client to access two different accounts on Repository hosting. See <a href="https://redefy.repositoryhosting.com/support" rel="noreferrer">https://redefy.repositoryhosting.com/support</a> -> How do I manage multiple acc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,452 | git | # Switching between multiple ssh keys in Git on Windows
I need to have multiple keys in my client to access two different accounts on Repository hosting. See <https://redefy.repositoryhosting.com/support> -> How do I manage multiple accounts with multiple keypairs on my client?
I do not understand how to change betwe... | I assume you use git bash and openssh.
Like what it's written in the article, you can make a configuration file for ssh client that lists all of your accounts. You can write the following configuration in your own ssh client configuration file in `~/.ssh/config`
```
Host account-one
HostName server.example.com
User u... |
16641057 | How can I list the git subtrees on the root? | 56 | 2013-05-20 00:43:00 | <p>For example, you can do a <code>git remote --verbose</code> and git will show all the remotes you have on your project, <code>git branch</code> will show all the branches and signal the current branch, but how to list all subtrees, without any destructive command? <code>git subtree</code> will give the usage example... | 35,823 | 647,380 | 2025-10-24 18:28:22 | 18,339,297 | 76 | 2013-08-20 15:38:37 | 2,351,476 | 2013-08-20 15:38:37 | https://stackoverflow.com/q/16641057 | https://stackoverflow.com/a/18339297 | <p>There isn't any explicit way to do that (at least, for now), the only available commands are listed here (as you noted yourself, but here's a reference for future seekers):
<a href="https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt">https://github.com/git/git/blob/master/contrib/subtree/git-subt... | <p>There isn't any explicit way to do that (at least, for now), the only available commands are listed here (as you noted yourself, but here's a reference for future seekers): <a href="https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt">https://github.com/git/git/blob/master/contrib/subtree/git-subt... | 119, 68200 | git, git-subtree | <h1>How can I list the git subtrees on the root?</h1>
<p>For example, you can do a <code>git remote --verbose</code> and git will show all the remotes you have on your project, <code>git branch</code> will show all the branches and signal the current branch, but how to list all subtrees, without any destructive command... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,453 | git | # How can I list the git subtrees on the root?
For example, you can do a `git remote --verbose` and git will show all the remotes you have on your project, `git branch` will show all the branches and signal the current branch, but how to list all subtrees, without any destructive command? `git subtree` will give the u... | There isn't any explicit way to do that (at least, for now), the only available commands are listed here (as you noted yourself, but here's a reference for future seekers):
<https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt>
I went through the code (basically all this mechanism is a big shell scri... |
612580 | How does Git solve the merging problem? | 56 | 2009-03-04 21:43:10 | <p>SVN made branching much easier by making branches really cheap, but merges remain a real problem in SVN - one that Git supposedly solves.</p>
<p>Does Git achieve this, and how?</p>
<p>(disclaimer: All I know about Git is based on the Linus lecture - total git noob here)</p>
| 20,909 | 11,208 | 2012-02-01 22:02:05 | 612,747 | 76 | 2009-03-04 22:24:22 | 6,309 | 2009-03-05 07:15:56 | https://stackoverflow.com/q/612580 | https://stackoverflow.com/a/612747 | <p>Git will not prevent conflict in merges but can reconcile history even when they do not share any parent ancestor.<br>
(through <a href="http://community.livejournal.com/evan_tech/255341.html" rel="noreferrer">The grafts file (<code>.git/info/grafts</code>)</a>, which is a list, one per line, of a commit followed by... | <p>Git will not prevent conflict in merges but can reconcile history even when they do not share any parent ancestor.<br> (through <a href="http://community.livejournal.com/evan_tech/255341.html" rel="noreferrer">The grafts file (<code>.git/info/grafts</code>)</a>, which is a list, one per line, of a commit followed by... | 63, 119, 456 | git, svn, version-control | <h1>How does Git solve the merging problem?</h1>
<p>SVN made branching much easier by making branches really cheap, but merges remain a real problem in SVN - one that Git supposedly solves.</p>
<p>Does Git achieve this, and how?</p>
<p>(disclaimer: All I know about Git is based on the Linus lecture - total git noob h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,454 | git | # How does Git solve the merging problem?
SVN made branching much easier by making branches really cheap, but merges remain a real problem in SVN - one that Git supposedly solves.
Does Git achieve this, and how?
(disclaimer: All I know about Git is based on the Linus lecture - total git noob here) | Git will not prevent conflict in merges but can reconcile history even when they do not share any parent ancestor.
(through [The grafts file (`.git/info/grafts`)](http://community.livejournal.com/evan_tech/255341.html), which is a list, one per line, of a commit followed by its parents, that you can modify for that "... |
41876631 | Changing Git remote URL updates fetch but not push | 46 | 2017-01-26 15:12:04 | <p>I am attempting to change the remote URL of my origin branch in Git. All I want to change is the SSH port. First, listing my remote origins gives me this:</p>
<pre><code>git remote -v
origin user@example.com:package/name.git (fetch)
origin user@example.com:package/name.git (push)
</code></pre>
<p>Then, I run t... | 41,748 | 1,447,867 | 2019-09-15 12:10:04 | 41,876,678 | 76 | 2017-01-26 15:15:04 | 2,018,369 | 2018-11-22 22:23:15 | https://stackoverflow.com/q/41876631 | https://stackoverflow.com/a/41876678 | <p>From <code>git-remote</code> manual:</p>
<pre><code>set-url
Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL,
error occurs and nothing is changed.
With --push,... | <p>From <code>git-remote</code> manual:</p> <pre><code>set-url Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL, error occurs and nothing is changed. With --push,... | 119, 386 | git, ssh | <h1>Changing Git remote URL updates fetch but not push</h1>
<p>I am attempting to change the remote URL of my origin branch in Git. All I want to change is the SSH port. First, listing my remote origins gives me this:</p>
<pre><code>git remote -v
origin user@example.com:package/name.git (fetch)
origin user@example... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,456 | git | # Changing Git remote URL updates fetch but not push
I am attempting to change the remote URL of my origin branch in Git. All I want to change is the SSH port. First, listing my remote origins gives me this:
```
git remote -v
origin user@example.com:package/name.git (fetch)
origin user@example.com:package/name.gi... | From `git-remote` manual:
```
set-url
Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL,
error occurs and nothing is changed.
With --push, push URLs are manipulated instead of fetch URLs.... |
12921125 | Git merge branch of another remote | 44 | 2012-10-16 18:28:28 | <p>Nowadays, I see a lot of commits from Linus Torvalds and/or Gitster that look like so:</p>
<pre><code>Merge branch 'maint' of git://github.com/git-l10n/git-po into maint …
* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: fix a few minor typos
</code></pre>
<p>or:</p>
<pre><code>Merge branch 'upstream... | 38,119 | null | 2019-11-19 17:44:16 | 12,921,855 | 76 | 2012-10-16 19:12:42 | 69,755 | 2012-10-16 19:20:20 | https://stackoverflow.com/q/12921125 | https://stackoverflow.com/a/12921855 | <p>Just use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html"><code>git pull</code></a> to pull the remote branch into <code>master</code>:</p>
<pre><code>git remote add something git://host.example.com/path/to/repo.git
git checkout master
git pull something master
</code></pre>
<p>Or do it with... | <p>Just use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-pull.html"><code>git pull</code></a> to pull the remote branch into <code>master</code>:</p> <pre><code>git remote add something git://host.example.com/path/to/repo.git git checkout master git pull something master </code></pre> <p>Or do it with... | 58, 119, 1231 | command-line, git, linux | <h1>Git merge branch of another remote</h1>
<p>Nowadays, I see a lot of commits from Linus Torvalds and/or Gitster that look like so:</p>
<pre><code>Merge branch 'maint' of git://github.com/git-l10n/git-po into maint …
* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: fix a few minor typos
</code></pre>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,457 | git | # Git merge branch of another remote
Nowadays, I see a lot of commits from Linus Torvalds and/or Gitster that look like so:
```
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint …
* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: fix a few minor typos
```
or:
```
Merge branch 'upstream... | Just use [`git pull`](http://www.kernel.org/pub/software/scm/git/docs/git-pull.html) to pull the remote branch into `master`:
```
git remote add something git://host.example.com/path/to/repo.git
git checkout master
git pull something master
```
Or do it without adding a remote:
```
git pull git://host.example.com/pa... |
72610494 | What is the difference between `git lfs fetch`, `git lfs fetch --all`, and `git lfs pull`? | 37 | 2022-06-14 01:05:10 | <p>Despite having used <code>git</code> for years, I find <code>git lfs</code> (<a href="https://git-lfs.github.com/" rel="noreferrer">git Large File Storage</a>) to be pretty confusing to use, even at a very basic level. Can someone explain the difference between these 3 commands?:</p>
<ol>
<li><code>git lfs fetch</co... | 40,156 | 4,561,887 | 2024-02-01 18:17:48 | 72,610,495 | 76 | 2022-06-14 01:05:10 | 4,561,887 | 2024-02-01 18:17:48 | https://stackoverflow.com/q/72610494 | https://stackoverflow.com/a/72610495 | <p>After a bunch of study and figuring out where the help pages are, here is what I have concluded.</p>
<p>Be warned, however, that Git LFS is slow, inefficient, online (as opposed to Git, which is offline), and evil. Read <a href="https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/personal_opinions_... | <p>After a bunch of study and figuring out where the help pages are, here is what I have concluded.</p> <p>Be warned, however, that Git LFS is slow, inefficient, online (as opposed to Git, which is offline), and evil. Read <a href="https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/personal_opinions_... | 119, 115244 | git, git-lfs | <h1>What is the difference between `git lfs fetch`, `git lfs fetch --all`, and `git lfs pull`?</h1>
<p>Despite having used <code>git</code> for years, I find <code>git lfs</code> (<a href="https://git-lfs.github.com/" rel="noreferrer">git Large File Storage</a>) to be pretty confusing to use, even at a very basic level... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,458 | git | # What is the difference between `git lfs fetch`, `git lfs fetch --all`, and `git lfs pull`?
Despite having used `git` for years, I find `git lfs` ([git Large File Storage](https://git-lfs.github.com/)) to be pretty confusing to use, even at a very basic level. Can someone explain the difference between these 3 comman... | After a bunch of study and figuring out where the help pages are, here is what I have concluded.
Be warned, however, that Git LFS is slow, inefficient, online (as opposed to Git, which is offline), and evil. Read [my full rant](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/personal_opinions_and... |
13276018 | Unstage all files and abandon merge | 37 | 2012-11-07 18:38:57 | <p>I was running a simple merge and expecting no conflicts, and I ran <code>git merge my_dev_branch</code></p>
<p>However I got a merge conflict which looked messy to resolve, and made me think that I wasn't clear on my branch history. Rather than resolve the conflict I would like to abandon the merge and go back to ... | 10,781 | 1,450,420 | 2012-11-07 18:47:00 | 13,276,138 | 76 | 2012-11-07 18:47:00 | 1,787,206 | 2012-11-07 18:47:00 | https://stackoverflow.com/q/13276018 | https://stackoverflow.com/a/13276138 | <p>Try <code>git merge --abort</code>. Handy, eh?</p>
| <p>Try <code>git merge --abort</code>. Handy, eh?</p> | 119 | git | <h1>Unstage all files and abandon merge</h1>
<p>I was running a simple merge and expecting no conflicts, and I ran <code>git merge my_dev_branch</code></p>
<p>However I got a merge conflict which looked messy to resolve, and made me think that I wasn't clear on my branch history. Rather than resolve the conflict I wo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,459 | git | # Unstage all files and abandon merge
I was running a simple merge and expecting no conflicts, and I ran `git merge my_dev_branch`
However I got a merge conflict which looked messy to resolve, and made me think that I wasn't clear on my branch history. Rather than resolve the conflict I would like to abandon the merg... | Try `git merge --abort`. Handy, eh? |
8803714 | Change Git commiter in Netbeans | 36 | 2012-01-10 13:04:16 | <p>In Netbeans 7.1 Git support has been added, however, I don't see a way to change commiter information. Currently, it's defaulting to my system information which is not what I want. Is there any way to change this? </p>
| 33,857 | 387,990 | 2015-06-16 18:10:12 | 8,803,742 | 76 | 2012-01-10 13:07:29 | 298,479 | 2012-01-10 13:07:29 | https://stackoverflow.com/q/8803714 | https://stackoverflow.com/a/8803742 | <p>Try setting it in the local gitconfig file <code>.git/config</code>:</p>
<pre><code>[user]
name = yourname
email = youremail
</code></pre>
| <p>Try setting it in the local gitconfig file <code>.git/config</code>:</p> <pre><code>[user] name = yourname email = youremail </code></pre> | 119, 2176 | git, netbeans | <h1>Change Git commiter in Netbeans</h1>
<p>In Netbeans 7.1 Git support has been added, however, I don't see a way to change commiter information. Currently, it's defaulting to my system information which is not what I want. Is there any way to change this? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,460 | git | # Change Git commiter in Netbeans
In Netbeans 7.1 Git support has been added, however, I don't see a way to change commiter information. Currently, it's defaulting to my system information which is not what I want. Is there any way to change this? | Try setting it in the local gitconfig file `.git/config`:
```
[user]
name = yourname
email = youremail
``` |
28104581 | How secure is storing password with Git? | 35 | 2015-01-23 06:58:37 | <p>I use the Git on my workplace and company policy doesn't allow me to store passwords in unsecure way. Is there any better option than using <code>git config credential.helper store</code> for storing password to the Git server? </p>
<p>P.S. Can't use key-authentication as it's not allowed on our server.</p>
| 45,291 | 1,809,978 | 2017-07-05 06:08:16 | 28,104,587 | 76 | 2015-01-23 06:58:55 | 1,809,978 | 2017-07-05 06:08:16 | https://stackoverflow.com/q/28104581 | https://stackoverflow.com/a/28104587 | <p><code>git config credential.helper store</code> is not very secure; as it said in <a href="http://git-scm.com/docs/git-credential-store" rel="noreferrer">documentation</a>:</p>
<blockquote>
<p>Using this helper will store your passwords unencrypted on disk,
protected only by filesystem permissions</p>
<p>T... | <p><code>git config credential.helper store</code> is not very secure; as it said in <a href="http://git-scm.com/docs/git-credential-store" rel="noreferrer">documentation</a>:</p> <blockquote> <p>Using this helper will store your passwords unencrypted on disk, protected only by filesystem permissions</p> <p>T... | 58, 119, 136, 369 | git, linux, macos, security | <h1>How secure is storing password with Git?</h1>
<p>I use the Git on my workplace and company policy doesn't allow me to store passwords in unsecure way. Is there any better option than using <code>git config credential.helper store</code> for storing password to the Git server? </p>
<p>P.S. Can't use key-authenticat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,461 | git | # How secure is storing password with Git?
I use the Git on my workplace and company policy doesn't allow me to store passwords in unsecure way. Is there any better option than using `git config credential.helper store` for storing password to the Git server?
P.S. Can't use key-authentication as it's not allowed on o... | `git config credential.helper store` is not very secure; as it said in [documentation](http://git-scm.com/docs/git-credential-store):
> Using this helper will store your passwords unencrypted on disk,
> protected only by filesystem permissions
>
> The ~/.git-credentials file will have its filesystem permissions set to... |
55325930 | Git: How to squash all commits on `master` branch? | 33 | 2019-03-24 16:24:22 | <p>I'm looking for a way to squash <strong>all</strong> git commits into a single big commit in <code>master</code> branch. I fully understand the consequences of what I'm trying to do, no need to explain that this is dangerous or that it's not the right way to go - I want to lose all my history and turn this repositor... | 35,020 | 2,102,748 | 2022-08-19 15:17:30 | 55,326,553 | 76 | 2019-03-24 17:32:44 | 2,437,508 | 2022-08-19 15:17:30 | https://stackoverflow.com/q/55325930 | https://stackoverflow.com/a/55326553 | <p>I would use <code>git reset --soft</code>:</p>
<pre><code>git reset --soft id-of-first-revision-of-master
git commit --amend -m "single commit for master"
</code></pre>
<p>Then you can <code>git push --force</code> wherever you need that new branch.</p>
<h3>Update</h3>
<p>I can think of another simple way ... | <p>I would use <code>git reset --soft</code>:</p> <pre><code>git reset --soft id-of-first-revision-of-master git commit --amend -m "single commit for master" </code></pre> <p>Then you can <code>git push --force</code> wherever you need that new branch.</p> <h3>Update</h3> <p>I can think of another simple way ... | 119 | git | <h1>Git: How to squash all commits on `master` branch?</h1>
<p>I'm looking for a way to squash <strong>all</strong> git commits into a single big commit in <code>master</code> branch. I fully understand the consequences of what I'm trying to do, no need to explain that this is dangerous or that it's not the right way t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,462 | git | # Git: How to squash all commits on `master` branch?
I'm looking for a way to squash **all** git commits into a single big commit in `master` branch. I fully understand the consequences of what I'm trying to do, no need to explain that this is dangerous or that it's not the right way to go - I want to lose all my hist... | I would use `git reset --soft`:
```
git reset --soft id-of-first-revision-of-master
git commit --amend -m "single commit for master"
```
Then you can `git push --force` wherever you need that new branch.
### Update
I can think of another simple way to do it, with more git commands:
```
git checkout --orphan some-b... |
6372318 | C# string starts with a number regex | 32 | 2011-06-16 13:03:04 | <p>I've been searching around for a little while to figure out how to confirm a string begins with a number. I came across a regex statement '/^\d/' which I can confirm says if starts with digit. However I can not seem to get it to work in the code below. Where did I went wrong in the statement <code>if(Regex.Match(inf... | 69,121 | 561,621 | 2020-02-07 08:11:19 | 6,372,335 | 76 | 2011-06-16 13:04:19 | 29,407 | 2011-06-16 13:10:49 | https://stackoverflow.com/q/6372318 | https://stackoverflow.com/a/6372335 | <p>Your regex is wrong. <code>/.../</code> is javascript convention for defining regular expressions. Try like this in C#:</p>
<pre><code>if (Regex.IsMatch(info, @"^\d"))
</code></pre>
<p>Also notice that you should use the <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.ismatch.... | <p>Your regex is wrong. <code>/.../</code> is javascript convention for defining regular expressions. Try like this in C#:</p> <pre><code>if (Regex.IsMatch(info, @"^\d")) </code></pre> <p>Also notice that you should use the <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.ismatch.... | 9, 18, 139, 9914 | c#, digits, regex, string | <h1>C# string starts with a number regex</h1>
<p>I've been searching around for a little while to figure out how to confirm a string begins with a number. I came across a regex statement '/^\d/' which I can confirm says if starts with digit. However I can not seem to get it to work in the code below. Where did I went w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,463 | git | # C# string starts with a number regex
I've been searching around for a little while to figure out how to confirm a string begins with a number. I came across a regex statement '/^\d/' which I can confirm says if starts with digit. However I can not seem to get it to work in the code below. Where did I went wrong in t... | Your regex is wrong. `/.../` is javascript convention for defining regular expressions. Try like this in C#:
```
if (Regex.IsMatch(info, @"^\d"))
```
Also notice that you should use the [IsMatch](http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.ismatch.aspx) method which returns boolean or... |
4786972 | Get a list of all Git commits, including the 'lost' ones | 297 | 2011-01-24 20:43:41 | <p>Let's say that I have a graph like this:</p>
<pre><code>A---B---C---D (master)
\
\-E---F (HEAD)
</code></pre>
<p>If I do <code>git log --all --oneline</code>, I will get all six of my commits.</p>
<p>But if the graph is:</p>
<pre><code>A---B---C---D (master, HEAD)
\
\-E---F
</code></pre>
<p>I w... | 595,408 | 240,443 | 2025-04-08 05:49:32 | 4,787,030 | 75 | 2011-01-24 20:49:46 | 85,134 | 2011-01-24 20:49:46 | https://stackoverflow.com/q/4786972 | https://stackoverflow.com/a/4787030 | <p>Not particularly easily- if you've lost the pointer to the tip of a branch, it's rather like finding a needle in a haystack. You can find all the commits that don't appear to be referenced any more- <code>git fsck --unreachable</code> will do this for you- but that will include commits that you threw away after a <c... | <p>Not particularly easily- if you've lost the pointer to the tip of a branch, it's rather like finding a needle in a haystack. You can find all the commits that don't appear to be referenced any more- <code>git fsck --unreachable</code> will do this for you- but that will include commits that you threw away after a <c... | 119, 47913 | git, git-log | <h1>Get a list of all Git commits, including the 'lost' ones</h1>
<p>Let's say that I have a graph like this:</p>
<pre><code>A---B---C---D (master)
\
\-E---F (HEAD)
</code></pre>
<p>If I do <code>git log --all --oneline</code>, I will get all six of my commits.</p>
<p>But if the graph is:</p>
<pre><code>A---... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,464 | git | # Get a list of all Git commits, including the 'lost' ones
Let's say that I have a graph like this:
```
A---B---C---D (master)
\
\-E---F (HEAD)
```
If I do `git log --all --oneline`, I will get all six of my commits.
But if the graph is:
```
A---B---C---D (master, HEAD)
\
\-E---F
```
I will ... | Not particularly easily- if you've lost the pointer to the tip of a branch, it's rather like finding a needle in a haystack. You can find all the commits that don't appear to be referenced any more- `git fsck --unreachable` will do this for you- but that will include commits that you threw away after a `git commit --am... |
24864700 | fatal: The upstream branch of your current branch does not match the name of your current branch | 179 | 2014-07-21 12:05:54 | <p>After doing a checkout of the remote branch <code>releases/rel_5.4.1</code> using the Git GUI, I'm seeing this unexpected error message when I try to <code>push</code>:</p>
<pre><code>fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on... | 204,984 | 34,088 | 2025-03-21 14:44:56 | 24,865,780 | 75 | 2014-07-21 13:01:23 | 34,088 | 2014-07-21 13:01:23 | https://stackoverflow.com/q/24864700 | https://stackoverflow.com/a/24865780 | <p>Your local branch is called <code>rel_5.4.1</code> but the remote branch is <code>releases/rel_5.4.1</code> (as far as Git is concerned, the <code>/</code> has no special meaning in branch names except to make them easier to read for the human eye).</p>
<p>When you push, Git is wary whether you want to push your br... | <p>Your local branch is called <code>rel_5.4.1</code> but the remote branch is <code>releases/rel_5.4.1</code> (as far as Git is concerned, the <code>/</code> has no special meaning in branch names except to make them easier to read for the human eye).</p> <p>When you push, Git is wary whether you want to push your br... | 119, 4236, 31678 | git, push, remote-branch | <h1>fatal: The upstream branch of your current branch does not match the name of your current branch</h1>
<p>After doing a checkout of the remote branch <code>releases/rel_5.4.1</code> using the Git GUI, I'm seeing this unexpected error message when I try to <code>push</code>:</p>
<pre><code>fatal: The upstream branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,465 | git | # fatal: The upstream branch of your current branch does not match the name of your current branch
After doing a checkout of the remote branch `releases/rel_5.4.1` using the Git GUI, I'm seeing this unexpected error message when I try to `push`:
```
fatal: The upstream branch of your current branch does not match
the... | Your local branch is called `rel_5.4.1` but the remote branch is `releases/rel_5.4.1` (as far as Git is concerned, the `/` has no special meaning in branch names except to make them easier to read for the human eye).
When you push, Git is wary whether you want to push your branch to `releases/rel_5.4.1` (the name of t... |
5181322 | GIT warning: too many files skipping inexact rename detection | 120 | 2011-03-03 13:28:28 | <p>I am aware that the default rename limit is 100 and we can increase this value using the config <code>diff.renamelimit config</code></p>
<p>What I am worried about is that, if this config is not setup, will there be a wrong merge or any missing code?
I am trying to merge (git merge) 2 branches that have huge changes... | 85,035 | 289,715 | 2021-05-26 22:18:10 | 5,181,599 | 75 | 2011-03-03 13:53:35 | 4,203 | 2011-03-03 13:53:35 | https://stackoverflow.com/q/5181322 | https://stackoverflow.com/a/5181599 | <p>Your content is safe.</p>
<p>As I understand it, <code>git</code> doesn't actually have any concept of a first-class <code>rename</code> operation (only <code>bzr</code> does, of the big 3 DVCSs): the <code>mv</code> is sugar on top of the underlying machinery, which is basically an <code>add</code> and a <code>rm<... | <p>Your content is safe.</p> <p>As I understand it, <code>git</code> doesn't actually have any concept of a first-class <code>rename</code> operation (only <code>bzr</code> does, of the big 3 DVCSs): the <code>mv</code> is sugar on top of the underlying machinery, which is basically an <code>add</code> and a <code>rm<... | 119, 28897, 32868 | git, git-config, git-merge | <h1>GIT warning: too many files skipping inexact rename detection</h1>
<p>I am aware that the default rename limit is 100 and we can increase this value using the config <code>diff.renamelimit config</code></p>
<p>What I am worried about is that, if this config is not setup, will there be a wrong merge or any missing c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,467 | git | # GIT warning: too many files skipping inexact rename detection
I am aware that the default rename limit is 100 and we can increase this value using the config `diff.renamelimit config`
What I am worried about is that, if this config is not setup, will there be a wrong merge or any missing code?
I am trying to merge ... | Your content is safe.
As I understand it, `git` doesn't actually have any concept of a first-class `rename` operation (only `bzr` does, of the big 3 DVCSs): the `mv` is sugar on top of the underlying machinery, which is basically an `add` and a `rm`. Since `git` can track the content that changes during such operation... |
28159071 | Why doesn't Git use more modern SHA? | 104 | 2015-01-26 21:28:07 | <p>I read about that Git uses SHA-1 digest as an ID for a revision. Why does it not use a more modern version of SHA?</p>
| 29,800 | 1,150,778 | 2022-07-31 21:14:05 | 47,838,703 | 75 | 2017-12-15 19:23:50 | 6,309 | 2022-07-31 21:14:05 | https://stackoverflow.com/q/28159071 | https://stackoverflow.com/a/47838703 | <blockquote>
<p>Why does it not use a more modern version of SHA?</p>
</blockquote>
<p>Dec. 2017: It will. And Git 2.16 (Q1 2018) is the first release to illustrate and implement that intent.</p>
<p>Note: see Git 2.19 below: it will be <strong>SHA-256</strong>.</p>
<p>Git 2.16 will propose an infrastructure to define w... | <blockquote> <p>Why does it not use a more modern version of SHA?</p> </blockquote> <p>Dec. 2017: It will. And Git 2.16 (Q1 2018) is the first release to illustrate and implement that intent.</p> <p>Note: see Git 2.19 below: it will be <strong>SHA-256</strong>.</p> <p>Git 2.16 will propose an infrastructure to define w... | 119, 2387, 10188 | cryptography, git, sha | <h1>Why doesn't Git use more modern SHA?</h1>
<p>I read about that Git uses SHA-1 digest as an ID for a revision. Why does it not use a more modern version of SHA?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,470 | git | # Why doesn't Git use more modern SHA?
I read about that Git uses SHA-1 digest as an ID for a revision. Why does it not use a more modern version of SHA? | > Why does it not use a more modern version of SHA?
Dec. 2017: It will. And Git 2.16 (Q1 2018) is the first release to illustrate and implement that intent.
Note: see Git 2.19 below: it will be **SHA-256**.
Git 2.16 will propose an infrastructure to define what hash function is used in Git, and will start an effort ... |
36862 | How do you organise multiple git repositories, so that all of them are backed up together? | 101 | 2008-08-31 13:54:20 | <p>With SVN, I had a single big repository I kept on a server, and checked-out on a few machines. This was a pretty good backup system, and allowed me easily work on any of the machines. I could checkout a specific project, commit and it updated the 'master' project, or I could checkout the entire thing.</p>
<p>Now, I... | 53,200 | 745 | 2013-04-11 06:20:26 | 37,006 | 75 | 2008-08-31 18:17:07 | 3,844 | 2008-09-01 05:25:40 | https://stackoverflow.com/q/36862 | https://stackoverflow.com/a/37006 | <p>I would <strong>strongly</strong> advise against putting unrelated data in a given
Git repository. The overhead of creating new repositories is quite
low, and that is a <em>feature</em> that makes it possible to keep
different lineages completely separate.</p>
<p>Fighting that idea means ending up with unnecessari... | <p>I would <strong>strongly</strong> advise against putting unrelated data in a given Git repository. The overhead of creating new repositories is quite low, and that is a <em>feature</em> that makes it possible to keep different lineages completely separate.</p> <p>Fighting that idea means ending up with unnecessari... | 119, 493 | backup, git | <h1>How do you organise multiple git repositories, so that all of them are backed up together?</h1>
<p>With SVN, I had a single big repository I kept on a server, and checked-out on a few machines. This was a pretty good backup system, and allowed me easily work on any of the machines. I could checkout a specific proje... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,471 | git | # How do you organise multiple git repositories, so that all of them are backed up together?
With SVN, I had a single big repository I kept on a server, and checked-out on a few machines. This was a pretty good backup system, and allowed me easily work on any of the machines. I could checkout a specific project, commi... | I would **strongly** advise against putting unrelated data in a given
Git repository. The overhead of creating new repositories is quite
low, and that is a *feature* that makes it possible to keep
different lineages completely separate.
Fighting that idea means ending up with unnecessarily tangled history,
which rende... |
3656351 | Git for Perforce users | 88 | 2010-09-07 06:52:22 | <p>I've been using Perforce for a number of years. I'd like to switch to using git for my personal code, but all of the git tutorials that I've seen either assume that you'e a complete source control n00b (which makes them incredibly tedious) or that you're used to svn (which I'm not).</p>
<p>I know p4, and I also und... | 26,354 | 90,848 | 2024-02-13 21:13:36 | 3,656,678 | 75 | 2010-09-07 07:43:49 | 167,735 | 2010-09-08 06:03:58 | https://stackoverflow.com/q/3656351 | https://stackoverflow.com/a/3656678 | <p>I haven't used perforce much so this may not be exactly be a 1:1 translation. Then again distributed source control systems like git and mercurial have a different workflow anyway so there really isn't (and there shouldn't) be a 1:1 translation. Anyway, here goes:</p>
<ul>
<li><p>Create multiple pending changelists... | <p>I haven't used perforce much so this may not be exactly be a 1:1 translation. Then again distributed source control systems like git and mercurial have a different workflow anyway so there really isn't (and there shouldn't) be a 1:1 translation. Anyway, here goes:</p> <ul> <li><p>Create multiple pending changelists... | 119, 1286 | git, perforce | <h1>Git for Perforce users</h1>
<p>I've been using Perforce for a number of years. I'd like to switch to using git for my personal code, but all of the git tutorials that I've seen either assume that you'e a complete source control n00b (which makes them incredibly tedious) or that you're used to svn (which I'm not).</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,472 | git | # Git for Perforce users
I've been using Perforce for a number of years. I'd like to switch to using git for my personal code, but all of the git tutorials that I've seen either assume that you'e a complete source control n00b (which makes them incredibly tedious) or that you're used to svn (which I'm not).
I know p4... | I haven't used perforce much so this may not be exactly be a 1:1 translation. Then again distributed source control systems like git and mercurial have a different workflow anyway so there really isn't (and there shouldn't) be a 1:1 translation. Anyway, here goes:
- Create multiple pending changelists -> Use branches ... |
2121230 | Git: How to move back and forth between commits | 86 | 2010-01-22 23:18:25 | <p>I have a newbie question about Git:</p>
<p>I need to move back and forth in a history of a branch.
That means, I need to get all the files to the state they were in in some old revision, and then I need to get back to the latest state in the repository. I don't need to commit.</p>
<p>With SVN, it would be</p>
<pr... | 96,488 | 145,989 | 2024-04-25 14:49:49 | 2,121,325 | 75 | 2010-01-22 23:43:44 | 141,177 | 2023-08-24 18:43:05 | https://stackoverflow.com/q/2121230 | https://stackoverflow.com/a/2121325 | <p>I'm a former svn user too and now use git for all my projects.</p>
<p>When using git, you should change your way of thinking from the client-server architecture that's used in svn. In svn, every change needs a connection with the server. Using git, your repo is in the working directory. You don't need a connection f... | <p>I'm a former svn user too and now use git for all my projects.</p> <p>When using git, you should change your way of thinking from the client-server architecture that's used in svn. In svn, every change needs a connection with the server. Using git, your repo is in the working directory. You don't need a connection f... | 119, 4860, 12626, 28896 | git, git-pull, pull, reset | <h1>Git: How to move back and forth between commits</h1>
<p>I have a newbie question about Git:</p>
<p>I need to move back and forth in a history of a branch.
That means, I need to get all the files to the state they were in in some old revision, and then I need to get back to the latest state in the repository. I don... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,473 | git | # Git: How to move back and forth between commits
I have a newbie question about Git:
I need to move back and forth in a history of a branch.
That means, I need to get all the files to the state they were in in some old revision, and then I need to get back to the latest state in the repository. I don't need to commi... | I'm a former svn user too and now use git for all my projects.
When using git, you should change your way of thinking from the client-server architecture that's used in svn. In svn, every change needs a connection with the server. Using git, your repo is in the working directory. You don't need a connection for every ... |
222782 | GIT vs. Perforce- Two VCS will enter... one will leave | 85 | 2008-10-21 17:49:08 | <p>So I'm in the process of getting GIT sold at work. First thing I need is to convince everyone that GIT is better at what they're already used to doing. We currently use Perforce. Anybody else go through a similar sale? Any good links/advice?</p>
<p>One of the big wins is that we can work with it disconnected from t... | 112,764 | 9,401 | 2014-04-17 11:20:17 | 223,963 | 75 | 2008-10-21 23:41:43 | 9,410 | 2008-10-21 23:46:50 | https://stackoverflow.com/q/222782 | https://stackoverflow.com/a/223963 | <p>The Perl 5 interpreter source code is currently going through the throes of converting from Perforce to git. Maybe Sam Vilain’s <code>git-p4raw</code> importer is of interest.</p>
<p>In any case, one of the major wins you’re going to have over every centralised VCS and most distributed ones also is raw, bliste... | <p>The Perl 5 interpreter source code is currently going through the throes of converting from Perforce to git. Maybe Sam Vilain’s <code>git-p4raw</code> importer is of interest.</p> <p>In any case, one of the major wins you’re going to have over every centralised VCS and most distributed ones also is raw, bliste... | 119, 1286, 2143 | git, perforce, process-management | <h1>GIT vs. Perforce- Two VCS will enter... one will leave</h1>
<p>So I'm in the process of getting GIT sold at work. First thing I need is to convince everyone that GIT is better at what they're already used to doing. We currently use Perforce. Anybody else go through a similar sale? Any good links/advice?</p>
<p>One... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,474 | git | # GIT vs. Perforce- Two VCS will enter... one will leave
So I'm in the process of getting GIT sold at work. First thing I need is to convince everyone that GIT is better at what they're already used to doing. We currently use Perforce. Anybody else go through a similar sale? Any good links/advice?
One of the big wins... | The Perl 5 interpreter source code is currently going through the throes of converting from Perforce to git. Maybe Sam Vilain’s `git-p4raw` importer is of interest.
In any case, one of the major wins you’re going to have over every centralised VCS and most distributed ones also is raw, blistering ***speed***. You can’... |
12394166 | How do I run git rebase --interactive in non-interactive manner? | 82 | 2012-09-12 18:22:32 | <p>Is it possible to do following?</p>
<ol>
<li>Make <code>git rebase --interactive</code> to just output standard boilerplate to a file, instead to outputting to a file and opening it in editor.</li>
<li>Let the user edit the file.</li>
<li>Let user re-run <code>git rebase</code> with the name of edited file.</li>
<l... | 26,136 | 496,009 | 2022-11-14 23:26:22 | 12,395,024 | 75 | 2012-09-12 19:31:40 | 496,009 | 2020-05-14 01:28:07 | https://stackoverflow.com/q/12394166 | https://stackoverflow.com/a/12395024 | <p>After some thinking and research, the answer turned out to be trivial: <code>git rebase -i</code> takes the editor name from the well-known EDITOR/VISUAL environment variables, so overriding that to point to a non-interactive script does the job. </p>
<p>However, EDITOR/VISUAL applies indifferently to the list of c... | <p>After some thinking and research, the answer turned out to be trivial: <code>git rebase -i</code> takes the editor name from the well-known EDITOR/VISUAL environment variables, so overriding that to point to a non-interactive script does the job. </p> <p>However, EDITOR/VISUAL applies indifferently to the list of c... | 119, 531, 29934, 38756 | git, git-rebase, non-interactive, scripting | <h1>How do I run git rebase --interactive in non-interactive manner?</h1>
<p>Is it possible to do following?</p>
<ol>
<li>Make <code>git rebase --interactive</code> to just output standard boilerplate to a file, instead to outputting to a file and opening it in editor.</li>
<li>Let the user edit the file.</li>
<li>Let... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,475 | git | # How do I run git rebase --interactive in non-interactive manner?
Is it possible to do following?
1. Make `git rebase --interactive` to just output standard boilerplate to a file, instead to outputting to a file and opening it in editor.
2. Let the user edit the file.
3. Let user re-run `git rebase` with the name of... | After some thinking and research, the answer turned out to be trivial: `git rebase -i` takes the editor name from the well-known EDITOR/VISUAL environment variables, so overriding that to point to a non-interactive script does the job.
However, EDITOR/VISUAL applies indifferently to the list of commits, commit message... |
9122948 | run git merge algorithm on two individual files | 82 | 2012-02-03 02:29:03 | <p>I want to take advantage of the git-merge algorithm on two arbitrary files in a git repo. Here is my working directory:</p>
<pre><code>folder/
file1
file2
</code></pre>
<p>file1 and file2 are similar, but I want to see how git would merge them as if they were different versions of the same file. In other w... | 48,295 | 10,608 | 2024-05-31 10:05:04 | 9,123,512 | 75 | 2012-02-03 04:04:07 | 119,963 | 2012-02-03 04:30:43 | https://stackoverflow.com/q/9122948 | https://stackoverflow.com/a/9123512 | <p>This doesn't really make sense, because you're not providing a common ancestor. If you do have one, however, you can use:</p>
<pre><code>git merge-file <current-version> <common-ancestor> <other-version>
</code></pre>
<p>This places the results in the current version file; if you want them elsewh... | <p>This doesn't really make sense, because you're not providing a common ancestor. If you do have one, however, you can use:</p> <pre><code>git merge-file <current-version> <common-ancestor> <other-version> </code></pre> <p>This places the results in the current version file; if you want them elsewh... | 119 | git | <h1>run git merge algorithm on two individual files</h1>
<p>I want to take advantage of the git-merge algorithm on two arbitrary files in a git repo. Here is my working directory:</p>
<pre><code>folder/
file1
file2
</code></pre>
<p>file1 and file2 are similar, but I want to see how git would merge them as if ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,476 | git | # run git merge algorithm on two individual files
I want to take advantage of the git-merge algorithm on two arbitrary files in a git repo. Here is my working directory:
```
folder/
file1
file2
```
file1 and file2 are similar, but I want to see how git would merge them as if they were different versions of t... | This doesn't really make sense, because you're not providing a common ancestor. If you do have one, however, you can use:
```
git merge-file <current-version> <common-ancestor> <other-version>
```
This places the results in the current version file; if you want them elsewhere, use:
```
git merge-file -p <current> <c... |
2586824 | Partial clone with Git and Mercurial | 76 | 2010-04-06 17:15:24 | <p>Is it possible to clone only one branch (or from a given commit) in Git and Mercurial? I mean, I want to clone a central repo but since it's huge I'd like to only get part of it and still be able to contribute back my changes. Is it possible? Like, I only want from Tag 130 onwards or something like that?</p>
<p>If ... | 30,550 | 72,456 | 2022-11-25 20:13:28 | 2,587,244 | 75 | 2010-04-06 18:16:54 | 46,058 | 2013-11-07 03:39:37 | https://stackoverflow.com/q/2586824 | https://stackoverflow.com/a/2587244 | <p>In Git land you are talking about three different types of partial clones:</p>
<ul>
<li><p><strong><em>shallow clones:</em></strong> I want history from revision point X onward.</p>
<p><strong>Use <code>git clone --depth <n> <url></code></strong> for that, but please remember that shallow clones are so... | <p>In Git land you are talking about three different types of partial clones:</p> <ul> <li><p><strong><em>shallow clones:</em></strong> I want history from revision point X onward.</p> <p><strong>Use <code>git clone --depth <n> <url></code></strong> for that, but please remember that shallow clones are so... | 119, 802 | git, mercurial | <h1>Partial clone with Git and Mercurial</h1>
<p>Is it possible to clone only one branch (or from a given commit) in Git and Mercurial? I mean, I want to clone a central repo but since it's huge I'd like to only get part of it and still be able to contribute back my changes. Is it possible? Like, I only want from Tag 1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,478 | git | # Partial clone with Git and Mercurial
Is it possible to clone only one branch (or from a given commit) in Git and Mercurial? I mean, I want to clone a central repo but since it's huge I'd like to only get part of it and still be able to contribute back my changes. Is it possible? Like, I only want from Tag 130 onward... | In Git land you are talking about three different types of partial clones:
- ***shallow clones:*** I want history from revision point X onward.
**Use `git clone --depth <n> <url>`** for that, but please remember that shallow clones are somewhat limited in interacting with other repositories. You would be able to ge... |
2217452 | In git, how do I create a single patch for the last 2+ revisions? | 76 | 2010-02-07 17:00:31 | <p>I would like to create a patch for the last 2 revisions.</p>
<pre><code>git format-patch -2
</code></pre>
<p>gives me 2 patch files, one for each revision</p>
<pre><code>git format-patch HEAD~2..HEAD
</code></pre>
<p>gives the same thing.</p>
<pre><code>git format-patch -1 HEAD~2..HEAD
</code></pre>
<p>gives a... | 56,984 | 105,084 | 2024-08-04 04:41:03 | 2,217,468 | 75 | 2010-02-07 17:04:10 | 229,753 | 2010-02-07 17:04:10 | https://stackoverflow.com/q/2217452 | https://stackoverflow.com/a/2217468 | <pre><code>git diff HEAD~2..HEAD > my-patch.diff
</code></pre>
<p>It won't have any of format-patch's per-commit metadata, though.</p>
| <pre><code>git diff HEAD~2..HEAD > my-patch.diff </code></pre> <p>It won't have any of format-patch's per-commit metadata, though.</p> | 119, 2132 | git, patch | <h1>In git, how do I create a single patch for the last 2+ revisions?</h1>
<p>I would like to create a patch for the last 2 revisions.</p>
<pre><code>git format-patch -2
</code></pre>
<p>gives me 2 patch files, one for each revision</p>
<pre><code>git format-patch HEAD~2..HEAD
</code></pre>
<p>gives the same thing.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,479 | git | # In git, how do I create a single patch for the last 2+ revisions?
I would like to create a patch for the last 2 revisions.
```
git format-patch -2
```
gives me 2 patch files, one for each revision
```
git format-patch HEAD~2..HEAD
```
gives the same thing.
```
git format-patch -1 HEAD~2..HEAD
```
gives a singl... | ```
git diff HEAD~2..HEAD > my-patch.diff
```
It won't have any of format-patch's per-commit metadata, though. |
2428137 | How to rebase one Git repository onto another one? | 75 | 2010-03-11 19:47:01 | <p>I had one Git repository (A) which contains the development of a project until a certain point. Then I lost the USB stick this repo A was on. Luckily I had a backup of the latest commit, so I could create a new repository (B) later where I imported the latest project's state and continue development.
Now I recovered... | 45,235 | 291,823 | 2021-04-30 14:33:50 | 2,428,339 | 75 | 2010-03-11 20:15:31 | 19,750 | 2014-10-06 03:56:20 | https://stackoverflow.com/q/2428137 | https://stackoverflow.com/a/2428339 | <p>If A and B are not the same repo (you created B by using the latest working copy you had), you have to use a <a href="https://git.wiki.kernel.org/index.php/GraftPoint" rel="noreferrer">graft</a> to pretend that they have common history.</p>
<p>Let’s assume you’ve added A as a remote for B as per <a href="https://st... | <p>If A and B are not the same repo (you created B by using the latest working copy you had), you have to use a <a href="https://git.wiki.kernel.org/index.php/GraftPoint" rel="noreferrer">graft</a> to pretend that they have common history.</p> <p>Let’s assume you’ve added A as a remote for B as per <a href="https://st... | 119, 717, 7330, 8974 | git, merge, rebase, repository | <h1>How to rebase one Git repository onto another one?</h1>
<p>I had one Git repository (A) which contains the development of a project until a certain point. Then I lost the USB stick this repo A was on. Luckily I had a backup of the latest commit, so I could create a new repository (B) later where I imported the late... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,480 | git | # How to rebase one Git repository onto another one?
I had one Git repository (A) which contains the development of a project until a certain point. Then I lost the USB stick this repo A was on. Luckily I had a backup of the latest commit, so I could create a new repository (B) later where I imported the latest projec... | If A and B are not the same repo (you created B by using the latest working copy you had), you have to use a [graft](https://git.wiki.kernel.org/index.php/GraftPoint) to pretend that they have common history.
Let’s assume you’ve added A as a remote for B as per [VonC’s answer](https://stackoverflow.com/a/2428224), and... |
16208144 | How do I merge multiple branches into master? | 71 | 2013-04-25 06:47:30 | <pre><code> C---D =>b1
/
/ E---F =>b2
| /
A--B =======> master
| \
\ G---H =>b3
\
I---J =>b4
</code></pre>
<p>I want to merge <code>b1</code>,<code>b2</code>,<code>b3</code>,<code>b4</code> into <code>master</code>, is it possible merge at o... | 66,769 | 1,583,453 | 2013-04-27 12:35:02 | 16,238,928 | 75 | 2013-04-26 14:29:00 | 213,682 | 2013-04-26 14:35:45 | https://stackoverflow.com/q/16208144 | https://stackoverflow.com/a/16238928 | <p>Git's <code>merge</code> command supports multiple <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html#_merge_strategies" rel="noreferrer">merging strategies</a>. There are two strategies that can merge more than two branches at a time.</p>
<p>See also this <a href="https://stackoverflow.com/qu... | <p>Git's <code>merge</code> command supports multiple <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html#_merge_strategies" rel="noreferrer">merging strategies</a>. There are two strategies that can merge more than two branches at a time.</p> <p>See also this <a href="https://stackoverflow.com/qu... | 119 | git | <h1>How do I merge multiple branches into master?</h1>
<pre><code> C---D =>b1
/
/ E---F =>b2
| /
A--B =======> master
| \
\ G---H =>b3
\
I---J =>b4
</code></pre>
<p>I want to merge <code>b1</code>,<code>b2</code>,<code>b3</code>,<code>b4</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,481 | git | # How do I merge multiple branches into master?
```
C---D =>b1
/
/ E---F =>b2
| /
A--B =======> master
| \
\ G---H =>b3
\
I---J =>b4
```
I want to merge `b1`,`b2`,`b3`,`b4` into `master`, is it possible merge at once?
something like:
```
git checkout m... | Git's `merge` command supports multiple [merging strategies](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html#_merge_strategies). There are two strategies that can merge more than two branches at a time.
See also this [question](https://stackoverflow.com/questions/366860/when-would-you-use-the-different... |
40274484 | Fatal: could not read username for 'https //github.com' device not configured | 70 | 2016-10-27 01:05:32 | <p>I am trying to push code to github with SublimeGit plugin, but something weird occurs to me.</p>
<blockquote>
<p>Pushing to <a href="https://github.com/username/username.github.io.git" rel="noreferrer">https://github.com/username/username.github.io.git</a></p>
<p>fatal: could not read Username for '<a href="... | 135,685 | 1,727,525 | 2024-10-04 14:55:21 | 40,274,775 | 75 | 2016-10-27 01:39:34 | 147,356 | 2016-10-27 01:39:34 | https://stackoverflow.com/q/40274484 | https://stackoverflow.com/a/40274775 | <p>You get that error (<code>fatal: could not read Username for 'https://github.com': Device not configured</code>) when <code>git</code> needs to ask for a username or password and (a) the only mechanism available to it is to ask on the console and (b) there is no console available (git is not attached to a tty device... | <p>You get that error (<code>fatal: could not read Username for 'https://github.com': Device not configured</code>) when <code>git</code> needs to ask for a username or password and (a) the only mechanism available to it is to ask on the console and (b) there is no console available (git is not attached to a tty device... | 119, 88190, 97815 | git, sublimetext3, sublime-text-plugin | <h1>Fatal: could not read username for 'https //github.com' device not configured</h1>
<p>I am trying to push code to github with SublimeGit plugin, but something weird occurs to me.</p>
<blockquote>
<p>Pushing to <a href="https://github.com/username/username.github.io.git" rel="noreferrer">https://github.com/userna... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,482 | git | # Fatal: could not read username for 'https //github.com' device not configured
I am trying to push code to github with SublimeGit plugin, but something weird occurs to me.
> Pushing to <https://github.com/username/username.github.io.git>
>
> fatal: could not read Username for '<https://github.com>': Device not confi... | You get that error (`fatal: could not read Username for 'https://github.com': Device not configured`) when `git` needs to ask for a username or password and (a) the only mechanism available to it is to ask on the console and (b) there is no console available (git is not attached to a tty device, i.e., you're not runnin... |
39877748 | git diff: what is the difference between --cached and --staged | 70 | 2016-10-05 15:11:03 | <p>To compare the staged with the last commit:</p>
<pre><code>git diff --cached
git diff --staged
</code></pre>
<p>Both commands generate the same results, right?</p>
| 17,257 | 2,846,062 | 2024-02-18 21:39:06 | 39,877,896 | 75 | 2016-10-05 15:18:29 | 293,494 | 2024-02-18 21:39:06 | https://stackoverflow.com/q/39877748 | https://stackoverflow.com/a/39877896 | <p>The documentation for <code>git diff</code> says "<code>--staged</code> is a synonym of <code>--cached</code>", so yes.</p>
| <p>The documentation for <code>git diff</code> says "<code>--staged</code> is a synonym of <code>--cached</code>", so yes.</p> | 119, 9033 | git, git-diff | <h1>git diff: what is the difference between --cached and --staged</h1>
<p>To compare the staged with the last commit:</p>
<pre><code>git diff --cached
git diff --staged
</code></pre>
<p>Both commands generate the same results, right?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,483 | git | # git diff: what is the difference between --cached and --staged
To compare the staged with the last commit:
```
git diff --cached
git diff --staged
```
Both commands generate the same results, right? | The documentation for `git diff` says "`--staged` is a synonym of `--cached`", so yes. |
15454555 | How can I completely empty the master branch in Git? | 66 | 2013-03-16 20:47:42 | <p>I would like to completely empty the master branch in Git. For now, I would also like to keep all other branches which have been branched from master.</p>
<p>Is this possible and how?</p>
| 97,549 | 1,189,880 | 2021-06-13 15:05:52 | 15,454,661 | 75 | 2013-03-16 20:58:11 | 390,363 | 2013-03-16 20:58:11 | https://stackoverflow.com/q/15454555 | https://stackoverflow.com/a/15454661 | <p>That's actually called "delete old master branch and create new from scratch"</p>
<p>This will create a new master branch pointing to initial commit:</p>
<pre><code>git branch -D master
git checkout -b master <initial commit hash>
</code></pre>
<p>This will create a totally new master branch unrelated to wh... | <p>That's actually called "delete old master branch and create new from scratch"</p> <p>This will create a new master branch pointing to initial commit:</p> <pre><code>git branch -D master git checkout -b master <initial commit hash> </code></pre> <p>This will create a totally new master branch unrelated to wh... | 119, 76220 | git, git-branch | <h1>How can I completely empty the master branch in Git?</h1>
<p>I would like to completely empty the master branch in Git. For now, I would also like to keep all other branches which have been branched from master.</p>
<p>Is this possible and how?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,484 | git | # How can I completely empty the master branch in Git?
I would like to completely empty the master branch in Git. For now, I would also like to keep all other branches which have been branched from master.
Is this possible and how? | That's actually called "delete old master branch and create new from scratch"
This will create a new master branch pointing to initial commit:
```
git branch -D master
git checkout -b master <initial commit hash>
```
This will create a totally new master branch unrelated to whatever you had:
```
git branch -D maste... |
5963597 | "git rebase origin" vs."git rebase origin/master" | 65 | 2011-05-11 11:39:14 | <p>I don't get the difference between <code>git rebase origin</code> and <code>git rebase origin/master</code>. In my case I cloned a git repository twice. In the first clone I have to use <code>git rebase origin</code> and in the other clone I must use <code>git rebase origin/master</code>.</p>
<p>An example: <a href... | 134,528 | 605,890 | 2018-04-10 07:44:12 | 5,964,697 | 75 | 2011-05-11 13:02:41 | 11,343 | 2018-04-10 07:44:12 | https://stackoverflow.com/q/5963597 | https://stackoverflow.com/a/5964697 | <p><code>git rebase origin</code> means "rebase from the tracking branch of <code>origin</code>", while <code>git rebase origin/master</code> means "rebase from the branch <code>master</code> of <code>origin</code>"</p>
<p>You must have a tracking branch in <code>~/Desktop/test</code>, which means that <code>git rebas... | <p><code>git rebase origin</code> means "rebase from the tracking branch of <code>origin</code>", while <code>git rebase origin/master</code> means "rebase from the branch <code>master</code> of <code>origin</code>"</p> <p>You must have a tracking branch in <code>~/Desktop/test</code>, which means that <code>git rebas... | 119, 29934 | git, git-rebase | <h1>"git rebase origin" vs."git rebase origin/master"</h1>
<p>I don't get the difference between <code>git rebase origin</code> and <code>git rebase origin/master</code>. In my case I cloned a git repository twice. In the first clone I have to use <code>git rebase origin</code> and in the other clone I must use <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,485 | git | # "git rebase origin" vs."git rebase origin/master"
I don't get the difference between `git rebase origin` and `git rebase origin/master`. In my case I cloned a git repository twice. In the first clone I have to use `git rebase origin` and in the other clone I must use `git rebase origin/master`.
An example: <http://... | `git rebase origin` means "rebase from the tracking branch of `origin`", while `git rebase origin/master` means "rebase from the branch `master` of `origin`"
You must have a tracking branch in `~/Desktop/test`, which means that `git rebase origin` knows which branch of `origin` to rebase with. If no tracking branch ex... |
3873839 | Why are there .sln, .suo and .csproj files? | 64 | 2010-10-06 14:56:57 | <p>I began to use Visual Studio 2010. After I'm done with the C# program, I see that there are <code>.sln</code>, and <code>.suo</code> files in the project root directory, and a <code>.csproj</code> file in the subdirectory. What are those files for? </p>
<p>I need to identify the files to put into a Git repository. ... | 64,024 | 260,127 | 2021-10-20 01:43:37 | 3,873,854 | 75 | 2010-10-06 14:58:50 | 34,397 | 2010-10-06 14:58:50 | https://stackoverflow.com/q/3873839 | https://stackoverflow.com/a/3873854 | <p>You should commit the <code>.sln</code> and the <code>.csproj</code>, but not the <code>.suo</code> or the <code>.user</code> files.</p>
<p>You can add the following to <code>.gitignore</code>:</p>
<pre><code>#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.u... | <p>You should commit the <code>.sln</code> and the <code>.csproj</code>, but not the <code>.suo</code> or the <code>.user</code> files.</p> <p>You can add the following to <code>.gitignore</code>:</p> <pre><code>#ignore thumbnails created by windows Thumbs.db #Ignore files build by Visual Studio *.obj *.exe *.pdb *.u... | 119, 33953 | git, visual-studio | <h1>Why are there .sln, .suo and .csproj files?</h1>
<p>I began to use Visual Studio 2010. After I'm done with the C# program, I see that there are <code>.sln</code>, and <code>.suo</code> files in the project root directory, and a <code>.csproj</code> file in the subdirectory. What are those files for? </p>
<p>I need... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,486 | git | # Why are there .sln, .suo and .csproj files?
I began to use Visual Studio 2010. After I'm done with the C# program, I see that there are `.sln`, and `.suo` files in the project root directory, and a `.csproj` file in the subdirectory. What are those files for?
I need to identify the files to put into a Git repositor... | You should commit the `.sln` and the `.csproj`, but not the `.suo` or the `.user` files.
You can add the following to `.gitignore`:
```
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*... |
5127178 | .gitignore files added inside Git submodules | 61 | 2011-02-26 13:30:24 | <p>I recently reorganized my dotfiles to live inside a Git repository at <code>~/Dropbox/dotfiles</code> and I'm using pathogen to bundle all Vim addons inside <code>~/Dropbox/dotfiles/home/.vim/bundle</code>. These addons were added as Git submodules.</p>
<p>Now the problem is, when I run Vim, it automatically genera... | 22,116 | 279,024 | 2020-06-06 12:17:52 | 5,127,213 | 75 | 2011-02-26 13:36:59 | 6,309 | 2020-06-06 12:17:52 | https://stackoverflow.com/q/5127178 | https://stackoverflow.com/a/5127213 | <p>You should add <code>.gitignore</code> within each of your submodules.<br>
Since said submodules are like nested Git repo, they take care of their own ignore rules, and their status wouldn't be influenced by the <code>.gitignore</code> of the parent repo (as <a href="https://stackoverflow.com/questions/1462754/what-... | <p>You should add <code>.gitignore</code> within each of your submodules.<br> Since said submodules are like nested Git repo, they take care of their own ignore rules, and their status wouldn't be influenced by the <code>.gitignore</code> of the parent repo (as <a href="https://stackoverflow.com/questions/1462754/what-... | 119, 370, 25056, 41612 | git, gitignore, git-submodules, vim | <h1>.gitignore files added inside Git submodules</h1>
<p>I recently reorganized my dotfiles to live inside a Git repository at <code>~/Dropbox/dotfiles</code> and I'm using pathogen to bundle all Vim addons inside <code>~/Dropbox/dotfiles/home/.vim/bundle</code>. These addons were added as Git submodules.</p>
<p>Now t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,487 | git | # .gitignore files added inside Git submodules
I recently reorganized my dotfiles to live inside a Git repository at `~/Dropbox/dotfiles` and I'm using pathogen to bundle all Vim addons inside `~/Dropbox/dotfiles/home/.vim/bundle`. These addons were added as Git submodules.
Now the problem is, when I run Vim, it auto... | You should add `.gitignore` within each of your submodules.
Since said submodules are like nested Git repo, they take care of their own ignore rules, and their status wouldn't be influenced by the `.gitignore` of the parent repo (as [explained here](https://stackoverflow.com/questions/1462754/what-is-the-advantage-of... |
17832850 | What does 'git fetch -p' (or --prune) mean | 51 | 2013-07-24 11:35:50 | <p>I had run this command with misunderstandings while I was deleting my one local branch,</p>
<pre><code>git branch -D branch-name
git fetch -p
</code></pre>
<p>but I have seen their is a list of branch names that are showing to be deleted.</p>
<p>I was afraid to see the list of deleted branches list, and thinkin... | 35,686 | 822,580 | 2022-03-16 16:22:46 | 17,833,002 | 75 | 2013-07-24 11:42:12 | 216,074 | 2013-07-24 11:42:12 | https://stackoverflow.com/q/17832850 | https://stackoverflow.com/a/17833002 | <p>When you fetch a remote repository, say “origin”, you will get <em>remote branches</em> for each branch that exists on that remote repository. Those branches are locally stored as <code><remote>/<branch></code>.</p>
<p>So assume origin has branches <code>master</code>, <code>featureX</code> and <code>fe... | <p>When you fetch a remote repository, say “origin”, you will get <em>remote branches</em> for each branch that exists on that remote repository. Those branches are locally stored as <code><remote>/<branch></code>.</p> <p>So assume origin has branches <code>master</code>, <code>featureX</code> and <code>fe... | 119 | git | <h1>What does 'git fetch -p' (or --prune) mean</h1>
<p>I had run this command with misunderstandings while I was deleting my one local branch,</p>
<pre><code>git branch -D branch-name
git fetch -p
</code></pre>
<p>but I have seen their is a list of branch names that are showing to be deleted.</p>
<p>I was afraid t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,489 | git | # What does 'git fetch -p' (or --prune) mean
I had run this command with misunderstandings while I was deleting my one local branch,
```
git branch -D branch-name
git fetch -p
```
but I have seen their is a list of branch names that are showing to be deleted.
I was afraid to see the list of deleted branches list, ... | When you fetch a remote repository, say “origin”, you will get *remote branches* for each branch that exists on that remote repository. Those branches are locally stored as `<remote>/<branch>`.
So assume origin has branches `master`, `featureX` and `featureY`. Then after fetching the following “remote branches” exist ... |
38664421 | How do I call git diff on the same file between 2 different local branches? | 44 | 2016-07-29 17:30:29 | <p>Is there a way to check the difference between the working directory in my current branch against the working directory of another branch in a specific file? For example, if I'm working in branch A on file 1, I want to compare the difference with file 1 on branch B.</p>
| 40,697 | 5,209,224 | 2018-07-12 16:47:59 | 38,664,474 | 75 | 2016-07-29 17:33:13 | 4,705,221 | 2016-07-29 17:33:13 | https://stackoverflow.com/q/38664421 | https://stackoverflow.com/a/38664474 | <p>Use the git diff branch branch filename syntax:</p>
<pre><code>git diff branchA branchB -- file.cs
</code></pre>
<p>put the two names of your branches and optionally use the <code>-- filename</code> option to specify one file! Good luck, let me know if you have issues. </p>
| <p>Use the git diff branch branch filename syntax:</p> <pre><code>git diff branchA branchB -- file.cs </code></pre> <p>put the two names of your branches and optionally use the <code>-- filename</code> option to specify one file! Good luck, let me know if you have issues. </p> | 119, 606, 9033, 10201, 76220 | diff, git, git-branch, git-diff, working-directory | <h1>How do I call git diff on the same file between 2 different local branches?</h1>
<p>Is there a way to check the difference between the working directory in my current branch against the working directory of another branch in a specific file? For example, if I'm working in branch A on file 1, I want to compare the d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,491 | git | # How do I call git diff on the same file between 2 different local branches?
Is there a way to check the difference between the working directory in my current branch against the working directory of another branch in a specific file? For example, if I'm working in branch A on file 1, I want to compare the difference... | Use the git diff branch branch filename syntax:
```
git diff branchA branchB -- file.cs
```
put the two names of your branches and optionally use the `-- filename` option to specify one file! Good luck, let me know if you have issues. |
43268751 | How to disable git for some project and other project not disable git in Visual Studio Code? | 41 | 2017-04-07 02:36:10 | <p>some project i don't want use git monitoring , but in other project i want to keep use git monitoring , i use setting</p>
<pre><code>"git.enabled": false,
"git.path": null,
"git.autofetch": false
</code></pre>
<p>but it will disable git for all project , so how to setting Visual Studio Code git for project instead... | 51,036 | 6,092,840 | 2024-05-30 09:46:06 | 43,286,241 | 75 | 2017-04-07 20:02:09 | 7,070,391 | 2017-04-07 20:02:09 | https://stackoverflow.com/q/43268751 | https://stackoverflow.com/a/43286241 | <p>You could add your git settings to the workspace settings.json file. That way, vscode would ignore git changes for only that project. Create or add to the .vscode/settings.json file.</p>
<pre><code>"git.enabled": false
</code></pre>
<p>This way all of your other project will continue have git enabled.</p>
| <p>You could add your git settings to the workspace settings.json file. That way, vscode would ignore git changes for only that project. Create or add to the .vscode/settings.json file.</p> <pre><code>"git.enabled": false </code></pre> <p>This way all of your other project will continue have git enabled.</p> | 119, 5025, 111608 | editor, git, visual-studio-code | <h1>How to disable git for some project and other project not disable git in Visual Studio Code?</h1>
<p>some project i don't want use git monitoring , but in other project i want to keep use git monitoring , i use setting</p>
<pre><code>"git.enabled": false,
"git.path": null,
"git.autofetch": false
</code></pre>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,492 | git | # How to disable git for some project and other project not disable git in Visual Studio Code?
some project i don't want use git monitoring , but in other project i want to keep use git monitoring , i use setting
```
"git.enabled": false,
"git.path": null,
"git.autofetch": false
```
but it will disable git for all p... | You could add your git settings to the workspace settings.json file. That way, vscode would ignore git changes for only that project. Create or add to the .vscode/settings.json file.
```
"git.enabled": false
```
This way all of your other project will continue have git enabled. |
32335459 | git ignore filenames which contain <pattern to ignore> | 40 | 2015-09-01 15:26:16 | <p>I am trying to tell git to ignore files which have <code>_autosave</code> somewhere in the filename. An example of such a file is:</p>
<p><code>hats/TFCB_ATV_TOP_HAT/_autosave-TFCB_ATV_HAT.kicad_pcb</code></p>
<p>In a regular expression, I would simply use the pattern <code>^.*_autosave.*</code></p>
<p>Of course, g... | 35,129 | 4,496,006 | 2021-02-23 17:19:34 | 32,335,752 | 75 | 2015-09-01 15:41:17 | 1,157,272 | 2015-09-02 08:18:27 | https://stackoverflow.com/q/32335459 | https://stackoverflow.com/a/32335752 | <p>Add this line to your <code>.gitignore</code></p>
<pre><code>*_autosave*
</code></pre>
<p>According to <code>git help gitignore</code></p>
<blockquote>
<p>patterns match relative to the location of the .gitignore file</p>
</blockquote>
<p>Patternz like <code>*_autosave*</code> match files or directories containing &... | <p>Add this line to your <code>.gitignore</code></p> <pre><code>*_autosave* </code></pre> <p>According to <code>git help gitignore</code></p> <blockquote> <p>patterns match relative to the location of the .gitignore file</p> </blockquote> <p>Patternz like <code>*_autosave*</code> match files or directories containing &... | 119, 25056 | git, gitignore | <h1>git ignore filenames which contain <pattern to ignore></h1>
<p>I am trying to tell git to ignore files which have <code>_autosave</code> somewhere in the filename. An example of such a file is:</p>
<p><code>hats/TFCB_ATV_TOP_HAT/_autosave-TFCB_ATV_HAT.kicad_pcb</code></p>
<p>In a regular expression, I would simply... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,493 | git | # git ignore filenames which contain
I am trying to tell git to ignore files which have `_autosave` somewhere in the filename. An example of such a file is:
`hats/TFCB_ATV_TOP_HAT/_autosave-TFCB_ATV_HAT.kicad_pcb`
In a regular expression, I would simply use the pattern `^.*_autosave.*`
Of course, git doesn't use re... | Add this line to your `.gitignore`
```
*_autosave*
```
According to `git help gitignore`
> patterns match relative to the location of the .gitignore file
Patternz like `*_autosave*` match files or directories containing "_autosave" somewhere in the name.
> Two consecutive asterisks ("**") in patterns mathed agains... |
16779929 | How do I make to some of the files that I have changed is not offered in the commit? | 36 | 2013-05-27 20:11:27 | <p>I use TortoiseGit 1.8.3.
I changed one of the files: Makefile, but I want to not offer commit it to me every once in a Git Commit.
I added it to the "delete and add to ignore list", but it does not help.
How do I make to some of the files that I have changed is not offered in the commit?</p>
<p>I want, that Makefil... | 20,318 | 1,558,037 | 2019-06-01 13:22:40 | 33,412,590 | 75 | 2015-10-29 11:09:46 | 4,823,151 | 2015-10-29 13:13:34 | https://stackoverflow.com/q/16779929 | https://stackoverflow.com/a/33412590 | <p>Answer for TortoiseGit 1.8.15, Git 2.6.1. There is no need to revert to the command line, all functions are directly available in TortoiseGit. I've tried to summarize the various ways how this function is accessible.
I assume that the reader knows what "assume unchanged" means. <a href="http://gitready.com/intermedi... | <p>Answer for TortoiseGit 1.8.15, Git 2.6.1. There is no need to revert to the command line, all functions are directly available in TortoiseGit. I've tried to summarize the various ways how this function is accessible. I assume that the reader knows what "assume unchanged" means. <a href="http://gitready.com/intermedi... | 31409 | tortoisegit | <h1>How do I make to some of the files that I have changed is not offered in the commit?</h1>
<p>I use TortoiseGit 1.8.3.
I changed one of the files: Makefile, but I want to not offer commit it to me every once in a Git Commit.
I added it to the "delete and add to ignore list", but it does not help.
How do I make to so... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,494 | git | # How do I make to some of the files that I have changed is not offered in the commit?
I use TortoiseGit 1.8.3.
I changed one of the files: Makefile, but I want to not offer commit it to me every once in a Git Commit.
I added it to the "delete and add to ignore list", but it does not help.
How do I make to some of the... | Answer for TortoiseGit 1.8.15, Git 2.6.1. There is no need to revert to the command line, all functions are directly available in TortoiseGit. I've tried to summarize the various ways how this function is accessible.
I assume that the reader knows what "assume unchanged" means. [Here is easy documentation](http://gitre... |
30268332 | Why does the Linux kernel repository have only one branch? | 33 | 2015-05-15 20:37:35 | <p>I'm a Linux beginner, so forgive me if this is the most obvious question you've ever heard.</p>
<p><a href="https://github.com/torvalds/linux/branches/all" rel="noreferrer">https://github.com/torvalds/linux/branches/all</a></p>
| 26,169 | 4,031,371 | 2017-09-19 10:56:26 | 30,268,416 | 75 | 2015-05-15 20:43:52 | 3,866,447 | 2017-09-19 10:56:26 | https://stackoverflow.com/q/30268332 | https://stackoverflow.com/a/30268416 | <h2>Mainline kernel</h2>
<p>First of all: don't use that github link (it's just a mirror). The actual repositories are located at <a href="https://kernel.org/" rel="noreferrer">kernel.org</a>. You probably want to use Linus Torvalds' tree, which is <a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.gi... | <h2>Mainline kernel</h2> <p>First of all: don't use that github link (it's just a mirror). The actual repositories are located at <a href="https://kernel.org/" rel="noreferrer">kernel.org</a>. You probably want to use Linus Torvalds' tree, which is <a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.gi... | 58, 119, 758, 21990 | git, linux, linux-kernel, workflow | <h1>Why does the Linux kernel repository have only one branch?</h1>
<p>I'm a Linux beginner, so forgive me if this is the most obvious question you've ever heard.</p>
<p><a href="https://github.com/torvalds/linux/branches/all" rel="noreferrer">https://github.com/torvalds/linux/branches/all</a></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,495 | git | # Why does the Linux kernel repository have only one branch?
I'm a Linux beginner, so forgive me if this is the most obvious question you've ever heard.
<https://github.com/torvalds/linux/branches/all> | ## Mainline kernel
First of all: don't use that github link (it's just a mirror). The actual repositories are located at [kernel.org](https://kernel.org/). You probably want to use Linus Torvalds' tree, which is [torvalds/linux.git](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/).
It's called **main... |
36433572 | How does ancestry path work with git log? | 31 | 2016-04-05 17:52:57 | <p>I've read the <a href="https://git-scm.com/docs/git-log">git log documentation</a>, but I still find it very difficult to understand what the <code>--ancestry-path</code> option does. I see different ways to invoke <code>git log</code>:</p>
<pre><code>$ git log origin/master..HEAD
$ git log --ancestry-path origin/m... | 13,132 | 157,971 | 2024-12-23 21:18:03 | 36,437,843 | 75 | 2016-04-05 22:01:11 | 1,256,452 | 2020-12-09 08:20:16 | https://stackoverflow.com/q/36433572 | https://stackoverflow.com/a/36437843 | <p><a href="https://stackoverflow.com/a/36433669/1256452">Matthieu Moy's answer</a> is correct but may not help you very much, if you haven't been exposed to the necessary graph theory.</p>
<h3>DAGs</h3>
<p>First, let's take a quick look at <strong>D</strong>irected <strong>A</strong>cyclic <strong>G</strong>raphs or D... | <p><a href="https://stackoverflow.com/a/36433669/1256452">Matthieu Moy's answer</a> is correct but may not help you very much, if you haven't been exposed to the necessary graph theory.</p> <h3>DAGs</h3> <p>First, let's take a quick look at <strong>D</strong>irected <strong>A</strong>cyclic <strong>G</strong>raphs or D... | 119 | git | <h1>How does ancestry path work with git log?</h1>
<p>I've read the <a href="https://git-scm.com/docs/git-log">git log documentation</a>, but I still find it very difficult to understand what the <code>--ancestry-path</code> option does. I see different ways to invoke <code>git log</code>:</p>
<pre><code>$ git log ori... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,496 | git | # How does ancestry path work with git log?
I've read the [git log documentation](https://git-scm.com/docs/git-log), but I still find it very difficult to understand what the `--ancestry-path` option does. I see different ways to invoke `git log`:
```
$ git log origin/master..HEAD
$ git log --ancestry-path origin/mas... | [Matthieu Moy's answer](https://stackoverflow.com/a/36433669/1256452) is correct but may not help you very much, if you haven't been exposed to the necessary graph theory.
### DAGs
First, let's take a quick look at **D**irected **A**cyclic **G**raphs or DAGs. A DAG is just a graph (hence the `g`), i.e., a collection ... |
23708231 | git shallow clone (clone --depth) misses remote branches | 229 | 2014-05-17 06:13:58 | <p>After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: </p>
<pre><code>$ git clone --depth 1 git://git.savannah.gnu.org/pythonwebkit.git
$ cd pythonwebkit
$ git branch -a
* master
remo... | 128,785 | 362,754 | 2025-06-23 19:55:44 | 23,710,503 | 74 | 2014-05-17 11:01:44 | 432,696 | 2014-05-19 18:56:35 | https://stackoverflow.com/q/23708231 | https://stackoverflow.com/a/23710503 | <p>The behavior is correct, after the last revision the master-branch is (since this is the primary remote's HEAD) the only remote-branch in the repository:</p>
<pre><code>florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
</code></pre>
<p>The fu... | <p>The behavior is correct, after the last revision the master-branch is (since this is the primary remote's HEAD) the only remote-branch in the repository:</p> <pre><code>florianb$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master </code></pre> <p>The fu... | 119, 1879, 74346 | branch, git, shallow-clone | <h1>git shallow clone (clone --depth) misses remote branches</h1>
<p>After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: </p>
<pre><code>$ git clone --depth 1 git://git.savannah.gnu.org/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,498 | git | # git shallow clone (clone --depth) misses remote branches
After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown:
```
$ git clone --depth 1 git://git.savannah.gnu.org/pythonwebkit.git
$ cd... | The behavior is correct, after the last revision the master-branch is (since this is the primary remote's HEAD) the only remote-branch in the repository:
```
florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
```
The full clone offers new (all) bran... |
19151247 | Ignoring folder meta files on version control | 79 | 2013-10-03 05:12:39 | <p>Unity creates and deletes meta files for <em>folders</em> inside the Asset folder.</p>
<p>That can create an annoying situation when using version control (that you can skip and go to the questions): someone creates a folder of files that will be ignored but forget to ignore the folder's meta file. Unity creates th... | 66,678 | 534,006 | 2022-02-15 23:02:12 | 19,157,675 | 74 | 2013-10-03 11:10:56 | 437,283 | 2017-11-03 21:05:08 | https://stackoverflow.com/q/19151247 | https://stackoverflow.com/a/19157675 | <p>The <a href="http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html" rel="noreferrer">Unity docs</a> say:</p>
<blockquote>
<p>When creating new assets, make sure both the asset itself and the associated .meta file is added to version control. </p>
</blockquote>
<p>For me this is re... | <p>The <a href="http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html" rel="noreferrer">Unity docs</a> say:</p> <blockquote> <p>When creating new assets, make sure both the asset itself and the associated .meta file is added to version control. </p> </blockquote> <p>For me this is re... | 119, 456, 802, 28511 | git, mercurial, unity-game-engine, version-control | <h1>Ignoring folder meta files on version control</h1>
<p>Unity creates and deletes meta files for <em>folders</em> inside the Asset folder.</p>
<p>That can create an annoying situation when using version control (that you can skip and go to the questions): someone creates a folder of files that will be ignored but fo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,500 | git | # Ignoring folder meta files on version control
Unity creates and deletes meta files for *folders* inside the Asset folder.
That can create an annoying situation when using version control (that you can skip and go to the questions): someone creates a folder of files that will be ignored but forget to ignore the fold... | The [Unity docs](http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html) say:
> When creating new assets, make sure both the asset itself and the associated .meta file is added to version control.
For me this is reason enough to put them under version control. I see two approaches to so... |
5176225 | Are Git's pack files deltas rather than snapshots? | 78 | 2011-03-03 03:09:05 | <p>One of the key differences between Git and most other version control systems is that the others tend to store commits as a series of deltas - changesets between one commit and the next. This seems logical, since it's the smallest possible amount of information to store about a commit. But the longer the commit hist... | 15,416 | 4,376 | 2021-01-17 03:16:43 | 5,576,688 | 74 | 2011-04-07 06:01:58 | 193,688 | 2020-02-17 11:05:42 | https://stackoverflow.com/q/5176225 | https://stackoverflow.com/a/5576688 | <p>Summary:<br>
Git’s pack files are carefully constructed to effectively use disk caches and
provide “nice” access patterns for common commands and for reading recently referenced
objects.</p>
<hr>
<p>Git’s pack file
format is quite flexible (see <a href="http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/t... | <p>Summary:<br> Git’s pack files are carefully constructed to effectively use disk caches and provide “nice” access patterns for common commands and for reading recently referenced objects.</p> <hr> <p>Git’s pack file format is quite flexible (see <a href="http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/t... | 119, 456, 6796 | git, internals, version-control | <h1>Are Git's pack files deltas rather than snapshots?</h1>
<p>One of the key differences between Git and most other version control systems is that the others tend to store commits as a series of deltas - changesets between one commit and the next. This seems logical, since it's the smallest possible amount of informa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,501 | git | # Are Git's pack files deltas rather than snapshots?
One of the key differences between Git and most other version control systems is that the others tend to store commits as a series of deltas - changesets between one commit and the next. This seems logical, since it's the smallest possible amount of information to s... | Summary:
Git’s pack files are carefully constructed to effectively use disk caches and
provide “nice” access patterns for common commands and for reading recently referenced
objects.
---
Git’s pack file
format is quite flexible (see [Documentation/technical/pack-format.txt](http://git.kernel.org/?p=git/git.git;a=bl... |
29882960 | Changing an existing submodule's branch | 77 | 2015-04-26 20:11:58 | <p>When I initially added my submodule, I specified a particular branch, as seen in the <code>.gitmodule</code> file:</p>
<pre><code>[submodule "externals/grpc/grpc"]
path = externals/grpc/grpc
url = git@github.com:me/grpc.git
branch = release-1.0
</code></pre>
<p>I want to change to the master branch of ... | 159,242 | 387,064 | 2025-03-28 14:46:01 | 29,882,995 | 74 | 2015-04-26 20:15:50 | 1,257,094 | 2015-04-26 20:15:50 | https://stackoverflow.com/q/29882960 | https://stackoverflow.com/a/29882995 | <p>Go into the directory where the submodule resides and <code>git checkout</code> the correct branch/commit. Then go up one level and <code>git add</code> and <code>git commit</code> the directory. This will check in the submodule with the correct commit.</p>
<p>And don't forget to run <code>git submodule update --re... | <p>Go into the directory where the submodule resides and <code>git checkout</code> the correct branch/commit. Then go up one level and <code>git add</code> and <code>git commit</code> the directory. This will check in the submodule with the correct commit.</p> <p>And don't forget to run <code>git submodule update --re... | 119, 41612 | git, git-submodules | <h1>Changing an existing submodule's branch</h1>
<p>When I initially added my submodule, I specified a particular branch, as seen in the <code>.gitmodule</code> file:</p>
<pre><code>[submodule "externals/grpc/grpc"]
path = externals/grpc/grpc
url = git@github.com:me/grpc.git
branch = release-1.0
</code></p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,502 | git | # Changing an existing submodule's branch
When I initially added my submodule, I specified a particular branch, as seen in the `.gitmodule` file:
```
[submodule "externals/grpc/grpc"]
path = externals/grpc/grpc
url = git@github.com:me/grpc.git
branch = release-1.0
```
I want to change to the master branc... | Go into the directory where the submodule resides and `git checkout` the correct branch/commit. Then go up one level and `git add` and `git commit` the directory. This will check in the submodule with the correct commit.
And don't forget to run `git submodule update --recursive` on the other clients after updating the... |
48699293 | How do I disable git-lfs? | 73 | 2018-02-09 05:31:42 | <p>I have a repository on bitbucket that is using LFS. Since using it for some time, I've decided to move the repository back to a space under my control. The only reason I used LFS in the first place was to effectively double my repository size limit (as files in LFS go in a separate bucket) but now I'm moving it, I n... | 91,996 | 1,594,286 | 2024-09-10 07:58:54 | 48,699,726 | 74 | 2018-02-09 06:09:18 | 1,594,286 | 2018-02-12 04:34:39 | https://stackoverflow.com/q/48699293 | https://stackoverflow.com/a/48699726 | <h1>Update current commit only</h1>
<p>If you want to move off LFS, but are not so worried about fixing the entire git history, you can do the following;</p>
<pre><code>git lfs uninstall
touch **/*
git commit -a
</code></pre>
<p>This will uninstall LFS support, touch every single file (so that git recognises that is... | <h1>Update current commit only</h1> <p>If you want to move off LFS, but are not so worried about fixing the entire git history, you can do the following;</p> <pre><code>git lfs uninstall touch **/* git commit -a </code></pre> <p>This will uninstall LFS support, touch every single file (so that git recognises that is... | 119, 115244 | git, git-lfs | <h1>How do I disable git-lfs?</h1>
<p>I have a repository on bitbucket that is using LFS. Since using it for some time, I've decided to move the repository back to a space under my control. The only reason I used LFS in the first place was to effectively double my repository size limit (as files in LFS go in a separate... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,503 | git | # How do I disable git-lfs?
I have a repository on bitbucket that is using LFS. Since using it for some time, I've decided to move the repository back to a space under my control. The only reason I used LFS in the first place was to effectively double my repository size limit (as files in LFS go in a separate bucket) ... | # Update current commit only
If you want to move off LFS, but are not so worried about fixing the entire git history, you can do the following;
```
git lfs uninstall
touch **/*
git commit -a
```
This will uninstall LFS support, touch every single file (so that git recognises that is has changed) then commit them all... |
18515488 | How to check if the commit exists in a Git repository by its SHA-1 | 70 | 2013-08-29 15:47:22 | <p>In a similar topic <a href="https://stackoverflow.com/questions/4127967/validate-if-commit-exists">Validate if commit exists</a> they recommend:</p>
<pre><code>git rev-list HEAD..$sha
</code></pre>
<p>If it exits without error code than the commit exists.</p>
<p>But is it efficient enough just for validation?</p>... | 47,957 | 1,522,942 | 2024-03-08 08:44:47 | 18,516,021 | 74 | 2013-08-29 16:12:30 | 711,380 | 2013-08-29 16:12:30 | https://stackoverflow.com/q/18515488 | https://stackoverflow.com/a/18516021 | <p>You can just run <code>git cat-file -t $sha</code> and check it returns "commit". You are right, you don't need to actually print the actual object for that...</p>
<p>I'm not 100% sure that what goes on behind the scene is more efficient, though.</p>
<p><code>test $(git cat-file -t $sha) == commit</code></p>
| <p>You can just run <code>git cat-file -t $sha</code> and check it returns "commit". You are right, you don't need to actually print the actual object for that...</p> <p>I'm not 100% sure that what goes on behind the scene is more efficient, though.</p> <p><code>test $(git cat-file -t $sha) == commit</code></p> | 119 | git | <h1>How to check if the commit exists in a Git repository by its SHA-1</h1>
<p>In a similar topic <a href="https://stackoverflow.com/questions/4127967/validate-if-commit-exists">Validate if commit exists</a> they recommend:</p>
<pre><code>git rev-list HEAD..$sha
</code></pre>
<p>If it exits without error code than th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,504 | git | # How to check if the commit exists in a Git repository by its SHA-1
In a similar topic [Validate if commit exists](https://stackoverflow.com/questions/4127967/validate-if-commit-exists) they recommend:
```
git rev-list HEAD..$sha
```
If it exits without error code than the commit exists.
But is it efficient enough... | You can just run `git cat-file -t $sha` and check it returns "commit". You are right, you don't need to actually print the actual object for that...
I'm not 100% sure that what goes on behind the scene is more efficient, though.
`test $(git cat-file -t $sha) == commit` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.