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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
55501998 | Git how to use `set-url` of remote repository | 20 | 2019-04-03 18:31:48 | <p>I need to change the url for an remote repository, so I was looking at the docs at <a href="https://git-scm.com/docs/git-remote" rel="noreferrer">https://git-scm.com/docs/git-remote</a> but when I do:</p>
<pre><code>git remote set-url git@github.com:gitusername/repository.git
</code></pre>
<p>I get the message <code... | 42,869 | 3,955,607 | 2023-07-07 18:06:53 | 55,502,111 | 25 | 2019-04-03 18:38:36 | 283,078 | 2023-07-07 18:06:53 | https://stackoverflow.com/q/55501998 | https://stackoverflow.com/a/55502111 | <p>The following command updates the URL for an existing remote, <code>origin</code>:</p>
<pre><code>git remote set-url origin git@github.com:user/repo.git
</code></pre>
<p>The command above updates both the fetch and push URLs.</p>
<p>Using <code>--push</code> will only update the push URL:</p>
<pre><code>git remote s... | <p>The following command updates the URL for an existing remote, <code>origin</code>:</p> <pre><code>git remote set-url origin git@github.com:user/repo.git </code></pre> <p>The command above updates both the fetch and push URLs.</p> <p>Using <code>--push</code> will only update the push URL:</p> <pre><code>git remote s... | 119 | git | <h1>Git how to use `set-url` of remote repository</h1>
<p>I need to change the url for an remote repository, so I was looking at the docs at <a href="https://git-scm.com/docs/git-remote" rel="noreferrer">https://git-scm.com/docs/git-remote</a> but when I do:</p>
<pre><code>git remote set-url git@github.com:gitusername/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,649 | git | # Git how to use `set-url` of remote repository
I need to change the url for an remote repository, so I was looking at the docs at <https://git-scm.com/docs/git-remote> but when I do:
```
git remote set-url git@github.com:gitusername/repository.git
```
I get the message `usage: git remote set-url [--push] <name> <ne... | The following command updates the URL for an existing remote, `origin`:
```
git remote set-url origin git@github.com:user/repo.git
```
The command above updates both the fetch and push URLs.
Using `--push` will only update the push URL:
```
git remote set-url --push origin git@github.com:usertwo/repotwo.git
git rem... |
10213117 | Start tracking a file in Git without adding it to the index | 20 | 2012-04-18 15:48:55 | <p>Is it possible to start tracking files in git without adding them to the index? </p>
<p>I have new files which I'd like to survive a <code>git clean</code>, but will likely change before the next commit. Do I simply add them to the index now, and then add them again later just before the commit?</p>
| 14,585 | 512,652 | 2023-09-14 13:56:10 | 44,437,297 | 25 | 2017-06-08 13:37:53 | 5,670,873 | 2019-01-10 20:44:42 | https://stackoverflow.com/q/10213117 | https://stackoverflow.com/a/44437297 | <p>Seems like you're looking for <code>git add --intent-to-add</code> (or <code>git add -N</code>). From <a href="https://git-scm.com/docs/git-add#git-add--N" rel="noreferrer">the official <code>git add</code> documentation</a>:</p>
<blockquote>
<pre><code>-N
--intent-to-add
</code></pre>
<p>Record only the fact ... | <p>Seems like you're looking for <code>git add --intent-to-add</code> (or <code>git add -N</code>). From <a href="https://git-scm.com/docs/git-add#git-add--N" rel="noreferrer">the official <code>git add</code> documentation</a>:</p> <blockquote> <pre><code>-N --intent-to-add </code></pre> <p>Record only the fact ... | 119 | git | <h1>Start tracking a file in Git without adding it to the index</h1>
<p>Is it possible to start tracking files in git without adding them to the index? </p>
<p>I have new files which I'd like to survive a <code>git clean</code>, but will likely change before the next commit. Do I simply add them to the index now, and ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,650 | git | # Start tracking a file in Git without adding it to the index
Is it possible to start tracking files in git without adding them to the index?
I have new files which I'd like to survive a `git clean`, but will likely change before the next commit. Do I simply add them to the index now, and then add them again later ju... | Seems like you're looking for `git add --intent-to-add` (or `git add -N`). From [the official `git add` documentation](https://git-scm.com/docs/git-add#git-add--N):
> ```
> -N
> --intent-to-add
> ```
>
> Record only the fact that the path will be added later. An entry for the path is placed in the index with no conten... |
23734864 | How do I set the topic from the command line when I push a new commit to gerrit? | 20 | 2014-05-19 10:01:12 | <p>When uploading a git commit for code review on Gerrit (2.8), I would like to be able to set the topic field (e.g. g-tune-pme-reform here <a href="https://gerrit.gromacs.org/#/c/3453/3" rel="noreferrer">https://gerrit.gromacs.org/#/c/3453/3</a>). How can this be done from the command line? Can it be done in the origi... | 20,763 | 334,142 | 2014-05-19 10:31:53 | 23,735,321 | 25 | 2014-05-19 10:24:26 | 1,342,413 | 2014-05-19 10:31:53 | https://stackoverflow.com/q/23734864 | https://stackoverflow.com/a/23735321 | <p>yes, it is possible using the push command:</p>
<pre><code>git push origin HEAD:refs/for/master/<topic_name>
</code></pre>
| <p>yes, it is possible using the push command:</p> <pre><code>git push origin HEAD:refs/for/master/<topic_name> </code></pre> | 119, 52272 | gerrit, git | <h1>How do I set the topic from the command line when I push a new commit to gerrit?</h1>
<p>When uploading a git commit for code review on Gerrit (2.8), I would like to be able to set the topic field (e.g. g-tune-pme-reform here <a href="https://gerrit.gromacs.org/#/c/3453/3" rel="noreferrer">https://gerrit.gromacs.or... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,651 | git | # How do I set the topic from the command line when I push a new commit to gerrit?
When uploading a git commit for code review on Gerrit (2.8), I would like to be able to set the topic field (e.g. g-tune-pme-reform here <https://gerrit.gromacs.org/#/c/3453/3>). How can this be done from the command line? Can it be don... | yes, it is possible using the push command:
```
git push origin HEAD:refs/for/master/<topic_name>
``` |
16403725 | Finishing a feature branch with GIT Flow | 20 | 2013-05-06 17:13:52 | <p>From my understanding one of the advantages of creating feature branches is so that you can easily see where large groups of commits have been merged into the develop branch.</p>
<p>Upon finishing a feature branch the recommendation is to delete the feature branch since it is no longer needed for development. Once ... | 38,020 | 656,172 | 2013-05-07 01:49:00 | 16,403,826 | 25 | 2013-05-06 17:20:06 | 1,802,138 | 2013-05-07 01:49:00 | https://stackoverflow.com/q/16403725 | https://stackoverflow.com/a/16403826 | <blockquote>
<p>"Upon finishing a feature branch the recommendation is to delete the
feature branch since it is no longer needed for development."</p>
</blockquote>
<h2>Difference between "discarding" and "merging" the feature branch:</h2>
<p>"Finishing" is an ambiguous expression here. To make sure I fully cover... | <blockquote> <p>"Upon finishing a feature branch the recommendation is to delete the feature branch since it is no longer needed for development."</p> </blockquote> <h2>Difference between "discarding" and "merging" the feature branch:</h2> <p>"Finishing" is an ambiguous expression here. To make sure I fully cover... | 119, 456, 64339, 90056 | atlassian-sourcetree, git, git-flow, version-control | <h1>Finishing a feature branch with GIT Flow</h1>
<p>From my understanding one of the advantages of creating feature branches is so that you can easily see where large groups of commits have been merged into the develop branch.</p>
<p>Upon finishing a feature branch the recommendation is to delete the feature branch s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,652 | git | # Finishing a feature branch with GIT Flow
From my understanding one of the advantages of creating feature branches is so that you can easily see where large groups of commits have been merged into the develop branch.
Upon finishing a feature branch the recommendation is to delete the feature branch since it is no lo... | > "Upon finishing a feature branch the recommendation is to delete the
> feature branch since it is no longer needed for development."
## Difference between "discarding" and "merging" the feature branch:
"Finishing" is an ambiguous expression here. To make sure I fully cover your question, I believe you meant either ... |
14008113 | How to switch android version in local repo? | 20 | 2012-12-23 02:13:30 | <p>I have downloaded whole working tree with the following command:</p>
<pre><code>repo init -u https://android.googlesource.com/platform/manifest
repo sync -j8
</code></pre>
<p>After syncing successfully, I want to switch working tree to android 2.3.7.
You see I didn't specify branch with "-b" parameter when "repo i... | 13,387 | 964,220 | 2023-05-19 11:04:48 | 14,353,644 | 25 | 2013-01-16 07:56:02 | 1,734,130 | 2023-05-19 11:04:48 | https://stackoverflow.com/q/14008113 | https://stackoverflow.com/a/14353644 | <p>You cannot solve this problem using <code>repo forall</code>.</p>
<p>Lets assume for certainty that your current Android tree is clean - no local changes or commits, i.e. <code>repo status</code> shows nothing.</p>
<p>To properly switch Android version, all you need to change is branch for your manifest repository. ... | <p>You cannot solve this problem using <code>repo forall</code>.</p> <p>Lets assume for certainty that your current Android tree is clean - no local changes or commits, i.e. <code>repo status</code> shows nothing.</p> <p>To properly switch Android version, all you need to change is branch for your manifest repository. ... | 115, 119, 1386, 7330, 37230 | android, git, git-checkout, repository, tags | <h1>How to switch android version in local repo?</h1>
<p>I have downloaded whole working tree with the following command:</p>
<pre><code>repo init -u https://android.googlesource.com/platform/manifest
repo sync -j8
</code></pre>
<p>After syncing successfully, I want to switch working tree to android 2.3.7.
You see I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,653 | git | # How to switch android version in local repo?
I have downloaded whole working tree with the following command:
```
repo init -u https://android.googlesource.com/platform/manifest
repo sync -j8
```
After syncing successfully, I want to switch working tree to android 2.3.7.
You see I didn't specify branch with "-b" p... | You cannot solve this problem using `repo forall`.
Lets assume for certainty that your current Android tree is clean - no local changes or commits, i.e. `repo status` shows nothing.
To properly switch Android version, all you need to change is branch for your manifest repository. First determine the available branche... |
2303124 | Git merge -s theirs: Simply? | 20 | 2010-02-20 18:11:52 | <p>I have checked out the various questions on this. The first provides <a href="https://stackoverflow.com/questions/1910444/git-merge-s-theirs-needed-but-i-know-it-doesnt-exist">a huge question and answer</a> (relevant? not sure) and the second provides a <a href="https://stackoverflow.com/questions/173919/git-merge-s... | 21,398 | 8,047 | 2017-11-30 20:34:56 | 2,303,198 | 25 | 2010-02-20 18:37:04 | 6,309 | 2016-03-11 11:49:55 | https://stackoverflow.com/q/2303124 | https://stackoverflow.com/a/2303198 | <p>Yes, creating a third branch and doing a <code>merge -s ours</code> is one solution.</p>
<p>But You will find the all <a href="http://markmail.org/message/k5zrn5jkspp5dc4n" rel="noreferrer">"let's not advertised any "theirs" merging strategy" here</a>.</p>
<p>Between replacing your work with one other branch work,... | <p>Yes, creating a third branch and doing a <code>merge -s ours</code> is one solution.</p> <p>But You will find the all <a href="http://markmail.org/message/k5zrn5jkspp5dc4n" rel="noreferrer">"let's not advertised any "theirs" merging strategy" here</a>.</p> <p>Between replacing your work with one other branch work,... | 119, 717 | git, merge | <h1>Git merge -s theirs: Simply?</h1>
<p>I have checked out the various questions on this. The first provides <a href="https://stackoverflow.com/questions/1910444/git-merge-s-theirs-needed-but-i-know-it-doesnt-exist">a huge question and answer</a> (relevant? not sure) and the second provides a <a href="https://stackove... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,655 | git | # Git merge -s theirs: Simply?
I have checked out the various questions on this. The first provides [a huge question and answer](https://stackoverflow.com/questions/1910444/git-merge-s-theirs-needed-but-i-know-it-doesnt-exist) (relevant? not sure) and the second provides a [wrong answer as best answer.](https://stacko... | Yes, creating a third branch and doing a `merge -s ours` is one solution.
But You will find the all ["let's not advertised any "theirs" merging strategy" here](http://markmail.org/message/k5zrn5jkspp5dc4n).
Between replacing your work with one other branch work, or simply getting rid of the current work and replacing... |
55385900 | pip3 setup.py install_requires PEP 508 git URL for private repo | 19 | 2019-03-27 20:27:33 | <p>I am trying to run:</p>
<p><code>pip3 install -e .</code></p>
<p>in my Python project where I have the following <code>setup.py</code>:</p>
<pre><code>from setuptools import setup
setup(
name='mypackage',
install_requires=[
"anotherpackage@git+git@bitbucket.org:myorg/anotherpackage.git"
]
)
<... | 6,414 | 597,473 | 2019-03-28 09:20:23 | 55,393,849 | 25 | 2019-03-28 09:13:30 | 597,473 | 2019-03-28 09:13:30 | https://stackoverflow.com/q/55385900 | https://stackoverflow.com/a/55393849 | <p>After checking <code>pip</code> source code I found the correct syntax for private BitBucket repositories.</p>
<p>The general form for the packages with URLs is <code><package name>@<URI></code> and the URI must start with a <code><scheme>://</code>.</p>
<p>So I fixed it to:</p>
<p><code>another... | <p>After checking <code>pip</code> source code I found the correct syntax for private BitBucket repositories.</p> <p>The general form for the packages with URLs is <code><package name>@<URI></code> and the URI must start with a <code><scheme>://</code>.</p> <p>So I fixed it to:</p> <p><code>another... | 16, 119, 5119, 41044 | git, pip, python, setup.py | <h1>pip3 setup.py install_requires PEP 508 git URL for private repo</h1>
<p>I am trying to run:</p>
<p><code>pip3 install -e .</code></p>
<p>in my Python project where I have the following <code>setup.py</code>:</p>
<pre><code>from setuptools import setup
setup(
name='mypackage',
install_requires=[
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,656 | git | # pip3 setup.py install_requires PEP 508 git URL for private repo
I am trying to run:
`pip3 install -e .`
in my Python project where I have the following `setup.py`:
```
from setuptools import setup
setup(
name='mypackage',
install_requires=[
"anotherpackage@git+git@bitbucket.org:myorg/anotherpacka... | After checking `pip` source code I found the correct syntax for private BitBucket repositories.
The general form for the packages with URLs is `<package name>@<URI>` and the URI must start with a `<scheme>://`.
So I fixed it to:
`anotherpackage@git+ssh://git@bitbucket.org:myorg/anotherpackage.git`
and then I was ge... |
44077544 | Skip pre-commit hook in "npm version" command | 19 | 2017-05-19 19:19:03 | <p><code>npm version</code> commits the change to package.json and creates a tag. Is there a way to prevent commit hook from being executed while using this command?</p>
| 12,898 | 1,816,503 | 2021-08-04 20:15:33 | 46,187,267 | 25 | 2017-09-13 00:54:34 | 2,125,414 | 2019-03-11 21:22:19 | https://stackoverflow.com/q/44077544 | https://stackoverflow.com/a/46187267 | <p>Not sure why this functionality didn't exist in <code>npm</code> before, but I contributed it a little while ago, as I needed it myself. It shipped with <code>npm@5.4.0</code>. To use it, set the config option <code>commit-hooks = false</code> in your <code>.npmrc</code> and the underlying <code>git</code> call will... | <p>Not sure why this functionality didn't exist in <code>npm</code> before, but I contributed it a little while ago, as I needed it myself. It shipped with <code>npm@5.4.0</code>. To use it, set the config option <code>commit-hooks = false</code> in your <code>.npmrc</code> and the underlying <code>git</code> call will... | 3, 119, 25281, 61387 | git, javascript, npm, pre-commit-hook | <h1>Skip pre-commit hook in "npm version" command</h1>
<p><code>npm version</code> commits the change to package.json and creates a tag. Is there a way to prevent commit hook from being executed while using this command?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,657 | git | # Skip pre-commit hook in "npm version" command
`npm version` commits the change to package.json and creates a tag. Is there a way to prevent commit hook from being executed while using this command? | Not sure why this functionality didn't exist in `npm` before, but I contributed it a little while ago, as I needed it myself. It shipped with `npm@5.4.0`. To use it, set the config option `commit-hooks = false` in your `.npmrc` and the underlying `git` call will not run commit hooks when creating the version commit. If... |
41123313 | Git is not ignoring file mode changes (chmod), why? | 19 | 2016-12-13 14:16:54 | <p>Before start I should say I already looked <a href="https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes">this post</a> and <a href="https://stackoverflow.com/questions/39038062/git-is-not-ignoring-file-permission-changes">this one</a> as well but for some reason the solutions... | 13,656 | 719,427 | 2016-12-13 21:03:06 | 41,124,027 | 25 | 2016-12-13 14:52:16 | 761,202 | 2016-12-13 14:58:47 | https://stackoverflow.com/q/41123313 | https://stackoverflow.com/a/41124027 | <h2>Local config overrides global config settings</h2>
<p>The diff output in the question indicates that the <em>local</em> git config has <code>filemode</code> set to true. This is probably expected behavior since the default config created for a repo defines this:</p>
<pre><code>-> git init
Initialized empty Git r... | <h2>Local config overrides global config settings</h2> <p>The diff output in the question indicates that the <em>local</em> git config has <code>filemode</code> set to true. This is probably expected behavior since the default config created for a repo defines this:</p> <pre><code>-> git init Initialized empty Git r... | 119, 4333 | git, ignore | <h1>Git is not ignoring file mode changes (chmod), why?</h1>
<p>Before start I should say I already looked <a href="https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes">this post</a> and <a href="https://stackoverflow.com/questions/39038062/git-is-not-ignoring-file-permission-ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,659 | git | # Git is not ignoring file mode changes (chmod), why?
Before start I should say I already looked [this post](https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes) and [this one](https://stackoverflow.com/questions/39038062/git-is-not-ignoring-file-permission-changes) as well but... | ## Local config overrides global config settings
The diff output in the question indicates that the *local* git config has `filemode` set to true. This is probably expected behavior since the default config created for a repo defines this:
```
-> git init
Initialized empty Git repository in /tmp/foo/.git/
-> cat .git... |
30905086 | git - list of all changed but not deleted files in a commit | 19 | 2015-06-18 01:29:36 | <p>I am investigating git repositories. I want to get the list of changed files in each commit. </p>
<p>So, what I did is I visited each commit through the command</p>
<pre><code>git reset --hard <commitId>
</code></pre>
<p>Then, I used</p>
<pre><code>git show --pretty="format:" --name-only #{commitId}
</code... | 4,540 | 4,974,679 | 2022-06-15 21:19:12 | 30,905,255 | 25 | 2015-06-18 01:54:00 | 1,863,229 | 2015-06-18 02:12:41 | https://stackoverflow.com/q/30905086 | https://stackoverflow.com/a/30905255 | <p>Try using this command:</p>
<pre><code>git show --diff-filter=AM --pretty="format:" --name-only #{commitId}
</code></pre>
<p>It is what you mentioned in your original problem with a <code>--diff-filter</code> flag added to restrict to only files which were added (<code>A</code>) or modified (<code>M</code>). For ... | <p>Try using this command:</p> <pre><code>git show --diff-filter=AM --pretty="format:" --name-only #{commitId} </code></pre> <p>It is what you mentioned in your original problem with a <code>--diff-filter</code> flag added to restrict to only files which were added (<code>A</code>) or modified (<code>M</code>). For ... | 119 | git | <h1>git - list of all changed but not deleted files in a commit</h1>
<p>I am investigating git repositories. I want to get the list of changed files in each commit. </p>
<p>So, what I did is I visited each commit through the command</p>
<pre><code>git reset --hard <commitId>
</code></pre>
<p>Then, I used</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,660 | git | # git - list of all changed but not deleted files in a commit
I am investigating git repositories. I want to get the list of changed files in each commit.
So, what I did is I visited each commit through the command
```
git reset --hard <commitId>
```
Then, I used
```
git show --pretty="format:" --name-only #{commi... | Try using this command:
```
git show --diff-filter=AM --pretty="format:" --name-only #{commitId}
```
It is what you mentioned in your original problem with a `--diff-filter` flag added to restrict to only files which were added (`A`) or modified (`M`). For a complete list of the types of files to which you can restri... |
15162748 | With Git, how do I remove a local copy of a remote branch? Or at least pull without merging? | 19 | 2013-03-01 16:50:49 | <p>Another developer has deleted and rebuilt a remote branch called "development" which I already have a checked out copy. He did this delete and rebuild to remove some cruft from it. Which is great.</p>
<p>But when I do a "git pull origin development" it keeps getting merge conflicts. Yet I don't w... | 25,816 | 306,295 | 2024-11-01 15:00:50 | 15,163,168 | 25 | 2013-03-01 17:12:38 | 123,109 | 2024-07-05 22:37:30 | https://stackoverflow.com/q/15162748 | https://stackoverflow.com/a/15163168 | <p>Grab the most up-to-date changes from the origin remote. This step is the “pull without merge” step you asked for in your question. <code>git pull</code> is the equivalent of <code>git fetch</code> followed by <code>git merge</code>.</p>
<pre><code>git fetch origin
</code></pre>
<p>Get to a clean branch if necessary... | <p>Grab the most up-to-date changes from the origin remote. This step is the “pull without merge” step you asked for in your question. <code>git pull</code> is the equivalent of <code>git fetch</code> followed by <code>git merge</code>.</p> <pre><code>git fetch origin </code></pre> <p>Get to a clean branch if necessary... | 119, 1879, 53847, 76220 | branch, branching-and-merging, git, git-branch | <h1>With Git, how do I remove a local copy of a remote branch? Or at least pull without merging?</h1>
<p>Another developer has deleted and rebuilt a remote branch called "development" which I already have a checked out copy. He did this delete and rebuild to remove some cruft from it. Which is great.</p>
<p>B... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,661 | git | # With Git, how do I remove a local copy of a remote branch? Or at least pull without merging?
Another developer has deleted and rebuilt a remote branch called "development" which I already have a checked out copy. He did this delete and rebuild to remove some cruft from it. Which is great.
But when I do a "git pull ... | Grab the most up-to-date changes from the origin remote. This step is the “pull without merge” step you asked for in your question. `git pull` is the equivalent of `git fetch` followed by `git merge`.
```
git fetch origin
```
Get to a clean branch if necessary.
```
git stash
```
With a clean branch, switch to the d... |
7997700 | git aliases causing "Permission denied" error | 19 | 2011-11-03 15:40:51 | <p>The following commands</p>
<pre><code>$ git co -b newbranch
$ git co oldbranch
</code></pre>
<p>result in "fatal: cannot exec 'git-co': Permission denied" error.</p>
<p>In the same time,</p>
<pre><code>$ git checkout -b newbranch
$ git checkout oldbranch
</code></pre>
<p>and</p>
<pre><code>$ sudo git co -b new... | 16,946 | 743,717 | 2012-06-14 07:01:29 | 8,020,031 | 25 | 2011-11-05 11:59:24 | 743,717 | 2012-06-14 07:01:29 | https://stackoverflow.com/q/7997700 | https://stackoverflow.com/a/8020031 | <p>The correct answer to this was actually different. Before git runs the aliases it checks the <code>$PATH</code>. In case the directory does not exist, or lacks permissions, git produces the <code>"fatal: cannot exec 'git-co': Permission denied"</code>. It does not ever comes to check the aliases so <code>git foobar<... | <p>The correct answer to this was actually different. Before git runs the aliases it checks the <code>$PATH</code>. In case the directory does not exist, or lacks permissions, git produces the <code>"fatal: cannot exec 'git-co': Permission denied"</code>. It does not ever comes to check the aliases so <code>git foobar<... | 119 | git | <h1>git aliases causing "Permission denied" error</h1>
<p>The following commands</p>
<pre><code>$ git co -b newbranch
$ git co oldbranch
</code></pre>
<p>result in "fatal: cannot exec 'git-co': Permission denied" error.</p>
<p>In the same time,</p>
<pre><code>$ git checkout -b newbranch
$ git checkout oldbranch
</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,662 | git | # git aliases causing "Permission denied" error
The following commands
```
$ git co -b newbranch
$ git co oldbranch
```
result in "fatal: cannot exec 'git-co': Permission denied" error.
In the same time,
```
$ git checkout -b newbranch
$ git checkout oldbranch
```
and
```
$ sudo git co -b newbranch
$ sudo git co... | The correct answer to this was actually different. Before git runs the aliases it checks the `$PATH`. In case the directory does not exist, or lacks permissions, git produces the `"fatal: cannot exec 'git-co': Permission denied"`. It does not ever comes to check the aliases so `git foobar` will produce the same error.
... |
27295961 | Remove a single merged branch from master branch | 18 | 2014-12-04 14:00:52 | <p>In my master branch, there're following local branches that have been merged, but I would like to remove the <code>local_branch3</code> from master:</p>
<pre><code>local_branch1
local_branch2
local_branch3
local_branch4
</code></pre>
<p>after removing the <code>local_branch3</code> from master, I would like it to ... | 13,762 | 2,228,325 | 2015-08-28 08:55:16 | 27,301,128 | 25 | 2014-12-04 18:17:18 | 1,543,579 | 2014-12-08 13:44:14 | https://stackoverflow.com/q/27295961 | https://stackoverflow.com/a/27301128 | <p>Maybe you mean reverting local_branch3 from master?</p>
<p>If so, first check SHA1 value of the commit which merges local_branch3.
And </p>
<pre><code>git checkout master
git revert -m 1 <<SHA1 value>>
</code></pre>
<p>Then no local_branch3 codes in master branch. And locah_branch3 will remain.</p>
| <p>Maybe you mean reverting local_branch3 from master?</p> <p>If so, first check SHA1 value of the commit which merges local_branch3. And </p> <pre><code>git checkout master git revert -m 1 <<SHA1 value>> </code></pre> <p>Then no local_branch3 codes in master branch. And locah_branch3 will remain.</p> | 119, 1879 | branch, git | <h1>Remove a single merged branch from master branch</h1>
<p>In my master branch, there're following local branches that have been merged, but I would like to remove the <code>local_branch3</code> from master:</p>
<pre><code>local_branch1
local_branch2
local_branch3
local_branch4
</code></pre>
<p>after removing the <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,665 | git | # Remove a single merged branch from master branch
In my master branch, there're following local branches that have been merged, but I would like to remove the `local_branch3` from master:
```
local_branch1
local_branch2
local_branch3
local_branch4
```
after removing the `local_branch3` from master, I would like it ... | Maybe you mean reverting local_branch3 from master?
If so, first check SHA1 value of the commit which merges local_branch3.
And
```
git checkout master
git revert -m 1 <<SHA1 value>>
```
Then no local_branch3 codes in master branch. And locah_branch3 will remain. |
10832722 | How do I keep the commit message when editing commits via git rebase --interactive? | 18 | 2012-05-31 11:31:02 | <p>I'm currently in the midst of a <code>git rebase --interactive</code> session, where I'm editing a commit. I'm proceeding as suggested by <a href="https://stackoverflow.com/questions/4307095/git-how-to-split-up-a-commit-buried-in-history">How can I split up a Git commit buried in history?</a> i.e. I ran <code>git r... | 11,967 | 1,176,543 | 2016-03-14 21:22:00 | 17,643,418 | 25 | 2013-07-14 20:25:35 | null | 2016-03-14 21:22:00 | https://stackoverflow.com/q/10832722 | https://stackoverflow.com/a/17643418 | <p>While <a href="https://stackoverflow.com/users/11343/charlesb">CharlesB's solution is correct and probably easier</a>, the reason that the original poster is seeing the commit message <em><strong>before</strong></em> the commit he wants to edit is because he's using the <code>--amend</code> flag of <code>git commit<... | <p>While <a href="https://stackoverflow.com/users/11343/charlesb">CharlesB's solution is correct and probably easier</a>, the reason that the original poster is seeing the commit message <em><strong>before</strong></em> the commit he wants to edit is because he's using the <code>--amend</code> flag of <code>git commit<... | 119 | git | <h1>How do I keep the commit message when editing commits via git rebase --interactive?</h1>
<p>I'm currently in the midst of a <code>git rebase --interactive</code> session, where I'm editing a commit. I'm proceeding as suggested by <a href="https://stackoverflow.com/questions/4307095/git-how-to-split-up-a-commit-bur... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,666 | git | # How do I keep the commit message when editing commits via git rebase --interactive?
I'm currently in the midst of a `git rebase --interactive` session, where I'm editing a commit. I'm proceeding as suggested by [How can I split up a Git commit buried in history?](https://stackoverflow.com/questions/4307095/git-how-t... | While [CharlesB's solution is correct and probably easier](https://stackoverflow.com/users/11343/charlesb), the reason that the original poster is seeing the commit message ***before*** the commit he wants to edit is because he's using the `--amend` flag of `git commit`, which modifies ***the previous*** commit.
Inste... |
14824431 | Git merge without including commits from one branch to another | 18 | 2013-02-12 02:20:04 | <p>During development I often need to commit and push "intermediate" commits, i.e. commits with the code not compilable or in the middle of changing something, etc. I don't want to make such commits, but this is required for easy continuing my work from office to home, sometimes for other developers to get them base on... | 13,145 | 860,913 | 2017-05-24 00:38:50 | 14,824,500 | 25 | 2013-02-12 02:28:41 | 250,168 | 2013-02-12 02:42:02 | https://stackoverflow.com/q/14824431 | https://stackoverflow.com/a/14824500 | <p>When you merge your "dev" branch into master, try</p>
<pre><code>git checkout master
git merge --squash dev
git commit -m "Add new feature."
</code></pre>
<p>The <code>--squash</code> option will squash all of your intermediate changes into one big change.</p>
<p>You can also use <code>git rebase --interactive</c... | <p>When you merge your "dev" branch into master, try</p> <pre><code>git checkout master git merge --squash dev git commit -m "Add new feature." </code></pre> <p>The <code>--squash</code> option will squash all of your intermediate changes into one big change.</p> <p>You can also use <code>git rebase --interactive</c... | 119 | git | <h1>Git merge without including commits from one branch to another</h1>
<p>During development I often need to commit and push "intermediate" commits, i.e. commits with the code not compilable or in the middle of changing something, etc. I don't want to make such commits, but this is required for easy continuing my work... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,667 | git | # Git merge without including commits from one branch to another
During development I often need to commit and push "intermediate" commits, i.e. commits with the code not compilable or in the middle of changing something, etc. I don't want to make such commits, but this is required for easy continuing my work from off... | When you merge your "dev" branch into master, try
```
git checkout master
git merge --squash dev
git commit -m "Add new feature."
```
The `--squash` option will squash all of your intermediate changes into one big change.
You can also use `git rebase --interactive` if you need more finite control (e.g., [reordering ... |
8737326 | Gerrit Change has Status:Submitted, Merge Pending, how to solve it? | 18 | 2012-01-05 03:38:33 | <p>The Gerrit system is only used by us several people.
Once there is a Change A, and its status is: "Submitted, Merge Pending".
The change list in the "open" web page.
Also I noticed this Change had a dependency on another change B (which status is abandoned).</p>
<ol>
<li>How to make A listed on "Merged" web page ?<... | 33,718 | 1,077,031 | 2017-06-10 18:22:16 | 8,737,351 | 25 | 2012-01-05 03:40:55 | 893 | 2012-01-05 03:40:55 | https://stackoverflow.com/q/8737326 | https://stackoverflow.com/a/8737351 | <p>If change A has a dependency on B, then A cannot be merged until B is merged. Since you have abandoned B, Gerrit will not automatically merge A.</p>
<p>What you will need to do is modify A (perhaps using <code>git rebase</code>) so that it no longer depends on B, and resubmit the change to Gerrit.</p>
| <p>If change A has a dependency on B, then A cannot be merged until B is merged. Since you have abandoned B, Gerrit will not automatically merge A.</p> <p>What you will need to do is modify A (perhaps using <code>git rebase</code>) so that it no longer depends on B, and resubmit the change to Gerrit.</p> | 119, 52272 | gerrit, git | <h1>Gerrit Change has Status:Submitted, Merge Pending, how to solve it?</h1>
<p>The Gerrit system is only used by us several people.
Once there is a Change A, and its status is: "Submitted, Merge Pending".
The change list in the "open" web page.
Also I noticed this Change had a dependency on another change B (which sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,669 | git | # Gerrit Change has Status:Submitted, Merge Pending, how to solve it?
The Gerrit system is only used by us several people.
Once there is a Change A, and its status is: "Submitted, Merge Pending".
The change list in the "open" web page.
Also I noticed this Change had a dependency on another change B (which status is ab... | If change A has a dependency on B, then A cannot be merged until B is merged. Since you have abandoned B, Gerrit will not automatically merge A.
What you will need to do is modify A (perhaps using `git rebase`) so that it no longer depends on B, and resubmit the change to Gerrit. |
39920992 | Rebase remote branch onto master while keeping the remote branch updated | 17 | 2016-10-07 15:34:52 | <p>I am trying to rebase my remote branch onto master, but I want to keep the remote branch pointing to it's commits, just based at a different point in master.</p>
<p>Here is my structure:</p>
<pre><code>A - B - C - D (origin/master)
\
R - S - T (origin/develop)
</code></pre>
<p>I would like:</p>
<pre><code>A ... | 31,404 | 2,697,007 | 2023-06-08 09:55:04 | 39,921,349 | 25 | 2016-10-07 15:54:56 | 6,861,041 | 2023-06-08 09:55:04 | https://stackoverflow.com/q/39920992 | https://stackoverflow.com/a/39921349 | <p>To see more about rebase you can read <a href="https://git-scm.com/docs/git-rebase" rel="nofollow noreferrer">the manual</a> or write <code>git rebase --help</code> at your terminal</p>
<p>To solve your problem there is a easy way, following these steps:</p>
<pre class="lang-bash prettyprint-override"><code>git bran... | <p>To see more about rebase you can read <a href="https://git-scm.com/docs/git-rebase" rel="nofollow noreferrer">the manual</a> or write <code>git rebase --help</code> at your terminal</p> <p>To solve your problem there is a easy way, following these steps:</p> <pre class="lang-bash prettyprint-override"><code>git bran... | 119, 8974, 41346 | git, git-remote, rebase | <h1>Rebase remote branch onto master while keeping the remote branch updated</h1>
<p>I am trying to rebase my remote branch onto master, but I want to keep the remote branch pointing to it's commits, just based at a different point in master.</p>
<p>Here is my structure:</p>
<pre><code>A - B - C - D (origin/master)
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,672 | git | # Rebase remote branch onto master while keeping the remote branch updated
I am trying to rebase my remote branch onto master, but I want to keep the remote branch pointing to it's commits, just based at a different point in master.
Here is my structure:
```
A - B - C - D (origin/master)
\
R - S - T (origin/deve... | To see more about rebase you can read [the manual](https://git-scm.com/docs/git-rebase) or write `git rebase --help` at your terminal
To solve your problem there is a easy way, following these steps:
```
git branch -D develop # remove your local develop repository
git fetch //update references
git checkout ... |
21255373 | Why will git not let me delete a remote branch | 17 | 2014-01-21 10:24:24 | <p>I have a local repository that I want to mirror to the remote 'websrv'. This used to work fine until I deleted a local branch. Now when I do</p>
<pre><code>git push --mirror websrv
</code></pre>
<p>I get</p>
<pre><code>remote: error: By default, deleting the current branch is denied, because the next
remote: erro... | 20,808 | 2,427,540 | 2014-01-22 10:50:20 | 21,275,557 | 25 | 2014-01-22 06:14:56 | 201,725 | 2014-01-22 06:31:17 | https://stackoverflow.com/q/21255373 | https://stackoverflow.com/a/21275557 | <p>Even a bare repository has a current branch. It is the one that will be checked out by default when you clone the repository. Git does not want to delete it and is telling you why.</p>
<p>The default branch is the special <code>HEAD</code> reference. Modify it to point to something that is expected to always exist,... | <p>Even a bare repository has a current branch. It is the one that will be checked out by default when you clone the repository. Git does not want to delete it and is telling you why.</p> <p>The default branch is the special <code>HEAD</code> reference. Modify it to point to something that is expected to always exist,... | 119, 28898 | git, git-push | <h1>Why will git not let me delete a remote branch</h1>
<p>I have a local repository that I want to mirror to the remote 'websrv'. This used to work fine until I deleted a local branch. Now when I do</p>
<pre><code>git push --mirror websrv
</code></pre>
<p>I get</p>
<pre><code>remote: error: By default, deleting the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,674 | git | # Why will git not let me delete a remote branch
I have a local repository that I want to mirror to the remote 'websrv'. This used to work fine until I deleted a local branch. Now when I do
```
git push --mirror websrv
```
I get
```
remote: error: By default, deleting the current branch is denied, because the next
... | Even a bare repository has a current branch. It is the one that will be checked out by default when you clone the repository. Git does not want to delete it and is telling you why.
The default branch is the special `HEAD` reference. Modify it to point to something that is expected to always exist, or to point to a rev... |
9159294 | How can I manually run the hook post-receive on git? | 17 | 2012-02-06 11:16:18 | <p>I've pushed a website to my remote server via Git but got the error</p>
<pre><code>cannot run post-receive: No such file or directory
</code></pre>
<p>So the stuff is on the server, it has just not been deployed to my /public folder. </p>
<p>I do however have a post-receive file so I am not sure why it was not fo... | 13,376 | 393,704 | 2012-02-06 19:17:52 | 9,165,632 | 25 | 2012-02-06 18:59:43 | 49,489 | 2012-02-06 19:17:52 | https://stackoverflow.com/q/9159294 | https://stackoverflow.com/a/9165632 | <p>A hook is an executable shell script. You can execute it from the command line if you need to run it by hand, although constructing the expected <code>stdin</code> inuput is somewhat tedious if your repo has more than one head (that is, you use branches). There should be a low-level command to do this for you, but I... | <p>A hook is an executable shell script. You can execute it from the command line if you need to run it by hand, although constructing the expected <code>stdin</code> inuput is somewhat tedious if your repo has more than one head (that is, you use branches). There should be a low-level command to do this for you, but I... | 119 | git | <h1>How can I manually run the hook post-receive on git?</h1>
<p>I've pushed a website to my remote server via Git but got the error</p>
<pre><code>cannot run post-receive: No such file or directory
</code></pre>
<p>So the stuff is on the server, it has just not been deployed to my /public folder. </p>
<p>I do howev... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,675 | git | # How can I manually run the hook post-receive on git?
I've pushed a website to my remote server via Git but got the error
```
cannot run post-receive: No such file or directory
```
So the stuff is on the server, it has just not been deployed to my /public folder.
I do however have a post-receive file so I am not s... | A hook is an executable shell script. You can execute it from the command line if you need to run it by hand, although constructing the expected `stdin` inuput is somewhat tedious if your repo has more than one head (that is, you use branches). There should be a low-level command to do this for you, but I don't know th... |
35965157 | How to git clone a specific tag only without getting the whole repo? | 16 | 2016-03-13 00:41:37 | <p>I want to get <a href="https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tag/?h=v2.6.22.19" rel="noreferrer">linux kernel 2.6.22.19 source</a> for cross compiling stuff for my router, but the repo is huge (3gb) if I do</p>
<pre><code>git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/... | 18,436 | 2,052,889 | 2024-01-14 04:42:10 | 35,965,390 | 25 | 2016-03-13 01:24:08 | 1,594,980 | 2024-01-14 04:42:10 | https://stackoverflow.com/q/35965157 | https://stackoverflow.com/a/35965390 | <p>providing <code>v2.6.22.19</code> is the tag name and <code>git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git</code> is the repository url, try this:</p>
<pre><code>git clone --depth 1 --branch v2.6.22.19 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
</code></pre>
<p>the <... | <p>providing <code>v2.6.22.19</code> is the tag name and <code>git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git</code> is the repository url, try this:</p> <pre><code>git clone --depth 1 --branch v2.6.22.19 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git </code></pre> <p>the <... | 119, 34099 | git, git-clone | <h1>How to git clone a specific tag only without getting the whole repo?</h1>
<p>I want to get <a href="https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tag/?h=v2.6.22.19" rel="noreferrer">linux kernel 2.6.22.19 source</a> for cross compiling stuff for my router, but the repo is huge (3gb) if I do</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,677 | git | # How to git clone a specific tag only without getting the whole repo?
I want to get [linux kernel 2.6.22.19 source](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tag/?h=v2.6.22.19) for cross compiling stuff for my router, but the repo is huge (3gb) if I do
```
git clone git://git.kernel.org/pu... | providing `v2.6.22.19` is the tag name and `git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git` is the repository url, try this:
```
git clone --depth 1 --branch v2.6.22.19 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
```
the `--depth 1` will download only the latest commit... |
33514642 | How can I set a submodule to point to a specific commit without fetching it? | 16 | 2015-11-04 05:52:46 | <p>I am writing a service that updates the commit that each submodule in a superproject points to. My naive way of doing this would be to run <code>git fetch</code> in a submodule, <code>git reset --hard <hash></code>, and then add the submodule and commit it.</p>
<p>I would like to skip the <code>git fetch</cod... | 6,461 | 454,967 | 2017-10-16 19:48:41 | 33,575,837 | 25 | 2015-11-06 21:15:01 | 454,967 | 2015-11-06 21:15:01 | https://stackoverflow.com/q/33514642 | https://stackoverflow.com/a/33575837 | <p>The solution is to write to the Git index directly, which actually is simple for submodules. With Git 2:</p>
<p><code>git update-index --cacheinfo 160000,<Git hash of the submodule's tree>,<path to the submodule></code></p>
<hr>
<p>So for example if your project directory structure looks like this:</p... | <p>The solution is to write to the Git index directly, which actually is simple for submodules. With Git 2:</p> <p><code>git update-index --cacheinfo 160000,<Git hash of the submodule's tree>,<path to the submodule></code></p> <hr> <p>So for example if your project directory structure looks like this:</p... | 119, 41612 | git, git-submodules | <h1>How can I set a submodule to point to a specific commit without fetching it?</h1>
<p>I am writing a service that updates the commit that each submodule in a superproject points to. My naive way of doing this would be to run <code>git fetch</code> in a submodule, <code>git reset --hard <hash></code>, and then ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,678 | git | # How can I set a submodule to point to a specific commit without fetching it?
I am writing a service that updates the commit that each submodule in a superproject points to. My naive way of doing this would be to run `git fetch` in a submodule, `git reset --hard <hash>`, and then add the submodule and commit it.
I w... | The solution is to write to the Git index directly, which actually is simple for submodules. With Git 2:
`git update-index --cacheinfo 160000,<Git hash of the submodule's tree>,<path to the submodule>`
---
So for example if your project directory structure looks like this:
```
.
├── .git
└── submodule
```
Then to ... |
10641451 | What is the meaning of the "bang" or "!" before the git command? | 16 | 2012-05-17 18:30:30 | <p>As you can see from this excerpt, there is a "!" before the git command. What's the point?</p>
<pre><code>[alias]
commitx = !git add . && git commit
</code></pre>
<p>- <a href="https://stackoverflow.com/a/8956546/1354543">https://stackoverflow.com/a/8956546/1354543</a></p>
<p>I understand aliases and what... | 2,861 | 1,354,543 | 2015-05-12 17:27:15 | 10,641,561 | 25 | 2012-05-17 18:37:03 | 350,351 | 2015-05-12 17:27:15 | https://stackoverflow.com/q/10641451 | https://stackoverflow.com/a/10641561 | <p>The <code>!</code> means "run the following as commands to the shell", so in this case the alias <code>git commitx</code> expands to the equivalent of running <code>git add . && git commit</code> (which is a terrible terrible idea)</p>
| <p>The <code>!</code> means "run the following as commands to the shell", so in this case the alias <code>git commitx</code> expands to the equivalent of running <code>git add . && git commit</code> (which is a terrible terrible idea)</p> | 119, 391, 34792, 79211 | git, git-add, git-alias, terminal | <h1>What is the meaning of the "bang" or "!" before the git command?</h1>
<p>As you can see from this excerpt, there is a "!" before the git command. What's the point?</p>
<pre><code>[alias]
commitx = !git add . && git commit
</code></pre>
<p>- <a href="https://stackoverflow.com/a/8956546/1354543">https://sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,679 | git | # What is the meaning of the "bang" or "!" before the git command?
As you can see from this excerpt, there is a "!" before the git command. What's the point?
```
[alias]
commitx = !git add . && git commit
```
- <https://stackoverflow.com/a/8956546/1354543>
I understand aliases and what the command itself is doing, ... | The `!` means "run the following as commands to the shell", so in this case the alias `git commitx` expands to the equivalent of running `git add . && git commit` (which is a terrible terrible idea) |
9673176 | git pull for a local repository at specified location (instead of pwd) | 16 | 2012-03-12 19:01:18 | <p><code>pwd</code> is "present working directory". Here's the situation. </p>
<pre><code>pwd: /path/to/pwd/
git repository: /repo/path/.git/
</code></pre>
<p>I want to do a git pull from origin, but without changing my current directory.</p>
<p>To clarify just a little more in case I'm not clear enough, ... | 9,708 | 298,212 | 2024-07-23 21:00:42 | 9,673,245 | 25 | 2012-03-12 19:06:28 | 265,575 | 2012-03-12 19:06:28 | https://stackoverflow.com/q/9673176 | https://stackoverflow.com/a/9673245 | <pre><code>git --work-tree=/repo/path --git-dir=/repo/path/.git pull origin master
</code></pre>
| <pre><code>git --work-tree=/repo/path --git-dir=/repo/path/.git pull origin master </code></pre> | 119 | git | <h1>git pull for a local repository at specified location (instead of pwd)</h1>
<p><code>pwd</code> is "present working directory". Here's the situation. </p>
<pre><code>pwd: /path/to/pwd/
git repository: /repo/path/.git/
</code></pre>
<p>I want to do a git pull from origin, but without changing my current... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,680 | git | # git pull for a local repository at specified location (instead of pwd)
`pwd` is "present working directory". Here's the situation.
```
pwd: /path/to/pwd/
git repository: /repo/path/.git/
```
I want to do a git pull from origin, but without changing my current directory.
To clarify just a little more in... | ```
git --work-tree=/repo/path --git-dir=/repo/path/.git pull origin master
``` |
5668674 | Adding users to Gitolite | 16 | 2011-04-14 19:35:51 | <p>I'm trying to setup Gitolite but I'm running into a weird issue:</p>
<p>When I add a new public key file for a new user (say raphaelcruzeiro.pub), giolite sends me the following warning on push:</p>
<pre><code>remote:
remote: ***** WARNING *****
remote: the following users (pubkey files in parens)... | 21,878 | 156,623 | 2018-04-09 14:15:17 | 5,669,510 | 25 | 2011-04-14 20:51:46 | 255,803 | 2017-03-06 15:21:45 | https://stackoverflow.com/q/5668674 | https://stackoverflow.com/a/5669510 | <p>Here's the workflow for adding users to gitolite:</p>
<p>Add the users public key to the map <code>keys</code> as <code><username>.pub</code></p>
<p>Edit your gitolite config file (<code>gitolite.conf</code>), this file is in the map <code>conf</code>. When you open it, everthing will be clear.</p>
<p>examp... | <p>Here's the workflow for adding users to gitolite:</p> <p>Add the users public key to the map <code>keys</code> as <code><username>.pub</code></p> <p>Edit your gitolite config file (<code>gitolite.conf</code>), this file is in the map <code>conf</code>. When you open it, everthing will be clear.</p> <p>examp... | 119, 386, 39151 | git, gitolite, ssh | <h1>Adding users to Gitolite</h1>
<p>I'm trying to setup Gitolite but I'm running into a weird issue:</p>
<p>When I add a new public key file for a new user (say raphaelcruzeiro.pub), giolite sends me the following warning on push:</p>
<pre><code>remote:
remote: ***** WARNING *****
remote: the follow... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,681 | git | # Adding users to Gitolite
I'm trying to setup Gitolite but I'm running into a weird issue:
When I add a new public key file for a new user (say raphaelcruzeiro.pub), giolite sends me the following warning on push:
```
remote:
remote: ***** WARNING *****
remote: the following users (pubkey files in ... | Here's the workflow for adding users to gitolite:
Add the users public key to the map `keys` as `<username>.pub`
Edit your gitolite config file (`gitolite.conf`), this file is in the map `conf`. When you open it, everthing will be clear.
example:
```
repo someproject
RW+ = darhuuk
RW = raphaelcruzeiro
R ... |
67976340 | Replace branch completely with another branch | 15 | 2021-06-14 19:45:21 | <p>I have 3 branches: <code>development</code>, <code>qa</code>, and <code>staging</code>. I have almost the same code in both <code>development</code> and <code>qa</code>, so making a pr from <code>development</code> to <code>qa</code> doesn't yield too many changes (and or conflicts).</p>
<p>But now I have a move all... | 26,008 | 3,549,177 | 2023-11-09 21:57:42 | 67,976,470 | 25 | 2021-06-14 19:57:13 | 5,389,127 | 2021-06-14 19:58:23 | https://stackoverflow.com/q/67976340 | https://stackoverflow.com/a/67976470 | <p>If you want to "completely replace", I'll go with <code>git reset</code>:</p>
<pre><code>git checkout staging
git reset origin/qa --hard
</code></pre>
<p>This will make <code>staging</code> have the exact same content as <code>qa</code> <em>but</em> this will "erase" commits that may have been do... | <p>If you want to "completely replace", I'll go with <code>git reset</code>:</p> <pre><code>git checkout staging git reset origin/qa --hard </code></pre> <p>This will make <code>staging</code> have the exact same content as <code>qa</code> <em>but</em> this will "erase" commits that may have been do... | 119 | git | <h1>Replace branch completely with another branch</h1>
<p>I have 3 branches: <code>development</code>, <code>qa</code>, and <code>staging</code>. I have almost the same code in both <code>development</code> and <code>qa</code>, so making a pr from <code>development</code> to <code>qa</code> doesn't yield too many chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,682 | git | # Replace branch completely with another branch
I have 3 branches: `development`, `qa`, and `staging`. I have almost the same code in both `development` and `qa`, so making a pr from `development` to `qa` doesn't yield too many changes (and or conflicts).
But now I have a move all the stuff from `qa` to `staging`. An... | If you want to "completely replace", I'll go with `git reset`:
```
git checkout staging
git reset origin/qa --hard
```
This will make `staging` have the exact same content as `qa` *but* this will "erase" commits that may have been done on `staging` (the commits won't be deleted yet but they won't be visible in the hi... |
21560896 | How to run tests for all commits during a rebase | 15 | 2014-02-04 18:51:12 | <p>I have a feature branch with plenty of commits. </p>
<pre><code>A---B---C master
\
\-B'---C'---D'...---Z' feature
</code></pre>
<p>I am working on <code>feature</code> but another developer has created commits <code>B</code> and <code>C</code>. Now I want to rebase <code>feature</code> on commit <code>C</c... | 4,095 | 327,301 | 2024-01-17 23:30:55 | 21,560,897 | 25 | 2014-02-04 18:51:12 | 327,301 | 2014-02-05 08:57:50 | https://stackoverflow.com/q/21560896 | https://stackoverflow.com/a/21560897 | <p>While you are on branch <code>feature</code> execute:</p>
<pre class="lang-bash prettyprint-override"><code>git rebase --interactive --exec "ant rebuild test" C
</code></pre>
<p>This will cause git to start again on commit C, replay your work on top and it will run your tests after each commit it applies during re... | <p>While you are on branch <code>feature</code> execute:</p> <pre class="lang-bash prettyprint-override"><code>git rebase --interactive --exec "ant rebuild test" C </code></pre> <p>This will cause git to start again on commit C, replay your work on top and it will run your tests after each commit it applies during re... | 119, 8974 | git, rebase | <h1>How to run tests for all commits during a rebase</h1>
<p>I have a feature branch with plenty of commits. </p>
<pre><code>A---B---C master
\
\-B'---C'---D'...---Z' feature
</code></pre>
<p>I am working on <code>feature</code> but another developer has created commits <code>B</code> and <code>C</code>. Now ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,685 | git | # How to run tests for all commits during a rebase
I have a feature branch with plenty of commits.
```
A---B---C master
\
\-B'---C'---D'...---Z' feature
```
I am working on `feature` but another developer has created commits `B` and `C`. Now I want to rebase `feature` on commit `C`, but I and/or automerge in... | While you are on branch `feature` execute:
```
git rebase --interactive --exec "ant rebuild test" C
```
This will cause git to start again on commit C, replay your work on top and it will run your tests after each commit it applies during replay phase.
Hopefully your ant task will have a non-zero exit code if your t... |
18575714 | libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit | 15 | 2013-09-02 14:40:09 | <p>I got this error when starting up TortoiseGit:</p>
<p><img src="https://i.sstatic.net/NdPcI.png" alt="Error dialog screenshot"></p>
<blockquote>
<p>Could not get all refs.<br>
libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found</p>
</blockquote>
<p>While annoying, it does not prevent me from using To... | 13,028 | null | 2021-08-20 15:36:53 | 18,575,715 | 25 | 2013-09-02 14:40:09 | null | 2021-08-20 15:36:53 | https://stackoverflow.com/q/18575714 | https://stackoverflow.com/a/18575715 | <h2>Updated Answer</h2>
<p>So it turns out that, for the purpose of updating <em><strong>a local repo's view</strong></em> of which branch <code><remote>/HEAD</code> points to, you can have git automatically fetch that information from the remote and set it locally for you, instead of having to manually set it wi... | <h2>Updated Answer</h2> <p>So it turns out that, for the purpose of updating <em><strong>a local repo's view</strong></em> of which branch <code><remote>/HEAD</code> points to, you can have git automatically fetch that information from the remote and set it locally for you, instead of having to manually set it wi... | 119, 31409, 66800 | git, libgit2, tortoisegit | <h1>libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit</h1>
<p>I got this error when starting up TortoiseGit:</p>
<p><img src="https://i.sstatic.net/NdPcI.png" alt="Error dialog screenshot"></p>
<blockquote>
<p>Could not get all refs.<br>
libgit2 returned: Refspec 'refs/heads/origin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,686 | git | # libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit
I got this error when starting up TortoiseGit:

> Could not get all refs.
> libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found
While annoying, it does not preven... | ## Updated Answer
So it turns out that, for the purpose of updating ***a local repo's view*** of which branch `<remote>/HEAD` points to, you can have git automatically fetch that information from the remote and set it locally for you, instead of having to manually set it with `git symbolic-ref` like in my old solution... |
15596522 | Sonar analysis using multiple git branches in Jenkins | 15 | 2013-03-24 08:25:23 | <p>I have setup Jenkins to automatically build several git branches of my project. The build also triggers Sonar analysis, as a post-build action.</p>
<p>The problem is that all branches point to the same Sonar project. I know that there is a sonar.branch property. Is it possible to have Jenkins automatically set sona... | 34,492 | 315,902 | 2022-05-25 09:06:25 | 15,597,132 | 25 | 2013-03-24 10:01:32 | 1,818,045 | 2019-01-14 19:44:26 | https://stackoverflow.com/q/15596522 | https://stackoverflow.com/a/15597132 | <p>You can try adding <code>-Dsonar.branch.name=something</code> in the field MAVEN_OPTS in jenkins post-build action (Advanced configuration).</p>
<p>I don't know how to resolve <code>something</code>, since I don't know how you configure your jenkins job... but it will probably be something like <a href="http://docs... | <p>You can try adding <code>-Dsonar.branch.name=something</code> in the field MAVEN_OPTS in jenkins post-build action (Advanced configuration).</p> <p>I don't know how to resolve <code>something</code>, since I don't know how you configure your jenkins job... but it will probably be something like <a href="http://docs... | 119, 41127, 64999, 98290 | git, jenkins, maven, sonarqube | <h1>Sonar analysis using multiple git branches in Jenkins</h1>
<p>I have setup Jenkins to automatically build several git branches of my project. The build also triggers Sonar analysis, as a post-build action.</p>
<p>The problem is that all branches point to the same Sonar project. I know that there is a sonar.branch ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,687 | git | # Sonar analysis using multiple git branches in Jenkins
I have setup Jenkins to automatically build several git branches of my project. The build also triggers Sonar analysis, as a post-build action.
The problem is that all branches point to the same Sonar project. I know that there is a sonar.branch property. Is it ... | You can try adding `-Dsonar.branch.name=something` in the field MAVEN_OPTS in jenkins post-build action (Advanced configuration).
I don't know how to resolve `something`, since I don't know how you configure your jenkins job... but it will probably be something like [`$git.branch`](http://docs.codehaus.org/display/SON... |
14585613 | Is there a way to automatically merge notes if commits for those notes get squashed? | 15 | 2013-01-29 14:47:51 | <p>For example:</p>
<pre><code>git commit -am "Something"
git notes append -m "Dark "
git commit -am "Something"
git notes append -m "Side"
git rebase -i
# now I squash two commits and I expect to see "Dark Side" here
# but it show that note is undefined
git notes show
</code></pre>
| 2,293 | 421,010 | 2013-01-30 10:15:22 | 14,601,464 | 25 | 2013-01-30 10:15:05 | 220,155 | 2013-01-30 10:15:05 | https://stackoverflow.com/q/14585613 | https://stackoverflow.com/a/14601464 | <p>The problem is almost certainly your config; assuming you have otherwise default config, you need to set the <code>notes.rewriteRef</code> option to <code>refs/notes/commits</code> for this to work.</p>
<p>The magic command you need is thus:</p>
<pre><code>git config notes.rewriteRef refs/notes/commits
</code></pr... | <p>The problem is almost certainly your config; assuming you have otherwise default config, you need to set the <code>notes.rewriteRef</code> option to <code>refs/notes/commits</code> for this to work.</p> <p>The magic command you need is thus:</p> <pre><code>git config notes.rewriteRef refs/notes/commits </code></pr... | 119, 88239 | git, git-notes | <h1>Is there a way to automatically merge notes if commits for those notes get squashed?</h1>
<p>For example:</p>
<pre><code>git commit -am "Something"
git notes append -m "Dark "
git commit -am "Something"
git notes append -m "Side"
git rebase -i
# now I squash two commits and I expect to see "Dark Side" here
# but ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,688 | git | # Is there a way to automatically merge notes if commits for those notes get squashed?
For example:
```
git commit -am "Something"
git notes append -m "Dark "
git commit -am "Something"
git notes append -m "Side"
git rebase -i
# now I squash two commits and I expect to see "Dark Side" here
# but it show that note is... | The problem is almost certainly your config; assuming you have otherwise default config, you need to set the `notes.rewriteRef` option to `refs/notes/commits` for this to work.
The magic command you need is thus:
```
git config notes.rewriteRef refs/notes/commits
```
After the above, squashing the commits should joi... |
6529136 | gitolite: default remotes for new repository | 15 | 2011-06-30 01:41:31 | <p>I've installed gitolite (locally for now, to experiment) and it seems to work, except that new repositories are not tracking the remote by default after a git clone. If I remember correctly, when I clone a repository from github.com, it's already able to push and pull.</p>
<p>Here is what I tried:</p>
<pre><code>$... | 10,352 | 445,543 | 2012-11-13 04:41:44 | 6,547,682 | 25 | 2011-07-01 12:01:49 | 6,309 | 2012-10-09 12:15:38 | https://stackoverflow.com/q/6529136 | https://stackoverflow.com/a/6547682 | <p>The first git push always require to specify the branch you want to push. </p>
<pre><code>git push -u origin master
</code></pre>
<p>Then the next push can be done, from the same branch, as you intended:</p>
<pre><code>git push
</code></pre>
<p>From <a href="http://kernel.org/pub/software/scm/git/docs/git-push.h... | <p>The first git push always require to specify the branch you want to push. </p> <pre><code>git push -u origin master </code></pre> <p>Then the next push can be done, from the same branch, as you intended:</p> <pre><code>git push </code></pre> <p>From <a href="http://kernel.org/pub/software/scm/git/docs/git-push.h... | 119, 39151 | git, gitolite | <h1>gitolite: default remotes for new repository</h1>
<p>I've installed gitolite (locally for now, to experiment) and it seems to work, except that new repositories are not tracking the remote by default after a git clone. If I remember correctly, when I clone a repository from github.com, it's already able to push and... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,690 | git | # gitolite: default remotes for new repository
I've installed gitolite (locally for now, to experiment) and it seems to work, except that new repositories are not tracking the remote by default after a git clone. If I remember correctly, when I clone a repository from github.com, it's already able to push and pull.
H... | The first git push always require to specify the branch you want to push.
```
git push -u origin master
```
Then the next push can be done, from the same branch, as you intended:
```
git push
```
From [`git push` man page](http://kernel.org/pub/software/scm/git/docs/git-push.html):
> The special refspec `:` (or `+... |
5248587 | how to get project path in hook script post-commit?(git) | 15 | 2011-03-09 16:10:38 | <p>I want to call a Script that is located in the repository. </p>
<p>I could of course do the following:</p>
<pre><code>#!/bin/sh
../../myscript.sh
</code></pre>
<p>but I think thats not nice ;)</p>
<p>so how do I get the path of my project within the post-commit script?</p>
| 7,922 | 455,578 | 2023-01-19 12:21:57 | 5,248,793 | 25 | 2011-03-09 16:25:00 | 223,092 | 2012-04-09 17:04:56 | https://stackoverflow.com/q/5248587 | https://stackoverflow.com/a/5248793 | <p>When you're dealing with a non-bare repository, the <code>post-commit</code><sup>1</sup> hook is run with a current working directory of the working tree of the repository. So, you don't need the <code>../../</code>.</p>
<p>If you want the full path of the script, you could always do:</p>
<pre><code>SCRIPT=$(read... | <p>When you're dealing with a non-bare repository, the <code>post-commit</code><sup>1</sup> hook is run with a current working directory of the working tree of the repository. So, you don't need the <code>../../</code>.</p> <p>If you want the full path of the script, you could always do:</p> <pre><code>SCRIPT=$(read... | 119, 6268, 10250 | git, path, post-commit | <h1>how to get project path in hook script post-commit?(git)</h1>
<p>I want to call a Script that is located in the repository. </p>
<p>I could of course do the following:</p>
<pre><code>#!/bin/sh
../../myscript.sh
</code></pre>
<p>but I think thats not nice ;)</p>
<p>so how do I get the path of my project within t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,691 | git | # how to get project path in hook script post-commit?(git)
I want to call a Script that is located in the repository.
I could of course do the following:
```
#!/bin/sh
../../myscript.sh
```
but I think thats not nice ;)
so how do I get the path of my project within the post-commit script? | When you're dealing with a non-bare repository, the `post-commit`1 hook is run with a current working directory of the working tree of the repository. So, you don't need the `../../`.
If you want the full path of the script, you could always do:
```
SCRIPT=$(readlink -nf myscript.sh)
```
... or you could use `git re... |
2401254 | Git push current branch to a remote with Heroku | 15 | 2010-03-08 12:32:44 | <p>I'm trying to create a staging branch on Heroku, but there's something I don't quite get.</p>
<p>Assuming I've already created a heroku app and setup the remote to point to staging-remote, If I do: </p>
<pre><code>git checkout -b staging staging-remote/master
</code></pre>
<p>I get a local branch called 'staging'... | 13,222 | 18,942 | 2013-10-22 19:42:00 | 3,845,069 | 25 | 2010-10-02 09:08:07 | 241,367 | 2013-10-22 19:42:00 | https://stackoverflow.com/q/2401254 | https://stackoverflow.com/a/3845069 | <p>I have tested it and @juba and @MatthewFord's versions work perfectly!</p>
<pre><code>git config remote.staging.push staging:master
</code></pre>
<p>This pushes my local topic branch named <strong>staging</strong> into remote branch <strong>master</strong> on the remote repository named <strong>staging</strong>.</... | <p>I have tested it and @juba and @MatthewFord's versions work perfectly!</p> <pre><code>git config remote.staging.push staging:master </code></pre> <p>This pushes my local topic branch named <strong>staging</strong> into remote branch <strong>master</strong> on the remote repository named <strong>staging</strong>.</... | 119, 1317, 8279, 20002 | git, heroku, production, staging | <h1>Git push current branch to a remote with Heroku</h1>
<p>I'm trying to create a staging branch on Heroku, but there's something I don't quite get.</p>
<p>Assuming I've already created a heroku app and setup the remote to point to staging-remote, If I do: </p>
<pre><code>git checkout -b staging staging-remote/maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,692 | git | # Git push current branch to a remote with Heroku
I'm trying to create a staging branch on Heroku, but there's something I don't quite get.
Assuming I've already created a heroku app and setup the remote to point to staging-remote, If I do:
```
git checkout -b staging staging-remote/master
```
I get a local branch ... | I have tested it and @juba and @MatthewFord's versions work perfectly!
```
git config remote.staging.push staging:master
```
This pushes my local topic branch named **staging** into remote branch **master** on the remote repository named **staging**.
@nickgrim put it in the general form like so:
```
git config remo... |
1474686 | Git replaced all of my LF with CRLF - How do I fix this? | 15 | 2009-09-24 23:26:40 | <p>I just ran a </p>
<pre><code>git add -A
</code></pre>
<p>on my first git project.</p>
<p>I got back about a thousand responses:</p>
<blockquote>
<p>"warning: LF will be replaced by CRLF"</p>
</blockquote>
<p>as it went through each file (Ruby files, some are gems). </p>
<p>I deleted my .git directory and tri... | 13,027 | 178,665 | 2009-11-19 09:50:10 | 1,474,781 | 25 | 2009-09-25 00:02:08 | 14,540 | 2009-09-25 00:02:08 | https://stackoverflow.com/q/1474686 | https://stackoverflow.com/a/1474781 | <p>You likely have the <code>core.autocrlf</code> attribute set to true</p>
<p>It's a configuration attribute you can set:</p>
<p><a href="http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in" rel="noreferrer">http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in</a></p>
<p>To make sure ... | <p>You likely have the <code>core.autocrlf</code> attribute set to true</p> <p>It's a configuration attribute you can set:</p> <p><a href="http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in" rel="noreferrer">http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in</a></p> <p>To make sure ... | 12, 119, 2847, 3705 | git, newline, ruby, rubygems | <h1>Git replaced all of my LF with CRLF - How do I fix this?</h1>
<p>I just ran a </p>
<pre><code>git add -A
</code></pre>
<p>on my first git project.</p>
<p>I got back about a thousand responses:</p>
<blockquote>
<p>"warning: LF will be replaced by CRLF"</p>
</blockquote>
<p>as it went through each file (Ruby f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,693 | git | # Git replaced all of my LF with CRLF - How do I fix this?
I just ran a
```
git add -A
```
on my first git project.
I got back about a thousand responses:
> "warning: LF will be replaced by CRLF"
as it went through each file (Ruby files, some are gems).
I deleted my .git directory and tried to disable this defau... | You likely have the `core.autocrlf` attribute set to true
It's a configuration attribute you can set:
<http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in>
To make sure that is set to false for all Git projects you can do:
```
git config --global core.autocrlf false
```
Hope this helps! |
74993114 | How can I cancel a git commit while VS Code is waiting for the commit message in an editor tab? | 14 | 2023-01-03 12:03:07 | <p>I'm testing the Visual Studio Code's source control, and I recklessly hit the "Commit" button; now it's waiting for me to enter the commit message:</p>
<p><a href="https://i.sstatic.net/IT4v5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IT4v5.png" alt="Enter image description here" /></a>... | 20,781 | 11,747,148 | 2026-01-13 22:04:48 | 77,504,351 | 25 | 2023-11-17 20:03:40 | 11,107,541 | 2026-01-13 22:04:48 | https://stackoverflow.com/q/74993114 | https://stackoverflow.com/a/77504351 | <h3>Since 1.108</h3>
<p>There should be buttons at the lower right of the editor now to commit or cancel drafting the commit message. See <a href="https://code.visualstudio.com/updates/v1_108#_new-snippet-tranformations" rel="nofollow noreferrer">the release notes</a> and <a href="https://code.visualstudio.com/docs/sou... | <h3>Since 1.108</h3> <p>There should be buttons at the lower right of the editor now to commit or cancel drafting the commit message. See <a href="https://code.visualstudio.com/updates/v1_108#_new-snippet-tranformations" rel="nofollow noreferrer">the release notes</a> and <a href="https://code.visualstudio.com/docs/sou... | 119, 111608 | git, visual-studio-code | <h1>How can I cancel a git commit while VS Code is waiting for the commit message in an editor tab?</h1>
<p>I'm testing the Visual Studio Code's source control, and I recklessly hit the "Commit" button; now it's waiting for me to enter the commit message:</p>
<p><a href="https://i.sstatic.net/IT4v5.png" rel="... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,694 | git | # How can I cancel a git commit while VS Code is waiting for the commit message in an editor tab?
I'm testing the Visual Studio Code's source control, and I recklessly hit the "Commit" button; now it's waiting for me to enter the commit message:
[](https... | ### Since 1.108
There should be buttons at the lower right of the editor now to commit or cancel drafting the commit message. See [the release notes](https://code.visualstudio.com/updates/v1_108#_new-snippet-tranformations) and [docs](https://code.visualstudio.com/docs/sourcecontrol/staging-commits#_use-the-editor-for... |
76018699 | How can I quit an in-progress git merge operation in VS Code? | 14 | 2023-04-14 20:25:57 | <p>I'm working on a project in VS code. I made changes, pulled from GitHub and got merge conflicts. I don't know what i did but my merge conflict screen now looks like this (it's highlighting the file as one big merge conflict?). I don't want to delete any of my progress in this file. Is there a way to "reset"... | 27,249 | 15,547,208 | 2024-09-18 17:40:31 | 76,018,726 | 25 | 2023-04-14 20:29:58 | 11,107,541 | 2024-09-18 17:40:31 | https://stackoverflow.com/q/76018699 | https://stackoverflow.com/a/76018726 | <p>You can use the <code>Git: Merge Abort</code> command in the <a href="https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette" rel="noreferrer">command palette</a>. Its command ID is <code>git.mergeAbort</code> (you can use this to bind it to a keyboard shortcut). The command pretty much just do... | <p>You can use the <code>Git: Merge Abort</code> command in the <a href="https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette" rel="noreferrer">command palette</a>. Its command ID is <code>git.mergeAbort</code> (you can use this to bind it to a keyboard shortcut). The command pretty much just do... | 119, 717, 111608 | git, merge, visual-studio-code | <h1>How can I quit an in-progress git merge operation in VS Code?</h1>
<p>I'm working on a project in VS code. I made changes, pulled from GitHub and got merge conflicts. I don't know what i did but my merge conflict screen now looks like this (it's highlighting the file as one big merge conflict?). I don't want to del... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,695 | git | # How can I quit an in-progress git merge operation in VS Code?
I'm working on a project in VS code. I made changes, pulled from GitHub and got merge conflicts. I don't know what i did but my merge conflict screen now looks like this (it's highlighting the file as one big merge conflict?). I don't want to delete any o... | You can use the `Git: Merge Abort` command in the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette). Its command ID is `git.mergeAbort` (you can use this to bind it to a keyboard shortcut). The command pretty much just does [`git merge --abort`](https://git-scm.com/docs/git... |
61914935 | git commit exclamation results in zsh: illegal modifier: | 14 | 2020-05-20 13:54:32 | <p>I'm running the latest available stable version of Zsh and am running into an error using a <code>!</code> exclamation mark in a git commit message, following conventional commit style. <a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="noreferrer">https://www.conventionalcommits.org/en/v1.0.0/</a></p>
<... | 4,288 | 416,845 | 2020-05-20 13:57:23 | 61,915,010 | 25 | 2020-05-20 13:57:23 | 1,126,841 | 2020-05-20 13:57:23 | https://stackoverflow.com/q/61914935 | https://stackoverflow.com/a/61915010 | <p><code>zsh</code> interprets the <code>!</code> as the beginning of a history expansion. Just use single quotes instead of double quotes.</p>
<pre><code>git commit -am 'chore(foo)!: bar'
</code></pre>
| <p><code>zsh</code> interprets the <code>!</code> as the beginning of a history expansion. Just use single quotes instead of double quotes.</p> <pre><code>git commit -am 'chore(foo)!: bar' </code></pre> | 119, 3791, 5597 | commit, git, zsh | <h1>git commit exclamation results in zsh: illegal modifier:</h1>
<p>I'm running the latest available stable version of Zsh and am running into an error using a <code>!</code> exclamation mark in a git commit message, following conventional commit style. <a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="nor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,696 | git | # git commit exclamation results in zsh: illegal modifier:
I'm running the latest available stable version of Zsh and am running into an error using a `!` exclamation mark in a git commit message, following conventional commit style. <https://www.conventionalcommits.org/en/v1.0.0/>
```
→ zsh --version
zsh 5.8 (x86_64... | `zsh` interprets the `!` as the beginning of a history expansion. Just use single quotes instead of double quotes.
```
git commit -am 'chore(foo)!: bar'
``` |
32135648 | How to remove the git remote master from bitbucket? | 14 | 2015-08-21 08:24:34 | <p>In a git project I did some refactoring in a branch and now this branch should be a new project.
I moved this project from github to bitbucket. Now I want to delete the old master and make the refactoring branch the new master.</p>
<p>I tried to delete the master:</p>
<pre><code>$ git branch -D master
Deleted bran... | 23,563 | 4,528,018 | 2015-08-21 08:31:57 | 32,135,685 | 25 | 2015-08-21 08:26:49 | 128,662 | 2015-08-21 08:31:57 | https://stackoverflow.com/q/32135648 | https://stackoverflow.com/a/32135685 | <p>You have to change the main branch of bibucket before being able to delete it.
As long as <code>master</code> is the main branch, bitbucket will prevent you to do so (which make sense).</p>
<p>In Bitbucket UI:</p>
<ul>
<li>Select the repository</li>
<li>Select Administration</li>
<li>In Repository Details, set Mai... | <p>You have to change the main branch of bibucket before being able to delete it. As long as <code>master</code> is the main branch, bitbucket will prevent you to do so (which make sense).</p> <p>In Bitbucket UI:</p> <ul> <li>Select the repository</li> <li>Select Administration</li> <li>In Repository Details, set Mai... | 119, 8337 | bitbucket, git | <h1>How to remove the git remote master from bitbucket?</h1>
<p>In a git project I did some refactoring in a branch and now this branch should be a new project.
I moved this project from github to bitbucket. Now I want to delete the old master and make the refactoring branch the new master.</p>
<p>I tried to delete th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,700 | git | # How to remove the git remote master from bitbucket?
In a git project I did some refactoring in a branch and now this branch should be a new project.
I moved this project from github to bitbucket. Now I want to delete the old master and make the refactoring branch the new master.
I tried to delete the master:
```
$... | You have to change the main branch of bibucket before being able to delete it.
As long as `master` is the main branch, bitbucket will prevent you to do so (which make sense).
In Bitbucket UI:
- Select the repository
- Select Administration
- In Repository Details, set Main branch
Duplicates :
- [Deleting remote mas... |
12388553 | Add git commit SHA to iOS application | 14 | 2012-09-12 12:49:06 | <p>I want to show the current git SHA of when my project was built in my App. What is a good way of doing this in an iOS project with minimal effort?</p>
| 3,608 | 784,318 | 2025-03-17 21:42:21 | 19,635,629 | 25 | 2013-10-28 13:06:26 | 1,571,878 | 2017-08-11 10:59:48 | https://stackoverflow.com/q/12388553 | https://stackoverflow.com/a/19635629 | <blockquote>
<p><strong>Version 2.17. Build a85b242.</strong></p>
</blockquote>
<p>If you want to add a pretty versioning like this above, just follow these steps:</p>
<ol>
<li>Open <code>Build Phases</code> in <strong>Xcode</strong></li>
<li>Press <code>Add Build Phase</code></li>
<li>Press <code>Add Run Script Bu... | <blockquote> <p><strong>Version 2.17. Build a85b242.</strong></p> </blockquote> <p>If you want to add a pretty versioning like this above, just follow these steps:</p> <ol> <li>Open <code>Build Phases</code> in <strong>Xcode</strong></li> <li>Press <code>Add Build Phase</code></li> <li>Press <code>Add Run Script Bu... | 119, 908, 7003, 58338 | git, ios, objective-c, xcode | <h1>Add git commit SHA to iOS application</h1>
<p>I want to show the current git SHA of when my project was built in my App. What is a good way of doing this in an iOS project with minimal effort?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,703 | git | # Add git commit SHA to iOS application
I want to show the current git SHA of when my project was built in my App. What is a good way of doing this in an iOS project with minimal effort? | > **Version 2.17. Build a85b242.**
If you want to add a pretty versioning like this above, just follow these steps:
1. Open `Build Phases` in **Xcode**
2. Press `Add Build Phase`
3. Press `Add Run Script Build Phase`. You can find this in the top menu **Editor**. Drag script-line to the position after `Target Depende... |
832427 | Can't find git-svn on Mac OS X Leopard after installing via MacPorts | 14 | 2009-05-07 00:37:42 | <p>Okay people, I'm sure someone has had this issue and can help me out.</p>
<p>I'm trying to get git-svn working on OSX Leopard (10.5.6). Using MacPorts I've run the install thus : sudo port install git-core +svn</p>
<p>However, git-svn has not been installed and is not available. No errors came up during the length... | 4,473 | 32,124 | 2011-04-28 21:14:45 | 832,456 | 25 | 2009-05-07 00:53:39 | 4,203 | 2009-05-07 00:53:39 | https://stackoverflow.com/q/832427 | https://stackoverflow.com/a/832456 | <p>On my install at least, I have to invoke it as <code>git svn <cmd></code> instead of <code>git-svn <cmd></code>.</p>
| <p>On my install at least, I have to invoke it as <code>git svn <cmd></code> instead of <code>git-svn <cmd></code>.</p> | 63, 119, 369, 3504, 6452 | git, git-svn, macos, osx-leopard, svn | <h1>Can't find git-svn on Mac OS X Leopard after installing via MacPorts</h1>
<p>Okay people, I'm sure someone has had this issue and can help me out.</p>
<p>I'm trying to get git-svn working on OSX Leopard (10.5.6). Using MacPorts I've run the install thus : sudo port install git-core +svn</p>
<p>However, git-svn ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,705 | git | # Can't find git-svn on Mac OS X Leopard after installing via MacPorts
Okay people, I'm sure someone has had this issue and can help me out.
I'm trying to get git-svn working on OSX Leopard (10.5.6). Using MacPorts I've run the install thus : sudo port install git-core +svn
However, git-svn has not been installed an... | On my install at least, I have to invoke it as `git svn <cmd>` instead of `git-svn <cmd>`. |
77485593 | Azure DevOps: git push fails with LFS with large file (>150MB) | 13 | 2023-11-15 06:12:37 | <p>Even though Azure DevOps docs mention that file size limit is 5GB even without LFS, all of my pushes with LFS file of size larger than ~100MB fail with this message that I find difficult to extract useful information from:</p>
<pre><code>Uploading LFS objects: 0% (0/1), 0 B | 7.4 MB/s, done.
LFS: Client error &... | 4,861 | 22,918,743 | 2023-11-15 06:36:44 | 77,485,682 | 25 | 2023-11-15 06:36:44 | 13,464,420 | 2023-11-15 06:36:44 | https://stackoverflow.com/q/77485593 | https://stackoverflow.com/a/77485682 | <blockquote>
<p>LFS: Client error &{%!!(string=https) %!!(string=) %!!(*url.Userinfo=) %!!(string=yyy.visualstudio.com) %) from HTTP 413</p>
</blockquote>
<p>HTTP 413 is usually a proxy or any other networking/machine limitation.</p>
<p>To solve this issue, you can run the following command on your local machine.</... | <blockquote> <p>LFS: Client error &{%!!(string=https) %!!(string=) %!!(*url.Userinfo=) %!!(string=yyy.visualstudio.com) %) from HTTP 413</p> </blockquote> <p>HTTP 413 is usually a proxy or any other networking/machine limitation.</p> <p>To solve this issue, you can run the following command on your local machine.</... | 119, 115244, 116537 | azure-devops, git, git-lfs | <h1>Azure DevOps: git push fails with LFS with large file (>150MB)</h1>
<p>Even though Azure DevOps docs mention that file size limit is 5GB even without LFS, all of my pushes with LFS file of size larger than ~100MB fail with this message that I find difficult to extract useful information from:</p>
<pre><code>Uploadi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,706 | git | # Azure DevOps: git push fails with LFS with large file (>150MB)
Even though Azure DevOps docs mention that file size limit is 5GB even without LFS, all of my pushes with LFS file of size larger than ~100MB fail with this message that I find difficult to extract useful information from:
```
Uploading LFS objects: 0... | > LFS: Client error &{%!!(string=https) %!!(string=) %!!(*url.Userinfo=) %!!(string=yyy.visualstudio.com) %) from HTTP 413
HTTP 413 is usually a proxy or any other networking/machine limitation.
To solve this issue, you can run the following command on your local machine.
```
git config http.version HTTP/1.1
```
On... |
59034391 | Is possible to write a multi-line alias in .gitconfig? | 13 | 2019-11-25 14:48:13 | <p>I know that is possible to use <code>&&</code> (and) statement to go running multiple commands for a same alias. However for long combinations it loses in readability. For example:</p>
<pre><code>save = !git status && git add -A && git commit -m \"$1\" && git push --force &a... | 3,704 | 2,989,289 | 2022-07-22 15:12:57 | 59,256,767 | 25 | 2019-12-09 21:17:16 | 2,989,289 | 2022-07-22 15:12:32 | https://stackoverflow.com/q/59034391 | https://stackoverflow.com/a/59256767 | <p>You can use a line escape (<code>\</code>) to break lines like this:</p>
<pre class="lang-ini prettyprint-override"><code>[alias]
save = !git status \
&& git add -A \
&& git commit -m \"$1\" \
&& git push -f \
&& git log -1 \
&&... | <p>You can use a line escape (<code>\</code>) to break lines like this:</p> <pre class="lang-ini prettyprint-override"><code>[alias] save = !git status \ && git add -A \ && git commit -m \"$1\" \ && git push -f \ && git log -1 \ &&... | 32868, 79211 | git-alias, git-config | <h1>Is possible to write a multi-line alias in .gitconfig?</h1>
<p>I know that is possible to use <code>&&</code> (and) statement to go running multiple commands for a same alias. However for long combinations it loses in readability. For example:</p>
<pre><code>save = !git status && git add -A &&am... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,707 | git | # Is possible to write a multi-line alias in .gitconfig?
I know that is possible to use `&&` (and) statement to go running multiple commands for a same alias. However for long combinations it loses in readability. For example:
```
save = !git status && git add -A && git commit -m \"$1\" && git push --force && git log... | You can use a line escape (`\`) to break lines like this:
```
[alias]
save = !git status \
&& git add -A \
&& git commit -m \"$1\" \
&& git push -f \
&& git log -1 \
&& : # Used to distinguish last command from arguments
```
You can also put multiple statements inside a func... |
54654012 | Can't complete a Pull request on Azure DevOps | 13 | 2019-02-12 15:56:14 | <p>As an adminstrator of the repository, I can't see the option to complete an already approved pull request on Azure DevOps while my team member can see that option when they go into my pull request.</p>
<p>Does this have to do with policy or branch security, if so which option should be enabled?</p>
<p><a href="https... | 20,440 | 1,038,554 | 2023-06-02 18:38:49 | 54,658,876 | 25 | 2019-02-12 21:23:51 | 4,629,442 | 2023-06-02 18:38:49 | https://stackoverflow.com/q/54654012 | https://stackoverflow.com/a/54658876 | <p>TL;DR</p>
<blockquote>
<p>It is my understanding from <a href="https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-permissions?view=azure-devops" rel="nofollow noreferrer">documentation</a> that the <strong>Contribute</strong> permission is the one that should allow one to complete a pull request.</p>
</... | <p>TL;DR</p> <blockquote> <p>It is my understanding from <a href="https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-permissions?view=azure-devops" rel="nofollow noreferrer">documentation</a> that the <strong>Contribute</strong> permission is the one that should allow one to complete a pull request.</p> </... | 9, 119, 733, 116537 | azure-devops, c#, git, tfs | <h1>Can't complete a Pull request on Azure DevOps</h1>
<p>As an adminstrator of the repository, I can't see the option to complete an already approved pull request on Azure DevOps while my team member can see that option when they go into my pull request.</p>
<p>Does this have to do with policy or branch security, if s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,708 | git | # Can't complete a Pull request on Azure DevOps
As an adminstrator of the repository, I can't see the option to complete an already approved pull request on Azure DevOps while my team member can see that option when they go into my pull request.
Does this have to do with policy or branch security, if so which option ... | TL;DR
> It is my understanding from [documentation](https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-permissions?view=azure-devops) that the **Contribute** permission is the one that should allow one to complete a pull request.
You may be seeing this because of a conflict in the permissions hierarchy.
... |
44754810 | Git: get ours/theirs file content during merge | 13 | 2017-06-26 07:27:30 | <p>I know I can get the ours/theirs state by invoking</p>
<pre><code>git checkout --ours/--theirs -- path/to/my/file.txt
</code></pre>
<p>but this will overwrite the file in my working tree. How to get the file content of the ours/theirs file state during merge <strong>without overwriting the working tree</strong>?</... | 3,361 | 2,460,378 | 2024-02-22 05:42:12 | 44,754,855 | 25 | 2017-06-26 07:31:08 | 86,072 | 2024-02-22 05:42:12 | https://stackoverflow.com/q/44754810 | https://stackoverflow.com/a/44754855 | <p><a href="https://git-scm.com/docs/git-merge#_how_to_resolve_conflicts" rel="nofollow noreferrer">Hidden in the docs :</a></p>
<pre><code>git show :1:file/path # base
git show :2:file/path # ours
git show :3:file/path # theirs
</code></pre>
<hr />
<p>When a merge conflict is triggered because of a <code>merge</... | <p><a href="https://git-scm.com/docs/git-merge#_how_to_resolve_conflicts" rel="nofollow noreferrer">Hidden in the docs :</a></p> <pre><code>git show :1:file/path # base git show :2:file/path # ours git show :3:file/path # theirs </code></pre> <hr /> <p>When a merge conflict is triggered because of a <code>merge</... | 119 | git | <h1>Git: get ours/theirs file content during merge</h1>
<p>I know I can get the ours/theirs state by invoking</p>
<pre><code>git checkout --ours/--theirs -- path/to/my/file.txt
</code></pre>
<p>but this will overwrite the file in my working tree. How to get the file content of the ours/theirs file state during merge ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,709 | git | # Git: get ours/theirs file content during merge
I know I can get the ours/theirs state by invoking
```
git checkout --ours/--theirs -- path/to/my/file.txt
```
but this will overwrite the file in my working tree. How to get the file content of the ours/theirs file state during merge **without overwriting the working... | [Hidden in the docs :](https://git-scm.com/docs/git-merge#_how_to_resolve_conflicts)
```
git show :1:file/path # base
git show :2:file/path # ours
git show :3:file/path # theirs
```
---
When a merge conflict is triggered because of a `merge` action, `HEAD` still points to the original commit, and `MERGE_HEAD` ... |
42513970 | Fetching a Git Branch Under a Different Name | 13 | 2017-02-28 16:27:29 | <p>I want to know if I can fetch a Git branch from a remote repo, but store it under a different name in my local repo. It happens to be the <code>master</code> branch of the remote repo, but I'd like it to show up as, say, <code>featureX</code>.</p>
<p>I know it's possible to <code>push <remote> local_name:remo... | 7,629 | 2,966,528 | 2017-03-06 14:37:21 | 42,514,085 | 25 | 2017-02-28 16:33:18 | 3,577,414 | 2017-02-28 16:33:18 | https://stackoverflow.com/q/42513970 | https://stackoverflow.com/a/42514085 | <pre><code>git fetch <remote>
git checkout -b <local-branch> <remote>/<remote-branch>
</code></pre>
<p>Alternatively if you already have <code><local-branch></code> and just want it to track <code><remote-branch></code>:</p>
<pre><code>git checkout <local-branch>
git branch -... | <pre><code>git fetch <remote> git checkout -b <local-branch> <remote>/<remote-branch> </code></pre> <p>Alternatively if you already have <code><local-branch></code> and just want it to track <code><remote-branch></code>:</p> <pre><code>git checkout <local-branch> git branch -... | 119, 456, 18283 | fetch, git, version-control | <h1>Fetching a Git Branch Under a Different Name</h1>
<p>I want to know if I can fetch a Git branch from a remote repo, but store it under a different name in my local repo. It happens to be the <code>master</code> branch of the remote repo, but I'd like it to show up as, say, <code>featureX</code>.</p>
<p>I know it's... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,710 | git | # Fetching a Git Branch Under a Different Name
I want to know if I can fetch a Git branch from a remote repo, but store it under a different name in my local repo. It happens to be the `master` branch of the remote repo, but I'd like it to show up as, say, `featureX`.
I know it's possible to `push <remote> local_name... | ```
git fetch <remote>
git checkout -b <local-branch> <remote>/<remote-branch>
```
Alternatively if you already have `<local-branch>` and just want it to track `<remote-branch>`:
```
git checkout <local-branch>
git branch -u <remote>/<remote-branch>
``` |
39121688 | Windows custom git commands | 13 | 2016-08-24 11:09:33 | <p>Say I want a new git command, git new, that makes a new branch that is up to date with origin/master.</p>
<p>Is there a way I can make this script and have it available in all repositories on Windows from powershell?</p>
<p>edit: To clarify I want a git script not a powershell function. The only reason I mentioned... | 7,740 | 4,279,286 | 2020-03-20 03:21:17 | 39,122,454 | 25 | 2016-08-24 11:46:14 | 4,265,352 | 2018-04-12 11:21:33 | https://stackoverflow.com/q/39121688 | https://stackoverflow.com/a/39122454 | <p>Create a batch file that contains the following commands:</p>
<pre><code>git branch %1 origin/master
git checkout %1
</code></pre>
<p>Save it, let's say, as <code>C:\Scripts\new-branch.cmd</code>. (I never worked with PowerShell, I don't know its rules. However, it should work as well using the old Windows Command... | <p>Create a batch file that contains the following commands:</p> <pre><code>git branch %1 origin/master git checkout %1 </code></pre> <p>Save it, let's say, as <code>C:\Scripts\new-branch.cmd</code>. (I never worked with PowerShell, I don't know its rules. However, it should work as well using the old Windows Command... | 64, 119 | git, windows | <h1>Windows custom git commands</h1>
<p>Say I want a new git command, git new, that makes a new branch that is up to date with origin/master.</p>
<p>Is there a way I can make this script and have it available in all repositories on Windows from powershell?</p>
<p>edit: To clarify I want a git script not a powershell ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,711 | git | # Windows custom git commands
Say I want a new git command, git new, that makes a new branch that is up to date with origin/master.
Is there a way I can make this script and have it available in all repositories on Windows from powershell?
edit: To clarify I want a git script not a powershell function. The only reas... | Create a batch file that contains the following commands:
```
git branch %1 origin/master
git checkout %1
```
Save it, let's say, as `C:\Scripts\new-branch.cmd`. (I never worked with PowerShell, I don't know its rules. However, it should work as well using the old Windows Command Prompt).
Test the batch file works a... |
12305668 | How to delete commit that is pushed to the remote repository? | 13 | 2012-09-06 17:50:07 | <p>A local branch:-</p>
<blockquote>
<p>'feature/100'</p>
</blockquote>
<p>And Remote branches:-</p>
<blockquote>
<p>'master'</p>
<p>'Version2'</p>
</blockquote>
<p>Accidently,</p>
<ol>
<li>I have merged my feature branch 'feature/100' to the master</li>
<li>Also pushed it to the remote repository.</li>
</ol>
<p>But in... | 26,560 | 1,327,064 | 2022-08-10 10:32:00 | 12,305,850 | 25 | 2012-09-06 18:03:01 | 229,375 | 2012-09-06 18:03:01 | https://stackoverflow.com/q/12305668 | https://stackoverflow.com/a/12305850 | <p>You can either:</p>
<p><strong>Revert your change</strong></p>
<p><code>git revert HEAD</code></p>
<p>This will create a new commit that reverts the changes that you just pushed up to master. This is the safest option because other people may have already pulled down the change that you have pushed up.</p>
<p><s... | <p>You can either:</p> <p><strong>Revert your change</strong></p> <p><code>git revert HEAD</code></p> <p>This will create a new commit that reverts the changes that you just pushed up to master. This is the safest option because other people may have already pulled down the change that you have pushed up.</p> <p><s... | 119 | git | <h1>How to delete commit that is pushed to the remote repository?</h1>
<p>A local branch:-</p>
<blockquote>
<p>'feature/100'</p>
</blockquote>
<p>And Remote branches:-</p>
<blockquote>
<p>'master'</p>
<p>'Version2'</p>
</blockquote>
<p>Accidently,</p>
<ol>
<li>I have merged my feature branch 'feature/100' to the master... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,714 | git | # How to delete commit that is pushed to the remote repository?
A local branch:-
> 'feature/100'
And Remote branches:-
> 'master'
>
> 'Version2'
Accidently,
1. I have merged my feature branch 'feature/100' to the master
2. Also pushed it to the remote repository.
But in real '**feature/100**' should have been me... | You can either:
**Revert your change**
`git revert HEAD`
This will create a new commit that reverts the changes that you just pushed up to master. This is the safest option because other people may have already pulled down the change that you have pushed up.
**Change your commit history and force push the change**
... |
64155911 | Get latest updates from master into my branch | 12 | 2020-10-01 12:58:33 | <p>I created a branch called myBranch from master. Other colleagues have done so and merged their branches into master. So my branch is different from master now. How can I get the latest version of master into myBranch?
I found on stackoverflow the answer is:</p>
<pre><code>git checkout myBranch # gets you "... | 87,856 | 4,893,099 | 2024-01-08 13:28:02 | 64,156,369 | 25 | 2020-10-01 13:25:52 | 3,712,298 | 2020-10-01 13:25:52 | https://stackoverflow.com/q/64155911 | https://stackoverflow.com/a/64156369 | <ol>
<li><p>checkout to your branch- myBranch</p>
<p><code>git checkout myBranch</code></p>
</li>
<li><p>get latest code from master branch to your branch</p>
<p><code>git pull origin master</code></p>
</li>
</ol>
| <ol> <li><p>checkout to your branch- myBranch</p> <p><code>git checkout myBranch</code></p> </li> <li><p>get latest code from master branch to your branch</p> <p><code>git pull origin master</code></p> </li> </ol> | 119 | git | <h1>Get latest updates from master into my branch</h1>
<p>I created a branch called myBranch from master. Other colleagues have done so and merged their branches into master. So my branch is different from master now. How can I get the latest version of master into myBranch?
I found on stackoverflow the answer is:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,716 | git | # Get latest updates from master into my branch
I created a branch called myBranch from master. Other colleagues have done so and merged their branches into master. So my branch is different from master now. How can I get the latest version of master into myBranch?
I found on stackoverflow the answer is:
```
git chec... | 1. checkout to your branch- myBranch
`git checkout myBranch`
2. get latest code from master branch to your branch
`git pull origin master` |
52808365 | Git error: gpg failed to sign the data on Linux | 12 | 2018-10-15 00:41:43 | <p>I am having trouble signing commits. With the following git config:</p>
<pre><code>user.name=Bob
user.email=[bob's email]
user.signingkey=ABCDEFGH
user.user=bob1
gpg.program=gpg2
</code></pre>
<p>I was told to include only the first eight characters of the secret key.</p>
<p>After staging, upon <code>git commit -... | 22,034 | 3,180,065 | 2022-06-28 16:36:02 | 52,808,419 | 25 | 2018-10-15 00:50:59 | 147,356 | 2018-10-15 00:50:59 | https://stackoverflow.com/q/52808365 | https://stackoverflow.com/a/52808419 | <blockquote>
<p>I was told to include only the first eight characters of the secret key.</p>
</blockquote>
<p>The value of <code>user.signingkey</code> is a <strong>key id</strong> identifying which key git should use when generating the signature.</p>
<p>There's a complete example <a href="https://git-scm.com/book... | <blockquote> <p>I was told to include only the first eight characters of the secret key.</p> </blockquote> <p>The value of <code>user.signingkey</code> is a <strong>key id</strong> identifying which key git should use when generating the signature.</p> <p>There's a complete example <a href="https://git-scm.com/book... | 58, 119, 5254 | git, linux, sign | <h1>Git error: gpg failed to sign the data on Linux</h1>
<p>I am having trouble signing commits. With the following git config:</p>
<pre><code>user.name=Bob
user.email=[bob's email]
user.signingkey=ABCDEFGH
user.user=bob1
gpg.program=gpg2
</code></pre>
<p>I was told to include only the first eight characters of the s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,717 | git | # Git error: gpg failed to sign the data on Linux
I am having trouble signing commits. With the following git config:
```
user.name=Bob
user.email=[bob's email]
user.signingkey=ABCDEFGH
user.user=bob1
gpg.program=gpg2
```
I was told to include only the first eight characters of the secret key.
After staging, upon `... | > I was told to include only the first eight characters of the secret key.
The value of `user.signingkey` is a **key id** identifying which key git should use when generating the signature.
There's a complete example [in the official documentation](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) that show... |
44524225 | GIT Log show only recent entries | 12 | 2017-06-13 14:21:14 | <p>I am trying to utilize cmd prompt to get the last 10 commits with the author, commit hash, and description to utilize in a form. I have been experimenting with <code>git log --pretty=short</code>, however, the output seems to go forever. </p>
<p>I would like to know how to reduce the amount of commits returned to t... | 8,289 | 3,241,982 | 2017-06-13 14:32:50 | 44,524,327 | 25 | 2017-06-13 14:25:57 | 1,987,612 | 2017-06-13 14:25:57 | https://stackoverflow.com/q/44524225 | https://stackoverflow.com/a/44524327 | <p>Run:</p>
<pre><code>git log -n <number-of-commits> --pretty=short
</code></pre>
<p>For all options, see:</p>
<p><a href="https://git-scm.com/docs/git-log" rel="noreferrer">https://git-scm.com/docs/git-log</a></p>
| <p>Run:</p> <pre><code>git log -n <number-of-commits> --pretty=short </code></pre> <p>For all options, see:</p> <p><a href="https://git-scm.com/docs/git-log" rel="noreferrer">https://git-scm.com/docs/git-log</a></p> | 119 | git | <h1>GIT Log show only recent entries</h1>
<p>I am trying to utilize cmd prompt to get the last 10 commits with the author, commit hash, and description to utilize in a form. I have been experimenting with <code>git log --pretty=short</code>, however, the output seems to go forever. </p>
<p>I would like to know how to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,718 | git | # GIT Log show only recent entries
I am trying to utilize cmd prompt to get the last 10 commits with the author, commit hash, and description to utilize in a form. I have been experimenting with `git log --pretty=short`, however, the output seems to go forever.
I would like to know how to reduce the amount of commits... | Run:
```
git log -n <number-of-commits> --pretty=short
```
For all options, see:
<https://git-scm.com/docs/git-log> |
12407899 | Cant rm folder with GIT rm? | 12 | 2012-09-13 13:54:47 | <p>I want to remove an entire directory with GIT ... each time I keep getting the same error and don't understand why this is happening. </p>
<p>I want to remove the "blue_white" folder ...</p>
<pre><code>├── css
│ ├── design.css
│ └── red_white.css
├── images
│ ├── blue_white
│ │ ├── accordion-button.png
│... | 16,861 | 223,134 | 2022-04-05 16:29:59 | 12,408,155 | 25 | 2012-09-13 14:06:30 | 802,005 | 2012-09-13 14:06:30 | https://stackoverflow.com/q/12407899 | https://stackoverflow.com/a/12408155 | <ol>
<li><code>$ rm -r images/blue_white/</code></li>
<li><code>$ git rm -r images/blue_white/</code></li>
<li><code>$ git commit -m 'Remove images/blue_white directory'</code></li>
</ol>
| <ol> <li><code>$ rm -r images/blue_white/</code></li> <li><code>$ git rm -r images/blue_white/</code></li> <li><code>$ git commit -m 'Remove images/blue_white directory'</code></li> </ol> | 119, 112901 | git, git-rm | <h1>Cant rm folder with GIT rm?</h1>
<p>I want to remove an entire directory with GIT ... each time I keep getting the same error and don't understand why this is happening. </p>
<p>I want to remove the "blue_white" folder ...</p>
<pre><code>├── css
│ ├── design.css
│ └── red_white.css
├── images
│ ├── blue_whi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,719 | git | # Cant rm folder with GIT rm?
I want to remove an entire directory with GIT ... each time I keep getting the same error and don't understand why this is happening.
I want to remove the "blue_white" folder ...
```
├── css
│ ├── design.css
│ └── red_white.css
├── images
│ ├── blue_white
│ │ ├── accordion-but... | 1. `$ rm -r images/blue_white/`
2. `$ git rm -r images/blue_white/`
3. `$ git commit -m 'Remove images/blue_white directory'` |
9477354 | How to allow introducing only digits in jTextField? | 12 | 2012-02-28 06:20:52 | <p>I have tried to use the example shown <a href="https://stackoverflow.com/a/5663094/282887">here</a> but java showing error message of</p>
<blockquote>
<p>"AttributeSet cannot be resolved to a type"</p>
</blockquote>
<p>That is why I am trying to use another method of allowing only digits: </p>
<pre><code>txtUse... | 37,695 | 282,887 | 2019-10-23 09:00:27 | 9,478,124 | 25 | 2012-02-28 07:43:09 | 1,057,230 | 2015-12-10 13:16:52 | https://stackoverflow.com/q/9477354 | https://stackoverflow.com/a/9478124 | <p>Here check this code snippet, that's how you allow only digits in JTextField, by using DocumentFilter, as the most effeciive way :</p>
<pre><code>import java.awt.*;
import javax.swing.*;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
imp... | <p>Here check this code snippet, that's how you allow only digits in JTextField, by using DocumentFilter, as the most effeciive way :</p> <pre><code>import java.awt.*; import javax.swing.*; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; imp... | 17, 1082, 9914, 10917, 17599 | digits, java, jtextfield, restriction, swing | <h1>How to allow introducing only digits in jTextField?</h1>
<p>I have tried to use the example shown <a href="https://stackoverflow.com/a/5663094/282887">here</a> but java showing error message of</p>
<blockquote>
<p>"AttributeSet cannot be resolved to a type"</p>
</blockquote>
<p>That is why I am trying to use an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,720 | git | # How to allow introducing only digits in jTextField?
I have tried to use the example shown [here](https://stackoverflow.com/a/5663094/282887) but java showing error message of
> "AttributeSet cannot be resolved to a type"
That is why I am trying to use another method of allowing only digits:
```
txtUsername.addKey... | Here check this code snippet, that's how you allow only digits in JTextField, by using DocumentFilter, as the most effeciive way :
```
import java.awt.*;
import javax.swing.*;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swin... |
54746699 | Please commit your changes or stash them before you merge | 11 | 2019-02-18 11:51:41 | <p>I want to upgrade, but I need to commit, but when I do git commit, I get:</p>
<blockquote>
<p>Your branch is behind 'origin/develop' by 20 commits, and can be fast-forwarded.</p>
<p>(use "git pull" to update your local branch)</p>
</blockquote>
<p>I don't want to lose my local changes</p>
| 51,514 | 10,254,976 | 2021-08-08 12:54:59 | 54,746,947 | 25 | 2019-02-18 12:07:06 | 3,811,763 | 2019-02-18 12:12:53 | https://stackoverflow.com/q/54746699 | https://stackoverflow.com/a/54746947 | <p>Use these terminal commands from your project directory.</p>
<p>Stash your local changes using <code>git stash</code>. This will save your local changes, after the last commit in your local, to a stack.</p>
<p>Pull changes from remote using <code>git pull</code> or <code>git pull <remote-name> <branch-na... | <p>Use these terminal commands from your project directory.</p> <p>Stash your local changes using <code>git stash</code>. This will save your local changes, after the last commit in your local, to a stack.</p> <p>Pull changes from remote using <code>git pull</code> or <code>git pull <remote-name> <branch-na... | 119 | git | <h1>Please commit your changes or stash them before you merge</h1>
<p>I want to upgrade, but I need to commit, but when I do git commit, I get:</p>
<blockquote>
<p>Your branch is behind 'origin/develop' by 20 commits, and can be fast-forwarded.</p>
<p>(use "git pull" to update your local branch)</p>
</blockqu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,722 | git | # Please commit your changes or stash them before you merge
I want to upgrade, but I need to commit, but when I do git commit, I get:
> Your branch is behind 'origin/develop' by 20 commits, and can be fast-forwarded.
>
> (use "git pull" to update your local branch)
I don't want to lose my local changes | Use these terminal commands from your project directory.
Stash your local changes using `git stash`. This will save your local changes, after the last commit in your local, to a stack.
Pull changes from remote using `git pull` or `git pull <remote-name> <branch-name>` if you are pulling from branch other than master.... |
22055390 | How to install Git with PCRE support on macOS with Homebrew? | 11 | 2014-02-26 23:00:31 | <p>When I run</p>
<pre><code>$ git grep -P "<pattern>"
</code></pre>
<p>I get the following error:</p>
<blockquote>
<p>fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE</p>
</blockquote>
<p>How can I install Git with PCRE support for macOS properly?</p>
| 5,302 | 646,960 | 2023-02-17 12:58:15 | 28,587,310 | 25 | 2015-02-18 15:30:03 | 2,241,364 | 2018-03-09 13:53:40 | https://stackoverflow.com/q/22055390 | https://stackoverflow.com/a/28587310 | <p>With homebrew, just use</p>
<pre><code>brew reinstall --with-pcre2 git
</code></pre>
<p>It forces to build git from source instead of downloading the bottle, but ensures that the updates will be done with the pcre support.</p>
| <p>With homebrew, just use</p> <pre><code>brew reinstall --with-pcre2 git </code></pre> <p>It forces to build git from source instead of downloading the bottle, but ensures that the updates will be done with the pcre support.</p> | 119, 369, 1067, 1923 | git, homebrew, macos, pcre | <h1>How to install Git with PCRE support on macOS with Homebrew?</h1>
<p>When I run</p>
<pre><code>$ git grep -P "<pattern>"
</code></pre>
<p>I get the following error:</p>
<blockquote>
<p>fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE</p>
</blockquote>
<p>How can I install... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,723 | git | # How to install Git with PCRE support on macOS with Homebrew?
When I run
```
$ git grep -P "<pattern>"
```
I get the following error:
> fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE
How can I install Git with PCRE support for macOS properly? | With homebrew, just use
```
brew reinstall --with-pcre2 git
```
It forces to build git from source instead of downloading the bottle, but ensures that the updates will be done with the pcre support. |
13606951 | Git submodule update gives "error: invalid key (newline)" | 11 | 2012-11-28 14:06:44 | <p>After a painful merge, when I run <code>git submodule update</code>, I get this:</p>
<pre><code>>git submodule update
error: invalid key (newline): submodule.external/mono-reactive
external/mono-reactive.url
error: invalid key (newline): submodule.external/mono-reactive
external/mono-reactive.update
</code></pr... | 3,130 | 458,193 | 2017-06-30 15:33:45 | 13,606,952 | 25 | 2012-11-28 14:06:44 | 458,193 | 2017-06-30 15:33:45 | https://stackoverflow.com/q/13606951 | https://stackoverflow.com/a/13606952 | <p>Turns out, I had a particular submodule defined <strong>twice</strong> in <code>.gitmodules</code>.<br>
Once I removed the extra entry, the error would be gone!</p>
| <p>Turns out, I had a particular submodule defined <strong>twice</strong> in <code>.gitmodules</code>.<br> Once I removed the extra entry, the error would be gone!</p> | 119, 41612 | git, git-submodules | <h1>Git submodule update gives "error: invalid key (newline)"</h1>
<p>After a painful merge, when I run <code>git submodule update</code>, I get this:</p>
<pre><code>>git submodule update
error: invalid key (newline): submodule.external/mono-reactive
external/mono-reactive.url
error: invalid key (newline): submodu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,725 | git | # Git submodule update gives "error: invalid key (newline)"
After a painful merge, when I run `git submodule update`, I get this:
```
>git submodule update
error: invalid key (newline): submodule.external/mono-reactive
external/mono-reactive.url
error: invalid key (newline): submodule.external/mono-reactive
external... | Turns out, I had a particular submodule defined **twice** in `.gitmodules`.
Once I removed the extra entry, the error would be gone! |
1248827 | Git: hide/remove files never to be versioned | 11 | 2009-08-08 12:59:30 | <p>I'm trying to get started using Git and TortoiseGit.</p>
<p>Is there a way to hide files that should never be tracked completely? Currently, all temporary build files are in the same "Not Versioned" list as new files when I commit a change. </p>
| 19,819 | 31,317 | 2019-08-05 16:27:45 | 1,248,844 | 25 | 2009-08-08 13:05:35 | 84,880 | 2019-08-05 16:06:52 | https://stackoverflow.com/q/1248827 | https://stackoverflow.com/a/1248844 | <p>Create a text file called <code>.gitignore</code> in your root folder and add lines like the following to exclude files:</p>
<pre><code>*.obj
test.c
</code></pre>
<p>Then add .gitignore to your Git repository and commit:</p>
<pre><code>$ git add .gitignore
$ git commit .gitignore
</code></pre>
| <p>Create a text file called <code>.gitignore</code> in your root folder and add lines like the following to exclude files:</p> <pre><code>*.obj test.c </code></pre> <p>Then add .gitignore to your Git repository and commit:</p> <pre><code>$ git add .gitignore $ git commit .gitignore </code></pre> | 119, 31409 | git, tortoisegit | <h1>Git: hide/remove files never to be versioned</h1>
<p>I'm trying to get started using Git and TortoiseGit.</p>
<p>Is there a way to hide files that should never be tracked completely? Currently, all temporary build files are in the same "Not Versioned" list as new files when I commit a change. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,726 | git | # Git: hide/remove files never to be versioned
I'm trying to get started using Git and TortoiseGit.
Is there a way to hide files that should never be tracked completely? Currently, all temporary build files are in the same "Not Versioned" list as new files when I commit a change. | Create a text file called `.gitignore` in your root folder and add lines like the following to exclude files:
```
*.obj
test.c
```
Then add .gitignore to your Git repository and commit:
```
$ git add .gitignore
$ git commit .gitignore
``` |
5112336 | How to make the master branch track? | 10 | 2011-02-25 00:38:44 | <p>I cloned a repository and was working in the master branch. There was a consistent problem: <code>git push</code> (and <code>git push</code>) didn't work and gave long, uninterpretable error message. Through trial-and-error, I found <code>git push origin master</code> did the push correctly. But now I've noticed s... | 16,969 | 238,884 | 2013-07-15 13:31:05 | 5,112,408 | 25 | 2011-02-25 00:49:58 | 227,513 | 2011-02-25 01:12:30 | https://stackoverflow.com/q/5112336 | https://stackoverflow.com/a/5112408 | <p>What is your <code>branch.autosetupmerge</code> set to? By default it should have setup the branch tracking when you cloned.</p>
<p>Try setting the upstream for the branch with this to make the branch track the remote.</p>
<pre><code>git branch --set-upstream master origin/master
</code></pre>
| <p>What is your <code>branch.autosetupmerge</code> set to? By default it should have setup the branch tracking when you cloned.</p> <p>Try setting the upstream for the branch with this to make the branch track the remote.</p> <pre><code>git branch --set-upstream master origin/master </code></pre> | 119 | git | <h1>How to make the master branch track?</h1>
<p>I cloned a repository and was working in the master branch. There was a consistent problem: <code>git push</code> (and <code>git push</code>) didn't work and gave long, uninterpretable error message. Through trial-and-error, I found <code>git push origin master</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,728 | git | # How to make the master branch track?
I cloned a repository and was working in the master branch. There was a consistent problem: `git push` (and `git push`) didn't work and gave long, uninterpretable error message. Through trial-and-error, I found `git push origin master` did the push correctly. But now I've noticed... | What is your `branch.autosetupmerge` set to? By default it should have setup the branch tracking when you cloned.
Try setting the upstream for the branch with this to make the branch track the remote.
```
git branch --set-upstream master origin/master
``` |
3901099 | git command to add/stage modified files in folders only | 10 | 2010-10-10 16:23:35 | <p>I've modified several files in a folder and subfolders. I could add the top folder recursively but then i have several subfolders that are untracked, so every time I do the recursive add to stage changes, I have to untrack the subfolders with <code>git rm -r --cached</code>. Is there a better way to just stage the m... | 15,032 | 170,521 | 2019-10-23 08:50:02 | 3,901,126 | 25 | 2010-10-10 16:29:26 | 356,716 | 2010-10-10 16:29:26 | https://stackoverflow.com/q/3901099 | https://stackoverflow.com/a/3901126 | <p><code>git add -u</code> adds only modifications. Also consider adding files which you don't want to track to <code>.gitignore</code> file.</p>
| <p><code>git add -u</code> adds only modifications. Also consider adding files which you don't want to track to <code>.gitignore</code> file.</p> | 119, 3346 | dvcs, git | <h1>git command to add/stage modified files in folders only</h1>
<p>I've modified several files in a folder and subfolders. I could add the top folder recursively but then i have several subfolders that are untracked, so every time I do the recursive add to stage changes, I have to untrack the subfolders with <code>git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,729 | git | # git command to add/stage modified files in folders only
I've modified several files in a folder and subfolders. I could add the top folder recursively but then i have several subfolders that are untracked, so every time I do the recursive add to stage changes, I have to untrack the subfolders with `git rm -r --cache... | `git add -u` adds only modifications. Also consider adding files which you don't want to track to `.gitignore` file. |
50354335 | clone AWS codecommit repo via HTTP | 9 | 2018-05-15 15:44:59 | <p>I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine.</p>
<p>Right not I am migrating the development of a project on a machine where I do have installed ubuntu and where I choose to use gitkraken.</p>
<p>I was... | 38,243 | 5,614,800 | 2022-04-23 23:38:55 | 50,895,453 | 25 | 2018-06-17 09:44:02 | 5,614,800 | 2019-08-07 21:53:17 | https://stackoverflow.com/q/50354335 | https://stackoverflow.com/a/50895453 | <p>I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs:</p>
<p>I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt:</p>
<p>At terminal provide the following:</p>
<pre><code>aws c... | <p>I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs:</p> <p>I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt:</p> <p>At terminal provide the following:</p> <pre><code>aws c... | 119, 33388, 78251, 114185, 119628 | amazon-iam, amazon-web-services, aws-codecommit, git, gitkraken | <h1>clone AWS codecommit repo via HTTP</h1>
<p>I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine.</p>
<p>Right not I am migrating the development of a project on a machine where I do have installed ubuntu and wh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,730 | git | # clone AWS codecommit repo via HTTP
I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine.
Right not I am migrating the development of a project on a machine where I do have installed ubuntu and where I choose to ... | I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs:
I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt:
At terminal provide the following:
```
aws configure
```
you will be pr... |
44221220 | git connect my local branch with remote | 9 | 2017-05-27 20:14:44 | <p>In my local repo if I execute</p>
<pre><code>$git branch --all
</code></pre>
<p>it returns </p>
<pre><code>* master
remotes/origin/develop
remotes/origin/master
</code></pre>
<p>that means that I have a local branch named repo
and 2 remote branches.</p>
<p>If I do </p>
<pre><code>$git checkout -b develop
<... | 44,716 | 1,298,499 | 2023-01-08 09:37:08 | 44,221,234 | 25 | 2017-05-27 20:16:52 | 2,296,458 | 2023-01-08 09:37:08 | https://stackoverflow.com/q/44221220 | https://stackoverflow.com/a/44221234 | <p>If by "connect" you mean you want your local branch to track the remote branch, then you need to have your branch <code>--set-upstream-to</code>. Change to the branch you want to connect and perform</p>
<pre><code>git branch --set-upstream-to remotes/origin/develop
</code></pre>
<p>Then things like <code>g... | <p>If by "connect" you mean you want your local branch to track the remote branch, then you need to have your branch <code>--set-upstream-to</code>. Change to the branch you want to connect and perform</p> <pre><code>git branch --set-upstream-to remotes/origin/develop </code></pre> <p>Then things like <code>g... | 119 | git | <h1>git connect my local branch with remote</h1>
<p>In my local repo if I execute</p>
<pre><code>$git branch --all
</code></pre>
<p>it returns </p>
<pre><code>* master
remotes/origin/develop
remotes/origin/master
</code></pre>
<p>that means that I have a local branch named repo
and 2 remote branches.</p>
<p>If... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,731 | git | # git connect my local branch with remote
In my local repo if I execute
```
$git branch --all
```
it returns
```
* master
remotes/origin/develop
remotes/origin/master
```
that means that I have a local branch named repo
and 2 remote branches.
If I do
```
$git checkout -b develop
```
it will create a local b... | If by "connect" you mean you want your local branch to track the remote branch, then you need to have your branch `--set-upstream-to`. Change to the branch you want to connect and perform
```
git branch --set-upstream-to remotes/origin/develop
```
Then things like `git pull` and `git status` will know which remote br... |
4569089 | Can't update RVM - "fatal: Unable to find remote helper for 'http'" | 9 | 2010-12-31 08:53:57 | <p>I'm running RVM 1.1.6 on Ubuntu 8.04 and all of a sudden I can't update to the latest version anymore.</p>
<pre><code>~ rvm get head
Original installed RVM version:
rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
fatal: Unable to find remote helper for 'http'
Installed RVM... | 13,280 | 155,050 | 2013-01-15 20:14:42 | 4,619,057 | 25 | 2011-01-06 19:40:10 | 565,975 | 2011-01-06 19:40:10 | https://stackoverflow.com/q/4569089 | https://stackoverflow.com/a/4619057 | <p>I ran into the same issue and it seemed that the git version was missing curl and expat support. I could resolve it by compiling the git version myself.</p>
<pre><code>sudo apt-get remove git-core
wget http://kernel.org/pub/software/scm/git/git-1.7.3.5.tar.gz
sudo apt-get build-dep git-core
tar xvzf git-1.7.3.5.tar... | <p>I ran into the same issue and it seemed that the git version was missing curl and expat support. I could resolve it by compiling the git version myself.</p> <pre><code>sudo apt-get remove git-core wget http://kernel.org/pub/software/scm/git/git-1.7.3.5.tar.gz sudo apt-get build-dep git-core tar xvzf git-1.7.3.5.tar... | 119, 549, 6090, 46495 | git, rvm, ubuntu, ubuntu-8.04 | <h1>Can't update RVM - "fatal: Unable to find remote helper for 'http'"</h1>
<p>I'm running RVM 1.1.6 on Ubuntu 8.04 and all of a sudden I can't update to the latest version anymore.</p>
<pre><code>~ rvm get head
Original installed RVM version:
rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,732 | git | # Can't update RVM - "fatal: Unable to find remote helper for 'http'"
I'm running RVM 1.1.6 on Ubuntu 8.04 and all of a sudden I can't update to the latest version anymore.
```
~ rvm get head
Original installed RVM version:
rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
fata... | I ran into the same issue and it seemed that the git version was missing curl and expat support. I could resolve it by compiling the git version myself.
```
sudo apt-get remove git-core
wget http://kernel.org/pub/software/scm/git/git-1.7.3.5.tar.gz
sudo apt-get build-dep git-core
tar xvzf git-1.7.3.5.tar.gz
cd git-1.7... |
75973072 | unable to git clone by symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0 | 8 | 2023-04-09 21:54:16 | <p>Reproduce:</p>
<p><code>git clone [any repo with https link]</code></p>
<p>Error:</p>
<p><code>/usr/lib/git-core/git-remote-https: symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0</code></p>
<p>I have tried:</p>
<ol>
<li>remove and reinstall git.... | 16,263 | 6,234,590 | 2023-09-11 12:53:56 | 76,234,380 | 25 | 2023-05-12 08:14:22 | 13,992,682 | 2023-05-12 08:14:22 | https://stackoverflow.com/q/75973072 | https://stackoverflow.com/a/76234380 | <p>If you are using a conda environment, then installing <code>git</code> through <code>conda install</code> solved the above error.</p>
<pre><code>conda install -c anaconda git
</code></pre>
| <p>If you are using a conda environment, then installing <code>git</code> through <code>conda install</code> solved the above error.</p> <pre><code>conda install -c anaconda git </code></pre> | 119, 549, 13613 | git, package, ubuntu | <h1>unable to git clone by symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0</h1>
<p>Reproduce:</p>
<p><code>git clone [any repo with https link]</code></p>
<p>Error:</p>
<p><code>/usr/lib/git-core/git-remote-https: symbol lookup error: /lib/x86_64-l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,733 | git | # unable to git clone by symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0
Reproduce:
`git clone [any repo with https link]`
Error:
`/usr/lib/git-core/git-remote-https: symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol:... | If you are using a conda environment, then installing `git` through `conda install` solved the above error.
```
conda install -c anaconda git
``` |
19742256 | Path doesn't work with %20 for space in filename in Git console | 8 | 2013-11-02 13:12:37 | <p>My filename contains a space, so when I did the following:</p>
<pre><code>git add first%20file.txt
</code></pre>
<p>the command above returned invalid path to me in my console</p>
| 21,686 | 2,859,050 | 2019-01-22 23:15:26 | 19,742,272 | 25 | 2013-11-02 13:14:50 | 2,872,574 | 2013-11-02 13:14:50 | https://stackoverflow.com/q/19742256 | https://stackoverflow.com/a/19742272 | <p>How about escaping space:</p>
<pre><code>git add first\ file.txt
</code></pre>
| <p>How about escaping space:</p> <pre><code>git add first\ file.txt </code></pre> | 119 | git | <h1>Path doesn't work with %20 for space in filename in Git console</h1>
<p>My filename contains a space, so when I did the following:</p>
<pre><code>git add first%20file.txt
</code></pre>
<p>the command above returned invalid path to me in my console</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,735 | git | # Path doesn't work with %20 for space in filename in Git console
My filename contains a space, so when I did the following:
```
git add first%20file.txt
```
the command above returned invalid path to me in my console | How about escaping space:
```
git add first\ file.txt
``` |
39154794 | Detailed reason why remote git rebase is so evil | 6 | 2016-08-25 21:11:28 | <p>So I come from a centralized VCS background and am trying to nail down our workflow in Git (new company, young code base). One question I can't find a simple yet detailed answer to is what exactly does rebase on a remote branch do. I understand it rewrites the history, and in general should be limited to local branc... | 9,399 | 295,686 | 2024-10-12 23:58:28 | 39,833,386 | 25 | 2016-10-03 13:55:24 | 1,256,452 | 2016-10-03 13:55:24 | https://stackoverflow.com/q/39154794 | https://stackoverflow.com/a/39833386 | <p>It's not really <em>evil</em>, it's a matter of implementations and expectations.</p>
<p>We start with a tangle of facts:</p>
<ul>
<li><p>Every Git hash represents some unique object. For our purposes here we need only consider <em>commit</em> objects. Each hash is the result of applying a cryptographic hash fun... | <p>It's not really <em>evil</em>, it's a matter of implementations and expectations.</p> <p>We start with a tangle of facts:</p> <ul> <li><p>Every Git hash represents some unique object. For our purposes here we need only consider <em>commit</em> objects. Each hash is the result of applying a cryptographic hash fun... | 119, 29934 | git, git-rebase | <h1>Detailed reason why remote git rebase is so evil</h1>
<p>So I come from a centralized VCS background and am trying to nail down our workflow in Git (new company, young code base). One question I can't find a simple yet detailed answer to is what exactly does rebase on a remote branch do. I understand it rewrites th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,737 | git | # Detailed reason why remote git rebase is so evil
So I come from a centralized VCS background and am trying to nail down our workflow in Git (new company, young code base). One question I can't find a simple yet detailed answer to is what exactly does rebase on a remote branch do. I understand it rewrites the history... | It's not really *evil*, it's a matter of implementations and expectations.
We start with a tangle of facts:
- Every Git hash represents some unique object. For our purposes here we need only consider *commit* objects. Each hash is the result of applying a cryptographic hash function (for Git, specifically, it's SHA-1... |
12578665 | I can't see my remote branch | 6 | 2012-09-25 08:05:27 | <p>While waiting for the sysadmin to set up the gerrit repo, I made my own branch. He just now sent me the address of the repo. I set it for origin and somehow pushed my last commit. <strong>Cloning the repo works fine</strong>, however <code>git branch -r</code> returns nothing. What is going on here? </p>
<pre><cod... | 12,027 | 1,145,760 | 2016-01-16 15:04:43 | 12,579,558 | 25 | 2012-09-25 09:03:02 | 148,870 | 2012-09-25 09:03:02 | https://stackoverflow.com/q/12578665 | https://stackoverflow.com/a/12579558 | <p>Try this:</p>
<pre><code>git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
</code></pre>
<p>and then try <code>git branch -r</code> again.</p>
<p>In the future when setting up remotes, it's preferable to use the following command instead of <code>git config</code>:</p>
<pre><c... | <p>Try this:</p> <pre><code>git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git fetch origin </code></pre> <p>and then try <code>git branch -r</code> again.</p> <p>In the future when setting up remotes, it's preferable to use the following command instead of <code>git config</code>:</p> <pre><c... | 119 | git | <h1>I can't see my remote branch</h1>
<p>While waiting for the sysadmin to set up the gerrit repo, I made my own branch. He just now sent me the address of the repo. I set it for origin and somehow pushed my last commit. <strong>Cloning the repo works fine</strong>, however <code>git branch -r</code> returns nothing. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,738 | git | # I can't see my remote branch
While waiting for the sysadmin to set up the gerrit repo, I made my own branch. He just now sent me the address of the repo. I set it for origin and somehow pushed my last commit. **Cloning the repo works fine**, however `git branch -r` returns nothing. What is going on here?
```
$ git ... | Try this:
```
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
```
and then try `git branch -r` again.
In the future when setting up remotes, it's preferable to use the following command instead of `git config`:
```
git remote add <remotename> <remoteurl>
```
e.g.
```
git remo... |
29422101 | Automatically track remote branch with git | 407 | 2015-04-02 20:42:33 | <p>When I'm using a local branch <code>mybranch</code>, I'd like to be able to push to and pull from <code>origin mybranch</code> using just <code>git push</code> and <code>git pull</code>. As it is, I have to tediously write out <code>git push origin mybranch</code> and <code>git pull origin mybranch</code>. If I try ... | 173,249 | 1,467,997 | 2024-11-04 08:48:39 | 29,422,368 | 24 | 2015-04-02 21:00:07 | 1,256,452 | 2015-04-02 21:00:07 | https://stackoverflow.com/q/29422101 | https://stackoverflow.com/a/29422368 | <p>It's not github, it's your local git, that does all this.</p>
<p>If you are creating <code>mybranch</code> locally with <code>git checkout</code> <em>and</em> it already exists as <code>origin/mybranch</code> in your local repository, you can simply <code>git checkout mybranch</code> and your local git will see tha... | <p>It's not github, it's your local git, that does all this.</p> <p>If you are creating <code>mybranch</code> locally with <code>git checkout</code> <em>and</em> it already exists as <code>origin/mybranch</code> in your local repository, you can simply <code>git checkout mybranch</code> and your local git will see tha... | 119 | git | <h1>Automatically track remote branch with git</h1>
<p>When I'm using a local branch <code>mybranch</code>, I'd like to be able to push to and pull from <code>origin mybranch</code> using just <code>git push</code> and <code>git pull</code>. As it is, I have to tediously write out <code>git push origin mybranch</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,739 | git | # Automatically track remote branch with git
When I'm using a local branch `mybranch`, I'd like to be able to push to and pull from `origin mybranch` using just `git push` and `git pull`. As it is, I have to tediously write out `git push origin mybranch` and `git pull origin mybranch`. If I try to use just `git pull` ... | It's not github, it's your local git, that does all this.
If you are creating `mybranch` locally with `git checkout` *and* it already exists as `origin/mybranch` in your local repository, you can simply `git checkout mybranch` and your local git will see that `origin/mybranch` exists and create local `mybranch` with `... |
2129214 | How to backup a local Git repository? | 173 | 2010-01-24 22:40:58 | <p>I am using git on a relatively small project and I find that zipping the .git directory's contents might be a fine way to back up the project. But this is kind of weird because, when I restore, the first thing I need to do is <code>git reset --hard</code>.</p>
<p>Are there any problems with backing up a git repo th... | 157,821 | 8,047 | 2021-08-24 08:48:56 | 10,458,663 | 24 | 2012-05-05 03:45:23 | null | 2012-05-15 16:41:34 | https://stackoverflow.com/q/2129214 | https://stackoverflow.com/a/10458663 | <p>I started hacking away a bit on Yar's script and the result is on github, including man pages and install script:</p>
<p><a href="https://github.com/najamelan/git-backup" rel="noreferrer">https://github.com/najamelan/git-backup</a></p>
<p><strong>Installation</strong>:</p>
<pre><code>git clone "https://github.com... | <p>I started hacking away a bit on Yar's script and the result is on github, including man pages and install script:</p> <p><a href="https://github.com/najamelan/git-backup" rel="noreferrer">https://github.com/najamelan/git-backup</a></p> <p><strong>Installation</strong>:</p> <pre><code>git clone "https://github.com... | 119, 493 | backup, git | <h1>How to backup a local Git repository?</h1>
<p>I am using git on a relatively small project and I find that zipping the .git directory's contents might be a fine way to back up the project. But this is kind of weird because, when I restore, the first thing I need to do is <code>git reset --hard</code>.</p>
<p>Are t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,740 | git | # How to backup a local Git repository?
I am using git on a relatively small project and I find that zipping the .git directory's contents might be a fine way to back up the project. But this is kind of weird because, when I restore, the first thing I need to do is `git reset --hard`.
Are there any problems with back... | I started hacking away a bit on Yar's script and the result is on github, including man pages and install script:
<https://github.com/najamelan/git-backup>
**Installation**:
```
git clone "https://github.com/najamelan/git-backup.git"
cd git-backup
sudo ./install.sh
```
Welcoming all suggestions and pull request on ... |
14267441 | Automatically apply "git update-index --chmod=+x" to executable files | 92 | 2013-01-10 21:19:21 | <p>I frequently add bash scripts to my Git repository, and the scripts have executable permissions in the Linux filesystem prior to the <code>git add</code>. But after pushing the added files to a remote repository and pulling in another location, the files show up with non-executable permissions. There seem to be two ... | 122,860 | 351,410 | 2024-08-14 07:07:56 | 22,710,807 | 24 | 2014-03-28 10:53:34 | 3,472,102 | 2016-06-02 21:29:12 | https://stackoverflow.com/q/14267441 | https://stackoverflow.com/a/22710807 | <p>There are several ways to do that.</p>
<ol>
<li>Git aliases</li>
<li>Bash aliases</li>
<li>Or even combine bash and git aliases</li>
</ol>
<ol>
<li><p><strong>Git aliases</strong></p>
<p>You can always use bash within your git alias.</p>
<ul>
<li><p>Open your git config:</p>
<p><code>vim ~/.gitconfig</code></... | <p>There are several ways to do that.</p> <ol> <li>Git aliases</li> <li>Bash aliases</li> <li>Or even combine bash and git aliases</li> </ol> <ol> <li><p><strong>Git aliases</strong></p> <p>You can always use bash within your git alias.</p> <ul> <li><p>Open your git config:</p> <p><code>vim ~/.gitconfig</code></... | 119, 1135, 2120 | executable, file-permissions, git | <h1>Automatically apply "git update-index --chmod=+x" to executable files</h1>
<p>I frequently add bash scripts to my Git repository, and the scripts have executable permissions in the Linux filesystem prior to the <code>git add</code>. But after pushing the added files to a remote repository and pulling in another loc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,741 | git | # Automatically apply "git update-index --chmod=+x" to executable files
I frequently add bash scripts to my Git repository, and the scripts have executable permissions in the Linux filesystem prior to the `git add`. But after pushing the added files to a remote repository and pulling in another location, the files sho... | There are several ways to do that.
1. Git aliases
2. Bash aliases
3. Or even combine bash and git aliases
1. **Git aliases**
You can always use bash within your git alias.
- Open your git config:
`vim ~/.gitconfig`
- Add an aliases section to it (if one does not exist):
```
[alias]
... |
4523496 | Is it possible to pull from one repo and push to other one? | 74 | 2010-12-24 00:34:45 | <p>I have one repo in github which is public, there I have an Open source application i'm working on that is for making product catalogs, and small cms content.</p>
<p>I also have a private repository (not hosted in github) which is an application developed under the open source application hosted in github.</p>
<p>S... | 43,552 | 525,587 | 2025-09-09 21:57:52 | 4,523,509 | 24 | 2010-12-24 00:38:35 | 411,944 | 2010-12-24 00:38:35 | https://stackoverflow.com/q/4523496 | https://stackoverflow.com/a/4523509 | <p><code>git pull private master</code> and <code>git push github master</code> pulls from your private repo (given it's named like that) and pushes to github (might also be called <code>origin</code>). It's not SVN ;-)</p>
| <p><code>git pull private master</code> and <code>git push github master</code> pulls from your private repo (given it's named like that) and pushes to github (might also be called <code>origin</code>). It's not SVN ;-)</p> | 119, 7330 | git, repository | <h1>Is it possible to pull from one repo and push to other one?</h1>
<p>I have one repo in github which is public, there I have an Open source application i'm working on that is for making product catalogs, and small cms content.</p>
<p>I also have a private repository (not hosted in github) which is an application de... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,742 | git | # Is it possible to pull from one repo and push to other one?
I have one repo in github which is public, there I have an Open source application i'm working on that is for making product catalogs, and small cms content.
I also have a private repository (not hosted in github) which is an application developed under th... | `git pull private master` and `git push github master` pulls from your private repo (given it's named like that) and pushes to github (might also be called `origin`). It's not SVN ;-) |
15214977 | Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly | 70 | 2013-03-05 02:50:39 | <p>I am using SSH to clone a git repo to my web server, but every time I get this error</p>
<pre><code>$git clone git@github.com:aleccunningham/marjoram.git
Cloning into marjoram...
Host key verification failed.
</code></pre>
<p>I have tried almost everything that has shown up in Google searches, and I am dumbfounded... | 171,380 | 2,134,076 | 2018-11-20 19:59:23 | 15,215,834 | 24 | 2013-03-05 04:29:18 | 529,196 | 2013-03-05 04:29:18 | https://stackoverflow.com/q/15214977 | https://stackoverflow.com/a/15215834 | <p>Resolved the issue... you need to add the ssh public key to your github account.</p>
<ol>
<li>Verify that the ssh keys have been setup correctly.
<ol>
<li>Run <code>ssh-keygen</code> </li>
<li>Enter the password (keep the default path - <code>~/.ssh/id_rsa</code>)</li>
</ol></li>
<li><a href="https://help.github.c... | <p>Resolved the issue... you need to add the ssh public key to your github account.</p> <ol> <li>Verify that the ssh keys have been setup correctly. <ol> <li>Run <code>ssh-keygen</code> </li> <li>Enter the password (keep the default path - <code>~/.ssh/id_rsa</code>)</li> </ol></li> <li><a href="https://help.github.c... | 119, 25308 | git, ssh-keys | <h1>Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly</h1>
<p>I am using SSH to clone a git repo to my web server, but every time I get this error</p>
<pre><code>$git clone git@github.com:aleccunningham/marjoram.git
Cloning into marjoram...
Host key verification f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,743 | git | # Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly
I am using SSH to clone a git repo to my web server, but every time I get this error
```
$git clone git@github.com:aleccunningham/marjoram.git
Cloning into marjoram...
Host key verification failed.
```
I have t... | Resolved the issue... you need to add the ssh public key to your github account.
1. Verify that the ssh keys have been setup correctly.
1. Run `ssh-keygen`
2. Enter the password (keep the default path - `~/.ssh/id_rsa`)
2. [Add](https://help.github.com/articles/generating-ssh-keys) the public key (`~/.ssh/id_rsa... |
1298499 | git push not send changes to remote git repository | 62 | 2009-08-19 08:25:53 | <p>I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.</p>
<p>After run "git commit -a" on my local side, to send the changes to the remote, I run</p>
<pre><code>$ git push
Everything up-to-date
</c... | 213,762 | 156,458 | 2025-07-22 20:18:39 | 1,298,516 | 24 | 2009-08-19 08:28:51 | 43,582 | 2025-07-18 11:01:39 | https://stackoverflow.com/q/1298499 | https://stackoverflow.com/a/1298516 | <p>You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning <code>git push</code> gives you if it notices that this is the case.</p>
<p>Anyway, log in to the remote machine, change to the repository and do</p>
<pre><code>git checkou... | <p>You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning <code>git push</code> gives you if it notices that this is the case.</p> <p>Anyway, log in to the remote machine, change to the repository and do</p> <pre><code>git checkou... | 119, 4236 | git, push | <h1>git push not send changes to remote git repository</h1>
<p>I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.</p>
<p>After run "git commit -a" on my local side, to send the changes to the remot... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,744 | git | # git push not send changes to remote git repository
I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.
After run "git commit -a" on my local side, to send the changes to the remote, I run
```
$ git push
... | You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning `git push` gives you if it notices that this is the case.
Anyway, log in to the remote machine, change to the repository and do
```
git checkout <whatever branch you’re on>
... |
813822 | How to make git merge handle uncommitted changes to my working tree? | 58 | 2009-05-02 00:33:38 | <p>A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge them:</p>
<pre><code>$ git merge origin/master
Updating 1b8c5c6..eb44c23
... | 47,191 | 99,189 | 2019-03-19 01:50:59 | 813,827 | 24 | 2009-05-02 00:35:41 | 41,661 | 2009-05-02 00:35:41 | https://stackoverflow.com/q/813822 | https://stackoverflow.com/a/813827 | <p>As far as I can tell, the best you can do is what you already have with <code>git stash</code>. I too find it strange that merge wants to deal only with clean trees.</p>
| <p>As far as I can tell, the best you can do is what you already have with <code>git stash</code>. I too find it strange that merge wants to deal only with clean trees.</p> | 119, 13091, 28897 | git, git-merge, git-stash | <h1>How to make git merge handle uncommitted changes to my working tree?</h1>
<p>A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,745 | git | # How to make git merge handle uncommitted changes to my working tree?
A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge them:
... | As far as I can tell, the best you can do is what you already have with `git stash`. I too find it strange that merge wants to deal only with clean trees. |
2882620 | Is it possible to remote count object and size of git repository? | 57 | 2010-05-21 13:52:23 | <p>Assume that somewhere in the web exists public git repository. I want to clone it but firstly i need to be sure what is size of it (how much objects & kbytes like in <code>git count-objects</code>)</p>
<p>Is there a way to do it?</p>
| 27,674 | 251,920 | 2021-09-21 03:36:16 | 2,884,103 | 24 | 2010-05-21 17:16:21 | 119,963 | 2016-09-24 14:55:56 | https://stackoverflow.com/q/2882620 | https://stackoverflow.com/a/2884103 | <p>One little kludge you could use would be the following:</p>
<pre><code>mkdir repo-name
cd repo-name
git init
git remote add origin <URL of remote>
git fetch origin
</code></pre>
<p><code>git fetch</code> displays feedback along these lines:</p>
<pre><code>remote: Counting objects: 95815, done.
remote: Compr... | <p>One little kludge you could use would be the following:</p> <pre><code>mkdir repo-name cd repo-name git init git remote add origin <URL of remote> git fetch origin </code></pre> <p><code>git fetch</code> displays feedback along these lines:</p> <pre><code>remote: Counting objects: 95815, done. remote: Compr... | 119, 314, 7330 | git, repository, size | <h1>Is it possible to remote count object and size of git repository?</h1>
<p>Assume that somewhere in the web exists public git repository. I want to clone it but firstly i need to be sure what is size of it (how much objects & kbytes like in <code>git count-objects</code>)</p>
<p>Is there a way to do it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,746 | git | # Is it possible to remote count object and size of git repository?
Assume that somewhere in the web exists public git repository. I want to clone it but firstly i need to be sure what is size of it (how much objects & kbytes like in `git count-objects`)
Is there a way to do it? | One little kludge you could use would be the following:
```
mkdir repo-name
cd repo-name
git init
git remote add origin <URL of remote>
git fetch origin
```
`git fetch` displays feedback along these lines:
```
remote: Counting objects: 95815, done.
remote: Compressing objects: 100% (25006/25006), done.
remote: Total... |
51381826 | Git rebase in Visual Studio Code | 49 | 2018-07-17 12:49:11 | <p>Here is my situation: I have a production branch, a dev branch and branches for features. While I was working on a feature I has to do a hotfix on the dev branch. Now I to rebase the feature branch I am currently working on to avoid future merging conflicts. When I used to use IDEs from JetBrain I would do a git reb... | 252,630 | 7,823,909 | 2023-01-23 12:26:35 | 51,409,189 | 24 | 2018-07-18 18:55:59 | 578,288 | 2018-07-18 18:55:59 | https://stackoverflow.com/q/51381826 | https://stackoverflow.com/a/51409189 | <p>I don't think Visual Studio Code has Git rebase functionality built-in. If you want to do your rebasing in Visual Studio Code instead with the <code>git</code> command-line tool or with a <a href="https://git-scm.com/downloads/guis" rel="noreferrer">Git GUI</a>, you can install the <strong><a href="https://marketpla... | <p>I don't think Visual Studio Code has Git rebase functionality built-in. If you want to do your rebasing in Visual Studio Code instead with the <code>git</code> command-line tool or with a <a href="https://git-scm.com/downloads/guis" rel="noreferrer">Git GUI</a>, you can install the <strong><a href="https://marketpla... | 119, 111608 | git, visual-studio-code | <h1>Git rebase in Visual Studio Code</h1>
<p>Here is my situation: I have a production branch, a dev branch and branches for features. While I was working on a feature I has to do a hotfix on the dev branch. Now I to rebase the feature branch I am currently working on to avoid future merging conflicts. When I used to u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,749 | git | # Git rebase in Visual Studio Code
Here is my situation: I have a production branch, a dev branch and branches for features. While I was working on a feature I has to do a hotfix on the dev branch. Now I to rebase the feature branch I am currently working on to avoid future merging conflicts. When I used to use IDEs f... | I don't think Visual Studio Code has Git rebase functionality built-in. If you want to do your rebasing in Visual Studio Code instead with the `git` command-line tool or with a [Git GUI](https://git-scm.com/downloads/guis), you can install the **[GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitl... |
11929766 | How to delete all Git commits except the last five | 46 | 2012-08-13 07:21:04 | <p>I have a very large Git repository which only contains binary files which are changed pretty often. Naturally the Git repository is <strong>much</strong> larger than the actual files in it. I don't really care about old history, I only need some of the newer history to be able to revert some wrong changes. So let's ... | 32,167 | 274,473 | 2012-08-29 16:38:53 | 11,937,116 | 24 | 2012-08-13 15:08:04 | 649,852 | 2012-08-29 16:38:53 | https://stackoverflow.com/q/11929766 | https://stackoverflow.com/a/11937116 | <p>Here's an <code>rebase-last-five</code> alias to get you started. It will recreate the current branch so only the most recent five commits are in the history. It's probably best to make this a script (<code>git-rebase-last-five.sh</code>) that is available in a directory on your <code>PATH</code>; Git will find an... | <p>Here's an <code>rebase-last-five</code> alias to get you started. It will recreate the current branch so only the most recent five commits are in the history. It's probably best to make this a script (<code>git-rebase-last-five.sh</code>) that is available in a directory on your <code>PATH</code>; Git will find an... | 119 | git | <h1>How to delete all Git commits except the last five</h1>
<p>I have a very large Git repository which only contains binary files which are changed pretty often. Naturally the Git repository is <strong>much</strong> larger than the actual files in it. I don't really care about old history, I only need some of the newe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,752 | git | # How to delete all Git commits except the last five
I have a very large Git repository which only contains binary files which are changed pretty often. Naturally the Git repository is **much** larger than the actual files in it. I don't really care about old history, I only need some of the newer history to be able t... | Here's an `rebase-last-five` alias to get you started. It will recreate the current branch so only the most recent five commits are in the history. It's probably best to make this a script (`git-rebase-last-five.sh`) that is available in a directory on your `PATH`; Git will find and use scripts named `git-....sh` witho... |
7805274 | pause git clone and resume later? | 46 | 2011-10-18 09:43:44 | <p>Is there a way to pause git clone and resume it later? I'm cloning a really big repo (around 2GB) and my PC's been turned on for more than 40 hours. I have school to catch later, I don't want to leave it like this. Anybody got an idea? It's already at 67% btw. :(</p>
| 34,977 | 588,051 | 2019-08-05 18:47:02 | 7,805,382 | 24 | 2011-10-18 09:52:48 | 223,092 | 2011-10-18 09:52:48 | https://stackoverflow.com/q/7805274 | https://stackoverflow.com/a/7805382 | <p>Assuming it's a normal <code>git clone</code>, I'm afraid that they're not resumable, as far as I know. To add support for resumable <code>git clone</code> / <code>git fetch</code> has been a suggested project for the Google Summer of Code in the past.</p>
<p>One exception is if you're actually doing a <code>git s... | <p>Assuming it's a normal <code>git clone</code>, I'm afraid that they're not resumable, as far as I know. To add support for resumable <code>git clone</code> / <code>git fetch</code> has been a suggested project for the Google Summer of Code in the past.</p> <p>One exception is if you're actually doing a <code>git s... | 119, 34099 | git, git-clone | <h1>pause git clone and resume later?</h1>
<p>Is there a way to pause git clone and resume it later? I'm cloning a really big repo (around 2GB) and my PC's been turned on for more than 40 hours. I have school to catch later, I don't want to leave it like this. Anybody got an idea? It's already at 67% btw. :(</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,753 | git | # pause git clone and resume later?
Is there a way to pause git clone and resume it later? I'm cloning a really big repo (around 2GB) and my PC's been turned on for more than 40 hours. I have school to catch later, I don't want to leave it like this. Anybody got an idea? It's already at 67% btw. :( | Assuming it's a normal `git clone`, I'm afraid that they're not resumable, as far as I know. To add support for resumable `git clone` / `git fetch` has been a suggested project for the Google Summer of Code in the past.
One exception is if you're actually doing a `git svn clone`, then you can restart it by changing in... |
2456954 | git encrypt/decrypt remote repository files while push/pull | 46 | 2010-03-16 18:14:39 | <p>Is it possible to automatically encrypt files via 'git push' before transferring to a remote repository? And automatically decode them while 'git pull'.</p>
<p>I.e, if I have some remote server with shared access with git repository there, and I don't want our project to be stolen without a permission...
Maybe ther... | 27,766 | 225,568 | 2019-06-05 21:48:10 | 2,457,006 | 24 | 2010-03-16 18:21:20 | 6,309 | 2018-07-02 16:29:55 | https://stackoverflow.com/q/2456954 | https://stackoverflow.com/a/2457006 | <p>Yes and no.</p>
<p>You could try to depend on hook but that supposes they are installed at the remote locations, and that is not always reliable.</p>
<p>Another way to achieve almost the same effect would be by using a <strong><a href="https://stackoverflow.com/questions/2154948/how-can-i-track-system-specific-con... | <p>Yes and no.</p> <p>You could try to depend on hook but that supposes they are installed at the remote locations, and that is not always reliable.</p> <p>Another way to achieve almost the same effect would be by using a <strong><a href="https://stackoverflow.com/questions/2154948/how-can-i-track-system-specific-con... | 119, 219 | encryption, git | <h1>git encrypt/decrypt remote repository files while push/pull</h1>
<p>Is it possible to automatically encrypt files via 'git push' before transferring to a remote repository? And automatically decode them while 'git pull'.</p>
<p>I.e, if I have some remote server with shared access with git repository there, and I d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,754 | git | # git encrypt/decrypt remote repository files while push/pull
Is it possible to automatically encrypt files via 'git push' before transferring to a remote repository? And automatically decode them while 'git pull'.
I.e, if I have some remote server with shared access with git repository there, and I don't want our pr... | Yes and no.
You could try to depend on hook but that supposes they are installed at the remote locations, and that is not always reliable.
Another way to achieve almost the same effect would be by using a **[smudge/clean attribute filter driver](https://stackoverflow.com/questions/2154948/how-can-i-track-system-speci... |
10020641 | git squash and preserve last commit's timestamp | 39 | 2012-04-04 23:24:31 | <p>Consider I have commits</p>
<pre><code>... -- A -- B -- C
</code></pre>
<p>If I use <code>git rebase -i</code> to squash all three commits into one, we could</p>
<pre><code>pick A
squash B
squash C
</code></pre>
<p>I see the resulted commit <code>A</code> has its original timestamp. How could make it inherit the... | 5,233 | 153,133 | 2016-12-08 15:00:23 | 10,021,196 | 24 | 2012-04-05 00:35:48 | 712,605 | 2012-04-05 00:35:48 | https://stackoverflow.com/q/10020641 | https://stackoverflow.com/a/10021196 | <p>There's not a trivial way to do this, but there are a few options. Here's one:</p>
<pre><code>git commit --amend --date="$(git show -s --pretty=tformat:%ai <sha1-of-C>)"
</code></pre>
<p>And another:</p>
<pre><code>git commit --amend -c <sha1-of-C>
</code></pre>
<p>The latter will clobber your exist... | <p>There's not a trivial way to do this, but there are a few options. Here's one:</p> <pre><code>git commit --amend --date="$(git show -s --pretty=tformat:%ai <sha1-of-C>)" </code></pre> <p>And another:</p> <pre><code>git commit --amend -c <sha1-of-C> </code></pre> <p>The latter will clobber your exist... | 119 | git | <h1>git squash and preserve last commit's timestamp</h1>
<p>Consider I have commits</p>
<pre><code>... -- A -- B -- C
</code></pre>
<p>If I use <code>git rebase -i</code> to squash all three commits into one, we could</p>
<pre><code>pick A
squash B
squash C
</code></pre>
<p>I see the resulted commit <code>A</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,755 | git | # git squash and preserve last commit's timestamp
Consider I have commits
```
... -- A -- B -- C
```
If I use `git rebase -i` to squash all three commits into one, we could
```
pick A
squash B
squash C
```
I see the resulted commit `A` has its original timestamp. How could make it inherit the timestamp of commit `... | There's not a trivial way to do this, but there are a few options. Here's one:
```
git commit --amend --date="$(git show -s --pretty=tformat:%ai <sha1-of-C>)"
```
And another:
```
git commit --amend -c <sha1-of-C>
```
The latter will clobber your existing commit message, so you'll have to rewrite it. |
60160453 | VS Code - The git repository has too many active changes, only a subset of Git features will be enabled | 36 | 2020-02-11 00:38:28 | <p>I am setting up VS Code to work on an existing Salesforce project saved in BitBucket.</p>
<p>I cloned the repository down to my device and now when I open VS Code I get the message</p>
<blockquote>
<p>The git repository at 'C:\Users[my repository directory]' has too many active changes, only a subset of Git features... | 165,034 | 12,875,400 | 2025-07-20 20:01:53 | 60,162,579 | 24 | 2020-02-11 05:35:17 | 6,309 | 2025-07-20 20:01:53 | https://stackoverflow.com/q/60160453 | https://stackoverflow.com/a/60162579 | <p>Check with <a href="https://stackoverflow.com/a/35204436/6309"><code>git ls-files --eol</code> (Git 2.8+)</a> if this is an eol issue.</p>
<p>If yes, then:</p>
<ul>
<li>type <code>git config --global core.autocrlf false</code></li>
<li>re-clone your repository</li>
<li>check if the issue persists on VSCode: since co... | <p>Check with <a href="https://stackoverflow.com/a/35204436/6309"><code>git ls-files --eol</code> (Git 2.8+)</a> if this is an eol issue.</p> <p>If yes, then:</p> <ul> <li>type <code>git config --global core.autocrlf false</code></li> <li>re-clone your repository</li> <li>check if the issue persists on VSCode: since co... | 119, 8337, 111608 | bitbucket, git, visual-studio-code | <h1>VS Code - The git repository has too many active changes, only a subset of Git features will be enabled</h1>
<p>I am setting up VS Code to work on an existing Salesforce project saved in BitBucket.</p>
<p>I cloned the repository down to my device and now when I open VS Code I get the message</p>
<blockquote>
<p>The... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,756 | git | # VS Code - The git repository has too many active changes, only a subset of Git features will be enabled
I am setting up VS Code to work on an existing Salesforce project saved in BitBucket.
I cloned the repository down to my device and now when I open VS Code I get the message
> The git repository at 'C:\Users[my ... | Check with [`git ls-files --eol` (Git 2.8+)](https://stackoverflow.com/a/35204436/6309) if this is an eol issue.
If yes, then:
- type `git config --global core.autocrlf false`
- re-clone your repository
- check if the issue persists on VSCode: since core.autocrlf attemps to modify *all* files, disable it could avoid ... |
8522619 | How do I get the list of files about to be updated by `git pull` without knowing the branch name or what it tracks? | 32 | 2011-12-15 15:37:25 | <p>How do I get the list of files that are about to be updated (or were just updated) by <code>git pull</code> so i can parse them and take appropriate action in a script?</p>
<p>The accepted answer to <a href="https://stackoverflow.com/questions/2284931/is-there-a-simple-way-to-know-which-files-will-be-updated-in-the... | 19,761 | 400,691 | 2018-09-01 17:11:08 | 8,522,692 | 24 | 2011-12-15 15:43:28 | 589,746 | 2011-12-15 15:57:37 | https://stackoverflow.com/q/8522619 | https://stackoverflow.com/a/8522692 | <p>Assuming you know the name of the remote (in my examples, origin) then you could simply go:</p>
<pre><code>git fetch && git diff --name-only ..origin
templates/shows/showBase.html
templates/shows/showList.html
templates/shows/showListEntry.htm
</code></pre>
<p>Or if you wanted to sort into individual comm... | <p>Assuming you know the name of the remote (in my examples, origin) then you could simply go:</p> <pre><code>git fetch && git diff --name-only ..origin templates/shows/showBase.html templates/shows/showList.html templates/shows/showListEntry.htm </code></pre> <p>Or if you wanted to sort into individual comm... | 119 | git | <h1>How do I get the list of files about to be updated by `git pull` without knowing the branch name or what it tracks?</h1>
<p>How do I get the list of files that are about to be updated (or were just updated) by <code>git pull</code> so i can parse them and take appropriate action in a script?</p>
<p>The accepted an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,760 | git | # How do I get the list of files about to be updated by `git pull` without knowing the branch name or what it tracks?
How do I get the list of files that are about to be updated (or were just updated) by `git pull` so i can parse them and take appropriate action in a script?
The accepted answer to [this similar looki... | Assuming you know the name of the remote (in my examples, origin) then you could simply go:
```
git fetch && git diff --name-only ..origin
templates/shows/showBase.html
templates/shows/showList.html
templates/shows/showListEntry.htm
```
Or if you wanted to sort into individual commits, you could use whatchanged:
``... |
19380840 | What happens in the child branch if I delete a parent branch in git | 31 | 2013-10-15 12:08:36 | <p>I am planning to rename a branch in my git repository. I found out that the easy way to do that is to make a new branch from that branch and give it the desired name. </p>
<p>After that I want to delete the old branch (the parent). But I'm afraid that I will lose data in my new branch if I do that. </p>
<p>What ha... | 14,911 | 1,444,019 | 2019-04-25 12:46:11 | 19,381,179 | 24 | 2013-10-15 12:23:42 | 6,309 | 2016-09-09 10:38:14 | https://stackoverflow.com/q/19380840 | https://stackoverflow.com/a/19381179 | <p>What happens? nothing.</p>
<p>If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit.<br>
As long as those commits are referenced by a branch HEAD (or are part of the branch HEAD ancestors), they aren't lost.<br>
And even if... | <p>What happens? nothing.</p> <p>If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit.<br> As long as those commits are referenced by a branch HEAD (or are part of the branch HEAD ancestors), they aren't lost.<br> And even if... | 119, 456, 76220 | git, git-branch, version-control | <h1>What happens in the child branch if I delete a parent branch in git</h1>
<p>I am planning to rename a branch in my git repository. I found out that the easy way to do that is to make a new branch from that branch and give it the desired name. </p>
<p>After that I want to delete the old branch (the parent). But I'm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,761 | git | # What happens in the child branch if I delete a parent branch in git
I am planning to rename a branch in my git repository. I found out that the easy way to do that is to make a new branch from that branch and give it the desired name.
After that I want to delete the old branch (the parent). But I'm afraid that I wi... | What happens? nothing.
If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit.
As long as those commits are referenced by a branch HEAD (or are part of the branch HEAD ancestors), they aren't lost.
And even if they are no l... |
19758915 | Keeping a branch up to date with master | 30 | 2013-11-03 22:22:31 | <p>I have a remote repository that I've pulled and am branching from. I want to keep the new branch up to date with changes done to master. I'm thinking about the workflow below, does it make sense or are there are better ways to do this?</p>
<ol>
<li><p>Initial branching and checkout:</p>
<pre><code>git checkout m... | 56,025 | 172,617 | 2013-11-03 23:56:50 | 19,759,728 | 24 | 2013-11-03 23:56:50 | 1,870,481 | 2013-11-03 23:56:50 | https://stackoverflow.com/q/19758915 | https://stackoverflow.com/a/19759728 | <p>You can simplify your commands:</p>
<p>1.</p>
<pre><code>git fetch
git checkout -b my_branch origin/master
</code></pre>
<p>2.</p>
<pre><code>git fetch
git merge origin/master
</code></pre>
<p><code>git fetch</code> updates your remote branches, there usually is no need to have a local copy of a branch when you... | <p>You can simplify your commands:</p> <p>1.</p> <pre><code>git fetch git checkout -b my_branch origin/master </code></pre> <p>2.</p> <pre><code>git fetch git merge origin/master </code></pre> <p><code>git fetch</code> updates your remote branches, there usually is no need to have a local copy of a branch when you... | 119, 28897, 76220 | git, git-branch, git-merge | <h1>Keeping a branch up to date with master</h1>
<p>I have a remote repository that I've pulled and am branching from. I want to keep the new branch up to date with changes done to master. I'm thinking about the workflow below, does it make sense or are there are better ways to do this?</p>
<ol>
<li><p>Initial branc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,762 | git | # Keeping a branch up to date with master
I have a remote repository that I've pulled and am branching from. I want to keep the new branch up to date with changes done to master. I'm thinking about the workflow below, does it make sense or are there are better ways to do this?
1. Initial branching and checkout:
`... | You can simplify your commands:
1.
```
git fetch
git checkout -b my_branch origin/master
```
2.
```
git fetch
git merge origin/master
```
`git fetch` updates your remote branches, there usually is no need to have a local copy of a branch when your are not planning to work on this branch.
You can omit the `--no-ff... |
16443501 | 'Fatal: cherry-pick failed' with Git | 30 | 2013-05-08 14:36:47 | <p>I was working on a branch <code>X</code>. I made a commit and pushed it. </p>
<p>Then I wanted to <code>cherry-pick</code> it to branch <code>Y</code>. But due to some unmerged files present, I got the following message:</p>
<pre><code>error: 'cherry-pick' is not possible because you have unmerged files.
hint: Fix... | 71,637 | 1,443,702 | 2013-05-09 02:41:42 | 16,453,479 | 24 | 2013-05-09 02:41:42 | 1,076,889 | 2013-05-09 02:41:42 | https://stackoverflow.com/q/16443501 | https://stackoverflow.com/a/16453479 | <p>Since you have already edited the conflict file, you just need </p>
<pre><code>git add mod/assign/locallib.php
</code></pre>
<p>then </p>
<pre><code>git cherry-pick --continue
</code></pre>
| <p>Since you have already edited the conflict file, you just need </p> <pre><code>git add mod/assign/locallib.php </code></pre> <p>then </p> <pre><code>git cherry-pick --continue </code></pre> | 119, 36489 | cherry-pick, git | <h1>'Fatal: cherry-pick failed' with Git</h1>
<p>I was working on a branch <code>X</code>. I made a commit and pushed it. </p>
<p>Then I wanted to <code>cherry-pick</code> it to branch <code>Y</code>. But due to some unmerged files present, I got the following message:</p>
<pre><code>error: 'cherry-pick' is not possi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,763 | git | # 'Fatal: cherry-pick failed' with Git
I was working on a branch `X`. I made a commit and pushed it.
Then I wanted to `cherry-pick` it to branch `Y`. But due to some unmerged files present, I got the following message:
```
error: 'cherry-pick' is not possible because you have unmerged files.
hint: Fix them up in the... | Since you have already edited the conflict file, you just need
```
git add mod/assign/locallib.php
```
then
```
git cherry-pick --continue
``` |
9561835 | Git push - suboptimal pack - out of memory | 29 | 2012-03-05 04:57:40 | <p>I could really use some help here.</p>
<p>I just created a new bare repo to act as a production target for dev pushes.
I also have the working web directory on the server as a git repo.
The server is running git 1.7.4.1 on centos5.5</p>
<p>After creating the new repo in the web directory, I performed a git add .
I... | 37,272 | 485,710 | 2020-07-28 14:58:55 | 9,564,910 | 24 | 2012-03-05 10:14:10 | 266,720 | 2012-03-06 11:34:07 | https://stackoverflow.com/q/9561835 | https://stackoverflow.com/a/9564910 | <ol>
<li>May be git is suboptimal tool for handling large amount of big blobs.</li>
<li>You can disable multi-threaded compression to save memory: <code>git config pack.threads 1</code> (in addition to other memory limiting options, like <code>core.bigfilethreshold</code> in newer Git)</li>
</ol>
| <ol> <li>May be git is suboptimal tool for handling large amount of big blobs.</li> <li>You can disable multi-threaded compression to save memory: <code>git config pack.threads 1</code> (in addition to other memory limiting options, like <code>core.bigfilethreshold</code> in newer Git)</li> </ol> | 61, 119, 28898 | git, git-push, memory | <h1>Git push - suboptimal pack - out of memory</h1>
<p>I could really use some help here.</p>
<p>I just created a new bare repo to act as a production target for dev pushes.
I also have the working web directory on the server as a git repo.
The server is running git 1.7.4.1 on centos5.5</p>
<p>After creating the new ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,764 | git | # Git push - suboptimal pack - out of memory
I could really use some help here.
I just created a new bare repo to act as a production target for dev pushes.
I also have the working web directory on the server as a git repo.
The server is running git 1.7.4.1 on centos5.5
After creating the new repo in the web directo... | 1. May be git is suboptimal tool for handling large amount of big blobs.
2. You can disable multi-threaded compression to save memory: `git config pack.threads 1` (in addition to other memory limiting options, like `core.bigfilethreshold` in newer Git) |
4629358 | Show only history of one branch in a Git log | 29 | 2011-01-07 19:16:14 | <p>I am using Git for my project and trying to follow best practice:</p>
<ol>
<li>I work on a <em>topic branch</em></li>
<li>When ready, I merge the <em>topic branch</em> into my <em>dev</em> branch using <code>git merge --squash</code>. This keeps my <em>dev</em> branch clean.</li>
<li>Whenever the <em>dev</em> branc... | 27,343 | 166,272 | 2017-07-29 20:47:39 | 4,629,437 | 24 | 2011-01-07 19:26:36 | 251,305 | 2011-01-07 19:54:29 | https://stackoverflow.com/q/4629358 | https://stackoverflow.com/a/4629437 | <p>If I'm understanding you correctly, you want to see the merges back into master, but not the history of those merges. I believe that:</p>
<pre><code>git log --merges
</code></pre>
<p>will give you what you want.</p>
<p>UPDATE: Adding --first-parent should fix this from the sounds of it.</p>
<pre><code>git log --... | <p>If I'm understanding you correctly, you want to see the merges back into master, but not the history of those merges. I believe that:</p> <pre><code>git log --merges </code></pre> <p>will give you what you want.</p> <p>UPDATE: Adding --first-parent should fix this from the sounds of it.</p> <pre><code>git log --... | 119, 47913, 53847 | branching-and-merging, git, git-log | <h1>Show only history of one branch in a Git log</h1>
<p>I am using Git for my project and trying to follow best practice:</p>
<ol>
<li>I work on a <em>topic branch</em></li>
<li>When ready, I merge the <em>topic branch</em> into my <em>dev</em> branch using <code>git merge --squash</code>. This keeps my <em>dev</em> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,765 | git | # Show only history of one branch in a Git log
I am using Git for my project and trying to follow best practice:
1. I work on a *topic branch*
2. When ready, I merge the *topic branch* into my *dev* branch using `git merge --squash`. This keeps my *dev* branch clean.
3. Whenever the *dev* branch is stable and the tea... | If I'm understanding you correctly, you want to see the merges back into master, but not the history of those merges. I believe that:
```
git log --merges
```
will give you what you want.
UPDATE: Adding --first-parent should fix this from the sounds of it.
```
git log --merges --first-parent
```
> --first-parent
>... |
11356901 | git-svn clone | spurious branches | 28 | 2012-07-06 06:24:01 | <p>I used the following command to clone svn repo into git and after executing it, i see some spurious branches.</p>
<p><code>git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp</code></p>
<p><code>git branch -a</code></p>
<pre><code>*(no branch)
master
remotes/abc-1.3.x
remo... | 7,394 | 930,618 | 2013-01-03 02:15:47 | 13,394,122 | 24 | 2012-11-15 08:54:48 | 43,681 | 2013-01-03 02:15:47 | https://stackoverflow.com/q/11356901 | https://stackoverflow.com/a/13394122 | <p>tl;dr:</p>
<p><code>git svn</code> creates these "@"-branches if a branch (or tag) was created for a subdirectory (or for another directory which is not tracked by git-svn). There will always also be a "regular" branch with the same name, but without the "@" suffix. The "@"-branch only exists as a branching point f... | <p>tl;dr:</p> <p><code>git svn</code> creates these "@"-branches if a branch (or tag) was created for a subdirectory (or for another directory which is not tracked by git-svn). There will always also be a "regular" branch with the same name, but without the "@" suffix. The "@"-branch only exists as a branching point f... | 119, 6452, 76220 | git, git-branch, git-svn | <h1>git-svn clone | spurious branches</h1>
<p>I used the following command to clone svn repo into git and after executing it, i see some spurious branches.</p>
<p><code>git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp</code></p>
<p><code>git branch -a</code></p>
<pre><code>*(no ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,766 | git | # git-svn clone | spurious branches
I used the following command to clone svn repo into git and after executing it, i see some spurious branches.
`git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp`
`git branch -a`
```
*(no branch)
master
remotes/abc-1.3.x
remotes/abc-1.3.x... | tl;dr:
`git svn` creates these "@"-branches if a branch (or tag) was created for a subdirectory (or for another directory which is not tracked by git-svn). There will always also be a "regular" branch with the same name, but without the "@" suffix. The "@"-branch only exists as a branching point for the regular branch... |
55860925 | Git Skip Worktree on All Tracked Files inside Directory and its Subdirectories | 27 | 2019-04-26 04:41:40 | <p>Let's say I have this worktree that has already been tracked by git.</p>
<pre><code>.
├── parent
│ ├── child1
│ | └── file1.txt
│ ├── child2
│ | ├── file2.txt
│ | └── grandchild
│ | └── file3.txt
│ ├── somefile.txt
│ └── anotherfile.txt
|
</code></pre>
<p>I want to mark every track... | 11,051 | 8,004,798 | 2019-11-24 19:07:21 | 55,860,969 | 24 | 2019-04-26 04:49:43 | 6,309 | 2019-11-24 19:07:21 | https://stackoverflow.com/q/55860925 | https://stackoverflow.com/a/55860969 | <p><a href="https://stackoverflow.com/q/16346535/6309">Similarly to assume-unchanged</a>, you need to apply this command to all files within a folder:</p>
<pre><code>find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git ls-files -z ${pwd} | xargs -0 git update-index --skip-wor... | <p><a href="https://stackoverflow.com/q/16346535/6309">Similarly to assume-unchanged</a>, you need to apply this command to all files within a folder:</p> <pre><code>find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git ls-files -z ${pwd} | xargs -0 git update-index --skip-wor... | 119, 111134 | git, git-skip-worktree | <h1>Git Skip Worktree on All Tracked Files inside Directory and its Subdirectories</h1>
<p>Let's say I have this worktree that has already been tracked by git.</p>
<pre><code>.
├── parent
│ ├── child1
│ | └── file1.txt
│ ├── child2
│ | ├── file2.txt
│ | └── grandchild
│ | └── file3.txt
│ ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,768 | git | # Git Skip Worktree on All Tracked Files inside Directory and its Subdirectories
Let's say I have this worktree that has already been tracked by git.
```
.
├── parent
│ ├── child1
│ | └── file1.txt
│ ├── child2
│ | ├── file2.txt
│ | └── grandchild
│ | └── file3.txt
│ ├── somefile.txt
│ ... | [Similarly to assume-unchanged](https://stackoverflow.com/q/16346535/6309), you need to apply this command to all files within a folder:
```
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git ls-files -z ${pwd} | xargs -0 git update-index --skip-worktree" \;
```
(there is no "recursive" o... |
50252181 | Git: How to ignore changes to a tracked file? | 26 | 2018-05-09 11:23:05 | <p>I have a file with database settings in my project which I have set to some defaults. The file is tracked by <code>Git</code> and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell <code>Git</code> to ignore new changes to this file?</p>
<p>I tried... | 12,875 | 4,632,019 | 2019-03-26 10:16:48 | 55,351,856 | 24 | 2019-03-26 07:32:34 | 2,705,757 | 2019-03-26 10:16:48 | https://stackoverflow.com/q/50252181 | https://stackoverflow.com/a/55351856 | <p>One may use <code>git update-index --skip-worktree FILE</code> for this purpose.</p>
<p>It is similar to <code>--assume-unchanged</code> but, unlike <code>--assume-unchanged</code>, <a href="https://stackoverflow.com/a/13631525/2705757">is not just an unpredictable performance trick</a>.</p>
<p>To cancel <code>--s... | <p>One may use <code>git update-index --skip-worktree FILE</code> for this purpose.</p> <p>It is similar to <code>--assume-unchanged</code> but, unlike <code>--assume-unchanged</code>, <a href="https://stackoverflow.com/a/13631525/2705757">is not just an unpredictable performance trick</a>.</p> <p>To cancel <code>--s... | 119, 3574, 25056 | config, git, gitignore | <h1>Git: How to ignore changes to a tracked file?</h1>
<p>I have a file with database settings in my project which I have set to some defaults. The file is tracked by <code>Git</code> and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell <code>Git</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,769 | git | # Git: How to ignore changes to a tracked file?
I have a file with database settings in my project which I have set to some defaults. The file is tracked by `Git` and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell `Git` to ignore new changes to th... | One may use `git update-index --skip-worktree FILE` for this purpose.
It is similar to `--assume-unchanged` but, unlike `--assume-unchanged`, [is not just an unpredictable performance trick](https://stackoverflow.com/a/13631525/2705757).
To cancel `--skip-worktree` effects and unset the flag use `--no-skip-worktree`.... |
30704128 | get commits since a particular date in git based on commit date | 26 | 2015-06-08 08:13:09 | <p>To get commits after a particular date. I can do this:</p>
<pre><code>git log <ref> --since=<date> --pretty=format:%ci
</code></pre>
<p>This seems to list commits based on author date. How do I get commits after a particular date <em>based on commit time</em> ? I can parse the output of above cmd to ge... | 12,877 | 1,897,845 | 2015-06-25 21:30:56 | 31,046,467 | 24 | 2015-06-25 09:33:32 | 2,206,295 | 2015-06-25 09:33:32 | https://stackoverflow.com/q/30704128 | https://stackoverflow.com/a/31046467 | <p>Your query is not that clear to me but I would like to answer with best of my understanding:
as we know, with ref: <a href="http://git-scm.com/docs/pretty-formats">http://git-scm.com/docs/pretty-formats</a></p>
<pre><code>%ai: author date, ISO 8601-like format
%ci: committer date, ISO 8601-like format
</code></pre>... | <p>Your query is not that clear to me but I would like to answer with best of my understanding: as we know, with ref: <a href="http://git-scm.com/docs/pretty-formats">http://git-scm.com/docs/pretty-formats</a></p> <pre><code>%ai: author date, ISO 8601-like format %ci: committer date, ISO 8601-like format </code></pre>... | 119, 53850 | git, git-commit | <h1>get commits since a particular date in git based on commit date</h1>
<p>To get commits after a particular date. I can do this:</p>
<pre><code>git log <ref> --since=<date> --pretty=format:%ci
</code></pre>
<p>This seems to list commits based on author date. How do I get commits after a particular date ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,770 | git | # get commits since a particular date in git based on commit date
To get commits after a particular date. I can do this:
```
git log <ref> --since=<date> --pretty=format:%ci
```
This seems to list commits based on author date. How do I get commits after a particular date *based on commit time* ? I can parse the outp... | Your query is not that clear to me but I would like to answer with best of my understanding:
as we know, with ref: <http://git-scm.com/docs/pretty-formats>
```
%ai: author date, ISO 8601-like format
%ci: committer date, ISO 8601-like format
```
Is this of any help? Using **--after** and **--before** to get results in... |
13772550 | Deleting all commits in a branch after certain commit | 26 | 2012-12-07 23:16:27 | <p>I'm having a difficult time grasping how I can use rebase/revert to accomplish this.</p>
<p>I was working on my <code>master</code> branch and after a certain commit my software stopped working. I did not want to loose the changes made at the time and I was pressured on time to reach a milestone so I went back a fe... | 30,344 | 1,043,817 | 2016-05-06 20:34:22 | 13,775,148 | 24 | 2012-12-08 06:30:57 | 159,607 | 2012-12-08 06:30:57 | https://stackoverflow.com/q/13772550 | https://stackoverflow.com/a/13775148 | <p>You have two options:</p>
<p><strong>Rewrite history (destructive)</strong></p>
<p>You can use <code>git-rebase</code> to rewrite history, ommiting these commits. You can run an interactive rebase. From your description, I'm not certain exactly what you have in <code>master</code> and <code>working</code>, but I a... | <p>You have two options:</p> <p><strong>Rewrite history (destructive)</strong></p> <p>You can use <code>git-rebase</code> to rewrite history, ommiting these commits. You can run an interactive rebase. From your description, I'm not certain exactly what you have in <code>master</code> and <code>working</code>, but I a... | 119, 8337 | bitbucket, git | <h1>Deleting all commits in a branch after certain commit</h1>
<p>I'm having a difficult time grasping how I can use rebase/revert to accomplish this.</p>
<p>I was working on my <code>master</code> branch and after a certain commit my software stopped working. I did not want to loose the changes made at the time and I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,771 | git | # Deleting all commits in a branch after certain commit
I'm having a difficult time grasping how I can use rebase/revert to accomplish this.
I was working on my `master` branch and after a certain commit my software stopped working. I did not want to loose the changes made at the time and I was pressured on time to r... | You have two options:
**Rewrite history (destructive)**
You can use `git-rebase` to rewrite history, ommiting these commits. You can run an interactive rebase. From your description, I'm not certain exactly what you have in `master` and `working`, but I am assuming all the history (wanted and unwanted) is present the... |
7344577 | Is there a way to ask git diff to show the method name instead of the class name? | 26 | 2011-09-08 07:28:25 | <p>This has been bugging me for a while and searching has yielded no hints.</p>
<p><strong>Issue:</strong></p>
<p>When I do a <code>git diff</code> on a PHP file containing a <code>Class</code>, each hunk description has the class name with no mention of the method name.</p>
<p><strong>For example:</strong></p>
<pr... | 6,296 | 383,786 | 2020-10-28 22:10:35 | 7,347,993 | 24 | 2011-09-08 12:27:39 | 383,786 | 2017-10-18 20:12:24 | https://stackoverflow.com/q/7344577 | https://stackoverflow.com/a/7347993 | <p>If you find yourself having this issue, it might be due to the fact that <code>git</code> lets <code>diff</code> define the hunk header. If you want to force <code>git</code> to use its predefined ones for PHP place the following line in either <code>.gitattributes</code> in the root folder of your git repository or... | <p>If you find yourself having this issue, it might be due to the fact that <code>git</code> lets <code>diff</code> define the hunk header. If you want to force <code>git</code> to use its predefined ones for PHP place the following line in either <code>.gitattributes</code> in the root folder of your git repository or... | 5, 119, 606 | diff, git, php | <h1>Is there a way to ask git diff to show the method name instead of the class name?</h1>
<p>This has been bugging me for a while and searching has yielded no hints.</p>
<p><strong>Issue:</strong></p>
<p>When I do a <code>git diff</code> on a PHP file containing a <code>Class</code>, each hunk description has the cl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,772 | git | # Is there a way to ask git diff to show the method name instead of the class name?
This has been bugging me for a while and searching has yielded no hints.
**Issue:**
When I do a `git diff` on a PHP file containing a `Class`, each hunk description has the class name with no mention of the method name.
**For exampl... | If you find yourself having this issue, it might be due to the fact that `git` lets `diff` define the hunk header. If you want to force `git` to use its predefined ones for PHP place the following line in either `.gitattributes` in the root folder of your git repository or the `.git/info/attributes` file in your reposi... |
43770520 | how to specify default merge strategy on git stash pop | 25 | 2017-05-03 21:46:15 | <p>How can I specify default merge strategy when I do a <code>git stash pop</code>?</p>
<p>I tried</p>
<pre><code>git stash pop --theirs
</code></pre>
<p>but that doesn't work.</p>
| 5,342 | 1,812,732 | 2020-07-19 00:51:51 | 62,975,210 | 24 | 2020-07-19 00:51:51 | 676,226 | 2020-07-19 00:51:51 | https://stackoverflow.com/q/43770520 | https://stackoverflow.com/a/62975210 | <p>This is now possible:</p>
<pre><code>git cherry-pick -n -m1 -Xtheirs stash
</code></pre>
<p>The literal string <code>stash</code> now represents the top stash entry (you can also do <code>stash@{1}</code> for the one below that, and so on.</p>
<p>More details on how this works are on <a href="https://stackoverflow.c... | <p>This is now possible:</p> <pre><code>git cherry-pick -n -m1 -Xtheirs stash </code></pre> <p>The literal string <code>stash</code> now represents the top stash entry (you can also do <code>stash@{1}</code> for the one below that, and so on.</p> <p>More details on how this works are on <a href="https://stackoverflow.c... | 119 | git | <h1>how to specify default merge strategy on git stash pop</h1>
<p>How can I specify default merge strategy when I do a <code>git stash pop</code>?</p>
<p>I tried</p>
<pre><code>git stash pop --theirs
</code></pre>
<p>but that doesn't work.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,773 | git | # how to specify default merge strategy on git stash pop
How can I specify default merge strategy when I do a `git stash pop`?
I tried
```
git stash pop --theirs
```
but that doesn't work. | This is now possible:
```
git cherry-pick -n -m1 -Xtheirs stash
```
The literal string `stash` now represents the top stash entry (you can also do `stash@{1}` for the one below that, and so on.
More details on how this works are on [this answer](https://stackoverflow.com/questions/19314287/can-i-influence-the-merge-... |
56612400 | Not a valid git branch name | 24 | 2019-06-15 16:56:39 | <p>I am trying to create a new branch under feature tag of my repo, I am using following to do this:</p>
<pre><code> git branch "feature/BA-302-[AU]Intl-BCard"
</code></pre>
<p>However I am getting:</p>
<p><code>fatal: 'feature/BA-302-[AU]Intl-BCard' is not a valid branch name</cod... | 56,996 | 2,822,178 | 2024-03-16 23:23:23 | 56,612,449 | 24 | 2019-06-15 17:03:37 | 1,030,675 | 2022-10-25 12:09:43 | https://stackoverflow.com/q/56612400 | https://stackoverflow.com/a/56612449 | <p><code>[</code> is not allowed in a branch name. See <a href="https://git-scm.com/docs/git-check-ref-format" rel="noreferrer">man-page for <code>git-check-ref-format</code></a> or <a href="https://wincent.com/wiki/Legal_Git_branch_names" rel="noreferrer">here</a> for more details.</p>
<p>In <code>zsh</code>, <code>[.... | <p><code>[</code> is not allowed in a branch name. See <a href="https://git-scm.com/docs/git-check-ref-format" rel="noreferrer">man-page for <code>git-check-ref-format</code></a> or <a href="https://wincent.com/wiki/Legal_Git_branch_names" rel="noreferrer">here</a> for more details.</p> <p>In <code>zsh</code>, <code>[.... | 119, 76220 | git, git-branch | <h1>Not a valid git branch name</h1>
<p>I am trying to create a new branch under feature tag of my repo, I am using following to do this:</p>
<pre><code> git branch "feature/BA-302-[AU]Intl-BCard"
</code></pre>
<p>However I am getting:</p>
<p><code>fatal: 'feature/BA-302-[AU]Intl-B... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,774 | git | # Not a valid git branch name
I am trying to create a new branch under feature tag of my repo, I am using following to do this:
```
git branch "feature/BA-302-[AU]Intl-BCard"
```
However I am getting:
`fatal: 'feature/BA-302-[AU]Intl-BCard' is not a valid branch name`
Not sure, what I am missing. Also to clarify,... | `[` is not allowed in a branch name. See [man-page for `git-check-ref-format`](https://git-scm.com/docs/git-check-ref-format) or [here](https://wincent.com/wiki/Legal_Git_branch_names) for more details.
In `zsh`, `[...]` defines a character class the shell tries to match. If there's no match, you get the error `zsh: n... |
62598858 | git submodule vs npm package? | 23 | 2020-06-26 16:18:48 | <p>I'm using git submodules to build and share components between projects. The projects are not in production yet, so at this point submodules are serving them well.</p>
<p>But I'm concerned about maintenance and deployment. Would it be a good idea to transform the submodules into npm packages?</p>
| 18,227 | 12,300,522 | 2024-06-25 17:57:49 | 62,605,719 | 24 | 2020-06-27 04:02:32 | 565,877 | 2024-06-25 17:57:49 | https://stackoverflow.com/q/62598858 | https://stackoverflow.com/a/62605719 | <p>An npm package will allow fragmentation across different package versions. On the other hand, git submodules have a bit of a learning curve, and the tooling is really not that good. With git submodules, you have all the source in one folder.</p>
<p>If it's at <em>all</em> possible, I'd recommend using a plain monore... | <p>An npm package will allow fragmentation across different package versions. On the other hand, git submodules have a bit of a learning curve, and the tooling is really not that good. With git submodules, you have all the source in one folder.</p> <p>If it's at <em>all</em> possible, I'd recommend using a plain monore... | 41612 | git-submodules | <h1>git submodule vs npm package?</h1>
<p>I'm using git submodules to build and share components between projects. The projects are not in production yet, so at this point submodules are serving them well.</p>
<p>But I'm concerned about maintenance and deployment. Would it be a good idea to transform the submodules int... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,777 | git | # git submodule vs npm package?
I'm using git submodules to build and share components between projects. The projects are not in production yet, so at this point submodules are serving them well.
But I'm concerned about maintenance and deployment. Would it be a good idea to transform the submodules into npm packages? | An npm package will allow fragmentation across different package versions. On the other hand, git submodules have a bit of a learning curve, and the tooling is really not that good. With git submodules, you have all the source in one folder.
If it's at *all* possible, I'd recommend using a plain monorepo for all proje... |
8130954 | When is git rm -f used? | 23 | 2011-11-15 02:57:35 | <p>I am learning Git and am unable to understand under what condition the -f flag is used while issuing the "git rm" command. Please explain a scenario where rm -f would be required instead of rm only?</p>
| 24,565 | 205,230 | 2018-04-19 00:04:06 | 8,130,989 | 24 | 2011-11-15 03:05:39 | 275,354 | 2011-11-15 19:14:53 | https://stackoverflow.com/q/8130954 | https://stackoverflow.com/a/8130989 | <h2>Explanation:</h2>
<p>The <code>-f</code> is used to remove a file if the file is not up to date with your last checked out commit. It is to prevent you from removing a file that you have made changes to, but have not yet checked them in.<br />
<br>
<br></p>
<h2>Example:</h2>
<p>You check out commit <em>0a12d4</em>... | <h2>Explanation:</h2> <p>The <code>-f</code> is used to remove a file if the file is not up to date with your last checked out commit. It is to prevent you from removing a file that you have made changes to, but have not yet checked them in.<br /> <br> <br></p> <h2>Example:</h2> <p>You check out commit <em>0a12d4</em>... | 119, 112901 | git, git-rm | <h1>When is git rm -f used?</h1>
<p>I am learning Git and am unable to understand under what condition the -f flag is used while issuing the "git rm" command. Please explain a scenario where rm -f would be required instead of rm only?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,780 | git | # When is git rm -f used?
I am learning Git and am unable to understand under what condition the -f flag is used while issuing the "git rm" command. Please explain a scenario where rm -f would be required instead of rm only? | ## Explanation:
The `-f` is used to remove a file if the file is not up to date with your last checked out commit. It is to prevent you from removing a file that you have made changes to, but have not yet checked them in.
## Example:
You check out commit *0a12d4* that contains the file *sample.txt*. Before you chang... |
37758202 | How do you apply patch file downloaded from gerrit? | 22 | 2016-06-10 22:57:42 | <p>In Gerrit, under the download section for a change, there is a section that allows you to download the Patch-File:</p>
<p><a href="https://i.sstatic.net/YCJNY.png" rel="noreferrer"><img src="https://i.sstatic.net/YCJNY.png" alt="enter image description here"></a></p>
<p>Using <code>git apply</code> results in:</p>... | 21,558 | 1,294,207 | 2021-10-08 02:10:10 | 42,035,672 | 24 | 2017-02-04 01:54:59 | 10,278 | 2017-02-04 01:54:59 | https://stackoverflow.com/q/37758202 | https://stackoverflow.com/a/42035672 | <pre><code>base64 --decode c6a9dcdb.diff.base64 > c6a9dcdb.diff
git apply c6a9dcdb.diff
</code></pre>
<p>(Replace c6a9dcdb with whatever abbreviated commit hash Gerrit gave you.) </p>
| <pre><code>base64 --decode c6a9dcdb.diff.base64 > c6a9dcdb.diff git apply c6a9dcdb.diff </code></pre> <p>(Replace c6a9dcdb with whatever abbreviated commit hash Gerrit gave you.) </p> | 119, 52272 | gerrit, git | <h1>How do you apply patch file downloaded from gerrit?</h1>
<p>In Gerrit, under the download section for a change, there is a section that allows you to download the Patch-File:</p>
<p><a href="https://i.sstatic.net/YCJNY.png" rel="noreferrer"><img src="https://i.sstatic.net/YCJNY.png" alt="enter image description he... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,781 | git | # How do you apply patch file downloaded from gerrit?
In Gerrit, under the download section for a change, there is a section that allows you to download the Patch-File:
[](https://i.sstatic.net/YCJNY.png)
Using `git apply` results in:
```
$ git apply 4... | ```
base64 --decode c6a9dcdb.diff.base64 > c6a9dcdb.diff
git apply c6a9dcdb.diff
```
(Replace c6a9dcdb with whatever abbreviated commit hash Gerrit gave you.) |
10748749 | How to rename commit messages in Git? | 22 | 2012-05-25 05:10:45 | <p>I understand that this is a bad idea for lots of scenarios. I am learning Git and experimenting. No code will be harmed in this exercise.</p>
<p>I have created a structure like this:</p>
<pre><code>* [cf0149e] (HEAD, branch_2) more editing
* [8fcc106] some edit
|
| * [59e643e] (branch_2b) branch 2b
| /
|/
| * ... | 39,386 | 576,311 | 2022-10-25 07:47:00 | 10,748,927 | 24 | 2012-05-25 05:30:15 | 1,256,452 | 2014-08-13 16:19:05 | https://stackoverflow.com/q/10748749 | https://stackoverflow.com/a/10748927 | <p>You can't actually ever change a commit. If you make the tiniest single-bit change anywhere, from the spelling of the name in the email line to the exact second of the commit timestamp, you get a new, different commit with a new, different SHA1 (the SHA1 is the "true name", as it were, of each "object" in the git d... | <p>You can't actually ever change a commit. If you make the tiniest single-bit change anywhere, from the spelling of the name in the email line to the exact second of the commit timestamp, you get a new, different commit with a new, different SHA1 (the SHA1 is the "true name", as it were, of each "object" in the git d... | 119 | git | <h1>How to rename commit messages in Git?</h1>
<p>I understand that this is a bad idea for lots of scenarios. I am learning Git and experimenting. No code will be harmed in this exercise.</p>
<p>I have created a structure like this:</p>
<pre><code>* [cf0149e] (HEAD, branch_2) more editing
* [8fcc106] some edit
|
| ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,783 | git | # How to rename commit messages in Git?
I understand that this is a bad idea for lots of scenarios. I am learning Git and experimenting. No code will be harmed in this exercise.
I have created a structure like this:
```
* [cf0149e] (HEAD, branch_2) more editing
* [8fcc106] some edit
|
| * [59e643e] (branch_2b) bran... | You can't actually ever change a commit. If you make the tiniest single-bit change anywhere, from the spelling of the name in the email line to the exact second of the commit timestamp, you get a new, different commit with a new, different SHA1 (the SHA1 is the "true name", as it were, of each "object" in the git datab... |
3698369 | Git rebase got 'unlink of file failed' error | 22 | 2010-09-13 07:02:44 | <p>Using <strong>msysgit 1.7.0.2</strong>, when doing <code>git rebase -i</code>, it hangs and there's no message.<br>
After enter <kbd>ctrl+c</kbd>, I can see </p>
<pre><code>'unlink of file failed, should I try again (y/n)?'
</code></pre>
<p>Then I tried <code>git rebase --abort</code> but got same error message. S... | 38,322 | 248,430 | 2020-11-12 11:30:36 | 3,698,543 | 24 | 2010-09-13 07:35:25 | 6,309 | 2018-08-09 08:08:06 | https://stackoverflow.com/q/3698369 | https://stackoverflow.com/a/3698543 | <p>Did you try with <code>set GIT_ASK_YESNO=false</code>?</p>
<p>This <a href="http://groups.google.com/group/msysgit/browse_thread/thread/5367e417693a77c0" rel="nofollow noreferrer">Google group thread</a> mentions it in the recent mingw evolutions:</p>
<blockquote>
<p>Make use of the new environment variable <cod... | <p>Did you try with <code>set GIT_ASK_YESNO=false</code>?</p> <p>This <a href="http://groups.google.com/group/msysgit/browse_thread/thread/5367e417693a77c0" rel="nofollow noreferrer">Google group thread</a> mentions it in the recent mingw evolutions:</p> <blockquote> <p>Make use of the new environment variable <cod... | 119 | git | <h1>Git rebase got 'unlink of file failed' error</h1>
<p>Using <strong>msysgit 1.7.0.2</strong>, when doing <code>git rebase -i</code>, it hangs and there's no message.<br>
After enter <kbd>ctrl+c</kbd>, I can see </p>
<pre><code>'unlink of file failed, should I try again (y/n)?'
</code></pre>
<p>Then I tried <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,784 | git | # Git rebase got 'unlink of file failed' error
Using **msysgit 1.7.0.2**, when doing `git rebase -i`, it hangs and there's no message.
After enter `ctrl+c`, I can see
```
'unlink of file failed, should I try again (y/n)?'
```
Then I tried `git rebase --abort` but got same error message. So now it's stuck in the mi... | Did you try with `set GIT_ASK_YESNO=false`?
This [Google group thread](http://groups.google.com/group/msysgit/browse_thread/thread/5367e417693a77c0) mentions it in the recent mingw evolutions:
> Make use of the new environment variable `GIT_ASK_YESNO` to support the recently implemented fallback in case `unlink`, `re... |
2426654 | git svn status - showing changes that are not committed to svn | 22 | 2010-03-11 16:20:31 | <p>I'm looking for a command in git-svn that will show me the changes I have committed to my git repository but that aren't yet committed to the central svn repository. I'm looking for something that works like svn status, but I'm using git-svn, and unfortunately, <code>git svn status</code> is not a valid command.</p... | 8,171 | 2,030 | 2013-07-10 21:16:59 | 2,448,892 | 24 | 2010-03-15 16:53:14 | 2,030 | 2010-06-30 17:13:57 | https://stackoverflow.com/q/2426654 | https://stackoverflow.com/a/2448892 | <p>Assuming the branch for the remote Subversion repository is at remotes/git-svn, run the following:</p>
<pre><code>git svn fetch
</code></pre>
<p>The fetch will ensure that remotes/git-svn is up-to-date. (Thanks to Mark for pointing this out in a comment.)</p>
<pre><code>git diff --name-status remotes/git-svn
</co... | <p>Assuming the branch for the remote Subversion repository is at remotes/git-svn, run the following:</p> <pre><code>git svn fetch </code></pre> <p>The fetch will ensure that remotes/git-svn is up-to-date. (Thanks to Mark for pointing this out in a comment.)</p> <pre><code>git diff --name-status remotes/git-svn </co... | 6452 | git-svn | <h1>git svn status - showing changes that are not committed to svn</h1>
<p>I'm looking for a command in git-svn that will show me the changes I have committed to my git repository but that aren't yet committed to the central svn repository. I'm looking for something that works like svn status, but I'm using git-svn, a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,785 | git | # git svn status - showing changes that are not committed to svn
I'm looking for a command in git-svn that will show me the changes I have committed to my git repository but that aren't yet committed to the central svn repository. I'm looking for something that works like svn status, but I'm using git-svn, and unfortu... | Assuming the branch for the remote Subversion repository is at remotes/git-svn, run the following:
```
git svn fetch
```
The fetch will ensure that remotes/git-svn is up-to-date. (Thanks to Mark for pointing this out in a comment.)
```
git diff --name-status remotes/git-svn
```
This should show you the name and sta... |
52221558 | Programmatically check if HEAD is detached? | 21 | 2018-09-07 11:23:37 | <p>I want to know whether I'm in a "HEAD detached" state in a script.</p>
<p>Currently I parse the output of <code>git status</code> but I dislike doing so because I've heard that it's a bad practice to parse Git output that's meant for human - I want a program-friendly interface to tell me whether HEAD is detached. I... | 6,400 | 5,958,455 | 2024-02-23 08:49:06 | 52,222,248 | 24 | 2018-09-07 12:07:56 | 865,874 | 2018-09-07 12:07:56 | https://stackoverflow.com/q/52221558 | https://stackoverflow.com/a/52222248 | <p>The easiest command is probably:</p>
<pre><code>$ git symbolic-ref -q HEAD
</code></pre>
<p>and check the exit status: 0 means normal; 1 is detached.</p>
<p>From the docs of <code>git-symbolic-ref</code>:</p>
<pre><code>-q, --quiet
Do not issue an error message if the <name> is not a symbolic ref
but... | <p>The easiest command is probably:</p> <pre><code>$ git symbolic-ref -q HEAD </code></pre> <p>and check the exit status: 0 means normal; 1 is detached.</p> <p>From the docs of <code>git-symbolic-ref</code>:</p> <pre><code>-q, --quiet Do not issue an error message if the <name> is not a symbolic ref but... | 119, 98582 | git, git-detached-head | <h1>Programmatically check if HEAD is detached?</h1>
<p>I want to know whether I'm in a "HEAD detached" state in a script.</p>
<p>Currently I parse the output of <code>git status</code> but I dislike doing so because I've heard that it's a bad practice to parse Git output that's meant for human - I want a program-frie... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,787 | git | # Programmatically check if HEAD is detached?
I want to know whether I'm in a "HEAD detached" state in a script.
Currently I parse the output of `git status` but I dislike doing so because I've heard that it's a bad practice to parse Git output that's meant for human - I want a program-friendly interface to tell me w... | The easiest command is probably:
```
$ git symbolic-ref -q HEAD
```
and check the exit status: 0 means normal; 1 is detached.
From the docs of `git-symbolic-ref`:
```
-q, --quiet
Do not issue an error message if the <name> is not a symbolic ref
but a detached HEAD; instead exit with non-zero status silently.
... |
40835258 | Git: Check programmatically if anything is staged | 21 | 2016-11-27 23:46:11 | <p>For a Git script I'm writing, I'd like to have a programmatic way to check whether there is anything at all staged. i.e. I want a positive result if anything at all is staged, and negative if nothing is staged.</p>
<p>Bonus points: A way to programmatically check whether there is anything new in the working tree th... | 4,585 | 76,701 | 2023-09-29 20:20:45 | 40,835,537 | 24 | 2016-11-28 00:27:56 | 1,405,588 | 2016-11-28 00:27:56 | https://stackoverflow.com/q/40835258 | https://stackoverflow.com/a/40835537 | <p>You're looking for:</p>
<pre><code>git diff --cached --quiet
</code></pre>
<p>(or replace <code>--quiet</code> with <code>--exit-code</code> if you still want output)</p>
| <p>You're looking for:</p> <pre><code>git diff --cached --quiet </code></pre> <p>(or replace <code>--quiet</code> with <code>--exit-code</code> if you still want output)</p> | 119 | git | <h1>Git: Check programmatically if anything is staged</h1>
<p>For a Git script I'm writing, I'd like to have a programmatic way to check whether there is anything at all staged. i.e. I want a positive result if anything at all is staged, and negative if nothing is staged.</p>
<p>Bonus points: A way to programmatically... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,788 | git | # Git: Check programmatically if anything is staged
For a Git script I'm writing, I'd like to have a programmatic way to check whether there is anything at all staged. i.e. I want a positive result if anything at all is staged, and negative if nothing is staged.
Bonus points: A way to programmatically check whether t... | You're looking for:
```
git diff --cached --quiet
```
(or replace `--quiet` with `--exit-code` if you still want output) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.