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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16217801 | Git rebase change author? | 105 | 2013-04-25 14:41:36 | <p>So I stupidly made 3 commits on a machine that was not configured for git (no author or email) and I want to change those 3 commits (have not been pushed) authors to what they are suppose to be.</p>
<p>I know <code>git commit --amend</code> can change the author, but how can I do it to 3? I know rebase can change t... | 90,811 | 150,062 | 2020-07-30 21:28:08 | 16,218,264 | 136 | 2013-04-25 15:02:13 | 1,275,165 | 2020-07-30 21:28:08 | https://stackoverflow.com/q/16217801 | https://stackoverflow.com/a/16218264 | <p>You can use interactive rebase. The answer from this post gives you an example:
<a href="https://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit">How to change the commit author for one specific commit?</a>.</p>
<p>In particular, you can do the following to change one specific commit:... | <p>You can use interactive rebase. The answer from this post gives you an example: <a href="https://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit">How to change the commit author for one specific commit?</a>.</p> <p>In particular, you can do the following to change one specific commit:... | 119 | git | <h1>Git rebase change author?</h1>
<p>So I stupidly made 3 commits on a machine that was not configured for git (no author or email) and I want to change those 3 commits (have not been pushed) authors to what they are suppose to be.</p>
<p>I know <code>git commit --amend</code> can change the author, but how can I do ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,539 | git | # Git rebase change author?
So I stupidly made 3 commits on a machine that was not configured for git (no author or email) and I want to change those 3 commits (have not been pushed) authors to what they are suppose to be.
I know `git commit --amend` can change the author, but how can I do it to 3? I know rebase can ... | You can use interactive rebase. The answer from this post gives you an example:
[How to change the commit author for one specific commit?](https://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit).
In particular, you can do the following to change one specific commit:
`git commit --amen... |
3845234 | Viewing Git history of moved files | 103 | 2010-10-02 10:12:44 | <p>Despite reading lots of other posts regarding GIT and moved files I still struggle to understand how to trace the full history. Doing <code>gitk myfile</code> as suggested <a href="https://stackoverflow.com/questions/278192/git-how-do-i-view-the-change-history-of-a-file">here</a> seems to only show history until th... | 30,036 | 160,356 | 2022-03-16 13:15:21 | 3,845,243 | 136 | 2010-10-02 10:17:32 | 893 | 2014-05-13 08:16:28 | https://stackoverflow.com/q/3845234 | https://stackoverflow.com/a/3845243 | <p>Try using the <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>--follow</code> option to <code>git log</code></a>:</p>
<pre><code>git log --follow file.txt
</code></pre>
| <p>Try using the <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>--follow</code> option to <code>git log</code></a>:</p> <pre><code>git log --follow file.txt </code></pre> | 119 | git | <h1>Viewing Git history of moved files</h1>
<p>Despite reading lots of other posts regarding GIT and moved files I still struggle to understand how to trace the full history. Doing <code>gitk myfile</code> as suggested <a href="https://stackoverflow.com/questions/278192/git-how-do-i-view-the-change-history-of-a-file">... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,540 | git | # Viewing Git history of moved files
Despite reading lots of other posts regarding GIT and moved files I still struggle to understand how to trace the full history. Doing `gitk myfile` as suggested [here](https://stackoverflow.com/questions/278192/git-how-do-i-view-the-change-history-of-a-file) seems to only show hist... | Try using the [`--follow` option to `git log`](http://git-scm.com/docs/git-log):
```
git log --follow file.txt
``` |
115399 | Converting a year from 4 digit to 2 digit and back again in C# | 79 | 2008-09-22 15:12:16 | <p>My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:</p>
<ol>
<li>I put a <code>DropDownList</code> of the 4-digit year on the page.</li>
<li>I validate the expiration date in a <code>DateTime</code> field to be sure that the expirati... | 205,328 | 2,535 | 2021-06-07 15:35:50 | 115,440 | 136 | 2008-09-22 15:17:53 | 15,860 | 2008-09-22 15:17:53 | https://stackoverflow.com/q/115399 | https://stackoverflow.com/a/115440 | <p>If you're creating a DateTime object using the expiration dates (month/year), you can use ToString() on your DateTime variable like so:</p>
<pre><code>DateTime expirationDate = new DateTime(2008, 1, 31); // random date
string lastTwoDigitsOfYear = expirationDate.ToString("yy");
</code></pre>
<p>Edit: Be careful wi... | <p>If you're creating a DateTime object using the expiration dates (month/year), you can use ToString() on your DateTime variable like so:</p> <pre><code>DateTime expirationDate = new DateTime(2008, 1, 31); // random date string lastTwoDigitsOfYear = expirationDate.ToString("yy"); </code></pre> <p>Edit: Be careful wi... | 9, 1263, 8016 | 2-digit-year, c#, datetime | <h1>Converting a year from 4 digit to 2 digit and back again in C#</h1>
<p>My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:</p>
<ol>
<li>I put a <code>DropDownList</code> of the 4-digit year on the page.</li>
<li>I validate the expir... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,541 | git | # Converting a year from 4 digit to 2 digit and back again in C#
My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:
1. I put a `DropDownList` of the 4-digit year on the page.
2. I validate the expiration date in a `DateTime` field to ... | If you're creating a DateTime object using the expiration dates (month/year), you can use ToString() on your DateTime variable like so:
```
DateTime expirationDate = new DateTime(2008, 1, 31); // random date
string lastTwoDigitsOfYear = expirationDate.ToString("yy");
```
Edit: Be careful with your dates though if you... |
37709298 | How to get changes from another branch | 280 | 2016-06-08 17:39:01 | <p>I am currently working on <code>featurex</code> branch. Our master branch is named <code>our-team</code>. Since I started working on <code>featurex</code>, more changes have been made to branch <code>our-team</code>.</p>
<p>I have done this locally to get all the latest changes from <code>our-team</code>:</p>
<pre><... | 554,171 | 654,203 | 2024-03-31 21:29:48 | 37,709,368 | 135 | 2016-06-08 17:42:41 | 2,504,617 | 2021-11-04 09:19:11 | https://stackoverflow.com/q/37709298 | https://stackoverflow.com/a/37709368 | <p>You can use <a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">rebase</a>, for instance, <code>git rebase our-team</code> when you are on your branch <code>featurex</code>.</p>
<p>It will move the start point of the branch at the end of your <code>our-team</code> branch, merging all changes in your <code... | <p>You can use <a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">rebase</a>, for instance, <code>git rebase our-team</code> when you are on your branch <code>featurex</code>.</p> <p>It will move the start point of the branch at the end of your <code>our-team</code> branch, merging all changes in your <code... | 119 | git | <h1>How to get changes from another branch</h1>
<p>I am currently working on <code>featurex</code> branch. Our master branch is named <code>our-team</code>. Since I started working on <code>featurex</code>, more changes have been made to branch <code>our-team</code>.</p>
<p>I have done this locally to get all the lates... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,544 | git | # How to get changes from another branch
I am currently working on `featurex` branch. Our master branch is named `our-team`. Since I started working on `featurex`, more changes have been made to branch `our-team`.
I have done this locally to get all the latest changes from `our-team`:
```
git checkout our-team
git p... | You can use [rebase](https://git-scm.com/docs/git-rebase), for instance, `git rebase our-team` when you are on your branch `featurex`.
It will move the start point of the branch at the end of your `our-team` branch, merging all changes in your `featurex` branch. |
39595034 | "Cannot 'squash' without a previous commit" error while rebase | 190 | 2016-09-20 13:09:47 | <p>I have the following in the to-do text of <code>git rebase -i HEAD~2</code>:</p>
<pre><code>pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link
# Rebase 684f917..e43ceba onto 684f917 (2 command(s))
#
...
</code></pre>
<p>Now, when I try to squash the first one(<code>56bcce7</code>) and pick th... | 195,440 | 4,993,513 | 2024-10-30 22:06:51 | 39,595,642 | 135 | 2016-09-20 13:36:11 | 6,394,138 | 2017-03-16 17:05:45 | https://stackoverflow.com/q/39595034 | https://stackoverflow.com/a/39595642 | <p>Interactive rebase presents commits in the reverse order of what you are used to when using <code>git log</code>. <code>git rebase -i</code> replays the selected commits in the exact (top-down) order they are listed in the saved rebase instructions file. When squashing, the commit selected for squashing is combined ... | <p>Interactive rebase presents commits in the reverse order of what you are used to when using <code>git log</code>. <code>git rebase -i</code> replays the selected commits in the exact (top-down) order they are listed in the saved rebase instructions file. When squashing, the commit selected for squashing is combined ... | 119, 8974 | git, rebase | <h1>"Cannot 'squash' without a previous commit" error while rebase</h1>
<p>I have the following in the to-do text of <code>git rebase -i HEAD~2</code>:</p>
<pre><code>pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link
# Rebase 684f917..e43ceba onto 684f917 (2 command(s))
#
...
</code></pre>
<p>N... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,545 | git | # "Cannot 'squash' without a previous commit" error while rebase
I have the following in the to-do text of `git rebase -i HEAD~2`:
```
pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link
# Rebase 684f917..e43ceba onto 684f917 (2 command(s))
#
...
```
Now, when I try to squash the first one(`56bc... | Interactive rebase presents commits in the reverse order of what you are used to when using `git log`. `git rebase -i` replays the selected commits in the exact (top-down) order they are listed in the saved rebase instructions file. When squashing, the commit selected for squashing is combined with the commit that prec... |
40479712 | How can I tell if a given git tag is annotated or lightweight? | 142 | 2016-11-08 05:36:29 | <p>I type <code>git tag</code> and it lists my current tags:</p>
<pre><code>1.2.3
1.2.4
</code></pre>
<p>How can I determine which of these is annotated, and which is lightweight?</p>
| 33,289 | 5,819,286 | 2023-05-12 11:36:19 | 40,499,437 | 135 | 2016-11-09 02:24:25 | 1,290,731 | 2023-05-12 11:36:19 | https://stackoverflow.com/q/40479712 | https://stackoverflow.com/a/40499437 | <p><a href="https://git-scm.com/docs/git-for-each-ref" rel="noreferrer"><code>git for-each-ref</code></a> tells you what each ref is to by default, its id and its type. To restrict it to just tags, do <code>git for-each-ref refs/tags</code>.</p>
<blockquote>
<p>[T]he output has three fields: The hash of an object, the ... | <p><a href="https://git-scm.com/docs/git-for-each-ref" rel="noreferrer"><code>git for-each-ref</code></a> tells you what each ref is to by default, its id and its type. To restrict it to just tags, do <code>git for-each-ref refs/tags</code>.</p> <blockquote> <p>[T]he output has three fields: The hash of an object, the ... | 119, 60718 | git, git-tag | <h1>How can I tell if a given git tag is annotated or lightweight?</h1>
<p>I type <code>git tag</code> and it lists my current tags:</p>
<pre><code>1.2.3
1.2.4
</code></pre>
<p>How can I determine which of these is annotated, and which is lightweight?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,546 | git | # How can I tell if a given git tag is annotated or lightweight?
I type `git tag` and it lists my current tags:
```
1.2.3
1.2.4
```
How can I determine which of these is annotated, and which is lightweight? | [`git for-each-ref`](https://git-scm.com/docs/git-for-each-ref) tells you what each ref is to by default, its id and its type. To restrict it to just tags, do `git for-each-ref refs/tags`.
> [T]he output has three fields: The hash of an object, the type of the object, and the name in refs/tags that refers to the objec... |
3580608 | "git diff" does nothing | 117 | 2010-08-27 00:51:48 | <p>I presume this is a configuration error somewhere, but I can't figure out where. Regular git commands appear to work fine, but "git diff" does nothing. To be safe, I removed external diff tools from my .gitconfig file. This was installed via MacPorts and is the lates version (1.7.2.2).</p>
<p>What I see is that ... | 81,998 | 26,624 | 2022-04-28 04:23:22 | 3,580,631 | 135 | 2010-08-27 00:59:42 | 119,271 | 2015-05-12 11:49:03 | https://stackoverflow.com/q/3580608 | https://stackoverflow.com/a/3580631 | <p>The default output for <code>git diff</code> is the list of changes which have not been committed / added to the index. If there are no changes, then there is no output.</p>
<blockquote>
<p><em>git diff [--options] [--] […]</em></p>
<p>This form is to view the changes you made relative to the index (staging ... | <p>The default output for <code>git diff</code> is the list of changes which have not been committed / added to the index. If there are no changes, then there is no output.</p> <blockquote> <p><em>git diff [--options] [--] […]</em></p> <p>This form is to view the changes you made relative to the index (staging ... | 119, 9033 | git, git-diff | <h1>"git diff" does nothing</h1>
<p>I presume this is a configuration error somewhere, but I can't figure out where. Regular git commands appear to work fine, but "git diff" does nothing. To be safe, I removed external diff tools from my .gitconfig file. This was installed via MacPorts and is the lates version (1.7.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,549 | git | # "git diff" does nothing
I presume this is a configuration error somewhere, but I can't figure out where. Regular git commands appear to work fine, but "git diff" does nothing. To be safe, I removed external diff tools from my .gitconfig file. This was installed via MacPorts and is the lates version (1.7.2.2).
What ... | The default output for `git diff` is the list of changes which have not been committed / added to the index. If there are no changes, then there is no output.
> *git diff [--options] [--] […]*
>
> This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the di... |
2688251 | What is the difference between `git fetch origin` and `git remote update origin`? | 117 | 2010-04-22 04:30:39 | <p>In response to <a href="https://stackoverflow.com/questions/2680426/how-to-pull-one-commit-at-a-time-from-a-remote-git-repository">a question about pulling one commit at a time from a git repository</a>, I was recommended to use <code>git remote update</code> instead of <code>git fetch</code>. I have read both man ... | 39,787 | 41,661 | 2010-04-22 05:33:19 | 2,688,397 | 135 | 2010-04-22 05:18:31 | 119,963 | 2010-04-22 05:33:19 | https://stackoverflow.com/q/2688251 | https://stackoverflow.com/a/2688397 | <p>It makes no difference when used like this.</p>
<p><code>remote update</code> is a very high-level command - it supports grouped remotes (<code>remotes.<group> = <list></code>), and updating all remotes (except those with <code>remote.<name>.skipDefaultUpdate</code> set), but not any of the more s... | <p>It makes no difference when used like this.</p> <p><code>remote update</code> is a very high-level command - it supports grouped remotes (<code>remotes.<group> = <list></code>), and updating all remotes (except those with <code>remote.<name>.skipDefaultUpdate</code> set), but not any of the more s... | 119 | git | <h1>What is the difference between `git fetch origin` and `git remote update origin`?</h1>
<p>In response to <a href="https://stackoverflow.com/questions/2680426/how-to-pull-one-commit-at-a-time-from-a-remote-git-repository">a question about pulling one commit at a time from a git repository</a>, I was recommended to u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,550 | git | # What is the difference between `git fetch origin` and `git remote update origin`?
In response to [a question about pulling one commit at a time from a git repository](https://stackoverflow.com/questions/2680426/how-to-pull-one-commit-at-a-time-from-a-remote-git-repository), I was recommended to use `git remote updat... | It makes no difference when used like this.
`remote update` is a very high-level command - it supports grouped remotes (`remotes.<group> = <list>`), and updating all remotes (except those with `remote.<name>.skipDefaultUpdate` set), but not any of the more specific options of fetch. Under the hood, though, it does the... |
22593087 | Merging a branch of a branch after first branch is squashed when merged to master | 107 | 2014-03-23 15:44:51 | <p>Here's a workflow that I commonly deal with at work.</p>
<pre><code>git checkout -b feature_branch
# Do some development
git add .
git commit
git push origin feature_branch
</code></pre>
<p>At this point the feature branch is up for review from my colleagues, but I want to keep developing on other features that ar... | 16,231 | 1,009,111 | 2021-10-29 12:27:22 | 22,593,321 | 135 | 2014-03-23 16:03:33 | 2,367,398 | 2014-03-23 16:23:25 | https://stackoverflow.com/q/22593087 | https://stackoverflow.com/a/22593321 | <p>A little bit about why this happens:</p>
<p>I'll let <code>O</code> be "original master" and <code>FB</code> be "new master", after a feature branch has been merged in:</p>
<p>Say <code>feature_branch</code> looks like:</p>
<pre><code>O - A - B - C
</code></pre>
<p><code>dependent_feature</code> has a few extra... | <p>A little bit about why this happens:</p> <p>I'll let <code>O</code> be "original master" and <code>FB</code> be "new master", after a feature branch has been merged in:</p> <p>Say <code>feature_branch</code> looks like:</p> <pre><code>O - A - B - C </code></pre> <p><code>dependent_feature</code> has a few extra... | 119, 42532, 95672 | arcanist, git, squash | <h1>Merging a branch of a branch after first branch is squashed when merged to master</h1>
<p>Here's a workflow that I commonly deal with at work.</p>
<pre><code>git checkout -b feature_branch
# Do some development
git add .
git commit
git push origin feature_branch
</code></pre>
<p>At this point the feature branch i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,551 | git | # Merging a branch of a branch after first branch is squashed when merged to master
Here's a workflow that I commonly deal with at work.
```
git checkout -b feature_branch
# Do some development
git add .
git commit
git push origin feature_branch
```
At this point the feature branch is up for review from my colleague... | A little bit about why this happens:
I'll let `O` be "original master" and `FB` be "new master", after a feature branch has been merged in:
Say `feature_branch` looks like:
```
O - A - B - C
```
`dependent_feature` has a few extra commits on top of that:
```
O - A - B - C - D - E - F
```
You merge your original f... |
2298047 | git ls-files: howto identify new files (added, not committed)? | 102 | 2010-02-19 16:50:08 | <p>After I called <code>git add <file></code> the command <code>git status</code> will show me something like:</p>
<pre><code>...
new file: <file>
</code></pre>
<p>Somehow I can't manage it to get the same information by using <code>ls-files</code>, it (<code>ls-files -tc</code> in this case) will show... | 183,664 | 52,444 | 2025-08-23 10:58:28 | 2,299,672 | 135 | 2010-02-19 21:20:35 | 24,762 | 2010-03-11 09:59:20 | https://stackoverflow.com/q/2298047 | https://stackoverflow.com/a/2299672 | <p>You want to use <code>git diff --cached</code>. With <code>--name-only</code> it'll list all the files you've changed in the index relative to HEAD. With <code>--name-status</code> you can get the status symbol too, with <code>--diff-filter</code> you can specify which set of files you want to show ('A' for newly ... | <p>You want to use <code>git diff --cached</code>. With <code>--name-only</code> it'll list all the files you've changed in the index relative to HEAD. With <code>--name-status</code> you can get the status symbol too, with <code>--diff-filter</code> you can specify which set of files you want to show ('A' for newly ... | 119 | git | <h1>git ls-files: howto identify new files (added, not committed)?</h1>
<p>After I called <code>git add <file></code> the command <code>git status</code> will show me something like:</p>
<pre><code>...
new file: <file>
</code></pre>
<p>Somehow I can't manage it to get the same information by using <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,552 | git | # git ls-files: howto identify new files (added, not committed)?
After I called `git add <file>` the command `git status` will show me something like:
```
...
new file: <file>
```
Somehow I can't manage it to get the same information by using `ls-files`, it (`ls-files -tc` in this case) will show me:
```
H <comm... | You want to use `git diff --cached`. With `--name-only` it'll list all the files you've changed in the index relative to HEAD. With `--name-status` you can get the status symbol too, with `--diff-filter` you can specify which set of files you want to show ('A' for newly added files, for instance). Use `-M` to turn on m... |
40224272 | Using a Jenkins pipeline to checkout multiple git repos into same job | 101 | 2016-10-24 17:36:08 | <p>I'm using the Jenkins Multiple SCM plugin to check out three git repositories into three sub directories in my Jenkins job. I then execute one set of commands to build a single set of artifacts with information and code drawn from all three repositories.</p>
<p>Multiple SCM is now depreciated, and the text recommen... | 157,961 | 69,455 | 2022-08-12 14:14:02 | 40,225,216 | 135 | 2016-10-24 18:36:15 | 7,030,983 | 2017-05-31 10:14:04 | https://stackoverflow.com/q/40224272 | https://stackoverflow.com/a/40225216 | <p>You can use the <code>dir</code> command to execute a pipeline step in a subdirectory:</p>
<pre class="lang-js prettyprint-override"><code>node('ATLAS && Linux') {
dir('CalibrationResults') {
git url: 'https://github.com/AtlasBID/CalibrationResults.git'
}
dir('Combination') {
git... | <p>You can use the <code>dir</code> command to execute a pipeline step in a subdirectory:</p> <pre class="lang-js prettyprint-override"><code>node('ATLAS && Linux') { dir('CalibrationResults') { git url: 'https://github.com/AtlasBID/CalibrationResults.git' } dir('Combination') { git... | 119, 64999, 118285 | git, jenkins, jenkins-pipeline | <h1>Using a Jenkins pipeline to checkout multiple git repos into same job</h1>
<p>I'm using the Jenkins Multiple SCM plugin to check out three git repositories into three sub directories in my Jenkins job. I then execute one set of commands to build a single set of artifacts with information and code drawn from all thr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,553 | git | # Using a Jenkins pipeline to checkout multiple git repos into same job
I'm using the Jenkins Multiple SCM plugin to check out three git repositories into three sub directories in my Jenkins job. I then execute one set of commands to build a single set of artifacts with information and code drawn from all three reposi... | You can use the `dir` command to execute a pipeline step in a subdirectory:
```
node('ATLAS && Linux') {
dir('CalibrationResults') {
git url: 'https://github.com/AtlasBID/CalibrationResults.git'
}
dir('Combination') {
git url: 'https://github.com/AtlasBID/Combination.git'
}
dir('Com... |
2545765 | How can I email someone a git repository? | 97 | 2010-03-30 14:00:21 | <p>I have tried:</p>
<pre><code>git archive HEAD --format=zip > archive.zip
</code></pre>
<p>:and then I email archive.zip and at the other end they unzip archive.zip into a folder. But when they try any git commands they find out that this does not produce a valid git repository</p>
| 36,851 | 190,822 | 2023-04-12 22:14:16 | 2,545,784 | 135 | 2010-03-30 14:03:01 | 6,309 | 2023-04-12 22:14:16 | https://stackoverflow.com/q/2545765 | https://stackoverflow.com/a/2545784 | <p>You could use <strong><a href="https://schacon.github.io/git/git-bundle.html" rel="noreferrer"><code>git bundle</code></a></strong> and email one single file</p>
<p>See "<a href="https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141">backing up project which uses git</a>&... | <p>You could use <strong><a href="https://schacon.github.io/git/git-bundle.html" rel="noreferrer"><code>git bundle</code></a></strong> and email one single file</p> <p>See "<a href="https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141">backing up project which uses git</a>&... | 119 | git | <h1>How can I email someone a git repository?</h1>
<p>I have tried:</p>
<pre><code>git archive HEAD --format=zip > archive.zip
</code></pre>
<p>:and then I email archive.zip and at the other end they unzip archive.zip into a folder. But when they try any git commands they find out that this does not produce a vali... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,554 | git | # How can I email someone a git repository?
I have tried:
```
git archive HEAD --format=zip > archive.zip
```
:and then I email archive.zip and at the other end they unzip archive.zip into a folder. But when they try any git commands they find out that this does not produce a valid git repository | You could use **[`git bundle`](https://schacon.github.io/git/git-bundle.html)** and email one single file
See "[backing up project which uses git](https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141)"
> A git bundle is just one file which can be very easily created and again ... |
2693640 | Aborted old git rebase and lost commits since the rebase started | 82 | 2010-04-22 19:02:48 | <p>About a week ago, I was rebasing some commits while trying to clean up my repository, and apparently I didn't actually finish it. Today, a week and several commits later, I went to rebase to reorder a few commits from today, and it told me I was already in the middle of a rebase.</p>
<p>That should have been a cue t... | 21,795 | 135,108 | 2022-12-29 03:54:25 | 2,693,668 | 135 | 2010-04-22 19:06:00 | 69,993 | 2014-03-31 16:20:34 | https://stackoverflow.com/q/2693640 | https://stackoverflow.com/a/2693668 | <p>Check <code>git reflog</code>. You can walk back in time using those commit hashes as a reference in almost all cases. </p>
<p>I'd also physically copy the git repo directory elsewhere as a place to do preliminary testing to see what will work, that way you can mess with whatever you want without losing untracked... | <p>Check <code>git reflog</code>. You can walk back in time using those commit hashes as a reference in almost all cases. </p> <p>I'd also physically copy the git repo directory elsewhere as a place to do preliminary testing to see what will work, that way you can mess with whatever you want without losing untracked... | 119, 29934 | git, git-rebase | <h1>Aborted old git rebase and lost commits since the rebase started</h1>
<p>About a week ago, I was rebasing some commits while trying to clean up my repository, and apparently I didn't actually finish it. Today, a week and several commits later, I went to rebase to reorder a few commits from today, and it told me I w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,556 | git | # Aborted old git rebase and lost commits since the rebase started
About a week ago, I was rebasing some commits while trying to clean up my repository, and apparently I didn't actually finish it. Today, a week and several commits later, I went to rebase to reorder a few commits from today, and it told me I was alread... | Check `git reflog`. You can walk back in time using those commit hashes as a reference in almost all cases.
I'd also physically copy the git repo directory elsewhere as a place to do preliminary testing to see what will work, that way you can mess with whatever you want without losing untracked files or getting things... |
22544305 | Git merge: accept theirs for multiple conflicts | 74 | 2014-03-20 20:26:46 | <p>I'm trying to merge a git branch (test-development) back into master. There are lots of merge conflicts but I want as many as possible to be resolved via --theirs. Is there a way to tell git to merge with --theirs in bulk?</p>
| 56,614 | 1,670,168 | 2023-08-01 02:04:54 | 22,544,803 | 135 | 2014-03-20 20:51:59 | 10,556 | 2023-08-01 02:04:54 | https://stackoverflow.com/q/22544305 | https://stackoverflow.com/a/22544803 | <p>This will do it (does not just resolve the conflicts but takes their version of the files) if you're mid-merge:</p>
<pre><code>git merge test-development
# Automatic merge failed, a bunch of conflicts!
git checkout --theirs ./path
git add ./path
git commit
</code></pre>
| <p>This will do it (does not just resolve the conflicts but takes their version of the files) if you're mid-merge:</p> <pre><code>git merge test-development # Automatic merge failed, a bunch of conflicts! git checkout --theirs ./path git add ./path git commit </code></pre> | 119, 717, 62599 | git, merge, merge-conflict-resolution | <h1>Git merge: accept theirs for multiple conflicts</h1>
<p>I'm trying to merge a git branch (test-development) back into master. There are lots of merge conflicts but I want as many as possible to be resolved via --theirs. Is there a way to tell git to merge with --theirs in bulk?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,557 | git | # Git merge: accept theirs for multiple conflicts
I'm trying to merge a git branch (test-development) back into master. There are lots of merge conflicts but I want as many as possible to be resolved via --theirs. Is there a way to tell git to merge with --theirs in bulk? | This will do it (does not just resolve the conflicts but takes their version of the files) if you're mid-merge:
```
git merge test-development
# Automatic merge failed, a bunch of conflicts!
git checkout --theirs ./path
git add ./path
git commit
``` |
15757023 | Access to a file or folder on heroku server | 62 | 2013-04-02 05:48:20 | <p>When I deploy my application on Heroku server, the server generate an app automatically and I found on my resource a git url. Example: <code>git@heroku.com:myapp-ss-1338.git</code>. How can I access this url to view source code or folder via a web browser?</p>
| 51,598 | 2,213,842 | 2020-06-15 11:39:33 | 15,773,391 | 135 | 2013-04-02 20:08:39 | 263,195 | 2015-03-11 10:00:54 | https://stackoverflow.com/q/15757023 | https://stackoverflow.com/a/15773391 | <p><code>heroku run bash</code> is the best way to see what is actually deployed to dynos. As for the git repo you should treat it more like a way to deploy your app (and so therefore ephemeral) than a place to store your code.</p>
<p>There is no way to view what is in that repo from your web browser.</p>
<p>If you w... | <p><code>heroku run bash</code> is the best way to see what is actually deployed to dynos. As for the git repo you should treat it more like a way to deploy your app (and so therefore ephemeral) than a place to store your code.</p> <p>There is no way to view what is in that repo from your web browser.</p> <p>If you w... | 17, 119, 8279 | git, heroku, java | <h1>Access to a file or folder on heroku server</h1>
<p>When I deploy my application on Heroku server, the server generate an app automatically and I found on my resource a git url. Example: <code>git@heroku.com:myapp-ss-1338.git</code>. How can I access this url to view source code or folder via a web browser?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,559 | git | # Access to a file or folder on heroku server
When I deploy my application on Heroku server, the server generate an app automatically and I found on my resource a git url. Example: `git@heroku.com:myapp-ss-1338.git`. How can I access this url to view source code or folder via a web browser? | `heroku run bash` is the best way to see what is actually deployed to dynos. As for the git repo you should treat it more like a way to deploy your app (and so therefore ephemeral) than a place to store your code.
There is no way to view what is in that repo from your web browser.
If you want to get at the files in t... |
3686452 | What are the differences between these git diff commands? | 62 | 2010-09-10 16:36:04 | <p>What are the differences between the following git commands?</p>
<ol>
<li><code>git diff HEAD</code></li>
<li><code>git diff HEAD^</code></li>
<li><code>git diff --cached</code> or the synonym <code>git diff --staged</code></li>
<li><code>git diff</code></li>
</ol>
| 16,556 | 95,592 | 2017-08-25 14:12:36 | 3,686,507 | 135 | 2010-09-10 16:42:52 | 148,870 | 2017-08-25 14:12:36 | https://stackoverflow.com/q/3686452 | https://stackoverflow.com/a/3686507 | <ol>
<li><code>git diff HEAD</code> - Shows what has changed since the last commit.</li>
<li><code>git diff HEAD^</code> - Shows what has changed since the commit <em>before</em> the latest commit.</li>
<li><code>git diff --cached</code> - Show what has been added to the index via <code>git add</code> but not yet comm... | <ol> <li><code>git diff HEAD</code> - Shows what has changed since the last commit.</li> <li><code>git diff HEAD^</code> - Shows what has changed since the commit <em>before</em> the latest commit.</li> <li><code>git diff --cached</code> - Show what has been added to the index via <code>git add</code> but not yet comm... | 119, 9033 | git, git-diff | <h1>What are the differences between these git diff commands?</h1>
<p>What are the differences between the following git commands?</p>
<ol>
<li><code>git diff HEAD</code></li>
<li><code>git diff HEAD^</code></li>
<li><code>git diff --cached</code> or the synonym <code>git diff --staged</code></li>
<li><code>git diff</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,560 | git | # What are the differences between these git diff commands?
What are the differences between the following git commands?
1. `git diff HEAD`
2. `git diff HEAD^`
3. `git diff --cached` or the synonym `git diff --staged`
4. `git diff` | 1. `git diff HEAD` - Shows what has changed since the last commit.
2. `git diff HEAD^` - Shows what has changed since the commit *before* the latest commit.
3. `git diff --cached` - Show what has been added to the index via `git add` but not yet committed.
4. `git diff` - Show what has changed but hasn't been added to ... |
44009551 | Is there a way to see git diff from origin/master using Visual Studio Code? | 137 | 2017-05-16 19:02:11 | <p>Using Visual Studio Code (version 1.11.2), I can see a side-by-side graphical diff of my current changes very easily by clicking the <em>Source Control</em> button in the left panel. But once I commit those changes to my local repository, I am unable to find a way to see the same side-by-side diff from origin/master... | 125,205 | 184,759 | 2023-02-19 02:16:56 | 44,711,528 | 134 | 2017-06-23 01:03:03 | 2,370,042 | 2020-08-13 08:17:37 | https://stackoverflow.com/q/44009551 | https://stackoverflow.com/a/44711528 | <p>You can use an extension for this.</p>
<p>Two good options:</p>
<p><strong>Gitlens:</strong> <a href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens" rel="noreferrer">https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens</a></p>
<p>With this one, you can use the <code>>GitLens: ... | <p>You can use an extension for this.</p> <p>Two good options:</p> <p><strong>Gitlens:</strong> <a href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens" rel="noreferrer">https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens</a></p> <p>With this one, you can use the <code>>GitLens: ... | 119, 13630, 111608 | git, meld, visual-studio-code | <h1>Is there a way to see git diff from origin/master using Visual Studio Code?</h1>
<p>Using Visual Studio Code (version 1.11.2), I can see a side-by-side graphical diff of my current changes very easily by clicking the <em>Source Control</em> button in the left panel. But once I commit those changes to my local repos... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,562 | git | # Is there a way to see git diff from origin/master using Visual Studio Code?
Using Visual Studio Code (version 1.11.2), I can see a side-by-side graphical diff of my current changes very easily by clicking the *Source Control* button in the left panel. But once I commit those changes to my local repository, I am unab... | You can use an extension for this.
Two good options:
**Gitlens:** <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>
With this one, you can use the `>GitLens: Open Changes with...` action to compare with any branch (local or remote).
You also can use **Git History**: <https://marketplace.visualst... |
11025980 | How to add /usr/local/bin in $PATH on Mac | 117 | 2012-06-14 02:44:35 | <p>When I do 'open .profile' in the terminal I have the following:</p>
<pre><code>export PATH=$PATH:/usr/local/git/bin
</code></pre>
<p>Now I installed node.js for Mac and it says, </p>
<blockquote>
<p>Make sure that /usr/local/bin is in your $PATH.</p>
</blockquote>
<p>How can I add <code>/usr/local/bin</code> ... | 250,523 | 119,198 | 2024-01-19 06:06:07 | 11,025,993 | 134 | 2012-06-14 02:47:26 | 797,049 | 2022-03-31 19:20:36 | https://stackoverflow.com/q/11025980 | https://stackoverflow.com/a/11025993 | <p>The <code>PATH</code> variable holds a list of directories separated by colons, so if you want to add more than one directory, just put a colon between them:</p>
<pre><code>export PATH=$PATH:/usr/local/git/bin:/usr/local/bin
</code></pre>
<p>That syntax works in any Bourne-compatible shell (sh, ksh, bash, zsh...). B... | <p>The <code>PATH</code> variable holds a list of directories separated by colons, so if you want to add more than one directory, just put a colon between them:</p> <pre><code>export PATH=$PATH:/usr/local/git/bin:/usr/local/bin </code></pre> <p>That syntax works in any Bourne-compatible shell (sh, ksh, bash, zsh...). B... | 119, 369, 403, 6268, 46426 | git, macos, node.js, path, profile | <h1>How to add /usr/local/bin in $PATH on Mac</h1>
<p>When I do 'open .profile' in the terminal I have the following:</p>
<pre><code>export PATH=$PATH:/usr/local/git/bin
</code></pre>
<p>Now I installed node.js for Mac and it says, </p>
<blockquote>
<p>Make sure that /usr/local/bin is in your $PATH.</p>
</blockqu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,563 | git | # How to add /usr/local/bin in $PATH on Mac
When I do 'open .profile' in the terminal I have the following:
```
export PATH=$PATH:/usr/local/git/bin
```
Now I installed node.js for Mac and it says,
> Make sure that /usr/local/bin is in your $PATH.
How can I add `/usr/local/bin` to export `PATH=$PATH:/usr/local/git... | The `PATH` variable holds a list of directories separated by colons, so if you want to add more than one directory, just put a colon between them:
```
export PATH=$PATH:/usr/local/git/bin:/usr/local/bin
```
That syntax works in any Bourne-compatible shell (sh, ksh, bash, zsh...). But zsh, which is the default shell i... |
3242282 | How to configure an existing git repo to be shared by a UNIX group | 115 | 2010-07-13 23:18:11 | <p>I have an existing git repo (a bare one) which has up to this point only been writable by me. I want to open it up to some UNIX user group, foo, so that all members of foo can push to it. I'm aware that I can easily set up a <em>new</em> git repo with:</p>
<pre><code>git init --bare --shared=group repodir
chgrp -... | 94,448 | 28,558 | 2024-08-03 07:30:38 | 3,242,364 | 134 | 2010-07-13 23:34:10 | 164,602 | 2024-08-03 07:30:38 | https://stackoverflow.com/q/3242282 | https://stackoverflow.com/a/3242364 | <p>Try this to make an existing repository in <code>repodir</code> work for users in group <code>foo</code>:</p>
<pre><code>chgrp -R foo repodir # set the group
chmod -R g+rw repodir # allow the group to read/write
find repodir -type d -exec chmod g+s {} + # new files get group ... | <p>Try this to make an existing repository in <code>repodir</code> work for users in group <code>foo</code>:</p> <pre><code>chgrp -R foo repodir # set the group chmod -R g+rw repodir # allow the group to read/write find repodir -type d -exec chmod g+s {} + # new files get group ... | 119, 359, 1575, 2504 | git, permissions, share, shared | <h1>How to configure an existing git repo to be shared by a UNIX group</h1>
<p>I have an existing git repo (a bare one) which has up to this point only been writable by me. I want to open it up to some UNIX user group, foo, so that all members of foo can push to it. I'm aware that I can easily set up a <em>new</em> g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,564 | git | # How to configure an existing git repo to be shared by a UNIX group
I have an existing git repo (a bare one) which has up to this point only been writable by me. I want to open it up to some UNIX user group, foo, so that all members of foo can push to it. I'm aware that I can easily set up a *new* git repo with:
```... | Try this to make an existing repository in `repodir` work for users in group `foo`:
```
chgrp -R foo repodir # set the group
chmod -R g+rw repodir # allow the group to read/write
find repodir -type d -exec chmod g+s {} + # new files get group id of directory
git init --bare --s... |
15072243 | git with development, staging and production branches | 104 | 2013-02-25 17:00:17 | <p>This article sounds interesting, but I'm pretty sure the diagrams are wrong.
<a href="http://guides.beanstalkapp.com/version-control/branching-best-practices.html" rel="noreferrer">http://guides.beanstalkapp.com/version-control/branching-best-practices.html</a></p>
<p>Shouldn't it be <code>DEVELOPMENT</code> > <cod... | 212,855 | 861,010 | 2020-04-18 02:35:13 | 15,072,296 | 134 | 2013-02-25 17:02:59 | 168,775 | 2016-05-17 22:25:26 | https://stackoverflow.com/q/15072243 | https://stackoverflow.com/a/15072296 | <p>The thought process here is that you spend most of your time in <code>development</code>. When in development, you create a <code>feature</code> branch (off of <code>development</code>), complete the feature, and then merge back into <code>development</code>. This can then be added to the final production version by... | <p>The thought process here is that you spend most of your time in <code>development</code>. When in development, you create a <code>feature</code> branch (off of <code>development</code>), complete the feature, and then merge back into <code>development</code>. This can then be added to the final production version by... | 119 | git | <h1>git with development, staging and production branches</h1>
<p>This article sounds interesting, but I'm pretty sure the diagrams are wrong.
<a href="http://guides.beanstalkapp.com/version-control/branching-best-practices.html" rel="noreferrer">http://guides.beanstalkapp.com/version-control/branching-best-practices.h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,565 | git | # git with development, staging and production branches
This article sounds interesting, but I'm pretty sure the diagrams are wrong.
<http://guides.beanstalkapp.com/version-control/branching-best-practices.html>
Shouldn't it be `DEVELOPMENT` > `STAGING` > `PRODUCTION`?
> Merges should only flow in one direction: fro... | The thought process here is that you spend most of your time in `development`. When in development, you create a `feature` branch (off of `development`), complete the feature, and then merge back into `development`. This can then be added to the final production version by merging into `production`.
See [A Successful ... |
4541300 | Export only modified and added files with folder structure in Git | 97 | 2010-12-27 19:41:34 | <p>I would like to get a list of modified and added files in an specific commit so that I can export them and generate a package with the file structure.</p>
<p>The idea is to get the package and extract it on the server. For many reasons I can't create a hook to pull the repo automatically and the easiest way I have ... | 92,531 | 317,908 | 2022-03-28 09:51:25 | 4,541,846 | 134 | 2010-12-27 21:06:03 | 9,410 | 2019-04-28 17:01:27 | https://stackoverflow.com/q/4541300 | https://stackoverflow.com/a/4541846 | <pre><code>git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT <i>$commit_id</i></code></pre>
<ol>
<li><p><code>git diff-tree -r <i>$commit_id</i></code>:</p>
<p>Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory).</p></li>
<li><p><code>--no-commit-i... | <pre><code>git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT <i>$commit_id</i></code></pre> <ol> <li><p><code>git diff-tree -r <i>$commit_id</i></code>:</p> <p>Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory).</p></li> <li><p><code>--no-commit-i... | 119, 9033 | git, git-diff | <h1>Export only modified and added files with folder structure in Git</h1>
<p>I would like to get a list of modified and added files in an specific commit so that I can export them and generate a package with the file structure.</p>
<p>The idea is to get the package and extract it on the server. For many reasons I can... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,567 | git | # Export only modified and added files with folder structure in Git
I would like to get a list of modified and added files in an specific commit so that I can export them and generate a package with the file structure.
The idea is to get the package and extract it on the server. For many reasons I can't create a hook... | ```
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id
```
1. `git diff-tree -r $commit_id`:
Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory).
2. `--no-commit-id --name-only`:
Do not output the commit SHA1. Output only the names... |
10357436 | how to make git not change line endings for one particular file? | 91 | 2012-04-27 20:29:57 | <p>due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one particular file with line endings intact. It is fine if all other files get converted. The question is how to make gi... | 21,025 | 410,102 | 2023-03-15 05:56:43 | 10,357,545 | 134 | 2012-04-27 20:40:15 | 147,356 | 2017-04-07 22:55:08 | https://stackoverflow.com/q/10357436 | https://stackoverflow.com/a/10357545 | <p>Take a look at the <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">gitatttributes</a> documentation. With recent versions of git, you can set the <code>eol</code> attribute for files to control what end-of-lines will be used when the file is checked out.</p>
<p>You should be able to create a <cod... | <p>Take a look at the <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">gitatttributes</a> documentation. With recent versions of git, you can set the <code>eol</code> attribute for files to control what end-of-lines will be used when the file is checked out.</p> <p>You should be able to create a <cod... | 119 | git | <h1>how to make git not change line endings for one particular file?</h1>
<p>due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one particular file with line endings intact. I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,569 | git | # how to make git not change line endings for one particular file?
due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one particular file with line endings intact. It is fine... | Take a look at the [gitatttributes](https://git-scm.com/docs/gitattributes) documentation. With recent versions of git, you can set the `eol` attribute for files to control what end-of-lines will be used when the file is checked out.
You should be able to create a `.gitattributes` file in your repository that looking ... |
4515580 | How do I remove the old history from a git repository? | 307 | 2010-12-23 03:07:31 | <p>I'm afraid I couldn't find anything quite like this particular scenario.</p>
<p>I have a git repository with a lot of history: 500+ branches, 500+ tags, going back to mid-2007. It contains ~19,500 commits. We'd like to remove all of the history before Jan 1, 2010, to make it smaller and easier to deal with (we woul... | 220,917 | 150,032 | 2023-11-06 17:11:23 | 4,909,248 | 133 | 2011-02-05 19:46:20 | 42,219 | 2022-09-04 08:45:26 | https://stackoverflow.com/q/4515580 | https://stackoverflow.com/a/4909248 | <p>Note: this has been deprecated in favor of <code>git replace</code>.</p>
<p>You can create a <a href="https://git.wiki.kernel.org/index.php/GraftPoint" rel="nofollow noreferrer">graft</a> of the parent of your new root commit to no parent (or to an empty commit, e.g. the real root commit of your repository). E.g. <c... | <p>Note: this has been deprecated in favor of <code>git replace</code>.</p> <p>You can create a <a href="https://git.wiki.kernel.org/index.php/GraftPoint" rel="nofollow noreferrer">graft</a> of the parent of your new root commit to no parent (or to an empty commit, e.g. the real root commit of your repository). E.g. <c... | 119, 44929, 46509, 79719 | git, git-filter-branch, git-gc, git-reflog | <h1>How do I remove the old history from a git repository?</h1>
<p>I'm afraid I couldn't find anything quite like this particular scenario.</p>
<p>I have a git repository with a lot of history: 500+ branches, 500+ tags, going back to mid-2007. It contains ~19,500 commits. We'd like to remove all of the history before ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,573 | git | # How do I remove the old history from a git repository?
I'm afraid I couldn't find anything quite like this particular scenario.
I have a git repository with a lot of history: 500+ branches, 500+ tags, going back to mid-2007. It contains ~19,500 commits. We'd like to remove all of the history before Jan 1, 2010, to ... | Note: this has been deprecated in favor of `git replace`.
You can create a [graft](https://git.wiki.kernel.org/index.php/GraftPoint) of the parent of your new root commit to no parent (or to an empty commit, e.g. the real root commit of your repository). E.g. `echo "<NEW-ROOT-SHA1>" > .git/info/grafts`
After creating... |
465042 | Is it possible to have a Subversion repository as a Git submodule? | 164 | 2009-01-21 12:16:05 | <p>Is there a way to add a Subversion repository as a Git submodule in my Git repository?</p>
<p>Something like:</p>
<pre><code>git-svn submodule add https://svn.foo.com/svn/proj --stdlayout svn-project
</code></pre>
<p>Where <code>https://svn.foo.com/svn/proj</code> points to a Subversion repository.</p>
<p>I know... | 48,834 | 50,765 | 2017-11-22 21:22:56 | 465,151 | 133 | 2009-01-21 12:47:31 | 4,596 | 2017-09-08 09:37:40 | https://stackoverflow.com/q/465042 | https://stackoverflow.com/a/465151 | <p>No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository. </p>
<pre><code>git svn clone -s http://subversion.example.com/ mysvnclone
cd mysvnclone
git remote add origin git@example.com:project.git
git push origin master
</code></pre>
<p>Then you can add the git repository a... | <p>No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository. </p> <pre><code>git svn clone -s http://subversion.example.com/ mysvnclone cd mysvnclone git remote add origin git@example.com:project.git git push origin master </code></pre> <p>Then you can add the git repository a... | 63, 119, 6452 | git, git-svn, svn | <h1>Is it possible to have a Subversion repository as a Git submodule?</h1>
<p>Is there a way to add a Subversion repository as a Git submodule in my Git repository?</p>
<p>Something like:</p>
<pre><code>git-svn submodule add https://svn.foo.com/svn/proj --stdlayout svn-project
</code></pre>
<p>Where <code>https://s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,574 | git | # Is it possible to have a Subversion repository as a Git submodule?
Is there a way to add a Subversion repository as a Git submodule in my Git repository?
Something like:
```
git-svn submodule add https://svn.foo.com/svn/proj --stdlayout svn-project
```
Where `https://svn.foo.com/svn/proj` points to a Subversion r... | No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository.
```
git svn clone -s http://subversion.example.com/ mysvnclone
cd mysvnclone
git remote add origin git@example.com:project.git
git push origin master
```
Then you can add the git repository as a submodule to the origina... |
1881594 | use Winmerge inside of Git to file diff | 122 | 2009-12-10 15:08:13 | <p>Is there a way to use Winmerge inside of git to do Diffs? </p>
| 86,048 | 31,470 | 2024-12-30 20:06:32 | 1,884,517 | 133 | 2009-12-10 22:25:33 | 6,309 | 2020-03-02 08:36:21 | https://stackoverflow.com/q/1881594 | https://stackoverflow.com/a/1884517 | <p>Update June 2015, 6 years later:</p>
<p>As detailed in "<a href="https://stackoverflow.com/a/30699239/6309">git mergetool winmerge</a>", a simple <code>git config diff.tool winmerge</code> will be enough.</p>
<p>Git 2.5+ (Q2, 2015) is now aware of Winmerge as a diff or merge tool!</p>
<hr>
<p>Original answer (20... | <p>Update June 2015, 6 years later:</p> <p>As detailed in "<a href="https://stackoverflow.com/a/30699239/6309">git mergetool winmerge</a>", a simple <code>git config diff.tool winmerge</code> will be enough.</p> <p>Git 2.5+ (Q2, 2015) is now aware of Winmerge as a diff or merge tool!</p> <hr> <p>Original answer (20... | 119, 606, 10933, 21628 | diff, git, msysgit, winmerge | <h1>use Winmerge inside of Git to file diff</h1>
<p>Is there a way to use Winmerge inside of git to do Diffs? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,576 | git | # use Winmerge inside of Git to file diff
Is there a way to use Winmerge inside of git to do Diffs? | Update June 2015, 6 years later:
As detailed in "[git mergetool winmerge](https://stackoverflow.com/a/30699239/6309)", a simple `git config diff.tool winmerge` will be enough.
Git 2.5+ (Q2, 2015) is now aware of Winmerge as a diff or merge tool!
---
Original answer (2009-2012)
(msysgit, 1.6.5, DOS session)
The fi... |
14620863 | Git add all subdirectories | 117 | 2013-01-31 07:50:42 | <p>I'm having trouble adding a folder and all of it's subdirectories to my git repository. I realized this is a very popular question after doing some googling and I've tried each suggestion with no luck, specifically the suggestion from the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-add.html" rel="no... | 247,304 | 128,422 | 2022-08-06 04:34:36 | 14,620,946 | 133 | 2013-01-31 07:56:26 | 1,967,931 | 2018-11-09 07:50:12 | https://stackoverflow.com/q/14620863 | https://stackoverflow.com/a/14620946 | <p>Do,</p>
<pre><code>git add .
</code></pre>
<p>while in the root of the repository. It will add everything. If you do <code>git add *</code>, it will only add the files <code>*</code> points to. The single dot refers to the directory.</p>
<p>If your directory or file wasn't added to git index/repo after the above ... | <p>Do,</p> <pre><code>git add . </code></pre> <p>while in the root of the repository. It will add everything. If you do <code>git add *</code>, it will only add the files <code>*</code> points to. The single dot refers to the directory.</p> <p>If your directory or file wasn't added to git index/repo after the above ... | 119, 7330, 34792 | git, git-add, repository | <h1>Git add all subdirectories</h1>
<p>I'm having trouble adding a folder and all of it's subdirectories to my git repository. I realized this is a very popular question after doing some googling and I've tried each suggestion with no luck, specifically the suggestion from the <a href="http://www.kernel.org/pub/softwar... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,577 | git | # Git add all subdirectories
I'm having trouble adding a folder and all of it's subdirectories to my git repository. I realized this is a very popular question after doing some googling and I've tried each suggestion with no luck, specifically the suggestion from the [man page on git-add](http://www.kernel.org/pub/sof... | Do,
```
git add .
```
while in the root of the repository. It will add everything. If you do `git add *`, it will only add the files `*` points to. The single dot refers to the directory.
If your directory or file wasn't added to git index/repo after the above command, remember to check if it's marked as ignored by ... |
22948747 | Git flow - create feature branch off another feature branch | 94 | 2014-04-08 21:41:03 | <p>I having been using <code>git flow</code> for a while now. I am curious to learn about a specific use case. </p>
<p>For one of my projects I have a ticket for a new website feature. This ticket depends on many sub-tasks. I would like to create a feature branch for the main ticket, and then for each sub-task create ... | 72,598 | 2,407,209 | 2022-07-08 12:13:41 | 27,359,534 | 133 | 2014-12-08 13:54:07 | 1,082,681 | 2019-12-13 05:18:32 | https://stackoverflow.com/q/22948747 | https://stackoverflow.com/a/27359534 | <p>You can create a sub-feature branch via</p>
<pre><code>git flow feature start PROJ-511 feature/PROJ-500
</code></pre>
<p>But you cannot use the GitFlow tool to merge the branch back into the main feature branch because if you do</p>
<pre><code>git flow feature finish PROJ-511
</code></pre>
<p>the feature will be... | <p>You can create a sub-feature branch via</p> <pre><code>git flow feature start PROJ-511 feature/PROJ-500 </code></pre> <p>But you cannot use the GitFlow tool to merge the branch back into the main feature branch because if you do</p> <pre><code>git flow feature finish PROJ-511 </code></pre> <p>the feature will be... | 119, 64339 | git, git-flow | <h1>Git flow - create feature branch off another feature branch</h1>
<p>I having been using <code>git flow</code> for a while now. I am curious to learn about a specific use case. </p>
<p>For one of my projects I have a ticket for a new website feature. This ticket depends on many sub-tasks. I would like to create a f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,579 | git | # Git flow - create feature branch off another feature branch
I having been using `git flow` for a while now. I am curious to learn about a specific use case.
For one of my projects I have a ticket for a new website feature. This ticket depends on many sub-tasks. I would like to create a feature branch for the main t... | You can create a sub-feature branch via
```
git flow feature start PROJ-511 feature/PROJ-500
```
But you cannot use the GitFlow tool to merge the branch back into the main feature branch because if you do
```
git flow feature finish PROJ-511
```
the feature will be merged into `develop`. Ergo **sub-features are not... |
41075972 | How to update a git shallow clone? | 61 | 2016-12-10 13:16:34 | <h2>Background</h2>
<p>(for tl;dr, see #questions below)</p>
<p>I have multiple git repository shallow clones. I'm using shallow clones because it's a lot smaller compared to a deep clone. Each is cloned doing about <code>git clone --single-branch --depth 1 <git-repo-url> <dir-name></code>.</p>
<p>This w... | 27,694 | 279,335 | 2022-06-16 15:16:58 | 41,081,908 | 133 | 2016-12-11 00:48:34 | 1,256,452 | 2020-06-29 15:17:12 | https://stackoverflow.com/q/41075972 | https://stackoverflow.com/a/41081908 | <h1>TL;DR</h1>
<p>Given that you have an existing <code>--depth 1</code> repository cloned from branch <em>B</em> and you'd like Git to act as if you removed and re-cloned, you can use this sequence of commands:</p>
<pre><code>git fetch --depth 1
git reset --hard origin/B
git clean -dfx
</code></pre>
<p>(e.g., <code>gi... | <h1>TL;DR</h1> <p>Given that you have an existing <code>--depth 1</code> repository cloned from branch <em>B</em> and you'd like Git to act as if you removed and re-cloned, you can use this sequence of commands:</p> <pre><code>git fetch --depth 1 git reset --hard origin/B git clean -dfx </code></pre> <p>(e.g., <code>gi... | 119, 34099 | git, git-clone | <h1>How to update a git shallow clone?</h1>
<h2>Background</h2>
<p>(for tl;dr, see #questions below)</p>
<p>I have multiple git repository shallow clones. I'm using shallow clones because it's a lot smaller compared to a deep clone. Each is cloned doing about <code>git clone --single-branch --depth 1 <git-repo-url... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,582 | git | # How to update a git shallow clone?
## Background
(for tl;dr, see #questions below)
I have multiple git repository shallow clones. I'm using shallow clones because it's a lot smaller compared to a deep clone. Each is cloned doing about `git clone --single-branch --depth 1 <git-repo-url> <dir-name>`.
This works fin... | # TL;DR
Given that you have an existing `--depth 1` repository cloned from branch *B* and you'd like Git to act as if you removed and re-cloned, you can use this sequence of commands:
```
git fetch --depth 1
git reset --hard origin/B
git clean -dfx
```
(e.g., `git reset --hard origin/master`—I cannot put italics in ... |
10333836 | git clone can't resolve proxy | 46 | 2012-04-26 12:54:06 | <p>When I try to clone from git</p>
<pre><code>git clone "http://github.com/symfony/symfony.git" "d:/www/a/vendor/symfony"
</code></pre>
<p>I get an error</p>
<pre class="lang-none prettyprint-override"><code>Cloning into 'd:/www/a/vendor/symfony'...
error: Couldn't resolve proxy '(null)' while accessing http://gith... | 120,367 | 905,865 | 2023-08-09 14:38:24 | 10,334,096 | 133 | 2012-04-26 13:09:33 | 1,263,927 | 2012-05-31 11:34:21 | https://stackoverflow.com/q/10333836 | https://stackoverflow.com/a/10334096 | <p>Seems the problem is reported in the mailing list.
Does <a href="http://osdir.com/ml/msysgit/2012-04/msg00054.html" rel="noreferrer">this</a> help?</p>
<pre><code>git config --global --unset http.proxy
</code></pre>
| <p>Seems the problem is reported in the mailing list. Does <a href="http://osdir.com/ml/msysgit/2012-04/msg00054.html" rel="noreferrer">this</a> help?</p> <pre><code>git config --global --unset http.proxy </code></pre> | 119 | git | <h1>git clone can't resolve proxy</h1>
<p>When I try to clone from git</p>
<pre><code>git clone "http://github.com/symfony/symfony.git" "d:/www/a/vendor/symfony"
</code></pre>
<p>I get an error</p>
<pre class="lang-none prettyprint-override"><code>Cloning into 'd:/www/a/vendor/symfony'...
error: Couldn't resolve pro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,583 | git | # git clone can't resolve proxy
When I try to clone from git
```
git clone "http://github.com/symfony/symfony.git" "d:/www/a/vendor/symfony"
```
I get an error
```
Cloning into 'd:/www/a/vendor/symfony'...
error: Couldn't resolve proxy '(null)' while accessing http://github.com/symfony/symfony.git/info/refs
fatal: ... | Seems the problem is reported in the mailing list.
Does [this](http://osdir.com/ml/msysgit/2012-04/msg00054.html) help?
```
git config --global --unset http.proxy
``` |
30893040 | Remove commit from history | 281 | 2015-06-17 13:27:21 | <p>I entered a curseword in my code and I pushed the code on the master branch. I pushed a few more times after that so people do not pull the bad stuff, but I can still find the curseword in the commits history.</p>
<p>I don't want to add the file to <code>.gitignore</code> because we need that file.</p>
<p>Is there a... | 375,231 | 4,219,264 | 2025-11-09 19:20:50 | 30,893,371 | 132 | 2015-06-17 13:40:27 | 809,113 | 2025-11-09 19:20:50 | https://stackoverflow.com/q/30893040 | https://stackoverflow.com/a/30893371 | <p>If it's only on your local PC (or noone checked out your changes):</p>
<ol>
<li><p>Use:</p>
<pre><code>git log
</code></pre>
</li>
</ol>
<p>to find the commit you want to remove. Copy hash (the long sqeuence like: e8348ebe553102018c...).</p>
<ol start="2">
<li><p>Use:</p>
<pre><code>git rebase -i [hash]~
</code></pr... | <p>If it's only on your local PC (or noone checked out your changes):</p> <ol> <li><p>Use:</p> <pre><code>git log </code></pre> </li> </ol> <p>to find the commit you want to remove. Copy hash (the long sqeuence like: e8348ebe553102018c...).</p> <ol start="2"> <li><p>Use:</p> <pre><code>git rebase -i [hash]~ </code></pr... | 119, 53850 | git, git-commit | <h1>Remove commit from history</h1>
<p>I entered a curseword in my code and I pushed the code on the master branch. I pushed a few more times after that so people do not pull the bad stuff, but I can still find the curseword in the commits history.</p>
<p>I don't want to add the file to <code>.gitignore</code> because ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,584 | git | # Remove commit from history
I entered a curseword in my code and I pushed the code on the master branch. I pushed a few more times after that so people do not pull the bad stuff, but I can still find the curseword in the commits history.
I don't want to add the file to `.gitignore` because we need that file.
Is the... | If it's only on your local PC (or noone checked out your changes):
1. Use:
```
git log
```
to find the commit you want to remove. Copy hash (the long sqeuence like: e8348ebe553102018c...).
2. Use:
```
git rebase -i [hash]~
```
for example:
```
git rebase -i e8348~
```
Just remove t... |
136178 | How should I use git diff for long lines? | 262 | 2008-09-25 21:12:34 | <p>I'm running <a href="http://www.git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> on a file, but the change is at the end of a long line.</p>
<p>If I use cursor keys to move right, it loses colour-coding—and worse the lines don't line up—making it harder to track the change.</p>
<p>Is there a wa... | 58,865 | 9,360 | 2022-01-21 21:16:05 | 152,546 | 132 | 2008-09-30 10:43:23 | 1,577,190 | 2014-05-13 23:14:01 | https://stackoverflow.com/q/136178 | https://stackoverflow.com/a/152546 | <p>The display of the output of <code>git diff</code> is handled by whatever pager you are using.</p>
<p>Commonly, under Linux, <code>less</code> would be used.</p>
<p>You can tell git to use a different pager by setting the <code>GIT_PAGER</code> environment variable. If you don't mind about paging (for example, you... | <p>The display of the output of <code>git diff</code> is handled by whatever pager you are using.</p> <p>Commonly, under Linux, <code>less</code> would be used.</p> <p>You can tell git to use a different pager by setting the <code>GIT_PAGER</code> environment variable. If you don't mind about paging (for example, you... | 119, 606, 19508 | diff, git, word-wrap | <h1>How should I use git diff for long lines?</h1>
<p>I'm running <a href="http://www.git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> on a file, but the change is at the end of a long line.</p>
<p>If I use cursor keys to move right, it loses colour-coding—and worse the lines don't line up—making i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,585 | git | # How should I use git diff for long lines?
I'm running [git-diff](http://www.git-scm.com/docs/git-diff) on a file, but the change is at the end of a long line.
If I use cursor keys to move right, it loses colour-coding—and worse the lines don't line up—making it harder to track the change.
Is there a way to prevent... | The display of the output of `git diff` is handled by whatever pager you are using.
Commonly, under Linux, `less` would be used.
You can tell git to use a different pager by setting the `GIT_PAGER` environment variable. If you don't mind about paging (for example, your terminal allows you to scroll back) you might tr... |
39289765 | What's the common practice of gitignore for aspnet core project | 162 | 2016-09-02 10:05:58 | <p>I know it depends on the project but i want to learn is there a common practice for typical asp.net core project(such as ignoring <code>node_modules</code>). </p>
| 129,744 | 5,426,333 | 2021-04-16 21:35:49 | 39,289,838 | 132 | 2016-09-02 10:10:09 | 440,611 | 2016-09-02 10:10:09 | https://stackoverflow.com/q/39289765 | https://stackoverflow.com/a/39289838 | <p>This is standard <code>.gitignore</code> for ASP.NET projects, it combines things from .NET Core and Visual Studio. Taken from official <code>yo-generator-aspnet</code> from Omnisharp.</p>
<p>Source: <a href="https://raw.githubusercontent.com/OmniSharp/generator-aspnet/master/templates/gitignore.txt" rel="noreferre... | <p>This is standard <code>.gitignore</code> for ASP.NET projects, it combines things from .NET Core and Visual Studio. Taken from official <code>yo-generator-aspnet</code> from Omnisharp.</p> <p>Source: <a href="https://raw.githubusercontent.com/OmniSharp/generator-aspnet/master/templates/gitignore.txt" rel="noreferre... | 119, 117274 | asp.net-core, git | <h1>What's the common practice of gitignore for aspnet core project</h1>
<p>I know it depends on the project but i want to learn is there a common practice for typical asp.net core project(such as ignoring <code>node_modules</code>). </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,586 | git | # What's the common practice of gitignore for aspnet core project
I know it depends on the project but i want to learn is there a common practice for typical asp.net core project(such as ignoring `node_modules`). | This is standard `.gitignore` for ASP.NET projects, it combines things from .NET Core and Visual Studio. Taken from official `yo-generator-aspnet` from Omnisharp.
Source: <https://raw.githubusercontent.com/OmniSharp/generator-aspnet/master/templates/gitignore.txt>
```
## Ignore Visual Studio temporary files, build re... |
24455377 | Git diff with line numbers (Git log with line numbers) | 146 | 2014-06-27 15:22:16 | <p>When I do a <code>git diff</code> or a <code>git log -p</code>, how do I get line numbers of the source file(s) inlined with the output?</p>
<p>I tried to look it up <code>man git-diff | grep "line numbers"</code> and I tried googling but got nothing quickly.</p>
| 101,662 | 95,642 | 2023-11-13 20:54:05 | 24,456,418 | 132 | 2014-06-27 16:15:01 | null | 2022-12-12 10:50:09 | https://stackoverflow.com/q/24455377 | https://stackoverflow.com/a/24456418 | <p>You can't get human-readable line numbers with <code>git diff</code></p>
<p>There aren't currently any options to get line-numbers displayed vertically on the side with <code>git diff</code>.</p>
<h2>Unified-diff format</h2>
<p>That information is available in the (c)hunk headers for each change in the diff though, ... | <p>You can't get human-readable line numbers with <code>git diff</code></p> <p>There aren't currently any options to get line-numbers displayed vertically on the side with <code>git diff</code>.</p> <h2>Unified-diff format</h2> <p>That information is available in the (c)hunk headers for each change in the diff though, ... | 119, 14680 | git, line-numbers | <h1>Git diff with line numbers (Git log with line numbers)</h1>
<p>When I do a <code>git diff</code> or a <code>git log -p</code>, how do I get line numbers of the source file(s) inlined with the output?</p>
<p>I tried to look it up <code>man git-diff | grep "line numbers"</code> and I tried googling but got nothing q... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,587 | git | # Git diff with line numbers (Git log with line numbers)
When I do a `git diff` or a `git log -p`, how do I get line numbers of the source file(s) inlined with the output?
I tried to look it up `man git-diff | grep "line numbers"` and I tried googling but got nothing quickly. | You can't get human-readable line numbers with `git diff`
There aren't currently any options to get line-numbers displayed vertically on the side with `git diff`.
## Unified-diff format
That information is available in the (c)hunk headers for each change in the diff though, it's just in [unified-diff format](http://... |
8717740 | Git gist - Markdown does not work | 73 | 2012-01-03 19:43:51 | <p>I am not able to get Markdown work in a gist. My post is available <a href="https://gist.github.com/1556448#comments">here</a>.</p>
<p>Notice that the same Markdown works when I add a comment.</p>
<p>What did I miss?</p>
| 25,181 | 270,835 | 2013-11-20 02:01:29 | 8,717,783 | 132 | 2012-01-03 19:48:33 | 357,743 | 2012-01-03 19:48:33 | https://stackoverflow.com/q/8717740 | https://stackoverflow.com/a/8717783 | <p>Github uses file extension to recognize file type. In order to use Markdown in your gist it should have appropriate <code>.markdown</code> (or <code>.md</code>) extension. See <a href="https://gist.github.com/1556552" rel="noreferrer">this</a>.</p>
| <p>Github uses file extension to recognize file type. In order to use Markdown in your gist it should have appropriate <code>.markdown</code> (or <code>.md</code>) extension. See <a href="https://gist.github.com/1556552" rel="noreferrer">this</a>.</p> | 119, 674, 2254 | gist, git, markdown | <h1>Git gist - Markdown does not work</h1>
<p>I am not able to get Markdown work in a gist. My post is available <a href="https://gist.github.com/1556448#comments">here</a>.</p>
<p>Notice that the same Markdown works when I add a comment.</p>
<p>What did I miss?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,589 | git | # Git gist - Markdown does not work
I am not able to get Markdown work in a gist. My post is available [here](https://gist.github.com/1556448#comments).
Notice that the same Markdown works when I add a comment.
What did I miss? | Github uses file extension to recognize file type. In order to use Markdown in your gist it should have appropriate `.markdown` (or `.md`) extension. See [this](https://gist.github.com/1556552). |
5620525 | Git: Pushing to two repos in one command | 68 | 2011-04-11 11:19:46 | <p>I want to do <code>git push origin</code> and <code>git push my_other_remote</code> in the same line. Possible?</p>
| 32,023 | 76,701 | 2024-08-21 21:17:41 | 5,620,585 | 132 | 2011-04-11 11:26:19 | 223,092 | 2016-01-30 22:16:51 | https://stackoverflow.com/q/5620525 | https://stackoverflow.com/a/5620585 | <p>You can get the same effect by adding an extra push URL for your <code>origin</code> remote. For example, if the URLs of your existing remotes are as follows:</p>
<pre><code>$ git remote -v
origin me@original:something.git (fetch)
origin me@original:something.git (push)
my_other_remote git://somewhere/something.... | <p>You can get the same effect by adding an extra push URL for your <code>origin</code> remote. For example, if the URLs of your existing remotes are as follows:</p> <pre><code>$ git remote -v origin me@original:something.git (fetch) origin me@original:something.git (push) my_other_remote git://somewhere/something.... | 119 | git | <h1>Git: Pushing to two repos in one command</h1>
<p>I want to do <code>git push origin</code> and <code>git push my_other_remote</code> in the same line. Possible?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,590 | git | # Git: Pushing to two repos in one command
I want to do `git push origin` and `git push my_other_remote` in the same line. Possible? | You can get the same effect by adding an extra push URL for your `origin` remote. For example, if the URLs of your existing remotes are as follows:
```
$ git remote -v
origin me@original:something.git (fetch)
origin me@original:something.git (push)
my_other_remote git://somewhere/something.git (fetch)
my_other_remot... |
35622933 | How to specify registry while doing npm install with git remote url? | 62 | 2016-02-25 09:16:41 | <p>I want to be able to clone a git repository using a URL as specified <a href="https://docs.npmjs.com/cli/install" rel="noreferrer">here</a> </p>
<blockquote>
<pre><code><protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]
</code></pre>
</blockqu... | 197,197 | 1,984,039 | 2025-06-12 20:33:22 | 35,624,145 | 132 | 2016-02-25 10:07:21 | 1,381,602 | 2020-06-08 08:52:59 | https://stackoverflow.com/q/35622933 | https://stackoverflow.com/a/35624145 | <p><code>npm</code> gets its config settings from the command line, environment variables, and npmrc files. You can try to specify registry in a npmrc file, and module in the command line.
To change registry, you can use command:</p>
<pre><code>npm config set registry <registry url>
</code></pre>
<p>You can al... | <p><code>npm</code> gets its config settings from the command line, environment variables, and npmrc files. You can try to specify registry in a npmrc file, and module in the command line. To change registry, you can use command:</p> <pre><code>npm config set registry <registry url> </code></pre> <p>You can al... | 34099, 46426, 115613 | git-clone, node.js, npm-install | <h1>How to specify registry while doing npm install with git remote url?</h1>
<p>I want to be able to clone a git repository using a URL as specified <a href="https://docs.npmjs.com/cli/install" rel="noreferrer">here</a> </p>
<blockquote>
<pre><code><protocol>://[<user>[:<password>]@]<hostname>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,591 | git | # How to specify registry while doing npm install with git remote url?
I want to be able to clone a git repository using a URL as specified [here](https://docs.npmjs.com/cli/install)
> ```
> <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]
> ```
I am getting an error saying
> npm ER... | `npm` gets its config settings from the command line, environment variables, and npmrc files. You can try to specify registry in a npmrc file, and module in the command line.
To change registry, you can use command:
```
npm config set registry <registry url>
```
You can also change configs with the help of `--` argum... |
39389380 | How to overwrite remote branch with different local branch with git | 59 | 2016-09-08 11:10:42 | <p>I have a remote branch that is the basis for a pullrequest.</p>
<p>I mainly worked on a different branch, however that should now replace the old branch. </p>
<p>I tried to do a <code>git push remote oldBranch -f</code> but that only pushes my latest local <code>oldBranch</code> to the git server instead of the cu... | 62,152 | 6,632,579 | 2016-09-08 11:31:13 | 39,389,793 | 132 | 2016-09-08 11:31:13 | 1,314,743 | 2016-09-08 11:31:13 | https://stackoverflow.com/q/39389380 | https://stackoverflow.com/a/39389793 | <p>You can use the <code>local-name:remote-name</code> syntax for git push:</p>
<pre><code>git push origin newBranch:oldBranch
</code></pre>
<p>This pushes <code>newBranch</code>, but using the name <code>oldBranch</code> on origin.</p>
<p>Because <code>oldBranch</code> probably already exists, you have to force it:... | <p>You can use the <code>local-name:remote-name</code> syntax for git push:</p> <pre><code>git push origin newBranch:oldBranch </code></pre> <p>This pushes <code>newBranch</code>, but using the name <code>oldBranch</code> on origin.</p> <p>Because <code>oldBranch</code> probably already exists, you have to force it:... | 119 | git | <h1>How to overwrite remote branch with different local branch with git</h1>
<p>I have a remote branch that is the basis for a pullrequest.</p>
<p>I mainly worked on a different branch, however that should now replace the old branch. </p>
<p>I tried to do a <code>git push remote oldBranch -f</code> but that only push... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,592 | git | # How to overwrite remote branch with different local branch with git
I have a remote branch that is the basis for a pullrequest.
I mainly worked on a different branch, however that should now replace the old branch.
I tried to do a `git push remote oldBranch -f` but that only pushes my latest local `oldBranch` to t... | You can use the `local-name:remote-name` syntax for git push:
```
git push origin newBranch:oldBranch
```
This pushes `newBranch`, but using the name `oldBranch` on origin.
Because `oldBranch` probably already exists, you have to force it:
```
git push origin +newBranch:oldBranch
```
(I prefer the `+` instead of `... |
5540883 | What's the -practical- difference between a Bare and non-Bare repository? | 310 | 2011-04-04 15:38:41 | <p>I've been reading about the bare and non-bare / default repositories in Git. I haven't been able to understand quite well (theoretically) the differences between them, and why I should "push" to a bare repository. Here's the deal:</p>
<p>Currently, I'm the only one working on a project on 3 different compu... | 173,040 | 613,997 | 2021-08-27 02:12:34 | 5,541,917 | 131 | 2011-04-04 17:11:22 | 107,158 | 2019-01-24 12:53:48 | https://stackoverflow.com/q/5540883 | https://stackoverflow.com/a/5541917 | <p>Another difference between a bare and non-bare repository is that a bare repository does not have a default remote <em>origin</em> repository:</p>
<pre><code>~/Projects$ git clone --bare test bare
Initialized empty Git repository in /home/derek/Projects/bare/
~/Projects$ cd bare
~/Projects/bare$ git branch -a
* mas... | <p>Another difference between a bare and non-bare repository is that a bare repository does not have a default remote <em>origin</em> repository:</p> <pre><code>~/Projects$ git clone --bare test bare Initialized empty Git repository in /home/derek/Projects/bare/ ~/Projects$ cd bare ~/Projects/bare$ git branch -a * mas... | 119, 7330, 64465 | git, git-bare, repository | <h1>What's the -practical- difference between a Bare and non-Bare repository?</h1>
<p>I've been reading about the bare and non-bare / default repositories in Git. I haven't been able to understand quite well (theoretically) the differences between them, and why I should "push" to a bare repository. Here's the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,593 | git | # What's the -practical- difference between a Bare and non-Bare repository?
I've been reading about the bare and non-bare / default repositories in Git. I haven't been able to understand quite well (theoretically) the differences between them, and why I should "push" to a bare repository. Here's the deal:
Currently, ... | Another difference between a bare and non-bare repository is that a bare repository does not have a default remote *origin* repository:
```
~/Projects$ git clone --bare test bare
Initialized empty Git repository in /home/derek/Projects/bare/
~/Projects$ cd bare
~/Projects/bare$ git branch -a
* master
~/Projects/bare$ ... |
1043388 | Record file copy operation with Git | 203 | 2009-06-25 11:22:11 | <p>When I move a file in git using git-mv the status shows that the file has been renamed and even if I alter some portions it still considers to be almost the same thing (which is good because it lets me follow the history of it). </p>
<p>When I copy a file the original file has some history I'd like to associate wit... | 62,169 | 90,428 | 2025-04-04 15:23:21 | 1,043,566 | 131 | 2009-06-25 12:09:00 | 46,058 | 2021-03-17 15:28:21 | https://stackoverflow.com/q/1043388 | https://stackoverflow.com/a/1043566 | <p>Git does not do rename tracking nor copy tracking, which means it doesn't <strong>record</strong> renames or copies. What it does instead is rename and copy <strong>detection</strong>. You can request rename detection in <code>git diff</code> (and <code>git show</code>) by using the <code>-M</code> option, you can r... | <p>Git does not do rename tracking nor copy tracking, which means it doesn't <strong>record</strong> renames or copies. What it does instead is rename and copy <strong>detection</strong>. You can request rename detection in <code>git diff</code> (and <code>git show</code>) by using the <code>-M</code> option, you can r... | 119, 4330, 5310 | copy, file, git | <h1>Record file copy operation with Git</h1>
<p>When I move a file in git using git-mv the status shows that the file has been renamed and even if I alter some portions it still considers to be almost the same thing (which is good because it lets me follow the history of it). </p>
<p>When I copy a file the original fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,595 | git | # Record file copy operation with Git
When I move a file in git using git-mv the status shows that the file has been renamed and even if I alter some portions it still considers to be almost the same thing (which is good because it lets me follow the history of it).
When I copy a file the original file has some histo... | Git does not do rename tracking nor copy tracking, which means it doesn't **record** renames or copies. What it does instead is rename and copy **detection**. You can request rename detection in `git diff` (and `git show`) by using the `-M` option, you can request additional copy detection in changed files by using the... |
17933401 | How do I remove deleted branch names from autocomplete? | 185 | 2013-07-29 20:17:31 | <p>I used <code>git branch -d myBranch</code> to delete a branch. However, when I am on master and try to checkout a new branch with <code>git checkout</code>, <code>myBranch</code> still appears in the tab-autocomplete.</p>
<p>How do I remove the name <code>myBranch</code> from tab-autocomplete for <code>git checkout... | 22,974 | 1,276,460 | 2022-06-02 00:33:23 | 17,935,627 | 131 | 2013-07-29 22:59:54 | 1,253,222 | 2013-07-29 22:59:54 | https://stackoverflow.com/q/17933401 | https://stackoverflow.com/a/17935627 | <p>One possible reason for this is that, if a remote branch (e.g. <code>origin/myBranch</code>) still exists, then <code>git checkout myBranch</code> will succeed as an alternative to <code>git checkout -b myBranch origin/myBranch</code>. This is intended as a convenience for the common case of checkout out a remote br... | <p>One possible reason for this is that, if a remote branch (e.g. <code>origin/myBranch</code>) still exists, then <code>git checkout myBranch</code> will succeed as an alternative to <code>git checkout -b myBranch origin/myBranch</code>. This is intended as a convenience for the common case of checkout out a remote br... | 119 | git | <h1>How do I remove deleted branch names from autocomplete?</h1>
<p>I used <code>git branch -d myBranch</code> to delete a branch. However, when I am on master and try to checkout a new branch with <code>git checkout</code>, <code>myBranch</code> still appears in the tab-autocomplete.</p>
<p>How do I remove the name <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,596 | git | # How do I remove deleted branch names from autocomplete?
I used `git branch -d myBranch` to delete a branch. However, when I am on master and try to checkout a new branch with `git checkout`, `myBranch` still appears in the tab-autocomplete.
How do I remove the name `myBranch` from tab-autocomplete for `git checkout... | One possible reason for this is that, if a remote branch (e.g. `origin/myBranch`) still exists, then `git checkout myBranch` will succeed as an alternative to `git checkout -b myBranch origin/myBranch`. This is intended as a convenience for the common case of checkout out a remote branch for the first time, creating an... |
15641259 | How to normalize working tree line endings in Git? | 126 | 2013-03-26 15:42:29 | <p>I have cloned a repository that had inconsistend line endings. I have added a <code>.gitattributes</code> that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message:</p>
<pre><code>warning: CRLF will be replaced by LF in FILE.
The file will have its original line end... | 86,087 | 1,250,278 | 2023-06-23 13:01:16 | 50,645,024 | 131 | 2018-06-01 13:54:56 | 4,633,326 | 2019-11-28 01:46:00 | https://stackoverflow.com/q/15641259 | https://stackoverflow.com/a/50645024 | <p>With Git client 2.16 and higher there is now a much simpler way to do this. Just use:</p>
<pre><code>git add --renormalize .
</code></pre>
<p>Note: it's better to do this with a clean workspace. For details, see:</p>
<ul>
<li><a href="https://git-scm.com/docs/gitattributes#_end_of_line_conversion" rel="noreferrer... | <p>With Git client 2.16 and higher there is now a much simpler way to do this. Just use:</p> <pre><code>git add --renormalize . </code></pre> <p>Note: it's better to do this with a clean workspace. For details, see:</p> <ul> <li><a href="https://git-scm.com/docs/gitattributes#_end_of_line_conversion" rel="noreferrer... | 119, 8329, 56102 | git, gitattributes, line-endings | <h1>How to normalize working tree line endings in Git?</h1>
<p>I have cloned a repository that had inconsistend line endings. I have added a <code>.gitattributes</code> that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message:</p>
<pre><code>warning: CRLF will be repl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,597 | git | # How to normalize working tree line endings in Git?
I have cloned a repository that had inconsistend line endings. I have added a `.gitattributes` that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message:
```
warning: CRLF will be replaced by LF in FILE.
The file wi... | With Git client 2.16 and higher there is now a much simpler way to do this. Just use:
```
git add --renormalize .
```
Note: it's better to do this with a clean workspace. For details, see:
- <https://git-scm.com/docs/gitattributes#_end_of_line_conversion>
- <https://help.github.com/en/github/using-git/configuring-gi... |
4638500 | Git blame showing no history | 91 | 2011-01-09 09:26:33 | <p>When I run git blame on a file (using msysgit) I always get the following sort of printout:</p>
<pre><code>00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 1) package co
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 2) {
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 3) impor
00000000... | 16,812 | 11,208 | 2022-03-15 21:07:31 | 4,653,165 | 131 | 2011-01-11 00:51:29 | 202,174 | 2011-01-11 12:29:08 | https://stackoverflow.com/q/4638500 | https://stackoverflow.com/a/4653165 | <p><code>git blame file.txt</code> blames the version of file.txt in your working copy. If file.txt has Windows-newlines (CRLF) in the repo and you have <code>core.autocrlf = true</code>, then every line of file.txt will be considered different and will be reported by <code>git blame</code> as not yet committed.</p>
<... | <p><code>git blame file.txt</code> blames the version of file.txt in your working copy. If file.txt has Windows-newlines (CRLF) in the repo and you have <code>core.autocrlf = true</code>, then every line of file.txt will be considered different and will be reported by <code>git blame</code> as not yet committed.</p> <... | 119, 21455, 21628, 119526 | blame, git, msysgit, windows-subsystem-for-linux | <h1>Git blame showing no history</h1>
<p>When I run git blame on a file (using msysgit) I always get the following sort of printout:</p>
<pre><code>00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 1) package co
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 2) {
00000000 (Not Committed Yet 2011-01-09 1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,598 | git | # Git blame showing no history
When I run git blame on a file (using msysgit) I always get the following sort of printout:
```
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 1) package co
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 2) {
00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 3) ... | `git blame file.txt` blames the version of file.txt in your working copy. If file.txt has Windows-newlines (CRLF) in the repo and you have `core.autocrlf = true`, then every line of file.txt will be considered different and will be reported by `git blame` as not yet committed.
The reason why `git blame <my_branch>` (o... |
28026767 | Where should I place my global 'gitattributes' file? | 90 | 2015-01-19 14:21:44 | <p>I gather there is (despite the lack of documentation) <a href="https://stackoverflow.com/q/2788649/656912">a way</a> to set <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer">Git attributes</a> globally; but I'm not clear where to place the necessary <code>gitattributes</code> file. The <a href="https:... | 63,121 | 656,912 | 2024-06-06 11:53:56 | 28,027,656 | 131 | 2015-01-19 15:07:30 | 2,541,573 | 2019-05-03 13:02:31 | https://stackoverflow.com/q/28026767 | https://stackoverflow.com/a/28027656 | <h2>Global vs. system-wide settings</h2>
<p>There is some ambiguity in your question's terminology.
In a Git context, "global" usually means "user-level"; in other words, a <em>global</em> setting affect all repositories for <em>one</em> specific user (the active one). In contrast, a <em>system-wide</em> setting affe... | <h2>Global vs. system-wide settings</h2> <p>There is some ambiguity in your question's terminology. In a Git context, "global" usually means "user-level"; in other words, a <em>global</em> setting affect all repositories for <em>one</em> specific user (the active one). In contrast, a <em>system-wide</em> setting affe... | 34, 119, 6268, 56102 | git, gitattributes, path, unix | <h1>Where should I place my global 'gitattributes' file?</h1>
<p>I gather there is (despite the lack of documentation) <a href="https://stackoverflow.com/q/2788649/656912">a way</a> to set <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer">Git attributes</a> globally; but I'm not clear where to place the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,599 | git | # Where should I place my global 'gitattributes' file?
I gather there is (despite the lack of documentation) [a way](https://stackoverflow.com/q/2788649/656912) to set [Git attributes](http://git-scm.com/docs/gitattributes) globally; but I'm not clear where to place the necessary `gitattributes` file. The [instruction... | ## Global vs. system-wide settings
There is some ambiguity in your question's terminology.
In a Git context, "global" usually means "user-level"; in other words, a *global* setting affect all repositories for *one* specific user (the active one). In contrast, a *system-wide* setting affects all repositories for *all* ... |
10815203 | How to update Git clone on local system? | 84 | 2012-05-30 11:16:40 | <p>I have started using Git. I have cloned the repo on my local system. I make the changes on the local machine and use <code>git push</code> to the update the remote repo. It works fine.</p>
<p>How to update my clone from the remote? I tried <code>git remote update</code>. It did not work, new changes does not appear.... | 290,490 | 840,766 | 2024-06-17 23:12:33 | 10,815,222 | 131 | 2012-05-30 11:17:56 | 465,183 | 2012-05-30 11:17:56 | https://stackoverflow.com/q/10815203 | https://stackoverflow.com/a/10815222 | <p>If you want to fetch + merge, run</p>
<pre><code>git pull
</code></pre>
<p>if you want simply to fetch :</p>
<pre><code>git fetch
</code></pre>
| <p>If you want to fetch + merge, run</p> <pre><code>git pull </code></pre> <p>if you want simply to fetch :</p> <pre><code>git fetch </code></pre> | 119 | git | <h1>How to update Git clone on local system?</h1>
<p>I have started using Git. I have cloned the repo on my local system. I make the changes on the local machine and use <code>git push</code> to the update the remote repo. It works fine.</p>
<p>How to update my clone from the remote? I tried <code>git remote update</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,600 | git | # How to update Git clone on local system?
I have started using Git. I have cloned the repo on my local system. I make the changes on the local machine and use `git push` to the update the remote repo. It works fine.
How to update my clone from the remote? I tried `git remote update`. It did not work, new changes doe... | If you want to fetch + merge, run
```
git pull
```
if you want simply to fetch :
```
git fetch
``` |
3419658 | understanding git fetch then merge | 71 | 2010-08-05 22:18:05 | <p>Coming from an svn background, I had this question:</p>
<p><a href="https://stackoverflow.com/questions/1138990/git-equivalent-of-svn-status-u">git equivalent of svn status -u</a></p>
<p>(what is the git equivalent of <code>svn status -u</code>)</p>
<p>And I understand, you do:</p>
<pre><code>git fetch
git log .... | 114,833 | 289,004 | 2010-08-06 20:47:39 | 3,427,698 | 131 | 2010-08-06 20:47:39 | 46,058 | 2010-08-06 20:47:39 | https://stackoverflow.com/q/3419658 | https://stackoverflow.com/a/3427698 | <h2>git fetch</h2>
<p><code>git fetch</code> grabs changes from remote repository and puts it in your repository's object database. It also fetches branches from remote repository and stores them as <strong><em>remote-tracking branches</em></strong>. </p>
<p>When you are fetching git tells you where it stores each ... | <h2>git fetch</h2> <p><code>git fetch</code> grabs changes from remote repository and puts it in your repository's object database. It also fetches branches from remote repository and stores them as <strong><em>remote-tracking branches</em></strong>. </p> <p>When you are fetching git tells you where it stores each ... | 119 | git | <h1>understanding git fetch then merge</h1>
<p>Coming from an svn background, I had this question:</p>
<p><a href="https://stackoverflow.com/questions/1138990/git-equivalent-of-svn-status-u">git equivalent of svn status -u</a></p>
<p>(what is the git equivalent of <code>svn status -u</code>)</p>
<p>And I understand,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,601 | git | # understanding git fetch then merge
Coming from an svn background, I had this question:
[git equivalent of svn status -u](https://stackoverflow.com/questions/1138990/git-equivalent-of-svn-status-u)
(what is the git equivalent of `svn status -u`)
And I understand, you do:
```
git fetch
git log ..origin/master
```
... | ## git fetch
`git fetch` grabs changes from remote repository and puts it in your repository's object database. It also fetches branches from remote repository and stores them as ***remote-tracking branches***.
When you are fetching git tells you where it stores each branch on remote repository it fetches. For exampl... |
13201906 | Issue with renaming a directory in git to lowercase while ignoreLowercase=True | 62 | 2012-11-02 19:37:28 | <p>When I type <code>git status</code>, I see:</p>
<pre><code># On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: DIR/a
#
</code></pre>
<p>However,... | 38,455 | null | 2025-05-03 00:01:58 | 30,654,833 | 131 | 2015-06-04 21:52:11 | 4,954,028 | 2017-03-30 12:39:32 | https://stackoverflow.com/q/13201906 | https://stackoverflow.com/a/30654833 | <p>Example: if you are lower-casing Mydir</p>
<pre><code>git mv src/Mydir src/mydirs
git mv src/mydirs src/mydir
git commit -m "Rename folder Mydir to mydir"
</code></pre>
| <p>Example: if you are lower-casing Mydir</p> <pre><code>git mv src/Mydir src/mydirs git mv src/mydirs src/mydir git commit -m "Rename folder Mydir to mydir" </code></pre> | 119 | git | <h1>Issue with renaming a directory in git to lowercase while ignoreLowercase=True</h1>
<p>When I type <code>git status</code>, I see:</p>
<pre><code># On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to di... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,602 | git | # Issue with renaming a directory in git to lowercase while ignoreLowercase=True
When I type `git status`, I see:
```
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# m... | Example: if you are lower-casing Mydir
```
git mv src/Mydir src/mydirs
git mv src/mydirs src/mydir
git commit -m "Rename folder Mydir to mydir"
``` |
26884364 | How to stash my previous commit? | 119 | 2014-11-12 10:13:37 | <p>I've got the following situation on my <code>git log</code>:</p>
<pre><code>commit 111 <-- need to push it to the repository
commit 222 <-- need to stash this one
...
</code></pre>
<p>As you can see, I need to push only last (without previous) commit to repository.</p>
<p>How can I do it? <code>git reve... | 251,012 | 3,796,338 | 2024-10-17 10:42:57 | 26,885,183 | 130 | 2014-11-12 10:52:59 | 1,794,631 | 2020-09-10 10:43:40 | https://stackoverflow.com/q/26884364 | https://stackoverflow.com/a/26885183 | <p>If you've not pushed either commit to your remote repository, you could use interactive rebasing to 'reorder' your commits and stash the (new) most recent commit's changes only.</p>
<p>Assuming you have the tip of your current branch (commit 111 in your example) checked out, execute the following:</p>
<pre><code>git... | <p>If you've not pushed either commit to your remote repository, you could use interactive rebasing to 'reorder' your commits and stash the (new) most recent commit's changes only.</p> <p>Assuming you have the tip of your current branch (commit 111 in your example) checked out, execute the following:</p> <pre><code>git... | 119 | git | <h1>How to stash my previous commit?</h1>
<p>I've got the following situation on my <code>git log</code>:</p>
<pre><code>commit 111 <-- need to push it to the repository
commit 222 <-- need to stash this one
...
</code></pre>
<p>As you can see, I need to push only last (without previous) commit to repositor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,605 | git | # How to stash my previous commit?
I've got the following situation on my `git log`:
```
commit 111 <-- need to push it to the repository
commit 222 <-- need to stash this one
...
```
As you can see, I need to push only last (without previous) commit to repository.
How can I do it? `git revert --soft commit_has... | If you've not pushed either commit to your remote repository, you could use interactive rebasing to 'reorder' your commits and stash the (new) most recent commit's changes only.
Assuming you have the tip of your current branch (commit 111 in your example) checked out, execute the following:
```
git rebase -i HEAD~2
`... |
8634356 | Filter git log to show only my changes | 111 | 2011-12-26 09:13:43 | <p>How can I filter the <code>git log</code> to show only my changes (excluding the changes committed by other developers)?</p>
| 49,624 | 42,372 | 2014-03-18 20:05:30 | 8,634,379 | 130 | 2011-12-26 09:18:29 | 330,280 | 2011-12-26 09:18:29 | https://stackoverflow.com/q/8634356 | https://stackoverflow.com/a/8634379 | <p>You can filter the log by the author for example, so you can filter by your name :</p>
<pre><code>git log --author="YourName"
</code></pre>
<p>or by committer : </p>
<pre><code> git log --committer="YourName"
</code></pre>
| <p>You can filter the log by the author for example, so you can filter by your name :</p> <pre><code>git log --author="YourName" </code></pre> <p>or by committer : </p> <pre><code> git log --committer="YourName" </code></pre> | 119, 456 | git, version-control | <h1>Filter git log to show only my changes</h1>
<p>How can I filter the <code>git log</code> to show only my changes (excluding the changes committed by other developers)?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,607 | git | # Filter git log to show only my changes
How can I filter the `git log` to show only my changes (excluding the changes committed by other developers)? | You can filter the log by the author for example, so you can filter by your name :
```
git log --author="YourName"
```
or by committer :
```
git log --committer="YourName"
``` |
42363881 | How to list files ignored with 'skip-worktree' | 87 | 2017-02-21 09:48:48 | <p>I have used <code>git update-index --skip-worktree <file></code> as suggested <a href="https://stackoverflow.com/a/13631525/1615903">here</a> to make git ignore local changes to a tracked file. But now I have forgotten which files I have applied it to. How can I list all files that have skip-worktree flag appl... | 20,875 | 1,615,903 | 2019-12-12 12:30:47 | 42,363,882 | 130 | 2017-02-21 09:48:48 | 1,615,903 | 2019-12-12 12:30:47 | https://stackoverflow.com/q/42363881 | https://stackoverflow.com/a/42363882 | <p>Use the following command if on *nix (Linux, Mac):</p>
<pre><code>git ls-files -v . | grep ^S
</code></pre>
<p>or, if on Windows, you can use:</p>
<pre><code>git ls-files -v . | findstr "^S"
</code></pre>
<p>Explanation:
<code>git ls-files .</code> lists all files in the repo (assuming you are in the root folder... | <p>Use the following command if on *nix (Linux, Mac):</p> <pre><code>git ls-files -v . | grep ^S </code></pre> <p>or, if on Windows, you can use:</p> <pre><code>git ls-files -v . | findstr "^S" </code></pre> <p>Explanation: <code>git ls-files .</code> lists all files in the repo (assuming you are in the root folder... | 119 | git | <h1>How to list files ignored with 'skip-worktree'</h1>
<p>I have used <code>git update-index --skip-worktree <file></code> as suggested <a href="https://stackoverflow.com/a/13631525/1615903">here</a> to make git ignore local changes to a tracked file. But now I have forgotten which files I have applied it to. Ho... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,609 | git | # How to list files ignored with 'skip-worktree'
I have used `git update-index --skip-worktree <file>` as suggested [here](https://stackoverflow.com/a/13631525/1615903) to make git ignore local changes to a tracked file. But now I have forgotten which files I have applied it to. How can I list all files that have skip... | Use the following command if on *nix (Linux, Mac):
```
git ls-files -v . | grep ^S
```
or, if on Windows, you can use:
```
git ls-files -v . | findstr "^S"
```
Explanation:
`git ls-files .` lists all files in the repo (assuming you are in the root folder). `-v` makes the output verbose, meaning that it will abbrevi... |
42174485 | GIT: How dangerous is "deleted by us" conflict? | 86 | 2017-02-11 09:50:20 | <p>A few days ago I made a new branch called "new_branch" based on "master". While I worked on my "new_branch" with file "file.php", a second developer on his branch deleted the file "file.php" and merged his branch with "master". Now I need to rebase my branch on current "master". After the command <code>git pull --re... | 83,572 | 7,411,621 | 2021-05-20 14:09:19 | 42,174,625 | 130 | 2017-02-11 10:07:10 | 1,863,229 | 2021-05-20 14:09:19 | https://stackoverflow.com/q/42174485 | https://stackoverflow.com/a/42174625 | <p>The message <code>deleted by us: app/file.php</code> means precisely what you described, namely that someone deleted this file in the <code>master</code> branch on which you are rebasing <code>new_branch</code>.</p>
<p>Assuming that the delete has not yet been staged and you want to keep this file, then you should <... | <p>The message <code>deleted by us: app/file.php</code> means precisely what you described, namely that someone deleted this file in the <code>master</code> branch on which you are rebasing <code>new_branch</code>.</p> <p>Assuming that the delete has not yet been staged and you want to keep this file, then you should <... | 119 | git | <h1>GIT: How dangerous is "deleted by us" conflict?</h1>
<p>A few days ago I made a new branch called "new_branch" based on "master". While I worked on my "new_branch" with file "file.php", a second developer on his branch deleted the file "file.php" and merged his branch with "master". Now I need to rebase my branch o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,610 | git | # GIT: How dangerous is "deleted by us" conflict?
A few days ago I made a new branch called "new_branch" based on "master". While I worked on my "new_branch" with file "file.php", a second developer on his branch deleted the file "file.php" and merged his branch with "master". Now I need to rebase my branch on current... | The message `deleted by us: app/file.php` means precisely what you described, namely that someone deleted this file in the `master` branch on which you are rebasing `new_branch`.
Assuming that the delete has not yet been staged and you want to keep this file, then you should `git add` the file to mark it that it shoul... |
549920 | Is it possible to alias a branch in Git? | 86 | 2009-02-14 22:45:04 | <p>I am looking into using Git on a massive scale. I was hoping to increase adoption and make things easier by calling the <code>master</code> branch <code>trunk</code>.</p>
<p>This can and will give SVN users some feelings of comfort. I know I can create a branch called <code>trunk</code>, but that seems to deviate ... | 21,436 | 66,519 | 2025-07-18 08:23:57 | 549,949 | 130 | 2009-02-14 23:07:12 | 19,563 | 2009-02-14 23:07:12 | https://stackoverflow.com/q/549920 | https://stackoverflow.com/a/549949 | <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 have the 'main' branch that they are used to.</p>
<pre><code>git symbolic-ref refs/heads/trunk refs/heads/master
</code></pre>
<p>Note that t... | <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 have the 'main' branch that they are used to.</p> <pre><code>git symbolic-ref refs/heads/trunk refs/heads/master </code></pre> <p>Note that t... | 119, 456, 487 | build-automation, git, version-control | <h1>Is it possible to alias a branch in Git?</h1>
<p>I am looking into using Git on a massive scale. I was hoping to increase adoption and make things easier by calling the <code>master</code> branch <code>trunk</code>.</p>
<p>This can and will give SVN users some feelings of comfort. I know I can create a branch cal... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,611 | git | # Is it possible to alias a branch in Git?
I am looking into using Git on a massive scale. I was hoping to increase adoption and make things easier by calling the `master` branch `trunk`.
This can and will give SVN users some feelings of comfort. I know I can create a branch called `trunk`, but that seems to deviate ... | 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 refs/heads/trunk refs/heads/master
```
Note that trunk isn't a first class ci... |
9143561 | Git "You have not concluded your merge" and nothing to commit? | 85 | 2012-02-04 18:59:24 | <p>Whenever I try to push in Git I get this:</p>
<pre><code>You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
</code></pre>
<p>Running <code>git status</code> I get:</p>
<pre><code># On branch master
nothing to commit (working directory clean)
</code></pre>
<p>... | 105,636 | 283,055 | 2019-05-27 08:54:50 | 9,143,629 | 130 | 2012-02-04 19:08:07 | 283,055 | 2012-02-04 19:08:07 | https://stackoverflow.com/q/9143561 | https://stackoverflow.com/a/9143629 | <p>Okay I finally found answer: <code>git commit -m "Test"</code> apparently fixed this. The result was an empty commit with no changes whatsoever. Even Github shows an empty commit, but it works.</p>
| <p>Okay I finally found answer: <code>git commit -m "Test"</code> apparently fixed this. The result was an empty commit with no changes whatsoever. Even Github shows an empty commit, but it works.</p> | 119 | git | <h1>Git "You have not concluded your merge" and nothing to commit?</h1>
<p>Whenever I try to push in Git I get this:</p>
<pre><code>You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
</code></pre>
<p>Running <code>git status</code> I get:</p>
<pre><code># On bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,612 | git | # Git "You have not concluded your merge" and nothing to commit?
Whenever I try to push in Git I get this:
```
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
```
Running `git status` I get:
```
# On branch master
nothing to commit (working directory clean)
`... | Okay I finally found answer: `git commit -m "Test"` apparently fixed this. The result was an empty commit with no changes whatsoever. Even Github shows an empty commit, but it works. |
3635952 | How to use git-bundle for keeping development in sync? | 79 | 2010-09-03 12:59:57 | <p>I need to keep my development trees in sync on different computers, with no network connection between them.</p>
<p>We have a central git repository, and I normally work on my own clone on my office computer. Sometimes I need to do some development on another computer, which is never connected to the office network... | 47,923 | 23,896 | 2017-02-14 22:22:15 | 3,639,182 | 130 | 2010-09-03 19:58:30 | 119,963 | 2012-07-23 08:11:28 | https://stackoverflow.com/q/3635952 | https://stackoverflow.com/a/3639182 | <h1>Bundles!</h1>
<p>The workflow with git bundle is going to be essentially the same as any other workflow. This may not seem like terribly helpful advice, but here it is: use whatever workflow you would normally use, and replace "push/pull" with "carry a bundle here to there on a flash drive, then pull".</p>
<p>The... | <h1>Bundles!</h1> <p>The workflow with git bundle is going to be essentially the same as any other workflow. This may not seem like terribly helpful advice, but here it is: use whatever workflow you would normally use, and replace "push/pull" with "carry a bundle here to there on a flash drive, then pull".</p> <p>The... | 119, 82677 | git, git-bundle | <h1>How to use git-bundle for keeping development in sync?</h1>
<p>I need to keep my development trees in sync on different computers, with no network connection between them.</p>
<p>We have a central git repository, and I normally work on my own clone on my office computer. Sometimes I need to do some development on ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,613 | git | # How to use git-bundle for keeping development in sync?
I need to keep my development trees in sync on different computers, with no network connection between them.
We have a central git repository, and I normally work on my own clone on my office computer. Sometimes I need to do some development on another computer... | # Bundles!
The workflow with git bundle is going to be essentially the same as any other workflow. This may not seem like terribly helpful advice, but here it is: use whatever workflow you would normally use, and replace "push/pull" with "carry a bundle here to there on a flash drive, then pull".
The man page actuall... |
5637311 | How can I use `git diff --color-words` outside a Git repository? | 77 | 2011-04-12 14:58:12 | <p>How can I get output like in <code>git diff --color-words</code>, but outside Git?</p>
<p>Closest thing is <code>wdiff -t</code>, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex.</p>
| 24,420 | 266,720 | 2022-12-10 15:18:01 | 5,637,364 | 130 | 2011-04-12 15:02:01 | 266,720 | 2022-01-11 14:31:30 | https://stackoverflow.com/q/5637311 | https://stackoverflow.com/a/5637364 | <pre><code>git diff --color-words --no-index old.txt new.txt
</code></pre>
| <pre><code>git diff --color-words --no-index old.txt new.txt </code></pre> | 119, 606, 6439, 63022 | colors, diff, git, word-diff | <h1>How can I use `git diff --color-words` outside a Git repository?</h1>
<p>How can I get output like in <code>git diff --color-words</code>, but outside Git?</p>
<p>Closest thing is <code>wdiff -t</code>, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespac... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,615 | git | # How can I use `git diff --color-words` outside a Git repository?
How can I get output like in `git diff --color-words`, but outside Git?
Closest thing is `wdiff -t`, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex. | ```
git diff --color-words --no-index old.txt new.txt
``` |
52410100 | How to separate changed files from untracked files in vscode? | 56 | 2018-09-19 16:08:41 | <p>I am checking out vscode to see if it does anything better than other options out there. I have the native version control and GitLens installed. I am trying to figure out how to work with version control and one thing has been puzzling. Both GitLens and native source control list both files that are not in the repo... | 31,255 | 302,268 | 2022-04-26 06:33:53 | 58,762,932 | 130 | 2019-11-08 08:27:43 | 6,309 | 2022-04-26 06:33:53 | https://stackoverflow.com/q/52410100 | https://stackoverflow.com/a/58762932 | <p><a href="https://code.visualstudio.com/updates/v1_40#_git-improved-untracked-files-management" rel="noreferrer">VSCode 1.40 (Oct. 2019)</a> seems to provide just that:</p>
<blockquote>
<h2>Git: Improved untracked files management</h2>
<p><strong>You can now manage untracked files separately by using the Git</strong>... | <p><a href="https://code.visualstudio.com/updates/v1_40#_git-improved-untracked-files-management" rel="noreferrer">VSCode 1.40 (Oct. 2019)</a> seems to provide just that:</p> <blockquote> <h2>Git: Improved untracked files management</h2> <p><strong>You can now manage untracked files separately by using the Git</strong>... | 119, 111608 | git, visual-studio-code | <h1>How to separate changed files from untracked files in vscode?</h1>
<p>I am checking out vscode to see if it does anything better than other options out there. I have the native version control and GitLens installed. I am trying to figure out how to work with version control and one thing has been puzzling. Both Git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,616 | git | # How to separate changed files from untracked files in vscode?
I am checking out vscode to see if it does anything better than other options out there. I have the native version control and GitLens installed. I am trying to figure out how to work with version control and one thing has been puzzling. Both GitLens and ... | [VSCode 1.40 (Oct. 2019)](https://code.visualstudio.com/updates/v1_40#_git-improved-untracked-files-management) seems to provide just that:
> ## Git: Improved untracked files management
>
> **You can now manage untracked files separately by using the Git**: **`Untracked Changes`** setting.
>
> - Choose the `separate` ... |
3492536 | Point branch to new commit | 130 | 2010-08-16 11:04:36 | <p><em>(This question is the opposite of <a href="https://stackoverflow.com/questions/1628563/git-move-recent-commit-to-a-new-branch">this one</a>)</em></p>
<p>How can I go from this</p>
<pre><code>dev C - D
/
master A - B
</code></pre>
<p>to this?</p>
<pre><code>dev D
... | 21,136 | 11,410 | 2019-06-11 15:06:25 | 3,492,559 | 129 | 2010-08-16 11:08:06 | 6,309 | 2016-01-07 21:39:06 | https://stackoverflow.com/q/3492536 | https://stackoverflow.com/a/3492559 | <h3>Solution</h3>
<pre><code>git checkout master
git merge C
</code></pre>
<p><em>With <code>C</code> being the SHA1 of commit <code>C</code>.</em></p>
<h3>Result</h3>
<pre><code> D (dev)
/
master A - B - C (move master HEAD)
</code></pre>
<p>It should be a fast-forward merge.</p>
| <h3>Solution</h3> <pre><code>git checkout master git merge C </code></pre> <p><em>With <code>C</code> being the SHA1 of commit <code>C</code>.</em></p> <h3>Result</h3> <pre><code> D (dev) / master A - B - C (move master HEAD) </code></pre> <p>It should be a fast-forward merge.</p> | 119 | git | <h1>Point branch to new commit</h1>
<p><em>(This question is the opposite of <a href="https://stackoverflow.com/questions/1628563/git-move-recent-commit-to-a-new-branch">this one</a>)</em></p>
<p>How can I go from this</p>
<pre><code>dev C - D
/
master A - B
</code></pre>
<p>to this?</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,618 | git | # Point branch to new commit
*(This question is the opposite of [this one](https://stackoverflow.com/questions/1628563/git-move-recent-commit-to-a-new-branch))*
How can I go from this
```
dev C - D
/
master A - B
```
to this?
```
dev D
/
master A - B - C
```
... | ### Solution
```
git checkout master
git merge C
```
*With `C` being the SHA1 of commit `C`.*
### Result
```
D (dev)
/
master A - B - C (move master HEAD)
```
It should be a fast-forward merge. |
25846189 | git am error: "patch does not apply" | 110 | 2014-09-15 10:41:18 | <p>I am trying to move several commits from one project to the second, similar one, using git. </p>
<p>So I created a patch, containing 5 commits: </p>
<pre><code>git format-patch 4af51 --stdout > changes.patch
</code></pre>
<p>Then move the patch to second project's folder and wants to apply the patch: </p>
<pr... | 169,084 | 1,632,572 | 2022-07-16 18:42:58 | 25,847,019 | 129 | 2014-09-15 11:27:27 | 1,256,452 | 2022-06-19 07:15:44 | https://stackoverflow.com/q/25846189 | https://stackoverflow.com/a/25847019 | <h2>What is a patch?</h2>
<p>A patch is little more (see below) than a series of instructions: "add this here", "remove that there", "change this third thing to a fourth". That's <em>why</em> Git tells you:</p>
<blockquote>
<pre><code>The copy of the patch that failed is found in:
c:/.../... | <h2>What is a patch?</h2> <p>A patch is little more (see below) than a series of instructions: "add this here", "remove that there", "change this third thing to a fourth". That's <em>why</em> Git tells you:</p> <blockquote> <pre><code>The copy of the patch that failed is found in: c:/.../... | 119 | git | <h1>git am error: "patch does not apply"</h1>
<p>I am trying to move several commits from one project to the second, similar one, using git. </p>
<p>So I created a patch, containing 5 commits: </p>
<pre><code>git format-patch 4af51 --stdout > changes.patch
</code></pre>
<p>Then move the patch to second project's ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,619 | git | # git am error: "patch does not apply"
I am trying to move several commits from one project to the second, similar one, using git.
So I created a patch, containing 5 commits:
```
git format-patch 4af51 --stdout > changes.patch
```
Then move the patch to second project's folder and wants to apply the patch:
```
git... | ## What is a patch?
A patch is little more (see below) than a series of instructions: "add this here", "remove that there", "change this third thing to a fourth". That's *why* Git tells you:
> ```
> The copy of the patch that failed is found in:
> c:/.../project2/.git/rebase-apply/patch
> ```
You can open that patch... |
5237605 | How to run "git status" and just get the filenames | 106 | 2011-03-08 20:00:27 | <p>How can I run "git status" and just get the filenames as opposed to the long relative path?</p>
| 47,864 | 327,508 | 2025-05-29 18:33:16 | 5,238,537 | 129 | 2011-03-08 21:27:35 | 223,092 | 2013-08-23 08:57:25 | https://stackoverflow.com/q/5237605 | https://stackoverflow.com/a/5238537 | <p>The output of <code>git status --porcelain</code>, designed to be easy to parse in a script, outputs the full paths rather than relative paths regardless of where your current directory is within the tree.</p>
<p>Each line output by <code>git status --porcelain</code> has two leading characters indicating the statu... | <p>The output of <code>git status --porcelain</code>, designed to be easy to parse in a script, outputs the full paths rather than relative paths regardless of where your current directory is within the tree.</p> <p>Each line output by <code>git status --porcelain</code> has two leading characters indicating the statu... | 119, 456 | git, version-control | <h1>How to run "git status" and just get the filenames</h1>
<p>How can I run "git status" and just get the filenames as opposed to the long relative path?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,620 | git | # How to run "git status" and just get the filenames
How can I run "git status" and just get the filenames as opposed to the long relative path? | The output of `git status --porcelain`, designed to be easy to parse in a script, outputs the full paths rather than relative paths regardless of where your current directory is within the tree.
Each line output by `git status --porcelain` has two leading characters indicating the status of the file (e.g. whether it's... |
7651644 | git: timezone and timestamp format | 101 | 2011-10-04 17:17:59 | <p>From git I can get the timestamp:</p>
<pre><code>"2011-10-04 12:58:36 -0600"
</code></pre>
<p>but is there any way to show it as:</p>
<pre><code>"2011-10-04 06:58:36"
</code></pre>
<p>So all I want is to get rid of the -0600 timezone offset. How can I do this? Thanks.</p>
| 59,892 | 595,771 | 2022-06-23 08:11:22 | 7,651,782 | 129 | 2011-10-04 17:30:28 | 960,558 | 2018-06-16 05:41:52 | https://stackoverflow.com/q/7651644 | https://stackoverflow.com/a/7651782 | <p>If you ask about git log, you can try and select most correct form from:</p>
<pre><code>git log --date={relative,local,default,iso,rfc}
</code></pre>
<p><code>--date=local</code> seems to be the best candidate.</p>
<p>To make this permanent, use <code>git config --global log.date local</code>.</p>
| <p>If you ask about git log, you can try and select most correct form from:</p> <pre><code>git log --date={relative,local,default,iso,rfc} </code></pre> <p><code>--date=local</code> seems to be the best candidate.</p> <p>To make this permanent, use <code>git config --global log.date local</code>.</p> | 119, 245, 982, 2177, 68775 | format, git, timestamp, timezone, timezone-offset | <h1>git: timezone and timestamp format</h1>
<p>From git I can get the timestamp:</p>
<pre><code>"2011-10-04 12:58:36 -0600"
</code></pre>
<p>but is there any way to show it as:</p>
<pre><code>"2011-10-04 06:58:36"
</code></pre>
<p>So all I want is to get rid of the -0600 timezone offset. How can I do this? Thanks.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,621 | git | # git: timezone and timestamp format
From git I can get the timestamp:
```
"2011-10-04 12:58:36 -0600"
```
but is there any way to show it as:
```
"2011-10-04 06:58:36"
```
So all I want is to get rid of the -0600 timezone offset. How can I do this? Thanks. | If you ask about git log, you can try and select most correct form from:
```
git log --date={relative,local,default,iso,rfc}
```
`--date=local` seems to be the best candidate.
To make this permanent, use `git config --global log.date local`. |
2209810 | add #*# glob to .gitignore? | 96 | 2010-02-05 19:29:55 | <p>I want to add emacs autosave files to my .gitignore with the glob <code>#*#</code> but of course, lines starting with a hash are comment lines.</p>
<p>How can I get this into my .gitignore without it being treated as a comment?</p>
| 17,566 | 48,659 | 2023-01-22 20:39:36 | 2,209,863 | 129 | 2010-02-05 19:37:49 | 6,309 | 2023-01-22 20:39:36 | https://stackoverflow.com/q/2209810 | https://stackoverflow.com/a/2209863 | <p>Did you try</p>
<pre><code>\#*#
</code></pre>
<p>Or:</p>
<pre><code>\#*\#
</code></pre>
<p>Since 1.6.2, <code>\</code> should be supported in <code>.gitignore</code> (see <a href="http://osdir.com/ml/git/2009-02/msg01285.html" rel="nofollow noreferrer">this patch</a>)</p>
<p>To be precise, <a href="https://github.co... | <p>Did you try</p> <pre><code>\#*# </code></pre> <p>Or:</p> <pre><code>\#*\# </code></pre> <p>Since 1.6.2, <code>\</code> should be supported in <code>.gitignore</code> (see <a href="http://osdir.com/ml/git/2009-02/msg01285.html" rel="nofollow noreferrer">this patch</a>)</p> <p>To be precise, <a href="https://github.co... | 119, 25056 | git, gitignore | <h1>add #*# glob to .gitignore?</h1>
<p>I want to add emacs autosave files to my .gitignore with the glob <code>#*#</code> but of course, lines starting with a hash are comment lines.</p>
<p>How can I get this into my .gitignore without it being treated as a comment?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,622 | git | # add #*# glob to .gitignore?
I want to add emacs autosave files to my .gitignore with the glob `#*#` but of course, lines starting with a hash are comment lines.
How can I get this into my .gitignore without it being treated as a comment? | Did you try
```
\#*#
```
Or:
```
\#*\#
```
Since 1.6.2, `\` should be supported in `.gitignore` (see [this patch](http://osdir.com/ml/git/2009-02/msg01285.html))
To be precise, [1.6.2.1](https://github.com/git/git/blob/master/Documentation/RelNotes/1.6.2.1.txt#L7-L8) (March 2009)
> `.gitignore` learned to handle ... |
13442130 | Git - Temporarily ignore trivial changes to files | 89 | 2012-11-18 16:41:56 | <p>I'm looking for a way to 'hide' minor changes made to a few files in Git, such that they will not show up in git status until a different change is made to those files.</p>
<p>Example: I have a java file where the only change made is the removal of an unused import (a contributor forgot to run an organize imports b... | 14,858 | 90,006 | 2022-05-02 23:58:39 | 26,549,583 | 129 | 2014-10-24 14:07:42 | 931,220 | 2014-10-24 14:07:42 | https://stackoverflow.com/q/13442130 | https://stackoverflow.com/a/26549583 | <p>In my use case (developing using an edited config file on my personal machine, running on another machine with the unchanged config), this was the solution for me:</p>
<p>start ignoring changes to a file:</p>
<pre><code>git update-index --assume-unchanged path/to/file
</code></pre>
<p>keep tracking again:</p>
<p... | <p>In my use case (developing using an edited config file on my personal machine, running on another machine with the unchanged config), this was the solution for me:</p> <p>start ignoring changes to a file:</p> <pre><code>git update-index --assume-unchanged path/to/file </code></pre> <p>keep tracking again:</p> <p... | 119, 4333 | git, ignore | <h1>Git - Temporarily ignore trivial changes to files</h1>
<p>I'm looking for a way to 'hide' minor changes made to a few files in Git, such that they will not show up in git status until a different change is made to those files.</p>
<p>Example: I have a java file where the only change made is the removal of an unuse... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,623 | git | # Git - Temporarily ignore trivial changes to files
I'm looking for a way to 'hide' minor changes made to a few files in Git, such that they will not show up in git status until a different change is made to those files.
Example: I have a java file where the only change made is the removal of an unused import (a cont... | In my use case (developing using an edited config file on my personal machine, running on another machine with the unchanged config), this was the solution for me:
start ignoring changes to a file:
```
git update-index --assume-unchanged path/to/file
```
keep tracking again:
```
git update-index --no-assume-unchang... |
50167969 | How to fix "modified content, untracked content" in git? | 77 | 2018-05-04 05:47:54 | <p><strong>The objective is to commit a git branch. The output of "git status" for the branch is:</strong></p>
<pre><code>On branch zeromq_new
Your branch is up to date with 'origin/zeromq'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <f... | 150,555 | 9,065,506 | 2025-04-30 06:22:43 | 52,722,775 | 129 | 2018-10-09 13:52:38 | 8,589,608 | 2018-12-14 22:39:03 | https://stackoverflow.com/q/50167969 | https://stackoverflow.com/a/52722775 | <p>What I did was to run: </p>
<pre><code>git rm -rf --cached myuntrackedfolder
</code></pre>
<p>This tells git to forget about it (since it was being tracked formally).</p>
<p>Then I used: </p>
<pre><code>git add myuntrackedfolder
</code></pre>
<p>to add it and I was good to go.</p>
| <p>What I did was to run: </p> <pre><code>git rm -rf --cached myuntrackedfolder </code></pre> <p>This tells git to forget about it (since it was being tracked formally).</p> <p>Then I used: </p> <pre><code>git add myuntrackedfolder </code></pre> <p>to add it and I was good to go.</p> | 119, 41612 | git, git-submodules | <h1>How to fix "modified content, untracked content" in git?</h1>
<p><strong>The objective is to commit a git branch. The output of "git status" for the branch is:</strong></p>
<pre><code>On branch zeromq_new
Your branch is up to date with 'origin/zeromq'.
Changes not staged for commit:
(use "git add <file>..... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,625 | git | # How to fix "modified content, untracked content" in git?
**The objective is to commit a git branch. The output of "git status" for the branch is:**
```
On branch zeromq_new
Your branch is up to date with 'origin/zeromq'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
... | What I did was to run:
```
git rm -rf --cached myuntrackedfolder
```
This tells git to forget about it (since it was being tracked formally).
Then I used:
```
git add myuntrackedfolder
```
to add it and I was good to go. |
24370975 | Find distance between two points using latitude and longitude in mysql | 63 | 2014-06-23 16:36:32 | <p>Hi I have the following table</p>
<pre><code> --------------------------------------------
| id | city | Latitude | Longitude |
--------------------------------------------
| 1 | 3 | 34.44444 | 84.3434 |
--------------------------------------------
| 2 | 4 | 42.4666667 | 1.4666667... | 152,259 | 2,157,861 | 2022-10-27 08:17:52 | 24,372,831 | 129 | 2014-06-23 18:28:01 | 205,608 | 2022-03-01 16:03:08 | https://stackoverflow.com/q/24370975 | https://stackoverflow.com/a/24372831 | <p>I think your question says you have the <code>city</code> values for the two cities between which you wish to compute the distance.</p>
<p>This query will do the job for you, yielding the distance in km. It uses the spherical cosine law formula.</p>
<p>Notice that you join the table to itself so you can retrieve two... | <p>I think your question says you have the <code>city</code> values for the two cities between which you wish to compute the distance.</p> <p>This query will do the job for you, yielding the distance in km. It uses the spherical cosine law formula.</p> <p>Notice that you join the table to itself so you can retrieve two... | 21, 20301 | latitude-longitude, mysql | <h1>Find distance between two points using latitude and longitude in mysql</h1>
<p>Hi I have the following table</p>
<pre><code> --------------------------------------------
| id | city | Latitude | Longitude |
--------------------------------------------
| 1 | 3 | 34.44444 | 84.3434 |
------... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,626 | git | # Find distance between two points using latitude and longitude in mysql
Hi I have the following table
```
--------------------------------------------
| id | city | Latitude | Longitude |
--------------------------------------------
| 1 | 3 | 34.44444 | 84.3434 |
--------------------------... | I think your question says you have the `city` values for the two cities between which you wish to compute the distance.
This query will do the job for you, yielding the distance in km. It uses the spherical cosine law formula.
Notice that you join the table to itself so you can retrieve two coordinate pairs for the ... |
24807930 | Git - list all authors of a folder of files? | 59 | 2014-07-17 15:38:36 | <p>How can I list the author names of a particular folder that's versioned by git?</p>
<p>I see that I can <code>git blame</code> a file and list the author of each line, but I can't do that for a folder, and I would also like only a unique list (each author listed only once)</p>
| 28,196 | 1,370,927 | 2023-10-29 14:06:07 | 49,275,435 | 129 | 2018-03-14 10:35:15 | 2,375,855 | 2023-10-29 14:06:07 | https://stackoverflow.com/q/24807930 | https://stackoverflow.com/a/49275435 | <p>Actually, there is a native Git command for that, <a href="https://git-scm.com/docs/git-shortlog" rel="noreferrer"><code>git shortlog</code></a>:</p>
<pre><code>git shortlog -n -s -- myfolder
</code></pre>
<p>The options do:</p>
<ul>
<li>Option <code>-s</code> just shows the number of commits per contributor. Withou... | <p>Actually, there is a native Git command for that, <a href="https://git-scm.com/docs/git-shortlog" rel="noreferrer"><code>git shortlog</code></a>:</p> <pre><code>git shortlog -n -s -- myfolder </code></pre> <p>The options do:</p> <ul> <li>Option <code>-s</code> just shows the number of commits per contributor. Withou... | 119 | git | <h1>Git - list all authors of a folder of files?</h1>
<p>How can I list the author names of a particular folder that's versioned by git?</p>
<p>I see that I can <code>git blame</code> a file and list the author of each line, but I can't do that for a folder, and I would also like only a unique list (each author listed... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,627 | git | # Git - list all authors of a folder of files?
How can I list the author names of a particular folder that's versioned by git?
I see that I can `git blame` a file and list the author of each line, but I can't do that for a folder, and I would also like only a unique list (each author listed only once) | Actually, there is a native Git command for that, [`git shortlog`](https://git-scm.com/docs/git-shortlog):
```
git shortlog -n -s -- myfolder
```
The options do:
- Option `-s` just shows the number of commits per contributor. Without it, the command lists the individual commits per author.
- Option `-n` sorts the au... |
14989858 | Get the current git hash in a Python script | 301 | 2013-02-20 21:03:29 | <p>I would like to include the current git hash in the output of a Python script (as a the <em>version number</em> of the code that generated that output).</p>
<p>How can I access the current git hash in my Python script?</p>
| 187,701 | 182,172 | 2024-12-23 14:31:29 | 14,989,911 | 128 | 2013-02-20 21:06:49 | 893 | 2018-03-13 13:23:10 | https://stackoverflow.com/q/14989858 | https://stackoverflow.com/a/14989911 | <p>The <a href="https://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a> command is a good way of creating a human-presentable "version number" of the code. From the examples in the documentation:</p>
<blockquote>
<p>With something like git.git current... | <p>The <a href="https://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a> command is a good way of creating a human-presentable "version number" of the code. From the examples in the documentation:</p> <blockquote> <p>With something like git.git current... | 16, 119, 117987 | git, git-hash, python | <h1>Get the current git hash in a Python script</h1>
<p>I would like to include the current git hash in the output of a Python script (as a the <em>version number</em> of the code that generated that output).</p>
<p>How can I access the current git hash in my Python script?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,628 | git | # Get the current git hash in a Python script
I would like to include the current git hash in the output of a Python script (as a the *version number* of the code that generated that output).
How can I access the current git hash in my Python script? | The [`git describe`](https://www.kernel.org/pub/software/scm/git/docs/git-describe.html) command is a good way of creating a human-presentable "version number" of the code. From the examples in the documentation:
> With something like git.git current tree, I get:
>
> ```
> [torvalds@g5 git]$ git describe parent
> v1.0... |
2604625 | Git: How to remove file from index without deleting files from any repository | 186 | 2010-04-09 01:52:07 | <p>When you use</p>
<pre><code>git rm --cached myfile
</code></pre>
<p>it doesn't delete from the local filesystem, which is the goal. But if you've already versioned and committed the file, pushed it to a central repository, and pulled it into yet another repository before using the command, it will delete the file ... | 126,713 | 312,427 | 2022-01-20 14:57:15 | 2,612,663 | 128 | 2010-04-10 07:52:26 | 193,688 | 2010-04-10 07:52:26 | https://stackoverflow.com/q/2604625 | https://stackoverflow.com/a/2612663 | <p>I do not think a Git commit can record an intention like “stop tracking this file, but do not delete it”.</p>
<p>Enacting such an intention will require intervention outside Git in any repositories that merge (or rebase onto) a commit that deletes the file.</p>
<hr>
<h2>Save a Copy, Apply Deletion, Restore</h2>
... | <p>I do not think a Git commit can record an intention like “stop tracking this file, but do not delete it”.</p> <p>Enacting such an intention will require intervention outside Git in any repositories that merge (or rebase onto) a commit that deletes the file.</p> <hr> <h2>Save a Copy, Apply Deletion, Restore</h2> ... | 119, 456, 25056, 112901 | git, gitignore, git-rm, version-control | <h1>Git: How to remove file from index without deleting files from any repository</h1>
<p>When you use</p>
<pre><code>git rm --cached myfile
</code></pre>
<p>it doesn't delete from the local filesystem, which is the goal. But if you've already versioned and committed the file, pushed it to a central repository, and p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,629 | git | # Git: How to remove file from index without deleting files from any repository
When you use
```
git rm --cached myfile
```
it doesn't delete from the local filesystem, which is the goal. But if you've already versioned and committed the file, pushed it to a central repository, and pulled it into yet another reposit... | I do not think a Git commit can record an intention like “stop tracking this file, but do not delete it”.
Enacting such an intention will require intervention outside Git in any repositories that merge (or rebase onto) a commit that deletes the file.
---
## Save a Copy, Apply Deletion, Restore
Probably the easiest ... |
1489830 | Efficient way to determine number of digits in an integer | 173 | 2009-09-28 23:20:15 | <p>What is a very <strong><em>efficient</em></strong> way of determining how many digits there are in an integer in C++?</p>
| 318,437 | 141,203 | 2025-11-23 12:50:28 | 1,489,873 | 128 | 2009-09-28 23:35:57 | 180,697 | 2025-11-23 12:50:28 | https://stackoverflow.com/q/1489830 | https://stackoverflow.com/a/1489873 | <p>Well, the most efficient way, presuming you know the size of the integer, would be a lookup. Should be faster than the much shorter logarithm based approach. If you don't care about counting the '-', remove the + 1.</p>
<pre><code>#include <climits>
// generic solution
template <class T>
int numDigits... | <p>Well, the most efficient way, presuming you know the size of the integer, would be a lookup. Should be faster than the much shorter logarithm based approach. If you don't care about counting the '-', remove the + 1.</p> <pre><code>#include <climits> // generic solution template <class T> int numDigits... | 10, 2054, 9914 | c++, digits, integer | <h1>Efficient way to determine number of digits in an integer</h1>
<p>What is a very <strong><em>efficient</em></strong> way of determining how many digits there are in an integer in C++?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,630 | git | # Efficient way to determine number of digits in an integer
What is a very ***efficient*** way of determining how many digits there are in an integer in C++? | Well, the most efficient way, presuming you know the size of the integer, would be a lookup. Should be faster than the much shorter logarithm based approach. If you don't care about counting the '-', remove the + 1.
```
#include <climits>
// generic solution
template <class T>
int numDigits(T number)
{
int digits... |
33674426 | git revert --no-commit without staging | 137 | 2015-11-12 14:58:59 | <p>Usually the command <code>git revert</code> automatically creates some commits with commit log messages stating which commits were reverted.</p>
<p>To avoid automatic commit there's the option <code>-n</code> (or <code>--no-commit</code>).</p>
<p>But after this command, the reverted files are in the staged area. I... | 111,456 | 297,373 | 2015-11-17 08:45:56 | 33,676,571 | 128 | 2015-11-12 16:34:44 | 1,256,452 | 2015-11-12 16:34:44 | https://stackoverflow.com/q/33674426 | https://stackoverflow.com/a/33676571 | <p>There is no single command for it. As you already noted, you can combine <code>git revert -n</code> with <code>git reset</code> to get the reversion undone in the index.</p>
<p>Besides that method, you can use <code>git apply -R</code> to "reverse apply" a patch, and you can turn a commit into a patch with <code>g... | <p>There is no single command for it. As you already noted, you can combine <code>git revert -n</code> with <code>git reset</code> to get the reversion undone in the index.</p> <p>Besides that method, you can use <code>git apply -R</code> to "reverse apply" a patch, and you can turn a commit into a patch with <code>g... | 119, 34403 | git, git-revert | <h1>git revert --no-commit without staging</h1>
<p>Usually the command <code>git revert</code> automatically creates some commits with commit log messages stating which commits were reverted.</p>
<p>To avoid automatic commit there's the option <code>-n</code> (or <code>--no-commit</code>).</p>
<p>But after this comma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,631 | git | # git revert --no-commit without staging
Usually the command `git revert` automatically creates some commits with commit log messages stating which commits were reverted.
To avoid automatic commit there's the option `-n` (or `--no-commit`).
But after this command, the reverted files are in the staged area. I can uns... | There is no single command for it. As you already noted, you can combine `git revert -n` with `git reset` to get the reversion undone in the index.
Besides that method, you can use `git apply -R` to "reverse apply" a patch, and you can turn a commit into a patch with `git show`, so:
```
$ git show <rev> | git apply -... |
31448445 | git log show one commit id only | 126 | 2015-07-16 07:56:54 | <p>I need some help. It is possible to only show one commit id? Since git log -3 show the log from 1 - 3, I just want to show only 3. What possible command will match for it?</p>
<p>I use the command</p>
<pre><code>git log -3 --pretty=format:"%h"
</code></pre>
<p>the result is</p>
<pre><code>ffbef87
cf0e073
1... | 147,528 | 3,928,061 | 2024-04-23 15:49:12 | 31,448,684 | 128 | 2015-07-16 08:08:52 | 26,396 | 2020-04-14 07:40:27 | https://stackoverflow.com/q/31448445 | https://stackoverflow.com/a/31448684 | <p>You can use <code>git show</code> <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Ancestry-References" rel="noreferrer">referencing the third parent</a> from your current commit (i.e. the second ancestor from <code>HEAD</code>). Also, <code>git show</code> accepts the same format string as <code... | <p>You can use <code>git show</code> <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Ancestry-References" rel="noreferrer">referencing the third parent</a> from your current commit (i.e. the second ancestor from <code>HEAD</code>). Also, <code>git show</code> accepts the same format string as <code... | 119, 47913, 53850 | git, git-commit, git-log | <h1>git log show one commit id only</h1>
<p>I need some help. It is possible to only show one commit id? Since git log -3 show the log from 1 - 3, I just want to show only 3. What possible command will match for it?</p>
<p>I use the command</p>
<pre><code>git log -3 --pretty=format:"%h"
</code></pre>
<p>the r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,633 | git | # git log show one commit id only
I need some help. It is possible to only show one commit id? Since git log -3 show the log from 1 - 3, I just want to show only 3. What possible command will match for it?
I use the command
```
git log -3 --pretty=format:"%h"
```
the result is
```
ffbef87
cf0e073
1c76c5d
```
I on... | You can use `git show` [referencing the third parent](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Ancestry-References) from your current commit (i.e. the second ancestor from `HEAD`). Also, `git show` accepts the same format string as `git log`:
```
git show HEAD~2 --pretty=format:"%h" --no-patch
```
... |
471300 | git: switch branch without detaching head | 114 | 2009-01-22 23:37:05 | <p>I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine.</p>
<p>Now, on a different machine, I try to clone my repository (git clone <em>repository</em>) and then switch to the experimental ... | 51,534 | 3,161 | 2019-08-20 17:06:12 | 471,322 | 128 | 2009-01-22 23:44:48 | 15,614 | 2014-05-05 16:40:16 | https://stackoverflow.com/q/471300 | https://stackoverflow.com/a/471322 | <pre class="lang-bash prettyprint-override"><code># first time: make origin/branchname locally available as localname
git checkout -b localname origin/branchname
# othertimes
git checkout localname
git push origin
</code></pre>
<p>For convenience, you may use the same string for localname & branchname<br>
Whe... | <pre class="lang-bash prettyprint-override"><code># first time: make origin/branchname locally available as localname git checkout -b localname origin/branchname # othertimes git checkout localname git push origin </code></pre> <p>For convenience, you may use the same string for localname & branchname<br> Whe... | 119, 456 | git, version-control | <h1>git: switch branch without detaching head</h1>
<p>I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine.</p>
<p>Now, on a different machine, I try to clone my repository (git clone <em>re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,634 | git | # git: switch branch without detaching head
I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine.
Now, on a different machine, I try to clone my repository (git clone *repository*) and then ... | ```
# first time: make origin/branchname locally available as localname
git checkout -b localname origin/branchname
# othertimes
git checkout localname
git push origin
```
For convenience, you may use the same string for localname & branchname
When you checked out `origin/branchname` you weren't really checking... |
8691199 | What does "T" mean in "git status"? (it isn't in the man page) | 97 | 2012-01-01 00:16:34 | <p>When I type <code>git status</code> I see:</p>
<pre><code>T /path/to/file...
M /path/to/otherfile...
</code></pre>
<p>What exactly does the <code>T</code> <code>git status</code> mean?</p>
<p>I tried <code>man git-status</code> (I think it <em>should</em> be there, but isn't).</p>
| 33,539 | 479,964 | 2021-11-13 01:26:55 | 8,691,226 | 128 | 2012-01-01 00:24:29 | 377,037 | 2012-01-01 15:53:47 | https://stackoverflow.com/q/8691199 | https://stackoverflow.com/a/8691226 | <p>It means that the type of a file changed. For example, a symbolic link that became a regular file.</p>
<p>As far as I know, this only applies to symlinks, submodules and regular files</p>
<p><strong>Edit</strong><br>
A source was requested for this information. While this is simply information that's in my head, I... | <p>It means that the type of a file changed. For example, a symbolic link that became a regular file.</p> <p>As far as I know, this only applies to symlinks, submodules and regular files</p> <p><strong>Edit</strong><br> A source was requested for this information. While this is simply information that's in my head, I... | 119 | git | <h1>What does "T" mean in "git status"? (it isn't in the man page)</h1>
<p>When I type <code>git status</code> I see:</p>
<pre><code>T /path/to/file...
M /path/to/otherfile...
</code></pre>
<p>What exactly does the <code>T</code> <code>git status</code> mean?</p>
<p>I tried <code>man git-status</code> (I think it <e... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,635 | git | # What does "T" mean in "git status"? (it isn't in the man page)
When I type `git status` I see:
```
T /path/to/file...
M /path/to/otherfile...
```
What exactly does the `T` `git status` mean?
I tried `man git-status` (I think it *should* be there, but isn't). | It means that the type of a file changed. For example, a symbolic link that became a regular file.
As far as I know, this only applies to symlinks, submodules and regular files
**Edit**
A source was requested for this information. While this is simply information that's in my head, I was able to find a few referenc... |
4131164 | How do I pull from another computer's repository in Git? | 91 | 2010-11-09 06:52:12 | <p>For example, I have cloned the origin repository on two computers. Then, I go ahead and make some changes and commit to the local repository of computer A. How do I now pull these changes to computer B? Both computer A and B are connected to a network. </p>
<p>What I am looking for will be the equivalent of someone... | 79,509 | 131,050 | 2019-01-13 14:39:25 | 4,131,239 | 128 | 2010-11-09 07:07:51 | 148,870 | 2010-11-09 07:07:51 | https://stackoverflow.com/q/4131164 | https://stackoverflow.com/a/4131239 | <p>If the machine you want to pull from is accessible via <code>ssh</code>, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:</p>
<pre><code>$ git remote add repo_b username@host:path/to/repository.git
$ git pull repo_b master
</code></pre>
<p>(You can skip the ste... | <p>If the machine you want to pull from is accessible via <code>ssh</code>, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:</p> <pre><code>$ git remote add repo_b username@host:path/to/repository.git $ git pull repo_b master </code></pre> <p>(You can skip the ste... | 119, 28896 | git, git-pull | <h1>How do I pull from another computer's repository in Git?</h1>
<p>For example, I have cloned the origin repository on two computers. Then, I go ahead and make some changes and commit to the local repository of computer A. How do I now pull these changes to computer B? Both computer A and B are connected to a network... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,636 | git | # How do I pull from another computer's repository in Git?
For example, I have cloned the origin repository on two computers. Then, I go ahead and make some changes and commit to the local repository of computer A. How do I now pull these changes to computer B? Both computer A and B are connected to a network.
What I... | If the machine you want to pull from is accessible via `ssh`, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:
```
$ git remote add repo_b username@host:path/to/repository.git
$ git pull repo_b master
```
(You can skip the step of adding a remote and just specify ... |
3998881 | Git pull into wrong branch | 90 | 2010-10-22 16:26:26 | <p>Myself and one other developer had been merging and pushing our work to a non-master branch called toolwork. That way, we didn't impact the rest of the team. My topic branch was called DPM-93 and my git workflow was this.</p>
<pre><code># do some work
git checkout DPM-93
git commit -m "did some work"
# catch up
gi... | 59,321 | 245,777 | 2021-04-16 09:35:51 | 3,998,923 | 128 | 2010-10-22 16:31:55 | 6,309 | 2010-10-22 16:31:55 | https://stackoverflow.com/q/3998881 | https://stackoverflow.com/a/3998923 | <pre><code>git reset --hard ORIG_HEAD
</code></pre>
<p>From the <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code> man page</a> (if you just did the pull):</p>
<p>Undo a merge or pull</p>
<pre><code>$ git pull (1)
Auto-merging nitfol
CONFLICT (content): Merge... | <pre><code>git reset --hard ORIG_HEAD </code></pre> <p>From the <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git reset</code> man page</a> (if you just did the pull):</p> <p>Undo a merge or pull</p> <pre><code>$ git pull (1) Auto-merging nitfol CONFLICT (content): Merge... | 119, 1879, 4860, 5766 | branch, git, pull, undo | <h1>Git pull into wrong branch</h1>
<p>Myself and one other developer had been merging and pushing our work to a non-master branch called toolwork. That way, we didn't impact the rest of the team. My topic branch was called DPM-93 and my git workflow was this.</p>
<pre><code># do some work
git checkout DPM-93
git comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,637 | git | # Git pull into wrong branch
Myself and one other developer had been merging and pushing our work to a non-master branch called toolwork. That way, we didn't impact the rest of the team. My topic branch was called DPM-93 and my git workflow was this.
```
# do some work
git checkout DPM-93
git commit -m "did some work... | ```
git reset --hard ORIG_HEAD
```
From the [`git reset` man page](http://git-scm.com/docs/git-reset) (if you just did the pull):
Undo a merge or pull
```
$ git pull (1)
Auto-merging nitfol
CONFLICT (content): Merge conflict in nitfol
Automatic merge failed; fix conflicts and then commit the ... |
13746554 | git: 'send-email' is not a git command. See 'git --help' | 80 | 2012-12-06 15:09:53 | <p>I'm trying to send patches with the <code>git send-email</code> But I get the following error:</p>
<pre><code>git: 'send-email' is not a git command. See 'git --help'.
</code></pre>
<p>How to make <code>git send-email</code> works ?</p>
<p>Related links:</p>
<p><a href="http://www.kernel.org/pub/software/scm/git... | 30,780 | 1,003,575 | 2023-07-15 01:16:41 | 13,746,813 | 128 | 2012-12-06 15:22:27 | 988,966 | 2015-03-29 05:08:50 | https://stackoverflow.com/q/13746554 | https://stackoverflow.com/a/13746813 | <p>You need to install the <code>git-email</code> package for it to work. </p>
<p>On <code>Ubuntu</code>, the usual <code>apt-get install git-email</code> works fine. I can confirm the same for <code>Fedora</code> as well (<code>yum install git-email</code>). </p>
<p><a href="https://stackoverflow.com/users/64798... | <p>You need to install the <code>git-email</code> package for it to work. </p> <p>On <code>Ubuntu</code>, the usual <code>apt-get install git-email</code> works fine. I can confirm the same for <code>Fedora</code> as well (<code>yum install git-email</code>). </p> <p><a href="https://stackoverflow.com/users/64798... | 119, 161973 | git, git-send-email | <h1>git: 'send-email' is not a git command. See 'git --help'</h1>
<p>I'm trying to send patches with the <code>git send-email</code> But I get the following error:</p>
<pre><code>git: 'send-email' is not a git command. See 'git --help'.
</code></pre>
<p>How to make <code>git send-email</code> works ?</p>
<p>Related ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,638 | git | # git: 'send-email' is not a git command. See 'git --help'
I'm trying to send patches with the `git send-email` But I get the following error:
```
git: 'send-email' is not a git command. See 'git --help'.
```
How to make `git send-email` works ?
Related links:
<http://www.kernel.org/pub/software/scm/git/docs/git-s... | You need to install the `git-email` package for it to work.
On `Ubuntu`, the usual `apt-get install git-email` works fine. I can confirm the same for `Fedora` as well (`yum install git-email`).
[cebewee](https://stackoverflow.com/users/647987/cebewee) mentions the rationale in the comments:
> Linux distributions oft... |
5283262 | What is GIT_WORK_TREE, why have I never needed to set this ENV var, why now? | 73 | 2011-03-12 15:01:30 | <p>I'm using Git under Ubuntu Linux to sync and deploy my projects.</p>
<p>I have a Repo on my local Linux working machine and two repos on my server, one bare repo and the one as a deployed app.</p>
<p>It always worked fine, but now I've created another repo for my other website I get this error:</p>
<pre><code>roo... | 74,716 | 179,602 | 2020-07-01 11:25:17 | 5,283,457 | 128 | 2011-03-12 15:35:30 | 223,092 | 2020-07-01 11:25:17 | https://stackoverflow.com/q/5283262 | https://stackoverflow.com/a/5283457 | <p>If you have a non-bare git repository, there are two parts to it:</p>
<ul>
<li><p>the working tree.<br />
The working tree has your checked out source code, with any changes you might have made.</p>
</li>
<li><p>the git directory.<br />
The git directory is normally called <code>.git</code>, and is in the top level ... | <p>If you have a non-bare git repository, there are two parts to it:</p> <ul> <li><p>the working tree.<br /> The working tree has your checked out source code, with any changes you might have made.</p> </li> <li><p>the git directory.<br /> The git directory is normally called <code>.git</code>, and is in the top level ... | 119 | git | <h1>What is GIT_WORK_TREE, why have I never needed to set this ENV var, why now?</h1>
<p>I'm using Git under Ubuntu Linux to sync and deploy my projects.</p>
<p>I have a Repo on my local Linux working machine and two repos on my server, one bare repo and the one as a deployed app.</p>
<p>It always worked fine, but no... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,641 | git | # What is GIT_WORK_TREE, why have I never needed to set this ENV var, why now?
I'm using Git under Ubuntu Linux to sync and deploy my projects.
I have a Repo on my local Linux working machine and two repos on my server, one bare repo and the one as a deployed app.
It always worked fine, but now I've created another ... | If you have a non-bare git repository, there are two parts to it:
- the working tree.
The working tree has your checked out source code, with any changes you might have made.
- the git directory.
The git directory is normally called `.git`, and is in the top level of your working tree - this contains all the h... |
25834500 | Push different branch to Heroku | 63 | 2014-09-14 14:47:52 | <p>Just finised work on my <code>other</code> branch. Now I need to test that this works on Heroku before I merge with the <code>master</code> branch.</p>
<p>Is it possible to push the <code>other</code> branch to Heroku and it replace the contents of my last push which was from the <code>master</code> branch?</p>
| 17,863 | 1,003,632 | 2019-11-09 02:35:52 | 25,834,522 | 128 | 2014-09-14 14:50:14 | 2,970,862 | 2014-09-14 14:59:09 | https://stackoverflow.com/q/25834500 | https://stackoverflow.com/a/25834522 | <p>Yes, pushing to a branch named differently that your current one is possible using the syntax:</p>
<pre><code>git push heroku other:master
</code></pre>
<p>This tells Git to push the contents of your <code>other</code> branch to the <code>master</code> branch on the <code>heroku</code> remote. Keep in mind that yo... | <p>Yes, pushing to a branch named differently that your current one is possible using the syntax:</p> <pre><code>git push heroku other:master </code></pre> <p>This tells Git to push the contents of your <code>other</code> branch to the <code>master</code> branch on the <code>heroku</code> remote. Keep in mind that yo... | 119, 8279 | git, heroku | <h1>Push different branch to Heroku</h1>
<p>Just finised work on my <code>other</code> branch. Now I need to test that this works on Heroku before I merge with the <code>master</code> branch.</p>
<p>Is it possible to push the <code>other</code> branch to Heroku and it replace the contents of my last push which was fro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,642 | git | # Push different branch to Heroku
Just finised work on my `other` branch. Now I need to test that this works on Heroku before I merge with the `master` branch.
Is it possible to push the `other` branch to Heroku and it replace the contents of my last push which was from the `master` branch? | Yes, pushing to a branch named differently that your current one is possible using the syntax:
```
git push heroku other:master
```
This tells Git to push the contents of your `other` branch to the `master` branch on the `heroku` remote. Keep in mind that you may have to force push if there are commits on `heroku/mas... |
5738797 | How can I push a local Git branch to a remote with a different name easily? | 333 | 2011-04-21 02:19:08 | <p>I've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.</p>
<p>For example:</p>
<pre><code>$ git clone myrepo.git
$ git checkout -b newb
$ ...
$ git commit -m "Some change"
$ git push origin newb:remote_branch_name
... | 260,559 | 670,478 | 2025-05-23 17:09:24 | 5,739,015 | 127 | 2011-04-21 03:00:52 | 69,755 | 2011-04-21 03:00:52 | https://stackoverflow.com/q/5738797 | https://stackoverflow.com/a/5739015 | <p>Sure. Just set your <code>push.default</code> to <code>upstream</code> to push branches to their upstreams (which is the same that <code>pull</code> will pull from, defined by <code>branch.newb.merge</code>), rather than pushing branches to ones matching in name (which is the default setting for <code>push.default</... | <p>Sure. Just set your <code>push.default</code> to <code>upstream</code> to push branches to their upstreams (which is the same that <code>pull</code> will pull from, defined by <code>branch.newb.merge</code>), rather than pushing branches to ones matching in name (which is the default setting for <code>push.default</... | 119, 456, 28898, 41346 | git, git-push, git-remote, version-control | <h1>How can I push a local Git branch to a remote with a different name easily?</h1>
<p>I've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.</p>
<p>For example:</p>
<pre><code>$ git clone myrepo.git
$ git checkout -... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,643 | git | # How can I push a local Git branch to a remote with a different name easily?
I've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.
For example:
```
$ git clone myrepo.git
$ git checkout -b newb
$ ...
$ git commit -... | Sure. Just set your `push.default` to `upstream` to push branches to their upstreams (which is the same that `pull` will pull from, defined by `branch.newb.merge`), rather than pushing branches to ones matching in name (which is the default setting for `push.default`, `matching`).
```
git config push.default upstream
... |
4526910 | Rename a git submodule directory | 248 | 2010-12-24 14:52:18 | <p>Is there some easy way to rename a git submodule directory (other than going through the entire motion of <a href="https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule">deleting</a> it and re-adding it with a new destination name). </p>
<p>And while we are at it, why is it that I simply cann... | 130,519 | 231,211 | 2025-12-29 20:15:37 | 5,540,263 | 127 | 2011-04-04 14:52:44 | 96,806 | 2022-05-13 20:31:18 | https://stackoverflow.com/q/4526910 | https://stackoverflow.com/a/5540263 | <p>I found following workflow working:</p>
<ul>
<li>Update .gitmodules</li>
<li><code>mv oldpath newpath</code></li>
<li><code>git rm oldpath</code></li>
<li><code>git add newpath</code></li>
<li><code>git submodule sync</code></li>
</ul>
<p>Note: this approach does not update the index and <code>.gitmodules</code> pro... | <p>I found following workflow working:</p> <ul> <li>Update .gitmodules</li> <li><code>mv oldpath newpath</code></li> <li><code>git rm oldpath</code></li> <li><code>git add newpath</code></li> <li><code>git submodule sync</code></li> </ul> <p>Note: this approach does not update the index and <code>.gitmodules</code> pro... | 119, 41612 | git, git-submodules | <h1>Rename a git submodule directory</h1>
<p>Is there some easy way to rename a git submodule directory (other than going through the entire motion of <a href="https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule">deleting</a> it and re-adding it with a new destination name). </p>
<p>And while ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,644 | git | # Rename a git submodule directory
Is there some easy way to rename a git submodule directory (other than going through the entire motion of [deleting](https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule) it and re-adding it with a new destination name).
And while we are at it, why is it that ... | I found following workflow working:
- Update .gitmodules
- `mv oldpath newpath`
- `git rm oldpath`
- `git add newpath`
- `git submodule sync`
Note: this approach does not update the index and `.gitmodules` properly in 2018 versions of GIT.
Note: You may be able to just do `git mv oldpath newpath` now, as pointed out... |
5605347 | Git diff --name-only and copy that list | 164 | 2011-04-09 13:36:48 | <p>I just want to get a list of changed files between two revisions, which is simple:</p>
<pre><code>git diff -–name-only commit1 commit2 > /path/to/my/file
</code></pre>
<p>But, what should I write, if I want copy all that listed files to another place? And I need completely identical directory structure for copi... | 189,037 | 699,972 | 2025-01-23 16:23:03 | 5,919,158 | 127 | 2011-05-07 04:38:54 | 671,728 | 2020-04-15 17:09:48 | https://stackoverflow.com/q/5605347 | https://stackoverflow.com/a/5919158 | <p>Try the following command, which I have tested:</p>
<pre><code>$ cp -pv --parents $(git diff --name-only) DESTINATION-DIRECTORY
</code></pre>
| <p>Try the following command, which I have tested:</p> <pre><code>$ cp -pv --parents $(git diff --name-only) DESTINATION-DIRECTORY </code></pre> | 119 | git | <h1>Git diff --name-only and copy that list</h1>
<p>I just want to get a list of changed files between two revisions, which is simple:</p>
<pre><code>git diff -–name-only commit1 commit2 > /path/to/my/file
</code></pre>
<p>But, what should I write, if I want copy all that listed files to another place? And I need ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,645 | git | # Git diff --name-only and copy that list
I just want to get a list of changed files between two revisions, which is simple:
```
git diff -–name-only commit1 commit2 > /path/to/my/file
```
But, what should I write, if I want copy all that listed files to another place? And I need completely identical directory struc... | Try the following command, which I have tested:
```
$ cp -pv --parents $(git diff --name-only) DESTINATION-DIRECTORY
``` |
36320517 | Making two branches identical | 86 | 2016-03-30 22:00:45 | <p>I have two branches - A and B. B was created from A.</p>
<p>Work on both branches continued in parallel. Work on branch A was bad (resulting in a non-working version) while work on branch B was good. During this time branch B was sometimes merged into branch A (but not the other way around).</p>
<p>Now I want to m... | 70,840 | 871,910 | 2024-08-06 18:37:57 | 36,321,787 | 127 | 2016-03-30 23:49:47 | 1,256,452 | 2016-03-30 23:55:25 | https://stackoverflow.com/q/36320517 | https://stackoverflow.com/a/36321787 | <p>There are a lot of ways to do this and which one you should use depends on what result you want, and particular what you and anyone collaborating with you (if this is a shared repository) expect to see in the future.</p>
<p>The three main ways to do this:</p>
<ol>
<li><p>Don't bother. Abandon branch <code>A</code>,... | <p>There are a lot of ways to do this and which one you should use depends on what result you want, and particular what you and anyone collaborating with you (if this is a shared repository) expect to see in the future.</p> <p>The three main ways to do this:</p> <ol> <li><p>Don't bother. Abandon branch <code>A</code>,... | 119, 456, 717 | git, merge, version-control | <h1>Making two branches identical</h1>
<p>I have two branches - A and B. B was created from A.</p>
<p>Work on both branches continued in parallel. Work on branch A was bad (resulting in a non-working version) while work on branch B was good. During this time branch B was sometimes merged into branch A (but not the oth... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,647 | git | # Making two branches identical
I have two branches - A and B. B was created from A.
Work on both branches continued in parallel. Work on branch A was bad (resulting in a non-working version) while work on branch B was good. During this time branch B was sometimes merged into branch A (but not the other way around).
... | There are a lot of ways to do this and which one you should use depends on what result you want, and particular what you and anyone collaborating with you (if this is a shared repository) expect to see in the future.
The three main ways to do this:
1. Don't bother. Abandon branch `A`, make a new `A2`, and use that.
2... |
9739352 | Git stash pop- needs merge, unable to refresh index | 201 | 2012-03-16 14:43:22 | <p>I can't pop my stash because I merged a branch which apparently conflicts with my stash and now my stash is seemingly unable to be popped.</p>
<pre><code>app.coffee: needs merge
unable to refresh index
</code></pre>
<p>Anyone know how to resolve this?</p>
| 353,350 | 551,828 | 2023-03-30 15:48:46 | 9,749,773 | 126 | 2012-03-17 11:52:11 | 6,309 | 2023-03-30 15:48:46 | https://stackoverflow.com/q/9739352 | https://stackoverflow.com/a/9749773 | <p>First, check <code>git status</code>.<br />
As the OP mentions,</p>
<blockquote>
<p>The actual issue was an unresolved merge conflict from the merge, NOT that the stash would cause a merge conflict.</p>
</blockquote>
<p>That is where <code>git status</code> would mention that file as being "<code>both modified<... | <p>First, check <code>git status</code>.<br /> As the OP mentions,</p> <blockquote> <p>The actual issue was an unresolved merge conflict from the merge, NOT that the stash would cause a merge conflict.</p> </blockquote> <p>That is where <code>git status</code> would mention that file as being "<code>both modified<... | 119, 13091 | git, git-stash | <h1>Git stash pop- needs merge, unable to refresh index</h1>
<p>I can't pop my stash because I merged a branch which apparently conflicts with my stash and now my stash is seemingly unable to be popped.</p>
<pre><code>app.coffee: needs merge
unable to refresh index
</code></pre>
<p>Anyone know how to resolve this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,650 | git | # Git stash pop- needs merge, unable to refresh index
I can't pop my stash because I merged a branch which apparently conflicts with my stash and now my stash is seemingly unable to be popped.
```
app.coffee: needs merge
unable to refresh index
```
Anyone know how to resolve this? | First, check `git status`.
As the OP mentions,
> The actual issue was an unresolved merge conflict from the merge, NOT that the stash would cause a merge conflict.
That is where `git status` would mention that file as being "`both modified`"
> Resolution: Commit the conflicted file.
---
Solution: in this case, s... |
18382986 | git: rename local branch failed | 165 | 2013-08-22 14:14:25 | <p>I don't know why my attempt of renaming local branch failed. I basically cloned the project, then I also have a submodule within the project, and I downloaded the submodule code as well. However, when I use <code>git branch</code> within the submodule, I have:</p>
<pre><code>* (no branch)
master
</code></pre>
<p... | 189,432 | 636,625 | 2025-03-29 09:53:21 | 18,383,042 | 126 | 2013-08-22 14:17:09 | 112,968 | 2013-08-22 14:17:09 | https://stackoverflow.com/q/18382986 | https://stackoverflow.com/a/18383042 | <p>You are currently in <em>detached head state</em>. You must checkout a new branch to associate it with the current commit:</p>
<pre><code>git checkout -b new_branch
</code></pre>
| <p>You are currently in <em>detached head state</em>. You must checkout a new branch to associate it with the current commit:</p> <pre><code>git checkout -b new_branch </code></pre> | 119, 1879, 4510 | branch, git, rename | <h1>git: rename local branch failed</h1>
<p>I don't know why my attempt of renaming local branch failed. I basically cloned the project, then I also have a submodule within the project, and I downloaded the submodule code as well. However, when I use <code>git branch</code> within the submodule, I have:</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,651 | git | # git: rename local branch failed
I don't know why my attempt of renaming local branch failed. I basically cloned the project, then I also have a submodule within the project, and I downloaded the submodule code as well. However, when I use `git branch` within the submodule, I have:
```
* (no branch)
master
```
Th... | You are currently in *detached head state*. You must checkout a new branch to associate it with the current commit:
```
git checkout -b new_branch
``` |
284514 | What is a git topic branch? | 157 | 2008-11-12 16:32:35 | <p>What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?</p>
| 52,668 | 18,103 | 2019-07-22 05:15:25 | 284,817 | 126 | 2008-11-12 18:16:52 | 893 | 2008-11-12 18:16:52 | https://stackoverflow.com/q/284514 | https://stackoverflow.com/a/284817 | <p>Topic branches are typically lightweight branches that you create locally and that have a name that is meaningful for <em>you</em>. They are where you might do work for a bug fix or feature (they're also called feature branches) that is expected to take some time to complete.</p>
<p>Another type of branch is the "r... | <p>Topic branches are typically lightweight branches that you create locally and that have a name that is meaningful for <em>you</em>. They are where you might do work for a bug fix or feature (they're also called feature branches) that is expected to take some time to complete.</p> <p>Another type of branch is the "r... | 119, 456, 1879 | branch, git, version-control | <h1>What is a git topic branch?</h1>
<p>What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,652 | git | # What is a git topic branch?
What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches? | Topic branches are typically lightweight branches that you create locally and that have a name that is meaningful for *you*. They are where you might do work for a bug fix or feature (they're also called feature branches) that is expected to take some time to complete.
Another type of branch is the "remote branch" or ... |
19742345 | What is the format for --date parameter of git commit | 129 | 2013-11-02 13:24:31 | <p>I need to overwrite the date of the commit of Git, all the documentation points to <code>--date</code> parameter, but then leaves one without a clue to the appropriate format. I've tried every permutation I can think of, and i'm getting:</p>
<blockquote>
<p>"fatal: invalid date format:"</p>
</blockquote>
<... | 63,268 | 2,893,496 | 2024-11-28 09:14:31 | 19,742,762 | 126 | 2013-11-02 14:10:24 | 6,309 | 2017-12-12 11:40:15 | https://stackoverflow.com/q/19742345 | https://stackoverflow.com/a/19742762 | <p>Git 2.6+ (Q3 2015) add a new option.</p>
<p>See <a href="https://github.com/git/git/commit/e4f031e34b08e3217c10942e682920a6939308a0" rel="noreferrer">commit e4f031e</a> (30 Jun 2015), and <a href="https://github.com/git/git/commit/aa1462cc3d3b0c4c8ad6a60aaf31e0f3a424162d" rel="noreferrer">commit aa1462c</a>, <a hre... | <p>Git 2.6+ (Q3 2015) add a new option.</p> <p>See <a href="https://github.com/git/git/commit/e4f031e34b08e3217c10942e682920a6939308a0" rel="noreferrer">commit e4f031e</a> (30 Jun 2015), and <a href="https://github.com/git/git/commit/aa1462cc3d3b0c4c8ad6a60aaf31e0f3a424162d" rel="noreferrer">commit aa1462c</a>, <a hre... | 119, 31134 | command-line-arguments, git | <h1>What is the format for --date parameter of git commit</h1>
<p>I need to overwrite the date of the commit of Git, all the documentation points to <code>--date</code> parameter, but then leaves one without a clue to the appropriate format. I've tried every permutation I can think of, and i'm getting:</p>
<blockquote>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,654 | git | # What is the format for --date parameter of git commit
I need to overwrite the date of the commit of Git, all the documentation points to `--date` parameter, but then leaves one without a clue to the appropriate format. I've tried every permutation I can think of, and i'm getting:
> "fatal: invalid date format:"
er... | Git 2.6+ (Q3 2015) add a new option.
See [commit e4f031e](https://github.com/git/git/commit/e4f031e34b08e3217c10942e682920a6939308a0) (30 Jun 2015), and [commit aa1462c](https://github.com/git/git/commit/aa1462cc3d3b0c4c8ad6a60aaf31e0f3a424162d), [commit a5481a6](https://github.com/git/git/commit/a5481a6c9438cbd9c246c... |
900560 | Git: checking out a file from a previous commit and amending it to HEAD | 79 | 2009-05-23 00:47:44 | <p>I recently committed a file to the HEAD of my branch which has errors in it. I need to do the following things:</p>
<ul>
<li> Get that file from one commit previous to HEAD </li><br />
<li> Commit that file back into HEAD </li><br />
</ul>
<p>What's the best way of going about that?</p>
| 48,424 | 40,882 | 2023-08-30 20:06:30 | 900,563 | 126 | 2009-05-23 00:51:06 | 53,850 | 2023-08-30 20:06:30 | https://stackoverflow.com/q/900560 | https://stackoverflow.com/a/900563 | <p>You've practically said it yourself:</p>
<p>First get the file back from one commit before:</p>
<pre><code>$> git checkout HEAD~1 path/to/file.ext
</code></pre>
<p>Then commit it:</p>
<pre><code>$> git commit -a -m 'Retrieved file from older revision'
</code></pre>
<p>If only the changes to that file were pres... | <p>You've practically said it yourself:</p> <p>First get the file back from one commit before:</p> <pre><code>$> git checkout HEAD~1 path/to/file.ext </code></pre> <p>Then commit it:</p> <pre><code>$> git commit -a -m 'Retrieved file from older revision' </code></pre> <p>If only the changes to that file were pres... | 119, 456 | git, version-control | <h1>Git: checking out a file from a previous commit and amending it to HEAD</h1>
<p>I recently committed a file to the HEAD of my branch which has errors in it. I need to do the following things:</p>
<ul>
<li> Get that file from one commit previous to HEAD </li><br />
<li> Commit that file back into HEAD </li><br ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,657 | git | # Git: checking out a file from a previous commit and amending it to HEAD
I recently committed a file to the HEAD of my branch which has errors in it. I need to do the following things:
- Get that file from one commit previous to HEAD
- Commit that file back into HEAD
What's the best way of going about that? | You've practically said it yourself:
First get the file back from one commit before:
```
$> git checkout HEAD~1 path/to/file.ext
```
Then commit it:
```
$> git commit -a -m 'Retrieved file from older revision'
```
If only the changes to that file were present in the last commit, you can even use `git revert`:
```... |
37036381 | How to undo a merge on Bitbucket? | 74 | 2016-05-04 19:27:44 | <p>I've created a merge (into the 'master' branch) that's now on a Bitbucket repo. Long story short: I need to undo that merge. </p>
<p>I know that you can do this at the Github site itself, but Bitbucket doesn't have that feature. I'm not clear on how to do this with Git without causing a mess.</p>
| 151,164 | 1,443,145 | 2024-06-23 02:33:19 | 37,036,587 | 126 | 2016-05-04 19:39:22 | 134,536 | 2016-05-04 23:33:05 | https://stackoverflow.com/q/37036381 | https://stackoverflow.com/a/37036587 | <p>You need to first clone the repository on your local system (you can get the repo URL in SSH or HTTPS format from the "Overview" page of the repository in Bitbucket): </p>
<pre><code>git clone git@bitbucket.org:my/repo.git
-or-
git clone https://my@bitbucket.org/my/repo.git
git checkout master
</code></pre>
<p>..... | <p>You need to first clone the repository on your local system (you can get the repo URL in SSH or HTTPS format from the "Overview" page of the repository in Bitbucket): </p> <pre><code>git clone git@bitbucket.org:my/repo.git -or- git clone https://my@bitbucket.org/my/repo.git git checkout master </code></pre> <p>..... | 119, 8337 | bitbucket, git | <h1>How to undo a merge on Bitbucket?</h1>
<p>I've created a merge (into the 'master' branch) that's now on a Bitbucket repo. Long story short: I need to undo that merge. </p>
<p>I know that you can do this at the Github site itself, but Bitbucket doesn't have that feature. I'm not clear on how to do this with Git wit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,658 | git | # How to undo a merge on Bitbucket?
I've created a merge (into the 'master' branch) that's now on a Bitbucket repo. Long story short: I need to undo that merge.
I know that you can do this at the Github site itself, but Bitbucket doesn't have that feature. I'm not clear on how to do this with Git without causing a me... | You need to first clone the repository on your local system (you can get the repo URL in SSH or HTTPS format from the "Overview" page of the repository in Bitbucket):
```
git clone git@bitbucket.org:my/repo.git
-or-
git clone https://my@bitbucket.org/my/repo.git
git checkout master
```
.. then revert the most recent... |
13464540 | Skip to next modified file in git diff? | 74 | 2012-11-19 23:57:00 | <p>I made the mistake of upgrading a Visual Studio project from 2008 to 2010 without checking in my previous changes first. Because of this I have a huge system generated file (10k+ lines) that had every 4th line changed.</p>
<p>I'm usually pretty good about checking in stuff often, so I will typically just use the d... | 28,581 | 226,897 | 2021-12-16 17:03:29 | 13,464,561 | 126 | 2012-11-19 23:59:16 | 893 | 2012-11-19 23:59:16 | https://stackoverflow.com/q/13464540 | https://stackoverflow.com/a/13464561 | <p>By default, <code>git diff</code> pipes its output through <code>less</code>. So you can use the <code>less</code> commands to search for the next header. Type <code>/^diff</code> and press <kbd>Enter</kbd> to skip to the next file.</p>
| <p>By default, <code>git diff</code> pipes its output through <code>less</code>. So you can use the <code>less</code> commands to search for the next header. Type <code>/^diff</code> and press <kbd>Enter</kbd> to skip to the next file.</p> | 119 | git | <h1>Skip to next modified file in git diff?</h1>
<p>I made the mistake of upgrading a Visual Studio project from 2008 to 2010 without checking in my previous changes first. Because of this I have a huge system generated file (10k+ lines) that had every 4th line changed.</p>
<p>I'm usually pretty good about checking i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,659 | git | # Skip to next modified file in git diff?
I made the mistake of upgrading a Visual Studio project from 2008 to 2010 without checking in my previous changes first. Because of this I have a huge system generated file (10k+ lines) that had every 4th line changed.
I'm usually pretty good about checking in stuff often, so... | By default, `git diff` pipes its output through `less`. So you can use the `less` commands to search for the next header. Type `/^diff` and press `Enter` to skip to the next file. |
2444100 | How can I determine if a given git hash exists on a given branch? | 42 | 2010-03-14 22:39:47 | <p>Background: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it. However, the build system uses the hash alone to check out the code and build it -- it simply stores the branch name, as given, in the build DB metadata.</p>
<p>I... | 21,419 | 293,606 | 2023-11-07 22:50:33 | 2,444,924 | 126 | 2010-03-15 03:27:33 | 39,975 | 2010-03-15 03:27:33 | https://stackoverflow.com/q/2444100 | https://stackoverflow.com/a/2444924 | <p>You can ask <code>git branch</code> directly which branches contain the commit in question:</p>
<pre><code>% git branch -a --contains 4f08c85ad
* master
remotes/origin/bug_872
remotes/origin/bug_898
remotes/origin/master
</code></pre>
| <p>You can ask <code>git branch</code> directly which branches contain the commit in question:</p> <pre><code>% git branch -a --contains 4f08c85ad * master remotes/origin/bug_872 remotes/origin/bug_898 remotes/origin/master </code></pre> | 119 | git | <h1>How can I determine if a given git hash exists on a given branch?</h1>
<p>Background: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it. However, the build system uses the hash alone to check out the code and build it -- it s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,660 | git | # How can I determine if a given git hash exists on a given branch?
Background: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it. However, the build system uses the hash alone to check out the code and build it -- it simply stor... | You can ask `git branch` directly which branches contain the commit in question:
```
% git branch -a --contains 4f08c85ad
* master
remotes/origin/bug_872
remotes/origin/bug_898
remotes/origin/master
``` |
13073062 | Git: warning: refname 'master' is ambiguous | 124 | 2012-10-25 16:26:45 | <p>I saw a few people asking the same question on here but it seems none of their advice is applicable to me. I'm getting the warning that is in the title of this but I don't have any tags named "master". This is the result of <code>git branch -a</code>:</p>
<pre><code>* master
remotes/origin/HEAD -> origin/maste... | 88,362 | 371,122 | 2025-05-07 03:47:30 | 16,302,266 | 125 | 2013-04-30 14:24:20 | 426,877 | 2025-03-27 15:55:40 | https://stackoverflow.com/q/13073062 | https://stackoverflow.com/a/16302266 | <p>For me I tracked down the source of this warning to much earlier when I incorrectly issued an <code>update-ref</code> command. If you forget to specify the full <code>refs/heads/mybranchname</code> path in the first arg, then a file <code>.git/mybranchname</code> gets created, which later leads to this warning when... | <p>For me I tracked down the source of this warning to much earlier when I incorrectly issued an <code>update-ref</code> command. If you forget to specify the full <code>refs/heads/mybranchname</code> path in the first arg, then a file <code>.git/mybranchname</code> gets created, which later leads to this warning when... | 119 | git | <h1>Git: warning: refname 'master' is ambiguous</h1>
<p>I saw a few people asking the same question on here but it seems none of their advice is applicable to me. I'm getting the warning that is in the title of this but I don't have any tags named "master". This is the result of <code>git branch -a</code>:</p>
<pre><c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,661 | git | # Git: warning: refname 'master' is ambiguous
I saw a few people asking the same question on here but it seems none of their advice is applicable to me. I'm getting the warning that is in the title of this but I don't have any tags named "master". This is the result of `git branch -a`:
```
* master
remotes/origin/H... | For me I tracked down the source of this warning to much earlier when I incorrectly issued an `update-ref` command. If you forget to specify the full `refs/heads/mybranchname` path in the first arg, then a file `.git/mybranchname` gets created, which later leads to this warning when you try to switch to that branch.
I... |
9672319 | .gitignore file, where should I put it in my xcode project? | 105 | 2012-03-12 18:01:06 | <p>I want git to ignore my <code>UserInterfaceState.xcuserstate</code> file in my XCode4 project, but where should I put the <code>.gitignore</code> file?, is it inside the <code>.git</code> folder? or out? The <code>.git</code> is in same folder with the <code>ProjectName.xcodeproj</code> file</p>
| 59,161 | 1,179,523 | 2015-11-15 03:56:33 | 9,672,494 | 125 | 2012-03-12 18:14:44 | 807,239 | 2015-06-23 11:14:39 | https://stackoverflow.com/q/9672319 | https://stackoverflow.com/a/9672494 | <p>You can have a <code>.gitignore</code> in every single directory of your project. </p>
<p>However, the best practice is to have one single <code>.gitignore</code> file on the project root directory, and place all files that you want to ignore in it, like this:</p>
<pre><code>ignoredFile.whatever
ignoredDirectory/*... | <p>You can have a <code>.gitignore</code> in every single directory of your project. </p> <p>However, the best practice is to have one single <code>.gitignore</code> file on the project root directory, and place all files that you want to ignore in it, like this:</p> <pre><code>ignoredFile.whatever ignoredDirectory/*... | 119, 908, 25056 | git, gitignore, xcode | <h1>.gitignore file, where should I put it in my xcode project?</h1>
<p>I want git to ignore my <code>UserInterfaceState.xcuserstate</code> file in my XCode4 project, but where should I put the <code>.gitignore</code> file?, is it inside the <code>.git</code> folder? or out? The <code>.git</code> is in same folder with... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,663 | git | # .gitignore file, where should I put it in my xcode project?
I want git to ignore my `UserInterfaceState.xcuserstate` file in my XCode4 project, but where should I put the `.gitignore` file?, is it inside the `.git` folder? or out? The `.git` is in same folder with the `ProjectName.xcodeproj` file | You can have a `.gitignore` in every single directory of your project.
However, the best practice is to have one single `.gitignore` file on the project root directory, and place all files that you want to ignore in it, like this:
```
ignoredFile.whatever
ignoredDirectory/*
directory/ignoredFileInsideDirectory
.svn
`... |
15515729 | git repository ignoring all .dlls | 91 | 2013-03-20 05:00:46 | <p>Title says it all. I am trying to add my NuGet packages to the repository. Everything but the .dll files are being detected. </p>
<p>The gitignore file contains no references to *.dll. The .dll files don't get recognized when located anywhere in the entire repository. info/exclude is also empty.</p>
<p>I have also... | 89,368 | 96,140 | 2022-09-22 11:35:30 | 15,515,842 | 125 | 2013-03-20 05:11:04 | 274,008 | 2013-03-20 05:11:04 | https://stackoverflow.com/q/15515729 | https://stackoverflow.com/a/15515842 | <p>Do you have either <code>~/.gitignore_global</code> or <code>~/.gitignore</code> in your home directory which could also be listing these file patterns?</p>
<p>See <a href="https://help.github.com/articles/ignoring-files">https://help.github.com/articles/ignoring-files</a></p>
| <p>Do you have either <code>~/.gitignore_global</code> or <code>~/.gitignore</code> in your home directory which could also be listing these file patterns?</p> <p>See <a href="https://help.github.com/articles/ignoring-files">https://help.github.com/articles/ignoring-files</a></p> | 119, 25056 | git, gitignore | <h1>git repository ignoring all .dlls</h1>
<p>Title says it all. I am trying to add my NuGet packages to the repository. Everything but the .dll files are being detected. </p>
<p>The gitignore file contains no references to *.dll. The .dll files don't get recognized when located anywhere in the entire repository. info... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,664 | git | # git repository ignoring all .dlls
Title says it all. I am trying to add my NuGet packages to the repository. Everything but the .dll files are being detected.
The gitignore file contains no references to *.dll. The .dll files don't get recognized when located anywhere in the entire repository. info/exclude is also ... | Do you have either `~/.gitignore_global` or `~/.gitignore` in your home directory which could also be listing these file patterns?
See <https://help.github.com/articles/ignoring-files> |
4251940 | Retrospectively add --recursive to a git repo | 91 | 2010-11-23 01:35:08 | <p>If you <code>git clone</code> with <code>--recursive</code>, you can get all the git submodules too.</p>
<p>If I've forgotten to add this magical flag when cloning, as can happen, how do I now go and get any submodules?</p>
<p>Additionally, how can I set the recursive flag as a default for future clones?</p>
| 27,271 | 195,638 | 2022-12-24 03:03:48 | 4,263,049 | 125 | 2010-11-24 02:47:09 | 1,864,976 | 2022-12-24 03:03:48 | https://stackoverflow.com/q/4251940 | https://stackoverflow.com/a/4263049 | <p>You can do it with this after a simple top-level clone:</p>
<pre><code>git submodule update --init --recursive
</code></pre>
<p>I would not recommend making clone do this by default. The proper way to do this if you are using submodules aggressively for development and not just linking to 3rd party OSS libs on githu... | <p>You can do it with this after a simple top-level clone:</p> <pre><code>git submodule update --init --recursive </code></pre> <p>I would not recommend making clone do this by default. The proper way to do this if you are using submodules aggressively for development and not just linking to 3rd party OSS libs on githu... | 119, 456, 34099, 41612 | git, git-clone, git-submodules, version-control | <h1>Retrospectively add --recursive to a git repo</h1>
<p>If you <code>git clone</code> with <code>--recursive</code>, you can get all the git submodules too.</p>
<p>If I've forgotten to add this magical flag when cloning, as can happen, how do I now go and get any submodules?</p>
<p>Additionally, how can I set the r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,665 | git | # Retrospectively add --recursive to a git repo
If you `git clone` with `--recursive`, you can get all the git submodules too.
If I've forgotten to add this magical flag when cloning, as can happen, how do I now go and get any submodules?
Additionally, how can I set the recursive flag as a default for future clones? | You can do it with this after a simple top-level clone:
```
git submodule update --init --recursive
```
I would not recommend making clone do this by default. The proper way to do this if you are using submodules aggressively for development and not just linking to 3rd party OSS libs on github that you may upgrade on... |
5563564 | Completely remove files from Git repo and remote on GitHub | 80 | 2011-04-06 08:36:02 | <p>I accidentally added a folder of images and committed. Then, I made one more commit.
Then I removed those files using <code>git rm -f ./images</code> and committed again. </p>
<p>Right now, I have made a lot more commits in that branch (master). In my HEAD, I don't have that <code>./static/images</code> folder.</p>... | 67,539 | 167,814 | 2017-06-20 08:33:24 | 5,563,603 | 125 | 2011-04-06 08:39:14 | 255,803 | 2014-06-11 04:54:13 | https://stackoverflow.com/q/5563564 | https://stackoverflow.com/a/5563603 | <p>This is what you're looking for: <a href="http://gitready.com/beginner/2009/03/06/ignoring-doesnt-remove-a-file.html" rel="noreferrer">ignoring doesn't remove a file</a>. I suggest you read that page, but here's the specific command to use:</p>
<pre class="lang-bash prettyprint-override"><code>git filter-branch --i... | <p>This is what you're looking for: <a href="http://gitready.com/beginner/2009/03/06/ignoring-doesnt-remove-a-file.html" rel="noreferrer">ignoring doesn't remove a file</a>. I suggest you read that page, but here's the specific command to use:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --i... | 119, 41346, 46509, 112901 | git, git-filter-branch, git-remote, git-rm | <h1>Completely remove files from Git repo and remote on GitHub</h1>
<p>I accidentally added a folder of images and committed. Then, I made one more commit.
Then I removed those files using <code>git rm -f ./images</code> and committed again. </p>
<p>Right now, I have made a lot more commits in that branch (master). In... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,667 | git | # Completely remove files from Git repo and remote on GitHub
I accidentally added a folder of images and committed. Then, I made one more commit.
Then I removed those files using `git rm -f ./images` and committed again.
Right now, I have made a lot more commits in that branch (master). In my HEAD, I don't have that ... | This is what you're looking for: [ignoring doesn't remove a file](http://gitready.com/beginner/2009/03/06/ignoring-doesnt-remove-a-file.html). I suggest you read that page, but here's the specific command to use:
```
git filter-branch --index-filter \
'git rm -r --cached --ignore-unmatch <file/dir>' HEAD
```
Also, to... |
48208487 | How to add commit message using vim? | 73 | 2018-01-11 13:43:02 | <p>I want to add a commit message using vim (or nano, or any other text editor) rather than writing it in the command line using <code>git commit -m</code>.</p>
<p>How I can do this?</p>
| 75,218 | 2,521,785 | 2025-01-06 17:48:10 | 48,208,689 | 125 | 2018-01-11 13:53:18 | 690,049 | 2025-01-06 17:48:10 | https://stackoverflow.com/q/48208487 | https://stackoverflow.com/a/48208689 | <p>This is mostly a question about using VIM, so let's do it.</p>
<p>First, you need to setup Git to use Vim as the editor, if that's not the default for you. You can do that by adding to the git config of your choice (none which is local, <code>--global</code> or <code>--system</code>):</p>
<pre><code>git config --glo... | <p>This is mostly a question about using VIM, so let's do it.</p> <p>First, you need to setup Git to use Vim as the editor, if that's not the default for you. You can do that by adding to the git config of your choice (none which is local, <code>--global</code> or <code>--system</code>):</p> <pre><code>git config --glo... | 119, 370, 53850 | git, git-commit, vim | <h1>How to add commit message using vim?</h1>
<p>I want to add a commit message using vim (or nano, or any other text editor) rather than writing it in the command line using <code>git commit -m</code>.</p>
<p>How I can do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,668 | git | # How to add commit message using vim?
I want to add a commit message using vim (or nano, or any other text editor) rather than writing it in the command line using `git commit -m`.
How I can do this? | This is mostly a question about using VIM, so let's do it.
First, you need to setup Git to use Vim as the editor, if that's not the default for you. You can do that by adding to the git config of your choice (none which is local, `--global` or `--system`):
```
git config --global core.editor vim
```
Then when you co... |
1435953 | How can I pass git SHA1 to compiler as definition using cmake? | 72 | 2009-09-16 23:01:30 | <p>In a Makefile this would be done with something like:</p>
<pre><code>g++ -DGIT_SHA1="`git log -1 | head -n 1`" ...
</code></pre>
<p>This is very useful, because the binary knows exact commit SHA1 so it can dump it in case of segfault.</p>
<p>How can I achieve the same with CMake?</p>
| 39,169 | 61,342 | 2022-04-08 17:06:25 | 4,318,642 | 125 | 2010-11-30 21:05:46 | 265,522 | 2013-01-28 02:32:41 | https://stackoverflow.com/q/1435953 | https://stackoverflow.com/a/4318642 | <p>I've made some CMake modules that peer into a git repo for versioning and similar purposes - they're all in my repository at <a href="https://github.com/rpavlik/cmake-modules">https://github.com/rpavlik/cmake-modules</a></p>
<p>The good thing about these functions is, they will force a re-configure (a rerun of cmak... | <p>I've made some CMake modules that peer into a git repo for versioning and similar purposes - they're all in my repository at <a href="https://github.com/rpavlik/cmake-modules">https://github.com/rpavlik/cmake-modules</a></p> <p>The good thing about these functions is, they will force a re-configure (a rerun of cmak... | 119, 3190, 8822 | cmake, git, sha1 | <h1>How can I pass git SHA1 to compiler as definition using cmake?</h1>
<p>In a Makefile this would be done with something like:</p>
<pre><code>g++ -DGIT_SHA1="`git log -1 | head -n 1`" ...
</code></pre>
<p>This is very useful, because the binary knows exact commit SHA1 so it can dump it in case of segfault.</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,669 | git | # How can I pass git SHA1 to compiler as definition using cmake?
In a Makefile this would be done with something like:
```
g++ -DGIT_SHA1="`git log -1 | head -n 1`" ...
```
This is very useful, because the binary knows exact commit SHA1 so it can dump it in case of segfault.
How can I achieve the same with CMake? | I've made some CMake modules that peer into a git repo for versioning and similar purposes - they're all in my repository at <https://github.com/rpavlik/cmake-modules>
The good thing about these functions is, they will force a re-configure (a rerun of cmake) before a build every time the HEAD commit changes. Unlike do... |
35901915 | How to rebase after squashing commits in the original branch? | 107 | 2016-03-09 20:29:05 | <p>I have</p>
<pre><code>A--B--C master
\
D branch0
</code></pre>
<p>Then I squash <code>B</code> and <code>C</code> into <code>B'</code>.
How do I rebase <code>branch0</code> such that it looks like this:</p>
<pre><code>A--B' master
\
D branch0
</code></pre>
| 37,190 | 1,954,235 | 2024-06-20 14:14:28 | 35,902,693 | 124 | 2016-03-09 21:10:51 | 6,019,731 | 2024-06-06 20:08:00 | https://stackoverflow.com/q/35901915 | https://stackoverflow.com/a/35902693 | <p>Use the <code>--onto</code> argument to <code>git rebase</code>, which changes the baseline that git replays work on.</p>
<pre><code>git checkout branch0
</code></pre>
<p>At this state you should still see <strong>C</strong> in your git history.</p>
<pre><code>git rebase --onto B' C
</code></pre>
<p>This translates ... | <p>Use the <code>--onto</code> argument to <code>git rebase</code>, which changes the baseline that git replays work on.</p> <pre><code>git checkout branch0 </code></pre> <p>At this state you should still see <strong>C</strong> in your git history.</p> <pre><code>git rebase --onto B' C </code></pre> <p>This translates ... | 119, 8974, 29934 | git, git-rebase, rebase | <h1>How to rebase after squashing commits in the original branch?</h1>
<p>I have</p>
<pre><code>A--B--C master
\
D branch0
</code></pre>
<p>Then I squash <code>B</code> and <code>C</code> into <code>B'</code>.
How do I rebase <code>branch0</code> such that it looks like this:</p>
<pre><code>A--B' mast... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,674 | git | # How to rebase after squashing commits in the original branch?
I have
```
A--B--C master
\
D branch0
```
Then I squash `B` and `C` into `B'`.
How do I rebase `branch0` such that it looks like this:
```
A--B' master
\
D branch0
``` | Use the `--onto` argument to `git rebase`, which changes the baseline that git replays work on.
```
git checkout branch0
```
At this state you should still see **C** in your git history.
```
git rebase --onto B' C
```
This translates to: *Take all commits in my current branch since commit **C** (In your case that's... |
29970885 | Cordova 5.0.0: Which files should I commit to git? | 95 | 2015-04-30 14:48:49 | <p>I use Cordova 5.0.0 and i have the following project structure:</p>
<pre><code>MyProject
- hooks
- platforms
- plugins
- resources
- www
- config.xml
</code></pre>
<p>My question now is: Which of these folders can I omit? I ask it because I work on three different platforms. I Develop on li... | 35,275 | 2,391,849 | 2021-05-06 10:11:51 | 29,972,835 | 124 | 2015-04-30 16:16:36 | 754,604 | 2015-04-30 16:16:36 | https://stackoverflow.com/q/29970885 | https://stackoverflow.com/a/29972835 | <p>You can ignore the platforms and plugins directories as long as you haven't added any custom code in them.</p>
<p>When adding plugins and platforms add --save to the command. e.g.</p>
<pre><code>cordova platform add ios@3.8.0 --save
</code></pre>
<p>or </p>
<pre><code>cordova plugin add cordova-plugin-device --s... | <p>You can ignore the platforms and plugins directories as long as you haven't added any custom code in them.</p> <p>When adding plugins and platforms add --save to the command. e.g.</p> <pre><code>cordova platform add ios@3.8.0 --save </code></pre> <p>or </p> <pre><code>cordova plugin add cordova-plugin-device --s... | 25056, 78331 | cordova, gitignore | <h1>Cordova 5.0.0: Which files should I commit to git?</h1>
<p>I use Cordova 5.0.0 and i have the following project structure:</p>
<pre><code>MyProject
- hooks
- platforms
- plugins
- resources
- www
- config.xml
</code></pre>
<p>My question now is: Which of these folders can I omit? I ask it ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,675 | git | # Cordova 5.0.0: Which files should I commit to git?
I use Cordova 5.0.0 and i have the following project structure:
```
MyProject
- hooks
- platforms
- plugins
- resources
- www
- config.xml
```
My question now is: Which of these folders can I omit? I ask it because I work on three different... | You can ignore the platforms and plugins directories as long as you haven't added any custom code in them.
When adding plugins and platforms add --save to the command. e.g.
```
cordova platform add ios@3.8.0 --save
```
or
```
cordova plugin add cordova-plugin-device --save
```
This will save a record of the plugin... |
29106996 | What is a Git commit ID? | 79 | 2015-03-17 18:29:19 | <p>How are the Git commit IDs generated to uniquely identify the commits?</p>
<p>Example: <code>521747298a3790fde1710f3aa2d03b55020575aa</code></p>
<p>How does it work? Are they only unique for each project? Or for the Git repositories globally?</p>
| 112,642 | 1,166,505 | 2022-08-04 20:35:48 | 29,107,504 | 124 | 2015-03-17 18:58:24 | 14,660 | 2022-08-04 20:35:48 | https://stackoverflow.com/q/29106996 | https://stackoverflow.com/a/29107504 | <p>Here's an example of a commit object file, decompressed.</p>
<pre><code>commit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84
parent 6270c56bec8b3cf7468b5dd94168ac410eca1e98
author Michael G. Schwern <schwern@pobox.com> 1659644787 -0700
committer Michael G. Schwern <schwern@pobox.com> 1659644787 -0700
... | <p>Here's an example of a commit object file, decompressed.</p> <pre><code>commit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84 parent 6270c56bec8b3cf7468b5dd94168ac410eca1e98 author Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 committer Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 ... | 119, 6452, 11342, 53850 | git, git-commit, git-svn, uniqueidentifier | <h1>What is a Git commit ID?</h1>
<p>How are the Git commit IDs generated to uniquely identify the commits?</p>
<p>Example: <code>521747298a3790fde1710f3aa2d03b55020575aa</code></p>
<p>How does it work? Are they only unique for each project? Or for the Git repositories globally?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,677 | git | # What is a Git commit ID?
How are the Git commit IDs generated to uniquely identify the commits?
Example: `521747298a3790fde1710f3aa2d03b55020575aa`
How does it work? Are they only unique for each project? Or for the Git repositories globally? | Here's an example of a commit object file, decompressed.
```
commit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84
parent 6270c56bec8b3cf7468b5dd94168ac410eca1e98
author Michael G. Schwern <schwern@pobox.com> 1659644787 -0700
committer Michael G. Schwern <schwern@pobox.com> 1659644787 -0700
feature: I did something... |
24754286 | How to change the git-flow configuration in SourceTree? | 58 | 2014-07-15 09:15:44 | <p>In my team we are migrating from svn to git and we have agreed upon embracing the git-flow flow. I've been playing around a while with SourceTree and the Git-Flow extension. Now, we have decided that the develop branch will be called development/current instead, but I do not find in the SourceTree UI where to change... | 40,773 | 2,260,761 | 2024-05-10 07:06:22 | 24,754,287 | 124 | 2014-07-15 09:15:44 | 2,260,761 | 2020-06-09 09:18:18 | https://stackoverflow.com/q/24754286 | https://stackoverflow.com/a/24754287 | <p>No, it is not possible (at least not at SourceTree 1.4.1.0).</p>
<p>It is possible however to do it manually by editing the file <code>/.git/config</code> in your git repository.</p>
<p>The Git-Flow extension adds it s configuration in the following two sections, which can be freely edited.</p>
<pre><code>[gitflo... | <p>No, it is not possible (at least not at SourceTree 1.4.1.0).</p> <p>It is possible however to do it manually by editing the file <code>/.git/config</code> in your git repository.</p> <p>The Git-Flow extension adds it s configuration in the following two sections, which can be freely edited.</p> <pre><code>[gitflo... | 119, 64339, 90056 | atlassian-sourcetree, git, git-flow | <h1>How to change the git-flow configuration in SourceTree?</h1>
<p>In my team we are migrating from svn to git and we have agreed upon embracing the git-flow flow. I've been playing around a while with SourceTree and the Git-Flow extension. Now, we have decided that the develop branch will be called development/curren... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,678 | git | # How to change the git-flow configuration in SourceTree?
In my team we are migrating from svn to git and we have agreed upon embracing the git-flow flow. I've been playing around a while with SourceTree and the Git-Flow extension. Now, we have decided that the develop branch will be called development/current instead... | No, it is not possible (at least not at SourceTree 1.4.1.0).
It is possible however to do it manually by editing the file `/.git/config` in your git repository.
The Git-Flow extension adds it s configuration in the following two sections, which can be freely edited.
```
[gitflow "branch"]
master = master
dev... |
39438168 | git checkout --ours does not remove files from unmerged files list | 42 | 2016-09-11 16:19:41 | <p>Hi I need to merge two branches like this.</p>
<p>This is just an example what is happening, I work with hundreds of files which need resolution.</p>
<pre><code>git merge branch1
...conflicts...
git status
....
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both ad... | 27,708 | 4,710,968 | 2018-08-10 12:01:11 | 39,439,137 | 124 | 2016-09-11 18:07:48 | 1,256,452 | 2018-03-18 19:42:19 | https://stackoverflow.com/q/39438168 | https://stackoverflow.com/a/39439137 | <p>It's mostly a quirk of how <code>git checkout</code> works internally. The Git folks have a tendency to let implementation dictate interface.</p>
<p>The end result is that after <code>git checkout</code> with <code>--ours</code> or <code>--theirs</code>, if you want to resolve the conflict, you must also <code>git... | <p>It's mostly a quirk of how <code>git checkout</code> works internally. The Git folks have a tendency to let implementation dictate interface.</p> <p>The end result is that after <code>git checkout</code> with <code>--ours</code> or <code>--theirs</code>, if you want to resolve the conflict, you must also <code>git... | 119, 7330, 28897, 37230, 76220 | git, git-branch, git-checkout, git-merge, repository | <h1>git checkout --ours does not remove files from unmerged files list</h1>
<p>Hi I need to merge two branches like this.</p>
<p>This is just an example what is happening, I work with hundreds of files which need resolution.</p>
<pre><code>git merge branch1
...conflicts...
git status
....
# Unmerged paths:
# (use "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 15,679 | git | # git checkout --ours does not remove files from unmerged files list
Hi I need to merge two branches like this.
This is just an example what is happening, I work with hundreds of files which need resolution.
```
git merge branch1
...conflicts...
git status
....
# Unmerged paths:
# (use "git add/rm <file>..." as ap... | It's mostly a quirk of how `git checkout` works internally. The Git folks have a tendency to let implementation dictate interface.
The end result is that after `git checkout` with `--ours` or `--theirs`, if you want to resolve the conflict, you must also `git add` the same paths:
```
git checkout --ours -- path/to/fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.