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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5396381 | getting git branches of a certain age | 24 | 2011-03-22 18:56:20 | <p>My organization is using git branching extensively. As a result, we have produced over 2000 branches in the past year. We are now trying to adopt a strategy for cleaning up all the old branches that are of some given age. I know how to delete branches, but I can't find a straightforward way to list all of the branch... | 7,573 | 248,368 | 2017-08-31 16:51:01 | 5,396,755 | 23 | 2011-03-22 19:31:52 | 119,963 | 2017-08-31 16:51:01 | https://stackoverflow.com/q/5396381 | https://stackoverflow.com/a/5396755 | <p>The answers using committer dates are a good direction... if you want to delete branches that point to old commits. But you might want to delete branches which are actually old; if you create a branch today pointing to a commit from last year, you don't want it wiped!</p>
<p>So, you want to examine the reflog dates... | <p>The answers using committer dates are a good direction... if you want to delete branches that point to old commits. But you might want to delete branches which are actually old; if you create a branch today pointing to a commit from last year, you don't want it wiped!</p> <p>So, you want to examine the reflog dates... | 119, 456, 76220 | git, git-branch, version-control | <h1>getting git branches of a certain age</h1>
<p>My organization is using git branching extensively. As a result, we have produced over 2000 branches in the past year. We are now trying to adopt a strategy for cleaning up all the old branches that are of some given age. I know how to delete branches, but I can't find ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,928 | git | # getting git branches of a certain age
My organization is using git branching extensively. As a result, we have produced over 2000 branches in the past year. We are now trying to adopt a strategy for cleaning up all the old branches that are of some given age. I know how to delete branches, but I can't find a straigh... | The answers using committer dates are a good direction... if you want to delete branches that point to old commits. But you might want to delete branches which are actually old; if you create a branch today pointing to a commit from last year, you don't want it wiped!
So, you want to examine the reflog dates instead.
... |
1603034 | How do you deploy cron jobs to production? | 24 | 2009-10-21 19:24:02 | <p>How do people deploy/version control cronjobs to production? I'm more curious about conventions/standards people use than any particular solution, but I happen to be using git for revision control, and the cronjob is running a python/django script.</p>
| 16,947 | 142,318 | 2019-12-17 09:28:56 | 1,603,598 | 23 | 2009-10-21 21:00:24 | 190,259 | 2013-03-06 12:36:53 | https://stackoverflow.com/q/1603034 | https://stackoverflow.com/a/1603598 | <p>If you are using <a href="http://docs.fabfile.org/0.9/" rel="noreferrer">Fabric</a> for deploment you could add a function that edits your crontab. </p>
<pre><code>def add_cronjob():
run('crontab -l > /tmp/crondump')
run('echo "@daily /path/to/dostuff.sh 2> /dev/null" >> /tmp/crondu... | <p>If you are using <a href="http://docs.fabfile.org/0.9/" rel="noreferrer">Fabric</a> for deploment you could add a function that edits your crontab. </p> <pre><code>def add_cronjob(): run('crontab -l > /tmp/crondump') run('echo "@daily /path/to/dostuff.sh 2> /dev/null" >> /tmp/crondu... | 119, 243, 601 | cron, django, git | <h1>How do you deploy cron jobs to production?</h1>
<p>How do people deploy/version control cronjobs to production? I'm more curious about conventions/standards people use than any particular solution, but I happen to be using git for revision control, and the cronjob is running a python/django script.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,929 | git | # How do you deploy cron jobs to production?
How do people deploy/version control cronjobs to production? I'm more curious about conventions/standards people use than any particular solution, but I happen to be using git for revision control, and the cronjob is running a python/django script. | If you are using [Fabric](http://docs.fabfile.org/0.9/) for deploment you could add a function that edits your crontab.
```
def add_cronjob():
run('crontab -l > /tmp/crondump')
run('echo "@daily /path/to/dostuff.sh 2> /dev/null" >> /tmp/crondump')
run('crontab /tmp/crondump')
```
This would a... |
66629436 | What does git checkout still do after git switch got introduced? | 23 | 2021-03-14 20:52:45 | <p>As everyone knows, <code>git checkout</code> is a very overloaded command. And I do understand that certain commands got introduced to distribute, e.g. to <code>git switch</code>.</p>
<p>Before I used the following commands:</p>
<pre><code>$ git checkout <existing-branch>
$ git checkout <hash>
$ git chec... | 5,680 | 1,385,931 | 2025-09-03 16:02:12 | 66,629,531 | 23 | 2021-03-14 21:02:58 | 7,976,758 | 2025-09-03 16:02:12 | https://stackoverflow.com/q/66629436 | https://stackoverflow.com/a/66629531 | <p>It's retained at least for backward compatibility. Think about millions of scripts that still use <code>git checkout</code> — should we hurry to rewrite all of them? Certainly no.</p>
<p>It's not even deprecated, actually. There is nothing about deprecation in <a href="https://git-scm.com/docs/git-checkout" rel="nof... | <p>It's retained at least for backward compatibility. Think about millions of scripts that still use <code>git checkout</code> — should we hurry to rewrite all of them? Certainly no.</p> <p>It's not even deprecated, actually. There is nothing about deprecation in <a href="https://git-scm.com/docs/git-checkout" rel="nof... | 119, 37230, 147522 | git, git-checkout, git-switch | <h1>What does git checkout still do after git switch got introduced?</h1>
<p>As everyone knows, <code>git checkout</code> is a very overloaded command. And I do understand that certain commands got introduced to distribute, e.g. to <code>git switch</code>.</p>
<p>Before I used the following commands:</p>
<pre><code>$ g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,930 | git | # What does git checkout still do after git switch got introduced?
As everyone knows, `git checkout` is a very overloaded command. And I do understand that certain commands got introduced to distribute, e.g. to `git switch`.
Before I used the following commands:
```
$ git checkout <existing-branch>
$ git checkout <h... | It's retained at least for backward compatibility. Think about millions of scripts that still use `git checkout` — should we hurry to rewrite all of them? Certainly no.
It's not even deprecated, actually. There is nothing about deprecation in [the docs](https://git-scm.com/docs/git-checkout). On the other hand the doc... |
28076760 | `git add` adds ^M to the end of every line | 23 | 2015-01-21 21:02:59 | <p>I'm on Ubuntu 14.04. I'm editing files with <strong>Vim</strong>. Suddenly I started to notice that the changes that I make which I see with <code>git diff filename</code> contain <code>^M</code> at the end of every line that I've inserted or changed. So after I run <code>git add</code> to the <code>filename</code> ... | 17,513 | 400,745 | 2021-03-10 16:11:06 | 28,076,848 | 23 | 2015-01-21 21:09:30 | 2,480,715 | 2021-03-10 16:11:06 | https://stackoverflow.com/q/28076760 | https://stackoverflow.com/a/28076848 | <p>Are your files being checked in from a Windows computer at any point? Windows adds <code>CR+LF</code> to line endings, while other OS's use <code>LF</code> only. If you've set <code>core.autocrlf</code> to <code>false</code> then <code>git diff</code> will highlight CR characters as <code>^M</code>. To turn this off... | <p>Are your files being checked in from a Windows computer at any point? Windows adds <code>CR+LF</code> to line endings, while other OS's use <code>LF</code> only. If you've set <code>core.autocrlf</code> to <code>false</code> then <code>git diff</code> will highlight CR characters as <code>^M</code>. To turn this off... | 119, 370, 3705, 12725, 14215 | addition, git, newline, special-characters, vim | <h1>`git add` adds ^M to the end of every line</h1>
<p>I'm on Ubuntu 14.04. I'm editing files with <strong>Vim</strong>. Suddenly I started to notice that the changes that I make which I see with <code>git diff filename</code> contain <code>^M</code> at the end of every line that I've inserted or changed. So after I ru... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,931 | git | # `git add` adds ^M to the end of every line
I'm on Ubuntu 14.04. I'm editing files with **Vim**. Suddenly I started to notice that the changes that I make which I see with `git diff filename` contain `^M` at the end of every line that I've inserted or changed. So after I run `git add` to the `filename` I see with `gi... | Are your files being checked in from a Windows computer at any point? Windows adds `CR+LF` to line endings, while other OS's use `LF` only. If you've set `core.autocrlf` to `false` then `git diff` will highlight CR characters as `^M`. To turn this off, you can alter the `core.whitespace` setting:
```
git config --glob... |
10689977 | How to include newline characters in git tag messages | 23 | 2012-05-21 17:42:34 | <p>When I tag versioned code in git, I like using bullet points in the tag message.</p>
<p>This can easily be done with annotated tags:</p>
<pre><code>git tag -a v1.0.0
* Change number 1
* Change number 2
#
# Write a tag message
#
</code></pre>
<p>However, if I attempt the same tag with the -m option, the tag messa... | 9,783 | 1,401,139 | 2020-01-17 07:18:47 | 10,690,076 | 23 | 2012-05-21 17:49:45 | 83,605 | 2012-05-21 17:49:45 | https://stackoverflow.com/q/10689977 | https://stackoverflow.com/a/10690076 | <p>The closest solution I found is to use multiple <code>-m</code> options, one for each line. For example:</p>
<pre><code>git tag -a v1.0.0 -m "* Change number 1" -m "* Change number 2"
</code></pre>
<p>from <a href="http://linux.die.net/man/1/git-tag" rel="noreferrer">git-tag man page</a>:</p>
<pre><code>-m <ms... | <p>The closest solution I found is to use multiple <code>-m</code> options, one for each line. For example:</p> <pre><code>git tag -a v1.0.0 -m "* Change number 1" -m "* Change number 2" </code></pre> <p>from <a href="http://linux.die.net/man/1/git-tag" rel="noreferrer">git-tag man page</a>:</p> <pre><code>-m <ms... | 119 | git | <h1>How to include newline characters in git tag messages</h1>
<p>When I tag versioned code in git, I like using bullet points in the tag message.</p>
<p>This can easily be done with annotated tags:</p>
<pre><code>git tag -a v1.0.0
* Change number 1
* Change number 2
#
# Write a tag message
#
</code></pre>
<p>Howev... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,933 | git | # How to include newline characters in git tag messages
When I tag versioned code in git, I like using bullet points in the tag message.
This can easily be done with annotated tags:
```
git tag -a v1.0.0
* Change number 1
* Change number 2
#
# Write a tag message
#
```
However, if I attempt the same tag with the -... | The closest solution I found is to use multiple `-m` options, one for each line. For example:
```
git tag -a v1.0.0 -m "* Change number 1" -m "* Change number 2"
```
from [git-tag man page](http://linux.die.net/man/1/git-tag):
```
-m <msg>
Use the given tag message (instead of prompting). If multiple
-m option... |
5999495 | Using an alternate diff algorithm in Git | 23 | 2011-05-14 02:46:38 | <p>Because <code>git</code> is designed for source code, its default <code>diff</code> algorithm treats a line as the minimum indivisible unit.</p>
<p>I am trying to edit some markdown files that are word wrapped at column 80. Adding a sentence can cause the rest of the paragraph to be marked as changed.</p>
<p>Is t... | 4,278 | 163,177 | 2015-03-06 10:37:11 | 5,999,521 | 23 | 2011-05-14 02:55:30 | 500,776 | 2011-05-14 02:55:30 | https://stackoverflow.com/q/5999495 | https://stackoverflow.com/a/5999521 | <p>You might try <code>git diff --word-diff</code> instead.</p>
<pre><code>$ git diff --word-diff
diff --git a/test.txt b/test.txt
index 54585bb..a8cd97e 100644
--- a/test.txt
+++ b/test.txt
@@ -1,7 +1,7 @@
Because git is designed for source code, its diff algorithms {+are bibbity +}
{+bobbity boo+} treat a line as th... | <p>You might try <code>git diff --word-diff</code> instead.</p> <pre><code>$ git diff --word-diff diff --git a/test.txt b/test.txt index 54585bb..a8cd97e 100644 --- a/test.txt +++ b/test.txt @@ -1,7 +1,7 @@ Because git is designed for source code, its diff algorithms {+are bibbity +} {+bobbity boo+} treat a line as th... | 119, 606 | diff, git | <h1>Using an alternate diff algorithm in Git</h1>
<p>Because <code>git</code> is designed for source code, its default <code>diff</code> algorithm treats a line as the minimum indivisible unit.</p>
<p>I am trying to edit some markdown files that are word wrapped at column 80. Adding a sentence can cause the rest of t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,934 | git | # Using an alternate diff algorithm in Git
Because `git` is designed for source code, its default `diff` algorithm treats a line as the minimum indivisible unit.
I am trying to edit some markdown files that are word wrapped at column 80. Adding a sentence can cause the rest of the paragraph to be marked as changed.
... | You might try `git diff --word-diff` instead.
```
$ git diff --word-diff
diff --git a/test.txt b/test.txt
index 54585bb..a8cd97e 100644
--- a/test.txt
+++ b/test.txt
@@ -1,7 +1,7 @@
Because git is designed for source code, its diff algorithms {+are bibbity +}
{+bobbity boo+} treat a line as the minimum indivisible uni... |
31177893 | Why does git log not show anything new after git fetch? | 22 | 2015-07-02 07:16:09 | <p>I am learning about working with Git remotes by reading the <a href="http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes" rel="noreferrer">relevant section of the Pro Git Book</a>.</p>
<p>If you clone a repository, the command automatically adds that remote repository under the name "origin". So, <code>gi... | 27,128 | 258,479 | 2024-08-19 09:42:38 | 31,179,095 | 23 | 2015-07-02 08:15:50 | null | 2015-07-02 08:15:50 | https://stackoverflow.com/q/31177893 | https://stackoverflow.com/a/31179095 | <p>By default, <code>git log</code> shows the log of the current branch. Since fetching without merging doesn't change anything in your current (local) branch, the <code>git log</code> output doesn't change.</p>
<p><code>git log</code> can take the <code>--all</code> option to show the history of all branches, local a... | <p>By default, <code>git log</code> shows the log of the current branch. Since fetching without merging doesn't change anything in your current (local) branch, the <code>git log</code> output doesn't change.</p> <p><code>git log</code> can take the <code>--all</code> option to show the history of all branches, local a... | 119, 28896, 33720 | git, git-fetch, git-pull | <h1>Why does git log not show anything new after git fetch?</h1>
<p>I am learning about working with Git remotes by reading the <a href="http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes" rel="noreferrer">relevant section of the Pro Git Book</a>.</p>
<p>If you clone a repository, the command automatically ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,938 | git | # Why does git log not show anything new after git fetch?
I am learning about working with Git remotes by reading the [relevant section of the Pro Git Book](http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes).
If you clone a repository, the command automatically adds that remote repository under the name "... | By default, `git log` shows the log of the current branch. Since fetching without merging doesn't change anything in your current (local) branch, the `git log` output doesn't change.
`git log` can take the `--all` option to show the history of all branches, local and remote. Alternatively, you can explicitly list the ... |
3697707 | How do I download a specific git commit from a repository? | 22 | 2010-09-13 03:31:09 | <p>I don't have a local code copy/etc, I just want to download a single specific git commit so I can view it. I have the url for the git repository:</p>
<p><a href="http://git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git" rel="noreferrer">git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git</... | 54,823 | 252,091 | 2025-12-10 08:28:56 | 3,761,968 | 23 | 2010-09-21 15:42:27 | 19,750 | 2025-12-10 08:28:56 | https://stackoverflow.com/q/3697707 | https://stackoverflow.com/a/3761968 | <p>In 2025, git 2.49 added a flag <code>--revision</code> to <code>git clone</code>.
A repo can now be fetched from a specific commit.</p>
<p>To fetch a repo with only the minimum information needed to reconstruct the state at a specific commit, i.e. "download the repo at a commit":</p>
<pre><code>git clone -... | <p>In 2025, git 2.49 added a flag <code>--revision</code> to <code>git clone</code>. A repo can now be fetched from a specific commit.</p> <p>To fetch a repo with only the minimum information needed to reconstruct the state at a specific commit, i.e. "download the repo at a commit":</p> <pre><code>git clone -... | 119 | git | <h1>How do I download a specific git commit from a repository?</h1>
<p>I don't have a local code copy/etc, I just want to download a single specific git commit so I can view it. I have the url for the git repository:</p>
<p><a href="http://git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git" rel="noreferre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,940 | git | # How do I download a specific git commit from a repository?
I don't have a local code copy/etc, I just want to download a single specific git commit so I can view it. I have the url for the git repository:
[git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git](http://git://git.kernel.org/pub/scm/linux/ker... | In 2025, git 2.49 added a flag `--revision` to `git clone`.
A repo can now be fetched from a specific commit.
To fetch a repo with only the minimum information needed to reconstruct the state at a specific commit, i.e. "download the repo at a commit":
```
git clone --revision=<commit id> --depth=1 <repo url>
```
---... |
61587133 | Cloning single file from Git repository | 21 | 2020-05-04 07:27:49 | <p>I wanted to clone a sub directory <em><a href="https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_project" rel="noreferrer">https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_project</a></em></p>
<p>from the parent directory</... | 33,756 | 10,515,390 | 2024-08-15 14:11:15 | 61,587,374 | 23 | 2020-05-04 07:45:37 | 605,153 | 2020-05-04 07:45:37 | https://stackoverflow.com/q/61587133 | https://stackoverflow.com/a/61587374 | <p>There is a difference between cloning the whole repo and downloading.
When you say cloning, this means that you're interested in all the history, meaning what happened to the file as the repository has evolved. I don't think its possible with git because its not designed to do so. I'll be glad to be proven otherwise... | <p>There is a difference between cloning the whole repo and downloading. When you say cloning, this means that you're interested in all the history, meaning what happened to the file as the repository has evolved. I don't think its possible with git because its not designed to do so. I'll be glad to be proven otherwise... | 119 | git | <h1>Cloning single file from Git repository</h1>
<p>I wanted to clone a sub directory <em><a href="https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_project" rel="noreferrer">https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_pro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,941 | git | # Cloning single file from Git repository
I wanted to clone a sub directory *<https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_project>*
from the parent directory
*<https://github.com/CoreyMSchafer/code_snippets.git>*
I have gone through some Stack Overflow answers and... | There is a difference between cloning the whole repo and downloading.
When you say cloning, this means that you're interested in all the history, meaning what happened to the file as the repository has evolved. I don't think its possible with git because its not designed to do so. I'll be glad to be proven otherwise th... |
43289444 | git merge conflict after git amend - "Your branch and 'origin/master' have diverged" | 21 | 2017-04-08 02:12:03 | <p>This is what happens:</p>
<ol>
<li>After a recent commit to remote master, I make a small trivial change to my local repo</li>
<li>I add <code>git commit --amend</code> and leave the same commit message as HEAD</li>
<li>I try to push the repo to master with <code>git push</code></li>
</ol>
<p>And now I get</p>
<p... | 9,135 | 228,521 | 2022-06-30 19:55:54 | 43,290,456 | 23 | 2017-04-08 05:16:23 | 6,309 | 2022-06-30 19:55:54 | https://stackoverflow.com/q/43289444 | https://stackoverflow.com/a/43290456 | <p>You changed an existing pushed commit, creating your own version (since its content has changed)</p>
<pre><code> --x---Y (master: that is the X amended)
\
--X (origin/master)
</code></pre>
<p>That is why you have 1 and 1 different commit each between master and origin/master</p>
<blockquote>
<p>What can I d... | <p>You changed an existing pushed commit, creating your own version (since its content has changed)</p> <pre><code> --x---Y (master: that is the X amended) \ --X (origin/master) </code></pre> <p>That is why you have 1 and 1 different commit each between master and origin/master</p> <blockquote> <p>What can I d... | 119, 30968, 62599 | git, git-amend, merge-conflict-resolution | <h1>git merge conflict after git amend - "Your branch and 'origin/master' have diverged"</h1>
<p>This is what happens:</p>
<ol>
<li>After a recent commit to remote master, I make a small trivial change to my local repo</li>
<li>I add <code>git commit --amend</code> and leave the same commit message as HEAD</li>
<li>I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,942 | git | # git merge conflict after git amend - "Your branch and 'origin/master' have diverged"
This is what happens:
1. After a recent commit to remote master, I make a small trivial change to my local repo
2. I add `git commit --amend` and leave the same commit message as HEAD
3. I try to push the repo to master with `git p... | You changed an existing pushed commit, creating your own version (since its content has changed)
```
--x---Y (master: that is the X amended)
\
--X (origin/master)
```
That is why you have 1 and 1 different commit each between master and origin/master
> What can I do to prevent this?
Don't "amend" an exist... |
18137918 | Git pull.rebase this is a possibly dangerous operation | 21 | 2013-08-08 23:28:31 | <p>In the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">git-config</a> documentation the information about pull.rebase:</p>
<blockquote>
<p>pull.rebase </p>
<p>When true, rebase branches on top of the fetched branch,
instead of merging the default branch from the... | 8,364 | 843,704 | 2017-06-15 04:12:20 | 18,138,117 | 23 | 2013-08-08 23:49:40 | 252,260 | 2014-11-07 16:13:02 | https://stackoverflow.com/q/18137918 | https://stackoverflow.com/a/18138117 | <p>Let's say you have these Git repositories: </p>
<ul>
<li>your private repo, sitting on your work computer;</li>
<li>your public repo, <code>you</code>, hosted somewhere;</li>
<li>a main repo, <code>origin</code>, which is the main development tree.</li>
</ul>
<p>You're working on something and made two commits A a... | <p>Let's say you have these Git repositories: </p> <ul> <li>your private repo, sitting on your work computer;</li> <li>your public repo, <code>you</code>, hosted somewhere;</li> <li>a main repo, <code>origin</code>, which is the main development tree.</li> </ul> <p>You're working on something and made two commits A a... | 119, 28896, 29934 | git, git-pull, git-rebase | <h1>Git pull.rebase this is a possibly dangerous operation</h1>
<p>In the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">git-config</a> documentation the information about pull.rebase:</p>
<blockquote>
<p>pull.rebase </p>
<p>When true, rebase branches on top of the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,943 | git | # Git pull.rebase this is a possibly dangerous operation
In the [git-config](https://www.kernel.org/pub/software/scm/git/docs/git-config.html) documentation the information about pull.rebase:
> pull.rebase
>
> When true, rebase branches on top of the fetched branch,
> instead of merging the default branch from the de... | Let's say you have these Git repositories:
- your private repo, sitting on your work computer;
- your public repo, `you`, hosted somewhere;
- a main repo, `origin`, which is the main development tree.
You're working on something and made two commits A and B. You published them to your public repo. In the same time, `... |
7234721 | Getting git to never push a single commit? | 21 | 2011-08-29 19:14:06 | <p>I don't think this is possible, but thought someone might have a nifty idea of how to accomplish this:</p>
<p>I have a project that I checked out that was in existence long before I took it over. I have about a dozen changes in various files that I never want checked in (they're all config changes).</p>
<p>Is there... | 2,674 | null | 2022-04-13 11:58:26 | 7,235,494 | 23 | 2011-08-29 20:22:48 | 389,146 | 2011-08-29 20:22:48 | https://stackoverflow.com/q/7234721 | https://stackoverflow.com/a/7235494 | <p>This is a similar pattern to maintaining a local patch set to an upstream project you don't control. The easiest way to handle this is to have an intermediate branch that all changes get merged through, like this:</p>
<pre><code>___________________________ master
\__________________________ config-changes
\__... | <p>This is a similar pattern to maintaining a local patch set to an upstream project you don't control. The easiest way to handle this is to have an intermediate branch that all changes get merged through, like this:</p> <pre><code>___________________________ master \__________________________ config-changes \__... | 119 | git | <h1>Getting git to never push a single commit?</h1>
<p>I don't think this is possible, but thought someone might have a nifty idea of how to accomplish this:</p>
<p>I have a project that I checked out that was in existence long before I took it over. I have about a dozen changes in various files that I never want chec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,944 | git | # Getting git to never push a single commit?
I don't think this is possible, but thought someone might have a nifty idea of how to accomplish this:
I have a project that I checked out that was in existence long before I took it over. I have about a dozen changes in various files that I never want checked in (they're ... | This is a similar pattern to maintaining a local patch set to an upstream project you don't control. The easiest way to handle this is to have an intermediate branch that all changes get merged through, like this:
```
___________________________ master
\__________________________ config-changes
\_________________... |
1738564 | Is it wise to use branching with one-man git project? | 21 | 2009-11-15 19:41:59 | <p>I have a small project on git, on which I am the sole developer. For now, I used only one main branch to actually get it working.</p>
<p>Now the project is somehow working and I would like to just implement some new features. The question is, should I create new branch for each new feature and merging it back after... | 3,282 | 101,152 | 2012-02-06 19:57:17 | 1,738,624 | 23 | 2009-11-15 19:58:34 | 63,147 | 2012-02-06 19:57:17 | https://stackoverflow.com/q/1738564 | https://stackoverflow.com/a/1738624 | <p>From the <a href="http://schacon.github.com/git/gitworkflows.html" rel="noreferrer"><code>gitworkflows</code></a> man page:</p>
<blockquote>
<p>Any nontrivial feature will require
several patches to implement, and may
get extra bugfixes or improvements
during its lifetime.</p>
<p>Committing everything ... | <p>From the <a href="http://schacon.github.com/git/gitworkflows.html" rel="noreferrer"><code>gitworkflows</code></a> man page:</p> <blockquote> <p>Any nontrivial feature will require several patches to implement, and may get extra bugfixes or improvements during its lifetime.</p> <p>Committing everything ... | 119 | git | <h1>Is it wise to use branching with one-man git project?</h1>
<p>I have a small project on git, on which I am the sole developer. For now, I used only one main branch to actually get it working.</p>
<p>Now the project is somehow working and I would like to just implement some new features. The question is, should I c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,945 | git | # Is it wise to use branching with one-man git project?
I have a small project on git, on which I am the sole developer. For now, I used only one main branch to actually get it working.
Now the project is somehow working and I would like to just implement some new features. The question is, should I create new branch... | From the [`gitworkflows`](http://schacon.github.com/git/gitworkflows.html) man page:
> Any nontrivial feature will require
> several patches to implement, and may
> get extra bugfixes or improvements
> during its lifetime.
>
> Committing everything directly on the
> integration branches leads to many
> problems: Bad c... |
26972340 | How can I determine the date of GIT cherry pick? | 20 | 2014-11-17 12:04:49 | <p>Suppose I:</p>
<ol>
<li>Pushed some file to branch A. </li>
<li>Cherry picked the commit from branch A to branch B. </li>
</ol>
<p>Once I enter git log -1 on branch B, I can see that the date is the original one in which the file was pushed to branch A. </p>
<p>So how can I determine the cherry pick date?</p>
<p... | 7,051 | 4,261,075 | 2023-08-28 07:46:43 | 26,972,463 | 23 | 2014-11-17 12:11:35 | 291,641 | 2014-11-17 12:11:35 | https://stackoverflow.com/q/26972340 | https://stackoverflow.com/a/26972463 | <p>A git commit has two dates. One is the <strong>author date</strong> and the other is the <strong>commit date</strong>. The default display is the author date. You want the commit date. <code>git log -1 --pretty=fuller</code> will show that or you can use <em>%cD</em> in a log format.</p>
| <p>A git commit has two dates. One is the <strong>author date</strong> and the other is the <strong>commit date</strong>. The default display is the author date. You want the commit date. <code>git log -1 --pretty=fuller</code> will show that or you can use <em>%cD</em> in a log format.</p> | 119 | git | <h1>How can I determine the date of GIT cherry pick?</h1>
<p>Suppose I:</p>
<ol>
<li>Pushed some file to branch A. </li>
<li>Cherry picked the commit from branch A to branch B. </li>
</ol>
<p>Once I enter git log -1 on branch B, I can see that the date is the original one in which the file was pushed to branch A. </p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,949 | git | # How can I determine the date of GIT cherry pick?
Suppose I:
1. Pushed some file to branch A.
2. Cherry picked the commit from branch A to branch B.
Once I enter git log -1 on branch B, I can see that the date is the original one in which the file was pushed to branch A.
So how can I determine the cherry pick date... | A git commit has two dates. One is the **author date** and the other is the **commit date**. The default display is the author date. You want the commit date. `git log -1 --pretty=fuller` will show that or you can use *%cD* in a log format. |
21490592 | How select a file from one branch when resolving conflict during git rebase? | 20 | 2014-01-31 21:43:10 | <p>Given a git repo with two branches <code>master</code> and <code>feature</code>. When rebasing the feature branch on top of master using <code>rebase master</code> lets say that file <code>a.txt</code> contains a conflict that needs to be resolved before the rebase can continue.</p>
<p>I know that I can resolve the... | 10,049 | 438,319 | 2014-01-31 22:16:00 | 21,491,020 | 23 | 2014-01-31 22:09:49 | 1,256,452 | 2014-01-31 22:16:00 | https://stackoverflow.com/q/21490592 | https://stackoverflow.com/a/21491020 | <p>Yes. In fact, there's more than one way to do it.</p>
<p>The rebase and merge (and cherry-pick, for that matter) commands all take the same <code>strategy</code> and <code>-X</code> flags to pass to the underlying git merge machinery. For the <code>recursive</code> strategy, <code>-Xours</code> and <code>-Xtheirs... | <p>Yes. In fact, there's more than one way to do it.</p> <p>The rebase and merge (and cherry-pick, for that matter) commands all take the same <code>strategy</code> and <code>-X</code> flags to pass to the underlying git merge machinery. For the <code>recursive</code> strategy, <code>-Xours</code> and <code>-Xtheirs... | 119 | git | <h1>How select a file from one branch when resolving conflict during git rebase?</h1>
<p>Given a git repo with two branches <code>master</code> and <code>feature</code>. When rebasing the feature branch on top of master using <code>rebase master</code> lets say that file <code>a.txt</code> contains a conflict that need... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,950 | git | # How select a file from one branch when resolving conflict during git rebase?
Given a git repo with two branches `master` and `feature`. When rebasing the feature branch on top of master using `rebase master` lets say that file `a.txt` contains a conflict that needs to be resolved before the rebase can continue.
I k... | Yes. In fact, there's more than one way to do it.
The rebase and merge (and cherry-pick, for that matter) commands all take the same `strategy` and `-X` flags to pass to the underlying git merge machinery. For the `recursive` strategy, `-Xours` and `-Xtheirs` choose one or the other "sides" of files in the case of a f... |
11419448 | Git Workflow: Share code between computers without pushing to public repo | 20 | 2012-07-10 18:19:07 | <p>I work at a company which uses Git for our version control. We're using a hosted repo service (Beanstalk) as our internal "public" (by that I mean accessible to the whole dev team) repo. I have two computers that I normally work on for writing code. I like using some of the history rewriting features of Git, specifi... | 17,724 | 439,356 | 2012-07-10 18:46:54 | 11,419,870 | 23 | 2012-07-10 18:46:54 | 410,126 | 2012-07-10 18:46:54 | https://stackoverflow.com/q/11419448 | https://stackoverflow.com/a/11419870 | <p>You can push, fetch and pull between the machines freely assuming you have ssh access between them:</p>
<pre><code>git push computer2:projects/prog HEAD:tmp
</code></pre>
<p>or, if you are on computer2:</p>
<pre><code>git pull computer1:projects/prog HEAD
</code></pre>
<p>or</p>
<pre><code>git fetch computer1:p... | <p>You can push, fetch and pull between the machines freely assuming you have ssh access between them:</p> <pre><code>git push computer2:projects/prog HEAD:tmp </code></pre> <p>or, if you are on computer2:</p> <pre><code>git pull computer1:projects/prog HEAD </code></pre> <p>or</p> <pre><code>git fetch computer1:p... | 119, 758 | git, workflow | <h1>Git Workflow: Share code between computers without pushing to public repo</h1>
<p>I work at a company which uses Git for our version control. We're using a hosted repo service (Beanstalk) as our internal "public" (by that I mean accessible to the whole dev team) repo. I have two computers that I normally work on fo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,952 | git | # Git Workflow: Share code between computers without pushing to public repo
I work at a company which uses Git for our version control. We're using a hosted repo service (Beanstalk) as our internal "public" (by that I mean accessible to the whole dev team) repo. I have two computers that I normally work on for writing... | You can push, fetch and pull between the machines freely assuming you have ssh access between them:
```
git push computer2:projects/prog HEAD:tmp
```
or, if you are on computer2:
```
git pull computer1:projects/prog HEAD
```
or
```
git fetch computer1:prj/prog branch1:t1
git fetch computer1:prj/prog branch2:t2
git... |
8560064 | Git bash home directory different from Git extension than Git Bash | 20 | 2011-12-19 10:35:34 | <p>If i run Git bash from Git Extention (<kbd>CTRL</kbd>+<kbd>G</kbd>), my home directory is %USERPROFILE%, which is ok.</p>
<p>If I run Git bash from the context menu of a git repo folder, or if I run Git bash from the start menu, my home directory is %HOME%, which is different.</p>
<p>How can I set up git bash to a... | 26,258 | 588,868 | 2011-12-19 15:24:43 | 8,562,715 | 23 | 2011-12-19 14:24:26 | 6,309 | 2011-12-19 15:24:43 | https://stackoverflow.com/q/8560064 | https://stackoverflow.com/a/8562715 | <p>The git bash provided with <a href="http://code.google.com/p/msysgit/" rel="nofollow noreferrer">msysgit</a> in <a href="https://github.com/msysgit/msysgit" rel="nofollow noreferrer">its repo</a> is a script you can edit, in order to set <code>HOME</code> to <code>%USERPROFILE%</code>.<br>
It is basically what it do... | <p>The git bash provided with <a href="http://code.google.com/p/msysgit/" rel="nofollow noreferrer">msysgit</a> in <a href="https://github.com/msysgit/msysgit" rel="nofollow noreferrer">its repo</a> is a script you can edit, in order to set <code>HOME</code> to <code>%USERPROFILE%</code>.<br> It is basically what it do... | 119, 39597 | git, git-extensions | <h1>Git bash home directory different from Git extension than Git Bash</h1>
<p>If i run Git bash from Git Extention (<kbd>CTRL</kbd>+<kbd>G</kbd>), my home directory is %USERPROFILE%, which is ok.</p>
<p>If I run Git bash from the context menu of a git repo folder, or if I run Git bash from the start menu, my home dir... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,953 | git | # Git bash home directory different from Git extension than Git Bash
If i run Git bash from Git Extention (`CTRL`+`G`), my home directory is %USERPROFILE%, which is ok.
If I run Git bash from the context menu of a git repo folder, or if I run Git bash from the start menu, my home directory is %HOME%, which is differe... | The git bash provided with [msysgit](http://code.google.com/p/msysgit/) in [its repo](https://github.com/msysgit/msysgit) is a script you can edit, in order to set `HOME` to `%USERPROFILE%`.
It is basically what it does by default, except if `HOME` is already defined, the git bash script won't modify that value (but ... |
62084684 | Rename remote branch without deleting it | 19 | 2020-05-29 11:17:14 | <p>I need your help to rename a remote branch.<br>
I created a PR but now I need to rename the remote branch name.<br>
I don't want to follow the process where I have to rename the local branch then push and delete the old branch because it will clear the PR.<br>
Is there a way to just rename the remote branch and PR s... | 22,344 | 6,656,693 | 2020-05-30 02:18:53 | 62,085,391 | 23 | 2020-05-29 11:54:45 | 497,127 | 2020-05-30 02:18:53 | https://stackoverflow.com/q/62084684 | https://stackoverflow.com/a/62085391 | <p>Renaming a remote branch in Git is really just creating a new branch with same commits and new name and deleting old branch. Depending on where you have pull request open (you don't mention whether is it Github, Gitlab, Phabricator or something else) you might have some options given to you by tool operating on repo... | <p>Renaming a remote branch in Git is really just creating a new branch with same commits and new name and deleting old branch. Depending on where you have pull request open (you don't mention whether is it Github, Gitlab, Phabricator or something else) you might have some options given to you by tool operating on repo... | 119 | git | <h1>Rename remote branch without deleting it</h1>
<p>I need your help to rename a remote branch.<br>
I created a PR but now I need to rename the remote branch name.<br>
I don't want to follow the process where I have to rename the local branch then push and delete the old branch because it will clear the PR.<br>
Is the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,954 | git | # Rename remote branch without deleting it
I need your help to rename a remote branch.
I created a PR but now I need to rename the remote branch name.
I don't want to follow the process where I have to rename the local branch then push and delete the old branch because it will clear the PR.
Is there a way to jus... | Renaming a remote branch in Git is really just creating a new branch with same commits and new name and deleting old branch. Depending on where you have pull request open (you don't mention whether is it Github, Gitlab, Phabricator or something else) you might have some options given to you by tool operating on reposit... |
32262412 | Git ignore: How to match one or more digits | 19 | 2015-08-28 02:24:34 | <p>I would like to make sure that git ignores any log files that are created on a rotating basis. For instance</p>
<pre><code>debug.log
debug.log.1
debug.log.2
debug.log.10
</code></pre>
<p>should all be ignored. I am currently using <code>*.log</code> and <code>*.log.[0-9]</code> to ignore the first 3 in the list. T... | 5,545 | 1,020,391 | 2015-08-28 03:05:03 | 32,262,670 | 23 | 2015-08-28 02:59:30 | 4,154,977 | 2015-08-28 03:05:03 | https://stackoverflow.com/q/32262412 | https://stackoverflow.com/a/32262670 | <p>Sadly but <code>.gitigore</code> use <a href="https://en.wikipedia.org/wiki/Glob_%28programming%29">glob</a> instead of regex for matching, which means there's not a good way to do it.</p>
<blockquote>
<p>Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAM... | <p>Sadly but <code>.gitigore</code> use <a href="https://en.wikipedia.org/wiki/Glob_%28programming%29">glob</a> instead of regex for matching, which means there's not a good way to do it.</p> <blockquote> <p>Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAM... | 18, 119, 25056 | git, gitignore, regex | <h1>Git ignore: How to match one or more digits</h1>
<p>I would like to make sure that git ignores any log files that are created on a rotating basis. For instance</p>
<pre><code>debug.log
debug.log.1
debug.log.2
debug.log.10
</code></pre>
<p>should all be ignored. I am currently using <code>*.log</code> and <code>*.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,959 | git | # Git ignore: How to match one or more digits
I would like to make sure that git ignores any log files that are created on a rotating basis. For instance
```
debug.log
debug.log.1
debug.log.2
debug.log.10
```
should all be ignored. I am currently using `*.log` and `*.log.[0-9]` to ignore the first 3 in the list. To ... | Sadly but `.gitigore` use [glob](https://en.wikipedia.org/wiki/Glob_%28programming%29) instead of regex for matching, which means there's not a good way to do it.
> Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag ...
Of course you can use:
```
*.log... |
70203457 | Change default remote git branch in IntelliJ | 18 | 2021-12-02 16:48:56 | <p>For some reason, my local <code>dev</code> branch is my default release branch. Is there any way in the IntelliJ UI to change this?</p>
<p><a href="https://i.sstatic.net/wsTgC.png" rel="noreferrer"><img src="https://i.sstatic.net/wsTgC.png" alt="enter image description here" /></a></p>
<p>For clarification, by "... | 9,745 | 1,490,169 | 2024-08-28 15:40:31 | 70,315,991 | 23 | 2021-12-11 14:30:18 | 1,318,479 | 2024-08-28 15:40:31 | https://stackoverflow.com/q/70203457 | https://stackoverflow.com/a/70315991 | <p>No GUI way to do it in IntelliJ 2021.2.3, though it's been a feature request for 3 years. If interested, <a href="https://youtrack.jetbrains.com/issue/IDEA-197078" rel="noreferrer">add your vote to IDEA-197078 at IntelliJ</a>.</p>
<p>To set a new default remote branch (also called the upstream branch), open the proj... | <p>No GUI way to do it in IntelliJ 2021.2.3, though it's been a feature request for 3 years. If interested, <a href="https://youtrack.jetbrains.com/issue/IDEA-197078" rel="noreferrer">add your vote to IDEA-197078 at IntelliJ</a>.</p> <p>To set a new default remote branch (also called the upstream branch), open the proj... | 119, 8945 | git, intellij-idea | <h1>Change default remote git branch in IntelliJ</h1>
<p>For some reason, my local <code>dev</code> branch is my default release branch. Is there any way in the IntelliJ UI to change this?</p>
<p><a href="https://i.sstatic.net/wsTgC.png" rel="noreferrer"><img src="https://i.sstatic.net/wsTgC.png" alt="enter image descr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,961 | git | # Change default remote git branch in IntelliJ
For some reason, my local `dev` branch is my default release branch. Is there any way in the IntelliJ UI to change this?
[](https://i.sstatic.net/wsTgC.png)
For clarification, by "default" I mean the defaul... | No GUI way to do it in IntelliJ 2021.2.3, though it's been a feature request for 3 years. If interested, [add your vote to IDEA-197078 at IntelliJ](https://youtrack.jetbrains.com/issue/IDEA-197078).
To set a new default remote branch (also called the upstream branch), open the project and checkout the branch whose def... |
59029992 | Using gitpython, how can I checkout a certain Git commit ID? | 18 | 2019-11-25 10:45:13 | <p>Checking out a branch works well, but I also need to check out a certain commit ID in a given Git repository.</p>
<p>I mean the equivalent of</p>
<pre><code>git clone --no-checkout my-repo-url my-target-path
cd my-target-path
git checkout my-commit-id
</code></pre>
<p>How can I do this with gitpython?</p>
| 11,150 | 394,071 | 2019-11-25 14:47:38 | 59,034,386 | 23 | 2019-11-25 14:47:38 | 2,609,640 | 2019-11-25 14:47:38 | https://stackoverflow.com/q/59029992 | https://stackoverflow.com/a/59034386 | <pre class="lang-py prettyprint-override"><code>repo = git.Repo.clone_from(repo_url, repo_path, no_checkout=True)
repo.git.checkout(commit_id)
</code></pre>
<p>You can find more details in the <a href="https://gitpython.readthedocs.io/en/stable/tutorial.html" rel="noreferrer">documentation</a>.</p>
| <pre class="lang-py prettyprint-override"><code>repo = git.Repo.clone_from(repo_url, repo_path, no_checkout=True) repo.git.checkout(commit_id) </code></pre> <p>You can find more details in the <a href="https://gitpython.readthedocs.io/en/stable/tutorial.html" rel="noreferrer">documentation</a>.</p> | 60010, 61013 | gitpython, python-3.x | <h1>Using gitpython, how can I checkout a certain Git commit ID?</h1>
<p>Checking out a branch works well, but I also need to check out a certain commit ID in a given Git repository.</p>
<p>I mean the equivalent of</p>
<pre><code>git clone --no-checkout my-repo-url my-target-path
cd my-target-path
git checkout my-com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,964 | git | # Using gitpython, how can I checkout a certain Git commit ID?
Checking out a branch works well, but I also need to check out a certain commit ID in a given Git repository.
I mean the equivalent of
```
git clone --no-checkout my-repo-url my-target-path
cd my-target-path
git checkout my-commit-id
```
How can I do th... | ```
repo = git.Repo.clone_from(repo_url, repo_path, no_checkout=True)
repo.git.checkout(commit_id)
```
You can find more details in the [documentation](https://gitpython.readthedocs.io/en/stable/tutorial.html). |
42539892 | Git Blame see changes after a certain date | 18 | 2017-03-01 19:01:56 | <p>Using <a href="https://git-scm.com/docs/git-blame" rel="noreferrer">git blame</a>, is it possible to see only changes made after a certain date on a file?</p>
<p>I am trying to run, <em>git blame</em> on a file with over 10000 lines and a large commit history. Its hard to spot only recent changes using <em>git bla... | 11,151 | 1,219,543 | 2018-11-15 16:41:14 | 42,540,014 | 23 | 2017-03-01 19:08:49 | 1,830,736 | 2018-11-15 16:41:14 | https://stackoverflow.com/q/42539892 | https://stackoverflow.com/a/42540014 | <p>Read the <a href="https://git-scm.com/docs/git-blame#_specifying_ranges" rel="noreferrer">Specifying Ranges</a> section of the git-blame manual. Specifically, you're interested in the <code>--since</code> option:</p>
<blockquote>
<p>When you are not interested in changes older than [...] 3 weeks [for the file <c... | <p>Read the <a href="https://git-scm.com/docs/git-blame#_specifying_ranges" rel="noreferrer">Specifying Ranges</a> section of the git-blame manual. Specifically, you're interested in the <code>--since</code> option:</p> <blockquote> <p>When you are not interested in changes older than [...] 3 weeks [for the file <c... | 119 | git | <h1>Git Blame see changes after a certain date</h1>
<p>Using <a href="https://git-scm.com/docs/git-blame" rel="noreferrer">git blame</a>, is it possible to see only changes made after a certain date on a file?</p>
<p>I am trying to run, <em>git blame</em> on a file with over 10000 lines and a large commit history. It... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,967 | git | # Git Blame see changes after a certain date
Using [git blame](https://git-scm.com/docs/git-blame), is it possible to see only changes made after a certain date on a file?
I am trying to run, *git blame* on a file with over 10000 lines and a large commit history. Its hard to spot only recent changes using *git blame*... | Read the [Specifying Ranges](https://git-scm.com/docs/git-blame#_specifying_ranges) section of the git-blame manual. Specifically, you're interested in the `--since` option:
> When you are not interested in changes older than [...] 3 weeks [for the file `foo`], you can use revision range specifiers similar to [git rev... |
37659606 | Remove a file from Git in Visual Studio | 18 | 2016-06-06 14:07:06 | <p>I am using Git with Visual Studio 2015 and I have a file that I want to remove, but I can't figure out how!</p>
<p>The file is a WebStorm settings file (workspace.xml), which I am using for working on the JavaScript fiels. This file was included as part of a previous Git Push, but I missed my chance at marking it a... | 39,327 | 2,394,816 | 2024-09-02 21:54:40 | 37,659,862 | 23 | 2016-06-06 14:20:02 | 1,863,229 | 2016-06-06 14:20:02 | https://stackoverflow.com/q/37659606 | https://stackoverflow.com/a/37659862 | <p>If you want to retain <code>workspace.xml</code> from the remote repository while keeping it locally as an untracked file, then this <a href="https://stackoverflow.com/questions/29975193/how-to-move-a-tracked-file-to-untracked-using-visual-studio-tools-for-git">cannot easily be done from Visual Studio</a>. Your bes... | <p>If you want to retain <code>workspace.xml</code> from the remote repository while keeping it locally as an untracked file, then this <a href="https://stackoverflow.com/questions/29975193/how-to-move-a-tracked-file-to-untracked-using-visual-studio-tools-for-git">cannot easily be done from Visual Studio</a>. Your bes... | 119, 33953 | git, visual-studio | <h1>Remove a file from Git in Visual Studio</h1>
<p>I am using Git with Visual Studio 2015 and I have a file that I want to remove, but I can't figure out how!</p>
<p>The file is a WebStorm settings file (workspace.xml), which I am using for working on the JavaScript fiels. This file was included as part of a previous... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,968 | git | # Remove a file from Git in Visual Studio
I am using Git with Visual Studio 2015 and I have a file that I want to remove, but I can't figure out how!
The file is a WebStorm settings file (workspace.xml), which I am using for working on the JavaScript fiels. This file was included as part of a previous Git Push, but I... | If you want to retain `workspace.xml` from the remote repository while keeping it locally as an untracked file, then this [cannot easily be done from Visual Studio](https://stackoverflow.com/questions/29975193/how-to-move-a-tracked-file-to-untracked-using-visual-studio-tools-for-git). Your best bet might be to do this ... |
34605817 | Customize Commit message while using npm version patch | 18 | 2016-01-05 06:55:58 | <p>Is it possible to customize the commit message while using <code>npm version patch</code>?</p>
<p>I' d like to change it to <code>:up-arrow: @VERSIONNUMBER</code></p>
| 6,912 | 1,444,743 | 2016-01-05 08:34:36 | 34,606,092 | 23 | 2016-01-05 07:14:21 | 6,309 | 2016-01-05 07:14:21 | https://stackoverflow.com/q/34605817 | https://stackoverflow.com/a/34606092 | <p>Since npm 2.7.4 (and <a href="https://github.com/npm/npm/commit/3703b0b87c127a64649bdbfc3bc697ebccc4aa24" rel="noreferrer">commit 3703b0b, March 2015</a>):</p>
<blockquote>
<p>The message in <code>npm version -m <message></code> is mapped to the <code>message</code> config parameter in <code>.npmrc</code>. ... | <p>Since npm 2.7.4 (and <a href="https://github.com/npm/npm/commit/3703b0b87c127a64649bdbfc3bc697ebccc4aa24" rel="noreferrer">commit 3703b0b, March 2015</a>):</p> <blockquote> <p>The message in <code>npm version -m <message></code> is mapped to the <code>message</code> config parameter in <code>.npmrc</code>. ... | 119, 46426, 53850, 61387 | git, git-commit, node.js, npm | <h1>Customize Commit message while using npm version patch</h1>
<p>Is it possible to customize the commit message while using <code>npm version patch</code>?</p>
<p>I' d like to change it to <code>:up-arrow: @VERSIONNUMBER</code></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,969 | git | # Customize Commit message while using npm version patch
Is it possible to customize the commit message while using `npm version patch`?
I' d like to change it to `:up-arrow: @VERSIONNUMBER` | Since npm 2.7.4 (and [commit 3703b0b, March 2015](https://github.com/npm/npm/commit/3703b0b87c127a64649bdbfc3bc697ebccc4aa24)):
> The message in `npm version -m <message>` is mapped to the `message` config parameter in `.npmrc`.
That does not seem to be tied specifically to `patch` only though.
[This test](https://... |
22818155 | Git stash to patch with untracked files | 18 | 2014-04-02 16:58:02 | <p>How can I make Git stash with untracked files, push it to patch and restore it in another computer.</p>
<pre><code>git stash save -u feature
git stash show -p > patch
git apply patch
</code></pre>
<p>But path hasn't untracked files</p>
| 8,574 | 1,309,841 | 2018-09-16 19:44:14 | 22,819,771 | 23 | 2014-04-02 18:18:48 | 1,256,452 | 2018-09-16 19:44:14 | https://stackoverflow.com/q/22818155 | https://stackoverflow.com/a/22819771 | <p>A normal <code>git stash</code> creates a <a href="https://stackoverflow.com/a/20412685/1256452">stash bag</a> that consists of two commits: the index, and the work-tree.</p>
<p>Using <code>-u</code> or <code>-a</code> (or their other spellings) creates a <a href="https://stackoverflow.com/a/20589663/1256452">three... | <p>A normal <code>git stash</code> creates a <a href="https://stackoverflow.com/a/20412685/1256452">stash bag</a> that consists of two commits: the index, and the work-tree.</p> <p>Using <code>-u</code> or <code>-a</code> (or their other spellings) creates a <a href="https://stackoverflow.com/a/20589663/1256452">three... | 119 | git | <h1>Git stash to patch with untracked files</h1>
<p>How can I make Git stash with untracked files, push it to patch and restore it in another computer.</p>
<pre><code>git stash save -u feature
git stash show -p > patch
git apply patch
</code></pre>
<p>But path hasn't untracked files</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,970 | git | # Git stash to patch with untracked files
How can I make Git stash with untracked files, push it to patch and restore it in another computer.
```
git stash save -u feature
git stash show -p > patch
git apply patch
```
But path hasn't untracked files | A normal `git stash` creates a [stash bag](https://stackoverflow.com/a/20412685/1256452) that consists of two commits: the index, and the work-tree.
Using `-u` or `-a` (or their other spellings) creates a [three-commit stash bag](https://stackoverflow.com/a/20589663/1256452). The third commit contains (only) the untra... |
13376917 | Add git branch after initial fetch in the same svn-remote | 18 | 2012-11-14 10:19:55 | <p>I'm using git-svn to work with a svn repo. I don't want the whole repo, sine it contains a lot of legacy, with binaries in it. I'm only tracking some directories.</p>
<p>Here is my current <code>.git/config</code>, which is working fine.</p>
<pre><code>[core]
repositoryformatversion = 0
filemode = true
... | 4,339 | 135,665 | 2021-03-16 14:00:03 | 13,477,378 | 23 | 2012-11-20 16:15:10 | 1,065,967 | 2012-11-20 16:35:14 | https://stackoverflow.com/q/13376917 | https://stackoverflow.com/a/13477378 | <p>For every svn-remote git-svn stores the <em>latest fetched revision</em> in <code>.git/svn/.metadata</code> file. It never fetches revisions less than that value. That's why it doesn't fetch the branch you've added to config; git-svn thinks <code>fuze_node</code> branch is already converted.</p>
<p>However you can ... | <p>For every svn-remote git-svn stores the <em>latest fetched revision</em> in <code>.git/svn/.metadata</code> file. It never fetches revisions less than that value. That's why it doesn't fetch the branch you've added to config; git-svn thinks <code>fuze_node</code> branch is already converted.</p> <p>However you can ... | 63, 119, 6452 | git, git-svn, svn | <h1>Add git branch after initial fetch in the same svn-remote</h1>
<p>I'm using git-svn to work with a svn repo. I don't want the whole repo, sine it contains a lot of legacy, with binaries in it. I'm only tracking some directories.</p>
<p>Here is my current <code>.git/config</code>, which is working fine.</p>
<pre><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,971 | git | # Add git branch after initial fetch in the same svn-remote
I'm using git-svn to work with a svn repo. I don't want the whole repo, sine it contains a lot of legacy, with binaries in it. I'm only tracking some directories.
Here is my current `.git/config`, which is working fine.
```
[core]
repositoryformatversio... | For every svn-remote git-svn stores the *latest fetched revision* in `.git/svn/.metadata` file. It never fetches revisions less than that value. That's why it doesn't fetch the branch you've added to config; git-svn thinks `fuze_node` branch is already converted.
However you can fetch this branch without re-cloning th... |
13182017 | Git log --stat summary of branch | 18 | 2012-11-01 17:03:51 | <p>I would like to show how many changes (insertions+deletions) I made on a feature branch. Is there a way to get a summary of the <code>git log --stat</code> output for the changes between 2 commits (branch root / tip).</p>
| 16,217 | 402,551 | 2024-10-14 17:50:06 | 13,182,844 | 23 | 2012-11-01 17:56:28 | 1,864,976 | 2022-05-31 18:16:22 | https://stackoverflow.com/q/13182017 | https://stackoverflow.com/a/13182844 | <p>for a feature branch you want to use</p>
<pre><code>git diff --stat dev..feature
</code></pre>
<p>this relies on not doing back merges. See my post here: <a href="http://dymitruk.com/blog/2012/02/05/branch-per-feature/" rel="nofollow noreferrer">http://dymitruk.com/blog/2012/02/05/branch-per-feature/</a></p>
<p><cod... | <p>for a feature branch you want to use</p> <pre><code>git diff --stat dev..feature </code></pre> <p>this relies on not doing back merges. See my post here: <a href="http://dymitruk.com/blog/2012/02/05/branch-per-feature/" rel="nofollow noreferrer">http://dymitruk.com/blog/2012/02/05/branch-per-feature/</a></p> <p><cod... | 119, 402, 942, 1879, 18147 | branch, git, logging, stat, statistics | <h1>Git log --stat summary of branch</h1>
<p>I would like to show how many changes (insertions+deletions) I made on a feature branch. Is there a way to get a summary of the <code>git log --stat</code> output for the changes between 2 commits (branch root / tip).</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,972 | git | # Git log --stat summary of branch
I would like to show how many changes (insertions+deletions) I made on a feature branch. Is there a way to get a summary of the `git log --stat` output for the changes between 2 commits (branch root / tip). | for a feature branch you want to use
```
git diff --stat dev..feature
```
this relies on not doing back merges. See my post here: <http://dymitruk.com/blog/2012/02/05/branch-per-feature/>
`--stat` can take parameters. This is useful if you have a wider terminal. You can do `--stat=200` to say that your display can a... |
7401303 | how do I run cmd from the git post-commit hook | 18 | 2011-09-13 11:45:10 | <p>I want to have a miniature ci loop on my private projects and was thinking if I could run msbuild inside a batfile I could have colorized feedback on the cmd window and automate the build. So if I could just trigger the bat from the post - commit hook I guess it would be possible. It can´t possible be a new idea but... | 13,404 | 88,136 | 2014-03-05 09:51:14 | 7,402,697 | 23 | 2011-09-13 13:29:32 | 520,162 | 2011-09-13 13:29:32 | https://stackoverflow.com/q/7401303 | https://stackoverflow.com/a/7402697 | <p>Calling the <code>.bat</code> file from your post-commit hook doesn't require any magic.</p>
<p>Rename the post-commit hook template in <code>.git/hooks/post-commit.sample</code> to <code>.git/hooks/post-commit</code> and call the batch file within by simply writing the name of the batch file:</p>
<pre><code>#!/bi... | <p>Calling the <code>.bat</code> file from your post-commit hook doesn't require any magic.</p> <p>Rename the post-commit hook template in <code>.git/hooks/post-commit.sample</code> to <code>.git/hooks/post-commit</code> and call the batch file within by simply writing the name of the batch file:</p> <pre><code>#!/bi... | 119, 265, 1066 | continuous-integration, git, msbuild | <h1>how do I run cmd from the git post-commit hook</h1>
<p>I want to have a miniature ci loop on my private projects and was thinking if I could run msbuild inside a batfile I could have colorized feedback on the cmd window and automate the build. So if I could just trigger the bat from the post - commit hook I guess i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,973 | git | # how do I run cmd from the git post-commit hook
I want to have a miniature ci loop on my private projects and was thinking if I could run msbuild inside a batfile I could have colorized feedback on the cmd window and automate the build. So if I could just trigger the bat from the post - commit hook I guess it would b... | Calling the `.bat` file from your post-commit hook doesn't require any magic.
Rename the post-commit hook template in `.git/hooks/post-commit.sample` to `.git/hooks/post-commit` and call the batch file within by simply writing the name of the batch file:
```
#!/bin/sh
path/to/batchfile.bat
```
Please note that the w... |
75244108 | Why is the Commit operation taking forever in Visual Studio Code? | 17 | 2023-01-26 09:11:13 | <p>When trying to 'commit' files the process just loads and loads but never completes.</p>
<p><a href="https://i.sstatic.net/BqSih.png" rel="noreferrer"><img src="https://i.sstatic.net/BqSih.png" alt="enter image description here" /></a></p>
<p>These are the steps I followed:</p>
<ol>
<li><p>I installed "Git"... | 59,656 | 20,295,949 | 2024-03-26 09:29:54 | 75,989,165 | 23 | 2023-04-11 18:44:11 | 21,489,133 | 2023-05-20 03:14:03 | https://stackoverflow.com/q/75244108 | https://stackoverflow.com/a/75989165 | <p>I have no idea why Git does this. It happens to me occasionally, but there are some solutions.</p>
<p>First, restart Visual Studio Code. Then try to <strong>commit & push</strong> again. If it still doesn't work, restart it again and this time, <strong>don't forget to write a message while committing.</strong></... | <p>I have no idea why Git does this. It happens to me occasionally, but there are some solutions.</p> <p>First, restart Visual Studio Code. Then try to <strong>commit & push</strong> again. If it still doesn't work, restart it again and this time, <strong>don't forget to write a message while committing.</strong></... | 119, 111608 | git, visual-studio-code | <h1>Why is the Commit operation taking forever in Visual Studio Code?</h1>
<p>When trying to 'commit' files the process just loads and loads but never completes.</p>
<p><a href="https://i.sstatic.net/BqSih.png" rel="noreferrer"><img src="https://i.sstatic.net/BqSih.png" alt="enter image description here" /></a></p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,974 | git | # Why is the Commit operation taking forever in Visual Studio Code?
When trying to 'commit' files the process just loads and loads but never completes.
[](https://i.sstatic.net/BqSih.png)
These are the steps I followed:
1. I installed "Git"
2. Created ... | I have no idea why Git does this. It happens to me occasionally, but there are some solutions.
First, restart Visual Studio Code. Then try to **commit & push** again. If it still doesn't work, restart it again and this time, **don't forget to write a message while committing.**
You can also do
```
git commit -m 'mes... |
62080135 | Git: force a pull to overwrite local changes | 17 | 2020-05-29 06:43:26 | <p>I would like my local branch to be identical to the remote one. When I pull from the remote one, I'm getting conflicts, and in this case I would like not to resolve them and just get the latest version from the remote branch.</p>
<p>To hard pull I use in my local branch:</p>
<pre><code>git reset -- hard
git pull
... | 34,929 | 9,856,049 | 2020-05-29 06:45:09 | 62,080,161 | 23 | 2020-05-29 06:45:09 | 1,863,229 | 2020-05-29 06:45:09 | https://stackoverflow.com/q/62080135 | https://stackoverflow.com/a/62080161 | <p>Try doing a <code>git fetch</code> to bring the (local) remote tracking branch up to date with the remote version, then hard reset your local branch to that:</p>
<pre><code># from local
git fetch origin
git reset --hard origin/local
</code></pre>
<p>As to why you are still getting merge conflicts even after a hard... | <p>Try doing a <code>git fetch</code> to bring the (local) remote tracking branch up to date with the remote version, then hard reset your local branch to that:</p> <pre><code># from local git fetch origin git reset --hard origin/local </code></pre> <p>As to why you are still getting merge conflicts even after a hard... | 119 | git | <h1>Git: force a pull to overwrite local changes</h1>
<p>I would like my local branch to be identical to the remote one. When I pull from the remote one, I'm getting conflicts, and in this case I would like not to resolve them and just get the latest version from the remote branch.</p>
<p>To hard pull I use in my loca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,975 | git | # Git: force a pull to overwrite local changes
I would like my local branch to be identical to the remote one. When I pull from the remote one, I'm getting conflicts, and in this case I would like not to resolve them and just get the latest version from the remote branch.
To hard pull I use in my local branch:
```
g... | Try doing a `git fetch` to bring the (local) remote tracking branch up to date with the remote version, then hard reset your local branch to that:
```
# from local
git fetch origin
git reset --hard origin/local
```
As to why you are still getting merge conflicts even after a hard reset, this could be explained by a f... |
32269590 | Git notes details | 17 | 2015-08-28 11:04:18 | <p>I've read <a href="http://git-scm.com/2010/08/25/notes.html" rel="noreferrer">this</a> and <a href="https://github.com/blog/707-git-notes-display" rel="noreferrer">this</a> but still see them as obscure. By far understood:</p>
<ul>
<li>creation (<code>git notes add -m "a note"</code>)</li>
<li>notes are namespaced<... | 8,493 | 336,184 | 2015-08-28 11:27:28 | 32,269,885 | 23 | 2015-08-28 11:20:41 | 130,659 | 2015-08-28 11:27:28 | https://stackoverflow.com/q/32269590 | https://stackoverflow.com/a/32269885 | <p>I wrote about them more here, as part of my <a href="http://alblue.bandlem.com/Tag/gtotw/" rel="noreferrer">git tip of the week series</a>.</p>
<p><a href="http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html" rel="noreferrer">http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html</a></p>
<p>... | <p>I wrote about them more here, as part of my <a href="http://alblue.bandlem.com/Tag/gtotw/" rel="noreferrer">git tip of the week series</a>.</p> <p><a href="http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html" rel="noreferrer">http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html</a></p> <p>... | 119, 88239 | git, git-notes | <h1>Git notes details</h1>
<p>I've read <a href="http://git-scm.com/2010/08/25/notes.html" rel="noreferrer">this</a> and <a href="https://github.com/blog/707-git-notes-display" rel="noreferrer">this</a> but still see them as obscure. By far understood:</p>
<ul>
<li>creation (<code>git notes add -m "a note"</code>)</li... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,977 | git | # Git notes details
I've read [this](http://git-scm.com/2010/08/25/notes.html) and [this](https://github.com/blog/707-git-notes-display) but still see them as obscure. By far understood:
- creation (`git notes add -m "a note"`)
- notes are namespaced
Questions:
1. notes seem not to create a commit, so how the `push... | I wrote about them more here, as part of my [git tip of the week series](http://alblue.bandlem.com/Tag/gtotw/).
<http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html>
The notes themselves are blobs that are stored in a separate ref file (`refs/notes/commits`) and are organised by the commit that they are ... |
18472473 | How to config SSH for gitlab? | 17 | 2013-08-27 17:59:59 | <p>In my experience of Github, I tought that I need to clone a repository with my user like <code>user@gitlabhost.com</code>. But when I try this, then it does not recognize my password from gitlab. Only cloning with gitlab user does work. </p>
<p>Can anybody please help me??? - How do I have to configure gitlab acces... | 76,777 | 2,451,418 | 2023-03-03 15:37:01 | 18,863,192 | 23 | 2013-09-18 03:03:47 | 1,243,123 | 2018-12-08 07:04:37 | https://stackoverflow.com/q/18472473 | https://stackoverflow.com/a/18863192 | <p>If you followed Installation Instructions of gitlab, then you must have installed it on an linux box under the user named <code>git</code>. Typically in a folder like this</p>
<pre><code>/home/git/gitlab
</code></pre>
<p>Hence you should use <code>git@gitlabhost.com</code></p>
<p>I am not sure what you mean by "... | <p>If you followed Installation Instructions of gitlab, then you must have installed it on an linux box under the user named <code>git</code>. Typically in a folder like this</p> <pre><code>/home/git/gitlab </code></pre> <p>Hence you should use <code>git@gitlabhost.com</code></p> <p>I am not sure what you mean by "... | 386, 34099 | git-clone, ssh | <h1>How to config SSH for gitlab?</h1>
<p>In my experience of Github, I tought that I need to clone a repository with my user like <code>user@gitlabhost.com</code>. But when I try this, then it does not recognize my password from gitlab. Only cloning with gitlab user does work. </p>
<p>Can anybody please help me??? - ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,979 | git | # How to config SSH for gitlab?
In my experience of Github, I tought that I need to clone a repository with my user like `user@gitlabhost.com`. But when I try this, then it does not recognize my password from gitlab. Only cloning with gitlab user does work.
Can anybody please help me??? - How do I have to configure g... | If you followed Installation Instructions of gitlab, then you must have installed it on an linux box under the user named `git`. Typically in a folder like this
```
/home/git/gitlab
```
Hence you should use `git@gitlabhost.com`
I am not sure what you mean by "configuring SSH". But since each user is expected to use ... |
7875865 | How to identify Git object type based on its SHA1 code? | 17 | 2011-10-24 12:48:08 | <p>Given object's SHA1 code, how could one identify the object type (blob, tree, tag, or commit)?</p>
| 1,323 | 247,243 | 2011-10-24 12:55:43 | 7,875,919 | 23 | 2011-10-24 12:53:14 | 223,092 | 2011-10-24 12:53:14 | https://stackoverflow.com/q/7875865 | https://stackoverflow.com/a/7875919 | <p>You can use <code>git cat-file -t</code>, e.g.:</p>
<pre><code>$ git cat-file -t ffcb14ca1dad
commit
$ git cat-file -t 74e34003a
blob
</code></pre>
<p>This use of <code>git cat-file</code> is explained in <a href="http://schacon.github.com/git/git-cat-file.html">its documentation</a>.</p>
| <p>You can use <code>git cat-file -t</code>, e.g.:</p> <pre><code>$ git cat-file -t ffcb14ca1dad commit $ git cat-file -t 74e34003a blob </code></pre> <p>This use of <code>git cat-file</code> is explained in <a href="http://schacon.github.com/git/git-cat-file.html">its documentation</a>.</p> | 119 | git | <h1>How to identify Git object type based on its SHA1 code?</h1>
<p>Given object's SHA1 code, how could one identify the object type (blob, tree, tag, or commit)?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,980 | git | # How to identify Git object type based on its SHA1 code?
Given object's SHA1 code, how could one identify the object type (blob, tree, tag, or commit)? | You can use `git cat-file -t`, e.g.:
```
$ git cat-file -t ffcb14ca1dad
commit
$ git cat-file -t 74e34003a
blob
```
This use of `git cat-file` is explained in [its documentation](http://schacon.github.com/git/git-cat-file.html). |
5995301 | How do I pipe a git clone to archive (tar or gzip) | 17 | 2011-05-13 16:58:31 | <p>I am trying to make a simple backup script for my remotely hosted git repos. In the script I have a few lines that currently look like this:</p>
<pre><code>git clone git@server:repo.git $DEST
tar czvf repo.tgz $DEST
rm -rf $DEST
</code></pre>
<p>Is there a way to make this all happen in one line? Can I pipe the gi... | 24,709 | 45,838 | 2020-05-06 08:21:12 | 5,995,331 | 23 | 2011-05-13 17:01:20 | 526,535 | 2011-05-13 17:07:27 | https://stackoverflow.com/q/5995301 | https://stackoverflow.com/a/5995331 | <p>No you cannot just pipe <code>git clone</code> because it does not write it out to the standard output. And why do you need a one-liner? They are great for boasting that you can do something cool in just one line, but not really ideal in real world.</p>
<p>You can do something like below, but you would not get <cod... | <p>No you cannot just pipe <code>git clone</code> because it does not write it out to the standard output. And why do you need a one-liner? They are great for boasting that you can do something cool in just one line, but not really ideal in real world.</p> <p>You can do something like below, but you would not get <cod... | 119, 1930, 5813, 8773, 17381 | backup-strategies, git, gzip, pipe, tar | <h1>How do I pipe a git clone to archive (tar or gzip)</h1>
<p>I am trying to make a simple backup script for my remotely hosted git repos. In the script I have a few lines that currently look like this:</p>
<pre><code>git clone git@server:repo.git $DEST
tar czvf repo.tgz $DEST
rm -rf $DEST
</code></pre>
<p>Is there ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,981 | git | # How do I pipe a git clone to archive (tar or gzip)
I am trying to make a simple backup script for my remotely hosted git repos. In the script I have a few lines that currently look like this:
```
git clone git@server:repo.git $DEST
tar czvf repo.tgz $DEST
rm -rf $DEST
```
Is there a way to make this all happen in ... | No you cannot just pipe `git clone` because it does not write it out to the standard output. And why do you need a one-liner? They are great for boasting that you can do something cool in just one line, but not really ideal in real world.
You can do something like below, but you would not get `.git` like you would in ... |
4290855 | Git SVN and merging branches | 17 | 2010-11-27 09:04:45 | <p>I am working on a svn project with two branches, lets call them</p>
<pre><code>trunk
branches/foo
</code></pre>
<p>My idea is to clone the whole svn repository (telling git which folder are trunk, tags and branches), do the merge in git and then copy my merge to a svn working copy and commit the changes from svn.<... | 20,857 | 143,303 | 2012-05-13 00:30:22 | 4,291,919 | 23 | 2010-11-27 13:44:32 | 4,279 | 2010-11-27 13:44:32 | https://stackoverflow.com/q/4290855 | https://stackoverflow.com/a/4291919 | <p>Create alias for checkout command:</p>
<pre><code>git config alias.co checkout
</code></pre>
<p>Make sure that you local branches are up to date:</p>
<pre><code>git co master # checkout branch that tracks subversion's trunk
git svn rebase
git co local/foo # checkout branch that tracks subversion's branches/fo... | <p>Create alias for checkout command:</p> <pre><code>git config alias.co checkout </code></pre> <p>Make sure that you local branches are up to date:</p> <pre><code>git co master # checkout branch that tracks subversion's trunk git svn rebase git co local/foo # checkout branch that tracks subversion's branches/fo... | 63, 119, 6452 | git, git-svn, svn | <h1>Git SVN and merging branches</h1>
<p>I am working on a svn project with two branches, lets call them</p>
<pre><code>trunk
branches/foo
</code></pre>
<p>My idea is to clone the whole svn repository (telling git which folder are trunk, tags and branches), do the merge in git and then copy my merge to a svn working ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,982 | git | # Git SVN and merging branches
I am working on a svn project with two branches, lets call them
```
trunk
branches/foo
```
My idea is to clone the whole svn repository (telling git which folder are trunk, tags and branches), do the merge in git and then copy my merge to a svn working copy and commit the changes from ... | Create alias for checkout command:
```
git config alias.co checkout
```
Make sure that you local branches are up to date:
```
git co master # checkout branch that tracks subversion's trunk
git svn rebase
git co local/foo # checkout branch that tracks subversion's branches/foo
# It assumes that ... |
52407221 | See (list) files changed between local and remote branch - git | 16 | 2018-09-19 13:37:18 | <p>How do I list files that are "diff"ed between my current local and the corresponding remote branch?</p>
<p>The situation is that I had made a push to remote earlier and since then have rebased off master + squashed some commits. </p>
<p>On doing a git status, I get </p>
<blockquote>
<p>Your branch and 'origin/Y... | 12,797 | 5,986,661 | 2024-07-21 18:49:15 | 52,407,378 | 23 | 2018-09-19 13:44:26 | 2,295,034 | 2018-09-19 13:47:49 | https://stackoverflow.com/q/52407221 | https://stackoverflow.com/a/52407378 | <p>To list just file names, use the <a href="https://git-scm.com/docs/git-diff#git-diff---name-only" rel="noreferrer"><code>name-only</code></a> flag like this:</p>
<pre><code>git diff --name-only origin/YourBranch YourBranch
</code></pre>
<p><code>name-only</code> will (from the <a href="https://git-scm.com/docs/git... | <p>To list just file names, use the <a href="https://git-scm.com/docs/git-diff#git-diff---name-only" rel="noreferrer"><code>name-only</code></a> flag like this:</p> <pre><code>git diff --name-only origin/YourBranch YourBranch </code></pre> <p><code>name-only</code> will (from the <a href="https://git-scm.com/docs/git... | 119, 9033 | git, git-diff | <h1>See (list) files changed between local and remote branch - git</h1>
<p>How do I list files that are "diff"ed between my current local and the corresponding remote branch?</p>
<p>The situation is that I had made a push to remote earlier and since then have rebased off master + squashed some commits. </p>
<p>On doi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,983 | git | # See (list) files changed between local and remote branch - git
How do I list files that are "diff"ed between my current local and the corresponding remote branch?
The situation is that I had made a push to remote earlier and since then have rebased off master + squashed some commits.
On doing a git status, I get
... | To list just file names, use the [`name-only`](https://git-scm.com/docs/git-diff#git-diff---name-only) flag like this:
```
git diff --name-only origin/YourBranch YourBranch
```
`name-only` will (from the [Git doc](https://git-scm.com/docs/git-diff#git-diff---name-only)):
> Show only names of changed files
BTW, this... |
50354333 | How do I re-checkout all files in Git to convert from CRLF to LF? | 16 | 2018-05-15 15:44:54 | <p>I have files checked out with CRLF. I changed <code>git config --global core.autocrlf false</code>. Git doesn't see any modifications. When I edit a file, Git thinks the whole file changed. How do I re-checkout and overwrite all the files with LF instead of CRLF, so the diff works as expected? I saw <a href="https:/... | 4,592 | 148,844 | 2022-08-12 17:33:11 | 50,354,765 | 23 | 2018-05-15 16:09:07 | 148,844 | 2022-08-12 17:33:11 | https://stackoverflow.com/q/50354333 | https://stackoverflow.com/a/50354765 | <p>This seemed to work, but I'm not sure why. It looks very scary with lots of changes, but it ended up not changing anything. I got worried after the first line.</p>
<pre><code>git rm --cached -r .
git reset --hard
git checkout .
</code></pre>
<p>No commits necessary.</p>
| <p>This seemed to work, but I'm not sure why. It looks very scary with lots of changes, but it ended up not changing anything. I got worried after the first line.</p> <pre><code>git rm --cached -r . git reset --hard git checkout . </code></pre> <p>No commits necessary.</p> | 119 | git | <h1>How do I re-checkout all files in Git to convert from CRLF to LF?</h1>
<p>I have files checked out with CRLF. I changed <code>git config --global core.autocrlf false</code>. Git doesn't see any modifications. When I edit a file, Git thinks the whole file changed. How do I re-checkout and overwrite all the files wit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,985 | git | # How do I re-checkout all files in Git to convert from CRLF to LF?
I have files checked out with CRLF. I changed `git config --global core.autocrlf false`. Git doesn't see any modifications. When I edit a file, Git thinks the whole file changed. How do I re-checkout and overwrite all the files with LF instead of CRLF... | This seemed to work, but I'm not sure why. It looks very scary with lots of changes, but it ended up not changing anything. I got worried after the first line.
```
git rm --cached -r .
git reset --hard
git checkout .
```
No commits necessary. |
42536989 | git pull --rebase lost commits after coworker's git push --force | 16 | 2017-03-01 16:28:42 | <p>I thought I understood how git pull --rebase was working, but this example is confusing me. I would have guessed that the following two scenarios would produce identical results, but they differ.</p>
<p>First, the one that works.</p>
<pre><code># Dan and Brian start out at the same spot:
dan$ git rev-parse HEAD
06... | 5,282 | 1,586,229 | 2021-02-26 00:57:41 | 42,546,368 | 23 | 2017-03-02 03:35:26 | 1,256,452 | 2019-02-02 23:44:39 | https://stackoverflow.com/q/42536989 | https://stackoverflow.com/a/42546368 | <h3>TL;DR: it's the fork point code</h3>
<p>You are getting the effect of <code>git rebase --fork-point</code>, which deliberately drops Dan's commit from <em>your</em> repository too. See also <a href="https://stackoverflow.com/q/42486141/1256452">Git rebase - commit select in fork-point mode</a> (although in my answ... | <h3>TL;DR: it's the fork point code</h3> <p>You are getting the effect of <code>git rebase --fork-point</code>, which deliberately drops Dan's commit from <em>your</em> repository too. See also <a href="https://stackoverflow.com/q/42486141/1256452">Git rebase - commit select in fork-point mode</a> (although in my answ... | 119, 456, 8974 | git, rebase, version-control | <h1>git pull --rebase lost commits after coworker's git push --force</h1>
<p>I thought I understood how git pull --rebase was working, but this example is confusing me. I would have guessed that the following two scenarios would produce identical results, but they differ.</p>
<p>First, the one that works.</p>
<pre><c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,986 | git | # git pull --rebase lost commits after coworker's git push --force
I thought I understood how git pull --rebase was working, but this example is confusing me. I would have guessed that the following two scenarios would produce identical results, but they differ.
First, the one that works.
```
# Dan and Brian start o... | ### TL;DR: it's the fork point code
You are getting the effect of `git rebase --fork-point`, which deliberately drops Dan's commit from *your* repository too. See also [Git rebase - commit select in fork-point mode](https://stackoverflow.com/q/42486141/1256452) (although in my answer there I don't mention something I ... |
41413357 | Cherry-pick Commit from a different repo | 16 | 2017-01-01 04:26:32 | <p>I was trying to cherrypick this commits </p>
<ul>
<li><a href="https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c" rel="noreferrer">https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c</a></li>
<li><a href="https://github.com/AICP/frameworks_ba... | 17,175 | 7,361,787 | 2020-09-23 05:00:18 | 41,413,383 | 23 | 2017-01-01 04:36:32 | 6,309 | 2017-01-01 06:05:45 | https://stackoverflow.com/q/41413357 | https://stackoverflow.com/a/41413383 | <p>You need to add that other repo as a remote first:</p>
<pre><code> git clone https://github.com/Gopinaidu7/android_frameworks_base
cd android_frameworks_base
git remote add other https://github.com/AICP/frameworks_base
</code></pre>
<p>Then fetch:</p>
<pre><code> git fetch other
</code></pre>
<p>Now you can c... | <p>You need to add that other repo as a remote first:</p> <pre><code> git clone https://github.com/Gopinaidu7/android_frameworks_base cd android_frameworks_base git remote add other https://github.com/AICP/frameworks_base </code></pre> <p>Then fetch:</p> <pre><code> git fetch other </code></pre> <p>Now you can c... | 119, 78810 | git, git-cherry-pick | <h1>Cherry-pick Commit from a different repo</h1>
<p>I was trying to cherrypick this commits </p>
<ul>
<li><a href="https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c" rel="noreferrer">https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c</a></li>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,988 | git | # Cherry-pick Commit from a different repo
I was trying to cherrypick this commits
- <https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c>
- <https://github.com/AICP/frameworks_base/commit/e24d0c250b4f80618f4b6064ad21d9c913890899>
from <https://github(dot)com/AICP/frameworks_base/... | You need to add that other repo as a remote first:
```
git clone https://github.com/Gopinaidu7/android_frameworks_base
cd android_frameworks_base
git remote add other https://github.com/AICP/frameworks_base
```
Then fetch:
```
git fetch other
```
Now you can cherry-pick using the SHA1. And then push.
If the c... |
22691575 | Run `git commit` from another directory | 16 | 2014-03-27 15:04:10 | <p>How to run <code>git commit -m '...'</code> command from another directory?</p>
<p>I edit my file:</p>
<pre><code>vim /home/.../myFile
</code></pre>
<p>I add it using:</p>
<pre><code>git add /home/.../myFile
</code></pre>
<p>But now, how can I commit the changes?</p>
<pre><code>git commit -m '...' ???
</code><... | 11,026 | 1,420,197 | 2023-01-09 06:11:39 | 22,691,838 | 23 | 2014-03-27 15:14:07 | 3,378,587 | 2014-03-27 16:49:02 | https://stackoverflow.com/q/22691575 | https://stackoverflow.com/a/22691838 | <p>You can also use the environment variables <code>$GIT_DIR</code> and <code>$GIT_WORK_TREE</code> to the same effect as <code>--git-dir</code> and <code>--work-tree</code></p>
<p>These are the steps to commit a file when you are in another directory:</p>
<pre><code>git --git-dir=/path/to/my/directory/.git/ --work-t... | <p>You can also use the environment variables <code>$GIT_DIR</code> and <code>$GIT_WORK_TREE</code> to the same effect as <code>--git-dir</code> and <code>--work-tree</code></p> <p>These are the steps to commit a file when you are in another directory:</p> <pre><code>git --git-dir=/path/to/my/directory/.git/ --work-t... | 119 | git | <h1>Run `git commit` from another directory</h1>
<p>How to run <code>git commit -m '...'</code> command from another directory?</p>
<p>I edit my file:</p>
<pre><code>vim /home/.../myFile
</code></pre>
<p>I add it using:</p>
<pre><code>git add /home/.../myFile
</code></pre>
<p>But now, how can I commit the changes?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,990 | git | # Run `git commit` from another directory
How to run `git commit -m '...'` command from another directory?
I edit my file:
```
vim /home/.../myFile
```
I add it using:
```
git add /home/.../myFile
```
But now, how can I commit the changes?
```
git commit -m '...' ???
``` | You can also use the environment variables `$GIT_DIR` and `$GIT_WORK_TREE` to the same effect as `--git-dir` and `--work-tree`
These are the steps to commit a file when you are in another directory:
```
git --git-dir=/path/to/my/directory/.git/ --work-tree=/path/to/my/directory/ add myFile
git --git-dir=/path/to/my/d... |
21148512 | Git rebase from one branch to another | 16 | 2014-01-15 21:23:15 | <p>I have the following case :</p>
<pre><code> K---L new-feature
/
H---I---J dev-team1
/
E---F---G dev-main
/
A---B---C---D master
</code></pre>
<p>And I want to move only the <em>new-feature</em> (K---L) branc... | 18,440 | 574,371 | 2014-01-16 01:55:44 | 21,148,633 | 23 | 2014-01-15 21:30:12 | 10,556 | 2014-01-15 21:30:12 | https://stackoverflow.com/q/21148512 | https://stackoverflow.com/a/21148633 | <p><code>git rebase</code> has an <code>--onto</code> argument that does what you need.</p>
<pre><code>git checkout new-feature
git rebase --onto dev-main dev-team1
# Now new-feature has commits K' and L' after G in dev-main.
git checkout dev-main
git merge --ff-only new-feature
</code></pre>
<p>See the <a href="htt... | <p><code>git rebase</code> has an <code>--onto</code> argument that does what you need.</p> <pre><code>git checkout new-feature git rebase --onto dev-main dev-team1 # Now new-feature has commits K' and L' after G in dev-main. git checkout dev-main git merge --ff-only new-feature </code></pre> <p>See the <a href="htt... | 119, 1879, 29934, 76220, 84381 | branch, git, git-branch, git-interactive-rebase, git-rebase | <h1>Git rebase from one branch to another</h1>
<p>I have the following case :</p>
<pre><code> K---L new-feature
/
H---I---J dev-team1
/
E---F---G dev-main
/
A---B---C---D master
</code></pre>
<p>And I want to m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,991 | git | # Git rebase from one branch to another
I have the following case :
```
K---L new-feature
/
H---I---J dev-team1
/
E---F---G dev-main
/
A---B---C---D master
```
And I want to move only the *new-feature* (K---L... | `git rebase` has an `--onto` argument that does what you need.
```
git checkout new-feature
git rebase --onto dev-main dev-team1
# Now new-feature has commits K' and L' after G in dev-main.
git checkout dev-main
git merge --ff-only new-feature
```
See the [man page for "git rebase"](http://git-scm.com/docs/git-rebas... |
12801936 | git-subtree: Push changes from an cloned repo | 16 | 2012-10-09 14:08:33 | <p>I'm using git-subtree(from Avery Pennarun). In my current git repo I have of course
all my project files/folders and a subtree called "lib".
If I now clone this git repo using <code>git clone</code> I get all of the project files and
the subtree "lib" (everything as it should be).
What I tried now: I changed somethi... | 22,961 | 550,979 | 2015-07-21 07:43:59 | 12,819,896 | 23 | 2012-10-10 12:56:42 | 9,827,379 | 2015-07-21 07:43:59 | https://stackoverflow.com/q/12801936 | https://stackoverflow.com/a/12819896 | <p>Disclaimer, I suspect I am only a few days ahead of you learing about subtree :-)</p>
<p>If you are just using <code>git subtree push</code> you are not giving subtree enough information to extract and push your changes.</p>
<p>If you cloned the repo correctly the subtree will already be in there. Subtree needs to... | <p>Disclaimer, I suspect I am only a few days ahead of you learing about subtree :-)</p> <p>If you are just using <code>git subtree push</code> you are not giving subtree enough information to extract and push your changes.</p> <p>If you cloned the repo correctly the subtree will already be in there. Subtree needs to... | 119, 68200 | git, git-subtree | <h1>git-subtree: Push changes from an cloned repo</h1>
<p>I'm using git-subtree(from Avery Pennarun). In my current git repo I have of course
all my project files/folders and a subtree called "lib".
If I now clone this git repo using <code>git clone</code> I get all of the project files and
the subtree "lib" (everythin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,992 | git | # git-subtree: Push changes from an cloned repo
I'm using git-subtree(from Avery Pennarun). In my current git repo I have of course
all my project files/folders and a subtree called "lib".
If I now clone this git repo using `git clone` I get all of the project files and
the subtree "lib" (everything as it should be).
... | Disclaimer, I suspect I am only a few days ahead of you learing about subtree :-)
If you are just using `git subtree push` you are not giving subtree enough information to extract and push your changes.
If you cloned the repo correctly the subtree will already be in there. Subtree needs to be told which subtree you w... |
6783917 | Why can't I delete a remote git branch with git push origin :branchname? | 16 | 2011-07-21 23:08:04 | <p>When I try to push to a remote git branch to delete it with <code>git push origin :branchname</code> I get the following error message:</p>
<blockquote>
<p>error: unable to push to unqualified destination: remotes/origin/branchname
The destination refspec neither matches an existing ref on the remote nor
begi... | 2,636 | 823 | 2014-12-10 07:58:16 | 6,783,936 | 23 | 2011-07-21 23:10:27 | 823 | 2013-04-12 23:05:40 | https://stackoverflow.com/q/6783917 | https://stackoverflow.com/a/6783936 | <p>The branch has already been deleted in the origin repository. You can reflect this in your local remotes when you fetch by doing <code>git fetch --all --prune</code>, which will delete it from your remotes. You can also more specifically do <code>git remote prune</code> to just prune your remotes without updating.</... | <p>The branch has already been deleted in the origin repository. You can reflect this in your local remotes when you fetch by doing <code>git fetch --all --prune</code>, which will delete it from your remotes. You can also more specifically do <code>git remote prune</code> to just prune your remotes without updating.</... | 119 | git | <h1>Why can't I delete a remote git branch with git push origin :branchname?</h1>
<p>When I try to push to a remote git branch to delete it with <code>git push origin :branchname</code> I get the following error message:</p>
<blockquote>
<p>error: unable to push to unqualified destination: remotes/origin/branchname
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,993 | git | # Why can't I delete a remote git branch with git push origin :branchname?
When I try to push to a remote git branch to delete it with `git push origin :branchname` I get the following error message:
> error: unable to push to unqualified destination: remotes/origin/branchname
> The destination refspec neither matche... | The branch has already been deleted in the origin repository. You can reflect this in your local remotes when you fetch by doing `git fetch --all --prune`, which will delete it from your remotes. You can also more specifically do `git remote prune` to just prune your remotes without updating. |
46809742 | How do fetch remote branch after I cloned repo with git clone --depth 1 | 15 | 2017-10-18 12:02:59 | <p>I've repo with long history so I cloned using</p>
<pre><code>git clone <url> --depth 1
</code></pre>
<p>Now I'm in the master branch.</p>
<p><strong>How do I fetch remote branch called 'feature/my-feature' that was branched 3 commits earlier?</strong></p>
<p>I've tried:</p>
<pre><code>git checkout -b feat... | 6,419 | 475,727 | 2017-10-18 18:13:14 | 46,816,633 | 23 | 2017-10-18 18:13:14 | 1,256,452 | 2017-10-18 18:13:14 | https://stackoverflow.com/q/46809742 | https://stackoverflow.com/a/46816633 | <h3>TL;DR</h3>
<p>You need either:</p>
<pre><code>git config --add remote.origin.fetch \
+refs/heads/feature/my-feature:refs/remotes/origin/feature/myfeature
</code></pre>
<p>or:</p>
<pre><code>git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
</code></pre>
<p>followed by any of:</p>
<pre><... | <h3>TL;DR</h3> <p>You need either:</p> <pre><code>git config --add remote.origin.fetch \ +refs/heads/feature/my-feature:refs/remotes/origin/feature/myfeature </code></pre> <p>or:</p> <pre><code>git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' </code></pre> <p>followed by any of:</p> <pre><... | 119 | git | <h1>How do fetch remote branch after I cloned repo with git clone --depth 1</h1>
<p>I've repo with long history so I cloned using</p>
<pre><code>git clone <url> --depth 1
</code></pre>
<p>Now I'm in the master branch.</p>
<p><strong>How do I fetch remote branch called 'feature/my-feature' that was branched 3 c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,999 | git | # How do fetch remote branch after I cloned repo with git clone --depth 1
I've repo with long history so I cloned using
```
git clone <url> --depth 1
```
Now I'm in the master branch.
**How do I fetch remote branch called 'feature/my-feature' that was branched 3 commits earlier?**
I've tried:
```
git checkout -b ... | ### TL;DR
You need either:
```
git config --add remote.origin.fetch \
+refs/heads/feature/my-feature:refs/remotes/origin/feature/myfeature
```
or:
```
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
```
followed by any of:
```
git fetch
git fetch --depth=<number>
git fetch --deepen=<numbe... |
46786956 | Can I add a dependent crate that is a subdirectory in a git repository? | 15 | 2017-10-17 09:32:59 | <p>I want to use an EDN parser but it is inside <a href="https://github.com/mozilla/mentat" rel="noreferrer">https://github.com/mozilla/mentat</a>. <a href="https://github.com/mozilla/mentat/tree/master/edn" rel="noreferrer">https://github.com/mozilla/mentat/tree/master/edn</a> has its own Cargo.toml.</p>
<p>I tried t... | 5,380 | 4,685,140 | 2017-10-17 13:08:48 | 46,787,162 | 23 | 2017-10-17 09:43:12 | 2,408,867 | 2017-10-17 09:43:12 | https://stackoverflow.com/q/46786956 | https://stackoverflow.com/a/46787162 | <p>From <a href="http://doc.crates.io/specifying-dependencies.html" rel="noreferrer">the Cargo documentation</a>:</p>
<blockquote>
<p>Cargo will fetch the git repository at this location then look for a <code>Cargo.toml</code> for the requested crate <strong>anywhere</strong> inside the git repository (<strong>not n... | <p>From <a href="http://doc.crates.io/specifying-dependencies.html" rel="noreferrer">the Cargo documentation</a>:</p> <blockquote> <p>Cargo will fetch the git repository at this location then look for a <code>Cargo.toml</code> for the requested crate <strong>anywhere</strong> inside the git repository (<strong>not n... | 119, 59148, 106050 | git, rust, rust-cargo | <h1>Can I add a dependent crate that is a subdirectory in a git repository?</h1>
<p>I want to use an EDN parser but it is inside <a href="https://github.com/mozilla/mentat" rel="noreferrer">https://github.com/mozilla/mentat</a>. <a href="https://github.com/mozilla/mentat/tree/master/edn" rel="noreferrer">https://github... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,000 | git | # Can I add a dependent crate that is a subdirectory in a git repository?
I want to use an EDN parser but it is inside <https://github.com/mozilla/mentat>. <https://github.com/mozilla/mentat/tree/master/edn> has its own Cargo.toml.
I tried this:
```
[dependencies]
edn = { git = "https://github.com/mozilla/mentat/tre... | From [the Cargo documentation](http://doc.crates.io/specifying-dependencies.html):
> Cargo will fetch the git repository at this location then look for a `Cargo.toml` for the requested crate **anywhere** inside the git repository (**not necessarily at the root**).
(*emphasis mine*)
This means that you can just say:
... |
46157540 | Creating a pull request in Bitucket: error "Unrelated branches" | 15 | 2017-09-11 14:00:06 | <p>I'm having a small team working on a single repository, I asked my each teammates to create there own branch and work on there branch, all of them cloned the repository and then they did the following command:</p>
<pre><code>git checkout -b BitPankaj
</code></pre>
<p><code>BitPankaj</code> is illustration branch n... | 21,916 | 6,085,328 | 2021-10-15 06:49:04 | 46,167,037 | 23 | 2017-09-12 02:34:25 | 6,936,103 | 2017-09-12 02:34:25 | https://stackoverflow.com/q/46157540 | https://stackoverflow.com/a/46167037 | <p><strong>This is because the <code>BitPankaj</code> branch is an orphan branch.</strong> </p>
<p>That means the branch <code>BitPankaj</code> didn’t created from <code>master</code> branch (as you expected), but may use <code>git checkout --orphan BitPankaj</code> instead. The branch structure looks like:</p>
<pre>... | <p><strong>This is because the <code>BitPankaj</code> branch is an orphan branch.</strong> </p> <p>That means the branch <code>BitPankaj</code> didn’t created from <code>master</code> branch (as you expected), but may use <code>git checkout --orphan BitPankaj</code> instead. The branch structure looks like:</p> <pre>... | 119, 456, 8337, 64512 | bitbucket, git, pull-request, version-control | <h1>Creating a pull request in Bitucket: error "Unrelated branches"</h1>
<p>I'm having a small team working on a single repository, I asked my each teammates to create there own branch and work on there branch, all of them cloned the repository and then they did the following command:</p>
<pre><code>git checkout -b Bi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,001 | git | # Creating a pull request in Bitucket: error "Unrelated branches"
I'm having a small team working on a single repository, I asked my each teammates to create there own branch and work on there branch, all of them cloned the repository and then they did the following command:
```
git checkout -b BitPankaj
```
`BitPan... | **This is because the `BitPankaj` branch is an orphan branch.**
That means the branch `BitPankaj` didn’t created from `master` branch (as you expected), but may use `git checkout --orphan BitPankaj` instead. The branch structure looks like:
```
A---B---…---C master
D---…---E BitPankaj
```
You can double check i... |
26836146 | How to sort array items by longitude latitude distance in javascripts? | 15 | 2014-11-10 03:12:34 | <p>I am having following JSON array of 6 locations. Is there any way sort these based on longitude and latitude where nearby locations come next in the array? </p>
<pre><code>[
{"id" : 279, "longitude":79.853239,"latitude":6.912283},
{"id" : 284, "longitude":79.865699,"latitude":6.885697},
{"id" : 13, "longitude":79.... | 25,631 | 1,101,345 | 2022-11-11 08:16:23 | 26,837,460 | 23 | 2014-11-10 05:41:58 | 1,101,345 | 2018-05-18 12:06:52 | https://stackoverflow.com/q/26836146 | https://stackoverflow.com/a/26837460 | <p>Problem resolved by adding another attribute called distance. Used following function to calculate distance between two points</p>
<pre class="lang-js prettyprint-override"><code>function calculateDistance(lat1, lon1, lat2, lon2, unit) {
var radlat1 = Math.PI * lat1/180
var radlat2 = Math.PI * lat2/180
var ra... | <p>Problem resolved by adding another attribute called distance. Used following function to calculate distance between two points</p> <pre class="lang-js prettyprint-override"><code>function calculateDistance(lat1, lon1, lat2, lon2, unit) { var radlat1 = Math.PI * lat1/180 var radlat2 = Math.PI * lat2/180 var ra... | 3, 114, 134, 16094, 20301 | arrays, geo, javascript, latitude-longitude, sorting | <h1>How to sort array items by longitude latitude distance in javascripts?</h1>
<p>I am having following JSON array of 6 locations. Is there any way sort these based on longitude and latitude where nearby locations come next in the array? </p>
<pre><code>[
{"id" : 279, "longitude":79.853239,"latitude":6.912283},
{"id"... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,004 | git | # How to sort array items by longitude latitude distance in javascripts?
I am having following JSON array of 6 locations. Is there any way sort these based on longitude and latitude where nearby locations come next in the array?
```
[
{"id" : 279, "longitude":79.853239,"latitude":6.912283},
{"id" : 284, "longitude":7... | Problem resolved by adding another attribute called distance. Used following function to calculate distance between two points
```
function calculateDistance(lat1, lon1, lat2, lon2, unit) {
var radlat1 = Math.PI * lat1/180
var radlat2 = Math.PI * lat2/180
var radlon1 = Math.PI * lon1/180
var radlon2 = Math.PI ... |
24819850 | Use 'git filter-branch' to correct committer dates in last N commits? | 15 | 2014-07-18 07:51:29 | <p>I recently needed to apply 16 patches to my repo, using 'git am', and I was careful to use '--committer-date-is-author-date' for each one. However, I also needed to adjust the commit message for each am'd patch, and-- after I was done with all 16-- I discovered that 'commit --amend' bumped the committer timestamp f... | 6,010 | 980,793 | 2014-07-29 01:34:19 | 24,820,045 | 23 | 2014-07-18 08:02:44 | 112,968 | 2014-07-18 08:02:44 | https://stackoverflow.com/q/24819850 | https://stackoverflow.com/a/24820045 | <p>The value of <code>$GIT_AUTHOR_DATE</code> contains spaces, so you have to quote it (<code>-0500</code> is your time zone offset):</p>
<pre><code>git filter-branch --env-filter \
'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' SHA1..HEAD
</code></pre>
| <p>The value of <code>$GIT_AUTHOR_DATE</code> contains spaces, so you have to quote it (<code>-0500</code> is your time zone offset):</p> <pre><code>git filter-branch --env-filter \ 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' SHA1..HEAD </code></pre> | 119, 46509 | git, git-filter-branch | <h1>Use 'git filter-branch' to correct committer dates in last N commits?</h1>
<p>I recently needed to apply 16 patches to my repo, using 'git am', and I was careful to use '--committer-date-is-author-date' for each one. However, I also needed to adjust the commit message for each am'd patch, and-- after I was done wi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,005 | git | # Use 'git filter-branch' to correct committer dates in last N commits?
I recently needed to apply 16 patches to my repo, using 'git am', and I was careful to use '--committer-date-is-author-date' for each one. However, I also needed to adjust the commit message for each am'd patch, and-- after I was done with all 16-... | The value of `$GIT_AUTHOR_DATE` contains spaces, so you have to quote it (`-0500` is your time zone offset):
```
git filter-branch --env-filter \
'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' SHA1..HEAD
``` |
23208128 | Perforce branching vs git branching | 15 | 2014-04-22 00:10:44 | <p>I am a Git user trying to learn Perforce. </p>
<p>In Git a user can checkout from the main branch, change some files and push his code to the server on a different branch with a specific commit ID.</p>
<p>Another Git user can checkout that new branch using its commit ID and work on top of it.</p>
<p>How can this ... | 10,379 | 1,248,779 | 2015-11-20 06:26:07 | 23,208,375 | 23 | 2014-04-22 00:36:18 | 101,999 | 2014-04-22 00:36:18 | https://stackoverflow.com/q/23208128 | https://stackoverflow.com/a/23208375 | <blockquote>
<p>I am a Git user trying to learn Perforce.</p>
</blockquote>
<p>I'm sorry.</p>
<blockquote>
<p>How can this be performed using Perforce?</p>
</blockquote>
<p>I'm a better Git user than I am a Perforce user, so correct me if anything appears wrong. I highly recommend reading the man pages and <a hr... | <blockquote> <p>I am a Git user trying to learn Perforce.</p> </blockquote> <p>I'm sorry.</p> <blockquote> <p>How can this be performed using Perforce?</p> </blockquote> <p>I'm a better Git user than I am a Perforce user, so correct me if anything appears wrong. I highly recommend reading the man pages and <a hr... | 119, 1286 | git, perforce | <h1>Perforce branching vs git branching</h1>
<p>I am a Git user trying to learn Perforce. </p>
<p>In Git a user can checkout from the main branch, change some files and push his code to the server on a different branch with a specific commit ID.</p>
<p>Another Git user can checkout that new branch using its commit ID... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,007 | git | # Perforce branching vs git branching
I am a Git user trying to learn Perforce.
In Git a user can checkout from the main branch, change some files and push his code to the server on a different branch with a specific commit ID.
Another Git user can checkout that new branch using its commit ID and work on top of it.
... | > I am a Git user trying to learn Perforce.
I'm sorry.
> How can this be performed using Perforce?
I'm a better Git user than I am a Perforce user, so correct me if anything appears wrong. I highly recommend reading the man pages and [a tutorial](http://www.vaccaperna.co.uk/scm/branching.html).
It "can't" be, at le... |
21471169 | Cannot Sync Git in Visual Studio 2013 | 15 | 2014-01-31 01:54:37 | <p>I'm working with another developer and we seem to have got ourselves into a GIT pickle.
I commit code regularly and regularly push to the remote master. My colleague (whilst a great guy and developer) has not got into the habit of doing this and when I went to Pull the Head revision this morning (as is my habit), I ... | 20,056 | 540,156 | 2016-02-22 21:57:02 | 22,799,963 | 23 | 2014-04-02 01:36:13 | 1,403,723 | 2016-02-22 21:57:02 | https://stackoverflow.com/q/21471169 | https://stackoverflow.com/a/22799963 | <p>I had the same problem, because a number of package files were removed on the server which were not being used. I had to open command prompt and see all errors by running:</p>
<pre><code>git pull
</code></pre>
<p>I saw this error with a list of files to remove: </p>
<pre><code>Please move or remove them before yo... | <p>I had the same problem, because a number of package files were removed on the server which were not being used. I had to open command prompt and see all errors by running:</p> <pre><code>git pull </code></pre> <p>I saw this error with a list of files to remove: </p> <pre><code>Please move or remove them before yo... | 119, 93364 | git, visual-studio-2013 | <h1>Cannot Sync Git in Visual Studio 2013</h1>
<p>I'm working with another developer and we seem to have got ourselves into a GIT pickle.
I commit code regularly and regularly push to the remote master. My colleague (whilst a great guy and developer) has not got into the habit of doing this and when I went to Pull the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,008 | git | # Cannot Sync Git in Visual Studio 2013
I'm working with another developer and we seem to have got ourselves into a GIT pickle.
I commit code regularly and regularly push to the remote master. My colleague (whilst a great guy and developer) has not got into the habit of doing this and when I went to Pull the Head revi... | I had the same problem, because a number of package files were removed on the server which were not being used. I had to open command prompt and see all errors by running:
```
git pull
```
I saw this error with a list of files to remove:
```
Please move or remove them before you can merge.
Aborting.
```
After remov... |
14564034 | Creating a git diff from nothing | 15 | 2013-01-28 14:19:55 | <p>I am trying to create a patch file to be used via <a href="http://www.reviewboard.org" rel="noreferrer">reviewboard</a>.<br>
It will be the initial patch.</p>
<p><code>diff -ruN --exclude=.git empty_dir working_dir > mypatch_00.patch</code> works but I am getting a "The selected file does not appear to be a diff... | 8,354 | 1,086,425 | 2019-08-29 10:19:25 | 14,623,458 | 23 | 2013-01-31 10:23:06 | 225,718 | 2014-11-25 08:54:34 | https://stackoverflow.com/q/14564034 | https://stackoverflow.com/a/14623458 | <p>If you want to get diff for your initial commit (maybe I misunderstood your question), you can display it using</p>
<pre><code>git show COMMIT
</code></pre>
<p>Alternatively to get it as file:</p>
<pre><code>git format-patch -1 COMMIT
</code></pre>
<p>Where <code>COMMIT</code> is revision of this commit. If this... | <p>If you want to get diff for your initial commit (maybe I misunderstood your question), you can display it using</p> <pre><code>git show COMMIT </code></pre> <p>Alternatively to get it as file:</p> <pre><code>git format-patch -1 COMMIT </code></pre> <p>Where <code>COMMIT</code> is revision of this commit. If this... | 119, 606, 2132, 37373 | diff, git, patch, review-board | <h1>Creating a git diff from nothing</h1>
<p>I am trying to create a patch file to be used via <a href="http://www.reviewboard.org" rel="noreferrer">reviewboard</a>.<br>
It will be the initial patch.</p>
<p><code>diff -ruN --exclude=.git empty_dir working_dir > mypatch_00.patch</code> works but I am getting a "The ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,011 | git | # Creating a git diff from nothing
I am trying to create a patch file to be used via [reviewboard](http://www.reviewboard.org).
It will be the initial patch.
`diff -ruN --exclude=.git empty_dir working_dir > mypatch_00.patch` works but I am getting a "The selected file does not appear to be a diff." error.
Is ther... | If you want to get diff for your initial commit (maybe I misunderstood your question), you can display it using
```
git show COMMIT
```
Alternatively to get it as file:
```
git format-patch -1 COMMIT
```
Where `COMMIT` is revision of this commit. If this is your current commit as well, you don't have to specify it ... |
10782978 | Recover files that were added to the index but then removed by a git reset | 15 | 2012-05-28 10:17:46 | <p>I added some files to the index but then by mistake I deleted them with <code>git reset --hard</code>. How do I recover them?
Here's what happened:</p>
<ol>
<li>I added all files using <code>git add .</code></li>
<li>I then committed</li>
<li>When I checked the status, there were still files that weren't included ... | 9,060 | 1,402,685 | 2013-02-20 19:26:10 | 10,783,950 | 23 | 2012-05-28 11:29:52 | 112,968 | 2012-05-28 11:46:36 | https://stackoverflow.com/q/10782978 | https://stackoverflow.com/a/10783950 | <p><strong>First, make a full backup of your Git repository!</strong></p>
<p>When you <code>git add</code> a file, git will create a blob out of this file's content and add it to its object database (<code>.git/objects/??/*</code>).</p>
<p>Let's look at your commands, one by one:</p>
<blockquote>
<p>I added all fi... | <p><strong>First, make a full backup of your Git repository!</strong></p> <p>When you <code>git add</code> a file, git will create a blob out of this file's content and add it to its object database (<code>.git/objects/??/*</code>).</p> <p>Let's look at your commands, one by one:</p> <blockquote> <p>I added all fi... | 119, 34792, 51381, 53850, 79719 | git, git-add, git-commit, git-reflog, git-reset | <h1>Recover files that were added to the index but then removed by a git reset</h1>
<p>I added some files to the index but then by mistake I deleted them with <code>git reset --hard</code>. How do I recover them?
Here's what happened:</p>
<ol>
<li>I added all files using <code>git add .</code></li>
<li>I then committ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,012 | git | # Recover files that were added to the index but then removed by a git reset
I added some files to the index but then by mistake I deleted them with `git reset --hard`. How do I recover them?
Here's what happened:
1. I added all files using `git add .`
2. I then committed
3. When I checked the status, there were stil... | **First, make a full backup of your Git repository!**
When you `git add` a file, git will create a blob out of this file's content and add it to its object database (`.git/objects/??/*`).
Let's look at your commands, one by one:
> I added all files using git add .
```
$ git add .
```
This will add all files contai... |
10153760 | Edit an incorrect commit message in Git that has already been pushed | 15 | 2012-04-14 12:50:04 | <p>I did a Git commit and push, but wrote the totally wrong thing in the comment. </p>
<p>How do I change the comment? I have already pushed the commit to the remote.</p>
| 6,449 | 613,318 | 2023-08-02 14:29:12 | 10,153,791 | 23 | 2012-04-14 12:55:14 | 298,479 | 2012-04-14 12:55:14 | https://stackoverflow.com/q/10153760 | https://stackoverflow.com/a/10153791 | <p><code>git commit --amend</code> will allow you to edit the commit message.</p>
<p>If you already pushed that commit, you need to run <code>git push --force</code>. <strong>Only do that if you are sure nobody pulled it yet!</strong></p>
<p>If people pulled the commit from your repo, simply leave the message as it i... | <p><code>git commit --amend</code> will allow you to edit the commit message.</p> <p>If you already pushed that commit, you need to run <code>git push --force</code>. <strong>Only do that if you are sure nobody pulled it yet!</strong></p> <p>If people pulled the commit from your repo, simply leave the message as it i... | 119, 28898, 53850 | git, git-commit, git-push | <h1>Edit an incorrect commit message in Git that has already been pushed</h1>
<p>I did a Git commit and push, but wrote the totally wrong thing in the comment. </p>
<p>How do I change the comment? I have already pushed the commit to the remote.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,013 | git | # Edit an incorrect commit message in Git that has already been pushed
I did a Git commit and push, but wrote the totally wrong thing in the comment.
How do I change the comment? I have already pushed the commit to the remote. | `git commit --amend` will allow you to edit the commit message.
If you already pushed that commit, you need to run `git push --force`. **Only do that if you are sure nobody pulled it yet!**
If people pulled the commit from your repo, simply leave the message as it is. |
3599412 | git : how to specify a default remote push-to branch? | 15 | 2010-08-30 10:05:52 | <p>Suppose I have a tracking branch named '<code>abc</code>' which tracks <code>origin/master</code>.</p>
<p>When I'm on '<code>abc</code>' and do a <code>git push</code>, it pushes '<code>abc</code>' to '<code>abc</code>'.<br>
How do I specify the remote push branch for it with just a '<code>git push</code>'?</p>
| 10,649 | 58,743 | 2013-07-19 22:30:25 | 3,599,554 | 23 | 2010-08-30 10:30:51 | 6,309 | 2013-07-19 22:30:25 | https://stackoverflow.com/q/3599412 | https://stackoverflow.com/a/3599554 | <pre><code>git branch --set-upstream-to abc origin/master
</code></pre>
<p>should be able to specify the remote branch.</p>
<p>Note the <a href="https://stackoverflow.com/a/10002469/6309"><code>-to</code> added to <code>--set-upstream</code> since git1.8.0</a>.</p>
<p>Since <a href="http://www.kernel.org/pub/softwar... | <pre><code>git branch --set-upstream-to abc origin/master </code></pre> <p>should be able to specify the remote branch.</p> <p>Note the <a href="https://stackoverflow.com/a/10002469/6309"><code>-to</code> added to <code>--set-upstream</code> since git1.8.0</a>.</p> <p>Since <a href="http://www.kernel.org/pub/softwar... | 119, 28898, 31678 | git, git-push, remote-branch | <h1>git : how to specify a default remote push-to branch?</h1>
<p>Suppose I have a tracking branch named '<code>abc</code>' which tracks <code>origin/master</code>.</p>
<p>When I'm on '<code>abc</code>' and do a <code>git push</code>, it pushes '<code>abc</code>' to '<code>abc</code>'.<br>
How do I specify the remote ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,014 | git | # git : how to specify a default remote push-to branch?
Suppose I have a tracking branch named '`abc`' which tracks `origin/master`.
When I'm on '`abc`' and do a `git push`, it pushes '`abc`' to '`abc`'.
How do I specify the remote push branch for it with just a '`git push`'? | ```
git branch --set-upstream-to abc origin/master
```
should be able to specify the remote branch.
Note the [`-to` added to `--set-upstream` since git1.8.0](https://stackoverflow.com/a/10002469/6309).
Since [Git1.7.0](http://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.7.0.txt):
> "`git branch --set-upstrea... |
75131872 | error: failed to solve: failed commit on ref : unexpected status: 400 Bad Request | 14 | 2023-01-16 08:43:22 | <p>I am trying to build projects using <strong>Circle CI</strong> <a href="https://github.com/CircleCI-Public/aws-ecr-orb" rel="noreferrer">aws-ecr-orb</a> to push to a private repository in AWS.</p>
<p>I get the error below:</p>
<pre><code>#16 exporting to image
#16 sha256:7dd518c28ca8d9b4a669654c56822c182f0329e5b5897... | 19,920 | 10,907,864 | 2025-05-15 16:15:58 | 75,131,873 | 23 | 2023-01-16 08:43:22 | 10,907,864 | 2023-01-16 08:43:22 | https://stackoverflow.com/q/75131872 | https://stackoverflow.com/a/75131873 | <p>I finally figured out the issue.</p>
<p>The issue was caused because I changed the tag mutability setting for the repository to <code>IMMUTABLE</code>.</p>
<p>All I had to do was to change the tag mutability setting for the repository to <code>MUTABLE</code>.</p>
<p>In Terraform AWS ECR module, I just had to add the... | <p>I finally figured out the issue.</p> <p>The issue was caused because I changed the tag mutability setting for the repository to <code>IMMUTABLE</code>.</p> <p>All I had to do was to change the tag mutability setting for the repository to <code>MUTABLE</code>.</p> <p>In Terraform AWS ECR module, I just had to add the... | 119, 33388, 90475 | amazon-web-services, circleci, git | <h1>error: failed to solve: failed commit on ref : unexpected status: 400 Bad Request</h1>
<p>I am trying to build projects using <strong>Circle CI</strong> <a href="https://github.com/CircleCI-Public/aws-ecr-orb" rel="noreferrer">aws-ecr-orb</a> to push to a private repository in AWS.</p>
<p>I get the error below:</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,015 | git | # error: failed to solve: failed commit on ref : unexpected status: 400 Bad Request
I am trying to build projects using **Circle CI** [aws-ecr-orb](https://github.com/CircleCI-Public/aws-ecr-orb) to push to a private repository in AWS.
I get the error below:
```
#16 exporting to image
#16 sha256:7dd518c28ca8d9b4a669... | I finally figured out the issue.
The issue was caused because I changed the tag mutability setting for the repository to `IMMUTABLE`.
All I had to do was to change the tag mutability setting for the repository to `MUTABLE`.
In Terraform AWS ECR module, I just had to add the settings below to the resource:
```
repos... |
55743088 | How to determine the version of Git Credential Manager for Windows? | 14 | 2019-04-18 09:30:21 | <p>Is there a command or other way to determine the version of Credential Manager in my git installation?</p>
| 16,177 | 458,982 | 2024-04-17 12:47:11 | 55,745,277 | 23 | 2019-04-18 11:41:32 | 5,698,740 | 2021-12-14 04:24:13 | https://stackoverflow.com/q/55743088 | https://stackoverflow.com/a/55745277 | <p>From <code>Git-Credential-Manager</code>'s GitHub <a href="https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/CredentialManager.md" rel="noreferrer">documentation</a></p>
<blockquote>
<p>Assuming the GCM has been installed, using your favorite Windows console (Command Prompt, PowerShell... | <p>From <code>Git-Credential-Manager</code>'s GitHub <a href="https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/CredentialManager.md" rel="noreferrer">documentation</a></p> <blockquote> <p>Assuming the GCM has been installed, using your favorite Windows console (Command Prompt, PowerShell... | 119, 132586 | git, git-credential-manager | <h1>How to determine the version of Git Credential Manager for Windows?</h1>
<p>Is there a command or other way to determine the version of Credential Manager in my git installation?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,016 | git | # How to determine the version of Git Credential Manager for Windows?
Is there a command or other way to determine the version of Credential Manager in my git installation? | From `Git-Credential-Manager`'s GitHub [documentation](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/CredentialManager.md)
> Assuming the GCM has been installed, using your favorite Windows console (Command Prompt, PowerShell, ConEmu, etc.), use the following command to interact dire... |
51848735 | Intellij: Cannot Run Git File Not Found: /usr/local/bin/git | 14 | 2018-08-14 19:43:04 | <p>In Intellij I'm receiving the error message that is in the title of this question: <code>Cannot Run Git File Not Found: /usr/local/bin/git</code>.</p>
<p>The file, however, does exist. I've tried selecting it in the configuration dialog, but without success.</p>
<p>The problem does not seem to be present in VS Cod... | 20,081 | 7,133,972 | 2024-10-21 19:45:06 | 51,848,846 | 23 | 2018-08-14 19:52:20 | 1,252,056 | 2018-08-20 12:58:33 | https://stackoverflow.com/q/51848735 | https://stackoverflow.com/a/51848846 | <p>You need to setup git properly, go to Settings, then File | Settings | Version Control | Git and edit <em>Path to Git executable</em> field. If you enter path to Git (<code>which git</code> in terminal) - usually <em>/usr/bin/git</em> and press <strong>Test</strong> it may popup a more informative message. Also chec... | <p>You need to setup git properly, go to Settings, then File | Settings | Version Control | Git and edit <em>Path to Git executable</em> field. If you enter path to Git (<code>which git</code> in terminal) - usually <em>/usr/bin/git</em> and press <strong>Test</strong> it may popup a more informative message. Also chec... | 119, 8945 | git, intellij-idea | <h1>Intellij: Cannot Run Git File Not Found: /usr/local/bin/git</h1>
<p>In Intellij I'm receiving the error message that is in the title of this question: <code>Cannot Run Git File Not Found: /usr/local/bin/git</code>.</p>
<p>The file, however, does exist. I've tried selecting it in the configuration dialog, but witho... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,017 | git | # Intellij: Cannot Run Git File Not Found: /usr/local/bin/git
In Intellij I'm receiving the error message that is in the title of this question: `Cannot Run Git File Not Found: /usr/local/bin/git`.
The file, however, does exist. I've tried selecting it in the configuration dialog, but without success.
The problem do... | You need to setup git properly, go to Settings, then File | Settings | Version Control | Git and edit *Path to Git executable* field. If you enter path to Git (`which git` in terminal) - usually */usr/bin/git* and press **Test** it may popup a more informative message. Also check the rights of the git executable. |
46590142 | What is the differrence between `* text=auto` and `* text eol=lf` in .gitattributes? | 14 | 2017-10-05 16:02:56 | <p>I am looking again and again at the documentation of <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">.gitattributes</a> but I cannot find a clear answer on what is the differrence between these two:</p>
<p><code>* text=auto</code></p>
<p><code>* text eol=lf</code></p>
<p>Also is <code>text=auto<... | 4,273 | 1,555,615 | 2023-01-17 11:53:16 | 46,592,252 | 23 | 2017-10-05 18:12:17 | 1,256,452 | 2023-01-17 11:53:16 | https://stackoverflow.com/q/46590142 | https://stackoverflow.com/a/46592252 | <h3>TL;DR</h3>
<p>Before Git 2.36.0, the <code>eol=lf</code> setting overrides any <code>text</code> setting, and since you have chosen to apply this to every path, only the <code>eol=lf</code> setting will matter, if you use that.
After Git 2.36.0, the <code>eol=lf</code> only applies if <code>text</code> is set, unsp... | <h3>TL;DR</h3> <p>Before Git 2.36.0, the <code>eol=lf</code> setting overrides any <code>text</code> setting, and since you have chosen to apply this to every path, only the <code>eol=lf</code> setting will matter, if you use that. After Git 2.36.0, the <code>eol=lf</code> only applies if <code>text</code> is set, unsp... | 119, 56102, 59139 | core.autocrlf, git, gitattributes | <h1>What is the differrence between `* text=auto` and `* text eol=lf` in .gitattributes?</h1>
<p>I am looking again and again at the documentation of <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">.gitattributes</a> but I cannot find a clear answer on what is the differrence between these two:</p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,019 | git | # What is the differrence between `* text=auto` and `* text eol=lf` in .gitattributes?
I am looking again and again at the documentation of [.gitattributes](https://git-scm.com/docs/gitattributes) but I cannot find a clear answer on what is the differrence between these two:
`* text=auto`
`* text eol=lf`
Also is `t... | ### TL;DR
Before Git 2.36.0, the `eol=lf` setting overrides any `text` setting, and since you have chosen to apply this to every path, only the `eol=lf` setting will matter, if you use that.
After Git 2.36.0, the `eol=lf` only applies if `text` is set, unspecified, or set to `auto` and Git determines it is a text file... |
29882263 | Browse list of tagged releases in a repo? | 14 | 2015-04-26 19:12:49 | <p>I'm trying to checkout OpenSSL 1.0.2a (and not Master). OpenSSL has tagged releases, and I'm trying to browse them to determine what the actual name is. I know they have 1.0.0, 1.0.1 and 1.0.2 (but they are named more complexly).</p>
<p>According to <a href="https://www.openssl.org/source/repos.html" rel="noreferre... | 19,996 | 608,639 | 2016-04-01 04:10:26 | 29,882,314 | 23 | 2015-04-26 19:17:21 | 79,061 | 2016-04-01 04:10:26 | https://stackoverflow.com/q/29882263 | https://stackoverflow.com/a/29882314 | <p><code>git tag</code> assumes you have a clone of the repo checked out locally. (Which is why it complains about not being in a git repository.)</p>
<p>To achieve what you desire, you probably want to first clone it, then switch to the desired tag:</p>
<pre><code>git clone git://git.openssl.org/openssl.git
cd opens... | <p><code>git tag</code> assumes you have a clone of the repo checked out locally. (Which is why it complains about not being in a git repository.)</p> <p>To achieve what you desire, you probably want to first clone it, then switch to the desired tag:</p> <pre><code>git clone git://git.openssl.org/openssl.git cd opens... | 119 | git | <h1>Browse list of tagged releases in a repo?</h1>
<p>I'm trying to checkout OpenSSL 1.0.2a (and not Master). OpenSSL has tagged releases, and I'm trying to browse them to determine what the actual name is. I know they have 1.0.0, 1.0.1 and 1.0.2 (but they are named more complexly).</p>
<p>According to <a href="https:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,020 | git | # Browse list of tagged releases in a repo?
I'm trying to checkout OpenSSL 1.0.2a (and not Master). OpenSSL has tagged releases, and I'm trying to browse them to determine what the actual name is. I know they have 1.0.0, 1.0.1 and 1.0.2 (but they are named more complexly).
According to [OpenSSL Git repository](https:... | `git tag` assumes you have a clone of the repo checked out locally. (Which is why it complains about not being in a git repository.)
To achieve what you desire, you probably want to first clone it, then switch to the desired tag:
```
git clone git://git.openssl.org/openssl.git
cd openssl
git tag -l ... |
14011046 | What happens to source and destination branches after git merge? | 14 | 2012-12-23 12:44:29 | <p>When I run <code>git checkout branch1</code> followed by <code>git merge branch2</code> to merge two branches it seems like branch2 simply overwrites branch1. Should this be happening?</p>
<p>Edit:</p>
<p>Before merge</p>
<ul>
<li>branch1 = readme.txt (Hello World!)</li>
<li>branch2 = readme.txt (Hello 2!)</li>
<... | 13,692 | 1,289,074 | 2014-07-17 15:01:50 | 14,011,286 | 23 | 2012-12-23 13:21:17 | 1,353,098 | 2012-12-23 15:13:42 | https://stackoverflow.com/q/14011046 | https://stackoverflow.com/a/14011286 | <p>When merging one branch into another <em>git merge</em> will apply all the commits from the branch being merged from to the branch being merged into since the two diverged. You can consider it as forming a new head that contains the latest state from both of the branches put together. If you have changed a file in a... | <p>When merging one branch into another <em>git merge</em> will apply all the commits from the branch being merged from to the branch being merged into since the two diverged. You can consider it as forming a new head that contains the latest state from both of the branches put together. If you have changed a file in a... | 119 | git | <h1>What happens to source and destination branches after git merge?</h1>
<p>When I run <code>git checkout branch1</code> followed by <code>git merge branch2</code> to merge two branches it seems like branch2 simply overwrites branch1. Should this be happening?</p>
<p>Edit:</p>
<p>Before merge</p>
<ul>
<li>branch1 =... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,021 | git | # What happens to source and destination branches after git merge?
When I run `git checkout branch1` followed by `git merge branch2` to merge two branches it seems like branch2 simply overwrites branch1. Should this be happening?
Edit:
Before merge
- branch1 = readme.txt (Hello World!)
- branch2 = readme.txt (Hello... | When merging one branch into another *git merge* will apply all the commits from the branch being merged from to the branch being merged into since the two diverged. You can consider it as forming a new head that contains the latest state from both of the branches put together. If you have changed a file in a branch an... |
9605863 | heroku: Gemfile.lock is required issue | 14 | 2012-03-07 16:56:15 | <p>I have the following issue:</p>
<p>I'm trying to deploy my project on heroku but after i run</p>
<pre><code>git push heroku master
</code></pre>
<p>I get the following:</p>
<pre><code>git push heroku master -f
Counting objects: 524, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (498/49... | 14,035 | 1,022,108 | 2019-08-28 05:34:08 | 9,606,201 | 23 | 2012-03-07 17:19:32 | 206,401 | 2013-11-19 17:36:34 | https://stackoverflow.com/q/9605863 | https://stackoverflow.com/a/9606201 | <p>Few things</p>
<ol>
<li>Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)</li>
<li>Just do <code>bundle install</code> on your local prompt.</li>
<li>now place Gemfile.lock
<ul>
<li><code>git add .</code> or you can add only Gemfile.lock with this <co... | <p>Few things</p> <ol> <li>Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)</li> <li>Just do <code>bundle install</code> on your local prompt.</li> <li>now place Gemfile.lock <ul> <li><code>git add .</code> or you can add only Gemfile.lock with this <co... | 12, 119, 1317, 4984, 8279 | git, heroku, production, ruby, ruby-on-rails | <h1>heroku: Gemfile.lock is required issue</h1>
<p>I have the following issue:</p>
<p>I'm trying to deploy my project on heroku but after i run</p>
<pre><code>git push heroku master
</code></pre>
<p>I get the following:</p>
<pre><code>git push heroku master -f
Counting objects: 524, done.
Delta compression using up... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,022 | git | # heroku: Gemfile.lock is required issue
I have the following issue:
I'm trying to deploy my project on heroku but after i run
```
git push heroku master
```
I get the following:
```
git push heroku master -f
Counting objects: 524, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (498/498),... | Few things
1. Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)
2. Just do `bundle install` on your local prompt.
3. now place Gemfile.lock
- `git add .` or you can add only Gemfile.lock with this `git add Gemfile.lock`
- git commit -m "commit messa... |
9491761 | Push to code.google.com in windows using git | 14 | 2012-02-29 00:05:55 | <p>Related questions:
<a href="https://stackoverflow.com/questions/6903158/netrc-not-accepted-by-git">netrc not accepted by git</a> and <a href="https://stackoverflow.com/questions/6031214/git-how-to-use-netrc-file-on-windows-to-save-user-and-password">Git - How to use .netrc file on windows to save user and password</... | 8,309 | 256,048 | 2016-10-22 12:45:44 | 9,493,462 | 23 | 2012-02-29 04:07:36 | 663,028 | 2012-02-29 04:07:36 | https://stackoverflow.com/q/9491761 | https://stackoverflow.com/a/9493462 | <p>Remove username@ from the url entry for origin in <code>.git/config</code></p>
| <p>Remove username@ from the url entry for origin in <code>.git/config</code></p> | 64, 119 | git, windows | <h1>Push to code.google.com in windows using git</h1>
<p>Related questions:
<a href="https://stackoverflow.com/questions/6903158/netrc-not-accepted-by-git">netrc not accepted by git</a> and <a href="https://stackoverflow.com/questions/6031214/git-how-to-use-netrc-file-on-windows-to-save-user-and-password">Git - How to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,023 | git | # Push to code.google.com in windows using git
Related questions:
[netrc not accepted by git](https://stackoverflow.com/questions/6903158/netrc-not-accepted-by-git) and [Git - How to use .netrc file on windows to save user and password](https://stackoverflow.com/questions/6031214/git-how-to-use-netrc-file-on-windows-t... | Remove username@ from the url entry for origin in `.git/config` |
3192837 | Can gitk show the diff of merges by default? | 14 | 2010-07-07 07:54:15 | <p>Currently for merges without conflicts <code>gitk</code> shows no diffs. Is it possible to have the diffs resulting from a merge (which are indeed there, e.g. <code>git diff HEAD~1</code> after the merge shows these diffs) shown by defautl, e.g. using a command line switch? Or why does gitk by default not show them?... | 4,368 | 321,973 | 2021-11-18 13:09:09 | 3,194,397 | 23 | 2010-07-07 11:52:50 | 19,563 | 2010-07-07 11:52:50 | https://stackoverflow.com/q/3192837 | https://stackoverflow.com/a/3194397 | <p>By default <code>gitk</code> does the same thing as the <code>--cc</code> option to <code>git diff</code> and compresses the merge to only show diff chunks that don't come directly from one or other parent. This is usually more helpful as conflicts are the interesting part of merges, the other parts of the diff will... | <p>By default <code>gitk</code> does the same thing as the <code>--cc</code> option to <code>git diff</code> and compresses the merge to only show diff chunks that don't come directly from one or other parent. This is usually more helpful as conflicts are the interesting part of merges, the other parts of the diff will... | 119, 606, 717, 30785 | diff, git, gitk, merge | <h1>Can gitk show the diff of merges by default?</h1>
<p>Currently for merges without conflicts <code>gitk</code> shows no diffs. Is it possible to have the diffs resulting from a merge (which are indeed there, e.g. <code>git diff HEAD~1</code> after the merge shows these diffs) shown by defautl, e.g. using a command l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,024 | git | # Can gitk show the diff of merges by default?
Currently for merges without conflicts `gitk` shows no diffs. Is it possible to have the diffs resulting from a merge (which are indeed there, e.g. `git diff HEAD~1` after the merge shows these diffs) shown by defautl, e.g. using a command line switch? Or why does gitk by... | By default `gitk` does the same thing as the `--cc` option to `git diff` and compresses the merge to only show diff chunks that don't come directly from one or other parent. This is usually more helpful as conflicts are the interesting part of merges, the other parts of the diff will already appear in the diffs for the... |
2520002 | Git exclude a commit in a branch | 14 | 2010-03-25 22:49:40 | <p>I have a commit, I have stored in a branch, because this should go only to a specific box.</p>
<p>I have merged it to the branch master, but not the branch dev, that I use locally.</p>
<p>Now, by mistake I merged master to dev and that introduced this commit to dev.</p>
<p>I know can git revert sha, to branch dev... | 16,625 | 55,562 | 2014-10-07 13:58:29 | 2,520,017 | 23 | 2010-03-25 22:53:28 | 225,801 | 2010-03-25 22:53:28 | https://stackoverflow.com/q/2520002 | https://stackoverflow.com/a/2520017 | <p>On a scratch copy of your branch, <code>git rebase --interactive</code> and drop the unwanted commit. Alternatively, you could create a new branch upstream of the unwanted commit and <code>git cherry-pick</code> the desired commits onto it.</p>
<p>There are probably more ways to achieve this.</p>
| <p>On a scratch copy of your branch, <code>git rebase --interactive</code> and drop the unwanted commit. Alternatively, you could create a new branch upstream of the unwanted commit and <code>git cherry-pick</code> the desired commits onto it.</p> <p>There are probably more ways to achieve this.</p> | 119, 5597, 12309 | commit, git, revert | <h1>Git exclude a commit in a branch</h1>
<p>I have a commit, I have stored in a branch, because this should go only to a specific box.</p>
<p>I have merged it to the branch master, but not the branch dev, that I use locally.</p>
<p>Now, by mistake I merged master to dev and that introduced this commit to dev.</p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,025 | git | # Git exclude a commit in a branch
I have a commit, I have stored in a branch, because this should go only to a specific box.
I have merged it to the branch master, but not the branch dev, that I use locally.
Now, by mistake I merged master to dev and that introduced this commit to dev.
I know can git revert sha, t... | On a scratch copy of your branch, `git rebase --interactive` and drop the unwanted commit. Alternatively, you could create a new branch upstream of the unwanted commit and `git cherry-pick` the desired commits onto it.
There are probably more ways to achieve this. |
36031848 | How to get the SHA of the checked out code with ansible git module? | 13 | 2016-03-16 09:42:49 | <p>I would like to store the currently checked out commit <code>SHA-1</code> hash for the version of code with Ansible.</p>
<p>I want to <a href="http://docs.ansible.com/ansible/set_fact_module.html" rel="noreferrer"><code>set_fact</code></a> of this version for use in another role.</p>
| 7,847 | 2,118,666 | 2016-03-16 20:18:49 | 36,035,066 | 23 | 2016-03-16 11:58:40 | 3,195,726 | 2016-03-16 19:39:16 | https://stackoverflow.com/q/36031848 | https://stackoverflow.com/a/36035066 | <p>The <code>git</code> module in Ansible returns this information for you, you just need to <strong>register</strong> it in a variable (variable is <code>gitresult</code> in the example below).</p>
<pre><code>- hosts: web
tasks:
- name: Checkout repo
git:
repo=https://github.com/michalgasek/www-di... | <p>The <code>git</code> module in Ansible returns this information for you, you just need to <strong>register</strong> it in a variable (variable is <code>gitresult</code> in the example below).</p> <pre><code>- hosts: web tasks: - name: Checkout repo git: repo=https://github.com/michalgasek/www-di... | 119, 86394 | ansible, git | <h1>How to get the SHA of the checked out code with ansible git module?</h1>
<p>I would like to store the currently checked out commit <code>SHA-1</code> hash for the version of code with Ansible.</p>
<p>I want to <a href="http://docs.ansible.com/ansible/set_fact_module.html" rel="noreferrer"><code>set_fact</code></a>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,027 | git | # How to get the SHA of the checked out code with ansible git module?
I would like to store the currently checked out commit `SHA-1` hash for the version of code with Ansible.
I want to [`set_fact`](http://docs.ansible.com/ansible/set_fact_module.html) of this version for use in another role. | The `git` module in Ansible returns this information for you, you just need to **register** it in a variable (variable is `gitresult` in the example below).
```
- hosts: web
tasks:
- name: Checkout repo
git:
repo=https://github.com/michalgasek/www-discogs.git
dest=/vagrant/checkout
... |
30475920 | Git ignore is not ignoring the netbeans private files | 13 | 2015-05-27 07:31:41 | <p>When ever I do git status, the netbeans private.xml is making trouble, I tried adding that in git ignore several ways. but the gitignore simply does not ignore it.</p>
<pre><code>git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>... | 8,721 | 1,256,197 | 2018-04-13 06:11:26 | 30,475,983 | 23 | 2015-05-27 07:34:51 | 6,309 | 2015-05-27 07:34:51 | https://stackoverflow.com/q/30475920 | https://stackoverflow.com/a/30475983 | <p>A file which is already tracked would not be ignored: you need to remove from the index first.</p>
<pre><code>git rm --cached private.xml
git add -u .
git commit -m "Record deletion of private.xml from the index"
</code></pre>
<p>(the <code>--cached</code> option make sure the file remains on the disk)</p>
<p>Th... | <p>A file which is already tracked would not be ignored: you need to remove from the index first.</p> <pre><code>git rm --cached private.xml git add -u . git commit -m "Record deletion of private.xml from the index" </code></pre> <p>(the <code>--cached</code> option make sure the file remains on the disk)</p> <p>Th... | 119, 2176, 25056 | git, gitignore, netbeans | <h1>Git ignore is not ignoring the netbeans private files</h1>
<p>When ever I do git status, the netbeans private.xml is making trouble, I tried adding that in git ignore several ways. but the gitignore simply does not ignore it.</p>
<pre><code>git status
On branch master
Your branch is up-to-date with 'origin/master'... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,029 | git | # Git ignore is not ignoring the netbeans private files
When ever I do git status, the netbeans private.xml is making trouble, I tried adding that in git ignore several ways. but the gitignore simply does not ignore it.
```
git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not stage... | A file which is already tracked would not be ignored: you need to remove from the index first.
```
git rm --cached private.xml
git add -u .
git commit -m "Record deletion of private.xml from the index"
```
(the `--cached` option make sure the file remains on the disk)
Then you can add it in the .gitignore (no need ... |
28273980 | Add git submodule as reference to existing solution in VS | 13 | 2015-02-02 08:53:33 | <p>Lets say I have a submodule repo:</p>
<pre><code>_git/DbModel (only source code indexed. No /bin or /obj folders)
</code></pre>
<p>And two projects which need DbModel as reference library:</p>
<pre><code>_git/TTT
_git/TPM
</code></pre>
<p>I've already added DbModel as submodule via GitBash to both of them</p>
<pre><... | 14,889 | 4,346,877 | 2022-08-12 03:54:02 | 28,338,732 | 23 | 2015-02-05 07:49:26 | 4,346,877 | 2015-02-05 07:49:26 | https://stackoverflow.com/q/28273980 | https://stackoverflow.com/a/28338732 | <p>For those who will be interested in this:</p>
<pre><code>git submodule add https://RepoPath/_git/DbModel
git submodule init //this is IMPORTANT
git submodule update
</code></pre>
<p>and then add existing project in your solution from newly created folder. Like that:</p>
<pre><code> Source\Repos\TPM\DbModel\DbMo... | <p>For those who will be interested in this:</p> <pre><code>git submodule add https://RepoPath/_git/DbModel git submodule init //this is IMPORTANT git submodule update </code></pre> <p>and then add existing project in your solution from newly created folder. Like that:</p> <pre><code> Source\Repos\TPM\DbModel\DbMo... | 119, 4484, 33953, 41612 | git, git-submodules, projects-and-solutions, visual-studio | <h1>Add git submodule as reference to existing solution in VS</h1>
<p>Lets say I have a submodule repo:</p>
<pre><code>_git/DbModel (only source code indexed. No /bin or /obj folders)
</code></pre>
<p>And two projects which need DbModel as reference library:</p>
<pre><code>_git/TTT
_git/TPM
</code></pre>
<p>I've alread... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,030 | git | # Add git submodule as reference to existing solution in VS
Lets say I have a submodule repo:
```
_git/DbModel (only source code indexed. No /bin or /obj folders)
```
And two projects which need DbModel as reference library:
```
_git/TTT
_git/TPM
```
I've already added DbModel as submodule via GitBash to both of t... | For those who will be interested in this:
```
git submodule add https://RepoPath/_git/DbModel
git submodule init //this is IMPORTANT
git submodule update
```
and then add existing project in your solution from newly created folder. Like that:
```
Source\Repos\TPM\DbModel\DbModel\DbModel.csproj
```
P.S.
```
Sour... |
11071420 | Delete everything and upload new version | 13 | 2012-06-17 12:52:49 | <p>We are using git for version control and right now we are getting a lot of warnings when trying to upload the most recent version. I am new to git and don't have patience for the restrictions, is there any way to delete everything and upload the current version?</p>
<p>This is what I get now when trying to upload.<... | 26,383 | 984,975 | 2017-10-02 09:56:35 | 11,071,474 | 23 | 2012-06-17 13:03:11 | 637,618 | 2012-06-17 13:03:11 | https://stackoverflow.com/q/11071420 | https://stackoverflow.com/a/11071474 | <p>1.) Delete everything in your repository folder</p>
<p>2.) run <code>git rm *</code> to tell git to remove all files (check with <code>git status</code> whether there are any unstaged files left)</p>
<p>3.) do a <code>git commit -a -m "commitmessage"</code> a <code>git push origin master</code> to delete all files... | <p>1.) Delete everything in your repository folder</p> <p>2.) run <code>git rm *</code> to tell git to remove all files (check with <code>git status</code> whether there are any unstaged files left)</p> <p>3.) do a <code>git commit -a -m "commitmessage"</code> a <code>git push origin master</code> to delete all files... | 119, 456 | git, version-control | <h1>Delete everything and upload new version</h1>
<p>We are using git for version control and right now we are getting a lot of warnings when trying to upload the most recent version. I am new to git and don't have patience for the restrictions, is there any way to delete everything and upload the current version?</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,031 | git | # Delete everything and upload new version
We are using git for version control and right now we are getting a lot of warnings when trying to upload the most recent version. I am new to git and don't have patience for the restrictions, is there any way to delete everything and upload the current version?
This is what... | 1.) Delete everything in your repository folder
2.) run `git rm *` to tell git to remove all files (check with `git status` whether there are any unstaged files left)
3.) do a `git commit -a -m "commitmessage"` a `git push origin master` to delete all files on the remote git server
4.) check if you have an empty rem... |
4126732 | Git: how to exclude a subfolder in a repository? | 13 | 2010-11-08 18:21:19 | <p>I have created a repository in a folder with my project, you know, <code>git init</code>, I have the Webstorm folder <code>.idea</code> and another one not related to this, I am not interested in keeping in the repository, and I don't want this folder to appear even as new files to add.
I want to forget about these... | 22,556 | 301,742 | 2015-04-23 21:42:03 | 4,126,777 | 23 | 2010-11-08 18:26:56 | 456 | 2015-04-23 21:42:03 | https://stackoverflow.com/q/4126732 | https://stackoverflow.com/a/4126777 | <p>Open the <code>.git/info/exclude</code> file in a text editor and add the folder to ignore. This file remains private to you. You can also create a <code>.gitignore</code> file in the repository's root directory, outside the <code>.git</code> directory and write the folder entry there. Then add this file to the repo... | <p>Open the <code>.git/info/exclude</code> file in a text editor and add the folder to ignore. This file remains private to you. You can also create a <code>.gitignore</code> file in the repository's root directory, outside the <code>.git</code> directory and write the folder entry there. Then add this file to the repo... | 119, 25056 | git, gitignore | <h1>Git: how to exclude a subfolder in a repository?</h1>
<p>I have created a repository in a folder with my project, you know, <code>git init</code>, I have the Webstorm folder <code>.idea</code> and another one not related to this, I am not interested in keeping in the repository, and I don't want this folder to appe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,032 | git | # Git: how to exclude a subfolder in a repository?
I have created a repository in a folder with my project, you know, `git init`, I have the Webstorm folder `.idea` and another one not related to this, I am not interested in keeping in the repository, and I don't want this folder to appear even as new files to add.
I ... | Open the `.git/info/exclude` file in a text editor and add the folder to ignore. This file remains private to you. You can also create a `.gitignore` file in the repository's root directory, outside the `.git` directory and write the folder entry there. Then add this file to the repository to share with others what con... |
22827676 | git warnings about unable to unlink git objects. How do I resolve this? | 12 | 2014-04-03 04:09:03 | <p>When I do a git commit I see the following</p>
<pre><code>>$ git commit -a
warning: unable to unlink .git/objects/63/tmp_obj_kK6IC9: Invalid argument
warning: unable to unlink .git/objects/2c/tmp_obj_SFNGla: Invalid argument
</code></pre>
<p>I can still perform git commit. However, I want to know how to get rid... | 22,630 | 80,353 | 2018-08-17 14:36:24 | 26,539,164 | 23 | 2014-10-23 23:25:25 | 1,317,564 | 2017-08-02 07:20:17 | https://stackoverflow.com/q/22827676 | https://stackoverflow.com/a/26539164 | <p>I had a similar problem on OS X whenever trying to run "git repack" or "git gc", and I finally solved it after coming across this page: <a href="http://hints.macworld.com/article.php?story=20010610132749532" rel="noreferrer">http://hints.macworld.com/article.php?story=20010610132749532</a></p>
<p>The fix is to open... | <p>I had a similar problem on OS X whenever trying to run "git repack" or "git gc", and I finally solved it after coming across this page: <a href="http://hints.macworld.com/article.php?story=20010610132749532" rel="noreferrer">http://hints.macworld.com/article.php?story=20010610132749532</a></p> <p>The fix is to open... | 119 | git | <h1>git warnings about unable to unlink git objects. How do I resolve this?</h1>
<p>When I do a git commit I see the following</p>
<pre><code>>$ git commit -a
warning: unable to unlink .git/objects/63/tmp_obj_kK6IC9: Invalid argument
warning: unable to unlink .git/objects/2c/tmp_obj_SFNGla: Invalid argument
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,035 | git | # git warnings about unable to unlink git objects. How do I resolve this?
When I do a git commit I see the following
```
>$ git commit -a
warning: unable to unlink .git/objects/63/tmp_obj_kK6IC9: Invalid argument
warning: unable to unlink .git/objects/2c/tmp_obj_SFNGla: Invalid argument
```
I can still perform git c... | I had a similar problem on OS X whenever trying to run "git repack" or "git gc", and I finally solved it after coming across this page: <http://hints.macworld.com/article.php?story=20010610132749532>
The fix is to open a terminal, go to your git repo, cd into the .git folder, and then type `chflags -R nouchg *`. If th... |
22022106 | git fetch origin doesn't fetch all branches | 12 | 2014-02-25 17:47:42 | <p>I read in the answers to <a href="https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches">this question</a> that <code>git fetch origin</code> should fetch <em>all</em> branches of origin. In my case, it doesn't seem to give me any branches, though. Here's what I did:</p>
<p>Initially, a remote ... | 16,759 | 3,198,108 | 2016-07-31 23:39:49 | 22,022,107 | 23 | 2014-02-25 17:47:42 | 3,198,108 | 2016-04-03 18:54:08 | https://stackoverflow.com/q/22022106 | https://stackoverflow.com/a/22022107 | <p>You have all 7 branches, but <code>git branch</code> only shows local branches. Even though you now have the branch data locally on your system, they are still considered "remote branches". <strong>You can see them with <code>git branch -a</code>.</strong> They'll be called something like <code>remotes/origin/branch... | <p>You have all 7 branches, but <code>git branch</code> only shows local branches. Even though you now have the branch data locally on your system, they are still considered "remote branches". <strong>You can see them with <code>git branch -a</code>.</strong> They'll be called something like <code>remotes/origin/branch... | 119, 1879, 33720, 34099 | branch, git, git-clone, git-fetch | <h1>git fetch origin doesn't fetch all branches</h1>
<p>I read in the answers to <a href="https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches">this question</a> that <code>git fetch origin</code> should fetch <em>all</em> branches of origin. In my case, it doesn't seem to give me any branches, th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,036 | git | # git fetch origin doesn't fetch all branches
I read in the answers to [this question](https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches) that `git fetch origin` should fetch *all* branches of origin. In my case, it doesn't seem to give me any branches, though. Here's what I did:
Initially, a... | You have all 7 branches, but `git branch` only shows local branches. Even though you now have the branch data locally on your system, they are still considered "remote branches". **You can see them with `git branch -a`.** They'll be called something like `remotes/origin/branchname`. You can check them out by specifying... |
20977520 | Is there any way to exclude branches from showing in GitK? | 12 | 2014-01-07 17:01:26 | <p>Sometimes when I use GitK there's a load of commits on branches I'm not concerned with and they tend get in the way of what I'm doing.</p>
<p>It would be nice to be able to specify which branches I want, or specify which branches I want to exclude.</p>
<p>Is this possible?</p>
| 2,367 | 348,261 | 2014-01-07 18:32:47 | 20,978,568 | 23 | 2014-01-07 17:59:23 | 266,374 | 2014-01-07 18:32:47 | https://stackoverflow.com/q/20977520 | https://stackoverflow.com/a/20978568 | <p>You can specify which branches you want by specifying them as arguments to the <code>gitk</code> command. I'm assuming that you're already using <code>--all</code>, but you might be interested to know that there's also a <code>--not</code> flag...although it has some side effects and is not too useful in most circum... | <p>You can specify which branches you want by specifying them as arguments to the <code>gitk</code> command. I'm assuming that you're already using <code>--all</code>, but you might be interested to know that there's also a <code>--not</code> flag...although it has some side effects and is not too useful in most circum... | 119, 1879, 30785 | branch, git, gitk | <h1>Is there any way to exclude branches from showing in GitK?</h1>
<p>Sometimes when I use GitK there's a load of commits on branches I'm not concerned with and they tend get in the way of what I'm doing.</p>
<p>It would be nice to be able to specify which branches I want, or specify which branches I want to exclude.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,037 | git | # Is there any way to exclude branches from showing in GitK?
Sometimes when I use GitK there's a load of commits on branches I'm not concerned with and they tend get in the way of what I'm doing.
It would be nice to be able to specify which branches I want, or specify which branches I want to exclude.
Is this possib... | You can specify which branches you want by specifying them as arguments to the `gitk` command. I'm assuming that you're already using `--all`, but you might be interested to know that there's also a `--not` flag...although it has some side effects and is not too useful in most circumstances.
Consider a repository that... |
19321584 | What is origin/master in git compared to origin master? | 12 | 2013-10-11 15:14:20 | <p>I wanted to add this question as a comment to the answer of @KevinBallard here <a href="https://stackoverflow.com/questions/7642273/whats-the-difference-origin-master-vs-origin-master">What's the difference "origin master" vs "origin/master"</a>, but my comment was to long.</p>
<p>So my ques... | 7,758 | 1,908,115 | 2016-12-13 22:41:25 | 19,321,898 | 23 | 2013-10-11 15:30:19 | 2,192,903 | 2013-10-11 16:03:54 | https://stackoverflow.com/q/19321584 | https://stackoverflow.com/a/19321898 | <ul>
<li><code>master</code> is your local branch.</li>
<li><code>origin master</code> is the branch <code>master</code> on the remote repository named <code>origin</code>.</li>
<li><code>origin/master</code> is your local copy of <code>origin master</code>.</li>
</ul>
<p>When you do <code>git pull</code> (what I cons... | <ul> <li><code>master</code> is your local branch.</li> <li><code>origin master</code> is the branch <code>master</code> on the remote repository named <code>origin</code>.</li> <li><code>origin/master</code> is your local copy of <code>origin master</code>.</li> </ul> <p>When you do <code>git pull</code> (what I cons... | 119 | git | <h1>What is origin/master in git compared to origin master?</h1>
<p>I wanted to add this question as a comment to the answer of @KevinBallard here <a href="https://stackoverflow.com/questions/7642273/whats-the-difference-origin-master-vs-origin-master">What's the difference "origin master" vs "origin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,038 | git | # What is origin/master in git compared to origin master?
I wanted to add this question as a comment to the answer of @KevinBallard here [What's the difference "origin master" vs "origin/master"](https://stackoverflow.com/questions/7642273/whats-the-difference-origin-master-vs-origin-master), but my comment was to lon... | - `master` is your local branch.
- `origin master` is the branch `master` on the remote repository named `origin`.
- `origin/master` is your local copy of `origin master`.
When you do `git pull` (what I consider as evil, anyone else?), it automatically does :
- git fetch : it copies `origin master` into `origin/maste... |
6599798 | How to undo a Git rollback | 12 | 2011-07-06 16:25:25 | <p>I wanted to rollback to the last commit after making a massive error, but I managed to rollback a little too fair. The commit I wanted to reassert doesn't appear when I enter 'git log' in bash (I suppose because it's no longer in the history). Is there any way I can recover the last commit by date?</p>
<p>I'm also ... | 27,031 | 524,353 | 2011-07-06 17:42:49 | 6,600,073 | 23 | 2011-07-06 16:48:35 | 526,535 | 2011-07-06 16:48:35 | https://stackoverflow.com/q/6599798 | https://stackoverflow.com/a/6600073 | <p>If you are ok with command line, go to you repo, do a <code>git reflog</code> and get the commit which you want to "rollback" to and do a <code>git reset --hard <commit></code></p>
<p>You would also be able to do <code>git reset --hard HEAD@{1}</code> and then come back to egit and rollback to the desired com... | <p>If you are ok with command line, go to you repo, do a <code>git reflog</code> and get the commit which you want to "rollback" to and do a <code>git reset --hard <commit></code></p> <p>You would also be able to do <code>git reset --hard HEAD@{1}</code> and then come back to egit and rollback to the desired com... | 53, 119, 5597, 12196, 43702 | commit, eclipse, egit, git, rollback | <h1>How to undo a Git rollback</h1>
<p>I wanted to rollback to the last commit after making a massive error, but I managed to rollback a little too fair. The commit I wanted to reassert doesn't appear when I enter 'git log' in bash (I suppose because it's no longer in the history). Is there any way I can recover the la... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,039 | git | # How to undo a Git rollback
I wanted to rollback to the last commit after making a massive error, but I managed to rollback a little too fair. The commit I wanted to reassert doesn't appear when I enter 'git log' in bash (I suppose because it's no longer in the history). Is there any way I can recover the last commit... | If you are ok with command line, go to you repo, do a `git reflog` and get the commit which you want to "rollback" to and do a `git reset --hard <commit>`
You would also be able to do `git reset --hard HEAD@{1}` and then come back to egit and rollback to the desired commit. |
5720329 | Finding out when code changed in git | 12 | 2011-04-19 17:32:56 | <p>I don't think there's an easier way to do this, but I thought I'd ask to be sure.</p>
<p>I have some code where an important line was deleted (by me). I wanted to find out in what commit I accidentally deleted that line. The only way I could find to do it was to start git "diff'ing" on subsequently earlier commit... | 4,117 | 136,451 | 2011-04-19 18:53:48 | 5,720,401 | 23 | 2011-04-19 17:41:07 | 19,563 | 2011-04-19 17:41:07 | https://stackoverflow.com/q/5720329 | https://stackoverflow.com/a/5720401 | <p>If you only modified or added a line you could of course use <code>git blame</code>. If you only completely removed the line then that, of course, doesn't help you.</p>
<p>If you knew at least some of the text on the line that was deleted then you can use the "pickaxe" option to <code>git log</code> to limit the co... | <p>If you only modified or added a line you could of course use <code>git blame</code>. If you only completely removed the line then that, of course, doesn't help you.</p> <p>If you knew at least some of the text on the line that was deleted then you can use the "pickaxe" option to <code>git log</code> to limit the co... | 119, 456 | git, version-control | <h1>Finding out when code changed in git</h1>
<p>I don't think there's an easier way to do this, but I thought I'd ask to be sure.</p>
<p>I have some code where an important line was deleted (by me). I wanted to find out in what commit I accidentally deleted that line. The only way I could find to do it was to start... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,040 | git | # Finding out when code changed in git
I don't think there's an easier way to do this, but I thought I'd ask to be sure.
I have some code where an important line was deleted (by me). I wanted to find out in what commit I accidentally deleted that line. The only way I could find to do it was to start git "diff'ing" on... | If you only modified or added a line you could of course use `git blame`. If you only completely removed the line then that, of course, doesn't help you.
If you knew at least some of the text on the line that was deleted then you can use the "pickaxe" option to `git log` to limit the commits that you are searching.
E... |
4697326 | How can I push my changes to a remote branch | 12 | 2011-01-15 00:32:46 | <p>I am on a master branch 'master' and I have 1 commit ahead
I want to create a new remote branch called 'new_remote' and push my commit there?</p>
<pre><code>$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' by 1 commit.
</code></pre>
<p>I w... | 66,997 | 286,802 | 2017-01-30 16:37:04 | 4,697,362 | 23 | 2011-01-15 00:42:50 | 176,769 | 2015-05-01 12:26:13 | https://stackoverflow.com/q/4697326 | https://stackoverflow.com/a/4697362 | <p>If you are currently working on local branch <em>master</em>, and the new remote branch has not been created yet:</p>
<pre><code>git checkout -b new_branch // creates a local branch (as a copy of the current)
git push origin new_branch // push it to the remote server
</code></pre>
| <p>If you are currently working on local branch <em>master</em>, and the new remote branch has not been created yet:</p> <pre><code>git checkout -b new_branch // creates a local branch (as a copy of the current) git push origin new_branch // push it to the remote server </code></pre> | 119 | git | <h1>How can I push my changes to a remote branch</h1>
<p>I am on a master branch 'master' and I have 1 commit ahead
I want to create a new remote branch called 'new_remote' and push my commit there?</p>
<pre><code>$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,041 | git | # How can I push my changes to a remote branch
I am on a master branch 'master' and I have 1 commit ahead
I want to create a new remote branch called 'new_remote' and push my commit there?
```
$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' ... | If you are currently working on local branch *master*, and the new remote branch has not been created yet:
```
git checkout -b new_branch // creates a local branch (as a copy of the current)
git push origin new_branch // push it to the remote server
``` |
3228457 | Git: Howto move changes since last commit to a new branch | 12 | 2010-07-12 12:24:19 | <p>I have been working on a branch which we can call "A". I just realized that the code I have added since I last committed should rather be in a specific (experimental) branch, but not in "A". How can I commit the changes to a new branch and leave branch "A" as it was when I last committed?</p>
| 1,716 | 374,605 | 2019-02-28 09:26:30 | 3,228,479 | 23 | 2010-07-12 12:27:15 | 230,575 | 2010-07-12 12:27:15 | https://stackoverflow.com/q/3228457 | https://stackoverflow.com/a/3228479 | <p>If the changes are staged or your working directory, you can simply checkout into a new branch like so:</p>
<pre><code>git checkout -b branch_name
</code></pre>
<p>You can then commit directly into the new branch.</p>
| <p>If the changes are staged or your working directory, you can simply checkout into a new branch like so:</p> <pre><code>git checkout -b branch_name </code></pre> <p>You can then commit directly into the new branch.</p> | 119, 1879, 5281, 37230, 53850 | branch, checkout, git, git-checkout, git-commit | <h1>Git: Howto move changes since last commit to a new branch</h1>
<p>I have been working on a branch which we can call "A". I just realized that the code I have added since I last committed should rather be in a specific (experimental) branch, but not in "A". How can I commit the changes to a new branch and leave bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,042 | git | # Git: Howto move changes since last commit to a new branch
I have been working on a branch which we can call "A". I just realized that the code I have added since I last committed should rather be in a specific (experimental) branch, but not in "A". How can I commit the changes to a new branch and leave branch "A" as... | If the changes are staged or your working directory, you can simply checkout into a new branch like so:
```
git checkout -b branch_name
```
You can then commit directly into the new branch. |
1434893 | git when changing the repository | 12 | 2009-09-16 19:05:40 | <p>I am used to pull from a git repository of someone. Today he moved his repository to another address. I wonder if there is some way for me to pull from the new address and to get the info of what changes he made with respect to last time before his moving?</p>
<p>What I have done is "git clone newaddress" ... | 12,734 | 156,458 | 2011-04-22 03:29:36 | 1,435,375 | 23 | 2009-09-16 20:47:17 | 124,674 | 2011-04-22 03:29:36 | https://stackoverflow.com/q/1434893 | https://stackoverflow.com/a/1435375 | <p>If I'm understanding your question correctly, what you are looking to do is replace your current remote origin with a new one. I don't know if you can replace it from command line, but you can change it in your <code>.git/config</code> (this is in your project directory)</p>
<p>OLD</p>
<pre><code>[remote "origin"]... | <p>If I'm understanding your question correctly, what you are looking to do is replace your current remote origin with a new one. I don't know if you can replace it from command line, but you can change it in your <code>.git/config</code> (this is in your project directory)</p> <p>OLD</p> <pre><code>[remote "origin"]... | 119, 7330 | git, repository | <h1>git when changing the repository</h1>
<p>I am used to pull from a git repository of someone. Today he moved his repository to another address. I wonder if there is some way for me to pull from the new address and to get the info of what changes he made with respect to last time before his moving?</p>
<p>What I have... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,043 | git | # git when changing the repository
I am used to pull from a git repository of someone. Today he moved his repository to another address. I wonder if there is some way for me to pull from the new address and to get the info of what changes he made with respect to last time before his moving?
What I have done is "git c... | If I'm understanding your question correctly, what you are looking to do is replace your current remote origin with a new one. I don't know if you can replace it from command line, but you can change it in your `.git/config` (this is in your project directory)
OLD
```
[remote "origin"]
url = git+ssh://original_repo... |
72292278 | error obtaining vcs status when running delve as root | 11 | 2022-05-18 15:47:39 | <p>I am trying to run <code>sudo dlv debug</code> on Arch Linux and I keep getting following error:</p>
<pre><code>error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
exit status 1
</code></pre>
<p>When I remove the .git folder, <code>sudo dlv debug</code> runs as expected, so I... | 28,680 | 365,601 | 2024-11-22 09:37:57 | 72,544,463 | 23 | 2022-06-08 10:54:41 | 15,710 | 2022-06-08 10:54:41 | https://stackoverflow.com/q/72292278 | https://stackoverflow.com/a/72544463 | <p>I had a similar error message when debugging code opened in a remote container via vscode.</p>
<p>when I used <code>git status</code> I got a message saying the git repository is unsafe was owned by someone else. And then a message explaining to use:</p>
<pre><code>git config --global --add safe.directory [your dir ... | <p>I had a similar error message when debugging code opened in a remote container via vscode.</p> <p>when I used <code>git status</code> I got a message saying the git repository is unsafe was owned by someone else. And then a message explaining to use:</p> <pre><code>git config --global --add safe.directory [your dir ... | 119, 277, 15627, 116037 | debugging, delve, git, go | <h1>error obtaining vcs status when running delve as root</h1>
<p>I am trying to run <code>sudo dlv debug</code> on Arch Linux and I keep getting following error:</p>
<pre><code>error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
exit status 1
</code></pre>
<p>When I remove the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,045 | git | # error obtaining vcs status when running delve as root
I am trying to run `sudo dlv debug` on Arch Linux and I keep getting following error:
```
error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
exit status 1
```
When I remove the .git folder, `sudo dlv debug` runs as expe... | I had a similar error message when debugging code opened in a remote container via vscode.
when I used `git status` I got a message saying the git repository is unsafe was owned by someone else. And then a message explaining to use:
```
git config --global --add safe.directory [your dir here]
```
doing this I no lon... |
52495260 | Git how to check to which repo project is connected | 11 | 2018-09-25 09:50:02 | <p>How can I check to see which repo project is connected when I'm using <code>android studio</code>? </p>
<p>I have created a new repo in <code>bitbucket</code>, pulled that new repository and copied the old project which was connected to another repository to that folder now I want to make sure that I will push to t... | 45,925 | 2,543,013 | 2018-09-25 10:26:37 | 52,495,949 | 23 | 2018-09-25 10:26:37 | 10,391,676 | 2018-09-25 10:26:37 | https://stackoverflow.com/q/52495260 | https://stackoverflow.com/a/52495949 | <p>You should be able to view your remote repositories by clicking <strong>VCS > Git > Remotes</strong>.</p>
<p>In Android Studio you can also click the Console tab to bring up a terminal. If you have set up remote repositories, <code>git remote -v</code> will list them, along with their names.</p>
<p>To make sure yo... | <p>You should be able to view your remote repositories by clicking <strong>VCS > Git > Remotes</strong>.</p> <p>In Android Studio you can also click the Console tab to bring up a terminal. If you have set up remote repositories, <code>git remote -v</code> will list them, along with their names.</p> <p>To make sure yo... | 119, 91905 | android-studio, git | <h1>Git how to check to which repo project is connected</h1>
<p>How can I check to see which repo project is connected when I'm using <code>android studio</code>? </p>
<p>I have created a new repo in <code>bitbucket</code>, pulled that new repository and copied the old project which was connected to another repository... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,046 | git | # Git how to check to which repo project is connected
How can I check to see which repo project is connected when I'm using `android studio`?
I have created a new repo in `bitbucket`, pulled that new repository and copied the old project which was connected to another repository to that folder now I want to make sure... | You should be able to view your remote repositories by clicking **VCS > Git > Remotes**.
In Android Studio you can also click the Console tab to bring up a terminal. If you have set up remote repositories, `git remote -v` will list them, along with their names.
To make sure you push to the right repository, just make... |
49396178 | BFG Repo Cleaner – Alternative to Fresh Clone | 11 | 2018-03-21 00:15:16 | <p>I was going to ask this on the repository but SO seemed like a more fitting place to ask this.</p>
<p>I was able to use BFG Repo Cleaner (great tool, thank you!) to reduce our <code>.git</code> folder size by over 1GB, which is a smashing success as far as our repository is concerned. I have not pushed my bare clon... | 2,183 | 3,720,523 | 2018-04-12 00:46:14 | 49,471,048 | 23 | 2018-03-24 23:32:46 | 438,886 | 2018-03-24 23:32:46 | https://stackoverflow.com/q/49396178 | https://stackoverflow.com/a/49471048 | <h3>Preface</h3>
<p>Before we get into this, let me clarify the recommended process for cleaning Git history in the context of an active <em>team</em> of developers (no matter what technology used for the cleaning - whether <em>BFG Repo-Cleaner</em> or <code>git filter-branch</code>):</p>
<ol>
<li>Practice doing the ... | <h3>Preface</h3> <p>Before we get into this, let me clarify the recommended process for cleaning Git history in the context of an active <em>team</em> of developers (no matter what technology used for the cleaning - whether <em>BFG Repo-Cleaner</em> or <code>git filter-branch</code>):</p> <ol> <li>Practice doing the ... | 91259, 105532 | bfg-repo-cleaner, git-rewrite-history | <h1>BFG Repo Cleaner – Alternative to Fresh Clone</h1>
<p>I was going to ask this on the repository but SO seemed like a more fitting place to ask this.</p>
<p>I was able to use BFG Repo Cleaner (great tool, thank you!) to reduce our <code>.git</code> folder size by over 1GB, which is a smashing success as far as our ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,047 | git | # BFG Repo Cleaner – Alternative to Fresh Clone
I was going to ask this on the repository but SO seemed like a more fitting place to ask this.
I was able to use BFG Repo Cleaner (great tool, thank you!) to reduce our `.git` folder size by over 1GB, which is a smashing success as far as our repository is concerned. I ... | ### Preface
Before we get into this, let me clarify the recommended process for cleaning Git history in the context of an active *team* of developers (no matter what technology used for the cleaning - whether *BFG Repo-Cleaner* or `git filter-branch`):
1. Practice doing the clean a few times on a local disposable cop... |
30325758 | Git: Conversion of a Subdirectory to a Submodule | 11 | 2015-05-19 12:34:15 | <p>I have successfully been able to convert Submodules to Subdirectories using commands such as the methods outlined in these two examples:</p>
<p><a href="http://x3ro.de/2013/09/01/Integrating-a-submodule-into-the-parent-repository.html" rel="noreferrer">Submodule->Subdir</a></p>
<p><a href="https://stackoverflow.c... | 3,419 | 4,911,784 | 2016-03-11 10:26:04 | 35,937,708 | 23 | 2016-03-11 10:26:04 | 282,601 | 2016-03-11 10:26:04 | https://stackoverflow.com/q/30325758 | https://stackoverflow.com/a/35937708 | <p>For me it worked after adding a trailing slash to the directory:</p>
<pre><code>$ git filter-branch --subdirectory-filter htdocs/typo3_src -- --all
Rewrite cbe03e13da071403a2632263f1760b560398cdd3 (1/12) (0 seconds passed, remaining 0 predicted) 004b20fc15023539484c7f5990b99780f54dc0ac
fatal: failed to unpack tr... | <p>For me it worked after adding a trailing slash to the directory:</p> <pre><code>$ git filter-branch --subdirectory-filter htdocs/typo3_src -- --all Rewrite cbe03e13da071403a2632263f1760b560398cdd3 (1/12) (0 seconds passed, remaining 0 predicted) 004b20fc15023539484c7f5990b99780f54dc0ac fatal: failed to unpack tr... | 119, 41612 | git, git-submodules | <h1>Git: Conversion of a Subdirectory to a Submodule</h1>
<p>I have successfully been able to convert Submodules to Subdirectories using commands such as the methods outlined in these two examples:</p>
<p><a href="http://x3ro.de/2013/09/01/Integrating-a-submodule-into-the-parent-repository.html" rel="noreferrer">Submod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,048 | git | # Git: Conversion of a Subdirectory to a Submodule
I have successfully been able to convert Submodules to Subdirectories using commands such as the methods outlined in these two examples:
[Submodule->Subdir](http://x3ro.de/2013/09/01/Integrating-a-submodule-into-the-parent-repository.html)
[Subdir->Submodule](https:... | For me it worked after adding a trailing slash to the directory:
```
$ git filter-branch --subdirectory-filter htdocs/typo3_src -- --all
Rewrite cbe03e13da071403a2632263f1760b560398cdd3 (1/12) (0 seconds passed, remaining 0 predicted) 004b20fc15023539484c7f5990b99780f54dc0ac
fatal: failed to unpack tree object cbe0... |
32000525 | git not adding existing folder | 11 | 2015-08-14 00:24:45 | <p>I started working on a project recently, then decided to push it up to github. So I did the following:</p>
<pre><code>cd <root>
git init
git add -A
git commit -m 'message'
git remote add origin <ur>
git push -u origin master
</code></pre>
<p>this, however, omitted an entire folder of my project. its ba... | 39,993 | 2,939,522 | 2024-02-09 07:17:50 | 32,000,546 | 23 | 2015-08-14 00:27:21 | 28,804 | 2015-08-14 00:27:21 | https://stackoverflow.com/q/32000525 | https://stackoverflow.com/a/32000546 | <p>Are there files in the folder? Git doesn't track folders, only files; you can't add an empty folder to a Git repo. However, you can put an empty file in that folder (<code>.gitignore</code> or <code>.blank</code> are common file names) and add those files to the folder.</p>
| <p>Are there files in the folder? Git doesn't track folders, only files; you can't add an empty folder to a Git repo. However, you can put an empty file in that folder (<code>.gitignore</code> or <code>.blank</code> are common file names) and add those files to the folder.</p> | 119 | git | <h1>git not adding existing folder</h1>
<p>I started working on a project recently, then decided to push it up to github. So I did the following:</p>
<pre><code>cd <root>
git init
git add -A
git commit -m 'message'
git remote add origin <ur>
git push -u origin master
</code></pre>
<p>this, however, omitte... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,049 | git | # git not adding existing folder
I started working on a project recently, then decided to push it up to github. So I did the following:
```
cd <root>
git init
git add -A
git commit -m 'message'
git remote add origin <ur>
git push -u origin master
```
this, however, omitted an entire folder of my project. its basical... | Are there files in the folder? Git doesn't track folders, only files; you can't add an empty folder to a Git repo. However, you can put an empty file in that folder (`.gitignore` or `.blank` are common file names) and add those files to the folder. |
18480174 | Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory' | 11 | 2013-08-28 05:41:34 | <p>Git pull command is working fine, but git stash is giving the following error:</p>
<pre><code>$git stash
error: unable to resolve reference refs/stash: No such file or directory
fatal: Cannot lock the ref 'refs/stash'.
Cannot save the current status
</code></pre>
<p>How do i resolve this so that i don't loose my c... | 15,634 | 1,765,505 | 2024-02-14 15:33:08 | 19,409,320 | 23 | 2013-10-16 16:59:08 | 1,472,496 | 2020-11-19 23:20:17 | https://stackoverflow.com/q/18480174 | https://stackoverflow.com/a/19409320 | <p>I was having a very similar issue, after a corrupted filesystem.</p>
<p>The solution was to remove the file or directory at .git/logs/refs/stash</p>
<p>After deleting the file or directory, please use git stash to create a new ref, and that's all.</p>
<p>This will delete any stash you might have, so please be carefu... | <p>I was having a very similar issue, after a corrupted filesystem.</p> <p>The solution was to remove the file or directory at .git/logs/refs/stash</p> <p>After deleting the file or directory, please use git stash to create a new ref, and that's all.</p> <p>This will delete any stash you might have, so please be carefu... | 119, 13091 | git, git-stash | <h1>Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'</h1>
<p>Git pull command is working fine, but git stash is giving the following error:</p>
<pre><code>$git stash
error: unable to resolve reference refs/stash: No such file or directory
fatal: Cannot lock the ref 'refs/stash... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,050 | git | # Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'
Git pull command is working fine, but git stash is giving the following error:
```
$git stash
error: unable to resolve reference refs/stash: No such file or directory
fatal: Cannot lock the ref 'refs/stash'.
Cannot save the c... | I was having a very similar issue, after a corrupted filesystem.
The solution was to remove the file or directory at .git/logs/refs/stash
After deleting the file or directory, please use git stash to create a new ref, and that's all.
This will delete any stash you might have, so please be careful.
```
git stash
err... |
1705731 | How do I fix checking out HEAD^ in git | 11 | 2009-11-10 05:06:46 | <p>Okay so I made some changes in my project that resulted in a huge mess. I had already committed the changes so I could go back to it later, and then used git checkout HEAD^ to checkout the previous commit. Now as I'm making commits to my project it shows the SHA-1 on the command line as the working branch (instead o... | 3,732 | 162,877 | 2009-11-10 06:27:34 | 1,705,988 | 23 | 2009-11-10 06:27:34 | 193,688 | 2009-11-10 06:27:34 | https://stackoverflow.com/q/1705731 | https://stackoverflow.com/a/1705988 | <p><em>Now as I'm making commits to my project it shows the SHA-1 on the command line as the working branch (instead of master)</em></p>
<p>This probably means you have a “detached HEAD”. A detached HEAD points directly to a commit instead of pointing to a branch (which then points to a commit). A detached head is lik... | <p><em>Now as I'm making commits to my project it shows the SHA-1 on the command line as the working branch (instead of master)</em></p> <p>This probably means you have a “detached HEAD”. A detached HEAD points directly to a commit instead of pointing to a branch (which then points to a commit). A detached head is lik... | 119, 6452 | git, git-svn | <h1>How do I fix checking out HEAD^ in git</h1>
<p>Okay so I made some changes in my project that resulted in a huge mess. I had already committed the changes so I could go back to it later, and then used git checkout HEAD^ to checkout the previous commit. Now as I'm making commits to my project it shows the SHA-1 on t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,052 | git | # How do I fix checking out HEAD^ in git
Okay so I made some changes in my project that resulted in a huge mess. I had already committed the changes so I could go back to it later, and then used git checkout HEAD^ to checkout the previous commit. Now as I'm making commits to my project it shows the SHA-1 on the comman... | *Now as I'm making commits to my project it shows the SHA-1 on the command line as the working branch (instead of master)*
This probably means you have a “detached HEAD”. A detached HEAD points directly to a commit instead of pointing to a branch (which then points to a commit). A detached head is like an unnamed bran... |
47284367 | git delete pushed commit and remove history entry | 10 | 2017-11-14 11:15:24 | <p>I have pushed some changes to the repository.</p>
<p>I want to delete the last commit from the repository and permanently remove the history entry as well.</p>
<p>How can I do this?</p>
| 9,611 | 4,042,470 | 2018-01-31 14:10:54 | 47,284,645 | 23 | 2017-11-14 11:28:49 | 542,270 | 2017-11-14 11:28:49 | https://stackoverflow.com/q/47284367 | https://stackoverflow.com/a/47284645 | <p>Try:</p>
<pre><code>git checkout <branch> // replace branch with a name of the branch you worked on
git reset --hard HEAD~1 // this command removes the latest commit
git push --force-with-lease origin <branch> // push the changes to the remote
</code></pre>
<p>If nobody modified the remote while doing ... | <p>Try:</p> <pre><code>git checkout <branch> // replace branch with a name of the branch you worked on git reset --hard HEAD~1 // this command removes the latest commit git push --force-with-lease origin <branch> // push the changes to the remote </code></pre> <p>If nobody modified the remote while doing ... | 119, 5597 | commit, git | <h1>git delete pushed commit and remove history entry</h1>
<p>I have pushed some changes to the repository.</p>
<p>I want to delete the last commit from the repository and permanently remove the history entry as well.</p>
<p>How can I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,056 | git | # git delete pushed commit and remove history entry
I have pushed some changes to the repository.
I want to delete the last commit from the repository and permanently remove the history entry as well.
How can I do this? | Try:
```
git checkout <branch> // replace branch with a name of the branch you worked on
git reset --hard HEAD~1 // this command removes the latest commit
git push --force-with-lease origin <branch> // push the changes to the remote
```
If nobody modified the remote while doing the operation above your push will be a... |
24620108 | Show all ignored files in git | 10 | 2014-07-07 21:23:00 | <p>I'm having problems with <code>git ls-files --others --ignored --exclude-standard</code> not listing some ignored files. </p>
<p>My project has this directory structure</p>
<pre><code>.
├── aspnet
│ ├── .gitignore
│ ├── __init__.py
│ ├── lib
│ │ ├── <lots of big stuff>
</code></pre>
<p>The <code>a... | 20,653 | 119,592 | 2020-10-13 20:49:35 | 24,621,695 | 23 | 2014-07-07 23:49:47 | 171,318 | 2018-02-07 12:40:28 | https://stackoverflow.com/q/24620108 | https://stackoverflow.com/a/24621695 | <p>Having <code>find</code> (likely on UNIX/Linux), you can issue the following command in the root folder of your git repository:</p>
<pre><code>find . -type f | git check-ignore --stdin
</code></pre>
<p><code>find . -type f</code> will list all files in the folder recursively, while <code>git check-ignore</code> w... | <p>Having <code>find</code> (likely on UNIX/Linux), you can issue the following command in the root folder of your git repository:</p> <pre><code>find . -type f | git check-ignore --stdin </code></pre> <p><code>find . -type f</code> will list all files in the folder recursively, while <code>git check-ignore</code> w... | 119, 25056 | git, gitignore | <h1>Show all ignored files in git</h1>
<p>I'm having problems with <code>git ls-files --others --ignored --exclude-standard</code> not listing some ignored files. </p>
<p>My project has this directory structure</p>
<pre><code>.
├── aspnet
│ ├── .gitignore
│ ├── __init__.py
│ ├── lib
│ │ ├── <lots of big ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,057 | git | # Show all ignored files in git
I'm having problems with `git ls-files --others --ignored --exclude-standard` not listing some ignored files.
My project has this directory structure
```
.
├── aspnet
│ ├── .gitignore
│ ├── __init__.py
│ ├── lib
│ │ ├── <lots of big stuff>
```
The `aspnet/.gitignore` lists ... | Having `find` (likely on UNIX/Linux), you can issue the following command in the root folder of your git repository:
```
find . -type f | git check-ignore --stdin
```
`find . -type f` will list all files in the folder recursively, while `git check-ignore` will list those files from the list, which are effectively ig... |
10604074 | python isdigit() function return true for non digit character u'\u2466' | 10 | 2012-05-15 15:32:38 | <p>I come across a strange problem dealing with python isdigit function.</p>
<p>For example:</p>
<pre><code>>>> a = u'\u2466'
>>> a.isdigit()
Out[1]: True
>>> a.isnumeric()
Out[2]: True
</code></pre>
<p>Why this character is a digit?</p>
<p>Any way to make this return False instead, thank... | 26,430 | 543,492 | 2012-05-15 15:48:15 | 10,604,095 | 23 | 2012-05-15 15:33:56 | 367,273 | 2012-05-15 15:39:25 | https://stackoverflow.com/q/10604074 | https://stackoverflow.com/a/10604095 | <p>U+2466 is the <a href="http://www.fileformat.info/info/unicode/char/2466/index.htm">CIRCLED DIGIT SEVEN</a> (⑦), so yes, it's a digit.</p>
<p>If your definition of what is a digit differs from that of the <a href="http://unicode.org/">Unicode Consortium</a>, you might have to write your own <code>isdigit()</code> m... | <p>U+2466 is the <a href="http://www.fileformat.info/info/unicode/char/2466/index.htm">CIRCLED DIGIT SEVEN</a> (⑦), so yes, it's a digit.</p> <p>If your definition of what is a digit differs from that of the <a href="http://unicode.org/">Unicode Consortium</a>, you might have to write your own <code>isdigit()</code> m... | 16, 279, 48894 | digit, python, unicode | <h1>python isdigit() function return true for non digit character u'\u2466'</h1>
<p>I come across a strange problem dealing with python isdigit function.</p>
<p>For example:</p>
<pre><code>>>> a = u'\u2466'
>>> a.isdigit()
Out[1]: True
>>> a.isnumeric()
Out[2]: True
</code></pre>
<p>Why th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,059 | git | # python isdigit() function return true for non digit character u'\u2466'
I come across a strange problem dealing with python isdigit function.
For example:
```
>>> a = u'\u2466'
>>> a.isdigit()
Out[1]: True
>>> a.isnumeric()
Out[2]: True
```
Why this character is a digit?
Any way to make this return False instead... | U+2466 is the [CIRCLED DIGIT SEVEN](http://www.fileformat.info/info/unicode/char/2466/index.htm) (⑦), so yes, it's a digit.
If your definition of what is a digit differs from that of the [Unicode Consortium](http://unicode.org/), you might have to write your own `isdigit()` method.
> Edit, If I don't want to treat it... |
7062192 | About Git's merge and rebase | 10 | 2011-08-15 06:23:27 | <p><img src="https://i.sstatic.net/zJ11M.jpg" alt="enter image description here" /></p>
<p><img src="https://i.sstatic.net/UR6rB.jpg" alt="enter image description here" /></p>
<p><img src="https://i.sstatic.net/NToRw.jpg" alt="enter image description here" /></p>
<p>The above is the result of merge and rebase.</p>
<p>M... | 4,942 | 851,277 | 2012-03-04 03:32:49 | 7,062,773 | 23 | 2011-08-15 08:02:36 | 6,309 | 2012-03-04 03:32:49 | https://stackoverflow.com/q/7062192 | https://stackoverflow.com/a/7062773 | <p>The example isn't very good, because it only consider <em>one</em> commit (merged or rebased), giving you the impression that the resulting commits are similar. In general, a rebase will add multiple commits, while a merge will add at most one (fast-forward merges add none).</p>
<p>Moreover, as long as there is <em... | <p>The example isn't very good, because it only consider <em>one</em> commit (merged or rebased), giving you the impression that the resulting commits are similar. In general, a rebase will add multiple commits, while a merge will add at most one (fast-forward merges add none).</p> <p>Moreover, as long as there is <em... | 119 | git | <h1>About Git's merge and rebase</h1>
<p><img src="https://i.sstatic.net/zJ11M.jpg" alt="enter image description here" /></p>
<p><img src="https://i.sstatic.net/UR6rB.jpg" alt="enter image description here" /></p>
<p><img src="https://i.sstatic.net/NToRw.jpg" alt="enter image description here" /></p>
<p>The above is th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,061 | git | # About Git's merge and rebase



The above is the result of merge and rebase.
My question is that in the final state ,are ... | The example isn't very good, because it only consider *one* commit (merged or rebased), giving you the impression that the resulting commits are similar. In general, a rebase will add multiple commits, while a merge will add at most one (fast-forward merges add none).
Moreover, as long as there is *no conflict to solv... |
6257539 | Do a Git pull to overwrite local changes | 9 | 2011-06-06 20:18:52 | <p>There has certainly been posts around for this, but I actually did a commit because I thought it was the right thing to do.</p>
<p>So, I have two repositories, one development and one production. I had to edit something in the production because it was an urgent bugfix, and now I have three files that are newer in ... | 25,582 | 786,463 | 2018-04-26 22:22:29 | 6,257,598 | 23 | 2011-06-06 20:25:09 | 719,673 | 2018-04-26 22:19:57 | https://stackoverflow.com/q/6257539 | https://stackoverflow.com/a/6257598 | <p>If you want to entirely replace your local branch foo with the contents of the remote branch origin/foo:</p>
<pre><code>git fetch origin
git checkout foo
git reset --hard origin/foo
</code></pre>
<p>If you want to do something else, please reword your question. However, I might add the production Git repository as... | <p>If you want to entirely replace your local branch foo with the contents of the remote branch origin/foo:</p> <pre><code>git fetch origin git checkout foo git reset --hard origin/foo </code></pre> <p>If you want to do something else, please reword your question. However, I might add the production Git repository as... | 81, 119, 4860, 5597, 28896 | commit, git, git-pull, pull, versioning | <h1>Do a Git pull to overwrite local changes</h1>
<p>There has certainly been posts around for this, but I actually did a commit because I thought it was the right thing to do.</p>
<p>So, I have two repositories, one development and one production. I had to edit something in the production because it was an urgent bug... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,067 | git | # Do a Git pull to overwrite local changes
There has certainly been posts around for this, but I actually did a commit because I thought it was the right thing to do.
So, I have two repositories, one development and one production. I had to edit something in the production because it was an urgent bugfix, and now I h... | If you want to entirely replace your local branch foo with the contents of the remote branch origin/foo:
```
git fetch origin
git checkout foo
git reset --hard origin/foo
```
If you want to do something else, please reword your question. However, I might add the production Git repository as a remote and then merge th... |
59328900 | How to globally ignore the .idea/ folder in git (not just adding it to .gitignore) | 8 | 2019-12-13 19:45:31 | <p>O., I am wondering if there is a way to globally ignore the .idea folder on my machine? I don't have or need a .gitignore file in my project, but it is irritating that the .idea/ folder keeps appearing when trying to add and commit real changes.</p>
<p>Any idea? </p>
| 6,641 | 10,152,171 | 2019-12-13 19:59:47 | 59,329,075 | 23 | 2019-12-13 19:59:47 | 6,827,582 | 2019-12-13 19:59:47 | https://stackoverflow.com/q/59328900 | https://stackoverflow.com/a/59329075 | <ul>
<li>Configure the path to the global .gitignore in the .gitconfig file which usually resides in your home directory:</li>
</ul>
<pre><code># add this to ~/.gitconfig:
[core]
excludesfile = ~/.gitignore
</code></pre>
<ul>
<li>And create the .gitignore file in your home directory:</li>
</ul>
<pre><code># crea... | <ul> <li>Configure the path to the global .gitignore in the .gitconfig file which usually resides in your home directory:</li> </ul> <pre><code># add this to ~/.gitconfig: [core] excludesfile = ~/.gitignore </code></pre> <ul> <li>And create the .gitignore file in your home directory:</li> </ul> <pre><code># crea... | 64, 119, 3881 | git, global, windows | <h1>How to globally ignore the .idea/ folder in git (not just adding it to .gitignore)</h1>
<p>O., I am wondering if there is a way to globally ignore the .idea folder on my machine? I don't have or need a .gitignore file in my project, but it is irritating that the .idea/ folder keeps appearing when trying to add and ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,068 | git | # How to globally ignore the .idea/ folder in git (not just adding it to .gitignore)
O., I am wondering if there is a way to globally ignore the .idea folder on my machine? I don't have or need a .gitignore file in my project, but it is irritating that the .idea/ folder keeps appearing when trying to add and commit re... | - Configure the path to the global .gitignore in the .gitconfig file which usually resides in your home directory:
```
# add this to ~/.gitconfig:
[core]
excludesfile = ~/.gitignore
```
- And create the .gitignore file in your home directory:
```
# create ~/.gitignore
.idea
```
.idea will be ignored in any git... |
52445475 | git pull with access token, git push with username / password | 8 | 2018-09-21 14:05:59 | <p>I've got a problem with git push. Here are many threads regarding this issue, but none of them fit to my problem. </p>
<p>The company I work for, has it's own gitlab. Policy is only https, no ssh is allowed. For cloning and pulling, an access token is required. Pushing only with username/password. Don't ask me abou... | 74,385 | 7,648,722 | 2018-09-21 18:52:27 | 52,449,584 | 23 | 2018-09-21 18:52:27 | 1,256,452 | 2018-09-21 18:52:27 | https://stackoverflow.com/q/52445475 | https://stackoverflow.com/a/52449584 | <p>You already know that every remote stores a URL: <code>origin</code> literally <em>means</em> <code>https://<username>:<AccessToken>@<domain>/<owner>/<reponame>.git/</code>.</p>
<p>What you didn't know is that every remote actually stores <em>two</em> URLs. One is used for <code>git f... | <p>You already know that every remote stores a URL: <code>origin</code> literally <em>means</em> <code>https://<username>:<AccessToken>@<domain>/<owner>/<reponame>.git/</code>.</p> <p>What you didn't know is that every remote actually stores <em>two</em> URLs. One is used for <code>git f... | 58, 119, 11225 | command-line-interface, git, linux | <h1>git pull with access token, git push with username / password</h1>
<p>I've got a problem with git push. Here are many threads regarding this issue, but none of them fit to my problem. </p>
<p>The company I work for, has it's own gitlab. Policy is only https, no ssh is allowed. For cloning and pulling, an access to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,069 | git | # git pull with access token, git push with username / password
I've got a problem with git push. Here are many threads regarding this issue, but none of them fit to my problem.
The company I work for, has it's own gitlab. Policy is only https, no ssh is allowed. For cloning and pulling, an access token is required. ... | You already know that every remote stores a URL: `origin` literally *means* `https://<username>:<AccessToken>@<domain>/<owner>/<reponame>.git/`.
What you didn't know is that every remote actually stores *two* URLs. One is used for `git fetch`, and the second one is used for `push`. The second URL defaults to being the... |
31545902 | Unable to push to heroku after removing submodule | 8 | 2015-07-21 17:35:32 | <p>I removed a submodule from my code, when I try to push to heroku now, I get:</p>
<pre><code>remote: Git submodules detected, installing:
remote: No submodule mapping found in .gitmodules for path 'submodule/path'
remote:
remote: ! Push rejected, submodule install failed
remote:
</code></pre>
<p>I am using Heroku's... | 1,602 | 973,292 | 2016-07-08 17:58:44 | 31,545,903 | 23 | 2015-07-21 17:35:32 | 973,292 | 2016-07-08 17:58:44 | https://stackoverflow.com/q/31545902 | https://stackoverflow.com/a/31545903 | <p>You can use the <a href="https://github.com/heroku/heroku-repo" rel="noreferrer">heroku-repo</a> plugin to reset the repo for the app:</p>
<pre><code>$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:reset -a APP
</code></pre>
<p>And then you can deploy again:</p>
<pre><code>$ git p... | <p>You can use the <a href="https://github.com/heroku/heroku-repo" rel="noreferrer">heroku-repo</a> plugin to reset the repo for the app:</p> <pre><code>$ heroku plugins:install https://github.com/heroku/heroku-repo.git $ heroku repo:reset -a APP </code></pre> <p>And then you can deploy again:</p> <pre><code>$ git p... | 119, 8279, 41612 | git, git-submodules, heroku | <h1>Unable to push to heroku after removing submodule</h1>
<p>I removed a submodule from my code, when I try to push to heroku now, I get:</p>
<pre><code>remote: Git submodules detected, installing:
remote: No submodule mapping found in .gitmodules for path 'submodule/path'
remote:
remote: ! Push rejected, submodule i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,071 | git | # Unable to push to heroku after removing submodule
I removed a submodule from my code, when I try to push to heroku now, I get:
```
remote: Git submodules detected, installing:
remote: No submodule mapping found in .gitmodules for path 'submodule/path'
remote:
remote: ! Push rejected, submodule install failed
remote... | You can use the [heroku-repo](https://github.com/heroku/heroku-repo) plugin to reset the repo for the app:
```
$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:reset -a APP
```
And then you can deploy again:
```
$ git push ....
``` |
5093533 | git ignores $GIT_AUTHOR_DATE -- is this a bug? | 7 | 2011-02-23 16:12:34 | <blockquote>
<p><strong>EDIT</strong>: <em>Summary</em>: Git does not allow dates before 1973/03/03 09:46:40 (epoch+100000000s) given in its "internal date format" (seconds since the epoch). This is to allow "20110224" as short form of "2011-02-24". -- <em>This Is no bug</em>: Not really, but it is not documented as ... | 1,465 | 594,769 | 2011-02-24 09:27:42 | 5,093,714 | 23 | 2011-02-23 16:26:14 | 152,948 | 2011-02-23 20:54:44 | https://stackoverflow.com/q/5093533 | https://stackoverflow.com/a/5093714 | <p>Found in the git date parser code:</p>
<pre><code>/*
* Seconds since 1970? We trigger on that for any numbers with
* more than 8 digits. This is because we don't want to rule out
* numbers like 20070606 as a YYYYMMDD date.
*/
if (num >= 100000000 && nodate(tm)) {
</code></pre>
<p>Since that code exp... | <p>Found in the git date parser code:</p> <pre><code>/* * Seconds since 1970? We trigger on that for any numbers with * more than 8 digits. This is because we don't want to rule out * numbers like 20070606 as a YYYYMMDD date. */ if (num >= 100000000 && nodate(tm)) { </code></pre> <p>Since that code exp... | 119, 46509 | git, git-filter-branch | <h1>git ignores $GIT_AUTHOR_DATE -- is this a bug?</h1>
<blockquote>
<p><strong>EDIT</strong>: <em>Summary</em>: Git does not allow dates before 1973/03/03 09:46:40 (epoch+100000000s) given in its "internal date format" (seconds since the epoch). This is to allow "20110224" as short form of "2011-02-24". -- <em>This ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,074 | git | # git ignores $GIT_AUTHOR_DATE -- is this a bug?
> **EDIT**: *Summary*: Git does not allow dates before 1973/03/03 09:46:40 (epoch+100000000s) given in its "internal date format" (seconds since the epoch). This is to allow "20110224" as short form of "2011-02-24". -- *This Is no bug*: Not really, but it is not documen... | Found in the git date parser code:
```
/*
* Seconds since 1970? We trigger on that for any numbers with
* more than 8 digits. This is because we don't want to rule out
* numbers like 20070606 as a YYYYMMDD date.
*/
if (num >= 100000000 && nodate(tm)) {
```
Since that code explicitly rejects small numbers as possi... |
5762216 | Is there a way to do a "git commit --amend" that automatically uses the old commit message instead of prompting us to edit the old one? | 6 | 2011-04-23 04:39:46 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5307417/can-i-skip-the-commit-message-step-when-i-run-git-commit-amend">Can I skip the commit message step when I run git commit --amend?</a> </p>
</blockquote>
<p>Is there a way to do a <code>git commit --amen... | 2,370 | 130,758 | 2011-04-23 04:53:32 | 5,762,260 | 23 | 2011-04-23 04:53:32 | 69,755 | 2011-04-23 04:53:32 | https://stackoverflow.com/q/5762216 | https://stackoverflow.com/a/5762260 | <p>Sure:</p>
<pre><code>git commit --amend -C HEAD
</code></pre>
| <p>Sure:</p> <pre><code>git commit --amend -C HEAD </code></pre> | 119, 456 | git, version-control | <h1>Is there a way to do a "git commit --amend" that automatically uses the old commit message instead of prompting us to edit the old one?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5307417/can-i-skip-the-commit-message-step-when-i-run-git-commit-amen... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,076 | git | # Is there a way to do a "git commit --amend" that automatically uses the old commit message instead of prompting us to edit the old one?
> **Possible Duplicate:**
> [Can I skip the commit message step when I run git commit --amend?](https://stackoverflow.com/questions/5307417/can-i-skip-the-commit-message-step-when... | Sure:
```
git commit --amend -C HEAD
``` |
2100907 | How can I remove/delete a large file from the commit history in the Git repository? | 1,170 | 2010-01-20 11:18:48 | <p>I accidentally dropped a DVD-rip into a website project, carelessly <code>git commit -a -m ...</code>, and, zap, the repository was bloated by 2.2 GB. Next time I made some edits, deleted the video file, and committed everything, but the compressed file was still there in the repository, in history.</p>
<p>I know I ... | 540,908 | 171,278 | 2025-03-22 12:29:58 | 74,592,032 | 22 | 2022-11-27 17:01:52 | 6,937,857 | 2023-11-24 21:19:02 | https://stackoverflow.com/q/2100907 | https://stackoverflow.com/a/74592032 | <h3>New answer that works in 2022</h3>
<p>Do not use:</p>
<pre><code>git filter-branch
</code></pre>
<p>This command might not change the remote repository after pushing. If you clone after using it, you will see that nothing has changed and the repository still has a large size. It seems this command is old now. For e... | <h3>New answer that works in 2022</h3> <p>Do not use:</p> <pre><code>git filter-branch </code></pre> <p>This command might not change the remote repository after pushing. If you clone after using it, you will see that nothing has changed and the repository still has a large size. It seems this command is old now. For e... | 119, 456, 29934, 91259 | git, git-rebase, git-rewrite-history, version-control | <h1>How can I remove/delete a large file from the commit history in the Git repository?</h1>
<p>I accidentally dropped a DVD-rip into a website project, carelessly <code>git commit -a -m ...</code>, and, zap, the repository was bloated by 2.2 GB. Next time I made some edits, deleted the video file, and committed everyt... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,077 | git | # How can I remove/delete a large file from the commit history in the Git repository?
I accidentally dropped a DVD-rip into a website project, carelessly `git commit -a -m ...`, and, zap, the repository was bloated by 2.2 GB. Next time I made some edits, deleted the video file, and committed everything, but the compre... | ### New answer that works in 2022
Do not use:
```
git filter-branch
```
This command might not change the remote repository after pushing. If you clone after using it, you will see that nothing has changed and the repository still has a large size. It seems this command is old now. For example, if you use the steps ... |
4515644 | Git checkout does not change anything | 70 | 2010-12-23 03:30:26 | <p>I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working.</p>
<p>Basically, my workflow is like this:</p>
<ol>
<li>Checkout stable version to ... | 96,952 | 447,934 | 2021-09-22 10:03:32 | 4,515,728 | 22 | 2010-12-23 03:51:07 | 547,023 | 2010-12-23 03:51:07 | https://stackoverflow.com/q/4515644 | https://stackoverflow.com/a/4515728 | <p>Here is an example of how to use git and branches.</p>
<pre><code>$ git branch
* master
organize
$ git branch networking
$ git checkout networking
$ git branch
master
* networking
organize
</code></pre>
<p>Now Master has been updated many times since anyone has done anything on networking</p>
<pre><code>$... | <p>Here is an example of how to use git and branches.</p> <pre><code>$ git branch * master organize $ git branch networking $ git checkout networking $ git branch master * networking organize </code></pre> <p>Now Master has been updated many times since anyone has done anything on networking</p> <pre><code>$... | 119, 37230, 76220 | git, git-branch, git-checkout | <h1>Git checkout does not change anything</h1>
<p>I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working.</p>
<p>Basically, my workflow is like ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,080 | git | # Git checkout does not change anything
I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working.
Basically, my workflow is like this:
1. Checkout ... | Here is an example of how to use git and branches.
```
$ git branch
* master
organize
$ git branch networking
$ git checkout networking
$ git branch
master
* networking
organize
```
Now Master has been updated many times since anyone has done anything on networking
```
$ git pull origin networking
From githu... |
9207260 | Merge conflict resolution | 60 | 2012-02-09 08:02:55 | <p>When there's a merge conflict in Git, junk like the following is inserted into the conflicting files. Three questions:</p>
<ol>
<li>How do you read these annotations?</li>
<li>What are some strategies to use when fixing these merge conflicts?</li>
<li>Is there a GUI tool for Mac that knows how to read these files a... | 31,150 | 101,869 | 2018-05-22 12:08:46 | 14,045,135 | 22 | 2012-12-26 19:19:01 | 101,869 | 2012-12-26 19:19:01 | https://stackoverflow.com/q/9207260 | https://stackoverflow.com/a/14045135 | <p>There's now a better solution than trying to read the gibberish markers that Git inserts into your files. <a href="http://www.kaleidoscopeapp.com/beta" rel="noreferrer">Kaleidoscope 2</a>, Black Pixel's second release of their diff tool, is now also a merge tool. It's not free, but it works beautifully.</p>
<p>Afte... | <p>There's now a better solution than trying to read the gibberish markers that Git inserts into your files. <a href="http://www.kaleidoscopeapp.com/beta" rel="noreferrer">Kaleidoscope 2</a>, Black Pixel's second release of their diff tool, is now also a merge tool. It's not free, but it works beautifully.</p> <p>Afte... | 119, 865, 62599 | git, merge-conflict-resolution, user-interface | <h1>Merge conflict resolution</h1>
<p>When there's a merge conflict in Git, junk like the following is inserted into the conflicting files. Three questions:</p>
<ol>
<li>How do you read these annotations?</li>
<li>What are some strategies to use when fixing these merge conflicts?</li>
<li>Is there a GUI tool for Mac t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,082 | git | # Merge conflict resolution
When there's a merge conflict in Git, junk like the following is inserted into the conflicting files. Three questions:
1. How do you read these annotations?
2. What are some strategies to use when fixing these merge conflicts?
3. Is there a GUI tool for Mac that knows how to read these fil... | There's now a better solution than trying to read the gibberish markers that Git inserts into your files. [Kaleidoscope 2](http://www.kaleidoscopeapp.com/beta), Black Pixel's second release of their diff tool, is now also a merge tool. It's not free, but it works beautifully.
After you install Kaleidoscope 2, it's rea... |
18891794 | Git pull all branches from a remote repository | 55 | 2013-09-19 10:05:23 | <p>How do I pull all of the remote branches to my own repository?</p>
<p>If I type:</p>
<pre class="lang-none prettyprint-override"><code>git branch -a
</code></pre>
<p>I get a long list of branches, but if I type:</p>
<pre class="lang-none prettyprint-override"><code>git branch
</code></pre>
<p>I see only two of them.... | 90,205 | 2,028,547 | 2024-10-17 12:18:50 | 18,911,322 | 22 | 2013-09-20 07:36:48 | 6,309 | 2014-09-04 12:17:29 | https://stackoverflow.com/q/18891794 | https://stackoverflow.com/a/18911322 | <p>The command I usually use to make all visible <a href="https://stackoverflow.com/a/2749166/6309">upstream</a> branches, and <a href="https://stackoverflow.com/a/6244487/6309">tracking them</a> is detailed in "<a href="https://stackoverflow.com/a/6300386/6309">Track all remote git branches as local branches</a>":</p>... | <p>The command I usually use to make all visible <a href="https://stackoverflow.com/a/2749166/6309">upstream</a> branches, and <a href="https://stackoverflow.com/a/6244487/6309">tracking them</a> is detailed in "<a href="https://stackoverflow.com/a/6300386/6309">Track all remote git branches as local branches</a>":</p>... | 119, 456, 31678, 76220 | git, git-branch, remote-branch, version-control | <h1>Git pull all branches from a remote repository</h1>
<p>How do I pull all of the remote branches to my own repository?</p>
<p>If I type:</p>
<pre class="lang-none prettyprint-override"><code>git branch -a
</code></pre>
<p>I get a long list of branches, but if I type:</p>
<pre class="lang-none prettyprint-override"><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,085 | git | # Git pull all branches from a remote repository
How do I pull all of the remote branches to my own repository?
If I type:
```
git branch -a
```
I get a long list of branches, but if I type:
```
git branch
```
I see only two of them.
How do I pull ***all*** branches into my local list?
I know I can do:
```
git... | The command I usually use to make all visible [upstream](https://stackoverflow.com/a/2749166/6309) branches, and [tracking them](https://stackoverflow.com/a/6244487/6309) is detailed in "[Track all remote git branches as local branches](https://stackoverflow.com/a/6300386/6309)":
```
remote=origin ; for brname in `git... |
14243397 | What are git's merge strategies? | 55 | 2013-01-09 17:53:01 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies">When would you use the different git merge strategies?</a> </p>
</blockquote>
<p>When git merges files I'm working on, I see:</p>
<pre><code>Merge ... | 39,401 | 732,539 | 2013-01-09 17:55:12 | 14,243,441 | 22 | 2013-01-09 17:55:12 | 361,319 | 2013-01-09 17:55:12 | https://stackoverflow.com/q/14243397 | https://stackoverflow.com/a/14243441 | <p>From <code>git help merge</code>:</p>
<pre><code> The merge mechanism (git-merge and git-pull commands) allows the
backend merge strategies to be chosen with -s option. Some strategies
can also take their own options, which can be passed by giving
-X<option> arguments to git-merge and/or git-pull.
... | <p>From <code>git help merge</code>:</p> <pre><code> The merge mechanism (git-merge and git-pull commands) allows the backend merge strategies to be chosen with -s option. Some strategies can also take their own options, which can be passed by giving -X<option> arguments to git-merge and/or git-pull. ... | 119 | git | <h1>What are git's merge strategies?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies">When would you use the different git merge strategies?</a> </p>
</blockquote>
<p>When git merges files I'm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,086 | git | # What are git's merge strategies?
> **Possible Duplicate:**
> [When would you use the different git merge strategies?](https://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies)
When git merges files I'm working on, I see:
```
Merge made by the 'recursive' strategy
```
What... | From `git help merge`:
```
The merge mechanism (git-merge and git-pull commands) allows the
backend merge strategies to be chosen with -s option. Some strategies
can also take their own options, which can be passed by giving
-X<option> arguments to git-merge and/or git-pull.
resolve
This can onl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.