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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23122621 | Checkout (discard changes) on files with only whitespace/lineending changes | 15 | 2014-04-17 00:37:02 | <p>Is there a command/option/filter to discard the changes (via a checkout) on all the modified files whose changes only affect whitespace?</p>
<p>Alternatively, staging only files with non-whitespace changes (including staging their whitespace changes) would be fine.</p>
| 3,385 | 3,603 | 2017-02-25 07:53:50 | 23,125,843 | 21 | 2014-04-17 06:13:14 | 6,309 | 2014-04-17 06:13:14 | https://stackoverflow.com/q/23122621 | https://stackoverflow.com/a/23125843 | <p>You could:</p>
<ul>
<li><p>first apply all non-whitespace changes (see "<a href="https://stackoverflow.com/a/7149602/6309">Git add only non-whitespace changes</a>")</p>
<pre><code>git diff -w --no-color | git apply --cached --ignore-whitespace
</code></pre></li>
<li><p>clean any other changes (see "<a href="https:... | <p>You could:</p> <ul> <li><p>first apply all non-whitespace changes (see "<a href="https://stackoverflow.com/a/7149602/6309">Git add only non-whitespace changes</a>")</p> <pre><code>git diff -w --no-color | git apply --cached --ignore-whitespace </code></pre></li> <li><p>clean any other changes (see "<a href="https:... | 119 | git | <h1>Checkout (discard changes) on files with only whitespace/lineending changes</h1>
<p>Is there a command/option/filter to discard the changes (via a checkout) on all the modified files whose changes only affect whitespace?</p>
<p>Alternatively, staging only files with non-whitespace changes (including staging their ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,371 | git | # Checkout (discard changes) on files with only whitespace/lineending changes
Is there a command/option/filter to discard the changes (via a checkout) on all the modified files whose changes only affect whitespace?
Alternatively, staging only files with non-whitespace changes (including staging their whitespace chang... | You could:
- first apply all non-whitespace changes (see "[Git add only non-whitespace changes](https://stackoverflow.com/a/7149602/6309)")
```
git diff -w --no-color | git apply --cached --ignore-whitespace
```
- clean any other changes (see "[How do you discard unstaged changes in git?](https://stackoverflow.... |
18126637 | How to apply `git --no-pager` for specific commands? | 15 | 2013-08-08 12:56:19 | <p>I realize that you can do <code>git --no-pager <command></code> to prevent the output from being run through a pager. I also realize you can use, for instance, <code>git config --global core.pager cat</code>.</p>
<p>However there are some commands where I do want to use the pager automatically, e.g. <code>dif... | 4,108 | 454,533 | 2022-08-16 04:39:00 | 18,129,365 | 21 | 2013-08-08 14:58:38 | null | 2013-08-08 15:31:37 | https://stackoverflow.com/q/18126637 | https://stackoverflow.com/a/18129365 | <p>As <a href="https://stackoverflow.com/questions/4225350/turning-off-the-pager-in-git-for-the-stash-command-only/8172857#8172857">this answer points out</a>, you can use <code>pager.stash false</code> to turn off pagination for <code>stash</code>:</p>
<pre><code>git config --global pager.stash false
</code></pre>
<... | <p>As <a href="https://stackoverflow.com/questions/4225350/turning-off-the-pager-in-git-for-the-stash-command-only/8172857#8172857">this answer points out</a>, you can use <code>pager.stash false</code> to turn off pagination for <code>stash</code>:</p> <pre><code>git config --global pager.stash false </code></pre> <... | 119, 3791 | git, zsh | <h1>How to apply `git --no-pager` for specific commands?</h1>
<p>I realize that you can do <code>git --no-pager <command></code> to prevent the output from being run through a pager. I also realize you can use, for instance, <code>git config --global core.pager cat</code>.</p>
<p>However there are some commands ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,372 | git | # How to apply `git --no-pager` for specific commands?
I realize that you can do `git --no-pager <command>` to prevent the output from being run through a pager. I also realize you can use, for instance, `git config --global core.pager cat`.
However there are some commands where I do want to use the pager automatical... | As [this answer points out](https://stackoverflow.com/questions/4225350/turning-off-the-pager-in-git-for-the-stash-command-only/8172857#8172857), you can use `pager.stash false` to turn off pagination for `stash`:
```
git config --global pager.stash false
```
More generally, you can use `pager.<command>` with other c... |
13877469 | How to disable git push when there are TODOs in code? | 15 | 2012-12-14 11:08:33 | <p>We are having an issue in our team and we have decided to check if there is a way or git command to reject git push where there are TODOs in the code.
Any ideas?
Thanks in advance.</p>
| 4,702 | 844,451 | 2023-09-21 09:29:04 | 13,912,426 | 21 | 2012-12-17 10:33:26 | 844,451 | 2023-06-30 09:50:09 | https://stackoverflow.com/q/13877469 | https://stackoverflow.com/a/13912426 | <p><strong>EDIT:</strong> because of grep behaviour in if statement we needed to edit our script:</p>
<pre><code>#!/bin/sh
for FILE in `git diff --name-only --cached`; do
grep 'TODO' $FILE 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo $FILE ' contains TODO'
exit 1
fi
done
exit
</code... | <p><strong>EDIT:</strong> because of grep behaviour in if statement we needed to edit our script:</p> <pre><code>#!/bin/sh for FILE in `git diff --name-only --cached`; do grep 'TODO' $FILE 2>&1 >/dev/null if [ $? -eq 0 ]; then echo $FILE ' contains TODO' exit 1 fi done exit </code... | 119, 4236, 49036 | git, push, todo | <h1>How to disable git push when there are TODOs in code?</h1>
<p>We are having an issue in our team and we have decided to check if there is a way or git command to reject git push where there are TODOs in the code.
Any ideas?
Thanks in advance.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,373 | git | # How to disable git push when there are TODOs in code?
We are having an issue in our team and we have decided to check if there is a way or git command to reject git push where there are TODOs in the code.
Any ideas?
Thanks in advance. | **EDIT:** because of grep behaviour in if statement we needed to edit our script:
```
#!/bin/sh
for FILE in `git diff --name-only --cached`; do
grep 'TODO' $FILE 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo $FILE ' contains TODO'
exit 1
fi
done
exit
```
Is not possible use pre-receive hooks... |
5730611 | How do I remove an invalid remote I added in Git? | 15 | 2011-04-20 12:51:40 | <p>Here's the line I fired:</p>
<pre><code>git remote add Nakor git://github.com.nakor/CherryTomato.git
</code></pre>
<p>I made a mistake and the command should have been:</p>
<pre><code>git remote add Nakor git://github.com/nakor/CherryTomato.git
</code></pre>
<p>When I try to run the second command, I get this er... | 14,610 | 699,978 | 2017-12-15 11:35:16 | 5,730,640 | 21 | 2011-04-20 12:54:42 | 112,968 | 2011-04-20 14:12:40 | https://stackoverflow.com/q/5730611 | https://stackoverflow.com/a/5730640 | <p>you can use the <code>set-url</code> subcommand of git remote:</p>
<pre><code>git remote set-url Nakor git://github.com/nakor/CherryTomato.git
</code></pre>
| <p>you can use the <code>set-url</code> subcommand of git remote:</p> <pre><code>git remote set-url Nakor git://github.com/nakor/CherryTomato.git </code></pre> | 119 | git | <h1>How do I remove an invalid remote I added in Git?</h1>
<p>Here's the line I fired:</p>
<pre><code>git remote add Nakor git://github.com.nakor/CherryTomato.git
</code></pre>
<p>I made a mistake and the command should have been:</p>
<pre><code>git remote add Nakor git://github.com/nakor/CherryTomato.git
</code></p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,375 | git | # How do I remove an invalid remote I added in Git?
Here's the line I fired:
```
git remote add Nakor git://github.com.nakor/CherryTomato.git
```
I made a mistake and the command should have been:
```
git remote add Nakor git://github.com/nakor/CherryTomato.git
```
When I try to run the second command, I get this ... | you can use the `set-url` subcommand of git remote:
```
git remote set-url Nakor git://github.com/nakor/CherryTomato.git
``` |
3088609 | How do i move my current work to a topic branch? | 15 | 2010-06-21 21:21:40 | <p>I started on a simple task in the main branch. ya' know the type of task where "this is too simple even to bother with a git branch"... the inevitable result was that now I have a lot of unfinished work in the master branch and need to work on other things. How do I move my current work to a new branch?</p>
| 819 | 90,801 | 2015-03-12 08:36:45 | 3,088,635 | 21 | 2010-06-21 21:26:40 | 309,308 | 2010-06-21 21:26:40 | https://stackoverflow.com/q/3088609 | https://stackoverflow.com/a/3088635 | <p>You can switch branches with a dirty tree, as long as the switch doesn't involve modifying dirty files. Since you're creating a new branch it's guaranteed not to:</p>
<pre><code>git checkout -b new-branch
</code></pre>
<p>Once you've done that you can commit and switch back to master. You can also commit first, al... | <p>You can switch branches with a dirty tree, as long as the switch doesn't involve modifying dirty files. Since you're creating a new branch it's guaranteed not to:</p> <pre><code>git checkout -b new-branch </code></pre> <p>Once you've done that you can commit and switch back to master. You can also commit first, al... | 119 | git | <h1>How do i move my current work to a topic branch?</h1>
<p>I started on a simple task in the main branch. ya' know the type of task where "this is too simple even to bother with a git branch"... the inevitable result was that now I have a lot of unfinished work in the master branch and need to work on other things. H... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,376 | git | # How do i move my current work to a topic branch?
I started on a simple task in the main branch. ya' know the type of task where "this is too simple even to bother with a git branch"... the inevitable result was that now I have a lot of unfinished work in the master branch and need to work on other things. How do I m... | You can switch branches with a dirty tree, as long as the switch doesn't involve modifying dirty files. Since you're creating a new branch it's guaranteed not to:
```
git checkout -b new-branch
```
Once you've done that you can commit and switch back to master. You can also commit first, although it's slightly more w... |
1194385 | Seeing what revision goes with a tag in Git | 15 | 2009-07-28 14:14:47 | <p>Beginner <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> question:</p>
<p>In the <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a> world, <code>hg tags</code> gives me a list of tags and the corresponding revisions, whereas <code>git tag</code> only l... | 8,860 | 26,819 | 2014-03-10 06:22:23 | 1,194,410 | 21 | 2009-07-28 14:18:11 | 63,841 | 2012-03-13 17:29:31 | https://stackoverflow.com/q/1194385 | https://stackoverflow.com/a/1194410 | <p>For full information associated with that tag, use command</p>
<pre><code>git show v1.5
</code></pre>
<p>Or you can see the lightweight information, skipping details, by command</p>
<pre><code>git show v1.5 -lw
</code></pre>
| <p>For full information associated with that tag, use command</p> <pre><code>git show v1.5 </code></pre> <p>Or you can see the lightweight information, skipping details, by command</p> <pre><code>git show v1.5 -lw </code></pre> | 119, 456, 3346, 60718 | dvcs, git, git-tag, version-control | <h1>Seeing what revision goes with a tag in Git</h1>
<p>Beginner <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> question:</p>
<p>In the <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a> world, <code>hg tags</code> gives me a list of tags and the corresp... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,377 | git | # Seeing what revision goes with a tag in Git
Beginner [Git](http://en.wikipedia.org/wiki/Git_%28software%29) question:
In the [Mercurial](http://en.wikipedia.org/wiki/Mercurial) world, `hg tags` gives me a list of tags and the corresponding revisions, whereas `git tag` only lists the tag names. How do I see what the... | For full information associated with that tag, use command
```
git show v1.5
```
Or you can see the lightweight information, skipping details, by command
```
git show v1.5 -lw
``` |
57106256 | How to remove some files from commit checklist Android Studio? | 14 | 2019-07-19 05:51:23 | <p>I would like to commit changes which I did in my AS project. But I see that changeslist contains <code>release</code> folder:</p>
<p><a href="https://i.sstatic.net/Szpel.jpg" rel="noreferrer"><img src="https://i.sstatic.net/Szpel.jpg" alt="enter image description here"></a></p>
<p>It means that I will commit worka... | 19,861 | 9,363,441 | 2023-04-06 13:30:32 | 57,106,706 | 21 | 2019-07-19 06:26:34 | 10,249,146 | 2021-12-23 18:46:30 | https://stackoverflow.com/q/57106256 | https://stackoverflow.com/a/57106706 | <p>First Things first:</p>
<p>You can add a .gitignore file to your repository, via terminal, by the commands below:</p>
<ol>
<li>In Terminal, navigate to the location of your Git repository.</li>
<li>Enter <code>touch .gitignore</code> to create a .gitignore file.</li>
</ol>
<p>Second, you should pay attention that, I... | <p>First Things first:</p> <p>You can add a .gitignore file to your repository, via terminal, by the commands below:</p> <ol> <li>In Terminal, navigate to the location of your Git repository.</li> <li>Enter <code>touch .gitignore</code> to create a .gitignore file.</li> </ol> <p>Second, you should pay attention that, I... | 119, 1386, 91905 | android, android-studio, git | <h1>How to remove some files from commit checklist Android Studio?</h1>
<p>I would like to commit changes which I did in my AS project. But I see that changeslist contains <code>release</code> folder:</p>
<p><a href="https://i.sstatic.net/Szpel.jpg" rel="noreferrer"><img src="https://i.sstatic.net/Szpel.jpg" alt="ente... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,380 | git | # How to remove some files from commit checklist Android Studio?
I would like to commit changes which I did in my AS project. But I see that changeslist contains `release` folder:
[](https://i.sstatic.net/Szpel.jpg)
It means that I will commit workable ... | First Things first:
You can add a .gitignore file to your repository, via terminal, by the commands below:
1. In Terminal, navigate to the location of your Git repository.
2. Enter `touch .gitignore` to create a .gitignore file.
Second, you should pay attention that, If you already have a file checked in and you wan... |
56545643 | --follow-tags doesn't seem to be working on `git push` | 14 | 2019-06-11 14:08:42 | <p>Here's my repro:</p>
<pre><code>$ mkdir git-test
$ cd git-test
$ git init
$ echo "hello world" >> test_file.txt
$ git add .
$ git commit -m "made a change"
$ git tag v1.0.0
$ git push -u --follow-tags origin master
</code></pre>
<p>Now if I go to my upstream repo, it has the commit but <em>not</em> the tag!<... | 3,173 | 11,631,582 | 2019-06-11 14:29:15 | 56,546,026 | 21 | 2019-06-11 14:29:15 | 7,976,758 | 2019-06-11 14:29:15 | https://stackoverflow.com/q/56545643 | https://stackoverflow.com/a/56546026 | <blockquote>
<p>push <strong>annotated tags</strong> in refs/tags that are missing from the remote but are pointing at committish that are reachable from the</p>
</blockquote>
<p><code>git tag v1.0.0</code> created a lightweight, non-annotated tag. Delete it and create an annotated tag:</p>
<pre><code>$ git tag -d ... | <blockquote> <p>push <strong>annotated tags</strong> in refs/tags that are missing from the remote but are pointing at committish that are reachable from the</p> </blockquote> <p><code>git tag v1.0.0</code> created a lightweight, non-annotated tag. Delete it and create an annotated tag:</p> <pre><code>$ git tag -d ... | 119 | git | <h1>--follow-tags doesn't seem to be working on `git push`</h1>
<p>Here's my repro:</p>
<pre><code>$ mkdir git-test
$ cd git-test
$ git init
$ echo "hello world" >> test_file.txt
$ git add .
$ git commit -m "made a change"
$ git tag v1.0.0
$ git push -u --follow-tags origin master
</code></pre>
<p>Now if I go t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,381 | git | # --follow-tags doesn't seem to be working on `git push`
Here's my repro:
```
$ mkdir git-test
$ cd git-test
$ git init
$ echo "hello world" >> test_file.txt
$ git add .
$ git commit -m "made a change"
$ git tag v1.0.0
$ git push -u --follow-tags origin master
```
Now if I go to my upstream repo, it has the commit b... | > push **annotated tags** in refs/tags that are missing from the remote but are pointing at committish that are reachable from the
`git tag v1.0.0` created a lightweight, non-annotated tag. Delete it and create an annotated tag:
```
$ git tag -d v1.0.0
$ git tag -a v1.0.0
``` |
23271424 | Issue with removing a git submodule | 14 | 2014-04-24 14:10:44 | <p>I have a question regarding removing git submodules. I'm organizing my config files and vim bundles using git, with the vim bundles as submodules. Now I'm trying to remove a submodule (per the instructions <a href="https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule/16162000#16162000">here</a... | 8,667 | 856,079 | 2021-12-12 03:13:08 | 26,264,500 | 21 | 2014-10-08 19:03:07 | 214,350 | 2014-10-08 19:03:07 | https://stackoverflow.com/q/23271424 | https://stackoverflow.com/a/26264500 | <p>You need to <code>rm -rf</code> without the git:</p>
<pre><code>rm -rf vim/bundle/snipmate-snippets
</code></pre>
<p>Then you can deinit the submodule:</p>
<pre><code>git submodule deinit vim/bundle/snipmate-snippets
</code></pre>
| <p>You need to <code>rm -rf</code> without the git:</p> <pre><code>rm -rf vim/bundle/snipmate-snippets </code></pre> <p>Then you can deinit the submodule:</p> <pre><code>git submodule deinit vim/bundle/snipmate-snippets </code></pre> | 119 | git | <h1>Issue with removing a git submodule</h1>
<p>I have a question regarding removing git submodules. I'm organizing my config files and vim bundles using git, with the vim bundles as submodules. Now I'm trying to remove a submodule (per the instructions <a href="https://stackoverflow.com/questions/1260748/how-do-i-remo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,382 | git | # Issue with removing a git submodule
I have a question regarding removing git submodules. I'm organizing my config files and vim bundles using git, with the vim bundles as submodules. Now I'm trying to remove a submodule (per the instructions [here](https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-su... | You need to `rm -rf` without the git:
```
rm -rf vim/bundle/snipmate-snippets
```
Then you can deinit the submodule:
```
git submodule deinit vim/bundle/snipmate-snippets
``` |
24892748 | Check out specific revision from Git repository with JGit | 14 | 2014-07-22 16:24:13 | <p>I am trying to use jGit to clone a repository and checkout a particular commit.</p>
<p>Assuming the commit hash is: 1e9ae842ca94f326215358917c620ac407323c81.</p>
<p>My first step is:</p>
<pre><code>// Cloning the repository
Git.cloneRepository()
.setURI(remotePath)
.setDirectory(localPath)
... | 7,735 | 1,876,047 | 2019-10-30 06:57:07 | 24,893,404 | 21 | 2014-07-22 17:00:31 | 2,986,905 | 2019-10-30 06:57:07 | https://stackoverflow.com/q/24892748 | https://stackoverflow.com/a/24893404 | <p>You will have to clone the repository first, thus your first step was right:</p>
<pre><code>Git.cloneRepository().setURI(remotePath).setDirectory(localPath).call();
</code></pre>
<p>To just checkout a commit by its id you can call <code>checkout</code> like this:</p>
<pre><code>git.checkout().setName("<id-to-c... | <p>You will have to clone the repository first, thus your first step was right:</p> <pre><code>Git.cloneRepository().setURI(remotePath).setDirectory(localPath).call(); </code></pre> <p>To just checkout a commit by its id you can call <code>checkout</code> like this:</p> <pre><code>git.checkout().setName("<id-to-c... | 17, 61058 | java, jgit | <h1>Check out specific revision from Git repository with JGit</h1>
<p>I am trying to use jGit to clone a repository and checkout a particular commit.</p>
<p>Assuming the commit hash is: 1e9ae842ca94f326215358917c620ac407323c81.</p>
<p>My first step is:</p>
<pre><code>// Cloning the repository
Git.cloneRepository... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,383 | git | # Check out specific revision from Git repository with JGit
I am trying to use jGit to clone a repository and checkout a particular commit.
Assuming the commit hash is: 1e9ae842ca94f326215358917c620ac407323c81.
My first step is:
```
// Cloning the repository
Git.cloneRepository()
.setURI(remotePath)
... | You will have to clone the repository first, thus your first step was right:
```
Git.cloneRepository().setURI(remotePath).setDirectory(localPath).call();
```
To just checkout a commit by its id you can call `checkout` like this:
```
git.checkout().setName("<id-to-commit>").call();
```
But note that this will result... |
23753566 | cannot spawn C:\ProgramFiles(x86)\Git\cmd\: No such file or directory. | 14 | 2014-05-20 07:32:40 | <p>I have a problem when I'm trying to clone with git on cygwin. My GIT_SSH is</p>
<pre><code> "C:\ProgramFiles(x86)\Git\bin\".
</code></pre>
<p>When I try to clone, here is the result:</p>
<pre><code>$ git clone ssh://*****/home/local/git/prestashop myDirectory
Cloning into 'myDirectory'...
error: cannot spawn C:\P... | 17,412 | 3,655,438 | 2021-12-13 12:54:29 | 23,753,779 | 21 | 2014-05-20 07:44:00 | 6,309 | 2015-10-29 15:46:16 | https://stackoverflow.com/q/23753566 | https://stackoverflow.com/a/23753779 | <p>Following <a href="https://stackoverflow.com/a/8713121/6309">Git with SSH on Windows</a>, you see that GIT_SSH should reference the ssh executable, not just its path:</p>
<pre><code>(old msysgit)
set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
(new 2015 git for Windows)
set GIT_SSH=C:\Program Files\Git\usr\bin\... | <p>Following <a href="https://stackoverflow.com/a/8713121/6309">Git with SSH on Windows</a>, you see that GIT_SSH should reference the ssh executable, not just its path:</p> <pre><code>(old msysgit) set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe (new 2015 git for Windows) set GIT_SSH=C:\Program Files\Git\usr\bin\... | 386, 34099 | git-clone, ssh | <h1>cannot spawn C:\ProgramFiles(x86)\Git\cmd\: No such file or directory.</h1>
<p>I have a problem when I'm trying to clone with git on cygwin. My GIT_SSH is</p>
<pre><code> "C:\ProgramFiles(x86)\Git\bin\".
</code></pre>
<p>When I try to clone, here is the result:</p>
<pre><code>$ git clone ssh://*****/home/local/g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,384 | git | # cannot spawn C:\ProgramFiles(x86)\Git\cmd\: No such file or directory.
I have a problem when I'm trying to clone with git on cygwin. My GIT_SSH is
```
"C:\ProgramFiles(x86)\Git\bin\".
```
When I try to clone, here is the result:
```
$ git clone ssh://*****/home/local/git/prestashop myDirectory
Cloning into 'myDi... | Following [Git with SSH on Windows](https://stackoverflow.com/a/8713121/6309), you see that GIT_SSH should reference the ssh executable, not just its path:
```
(old msysgit)
set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
(new 2015 git for Windows)
set GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe
``` |
7197941 | Copy 1 commit from one branch (dev) to another (stable) with clean working dir | 14 | 2011-08-25 22:24:40 | <p>I tried to understand <a href="https://stackoverflow.com/questions/2100851/how-to-undo-a-commit-and-commit-the-changes-into-the-other-branch-in-git">How to undo a commit and commit the changes into the other branch in Git?</a> but I don't think it has to be that hard. (Answer is using <code>branch -f</code> and <cod... | 3,455 | 247,372 | 2012-06-29 22:46:22 | 7,197,951 | 21 | 2011-08-25 22:26:19 | 47,773 | 2011-08-25 22:34:40 | https://stackoverflow.com/q/7197941 | https://stackoverflow.com/a/7197951 | <p>Go to the stable branch:</p>
<pre><code>git checkout stable
</code></pre>
<p>Copy the desired commit to the current branch.</p>
<pre><code>git cherry-pick e87568fa
</code></pre>
<p>You can now return to dev:</p>
<pre><code>git checkout dev
</code></pre>
| <p>Go to the stable branch:</p> <pre><code>git checkout stable </code></pre> <p>Copy the desired commit to the current branch.</p> <pre><code>git cherry-pick e87568fa </code></pre> <p>You can now return to dev:</p> <pre><code>git checkout dev </code></pre> | 119, 1879, 5597, 36489 | branch, cherry-pick, commit, git | <h1>Copy 1 commit from one branch (dev) to another (stable) with clean working dir</h1>
<p>I tried to understand <a href="https://stackoverflow.com/questions/2100851/how-to-undo-a-commit-and-commit-the-changes-into-the-other-branch-in-git">How to undo a commit and commit the changes into the other branch in Git?</a> bu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,386 | git | # Copy 1 commit from one branch (dev) to another (stable) with clean working dir
I tried to understand [How to undo a commit and commit the changes into the other branch in Git?](https://stackoverflow.com/questions/2100851/how-to-undo-a-commit-and-commit-the-changes-into-the-other-branch-in-git) but I don't think it h... | Go to the stable branch:
```
git checkout stable
```
Copy the desired commit to the current branch.
```
git cherry-pick e87568fa
```
You can now return to dev:
```
git checkout dev
``` |
5510918 | Where should git repositories be created? | 14 | 2011-04-01 08:37:04 | <p>Can git repositories be created inside the folder that is being version-controlled, or should the repository be placed outside that folder? Or is either possible? Does the repository location matter?</p>
| 16,811 | 560,429 | 2020-10-12 08:49:24 | 5,513,523 | 21 | 2011-04-01 12:43:11 | 223,092 | 2011-04-01 13:47:48 | https://stackoverflow.com/q/5510918 | https://stackoverflow.com/a/5513523 | <p><em>Adding a sixth answer might be a bit futile at this point, but I wrote something like this for a tutorial and I think it's important that an answer to this question clearly explains the standard layout of bare and non-bare repositories.</em></p>
<p>Usually with git you will be using a <strong>non-bare repositor... | <p><em>Adding a sixth answer might be a bit futile at this point, but I wrote something like this for a tutorial and I think it's important that an answer to this question clearly explains the standard layout of bare and non-bare repositories.</em></p> <p>Usually with git you will be using a <strong>non-bare repositor... | 99, 119, 456 | filesystems, git, version-control | <h1>Where should git repositories be created?</h1>
<p>Can git repositories be created inside the folder that is being version-controlled, or should the repository be placed outside that folder? Or is either possible? Does the repository location matter?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,388 | git | # Where should git repositories be created?
Can git repositories be created inside the folder that is being version-controlled, or should the repository be placed outside that folder? Or is either possible? Does the repository location matter? | *Adding a sixth answer might be a bit futile at this point, but I wrote something like this for a tutorial and I think it's important that an answer to this question clearly explains the standard layout of bare and non-bare repositories.*
Usually with git you will be using a **non-bare repository**, or a repository wi... |
4036255 | how to automatically run bundle install if the gemfile is updated after a git pull/merge? | 14 | 2010-10-27 18:06:59 | <p>I imagine that I should write a git commit hook (post-merge?) that would look at the list of changed files and run bundle install if necessary after I fetch and merge from my git repo.</p>
<p>But after some googling, I figure that either this should exist (couldn't find it!) or there's a good reason not to do this.... | 2,512 | 9,412 | 2016-03-03 15:46:59 | 5,135,025 | 21 | 2011-02-27 18:31:14 | 193,313 | 2011-02-27 18:31:14 | https://stackoverflow.com/q/4036255 | https://stackoverflow.com/a/5135025 | <p>You can create a post-merge hook that will fire everytime you pull changes:</p>
<pre><code>~/.git/post-merge
</code></pre>
<p>... and set it up to re-install bundle if needed:</p>
<pre><code>bundle check || bundle install
</code></pre>
| <p>You can create a post-merge hook that will fire everytime you pull changes:</p> <pre><code>~/.git/post-merge </code></pre> <p>... and set it up to re-install bundle if needed:</p> <pre><code>bundle check || bundle install </code></pre> | 12, 119, 43112 | bundler, git, ruby | <h1>how to automatically run bundle install if the gemfile is updated after a git pull/merge?</h1>
<p>I imagine that I should write a git commit hook (post-merge?) that would look at the list of changed files and run bundle install if necessary after I fetch and merge from my git repo.</p>
<p>But after some googling, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,389 | git | # how to automatically run bundle install if the gemfile is updated after a git pull/merge?
I imagine that I should write a git commit hook (post-merge?) that would look at the list of changed files and run bundle install if necessary after I fetch and merge from my git repo.
But after some googling, I figure that ei... | You can create a post-merge hook that will fire everytime you pull changes:
```
~/.git/post-merge
```
... and set it up to re-install bundle if needed:
```
bundle check || bundle install
``` |
57008847 | Why is my "git rebase master" returning too much commits than "normal" after the lastest merge? | 13 | 2019-07-12 14:17:24 | <p>I try to understand what I am doing wrong but nothing. I am totally confused.
I know that another way to merge branches (or commits) is to use "git rebase".
I have 3 branches: master and 2 others for different features. Let's talk about master, f1 and f2.
I am working on my f1, and I need another feature, so I creat... | 13,353 | 7,142,629 | 2023-12-05 14:40:33 | 57,009,939 | 21 | 2019-07-12 15:25:32 | 3,980,115 | 2022-02-16 14:21:50 | https://stackoverflow.com/q/57008847 | https://stackoverflow.com/a/57009939 | <p>That is a misunderstanding of what rebase does, and I believe this is what has created this very frustrating situation.</p>
<p><strong>What might have happened</strong></p>
<p>Suppose you have the follow situation (which I believe is what you described).</p>
<pre><code>master o---o---o---o---o---o
... | <p>That is a misunderstanding of what rebase does, and I believe this is what has created this very frustrating situation.</p> <p><strong>What might have happened</strong></p> <p>Suppose you have the follow situation (which I believe is what you described).</p> <pre><code>master o---o---o---o---o---o ... | 119, 1879, 5597, 8974 | branch, commit, git, rebase | <h1>Why is my "git rebase master" returning too much commits than "normal" after the lastest merge?</h1>
<p>I try to understand what I am doing wrong but nothing. I am totally confused.
I know that another way to merge branches (or commits) is to use "git rebase".
I have 3 branches: master and 2 others for different fe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,392 | git | # Why is my "git rebase master" returning too much commits than "normal" after the lastest merge?
I try to understand what I am doing wrong but nothing. I am totally confused.
I know that another way to merge branches (or commits) is to use "git rebase".
I have 3 branches: master and 2 others for different features. L... | That is a misunderstanding of what rebase does, and I believe this is what has created this very frustrating situation.
**What might have happened**
Suppose you have the follow situation (which I believe is what you described).
```
master o---o---o---o---o---o
\
feature1 A---B---C
... |
50746504 | Rebasing/duplicating feature branch to an older release | 13 | 2018-06-07 16:51:02 | <p>I want to backport commits from one branch to one older branch. How should I do this? I know I could for example cherry-pick each commit one by one, but what would be the simplest way to do this?</p>
<p><em>From this:</em></p>
<pre><code>___(a)__(b)__(c)__(d)__(e)__(f)__(g) <- master
\ \ /
... | 6,147 | 2,710,225 | 2018-06-07 18:24:50 | 50,746,663 | 21 | 2018-06-07 17:01:43 | 157,957 | 2018-06-07 17:13:58 | https://stackoverflow.com/q/50746504 | https://stackoverflow.com/a/50746663 | <p>First, let's consider what a normal "rebase" onto the release branch would do here:</p>
<ul>
<li>git doesn't know that <code>master</code> is involved, so sees only two branches: a feature with commits <code>a-b-1-2-3</code> and a release with commits <code>a-x-y-z</code></li>
<li>the common branch point is therefo... | <p>First, let's consider what a normal "rebase" onto the release branch would do here:</p> <ul> <li>git doesn't know that <code>master</code> is involved, so sees only two branches: a feature with commits <code>a-b-1-2-3</code> and a release with commits <code>a-x-y-z</code></li> <li>the common branch point is therefo... | 119 | git | <h1>Rebasing/duplicating feature branch to an older release</h1>
<p>I want to backport commits from one branch to one older branch. How should I do this? I know I could for example cherry-pick each commit one by one, but what would be the simplest way to do this?</p>
<p><em>From this:</em></p>
<pre><code>___(a)__(b)_... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,393 | git | # Rebasing/duplicating feature branch to an older release
I want to backport commits from one branch to one older branch. How should I do this? I know I could for example cherry-pick each commit one by one, but what would be the simplest way to do this?
*From this:*
```
___(a)__(b)__(c)__(d)__(e)__(f)__(g) <- master... | First, let's consider what a normal "rebase" onto the release branch would do here:
- git doesn't know that `master` is involved, so sees only two branches: a feature with commits `a-b-1-2-3` and a release with commits `a-x-y-z`
- the common branch point is therefore `a`, so the commits to be rebased will be `b-1-2-3`... |
48346607 | Git worktree prune - what it does? | 13 | 2018-01-19 17:36:05 | <p>I'm using <em>git version 2.14.2.windows.2</em> and invoked</p>
<pre><code>git worktree add <newpath> <branch>
</code></pre>
<p>on a "normal" repository to create a worktree. This created a new working tree structure at <code><newpath></code> for the branch <code><branch></code> and added <... | 17,148 | 2,460,378 | 2018-01-19 18:11:22 | 48,347,149 | 21 | 2018-01-19 18:11:22 | 20,713 | 2018-01-19 18:11:22 | https://stackoverflow.com/q/48346607 | https://stackoverflow.com/a/48347149 | <p><code>git worktree prune</code> removes information about (non-locked) worktrees which no longer exist. For example,</p>
<pre><code>$ mkdir a
$ cd a
$ git init
$ git commit --allow-empty --allow-empty-message -m ''
$ git worktree add ../b
$ ls .git/worktrees/
b
$ rm -rf ../b
$ git worktree prune
$ ls .git/worktrees... | <p><code>git worktree prune</code> removes information about (non-locked) worktrees which no longer exist. For example,</p> <pre><code>$ mkdir a $ cd a $ git init $ git commit --allow-empty --allow-empty-message -m '' $ git worktree add ../b $ ls .git/worktrees/ b $ rm -rf ../b $ git worktree prune $ ls .git/worktrees... | 119 | git | <h1>Git worktree prune - what it does?</h1>
<p>I'm using <em>git version 2.14.2.windows.2</em> and invoked</p>
<pre><code>git worktree add <newpath> <branch>
</code></pre>
<p>on a "normal" repository to create a worktree. This created a new working tree structure at <code><newpath></code> for the br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,394 | git | # Git worktree prune - what it does?
I'm using *git version 2.14.2.windows.2* and invoked
```
git worktree add <newpath> <branch>
```
on a "normal" repository to create a worktree. This created a new working tree structure at `<newpath>` for the branch `<branch>` and added `.git/worktrees/<newpath-name>` with a coup... | `git worktree prune` removes information about (non-locked) worktrees which no longer exist. For example,
```
$ mkdir a
$ cd a
$ git init
$ git commit --allow-empty --allow-empty-message -m ''
$ git worktree add ../b
$ ls .git/worktrees/
b
$ rm -rf ../b
$ git worktree prune
$ ls .git/worktrees/
$
``` |
47273592 | How to make a folder a non Git directory? | 13 | 2017-11-13 21:10:06 | <p>One day I was messing around with Git and I accidentally made a folder Git repository so now it looks like this:</p>
<pre><code>⌘ ~/sites/ (master)
</code></pre>
<p>How can I change it back to a regular folder?</p>
| 14,183 | null | 2017-11-15 19:25:16 | 47,274,113 | 21 | 2017-11-13 21:47:59 | null | 2017-11-13 21:47:59 | https://stackoverflow.com/q/47273592 | https://stackoverflow.com/a/47274113 | <pre><code>rm -rf .git
</code></pre>
<p>Removing this folder will make it a non git directory. Maybe accidentally someone previously by doing <em>git init</em> initialized a git repository here.</p>
| <pre><code>rm -rf .git </code></pre> <p>Removing this folder will make it a non git directory. Maybe accidentally someone previously by doing <em>git init</em> initialized a git repository here.</p> | 119, 391 | git, terminal | <h1>How to make a folder a non Git directory?</h1>
<p>One day I was messing around with Git and I accidentally made a folder Git repository so now it looks like this:</p>
<pre><code>⌘ ~/sites/ (master)
</code></pre>
<p>How can I change it back to a regular folder?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,395 | git | # How to make a folder a non Git directory?
One day I was messing around with Git and I accidentally made a folder Git repository so now it looks like this:
```
⌘ ~/sites/ (master)
```
How can I change it back to a regular folder? | ```
rm -rf .git
```
Removing this folder will make it a non git directory. Maybe accidentally someone previously by doing *git init* initialized a git repository here. |
47186472 | Do you have commit webpack generated files? | 13 | 2017-11-08 17:52:40 | <p>I started using webpack with my node application recently. However, the application generates a huge file in <code>client/dist/js/app.js</code> and commiting that file everytime takes quite a bit of time. I imagine, that as my web application keeps growing, its going to get even worse. </p>
<p>The question is, sinc... | 6,368 | null | 2017-11-08 18:06:36 | 47,186,643 | 21 | 2017-11-08 18:01:16 | 2,844,616 | 2017-11-08 18:06:36 | https://stackoverflow.com/q/47186472 | https://stackoverflow.com/a/47186643 | <p>Your file is a minified javascript generated from your source code by webpack. You must not include these generated files from the dist folder in your repository since they will be overwritten every time you run webpack after changes has been made to your source files.</p>
<p>Remove this directory from your reposit... | <p>Your file is a minified javascript generated from your source code by webpack. You must not include these generated files from the dist folder in your repository since they will be overwritten every time you run webpack after changes has been made to your source files.</p> <p>Remove this directory from your reposit... | 119, 46426, 102241 | git, node.js, webpack | <h1>Do you have commit webpack generated files?</h1>
<p>I started using webpack with my node application recently. However, the application generates a huge file in <code>client/dist/js/app.js</code> and commiting that file everytime takes quite a bit of time. I imagine, that as my web application keeps growing, its go... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,396 | git | # Do you have commit webpack generated files?
I started using webpack with my node application recently. However, the application generates a huge file in `client/dist/js/app.js` and commiting that file everytime takes quite a bit of time. I imagine, that as my web application keeps growing, its going to get even wors... | Your file is a minified javascript generated from your source code by webpack. You must not include these generated files from the dist folder in your repository since they will be overwritten every time you run webpack after changes has been made to your source files.
Remove this directory from your repository and wr... |
38970472 | How to git clone from *local bare* repository | 13 | 2016-08-16 08:52:09 | <p>Say I have a bare repository on my local machine at <code>./new-bare.git</code>.
What is the correct way to clone it to another location on my machine?</p>
| 15,707 | 1,773,706 | 2016-08-16 09:13:48 | 38,970,914 | 21 | 2016-08-16 09:13:48 | 2,915,834 | 2016-08-16 09:13:48 | https://stackoverflow.com/q/38970472 | https://stackoverflow.com/a/38970914 | <p>There is no difference in cloning from a not bare repository:</p>
<pre><code>/tmp> mkdir foo
/tmp> git init --bare foo
Initialized empty Git repository in /tmp/foo/
/tmp> git clone /tmp/foo /tmp/baa
Cloning into '/tmp/baa'...
warning: You appear to have cloned an empty repository.
done.
</code></pre>
| <p>There is no difference in cloning from a not bare repository:</p> <pre><code>/tmp> mkdir foo /tmp> git init --bare foo Initialized empty Git repository in /tmp/foo/ /tmp> git clone /tmp/foo /tmp/baa Cloning into '/tmp/baa'... warning: You appear to have cloned an empty repository. done. </code></pre> | 119, 34099, 64465 | git, git-bare, git-clone | <h1>How to git clone from *local bare* repository</h1>
<p>Say I have a bare repository on my local machine at <code>./new-bare.git</code>.
What is the correct way to clone it to another location on my machine?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,397 | git | # How to git clone from *local bare* repository
Say I have a bare repository on my local machine at `./new-bare.git`.
What is the correct way to clone it to another location on my machine? | There is no difference in cloning from a not bare repository:
```
/tmp> mkdir foo
/tmp> git init --bare foo
Initialized empty Git repository in /tmp/foo/
/tmp> git clone /tmp/foo /tmp/baa
Cloning into '/tmp/baa'...
warning: You appear to have cloned an empty repository.
done.
``` |
36339248 | On Windows git pull and clone for Google cloud repository pops credential manager dialog box | 13 | 2016-03-31 16:47:29 | <p>Pulling from an existing clone</p>
<pre><code>git pull
</code></pre>
<p>or cloning Google cloud repository with gcloud</p>
<pre><code>gcloud source repos clone default my_repo
</code></pre>
<p>produces the following dialog box:
<a href="https://i.sstatic.net/EesfC.jpg" rel="noreferrer"><img src="https://i.sstat... | 8,082 | 4,627,916 | 2016-07-02 22:08:07 | 36,339,249 | 21 | 2016-03-31 16:47:29 | 4,627,916 | 2016-03-31 16:47:29 | https://stackoverflow.com/q/36339248 | https://stackoverflow.com/a/36339249 | <p>If you run</p>
<pre><code>C:\> git config --list --system
credential.helper=manager
</code></pre>
<p>and get a setting for <code>credential.helper</code> like above, it will have precedence over gcloud installed credential helper.</p>
<p>You can unset it via (possibly as administrator)</p>
<pre><code>C:\> ... | <p>If you run</p> <pre><code>C:\> git config --list --system credential.helper=manager </code></pre> <p>and get a setting for <code>credential.helper</code> like above, it will have precedence over gcloud installed credential helper.</p> <p>You can unset it via (possibly as administrator)</p> <pre><code>C:\> ... | 119, 117470 | gcloud-cli, git | <h1>On Windows git pull and clone for Google cloud repository pops credential manager dialog box</h1>
<p>Pulling from an existing clone</p>
<pre><code>git pull
</code></pre>
<p>or cloning Google cloud repository with gcloud</p>
<pre><code>gcloud source repos clone default my_repo
</code></pre>
<p>produces the follo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,398 | git | # On Windows git pull and clone for Google cloud repository pops credential manager dialog box
Pulling from an existing clone
```
git pull
```
or cloning Google cloud repository with gcloud
```
gcloud source repos clone default my_repo
```
produces the following dialog box:
[
```
C:\> git config --system --unset credential.helper
```
Now
```
C:... |
28073266 | How to use JGit to push changes to remote with OAuth access token | 13 | 2015-01-21 17:26:18 | <p>I am able to push to remote with this piece of code </p>
<pre><code>return git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(user, password)).setRemote("origin").call();
</code></pre>
<p>I also am able to get oauth access token with all necessary scopes. How do I push with access token?</p>... | 10,302 | 1,745,356 | 2024-12-29 22:59:56 | 28,105,276 | 21 | 2015-01-23 07:50:12 | 2,986,905 | 2020-04-15 05:48:25 | https://stackoverflow.com/q/28073266 | https://stackoverflow.com/a/28105276 | <p>You need to pass a <code>UsernamePasswordCredentialsProvider</code> with the token as its user name.</p>
<pre><code>String remoteUrl = "https://${token}@github.com/user/repo.git";
CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider("${token}", "");
git.push().setRemote(remoteUrl).setCr... | <p>You need to pass a <code>UsernamePasswordCredentialsProvider</code> with the token as its user name.</p> <pre><code>String remoteUrl = "https://${token}@github.com/user/repo.git"; CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider("${token}", ""); git.push().setRemote(remoteUrl).setCr... | 17, 61058 | java, jgit | <h1>How to use JGit to push changes to remote with OAuth access token</h1>
<p>I am able to push to remote with this piece of code </p>
<pre><code>return git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(user, password)).setRemote("origin").call();
</code></pre>
<p>I also am able to get oauth a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,399 | git | # How to use JGit to push changes to remote with OAuth access token
I am able to push to remote with this piece of code
```
return git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(user, password)).setRemote("origin").call();
```
I also am able to get oauth access token with all necessary sco... | You need to pass a `UsernamePasswordCredentialsProvider` with the token as its user name.
```
String remoteUrl = "https://${token}@github.com/user/repo.git";
CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider("${token}", "");
git.push().setRemote(remoteUrl).setCredentialsProvider(credent... |
4843881 | updating branches using git pull | 13 | 2011-01-30 16:09:20 | <pre><code>git version 1.7.3.5
</code></pre>
<p>I have the following branches:</p>
<pre><code>git branch
image
master
* video
</code></pre>
<p>I did some work at the office. And when I came home I always update on my home's notebook.</p>
<p>However, when I did a <code>git remote show origin</code> I get the fol... | 44,775 | 70,942 | 2013-12-19 03:41:23 | 4,849,847 | 21 | 2011-01-31 10:33:43 | 81,071 | 2011-01-31 10:33:43 | https://stackoverflow.com/q/4843881 | https://stackoverflow.com/a/4849847 | <p><code>git remote show origin</code> compares your local repository with the remote:</p>
<ul>
<li><code>fast-forwardable</code> means you can push your local changes to the remote branch.</li>
<li><code>local out of date</code> means your local branch is behind the remote branch and you should pull from it.</li>
</u... | <p><code>git remote show origin</code> compares your local repository with the remote:</p> <ul> <li><code>fast-forwardable</code> means you can push your local changes to the remote branch.</li> <li><code>local out of date</code> means your local branch is behind the remote branch and you should pull from it.</li> </u... | 119 | git | <h1>updating branches using git pull</h1>
<pre><code>git version 1.7.3.5
</code></pre>
<p>I have the following branches:</p>
<pre><code>git branch
image
master
* video
</code></pre>
<p>I did some work at the office. And when I came home I always update on my home's notebook.</p>
<p>However, when I did a <code>g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,400 | git | # updating branches using git pull
```
git version 1.7.3.5
```
I have the following branches:
```
git branch
image
master
* video
```
I did some work at the office. And when I came home I always update on my home's notebook.
However, when I did a `git remote show origin` I get the following:
```
Local refs ... | `git remote show origin` compares your local repository with the remote:
- `fast-forwardable` means you can push your local changes to the remote branch.
- `local out of date` means your local branch is behind the remote branch and you should pull from it.
`git status` compares your local working directory with the c... |
3354482 | With git, temporary exclude a changed tracked file from commit in command line | 13 | 2010-07-28 15:28:07 | <p>I have a <strong>tracked</strong> database (already added) file in git. I want this file to always contain the same data in my git repository. Even when I modify it in the working copy (local sandbox) for test purposes. </p>
<p>With git, how to exclude this changed file on my working copy from a commit ?</p>
| 3,889 | 388,465 | 2016-08-30 20:08:42 | 3,354,629 | 21 | 2010-07-28 15:41:45 | 158,676 | 2010-07-28 15:41:45 | https://stackoverflow.com/q/3354482 | https://stackoverflow.com/a/3354629 | <p>The way to ignore certain files that are already committed is </p>
<pre><code>git update-index --assume-unchanged file
</code></pre>
<p>However, this is a local setting, and it doesn't propagate when cloning.</p>
<p>Its effect is canceled with <code>git update-index --no-assume-unchanged gui</code>.</p>
| <p>The way to ignore certain files that are already committed is </p> <pre><code>git update-index --assume-unchanged file </code></pre> <p>However, this is a local setting, and it doesn't propagate when cloning.</p> <p>Its effect is canceled with <code>git update-index --no-assume-unchanged gui</code>.</p> | 119 | git | <h1>With git, temporary exclude a changed tracked file from commit in command line</h1>
<p>I have a <strong>tracked</strong> database (already added) file in git. I want this file to always contain the same data in my git repository. Even when I modify it in the working copy (local sandbox) for test purposes. </p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,401 | git | # With git, temporary exclude a changed tracked file from commit in command line
I have a **tracked** database (already added) file in git. I want this file to always contain the same data in my git repository. Even when I modify it in the working copy (local sandbox) for test purposes.
With git, how to exclude this ... | The way to ignore certain files that are already committed is
```
git update-index --assume-unchanged file
```
However, this is a local setting, and it doesn't propagate when cloning.
Its effect is canceled with `git update-index --no-assume-unchanged gui`. |
3206093 | Push local master commits to remote branch | 13 | 2010-07-08 16:56:58 | <p>I've been working on a local clone of a remote git repository, committing my changes to my local master branch. Now, I want to push my commits to the remote repository. However, I want to keep my local commits separate from the remote master branch, so that I don't break anything. How can I push my local commits to ... | 24,844 | 156,787 | 2020-06-16 14:57:10 | 3,206,144 | 21 | 2010-07-08 17:03:27 | 350,351 | 2010-07-08 17:03:27 | https://stackoverflow.com/q/3206093 | https://stackoverflow.com/a/3206144 | <p>You should run <code>git help push</code>, which will tell you about the syntax for the refspec that you push to. In short, <code>git push <remotename> <local_branch_name>:<remote_branch_name></code></p>
| <p>You should run <code>git help push</code>, which will tell you about the syntax for the refspec that you push to. In short, <code>git push <remotename> <local_branch_name>:<remote_branch_name></code></p> | 119 | git | <h1>Push local master commits to remote branch</h1>
<p>I've been working on a local clone of a remote git repository, committing my changes to my local master branch. Now, I want to push my commits to the remote repository. However, I want to keep my local commits separate from the remote master branch, so that I don't... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,402 | git | # Push local master commits to remote branch
I've been working on a local clone of a remote git repository, committing my changes to my local master branch. Now, I want to push my commits to the remote repository. However, I want to keep my local commits separate from the remote master branch, so that I don't break an... | You should run `git help push`, which will tell you about the syntax for the refspec that you push to. In short, `git push <remotename> <local_branch_name>:<remote_branch_name>` |
72830343 | Retrieve original files after a git clone with git lfs | 12 | 2022-07-01 13:53:00 | <p>I am a bit confused. I back up a project with Github.com. Because my files are too large to store them on Github.com, I am using <code>git large file storage</code>. Now I changed to a new computer, and performed a <code>git clone</code> on the repository stored remotly on Github.com. I also installed <code>git lfs<... | 9,642 | 3,935,035 | 2024-08-05 11:41:23 | 72,830,455 | 21 | 2022-07-01 14:01:33 | 3,935,035 | 2024-08-05 11:41:23 | https://stackoverflow.com/q/72830343 | https://stackoverflow.com/a/72830455 | <p>Run the following commands:</p>
<pre><code># Fetch all the LFS files from the remote
git lfs fetch
# Replace the pointer files to the actual files
git lfs checkout
</code></pre>
<p>Now you should see that the pointer files are replaced by the original files.</p>
<hr />
<p>Moderator notes: You need Git LFS extension... | <p>Run the following commands:</p> <pre><code># Fetch all the LFS files from the remote git lfs fetch # Replace the pointer files to the actual files git lfs checkout </code></pre> <p>Now you should see that the pointer files are replaced by the original files.</p> <hr /> <p>Moderator notes: You need Git LFS extension... | 119, 115244 | git, git-lfs | <h1>Retrieve original files after a git clone with git lfs</h1>
<p>I am a bit confused. I back up a project with Github.com. Because my files are too large to store them on Github.com, I am using <code>git large file storage</code>. Now I changed to a new computer, and performed a <code>git clone</code> on the reposito... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,403 | git | # Retrieve original files after a git clone with git lfs
I am a bit confused. I back up a project with Github.com. Because my files are too large to store them on Github.com, I am using `git large file storage`. Now I changed to a new computer, and performed a `git clone` on the repository stored remotly on Github.com... | Run the following commands:
```
# Fetch all the LFS files from the remote
git lfs fetch
# Replace the pointer files to the actual files
git lfs checkout
```
Now you should see that the pointer files are replaced by the original files.
---
Moderator notes: You need Git LFS extension installed on your system for the... |
58378724 | No effect when doing git diff -- ':(exclude)package-lock.json' | 12 | 2019-10-14 14:18:50 | <p>I want to a do a diff but without package-lock.json which is huge and is a generated file so nothing interesting for me there.
I tried both :</p>
<pre><code>git diff -- ':(exclude)package-lock.json'
git diff -- ':!package-lock.json'
</code></pre>
<p>but it has just zero output. What am I doing wrong ?
I am runnin... | 6,278 | 113,291 | 2025-05-20 15:27:39 | 58,382,160 | 21 | 2019-10-14 18:22:17 | 7,976,758 | 2022-04-04 12:22:42 | https://stackoverflow.com/q/58378724 | https://stackoverflow.com/a/58382160 | <p>Before using exclude pathspec you need to list non-exclude paths. Dot, for example, or a magic root <code>:/</code>:</p>
<pre><code>git diff -- . ':(exclude)package-lock.json'
git diff -- . ':!package-lock.json'
</code></pre>
| <p>Before using exclude pathspec you need to list non-exclude paths. Dot, for example, or a magic root <code>:/</code>:</p> <pre><code>git diff -- . ':(exclude)package-lock.json' git diff -- . ':!package-lock.json' </code></pre> | 119, 126671 | git, package-lock.json | <h1>No effect when doing git diff -- ':(exclude)package-lock.json'</h1>
<p>I want to a do a diff but without package-lock.json which is huge and is a generated file so nothing interesting for me there.
I tried both :</p>
<pre><code>git diff -- ':(exclude)package-lock.json'
git diff -- ':!package-lock.json'
</code></p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,405 | git | # No effect when doing git diff -- ':(exclude)package-lock.json'
I want to a do a diff but without package-lock.json which is huge and is a generated file so nothing interesting for me there.
I tried both :
```
git diff -- ':(exclude)package-lock.json'
git diff -- ':!package-lock.json'
```
but it has just zero outp... | Before using exclude pathspec you need to list non-exclude paths. Dot, for example, or a magic root `:/`:
```
git diff -- . ':(exclude)package-lock.json'
git diff -- . ':!package-lock.json'
``` |
38868224 | how to git push to a local branch? | 12 | 2016-08-10 08:38:38 | <p>I git clone a project on my computer and have a local master branch, let say A. Here, I create some local branches (let say B and C).</p>
<p>I made some changes in B and C. So, how do I can git push to merge the changes in B and C to A?</p>
<p>Normally, I see that <pre> git push origin master </pre> to push to the... | 37,132 | 1,832,951 | 2020-05-25 05:34:22 | 38,868,412 | 21 | 2016-08-10 08:47:39 | 6,330,106 | 2016-08-10 08:47:39 | https://stackoverflow.com/q/38868224 | https://stackoverflow.com/a/38868412 | <p>Use <code>git merge</code> instead to manipulate local branches.</p>
<pre><code>git checkout master
git merge B
git merge C
</code></pre>
<p>If you really want to push a local branch to another local branch, <code>git push . B:master</code>, though this is quite rare.</p>
| <p>Use <code>git merge</code> instead to manipulate local branches.</p> <pre><code>git checkout master git merge B git merge C </code></pre> <p>If you really want to push a local branch to another local branch, <code>git push . B:master</code>, though this is quite rare.</p> | 119 | git | <h1>how to git push to a local branch?</h1>
<p>I git clone a project on my computer and have a local master branch, let say A. Here, I create some local branches (let say B and C).</p>
<p>I made some changes in B and C. So, how do I can git push to merge the changes in B and C to A?</p>
<p>Normally, I see that <pre> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,407 | git | # how to git push to a local branch?
I git clone a project on my computer and have a local master branch, let say A. Here, I create some local branches (let say B and C).
I made some changes in B and C. So, how do I can git push to merge the changes in B and C to A?
Normally, I see that
```
git push origin master
... | Use `git merge` instead to manipulate local branches.
```
git checkout master
git merge B
git merge C
```
If you really want to push a local branch to another local branch, `git push . B:master`, though this is quite rare. |
32773000 | git doesn't push .env file on the server | 12 | 2015-09-25 00:26:57 | <p>on my local server in my laravel app I have .env file.</p>
<p>to push changes to the server I use </p>
<p><code>git add .
git commit -m "something"
git push heroku master
</code></p>
<p>but when I use <code>heroku git:clone -a myapp</code> in the cloned app there is no <strong>.env</strong> file... there is only ... | 35,819 | 3,830,618 | 2021-06-23 13:46:36 | 32,774,476 | 21 | 2015-09-25 03:49:00 | 1,739,852 | 2015-09-25 03:49:00 | https://stackoverflow.com/q/32773000 | https://stackoverflow.com/a/32774476 | <p>Check your <code>.gitignore</code> file if you have one there. If your git repo was set up for you automatically or imported from another project then it is likely that it is being ignored by default. </p>
<p>If it is in there then simply remove it to include your <code>.env</code> file in your next commit.</p>
| <p>Check your <code>.gitignore</code> file if you have one there. If your git repo was set up for you automatically or imported from another project then it is likely that it is being ignored by default. </p> <p>If it is in there then simply remove it to include your <code>.env</code> file in your next commit.</p> | 119, 8279, 75151 | git, heroku, laravel | <h1>git doesn't push .env file on the server</h1>
<p>on my local server in my laravel app I have .env file.</p>
<p>to push changes to the server I use </p>
<p><code>git add .
git commit -m "something"
git push heroku master
</code></p>
<p>but when I use <code>heroku git:clone -a myapp</code> in the cloned app there ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,408 | git | # git doesn't push .env file on the server
on my local server in my laravel app I have .env file.
to push changes to the server I use
`git add .
git commit -m "something"
git push heroku master`
but when I use `heroku git:clone -a myapp` in the cloned app there is no **.env** file... there is only **.env.developmen... | Check your `.gitignore` file if you have one there. If your git repo was set up for you automatically or imported from another project then it is likely that it is being ignored by default.
If it is in there then simply remove it to include your `.env` file in your next commit. |
18491539 | Use git commit history to find project hot-spots? | 12 | 2013-08-28 15:01:06 | <p>I'm joining a new project with a long and storied commit history, and I'd like to use that history to show me the hot-spots in the project: the files that have been most commonly (and most recently) edited.</p>
<p>Ideally, I'd like to avoid writing more than a few lines of script (ruby, python, javascript; doesn't ... | 2,986 | 22,979 | 2022-01-14 15:59:53 | 18,594,249 | 21 | 2013-09-03 13:58:45 | 1,065,190 | 2022-01-14 15:59:53 | https://stackoverflow.com/q/18491539 | https://stackoverflow.com/a/18594249 | <p>You can use this one-liner to print the top 100 most frequently changed files:</p>
<pre><code>git log --pretty=format: --name-only | sed '/^\s*$/d' | sort | uniq -c | sort -rg | head -100
</code></pre>
| <p>You can use this one-liner to print the top 100 most frequently changed files:</p> <pre><code>git log --pretty=format: --name-only | sed '/^\s*$/d' | sort | uniq -c | sort -rg | head -100 </code></pre> | 119 | git | <h1>Use git commit history to find project hot-spots?</h1>
<p>I'm joining a new project with a long and storied commit history, and I'd like to use that history to show me the hot-spots in the project: the files that have been most commonly (and most recently) edited.</p>
<p>Ideally, I'd like to avoid writing more tha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,410 | git | # Use git commit history to find project hot-spots?
I'm joining a new project with a long and storied commit history, and I'd like to use that history to show me the hot-spots in the project: the files that have been most commonly (and most recently) edited.
Ideally, I'd like to avoid writing more than a few lines of... | You can use this one-liner to print the top 100 most frequently changed files:
```
git log --pretty=format: --name-only | sed '/^\s*$/d' | sort | uniq -c | sort -rg | head -100
``` |
17942396 | Git: update a repository to certain revision | 12 | 2013-07-30 08:51:09 | <p>Say I have a repository that has a revision number A. And I would like to update it to revision B, while the latest revision is C. (revision A is earlier than B, and B is earlier than C). I'm new to git so I did some research, and found <a href="https://stackoverflow.com/questions/889984/bring-git-repo-up-to-a-certa... | 32,303 | null | 2017-02-24 09:16:24 | 17,942,571 | 21 | 2013-07-30 09:00:00 | 1,646,320 | 2017-02-24 08:14:27 | https://stackoverflow.com/q/17942396 | https://stackoverflow.com/a/17942571 | <p>There is no "updating a repository to a certain version". You repository has all the versions, that's what <code>git fetch</code> / <code>git pull</code> does.</p>
<p>If you want put a specific revision of the repo in your current working tree locally, there are several ways you could do that. The closest to your q... | <p>There is no "updating a repository to a certain version". You repository has all the versions, that's what <code>git fetch</code> / <code>git pull</code> does.</p> <p>If you want put a specific revision of the repo in your current working tree locally, there are several ways you could do that. The closest to your q... | 119 | git | <h1>Git: update a repository to certain revision</h1>
<p>Say I have a repository that has a revision number A. And I would like to update it to revision B, while the latest revision is C. (revision A is earlier than B, and B is earlier than C). I'm new to git so I did some research, and found <a href="https://stackover... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,411 | git | # Git: update a repository to certain revision
Say I have a repository that has a revision number A. And I would like to update it to revision B, while the latest revision is C. (revision A is earlier than B, and B is earlier than C). I'm new to git so I did some research, and found [this](https://stackoverflow.com/qu... | There is no "updating a repository to a certain version". You repository has all the versions, that's what `git fetch` / `git pull` does.
If you want put a specific revision of the repo in your current working tree locally, there are several ways you could do that. The closest to your questions is:
update your local ... |
14409299 | Does git remove files from version control after they are added to .gitignore? | 12 | 2013-01-18 23:27:47 | <p>I've been accidentally including my Python virtual environment directory <code>venv</code> in all my git commit and push activity. </p>
<p>I've just added <code>venv</code> to my <code>.gitignore</code>. But my .git folder is still massive (I'm assuming because of the previous commits and tracking of venv).</p>
<p... | 13,178 | 1,185,242 | 2020-04-19 20:36:32 | 14,409,384 | 21 | 2013-01-18 23:37:04 | 1,229,195 | 2020-04-19 20:36:32 | https://stackoverflow.com/q/14409299 | https://stackoverflow.com/a/14409384 | <p>Try deleting the files from your git repository:</p>
<pre><code>git rm --cached venv*
</code></pre>
<p>Rich Stone mentions below, that if <code>venv</code> is a folder, you should use the recursive switch, <code>-r</code>:</p>
<pre><code>git rm --cached -r venv*
</code></pre>
| <p>Try deleting the files from your git repository:</p> <pre><code>git rm --cached venv* </code></pre> <p>Rich Stone mentions below, that if <code>venv</code> is a folder, you should use the recursive switch, <code>-r</code>:</p> <pre><code>git rm --cached -r venv* </code></pre> | 119 | git | <h1>Does git remove files from version control after they are added to .gitignore?</h1>
<p>I've been accidentally including my Python virtual environment directory <code>venv</code> in all my git commit and push activity. </p>
<p>I've just added <code>venv</code> to my <code>.gitignore</code>. But my .git folder is st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,412 | git | # Does git remove files from version control after they are added to .gitignore?
I've been accidentally including my Python virtual environment directory `venv` in all my git commit and push activity.
I've just added `venv` to my `.gitignore`. But my .git folder is still massive (I'm assuming because of the previous ... | Try deleting the files from your git repository:
```
git rm --cached venv*
```
Rich Stone mentions below, that if `venv` is a folder, you should use the recursive switch, `-r`:
```
git rm --cached -r venv*
``` |
12404257 | Replace the contents of one directory in GIT | 12 | 2012-09-13 10:30:11 | <p>Imagine that I have a repository with directories Dir1 and Dir2 and I am in branchA. </p>
<p>Imagine that I want to get rid of contents of Dir2 and replace them with Dir2 in the master branch, while keeping the content of Dir1.</p>
<p>I don't expect this to be that simple, but ideally :</p>
<pre><code>cd Dir2
git... | 10,038 | 492,936 | 2012-09-13 10:36:21 | 12,404,351 | 21 | 2012-09-13 10:36:21 | 329,407 | 2012-09-13 10:36:21 | https://stackoverflow.com/q/12404257 | https://stackoverflow.com/a/12404351 | <p>remove <code>Dir2</code> from <code>branchA</code> and<br>
fetch it from <code>master</code> branch:</p>
<pre><code>$ git checkout branchA
$ git rm -r Dir2
$ git checkout master -- Dir2
$ git commit -m "replaced Dir with Dir2 from master"
</code></pre>
| <p>remove <code>Dir2</code> from <code>branchA</code> and<br> fetch it from <code>master</code> branch:</p> <pre><code>$ git checkout branchA $ git rm -r Dir2 $ git checkout master -- Dir2 $ git commit -m "replaced Dir with Dir2 from master" </code></pre> | 119 | git | <h1>Replace the contents of one directory in GIT</h1>
<p>Imagine that I have a repository with directories Dir1 and Dir2 and I am in branchA. </p>
<p>Imagine that I want to get rid of contents of Dir2 and replace them with Dir2 in the master branch, while keeping the content of Dir1.</p>
<p>I don't expect this to be ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,414 | git | # Replace the contents of one directory in GIT
Imagine that I have a repository with directories Dir1 and Dir2 and I am in branchA.
Imagine that I want to get rid of contents of Dir2 and replace them with Dir2 in the master branch, while keeping the content of Dir1.
I don't expect this to be that simple, but ideally... | remove `Dir2` from `branchA` and
fetch it from `master` branch:
```
$ git checkout branchA
$ git rm -r Dir2
$ git checkout master -- Dir2
$ git commit -m "replaced Dir with Dir2 from master"
``` |
8439432 | How to make "git branch" respect the "core.ignorecase" flag on Linux? | 12 | 2011-12-09 00:02:57 | <p>We are using a remote Git repository located on a Linux server at the office. All clients are Windows PCs with Git Extensions installed as a client (running with msysgit).</p>
<p>On a client system, if I try to do the following:</p>
<pre><code>git branch Branch1
git branch branch1
</code></pre>
<p>the second comm... | 5,631 | 221,111 | 2011-12-09 02:41:06 | 8,440,402 | 21 | 2011-12-09 02:41:06 | 526,535 | 2011-12-09 02:41:06 | https://stackoverflow.com/q/8439432 | https://stackoverflow.com/a/8440402 | <p>I would like to add more details over @meagar's answer:</p>
<p>FAT32 / NTFS are <a href="http://en.wikipedia.org/wiki/Case_preservation">case-preserving</a> file systems. That is, if you name a file "Foo.txt", it will be stored as ""Foo.txt". If you save a file as "foo.txt", it will be saved as "foo.txt". But since... | <p>I would like to add more details over @meagar's answer:</p> <p>FAT32 / NTFS are <a href="http://en.wikipedia.org/wiki/Case_preservation">case-preserving</a> file systems. That is, if you name a file "Foo.txt", it will be stored as ""Foo.txt". If you save a file as "foo.txt", it will be saved as "foo.txt". But since... | 58, 64, 119, 9708 | case-sensitive, git, linux, windows | <h1>How to make "git branch" respect the "core.ignorecase" flag on Linux?</h1>
<p>We are using a remote Git repository located on a Linux server at the office. All clients are Windows PCs with Git Extensions installed as a client (running with msysgit).</p>
<p>On a client system, if I try to do the following:</p>
<pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,415 | git | # How to make "git branch" respect the "core.ignorecase" flag on Linux?
We are using a remote Git repository located on a Linux server at the office. All clients are Windows PCs with Git Extensions installed as a client (running with msysgit).
On a client system, if I try to do the following:
```
git branch Branch1
... | I would like to add more details over @meagar's answer:
FAT32 / NTFS are [case-preserving](http://en.wikipedia.org/wiki/Case_preservation) file systems. That is, if you name a file "Foo.txt", it will be stored as ""Foo.txt". If you save a file as "foo.txt", it will be saved as "foo.txt". But since it is case-insensiti... |
67715404 | Git fetch Pull Requests from Azure DevOps | 11 | 2021-05-27 03:45:00 | <p>I want to fetch, using git, the list of Pull Requests in a repository hosted in Azure DevOps.</p>
<p><a href="https://stackoverflow.com/questions/27567846/how-can-i-check-out-a-github-pull-request-with-git">Github has the support</a>.
We can just add this to <code>.git/config</code>:</p>
<pre><code>[remote "ori... | 10,318 | 7,625,884 | 2024-02-13 19:12:12 | 67,717,393 | 21 | 2021-05-27 07:18:51 | 5,024,726 | 2021-05-31 11:52:13 | https://stackoverflow.com/q/67715404 | https://stackoverflow.com/a/67717393 | <p>For Azure DevOps the configuration is slightly different. You can add the following to <code>.git/config</code>:</p>
<pre><code>[remote "origin"]
fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
</code></pre>
<p>It is also possible to perform an ad-hoc fetch of a pull-request into a local bran... | <p>For Azure DevOps the configuration is slightly different. You can add the following to <code>.git/config</code>:</p> <pre><code>[remote "origin"] fetch = +refs/pull/*/merge:refs/remotes/origin/pull/* </code></pre> <p>It is also possible to perform an ad-hoc fetch of a pull-request into a local bran... | 119, 64512, 116537 | azure-devops, git, pull-request | <h1>Git fetch Pull Requests from Azure DevOps</h1>
<p>I want to fetch, using git, the list of Pull Requests in a repository hosted in Azure DevOps.</p>
<p><a href="https://stackoverflow.com/questions/27567846/how-can-i-check-out-a-github-pull-request-with-git">Github has the support</a>.
We can just add this to <code>.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,417 | git | # Git fetch Pull Requests from Azure DevOps
I want to fetch, using git, the list of Pull Requests in a repository hosted in Azure DevOps.
[Github has the support](https://stackoverflow.com/questions/27567846/how-can-i-check-out-a-github-pull-request-with-git).
We can just add this to `.git/config`:
```
[remote "orig... | For Azure DevOps the configuration is slightly different. You can add the following to `.git/config`:
```
[remote "origin"]
fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
```
It is also possible to perform an ad-hoc fetch of a pull-request into a local branch without prior configuration like this:
```... |
56995358 | git continues to control changes on __pycache__ even when it is in gitignore | 11 | 2019-07-11 18:31:16 | <p>This is my <code>.gitignore</code>:</p>
<pre><code>*__pycache__*
*.pyc
db.sqlite3
*.DS_Store
media/
res/
</code></pre>
<p>I can see on my <strong>Atom</strong> that <code>__pycache__</code> directories are VcsIgnored (which implies that are recognized as not version controlled by <strong>git</strong>)</p>
<p><a href... | 17,219 | 6,843,153 | 2022-08-13 18:03:20 | 56,995,475 | 21 | 2019-07-11 18:39:55 | 7,475,772 | 2019-07-11 18:51:15 | https://stackoverflow.com/q/56995358 | https://stackoverflow.com/a/56995475 | <p>Try <code>git rm --cached */__pycache__/*</code></p>
<p><code>.gitignore</code> file only inform git which new files should not be tracked. Do not remove from repository files already tracked.</p>
| <p>Try <code>git rm --cached */__pycache__/*</code></p> <p><code>.gitignore</code> file only inform git which new files should not be tracked. Do not remove from repository files already tracked.</p> | 16, 119, 25056 | git, gitignore, python | <h1>git continues to control changes on __pycache__ even when it is in gitignore</h1>
<p>This is my <code>.gitignore</code>:</p>
<pre><code>*__pycache__*
*.pyc
db.sqlite3
*.DS_Store
media/
res/
</code></pre>
<p>I can see on my <strong>Atom</strong> that <code>__pycache__</code> directories are VcsIgnored (which implies... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,418 | git | # git continues to control changes on __pycache__ even when it is in gitignore
This is my `.gitignore`:
```
*__pycache__*
*.pyc
db.sqlite3
*.DS_Store
media/
res/
```
I can see on my **Atom** that `__pycache__` directories are VcsIgnored (which implies that are recognized as not version controlled by **git**)
[![ent... | Try `git rm --cached */__pycache__/*`
`.gitignore` file only inform git which new files should not be tracked. Do not remove from repository files already tracked. |
4927519 | Diff a git fork | 11 | 2011-02-07 22:42:37 | <p>I'm reviewing a set of forks from an original git project and trying to determine the actual differences. Is there a way to do some sort of <code>git diff original-uri fork-uri</code> to get the differences between the current state of the original project and the current state of the fork?</p>
| 9,139 | 76,456 | 2011-06-25 19:13:58 | 4,927,587 | 21 | 2011-02-07 22:50:03 | 11,343 | 2011-06-25 19:13:58 | https://stackoverflow.com/q/4927519 | https://stackoverflow.com/a/4927587 | <p>If you add the fork as a remote repository, you can make diff on it: </p>
<pre><code>git remote add original original-uri
git fetch original
git diff HEAD original/master
</code></pre>
<p>However this requires to clone the forked repository, don't know how to do without cloning.</p>
| <p>If you add the fork as a remote repository, you can make diff on it: </p> <pre><code>git remote add original original-uri git fetch original git diff HEAD original/master </code></pre> <p>However this requires to clone the forked repository, don't know how to do without cloning.</p> | 119, 606 | diff, git | <h1>Diff a git fork</h1>
<p>I'm reviewing a set of forks from an original git project and trying to determine the actual differences. Is there a way to do some sort of <code>git diff original-uri fork-uri</code> to get the differences between the current state of the original project and the current state of the fork?<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,423 | git | # Diff a git fork
I'm reviewing a set of forks from an original git project and trying to determine the actual differences. Is there a way to do some sort of `git diff original-uri fork-uri` to get the differences between the current state of the original project and the current state of the fork? | If you add the fork as a remote repository, you can make diff on it:
```
git remote add original original-uri
git fetch original
git diff HEAD original/master
```
However this requires to clone the forked repository, don't know how to do without cloning. |
1490783 | Prevent accidental check-in of password file using git | 11 | 2009-09-29 05:56:28 | <p>git does not seem to do what I want here so I need some advise. I have a configuration file with sensitive information such as passwords. Say I have checked in the config file with blank/generic values:</p>
<pre><code>username =
password =
</code></pre>
<p>Now I fill it with real values, and then add the file to .... | 3,137 | 150,172 | 2024-04-30 06:04:01 | 1,490,825 | 21 | 2009-09-29 06:09:50 | 112,968 | 2024-04-30 05:55:01 | https://stackoverflow.com/q/1490783 | https://stackoverflow.com/a/1490825 | <p><code>.gitignore</code> will only ignore files not already tracked. In your case, you need to create an <code>password.file.template</code> and track it (by committing it), then put your real <code>password.file</code> in the <code>.gitignore</code> file.</p>
| <p><code>.gitignore</code> will only ignore files not already tracked. In your case, you need to create an <code>password.file.template</code> and track it (by committing it), then put your real <code>password.file</code> in the <code>.gitignore</code> file.</p> | 119 | git | <h1>Prevent accidental check-in of password file using git</h1>
<p>git does not seem to do what I want here so I need some advise. I have a configuration file with sensitive information such as passwords. Say I have checked in the config file with blank/generic values:</p>
<pre><code>username =
password =
</code></pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,424 | git | # Prevent accidental check-in of password file using git
git does not seem to do what I want here so I need some advise. I have a configuration file with sensitive information such as passwords. Say I have checked in the config file with blank/generic values:
```
username =
password =
```
Now I fill it with real val... | `.gitignore` will only ignore files not already tracked. In your case, you need to create an `password.file.template` and track it (by committing it), then put your real `password.file` in the `.gitignore` file. |
70063122 | Can I set a username/email for all directories under some directory? | 10 | 2021-11-22 08:55:04 | <p>So I have my global 'user.email' as "myPersonalEmail@gmail.com". But I also have a folder that holds my work projects, organized like:</p>
<pre><code>repos/
workRepos/
databaseMonitor/
salesWebapp/
sudokuSolver/
someCoolGame/
</code></pre>
<p>I know I can set the local user.email on each su... | 2,250 | 1,392,189 | 2021-11-22 09:09:34 | 70,063,191 | 21 | 2021-11-22 09:01:32 | 4,304,123 | 2021-11-22 09:09:34 | https://stackoverflow.com/q/70063122 | https://stackoverflow.com/a/70063191 | <p>It's possible to do this using different <code>.gitconfig</code> files. My home directory looks like this:</p>
<pre class="lang-sh prettyprint-override"><code>~
-> .gitconfig
-> .gitconfig.personal
-> .gitconfig.work
-> /personal
-> /work
</code></pre>
<p>The contents of <code>.gitconfig</code>:</p>
<... | <p>It's possible to do this using different <code>.gitconfig</code> files. My home directory looks like this:</p> <pre class="lang-sh prettyprint-override"><code>~ -> .gitconfig -> .gitconfig.personal -> .gitconfig.work -> /personal -> /work </code></pre> <p>The contents of <code>.gitconfig</code>:</p> <... | 119 | git | <h1>Can I set a username/email for all directories under some directory?</h1>
<p>So I have my global 'user.email' as "myPersonalEmail@gmail.com". But I also have a folder that holds my work projects, organized like:</p>
<pre><code>repos/
workRepos/
databaseMonitor/
salesWebapp/
sudokuSolver/
s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,425 | git | # Can I set a username/email for all directories under some directory?
So I have my global 'user.email' as "myPersonalEmail@gmail.com". But I also have a folder that holds my work projects, organized like:
```
repos/
workRepos/
databaseMonitor/
salesWebapp/
sudokuSolver/
someCoolGame/
```
I know I ca... | It's possible to do this using different `.gitconfig` files. My home directory looks like this:
```
~
-> .gitconfig
-> .gitconfig.personal
-> .gitconfig.work
-> /personal
-> /work
```
The contents of `.gitconfig`:
```
# default to work config
[include]
path = ~/.gitconfig.work
# when working on personal projects
... |
69688288 | gitea: Built-in ssh server not starting when sshd server running | 10 | 2021-10-23 12:45:31 | <p>I have a problem with my gitea version 1.15.5 running on my raspberry pi. I appears that the built in ssh server is not starting:</p>
<pre><code>ssh -p 2222 git@myaddress.com
ssh: connect to host myaddress.com port 2222: Connection refused
</code></pre>
<p>I already assured that "myaddress.com" points to t... | 7,301 | 17,010,325 | 2022-12-31 02:07:47 | 69,688,394 | 21 | 2021-10-23 13:00:01 | 17,010,325 | 2022-12-31 02:07:47 | https://stackoverflow.com/q/69688288 | https://stackoverflow.com/a/69688394 | <p>After some more googling, I found the solution myself:</p>
<p>If there is an sshd server running, gitea does not automatically start its built-in ssh server. Instead, you have to force it by adding this line under <code>[server]</code> in the <code>app.ini</code> configuration:</p>
<pre class="lang-ini prettyprint-o... | <p>After some more googling, I found the solution myself:</p> <p>If there is an sshd server running, gitea does not automatically start its built-in ssh server. Instead, you have to force it by adding this line under <code>[server]</code> in the <code>app.ini</code> configuration:</p> <pre class="lang-ini prettyprint-o... | 386, 128429 | gitea, ssh | <h1>gitea: Built-in ssh server not starting when sshd server running</h1>
<p>I have a problem with my gitea version 1.15.5 running on my raspberry pi. I appears that the built in ssh server is not starting:</p>
<pre><code>ssh -p 2222 git@myaddress.com
ssh: connect to host myaddress.com port 2222: Connection refused
</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,426 | git | # gitea: Built-in ssh server not starting when sshd server running
I have a problem with my gitea version 1.15.5 running on my raspberry pi. I appears that the built in ssh server is not starting:
```
ssh -p 2222 git@myaddress.com
ssh: connect to host myaddress.com port 2222: Connection refused
```
I already assured... | After some more googling, I found the solution myself:
If there is an sshd server running, gitea does not automatically start its built-in ssh server. Instead, you have to force it by adding this line under `[server]` in the `app.ini` configuration:
```
[server]
START_SSH_SERVER = true
```
Since, according to the [g... |
47585962 | Git diff between staged or unstaged changes with a remote branch | 10 | 2017-12-01 02:56:11 | <p>Is there a way to do a git diff between staged/unstaged changes with a remote branch say origin/branch1. Is there a similar option with git difftool? </p>
<p>OR</p>
<p>Is there a way to diff changes in my local file system (forget about staged or unstaged) with git remote branch? All I want is to check my changes ... | 12,206 | 5,137,076 | 2017-12-01 03:29:10 | 47,586,219 | 21 | 2017-12-01 03:29:10 | 1,256,452 | 2017-12-01 03:29:10 | https://stackoverflow.com/q/47585962 | https://stackoverflow.com/a/47586219 | <blockquote>
<p>Is there a way to do a git diff between staged changes and a remote branch say origin/branch1.</p>
</blockquote>
<p>Just run:</p>
<pre><code>git diff --cached origin/branch1
</code></pre>
<p>(you may use <code>--staged</code> here if you prefer; I use <code>--cached</code> because <code>git rm</cod... | <blockquote> <p>Is there a way to do a git diff between staged changes and a remote branch say origin/branch1.</p> </blockquote> <p>Just run:</p> <pre><code>git diff --cached origin/branch1 </code></pre> <p>(you may use <code>--staged</code> here if you prefer; I use <code>--cached</code> because <code>git rm</cod... | 119, 28897, 105625 | git, git-difftool, git-merge | <h1>Git diff between staged or unstaged changes with a remote branch</h1>
<p>Is there a way to do a git diff between staged/unstaged changes with a remote branch say origin/branch1. Is there a similar option with git difftool? </p>
<p>OR</p>
<p>Is there a way to diff changes in my local file system (forget about stag... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,428 | git | # Git diff between staged or unstaged changes with a remote branch
Is there a way to do a git diff between staged/unstaged changes with a remote branch say origin/branch1. Is there a similar option with git difftool?
OR
Is there a way to diff changes in my local file system (forget about staged or unstaged) with git... | > Is there a way to do a git diff between staged changes and a remote branch say origin/branch1.
Just run:
```
git diff --cached origin/branch1
```
(you may use `--staged` here if you prefer; I use `--cached` because `git rm` has `--cached` but not `--staged`). This shows you a way to change `origin/branch1` to matc... |
19826574 | How can I revert a push to repository in GitHub | 10 | 2013-11-07 01:55:15 | <p>I commited few changes, and made a push to remote branch in github.
But then I realized that I did some mistakes in the commit, and pushed
lot of wrong files. Is there a way to revert the push?</p>
| 43,078 | 2,916,464 | 2013-11-07 03:31:43 | 19,827,523 | 21 | 2013-11-07 03:31:43 | 1,646,106 | 2013-11-07 03:31:43 | https://stackoverflow.com/q/19826574 | https://stackoverflow.com/a/19827523 | <p>The <code>git revert</code> command does not rewrite history, but does take away the changes from a commit with a new commit. Then all you would have to do is to push again. This is the suggested method.</p>
<p>If you really want to make github look like a particular commit never really happened, there is a way, ... | <p>The <code>git revert</code> command does not rewrite history, but does take away the changes from a commit with a new commit. Then all you would have to do is to push again. This is the suggested method.</p> <p>If you really want to make github look like a particular commit never really happened, there is a way, ... | 119 | git | <h1>How can I revert a push to repository in GitHub</h1>
<p>I commited few changes, and made a push to remote branch in github.
But then I realized that I did some mistakes in the commit, and pushed
lot of wrong files. Is there a way to revert the push?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,432 | git | # How can I revert a push to repository in GitHub
I commited few changes, and made a push to remote branch in github.
But then I realized that I did some mistakes in the commit, and pushed
lot of wrong files. Is there a way to revert the push? | The `git revert` command does not rewrite history, but does take away the changes from a commit with a new commit. Then all you would have to do is to push again. This is the suggested method.
If you really want to make github look like a particular commit never really happened, there is a way, but use caution (especi... |
18866880 | Get remote repository Git | 10 | 2013-09-18 08:04:53 | <p>I am almost newby in Git and just read Git book from the official site. I try understand difference between next cases.</p>
<pre><code>git init Project
git remote add Project [some-url]
</code></pre>
<p>and </p>
<pre><code>git clone [some-url]
</code></pre>
<p>And what is a preferable approach?</p>
| 34,323 | 712,183 | 2017-05-15 09:04:25 | 18,866,980 | 21 | 2013-09-18 08:09:45 | 1,257,954 | 2013-09-18 08:09:45 | https://stackoverflow.com/q/18866880 | https://stackoverflow.com/a/18866980 | <p>There is no question of preference. These are commands for 2 entirely different purposes.</p>
<pre><code>git init Project
git remote add Project [some-url]
</code></pre>
<blockquote>
<p><strong>git init</strong> initializes a directory as a Git repository</p>
</blockquote>
<p>This is used when you are starting ... | <p>There is no question of preference. These are commands for 2 entirely different purposes.</p> <pre><code>git init Project git remote add Project [some-url] </code></pre> <blockquote> <p><strong>git init</strong> initializes a directory as a Git repository</p> </blockquote> <p>This is used when you are starting ... | 119, 34099, 41346 | git, git-clone, git-remote | <h1>Get remote repository Git</h1>
<p>I am almost newby in Git and just read Git book from the official site. I try understand difference between next cases.</p>
<pre><code>git init Project
git remote add Project [some-url]
</code></pre>
<p>and </p>
<pre><code>git clone [some-url]
</code></pre>
<p>And what is a pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,433 | git | # Get remote repository Git
I am almost newby in Git and just read Git book from the official site. I try understand difference between next cases.
```
git init Project
git remote add Project [some-url]
```
and
```
git clone [some-url]
```
And what is a preferable approach? | There is no question of preference. These are commands for 2 entirely different purposes.
```
git init Project
git remote add Project [some-url]
```
> **git init** initializes a directory as a Git repository
This is used when you are starting work on a **new** project, not continuing work on an existing project unde... |
11625836 | make GitX open via Terminal for the repo laying at the current path | 10 | 2012-07-24 07:11:35 | <p>I usually start gitx via the terminal command</p>
<pre><code>$ gitx
</code></pre>
<p>Normally, when I'm at /path/to/repo as pwd in terminal, gitx was opening that repos log. I don't know if it was an update or if I changed some settings, but since some time, gitx opens blank, when i hit the command. I googled, and... | 5,452 | 644,987 | 2015-01-12 12:15:28 | 13,528,919 | 21 | 2012-11-23 12:11:49 | 1,330,505 | 2013-08-30 15:12:19 | https://stackoverflow.com/q/11625836 | https://stackoverflow.com/a/13528919 | <p>Open terminal, navigate to the site directory and type this at the prompt: </p>
<pre><code>$ open -a GitX .
</code></pre>
<p><strong>--- edit ---</strong></p>
<p>To make this change permanent, open your local <code>.bashrc</code> file:</p>
<pre><code>$ vi ~/.bashrc
</code></pre>
<p>Add the following alias where... | <p>Open terminal, navigate to the site directory and type this at the prompt: </p> <pre><code>$ open -a GitX . </code></pre> <p><strong>--- edit ---</strong></p> <p>To make this change permanent, open your local <code>.bashrc</code> file:</p> <pre><code>$ vi ~/.bashrc </code></pre> <p>Add the following alias where... | 391, 37258 | gitx, terminal | <h1>make GitX open via Terminal for the repo laying at the current path</h1>
<p>I usually start gitx via the terminal command</p>
<pre><code>$ gitx
</code></pre>
<p>Normally, when I'm at /path/to/repo as pwd in terminal, gitx was opening that repos log. I don't know if it was an update or if I changed some settings, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,434 | git | # make GitX open via Terminal for the repo laying at the current path
I usually start gitx via the terminal command
```
$ gitx
```
Normally, when I'm at /path/to/repo as pwd in terminal, gitx was opening that repos log. I don't know if it was an update or if I changed some settings, but since some time, gitx opens b... | Open terminal, navigate to the site directory and type this at the prompt:
```
$ open -a GitX .
```
**--- edit ---**
To make this change permanent, open your local `.bashrc` file:
```
$ vi ~/.bashrc
```
Add the following alias wherever you like:
```
alias gitx='open -a GitX .'
```
Save and exit, then reload the ... |
12901549 | Using git with diffmerge with no prompts and no alias | 10 | 2012-10-15 18:13:40 | <p>On OSX, I'm using diffmerge as my git diffing tool. Here is my .gitconfig:</p>
<pre><code>[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[alias]
d = difftool --no-prompt
</code></pre>
<p>If I just use <code>git difftool</code> it will prompt me for ev... | 4,149 | 29,502 | 2012-10-16 06:49:25 | 12,908,990 | 21 | 2012-10-16 06:49:25 | 6,309 | 2012-10-16 06:49:25 | https://stackoverflow.com/q/12901549 | https://stackoverflow.com/a/12908990 | <blockquote>
<p>moving the <code>--no-prompt</code> flag next to the <code>diffmerge</code> command</p>
</blockquote>
<p><code>--no-prompt</code> is an argument of <code>difftool</code> (as I mention in "<a href="https://stackoverflow.com/a/949242/6309">How do I view 'git diff' output with a visual diff program?</a>... | <blockquote> <p>moving the <code>--no-prompt</code> flag next to the <code>diffmerge</code> command</p> </blockquote> <p><code>--no-prompt</code> is an argument of <code>difftool</code> (as I mention in "<a href="https://stackoverflow.com/a/949242/6309">How do I view 'git diff' output with a visual diff program?</a>... | 119, 14797, 32868 | diffmerge, git, git-config | <h1>Using git with diffmerge with no prompts and no alias</h1>
<p>On OSX, I'm using diffmerge as my git diffing tool. Here is my .gitconfig:</p>
<pre><code>[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[alias]
d = difftool --no-prompt
</code></pre>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,435 | git | # Using git with diffmerge with no prompts and no alias
On OSX, I'm using diffmerge as my git diffing tool. Here is my .gitconfig:
```
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[alias]
d = difftool --no-prompt
```
If I just use `git difftool` it wil... | > moving the `--no-prompt` flag next to the `diffmerge` command
`--no-prompt` is an argument of `difftool` (as I mention in "[How do I view 'git diff' output with a visual diff program?](https://stackoverflow.com/a/949242/6309)").
So I confirm it won't work with `diffmerge`.
> I tried inserting `prompt=false` and `... |
10435117 | PS1 env variable does not work on mac | 10 | 2012-05-03 16:02:58 | <p>I have a script(not written by myself) which shows the git branch/svn branch in my command prompt. Does anyone know why this would not work on mac? It works perfectly in linux.</p>
<p>From <a href="https://github.com/xumingming/dotfiles/blob/master/.ps1">https://github.com/xumingming/dotfiles/blob/master/.ps1</a>:<... | 13,345 | 238,546 | 2016-04-06 07:37:40 | 10,435,238 | 21 | 2012-05-03 16:10:30 | 13,767 | 2012-05-03 16:10:30 | https://stackoverflow.com/q/10435117 | https://stackoverflow.com/a/10435238 | <p>Mac OS X installations of Git don't have <code>__git_ps1</code> included.</p>
<p>Use:</p>
<pre><code>alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
</code></pre>
<p>as a substitution.</p>
| <p>Mac OS X installations of Git don't have <code>__git_ps1</code> included.</p> <p>Use:</p> <pre><code>alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'" </code></pre> <p>as a substitution.</p> | 119, 450, 53034 | git, macros, ps1 | <h1>PS1 env variable does not work on mac</h1>
<p>I have a script(not written by myself) which shows the git branch/svn branch in my command prompt. Does anyone know why this would not work on mac? It works perfectly in linux.</p>
<p>From <a href="https://github.com/xumingming/dotfiles/blob/master/.ps1">https://github... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,436 | git | # PS1 env variable does not work on mac
I have a script(not written by myself) which shows the git branch/svn branch in my command prompt. Does anyone know why this would not work on mac? It works perfectly in linux.
From <https://github.com/xumingming/dotfiles/blob/master/.ps1>:
```
# Display ps1 with colorful pwd ... | Mac OS X installations of Git don't have `__git_ps1` included.
Use:
```
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
```
as a substitution. |
7150424 | Is it possible to have a git repo inside another git repo | 10 | 2011-08-22 16:19:37 | <p>I have a django project managed with git. I am git pushing it to my host. Now, I want to be able to push just one of the directories (inc. all sub dirs) to another git repo. How is it possible, if it is possible at all?</p>
<p>Edit: So I want that directory to be a git repo itself.</p>
| 12,023 | 886,669 | 2016-08-08 06:28:52 | 7,150,481 | 21 | 2011-08-22 16:24:34 | 223,092 | 2013-12-08 17:06:44 | https://stackoverflow.com/q/7150424 | https://stackoverflow.com/a/7150481 | <p>You could look at git's support for <a href="http://git-scm.com/book/en/Git-Tools-Submodules" rel="nofollow noreferrer">submodules</a>. You would add the second repository as a submodule to your main project, e.g. with commands like:</p>
<pre><code>git submodule add git://wherever/blah.git library-code
git commit ... | <p>You could look at git's support for <a href="http://git-scm.com/book/en/Git-Tools-Submodules" rel="nofollow noreferrer">submodules</a>. You would add the second repository as a submodule to your main project, e.g. with commands like:</p> <pre><code>git submodule add git://wherever/blah.git library-code git commit ... | 119, 41612 | git, git-submodules | <h1>Is it possible to have a git repo inside another git repo</h1>
<p>I have a django project managed with git. I am git pushing it to my host. Now, I want to be able to push just one of the directories (inc. all sub dirs) to another git repo. How is it possible, if it is possible at all?</p>
<p>Edit: So I want that d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,437 | git | # Is it possible to have a git repo inside another git repo
I have a django project managed with git. I am git pushing it to my host. Now, I want to be able to push just one of the directories (inc. all sub dirs) to another git repo. How is it possible, if it is possible at all?
Edit: So I want that directory to be a... | You could look at git's support for [submodules](http://git-scm.com/book/en/Git-Tools-Submodules). You would add the second repository as a submodule to your main project, e.g. with commands like:
```
git submodule add git://wherever/blah.git library-code
git commit -m "Added a new submodule called 'library-code'"
```... |
2569960 | Git pre-receive hook | 10 | 2010-04-03 01:40:50 | <p>When you enable pre-receive hook for git repository:</p>
<blockquote>
<p>It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:</p>
<p>< old-value > SP < new-value > SP < ref-name > LF</p>
<p>where < old-value > is the old object name stored ... | 14,222 | 282,882 | 2023-03-23 22:51:27 | 2,570,098 | 21 | 2010-04-03 03:04:07 | 55,225 | 2023-03-23 22:51:27 | https://stackoverflow.com/q/2569960 | https://stackoverflow.com/a/2570098 | <p>Oddly, I had some code laying around from a git -> Wordpress utility that might help. The following will give you a list of all files changed in the receive, as well as their contents. No guarantees, may have bugs, may not be the most efficient way to do it, blah blah blah. Some of this code is based off stuff ... | <p>Oddly, I had some code laying around from a git -> Wordpress utility that might help. The following will give you a list of all files changed in the receive, as well as their contents. No guarantees, may have bugs, may not be the most efficient way to do it, blah blah blah. Some of this code is based off stuff ... | 119 | git | <h1>Git pre-receive hook</h1>
<p>When you enable pre-receive hook for git repository:</p>
<blockquote>
<p>It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:</p>
<p>< old-value > SP < new-value > SP < ref-name > LF</p>
<p>where < old-value > ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,438 | git | # Git pre-receive hook
When you enable pre-receive hook for git repository:
> It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:
>
> < old-value > SP < new-value > SP < ref-name > LF
>
> where < old-value > is the old object name stored in the ref, < new-value > ... | Oddly, I had some code laying around from a git -> Wordpress utility that might help. The following will give you a list of all files changed in the receive, as well as their contents. No guarantees, may have bugs, may not be the most efficient way to do it, blah blah blah. Some of this code is based off stuff in [gits... |
62760057 | git commit and push even although no changes have been made, it's necessary to trigger web hook | 9 | 2020-07-06 16:09:18 | <p>I need to trigger commit and push although no changes have been made and the commit and push are not needed, but I do need it as each commit and push triggers a webhook.</p>
<p>So when I do:</p>
<pre><code>git commit -am "release 1"
</code></pre>
<p>I'm getting:</p>
<pre><code>On branch feature/X-111_Suppo... | 8,171 | 63,898 | 2024-07-05 06:53:13 | 62,761,443 | 21 | 2020-07-06 17:32:51 | 4,413,841 | 2024-07-05 06:53:13 | https://stackoverflow.com/q/62760057 | https://stackoverflow.com/a/62761443 | <p><code>git commit --allow-empty -am 'empty commit'</code></p>
<p>One way to create an empty commit and avoid the "Nothing to commit" response is to add the <a href="https://git-scm.com/docs/git-commit/2.31.0#Documentation/git-commit.txt---allow-empty" rel="nofollow noreferrer"><code>--allow-empty</code> fla... | <p><code>git commit --allow-empty -am 'empty commit'</code></p> <p>One way to create an empty commit and avoid the "Nothing to commit" response is to add the <a href="https://git-scm.com/docs/git-commit/2.31.0#Documentation/git-commit.txt---allow-empty" rel="nofollow noreferrer"><code>--allow-empty</code> fla... | 119 | git | <h1>git commit and push even although no changes have been made, it's necessary to trigger web hook</h1>
<p>I need to trigger commit and push although no changes have been made and the commit and push are not needed, but I do need it as each commit and push triggers a webhook.</p>
<p>So when I do:</p>
<pre><code>git co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,441 | git | # git commit and push even although no changes have been made, it's necessary to trigger web hook
I need to trigger commit and push although no changes have been made and the commit and push are not needed, but I do need it as each commit and push triggers a webhook.
So when I do:
```
git commit -am "release 1"
```
... | `git commit --allow-empty -am 'empty commit'`
One way to create an empty commit and avoid the "Nothing to commit" response is to add the [`--allow-empty` flag](https://git-scm.com/docs/git-commit/2.31.0#Documentation/git-commit.txt---allow-empty) to the `commit` command.
BTW, I agree with [the docs](https://git-scm.c... |
48705398 | Shortcut for deleting previous branch in git | 9 | 2018-02-09 12:03:17 | <p>In git it would be helpful to be able to easily delete the previous branch I was on. You can't delete the branch you're on so you need to check out a new/existing branch and delete the previous you where on by writing it's full name.</p>
<pre><code>git checkout new_branch
git branch -D old_branch_with_really_long_a... | 1,385 | 1,465,640 | 2025-11-20 16:00:00 | 48,705,399 | 21 | 2018-02-09 12:03:17 | 1,465,640 | 2018-02-13 07:46:00 | https://stackoverflow.com/q/48705398 | https://stackoverflow.com/a/48705399 | <p><code>-</code> doesn't work, but <code>-</code> is just an alias for <code>@{-1}</code> and that <em>does</em> work. So you workflow would be this:</p>
<pre><code>git checkout new_branch
git branch -D @{-1}
</code></pre>
<p><em>Amendment:</em></p>
<p>Turning this into the git alias <code>git done</code>:</p>
<pr... | <p><code>-</code> doesn't work, but <code>-</code> is just an alias for <code>@{-1}</code> and that <em>does</em> work. So you workflow would be this:</p> <pre><code>git checkout new_branch git branch -D @{-1} </code></pre> <p><em>Amendment:</em></p> <p>Turning this into the git alias <code>git done</code>:</p> <pr... | 119, 1231 | command-line, git | <h1>Shortcut for deleting previous branch in git</h1>
<p>In git it would be helpful to be able to easily delete the previous branch I was on. You can't delete the branch you're on so you need to check out a new/existing branch and delete the previous you where on by writing it's full name.</p>
<pre><code>git checkout ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,442 | git | # Shortcut for deleting previous branch in git
In git it would be helpful to be able to easily delete the previous branch I was on. You can't delete the branch you're on so you need to check out a new/existing branch and delete the previous you where on by writing it's full name.
```
git checkout new_branch
git branc... | `-` doesn't work, but `-` is just an alias for `@{-1}` and that *does* work. So you workflow would be this:
```
git checkout new_branch
git branch -D @{-1}
```
*Amendment:*
Turning this into the git alias `git done`:
```
git config --global alias.done '!f() { git checkout master && git branch -D @{-1}; }; f'
``` |
44307590 | How to enable using Git repository with files with long paths for all users? | 9 | 2017-06-01 12:29:50 | <p>On Windows using git repository with long paths causes errors for example for <code>pull</code>: </p>
<blockquote>
<p>"Fatal: cannot create directory at PATH: Filename too long". </p>
</blockquote>
<p>To solve that all repository users can add <code>"longpaths = true"</code> to their <code>.gitconfig</code> file... | 14,182 | 8,097,676 | 2017-06-01 12:48:15 | 44,308,002 | 21 | 2017-06-01 12:48:15 | 267 | 2017-06-01 12:48:15 | https://stackoverflow.com/q/44307590 | https://stackoverflow.com/a/44308002 | <p>You can't make a central repository configuration that will automagically propagate out to everyone that clone your repository.</p>
<p>As such you're left with the following options:</p>
<ol>
<li>Shorten the paths in the repository</li>
<li><p>Advice or help your programmers on how to configure their git according... | <p>You can't make a central repository configuration that will automagically propagate out to everyone that clone your repository.</p> <p>As such you're left with the following options:</p> <ol> <li>Shorten the paths in the repository</li> <li><p>Advice or help your programmers on how to configure their git according... | 64, 119, 6268 | git, path, windows | <h1>How to enable using Git repository with files with long paths for all users?</h1>
<p>On Windows using git repository with long paths causes errors for example for <code>pull</code>: </p>
<blockquote>
<p>"Fatal: cannot create directory at PATH: Filename too long". </p>
</blockquote>
<p>To solve that all reposito... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,443 | git | # How to enable using Git repository with files with long paths for all users?
On Windows using git repository with long paths causes errors for example for `pull`:
> "Fatal: cannot create directory at PATH: Filename too long".
To solve that all repository users can add `"longpaths = true"` to their `.gitconfig` fil... | You can't make a central repository configuration that will automagically propagate out to everyone that clone your repository.
As such you're left with the following options:
1. Shorten the paths in the repository
2. Advice or help your programmers on how to configure their git accordingly
- For instance, you co... |
33649639 | How to clone a list of GIT repositories? | 9 | 2015-11-11 11:32:08 | <p>I have a list of 70+ GIT repo URLs(students). Is there any feature that allows me to clone them all at once?</p>
<p>Would there be the same for synchronizing the repository with the server?</p>
<p>If not, I guess I'd need to write a quick shell script in order to do this.</p>
| 10,830 | 2,259,057 | 2023-09-13 01:37:16 | 33,651,102 | 21 | 2015-11-11 13:01:03 | 720,999 | 2015-11-11 14:59:13 | https://stackoverflow.com/q/33649639 | https://stackoverflow.com/a/33651102 | <p>Shell scripting.</p>
<h2>Getting the repos</h2>
<p>The principal idea to get the repos is</p>
<pre><code>while read repo; do
git clone "$repo"
done < repolist.txt
</code></pre>
<p>assuming the file "repolist.txt" contains one repo URL per line.</p>
<h2>Updating the repos</h2>
<p>This one is trickier.</p... | <p>Shell scripting.</p> <h2>Getting the repos</h2> <p>The principal idea to get the repos is</p> <pre><code>while read repo; do git clone "$repo" done < repolist.txt </code></pre> <p>assuming the file "repolist.txt" contains one repo URL per line.</p> <h2>Updating the repos</h2> <p>This one is trickier.</p... | 119, 34099 | git, git-clone | <h1>How to clone a list of GIT repositories?</h1>
<p>I have a list of 70+ GIT repo URLs(students). Is there any feature that allows me to clone them all at once?</p>
<p>Would there be the same for synchronizing the repository with the server?</p>
<p>If not, I guess I'd need to write a quick shell script in order to d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,445 | git | # How to clone a list of GIT repositories?
I have a list of 70+ GIT repo URLs(students). Is there any feature that allows me to clone them all at once?
Would there be the same for synchronizing the repository with the server?
If not, I guess I'd need to write a quick shell script in order to do this. | Shell scripting.
## Getting the repos
The principal idea to get the repos is
```
while read repo; do
git clone "$repo"
done < repolist.txt
```
assuming the file "repolist.txt" contains one repo URL per line.
## Updating the repos
This one is trickier.
While it's easy to iterate over the list of repos,
there'... |
14445431 | git push origin master fails and gives error: src refspec HEAD does not match any | 9 | 2013-01-21 19:02:51 | <p>Any help would be great. Thanks in advance!</p>
<p>I have git installed, and the ssh key setup, but I'm getting this weird error.</p>
<pre><code>admin@Administrators-MacBook-Pro:~/Desktop$ cd exercise/
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git init
Initialized empty Git repository in /Users/admin/De... | 14,300 | 485,843 | 2023-10-11 00:27:56 | 14,445,696 | 21 | 2013-01-21 19:21:12 | 485,843 | 2013-01-21 19:21:12 | https://stackoverflow.com/q/14445431 | https://stackoverflow.com/a/14445696 | <p>so i didn't do</p>
<pre><code>git add .
git commit -am 'initial commit'
</code></pre>
<p>before I pushed.</p>
<p>:/</p>
| <p>so i didn't do</p> <pre><code>git add . git commit -am 'initial commit' </code></pre> <p>before I pushed.</p> <p>:/</p> | 119 | git | <h1>git push origin master fails and gives error: src refspec HEAD does not match any</h1>
<p>Any help would be great. Thanks in advance!</p>
<p>I have git installed, and the ssh key setup, but I'm getting this weird error.</p>
<pre><code>admin@Administrators-MacBook-Pro:~/Desktop$ cd exercise/
admin@Administrators-M... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,447 | git | # git push origin master fails and gives error: src refspec HEAD does not match any
Any help would be great. Thanks in advance!
I have git installed, and the ssh key setup, but I'm getting this weird error.
```
admin@Administrators-MacBook-Pro:~/Desktop$ cd exercise/
admin@Administrators-MacBook-Pro:~/Desktop/exerci... | so i didn't do
```
git add .
git commit -am 'initial commit'
```
before I pushed.
:/ |
6529433 | Window Git $ git config --global http.proxy warning: http.proxy has multiple values | 9 | 2011-06-30 02:41:04 | <p>Why do I see the following warning?</p>
<pre><code>$ git config --global http.proxy http://172.19.18.22:8080
warning: http.proxy has multiple values
</code></pre>
| 21,451 | 739,141 | 2011-10-17 12:43:06 | 6,529,889 | 21 | 2011-06-30 04:20:55 | 6,309 | 2011-10-17 12:43:06 | https://stackoverflow.com/q/6529433 | https://stackoverflow.com/a/6529889 | <p>Simple display all three configuration level (system, <a href="https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to/2115116#2115116">global</a> and local) in order to check if you see several <code>http.proxy</code> configuration:</p>
<pre><code>git config -l
</code></pre>
<p>You... | <p>Simple display all three configuration level (system, <a href="https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to/2115116#2115116">global</a> and local) in order to check if you see several <code>http.proxy</code> configuration:</p> <pre><code>git config -l </code></pre> <p>You... | 119 | git | <h1>Window Git $ git config --global http.proxy warning: http.proxy has multiple values</h1>
<p>Why do I see the following warning?</p>
<pre><code>$ git config --global http.proxy http://172.19.18.22:8080
warning: http.proxy has multiple values
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,448 | git | # Window Git $ git config --global http.proxy warning: http.proxy has multiple values
Why do I see the following warning?
```
$ git config --global http.proxy http://172.19.18.22:8080
warning: http.proxy has multiple values
``` | Simple display all three configuration level (system, [global](https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to/2115116#2115116) and local) in order to check if you see several `http.proxy` configuration:
```
git config -l
```
You can then proceed to remove the extra one with a:... |
4726031 | MySQL latitude and Longitude table setup | 9 | 2011-01-18 15:48:42 | <p>I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and longitude values in? Please could you provide me with... | 9,002 | 338,547 | 2016-04-19 12:48:25 | 4,726,072 | 21 | 2011-01-18 15:52:19 | 55,159 | 2011-01-18 15:59:33 | https://stackoverflow.com/q/4726031 | https://stackoverflow.com/a/4726072 | <p>You should store the points in a singe column of datatype <code>Point</code> which you can index with a <code>SPATIAL</code> index (if your table type is <code>MyISAM</code>):</p>
<pre><code>CREATE SPATIAL INDEX sx_place_location ON place (location)
SELECT *
FROM mytable
WHERE MBRContains
(
... | <p>You should store the points in a singe column of datatype <code>Point</code> which you can index with a <code>SPATIAL</code> index (if your table type is <code>MyISAM</code>):</p> <pre><code>CREATE SPATIAL INDEX sx_place_location ON place (location) SELECT * FROM mytable WHERE MBRContains ( ... | 21, 7505, 20301 | latitude-longitude, mysql, spatial | <h1>MySQL latitude and Longitude table setup</h1>
<p>I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and lon... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,449 | git | # MySQL latitude and Longitude table setup
I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and longitude va... | You should store the points in a singe column of datatype `Point` which you can index with a `SPATIAL` index (if your table type is `MyISAM`):
```
CREATE SPATIAL INDEX sx_place_location ON place (location)
SELECT *
FROM mytable
WHERE MBRContains
(
LineString
... |
55616349 | How does git matches blobs to files across commit trees? | 8 | 2019-04-10 15:30:57 | <p><a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell" rel="noreferrer">Chapter 3.1 of the the Git book</a> clearly states that only staged files get to be stored as blobs in the commit tree.</p>
<p>If, like a commit object, a blob gets a hash ID that is unique to its content, how does Git ma... | 1,671 | 3,464,933 | 2020-06-26 01:44:19 | 55,617,347 | 21 | 2019-04-10 16:30:32 | 1,256,452 | 2019-04-10 17:05:35 | https://stackoverflow.com/q/55616349 | https://stackoverflow.com/a/55617347 | <p>That's actually quite a good question.</p>
<p>The internal storage form of a commit is partly relevant, so let's consider it for a moment. An individual commit is actually pretty small. Here is one from the Git repository for Git, namely commit <a href="https://github.com/git/git/commit/b5101f929789889c2e536d9156... | <p>That's actually quite a good question.</p> <p>The internal storage form of a commit is partly relevant, so let's consider it for a moment. An individual commit is actually pretty small. Here is one from the Git repository for Git, namely commit <a href="https://github.com/git/git/commit/b5101f929789889c2e536d9156... | 119, 456 | git, version-control | <h1>How does git matches blobs to files across commit trees?</h1>
<p><a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell" rel="noreferrer">Chapter 3.1 of the the Git book</a> clearly states that only staged files get to be stored as blobs in the commit tree.</p>
<p>If, like a commit object, a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,450 | git | # How does git matches blobs to files across commit trees?
[Chapter 3.1 of the the Git book](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) clearly states that only staged files get to be stored as blobs in the commit tree.
If, like a commit object, a blob gets a hash ID that is unique to its co... | That's actually quite a good question.
The internal storage form of a commit is partly relevant, so let's consider it for a moment. An individual commit is actually pretty small. Here is one from the Git repository for Git, namely commit [`b5101f929789889c2e536d915698f58d5c5c6b7a`](https://github.com/git/git/commit/b5... |
1566809 | How do I rewrite committer names in a git repository? | 8 | 2009-10-14 14:51:10 | <p>I converted a Subversion repository to Git using git svn but unfortunately only now noticed that some of the author information was wrong. The converted repository is not shared with anybody yet, so I'd like to rewrite the commit logs in it - if possible.</p>
<p>How can I rewrite a git repository so that the log fo... | 2,549 | 91,757 | 2014-01-30 15:54:35 | 1,566,833 | 21 | 2009-10-14 14:53:43 | 2,688 | 2014-01-30 15:54:35 | https://stackoverflow.com/q/1566809 | https://stackoverflow.com/a/1566833 | <p><a href="http://www.git-scm.com/book/" rel="noreferrer">The ProGit book</a> has <a href="http://www.git-scm.com/book/en/Git-Tools-Rewriting-History" rel="noreferrer">an example of doing this</a> that should probably work for you.</p>
<pre><code>$ git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "s... | <p><a href="http://www.git-scm.com/book/" rel="noreferrer">The ProGit book</a> has <a href="http://www.git-scm.com/book/en/Git-Tools-Rewriting-History" rel="noreferrer">an example of doing this</a> that should probably work for you.</p> <pre><code>$ git filter-branch --commit-filter ' if [ "$GIT_AUTHOR_EMAIL" = "s... | 119 | git | <h1>How do I rewrite committer names in a git repository?</h1>
<p>I converted a Subversion repository to Git using git svn but unfortunately only now noticed that some of the author information was wrong. The converted repository is not shared with anybody yet, so I'd like to rewrite the commit logs in it - if possible... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,455 | git | # How do I rewrite committer names in a git repository?
I converted a Subversion repository to Git using git svn but unfortunately only now noticed that some of the author information was wrong. The converted repository is not shared with anybody yet, so I'd like to rewrite the commit logs in it - if possible.
How ca... | [The ProGit book](http://www.git-scm.com/book/) has [an example of doing this](http://www.git-scm.com/book/en/Git-Tools-Rewriting-History) that should probably work for you.
```
$ git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "schacon@localhost" ];
then
GIT_AUTHOR_NAME="Scott Chaco... |
65225055 | How does `git rebase` work under the hood? | 7 | 2020-12-09 21:18:06 | <p>I recently started working with git trees and temporary index files to construct commits without modifying my working directory, for the purpose of automating some tasks. The ultimate goal is to effectively rebase some branch (e.g. <code>feature/x_y_z</code> on top of <code>main</code>), but without modifying the wo... | 2,551 | 2,620,183 | 2020-12-10 05:54:25 | 65,226,438 | 21 | 2020-12-09 23:31:32 | 1,256,452 | 2020-12-10 05:54:25 | https://stackoverflow.com/q/65225055 | https://stackoverflow.com/a/65226438 | <blockquote>
<p>To that end, how does git rebase work under the hood?</p>
</blockquote>
<p>It's complicated. It's particularly complicated because of history: it was originally a small shell script using <code>git format-patch</code> and <code>git am</code>, but that has some flaws, so it was rewritten as a much fanci... | <blockquote> <p>To that end, how does git rebase work under the hood?</p> </blockquote> <p>It's complicated. It's particularly complicated because of history: it was originally a small shell script using <code>git format-patch</code> and <code>git am</code>, but that has some flaws, so it was rewritten as a much fanci... | 119, 29934, 106016 | git, git-plumbing, git-rebase | <h1>How does `git rebase` work under the hood?</h1>
<p>I recently started working with git trees and temporary index files to construct commits without modifying my working directory, for the purpose of automating some tasks. The ultimate goal is to effectively rebase some branch (e.g. <code>feature/x_y_z</code> on top... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,457 | git | # How does `git rebase` work under the hood?
I recently started working with git trees and temporary index files to construct commits without modifying my working directory, for the purpose of automating some tasks. The ultimate goal is to effectively rebase some branch (e.g. `feature/x_y_z` on top of `main`), but wit... | > To that end, how does git rebase work under the hood?
It's complicated. It's particularly complicated because of history: it was originally a small shell script using `git format-patch` and `git am`, but that has some flaws, so it was rewritten as a much fancier set of shell scripts. These included a merge based bac... |
46628436 | How to fix "fatal: remote origin already exists." on 'git remote add'? | 7 | 2017-10-08 07:15:16 | <p>I want to create a git repository on my USB stick. On the stick I created a bare git repository by using the command</p>
<pre><code>git init --bare MyRepo
</code></pre>
<p>and in the repository on the laptop (Ubuntu 14.04) I issued the following commands</p>
<pre><code>git init
git add .
git commit -m 'first comm... | 14,620 | 1,581,090 | 2022-12-05 11:23:22 | 46,628,499 | 21 | 2017-10-08 07:23:26 | 4,133,798 | 2018-04-30 11:18:17 | https://stackoverflow.com/q/46628436 | https://stackoverflow.com/a/46628499 | <p>Remove the remote <code>origin</code> first, then add again with the path.</p>
<pre><code>$ git remote rm origin
$ git remote add origin <repo-url>
</code></pre>
<p><strong>Another way:</strong> Set the <code>origin's</code> url instead of adding.</p>
<pre><code>$ git remote set-url origin <repo-url>... | <p>Remove the remote <code>origin</code> first, then add again with the path.</p> <pre><code>$ git remote rm origin $ git remote add origin <repo-url> </code></pre> <p><strong>Another way:</strong> Set the <code>origin's</code> url instead of adding.</p> <pre><code>$ git remote set-url origin <repo-url>... | 119 | git | <h1>How to fix "fatal: remote origin already exists." on 'git remote add'?</h1>
<p>I want to create a git repository on my USB stick. On the stick I created a bare git repository by using the command</p>
<pre><code>git init --bare MyRepo
</code></pre>
<p>and in the repository on the laptop (Ubuntu 14.04) I issued the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,458 | git | # How to fix "fatal: remote origin already exists." on 'git remote add'?
I want to create a git repository on my USB stick. On the stick I created a bare git repository by using the command
```
git init --bare MyRepo
```
and in the repository on the laptop (Ubuntu 14.04) I issued the following commands
```
git init... | Remove the remote `origin` first, then add again with the path.
```
$ git remote rm origin
$ git remote add origin <repo-url>
```
**Another way:** Set the `origin's` url instead of adding.
```
$ git remote set-url origin <repo-url>
``` |
46264963 | db.sqlite3 cannot be ignored in git | 6 | 2017-09-17 14:07:08 | <p>I have add <code>*.sqlite3</code> to my <code>.gitignore_global</code> file:</p>
<p><img src="https://i.sstatic.net/W5rJl.jpg" alt=""></p>
<p>When I run <code>git status</code> in my terminal there still have <code>db.sqlite3</code> listed as modified:</p>
<p><img src="https://i.sstatic.net/y7cqx.jpg" alt=""></p>... | 8,951 | null | 2022-11-18 11:09:44 | 46,265,203 | 21 | 2017-09-17 14:31:39 | 354,577 | 2021-12-09 15:26:51 | https://stackoverflow.com/q/46264963 | https://stackoverflow.com/a/46265203 | <p>I see three issues here:</p>
<ol>
<li><p><strong><code>.gitignore_global</code> isn't a standard Git ignore file.</strong> If you haven't told Git about it it will have no effect. Something like <code>git config --global core.excludesfile <file></code> can be used to add a global ignore file.</p>
</li>
<li><p>... | <p>I see three issues here:</p> <ol> <li><p><strong><code>.gitignore_global</code> isn't a standard Git ignore file.</strong> If you haven't told Git about it it will have no effect. Something like <code>git config --global core.excludesfile <file></code> can be used to add a global ignore file.</p> </li> <li><p>... | 119 | git | <h1>db.sqlite3 cannot be ignored in git</h1>
<p>I have add <code>*.sqlite3</code> to my <code>.gitignore_global</code> file:</p>
<p><img src="https://i.sstatic.net/W5rJl.jpg" alt=""></p>
<p>When I run <code>git status</code> in my terminal there still have <code>db.sqlite3</code> listed as modified:</p>
<p><img src=... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,461 | git | # db.sqlite3 cannot be ignored in git
I have add `*.sqlite3` to my `.gitignore_global` file:

When I run `git status` in my terminal there still have `db.sqlite3` listed as modified:

How can I ignore my SQLite file? | I see three issues here:
1. **`.gitignore_global` isn't a standard Git ignore file.** If you haven't told Git about it it will have no effect. Something like `git config --global core.excludesfile <file>` can be used to add a global ignore file.
2. **Your screenshot actually doesn't show `*.sqlite3` in your ignore fil... |
17194107 | Git submodule new version update | 6 | 2013-06-19 14:35:38 | <p>I had forked a MapBox-ios-sdk and make some changes to it. A newer release of the sdk is here and I merged my the changes into my fork. MapBox-ios-sdk also incorporate SMCalloutView which is a submodule within MapBox-ios-sdk. However the version of the official sdk uses a newer, updated SMCalloutView that's not in m... | 8,378 | 133,747 | 2013-11-15 06:34:24 | 17,199,855 | 21 | 2013-06-19 19:37:54 | 6,309 | 2013-11-15 06:34:24 | https://stackoverflow.com/q/17194107 | https://stackoverflow.com/a/17199855 | <p>With <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L186-L188" rel="noreferrer">git 1.8.2+</a> (March 2013), you can define a submodule which will reflect the latest commit of a given branch.<br>
See "<a href="https://stackoverflow.com/a/9189815/6309">git submodule tracking latest</... | <p>With <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L186-L188" rel="noreferrer">git 1.8.2+</a> (March 2013), you can define a submodule which will reflect the latest commit of a given branch.<br> See "<a href="https://stackoverflow.com/a/9189815/6309">git submodule tracking latest</... | 119, 41612 | git, git-submodules | <h1>Git submodule new version update</h1>
<p>I had forked a MapBox-ios-sdk and make some changes to it. A newer release of the sdk is here and I merged my the changes into my fork. MapBox-ios-sdk also incorporate SMCalloutView which is a submodule within MapBox-ios-sdk. However the version of the official sdk uses a ne... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,462 | git | # Git submodule new version update
I had forked a MapBox-ios-sdk and make some changes to it. A newer release of the sdk is here and I merged my the changes into my fork. MapBox-ios-sdk also incorporate SMCalloutView which is a submodule within MapBox-ios-sdk. However the version of the official sdk uses a newer, upda... | With [git 1.8.2+](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt#L186-L188) (March 2013), you can define a submodule which will reflect the latest commit of a given branch.
See "[git submodule tracking latest](https://stackoverflow.com/a/9189815/6309)".
It means this would be enough to updat... |
527037 | git-svn not a git command? | 129 | 2009-02-09 03:04:33 | <p>While attempting to get an old svn dump of a project under git control, I ran into an interesting problem. Whenever I run <code>git svn</code>, I get an error saying it isn't a git command, yet there is documentation for it that I can pull up using <code>git help</code>. Is there something wrong with my install, o... | 83,912 | 1,256 | 2024-02-20 04:07:51 | 527,383 | 20 | 2009-02-09 08:00:33 | 6,309 | 2017-11-14 09:00:34 | https://stackoverflow.com/q/527037 | https://stackoverflow.com/a/527383 | <p>I am not sure that <a href="http://osdir.com/ml/version-control.msysgit/2008-01/msg00225.html" rel="noreferrer">git svn has ever worked</a> with recent Git Windows distribution (post 1.5.6).</p>
<p>Many problems <a href="http://article.gmane.org/gmane.comp.version-control.msysgit/2433" rel="noreferrer">have been re... | <p>I am not sure that <a href="http://osdir.com/ml/version-control.msysgit/2008-01/msg00225.html" rel="noreferrer">git svn has ever worked</a> with recent Git Windows distribution (post 1.5.6).</p> <p>Many problems <a href="http://article.gmane.org/gmane.comp.version-control.msysgit/2433" rel="noreferrer">have been re... | 63, 119, 6452 | git, git-svn, svn | <h1>git-svn not a git command?</h1>
<p>While attempting to get an old svn dump of a project under git control, I ran into an interesting problem. Whenever I run <code>git svn</code>, I get an error saying it isn't a git command, yet there is documentation for it that I can pull up using <code>git help</code>. Is ther... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,463 | git | # git-svn not a git command?
While attempting to get an old svn dump of a project under git control, I ran into an interesting problem. Whenever I run `git svn`, I get an error saying it isn't a git command, yet there is documentation for it that I can pull up using `git help`. Is there something wrong with my install... | I am not sure that [git svn has ever worked](http://osdir.com/ml/version-control.msysgit/2008-01/msg00225.html) with recent Git Windows distribution (post 1.5.6).
Many problems [have been reported](http://article.gmane.org/gmane.comp.version-control.msysgit/2433) before, so `git svn` may very much be not included in c... |
14821358 | Git mergetool with Meld on Windows | 107 | 2013-02-11 21:41:13 | <p>In Linux, my favorite merge tool is <a href="https://meldmerge.org/" rel="nofollow noreferrer">Meld</a>, and I've had no problems using or configuring it to work with Git. However, in Windows it has been a different story.</p>
<p>I configured my <code>.gitconfig</code> like so to use Meld as the default mergetool</... | 89,041 | 380,248 | 2025-01-15 00:27:18 | 48,979,939 | 20 | 2018-02-26 00:29:08 | 4,561,887 | 2025-01-15 00:27:18 | https://stackoverflow.com/q/14821358 | https://stackoverflow.com/a/48979939 |
<h2>How to use meld as your <code>git difftool</code> in place of <code>git diff</code></h2>
<p>(see also the screenshots of meld below):</p>
<h2>1. Windows:</h2>
<p>Download and install <a href="https://git-scm.com/download/win" rel="nofollow noreferrer">Git for Windows</a>, which includes a "Git Bash" Linu... | <h2>How to use meld as your <code>git difftool</code> in place of <code>git diff</code></h2> <p>(see also the screenshots of meld below):</p> <h2>1. Windows:</h2> <p>Download and install <a href="https://git-scm.com/download/win" rel="nofollow noreferrer">Git for Windows</a>, which includes a "Git Bash" Linu... | 119, 13630 | git, meld | <h1>Git mergetool with Meld on Windows</h1>
<p>In Linux, my favorite merge tool is <a href="https://meldmerge.org/" rel="nofollow noreferrer">Meld</a>, and I've had no problems using or configuring it to work with Git. However, in Windows it has been a different story.</p>
<p>I configured my <code>.gitconfig</code> li... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,464 | git | # Git mergetool with Meld on Windows
In Linux, my favorite merge tool is [Meld](https://meldmerge.org/), and I've had no problems using or configuring it to work with Git. However, in Windows it has been a different story.
I configured my `.gitconfig` like so to use Meld as the default mergetool
```
[merge] ... | ## How to use meld as your `git difftool` in place of `git diff`
(see also the screenshots of meld below):
## 1. Windows:
Download and install [Git for Windows](https://git-scm.com/download/win), which includes a "Git Bash" Linux-like terminal accessible via the right-click menu in any folder in Windows Explorer, on... |
43198273 | Which files in .idea folder should be tracked by Git? | 98 | 2017-04-04 04:29:33 | <p>Unlike Netbeans, in Jetbrains IDEs, the setting files related to user and team are mixed in the same folder that makes it tricky when you need to push them to git.</p>
<p>There is a number of sample git ignore files for these IDEs and <a href="https://intellij-support.jetbrains.com/hc/articles/206544839" rel="norefe... | 49,324 | 752,603 | 2024-08-10 06:37:45 | 44,690,814 | 20 | 2017-06-22 05:28:27 | 752,603 | 2024-08-10 06:37:45 | https://stackoverflow.com/q/43198273 | https://stackoverflow.com/a/44690814 | <p>I found the whitelist startegy indicated here suitable for most projects <a href="https://github.com/salarmehr/idea-gitignore" rel="nofollow noreferrer">https://github.com/salarmehr/idea-gitignore</a>, so you create/modify <code>.idea/.gitignore</code> as below.</p>
<pre><code>#### ignore all .idea files ...
*
####... | <p>I found the whitelist startegy indicated here suitable for most projects <a href="https://github.com/salarmehr/idea-gitignore" rel="nofollow noreferrer">https://github.com/salarmehr/idea-gitignore</a>, so you create/modify <code>.idea/.gitignore</code> as below.</p> <pre><code>#### ignore all .idea files ... * ####... | 119, 4333, 8945, 66821 | git, ignore, intellij-idea, phpstorm | <h1>Which files in .idea folder should be tracked by Git?</h1>
<p>Unlike Netbeans, in Jetbrains IDEs, the setting files related to user and team are mixed in the same folder that makes it tricky when you need to push them to git.</p>
<p>There is a number of sample git ignore files for these IDEs and <a href="https://in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,465 | git | # Which files in .idea folder should be tracked by Git?
Unlike Netbeans, in Jetbrains IDEs, the setting files related to user and team are mixed in the same folder that makes it tricky when you need to push them to git.
There is a number of sample git ignore files for these IDEs and <https://intellij-support.jetbrain... | I found the whitelist startegy indicated here suitable for most projects <https://github.com/salarmehr/idea-gitignore>, so you create/modify `.idea/.gitignore` as below.
```
#### ignore all .idea files ...
*
#### except
# Version Control configuration for your project
!vcs.xml
# how IDEA should treat the text files... |
18659959 | `git tag` sorted in chronological order of the date of the commit pointed to | 74 | 2013-09-06 14:16:38 | <p>The output from <code>git tag</code> is ordered alphabetically. I would like it to be ordered chronological (the date of the commits they are assigned to, not the date on which they were created), otherwise the output should stay the same.</p>
<p>I’ve tried the suggestion from <a href="http://networkadmin20.blogspo... | 34,790 | 458,274 | 2023-08-25 14:33:03 | 18,692,754 | 20 | 2013-09-09 06:42:26 | 458,274 | 2013-09-09 06:59:02 | https://stackoverflow.com/q/18659959 | https://stackoverflow.com/a/18692754 | <pre><code>git tag | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort | awk '{print $4}'
</code></pre>
| <pre><code>git tag | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort | awk '{print $4}' </code></pre> | 119, 134 | git, sorting | <h1>`git tag` sorted in chronological order of the date of the commit pointed to</h1>
<p>The output from <code>git tag</code> is ordered alphabetically. I would like it to be ordered chronological (the date of the commits they are assigned to, not the date on which they were created), otherwise the output should stay t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,466 | git | # `git tag` sorted in chronological order of the date of the commit pointed to
The output from `git tag` is ordered alphabetically. I would like it to be ordered chronological (the date of the commits they are assigned to, not the date on which they were created), otherwise the output should stay the same.
I’ve tried... | ```
git tag | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort | awk '{print $4}'
``` |
6400755 | git: Unable to index file - permission denied | 54 | 2011-06-19 05:27:07 | <p>Only for one file, I am getting the following error:</p>
<pre><code>error: unable to write sha1 filename /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47: Permission denied
error: wp/wp-admin/css/theme-install.dev.css: failed to insert into database
fatal: unable to index file wp/wp-admin/css/theme-... | 151,805 | 180,723 | 2024-04-24 09:22:42 | 6,404,434 | 20 | 2011-06-19 18:50:47 | 712,605 | 2011-06-19 19:05:08 | https://stackoverflow.com/q/6400755 | https://stackoverflow.com/a/6404434 | <p>Looking at the Git source code (<code>sha1_file.c</code>, function <code>move_temp_to_file()</code>) it looks like Git is failing to rename a temporary file named <code>/opt/www/.git/objects/3f/tmp_obj_XXXXXX</code> (where <code>XXXXXX</code> is six random characters) to <code>/opt/www/.git/objects/3f/ce3587c54a8be1... | <p>Looking at the Git source code (<code>sha1_file.c</code>, function <code>move_temp_to_file()</code>) it looks like Git is failing to rename a temporary file named <code>/opt/www/.git/objects/3f/tmp_obj_XXXXXX</code> (where <code>XXXXXX</code> is six random characters) to <code>/opt/www/.git/objects/3f/ce3587c54a8be1... | 119, 317, 14215 | addition, git, indexing | <h1>git: Unable to index file - permission denied</h1>
<p>Only for one file, I am getting the following error:</p>
<pre><code>error: unable to write sha1 filename /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47: Permission denied
error: wp/wp-admin/css/theme-install.dev.css: failed to insert into data... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,467 | git | # git: Unable to index file - permission denied
Only for one file, I am getting the following error:
```
error: unable to write sha1 filename /opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47: Permission denied
error: wp/wp-admin/css/theme-install.dev.css: failed to insert into database
fatal: unable t... | Looking at the Git source code (`sha1_file.c`, function `move_temp_to_file()`) it looks like Git is failing to rename a temporary file named `/opt/www/.git/objects/3f/tmp_obj_XXXXXX` (where `XXXXXX` is six random characters) to `/opt/www/.git/objects/3f/ce3587c54a8be14c69b08c6b01f94949b11b47`. This can happen if you do... |
38171899 | How to reduce the depth of an existing git clone? | 53 | 2016-07-03 16:21:09 | <p>I have a clone. I want to reduce the history on it, without cloning from scratch with a reduced depth. Worked example:</p>
<pre><code>$ git clone git@github.com:apache/spark.git
# ...
$ cd spark/
$ du -hs .git
193M .git
</code></pre>
<p>OK, so that's not so but, but it'll serve for this discussion. If I try <... | 19,576 | 832,725 | 2023-08-18 13:05:49 | 38,194,119 | 20 | 2016-07-05 01:48:51 | 1,290,731 | 2018-01-01 17:44:28 | https://stackoverflow.com/q/38171899 | https://stackoverflow.com/a/38194119 | <pre><code>git clone --mirror --depth=5 file://$PWD ../temp
rm -rf .git/objects
mv ../temp/{shallow,objects} .git
rm -rf ../temp
</code></pre>
<p>This really isn't cloning "from scratch", as it's purely local work and it creates virtually nothing more than the shallowed-out pack files, probably in the tens of kbytes ... | <pre><code>git clone --mirror --depth=5 file://$PWD ../temp rm -rf .git/objects mv ../temp/{shallow,objects} .git rm -rf ../temp </code></pre> <p>This really isn't cloning "from scratch", as it's purely local work and it creates virtually nothing more than the shallowed-out pack files, probably in the tens of kbytes ... | 119 | git | <h1>How to reduce the depth of an existing git clone?</h1>
<p>I have a clone. I want to reduce the history on it, without cloning from scratch with a reduced depth. Worked example:</p>
<pre><code>$ git clone git@github.com:apache/spark.git
# ...
$ cd spark/
$ du -hs .git
193M .git
</code></pre>
<p>OK, so that's n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,468 | git | # How to reduce the depth of an existing git clone?
I have a clone. I want to reduce the history on it, without cloning from scratch with a reduced depth. Worked example:
```
$ git clone git@github.com:apache/spark.git
# ...
$ cd spark/
$ du -hs .git
193M .git
```
OK, so that's not so but, but it'll serve for thi... | ```
git clone --mirror --depth=5 file://$PWD ../temp
rm -rf .git/objects
mv ../temp/{shallow,objects} .git
rm -rf ../temp
```
This really isn't cloning "from scratch", as it's purely local work and it creates virtually nothing more than the shallowed-out pack files, probably in the tens of kbytes total. I'd venture y... |
15015894 | git add Signed-off-by line using format.signoff not working | 52 | 2013-02-22 02:32:27 | <p>My client git version is 1.7.0.4.</p>
<p>I want to automatically add a "Signed-off-by" line for the committer at the end of the commit log message when commit a message.</p>
<ol>
<li>When I set <code>git config --global format.signoff true</code>, and run <code>git commit -m "modify something"</code>, I see no "Si... | 29,571 | 1,414,448 | 2025-04-11 09:46:19 | 15,018,905 | 20 | 2013-02-22 07:20:32 | 6,309 | 2017-10-08 06:44:10 | https://stackoverflow.com/q/15015894 | https://stackoverflow.com/a/15018905 | <p>Update for Git 2.14.x/2.15: as I mentioned in "<a href="https://stackoverflow.com/a/41361273/6309">Git - Detect if commit is signed off programmatically</a>", you will be able to parse a commit message trailer for <code>Signed-off-By</code> line.</p>
<blockquote>
<p>"<code>git interpret-trailers</code>" has been ... | <p>Update for Git 2.14.x/2.15: as I mentioned in "<a href="https://stackoverflow.com/a/41361273/6309">Git - Detect if commit is signed off programmatically</a>", you will be able to parse a commit message trailer for <code>Signed-off-By</code> line.</p> <blockquote> <p>"<code>git interpret-trailers</code>" has been ... | 119, 245, 3574 | config, format, git | <h1>git add Signed-off-by line using format.signoff not working</h1>
<p>My client git version is 1.7.0.4.</p>
<p>I want to automatically add a "Signed-off-by" line for the committer at the end of the commit log message when commit a message.</p>
<ol>
<li>When I set <code>git config --global format.signoff true</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,469 | git | # git add Signed-off-by line using format.signoff not working
My client git version is 1.7.0.4.
I want to automatically add a "Signed-off-by" line for the committer at the end of the commit log message when commit a message.
1. When I set `git config --global format.signoff true`, and run `git commit -m "modify some... | Update for Git 2.14.x/2.15: as I mentioned in "[Git - Detect if commit is signed off programmatically](https://stackoverflow.com/a/41361273/6309)", you will be able to parse a commit message trailer for `Signed-off-By` line.
> "`git interpret-trailers`" has been taught a "`--parse`" and a few other options to make it ... |
2969214 | git: programmatically know by how much the branch is ahead/behind a remote branch | 48 | 2010-06-03 19:43:21 | <p>I would like to extract the information that is printed after a <code>git status</code>, which looks like:</p>
<pre><code># On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
</code></pre>
<p>Of course I can parse the output of <code>git status</code> but this is not recommended since this hu... | 15,267 | 262,667 | 2021-06-22 19:32:59 | 2,970,101 | 20 | 2010-06-03 22:01:21 | 85,134 | 2014-06-17 10:15:59 | https://stackoverflow.com/q/2969214 | https://stackoverflow.com/a/2970101 | <p><strong>update</strong></p>
<p>As pointed out by amalloy, recent versions of git support finding the matching tracking branch for a given branch by giving "branchname@{upstream}" (or "branchname@{u}", or "@{u}" for the tracking branch of HEAD). This effectively supercedes the script below. You can do:</p>
<pre cla... | <p><strong>update</strong></p> <p>As pointed out by amalloy, recent versions of git support finding the matching tracking branch for a given branch by giving "branchname@{upstream}" (or "branchname@{u}", or "@{u}" for the tracking branch of HEAD). This effectively supercedes the script below. You can do:</p> <pre cla... | 119, 54839 | git, git-status | <h1>git: programmatically know by how much the branch is ahead/behind a remote branch</h1>
<p>I would like to extract the information that is printed after a <code>git status</code>, which looks like:</p>
<pre><code># On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
</code></pre>
<p>Of course ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,471 | git | # git: programmatically know by how much the branch is ahead/behind a remote branch
I would like to extract the information that is printed after a `git status`, which looks like:
```
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
```
Of course I can parse the output of `git status` but t... | **update**
As pointed out by amalloy, recent versions of git support finding the matching tracking branch for a given branch by giving "branchname@{upstream}" (or "branchname@{u}", or "@{u}" for the tracking branch of HEAD). This effectively supercedes the script below. You can do:
```
git rev-list @{u}..
git rev-lis... |
2141492 | git-clone and post-checkout hook | 44 | 2010-01-26 18:01:52 | <p>According to the manual, the <code>post-checkout</code> hook is run after a <code>git checkout</code> (just as expected) but also after a <code>git clone</code> (unless you pass <code>--no-checkout</code>).</p>
<p>Very well, now, considering the following:</p>
<ul>
<li>you don't have a local repository before a <c... | 40,826 | 227,887 | 2023-10-27 07:53:39 | 2,141,548 | 20 | 2010-01-26 18:11:51 | 119,963 | 2023-10-27 07:53:39 | https://stackoverflow.com/q/2141492 | https://stackoverflow.com/a/2141548 | <p>I suppose you could make a custom installation - rename the hooks in <code>.../share/git-core/templates/hooks</code> to remove the <code>.sample</code> suffix.</p>
<p>You could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. <code>post-checkout -> ../../hooks/post... | <p>I suppose you could make a custom installation - rename the hooks in <code>.../share/git-core/templates/hooks</code> to remove the <code>.sample</code> suffix.</p> <p>You could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. <code>post-checkout -> ../../hooks/post... | 119, 853, 34099 | git, git-clone, hook | <h1>git-clone and post-checkout hook</h1>
<p>According to the manual, the <code>post-checkout</code> hook is run after a <code>git checkout</code> (just as expected) but also after a <code>git clone</code> (unless you pass <code>--no-checkout</code>).</p>
<p>Very well, now, considering the following:</p>
<ul>
<li>you... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,473 | git | # git-clone and post-checkout hook
According to the manual, the `post-checkout` hook is run after a `git checkout` (just as expected) but also after a `git clone` (unless you pass `--no-checkout`).
Very well, now, considering the following:
- you don't have a local repository before a `git clone`
- hooks are not syn... | I suppose you could make a custom installation - rename the hooks in `.../share/git-core/templates/hooks` to remove the `.sample` suffix.
You could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. `post-checkout -> ../../hooks/post-checkout`). Then if the cloned repo co... |
35962754 | How can I prevent foxtrot merges in my 'master' branch? | 43 | 2016-03-12 20:12:54 | <p>A foxtrot merge is a merge where 'origin/master' merges in as a 2nd (or later) parent, like so:</p>
<p><a href="https://i.sstatic.net/yZMCS.png"><img src="https://i.sstatic.net/yZMCS.png" alt="Commit 'D' is a foxtrot merge because 'origin/master' is its 2nd parent."></a></p>
<p><sup><i>Commit 'D' i... | 19,052 | 5,819,286 | 2021-04-27 00:38:12 | 35,962,849 | 20 | 2016-03-12 20:22:57 | 5,819,286 | 2016-03-22 15:43:30 | https://stackoverflow.com/q/35962754 | https://stackoverflow.com/a/35962849 | <p>The following pre-receive hook will block those:</p>
<pre class="lang-sh prettyprint-override"><code>#/bin/bash
# Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/
# Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek
# License: MIT license. https://opensource.org/licenses/MIT
while r... | <p>The following pre-receive hook will block those:</p> <pre class="lang-sh prettyprint-override"><code>#/bin/bash # Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/ # Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek # License: MIT license. https://opensource.org/licenses/MIT while r... | 119, 717, 28897 | git, git-merge, merge | <h1>How can I prevent foxtrot merges in my 'master' branch?</h1>
<p>A foxtrot merge is a merge where 'origin/master' merges in as a 2nd (or later) parent, like so:</p>
<p><a href="https://i.sstatic.net/yZMCS.png"><img src="https://i.sstatic.net/yZMCS.png" alt="Commit 'D' is a foxtrot merge because 'origin/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,474 | git | # How can I prevent foxtrot merges in my 'master' branch?
A foxtrot merge is a merge where 'origin/master' merges in as a 2nd (or later) parent, like so:
[](https://i.sstatic.net/yZMCS.png)
*Commit 'D' is a fo... | The following pre-receive hook will block those:
```
#/bin/bash
# Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/
# Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek
# License: MIT license. https://opensource.org/licenses/MIT
while read oldrev newrev refname
do
if [ "$refname" = "ref... |
14182259 | How to automatically resolve a Git conflict by taking the version in the current branch? | 43 | 2013-01-06 12:46:45 | <p>Let's suppose that I get a merge conflict on <code>foo/bar.txt</code> when running this:</p>
<pre><code>$ git checkout A
$ git merge B
</code></pre>
<p>I'd like to automatically resolve the conflict by taking <code>foo/bar.txt</code> from branch A. (I know what I'm doing, and I do need this. The version in branch ... | 56,302 | 97,248 | 2024-02-23 18:59:30 | 14,185,951 | 20 | 2013-01-06 19:38:59 | 1,290,731 | 2013-01-06 19:53:58 | https://stackoverflow.com/q/14182259 | https://stackoverflow.com/a/14185951 | <p>If you want to do it as a one-off, the single-line command is:</p>
<pre><code>$ git checkout --ours foo/bar.txt # <-- resets it only if the merge found conflicts in this file
$ git checkout HEAD -- foo/bar.txt # <-- resets it to that specific version no matter what
</code></pre>
<p>To configure git's merge ... | <p>If you want to do it as a one-off, the single-line command is:</p> <pre><code>$ git checkout --ours foo/bar.txt # <-- resets it only if the merge found conflicts in this file $ git checkout HEAD -- foo/bar.txt # <-- resets it to that specific version no matter what </code></pre> <p>To configure git's merge ... | 119, 717, 1362, 3146 | automation, conflict, git, merge | <h1>How to automatically resolve a Git conflict by taking the version in the current branch?</h1>
<p>Let's suppose that I get a merge conflict on <code>foo/bar.txt</code> when running this:</p>
<pre><code>$ git checkout A
$ git merge B
</code></pre>
<p>I'd like to automatically resolve the conflict by taking <code>fo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,475 | git | # How to automatically resolve a Git conflict by taking the version in the current branch?
Let's suppose that I get a merge conflict on `foo/bar.txt` when running this:
```
$ git checkout A
$ git merge B
```
I'd like to automatically resolve the conflict by taking `foo/bar.txt` from branch A. (I know what I'm doing,... | If you want to do it as a one-off, the single-line command is:
```
$ git checkout --ours foo/bar.txt # <-- resets it only if the merge found conflicts in this file
$ git checkout HEAD -- foo/bar.txt # <-- resets it to that specific version no matter what
```
To configure git's merge to permanently ignore all upstrea... |
20794979 | Git submodule is in "detached head" state after cloning and submodule update | 40 | 2013-12-27 04:55:17 | <p>When I clone my git repo, one of the submodules is in a branch with a strange name, which I think means it has a "<strong>detached head</strong>" (I'm not even sure what that means).</p>
<p>If I checkout my main branch for the submodule, then run "<code>git submodule update --init --recursive</code>" it happens aga... | 33,525 | 706,628 | 2023-01-16 16:39:37 | 20,796,019 | 20 | 2013-12-27 06:34:05 | 955,926 | 2013-12-27 06:34:05 | https://stackoverflow.com/q/20794979 | https://stackoverflow.com/a/20796019 | <p>The contents of git directories are stored in simple text file manifests (i.e. directory listings) called "trees" that look like the following, where blobs are the contents of files, and trees are yet more trees like this one:</p>
<pre><code>100644 blob 0c31be662540ce902cee106f86bfdeef519fc662 .gitignore
100644 ... | <p>The contents of git directories are stored in simple text file manifests (i.e. directory listings) called "trees" that look like the following, where blobs are the contents of files, and trees are yet more trees like this one:</p> <pre><code>100644 blob 0c31be662540ce902cee106f86bfdeef519fc662 .gitignore 100644 ... | 119 | git | <h1>Git submodule is in "detached head" state after cloning and submodule update</h1>
<p>When I clone my git repo, one of the submodules is in a branch with a strange name, which I think means it has a "<strong>detached head</strong>" (I'm not even sure what that means).</p>
<p>If I checkout my main branch for the sub... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,476 | git | # Git submodule is in "detached head" state after cloning and submodule update
When I clone my git repo, one of the submodules is in a branch with a strange name, which I think means it has a "**detached head**" (I'm not even sure what that means).
If I checkout my main branch for the submodule, then run "`git submod... | The contents of git directories are stored in simple text file manifests (i.e. directory listings) called "trees" that look like the following, where blobs are the contents of files, and trees are yet more trees like this one:
```
100644 blob 0c31be662540ce902cee106f86bfdeef519fc662 .gitignore
100644 blob 1d364edf5... |
6666489 | Is there a simple command to convert a branch to a tag? | 36 | 2011-07-12 15:10:51 | <p>I am about to complete a tedious process of converting "dumb snapshots" to git. This process has been going very well (thanks to <a href="https://stackoverflow.com/questions/6628539/how-to-tell-git-that-its-the-same-directory-just-a-different-name/6629505#6629505">this rename process</a>), but now I realized that so... | 11,073 | 586,707 | 2019-12-19 17:13:30 | 6,666,885 | 20 | 2011-07-12 15:35:30 | 275,354 | 2011-07-12 15:47:18 | https://stackoverflow.com/q/6666489 | https://stackoverflow.com/a/6666885 | <p>Was there separate development on these branches? (the post you linked to, doesn't appear to have development on those branches)
If there was no development, you could:</p>
<ol>
<li>Checkout the branch <code>git checkout branchName</code>.</li>
<li>Tag it with <code>git tag tagName</code>. </li>
<li>Switch back to... | <p>Was there separate development on these branches? (the post you linked to, doesn't appear to have development on those branches) If there was no development, you could:</p> <ol> <li>Checkout the branch <code>git checkout branchName</code>.</li> <li>Tag it with <code>git tag tagName</code>. </li> <li>Switch back to... | 119, 60718, 76220 | git, git-branch, git-tag | <h1>Is there a simple command to convert a branch to a tag?</h1>
<p>I am about to complete a tedious process of converting "dumb snapshots" to git. This process has been going very well (thanks to <a href="https://stackoverflow.com/questions/6628539/how-to-tell-git-that-its-the-same-directory-just-a-different-name/6629... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,477 | git | # Is there a simple command to convert a branch to a tag?
I am about to complete a tedious process of converting "dumb snapshots" to git. This process has been going very well (thanks to [this rename process](https://stackoverflow.com/questions/6628539/how-to-tell-git-that-its-the-same-directory-just-a-different-name/... | Was there separate development on these branches? (the post you linked to, doesn't appear to have development on those branches)
If there was no development, you could:
1. Checkout the branch `git checkout branchName`.
2. Tag it with `git tag tagName`.
3. Switch back to master `git checkout master`.
4. Finally, delete... |
6011172 | How to compute the git hash-object of a directory? | 34 | 2011-05-15 20:53:28 | <p>Does anyone have an example of using git hash-object on a directory? It works easily enough on a file* but doesn't work as I'd expect for a directory**</p>
<pre><code>*: git hash-object c:\somefile.txt
**: git hash-object -t tree c:\somedirectory
</code></pre>
<p>When I try to use hash-object with the directory,... | 23,960 | 32,203 | 2023-03-03 23:57:10 | 6,011,324 | 20 | 2011-05-15 21:19:08 | 223,092 | 2023-03-03 23:57:10 | https://stackoverflow.com/q/6011172 | https://stackoverflow.com/a/6011324 | <p><code>git hash-object -t tree</code> is expecting the file parameter to be a file that describes the entries in the tree, rather than a directory in the filesystem. I understand from the comment <a href="http://lists-archives.org/git/665232-treewalk-d-f-conflict-detection.html" rel="nofollow noreferrer">here</a> th... | <p><code>git hash-object -t tree</code> is expecting the file parameter to be a file that describes the entries in the tree, rather than a directory in the filesystem. I understand from the comment <a href="http://lists-archives.org/git/665232-treewalk-d-f-conflict-detection.html" rel="nofollow noreferrer">here</a> th... | 119 | git | <h1>How to compute the git hash-object of a directory?</h1>
<p>Does anyone have an example of using git hash-object on a directory? It works easily enough on a file* but doesn't work as I'd expect for a directory**</p>
<pre><code>*: git hash-object c:\somefile.txt
**: git hash-object -t tree c:\somedirectory
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,478 | git | # How to compute the git hash-object of a directory?
Does anyone have an example of using git hash-object on a directory? It works easily enough on a file* but doesn't work as I'd expect for a directory**
```
*: git hash-object c:\somefile.txt
**: git hash-object -t tree c:\somedirectory
```
When I try to use hash-... | `git hash-object -t tree` is expecting the file parameter to be a file that describes the entries in the tree, rather than a directory in the filesystem. I understand from the comment [here](http://lists-archives.org/git/665232-treewalk-d-f-conflict-detection.html) that this command is expecting a file that describes t... |
41628914 | How to find last git commit before a merge | 33 | 2017-01-13 06:50:47 | <p>After I have done a merge to my master branch from a working branch with git, I sometimes want to find to find the last commit on master before the merge happened. How do I do this?</p>
| 22,921 | 1,299,362 | 2024-10-09 13:51:06 | 41,628,915 | 20 | 2017-01-13 06:50:47 | 1,299,362 | 2017-01-14 21:41:15 | https://stackoverflow.com/q/41628914 | https://stackoverflow.com/a/41628915 | <p>A quick way to do this is to type </p>
<pre><code>git log --pretty=format:'%h : %s' --graph
</code></pre>
<p>then just follow down the graph on the right hand side till you find the merge point. You can also do</p>
<pre><code>git log --pretty=format:'%h : %s' --graph > temp.txt
</code></pre>
<p>which puts th... | <p>A quick way to do this is to type </p> <pre><code>git log --pretty=format:'%h : %s' --graph </code></pre> <p>then just follow down the graph on the right hand side till you find the merge point. You can also do</p> <pre><code>git log --pretty=format:'%h : %s' --graph > temp.txt </code></pre> <p>which puts th... | 119 | git | <h1>How to find last git commit before a merge</h1>
<p>After I have done a merge to my master branch from a working branch with git, I sometimes want to find to find the last commit on master before the merge happened. How do I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,479 | git | # How to find last git commit before a merge
After I have done a merge to my master branch from a working branch with git, I sometimes want to find to find the last commit on master before the merge happened. How do I do this? | A quick way to do this is to type
```
git log --pretty=format:'%h : %s' --graph
```
then just follow down the graph on the right hand side till you find the merge point. You can also do
```
git log --pretty=format:'%h : %s' --graph > temp.txt
```
which puts the output into a file, `temp.txt`, that which you can ope... |
7564841 | Concept of git tracking and git staging | 33 | 2011-09-27 06:04:02 | <p>When you modify a file in your working directory, git tells you to use "git add" to stage.</p>
<p>When you add a new file to your working directory, git tells you to use "git add" to start tracking.</p>
<p>I am a bit confused about these 2 concepts because i assumed tracking a file for changes is different from st... | 11,097 | 653,858 | 2023-04-08 06:02:42 | 7,565,359 | 20 | 2011-09-27 07:05:53 | 112,968 | 2011-09-27 07:05:53 | https://stackoverflow.com/q/7564841 | https://stackoverflow.com/a/7565359 | <p>Git has a concept known as 'the index'. To create a new commit, you fill the index with the contents you'd like to have in the next commit. That means that you have to explicitly tell Git which changes you want to appear in the next commit by using <code>git add</code>. (<code>git add -p</code> to add only single hu... | <p>Git has a concept known as 'the index'. To create a new commit, you fill the index with the contents you'd like to have in the next commit. That means that you have to explicitly tell Git which changes you want to appear in the next commit by using <code>git add</code>. (<code>git add -p</code> to add only single hu... | 119, 20002 | git, staging | <h1>Concept of git tracking and git staging</h1>
<p>When you modify a file in your working directory, git tells you to use "git add" to stage.</p>
<p>When you add a new file to your working directory, git tells you to use "git add" to start tracking.</p>
<p>I am a bit confused about these 2 concepts because i assumed... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,480 | git | # Concept of git tracking and git staging
When you modify a file in your working directory, git tells you to use "git add" to stage.
When you add a new file to your working directory, git tells you to use "git add" to start tracking.
I am a bit confused about these 2 concepts because i assumed tracking a file for ch... | Git has a concept known as 'the index'. To create a new commit, you fill the index with the contents you'd like to have in the next commit. That means that you have to explicitly tell Git which changes you want to appear in the next commit by using `git add`. (`git add -p` to add only single hunks)
It doesn't make a d... |
2514859 | Regular expression for git repository | 32 | 2010-03-25 11:00:46 | <p>What will be proper regular expression for git repositories?</p>
<p>example link:
git@github.com:someone/someproject.git</p>
<p>so it will be like
[user]@[server]:[project].git</p>
<p>server can be url or ip
Project can contain some other characters than alphanumeric like '-'
I'm not sure what is the role of '/'<... | 36,829 | 251,920 | 2025-05-28 22:47:15 | 2,514,986 | 20 | 2010-03-25 11:24:11 | 268,330 | 2010-03-25 11:24:11 | https://stackoverflow.com/q/2514859 | https://stackoverflow.com/a/2514986 | <p>Git accepts a large range of repository URL expressions:</p>
<pre><code>* ssh://user@host.xz:port/path/to/repo.git/
* ssh://user@host.xz/path/to/repo.git/
* ssh://host.xz:port/path/to/repo.git/
* ssh://host.xz/path/to/repo.git/
* ssh://user@host.xz/path/to/repo.git/
* ssh://host.xz/path/to/repo.git/
* ssh://user@ho... | <p>Git accepts a large range of repository URL expressions:</p> <pre><code>* ssh://user@host.xz:port/path/to/repo.git/ * ssh://user@host.xz/path/to/repo.git/ * ssh://host.xz:port/path/to/repo.git/ * ssh://host.xz/path/to/repo.git/ * ssh://user@host.xz/path/to/repo.git/ * ssh://host.xz/path/to/repo.git/ * ssh://user@ho... | 18, 119 | git, regex | <h1>Regular expression for git repository</h1>
<p>What will be proper regular expression for git repositories?</p>
<p>example link:
git@github.com:someone/someproject.git</p>
<p>so it will be like
[user]@[server]:[project].git</p>
<p>server can be url or ip
Project can contain some other characters than alphanumeric... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,482 | git | # Regular expression for git repository
What will be proper regular expression for git repositories?
example link:
git@github.com:someone/someproject.git
so it will be like
[user]@[server]:[project].git
server can be url or ip
Project can contain some other characters than alphanumeric like '-'
I'm not sure what is... | Git accepts a large range of repository URL expressions:
```
* ssh://user@host.xz:port/path/to/repo.git/
* ssh://user@host.xz/path/to/repo.git/
* ssh://host.xz:port/path/to/repo.git/
* ssh://host.xz/path/to/repo.git/
* ssh://user@host.xz/path/to/repo.git/
* ssh://host.xz/path/to/repo.git/
* ssh://user@host.xz/~user/pa... |
60768651 | What does * alongside a branch name in VS-code mean? | 31 | 2020-03-20 04:39:59 | <p>I am unable to know why is there a <code>*</code> beside my git branch name in Visual studio code. Is there something I should be wary about? </p>
| 11,303 | 6,253,559 | 2022-03-28 05:08:17 | 60,768,872 | 20 | 2020-03-20 05:13:21 | 465,082 | 2020-03-20 05:13:21 | https://stackoverflow.com/q/60768651 | https://stackoverflow.com/a/60768872 | <p>Most shell colorisation plugins and IDEs typically use <code>*</code> for branch names denote that the current branch has files that have been modified, or sometimes only denote that the local repositories have files that were created, but not added to the "index" in git, which means those files haven't been <code>g... | <p>Most shell colorisation plugins and IDEs typically use <code>*</code> for branch names denote that the current branch has files that have been modified, or sometimes only denote that the local repositories have files that were created, but not added to the "index" in git, which means those files haven't been <code>g... | 119, 8337, 111608 | bitbucket, git, visual-studio-code | <h1>What does * alongside a branch name in VS-code mean?</h1>
<p>I am unable to know why is there a <code>*</code> beside my git branch name in Visual studio code. Is there something I should be wary about? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,483 | git | # What does * alongside a branch name in VS-code mean?
I am unable to know why is there a `*` beside my git branch name in Visual studio code. Is there something I should be wary about? | Most shell colorisation plugins and IDEs typically use `*` for branch names denote that the current branch has files that have been modified, or sometimes only denote that the local repositories have files that were created, but not added to the "index" in git, which means those files haven't been `git add`-ed. This is... |
18429086 | Is there a way to reuse the previous comment on a git commit? | 31 | 2013-08-25 12:41:46 | <p>Occasionally I will drop into troubleshooting mode and commit/push a number of small but separate commits with a comment like, "Troubleshooting the <something> during deployment to Heroku." I would like to use the same comment for each commit without having to retype it. Is this possible?</p>
| 20,578 | 521,662 | 2018-06-15 12:08:36 | 18,429,131 | 20 | 2013-08-25 12:46:56 | 216,063 | 2013-08-25 19:09:13 | https://stackoverflow.com/q/18429086 | https://stackoverflow.com/a/18429131 | <p>At first, I answered:</p>
<blockquote>
<p>I guess <code>git commit --reuse-message=HEAD</code> does it</p>
</blockquote>
<p>Then I thought that's not what you wanted and deleted it. Then life caught up and got AFK for a couple of hours. Anyways, despite an answer having already been accepted, I would have sugges... | <p>At first, I answered:</p> <blockquote> <p>I guess <code>git commit --reuse-message=HEAD</code> does it</p> </blockquote> <p>Then I thought that's not what you wanted and deleted it. Then life caught up and got AFK for a couple of hours. Anyways, despite an answer having already been accepted, I would have sugges... | 119 | git | <h1>Is there a way to reuse the previous comment on a git commit?</h1>
<p>Occasionally I will drop into troubleshooting mode and commit/push a number of small but separate commits with a comment like, "Troubleshooting the <something> during deployment to Heroku." I would like to use the same comment for each comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,484 | git | # Is there a way to reuse the previous comment on a git commit?
Occasionally I will drop into troubleshooting mode and commit/push a number of small but separate commits with a comment like, "Troubleshooting the <something> during deployment to Heroku." I would like to use the same comment for each commit without havi... | At first, I answered:
> I guess `git commit --reuse-message=HEAD` does it
Then I thought that's not what you wanted and deleted it. Then life caught up and got AFK for a couple of hours. Anyways, despite an answer having already been accepted, I would have suggested:
```
$ git config alias.troubleshoot '!troubleshoo... |
17995092 | What does a hunk mean in relation to pushes on sourcetree | 29 | 2013-08-01 13:13:33 | <p>When I make changes on my "develop" branch, I see an up-arrow beside the branch telling me how many changes will be pushed. What confuses me thou is how sourcetree decides what the number is?</p>
<p>It seems to relate to something called hunks? What are hunks?</p>
<p>Is there an equiavalent git commit which retu... | 38,630 | 2,219,989 | 2017-11-22 10:07:11 | 17,995,320 | 20 | 2013-08-01 13:23:47 | 912,144 | 2013-08-01 13:42:56 | https://stackoverflow.com/q/17995092 | https://stackoverflow.com/a/17995320 | <p>Note that the number of changes to be pushed probably refers to number of commits you are ahead of origin/master and is unrelated to hunks. To see the commits you are ahead of master, you can do the following:</p>
<pre><code># get most recent commit found in both master and origin/master
mb=$(git merge-base master ... | <p>Note that the number of changes to be pushed probably refers to number of commits you are ahead of origin/master and is unrelated to hunks. To see the commits you are ahead of master, you can do the following:</p> <pre><code># get most recent commit found in both master and origin/master mb=$(git merge-base master ... | 119, 90056 | atlassian-sourcetree, git | <h1>What does a hunk mean in relation to pushes on sourcetree</h1>
<p>When I make changes on my "develop" branch, I see an up-arrow beside the branch telling me how many changes will be pushed. What confuses me thou is how sourcetree decides what the number is?</p>
<p>It seems to relate to something called hunks? Wh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,487 | git | # What does a hunk mean in relation to pushes on sourcetree
When I make changes on my "develop" branch, I see an up-arrow beside the branch telling me how many changes will be pushed. What confuses me thou is how sourcetree decides what the number is?
It seems to relate to something called hunks? What are hunks?
Is ... | Note that the number of changes to be pushed probably refers to number of commits you are ahead of origin/master and is unrelated to hunks. To see the commits you are ahead of master, you can do the following:
```
# get most recent commit found in both master and origin/master
mb=$(git merge-base master origin/master)... |
2752168 | Convert SVN Subdirectory to Git | 29 | 2010-05-02 01:32:25 | <p>I would like to ditch SVN for Git. My current SVN repository setup has projects under trunk (<code>/trunk/projecta</code>, <code>/trunk/projectb</code>, etc. with tags and branches at <code>/tags/projecta-1.0</code>, etc.). I would like to create distinct Git repos for each of these projects by pulling them out of S... | 10,424 | 73,004 | 2013-05-17 00:24:24 | 2,752,275 | 20 | 2010-05-02 02:43:39 | 9,990 | 2013-01-29 02:42:46 | https://stackoverflow.com/q/2752168 | https://stackoverflow.com/a/2752275 | <p>This is tricky. To get, e.g., the tags for a project, all its tags have to be under a common directory, but your structure has all projects sharing a single tag directory.</p>
<p>Perhaps you could move /tags/projecta-1.0 to /tags/projecta/1.0 and so on, and then import projects into git one at a time:</p>
<pre><co... | <p>This is tricky. To get, e.g., the tags for a project, all its tags have to be under a common directory, but your structure has all projects sharing a single tag directory.</p> <p>Perhaps you could move /tags/projecta-1.0 to /tags/projecta/1.0 and so on, and then import projects into git one at a time:</p> <pre><co... | 63, 119, 6452 | git, git-svn, svn | <h1>Convert SVN Subdirectory to Git</h1>
<p>I would like to ditch SVN for Git. My current SVN repository setup has projects under trunk (<code>/trunk/projecta</code>, <code>/trunk/projectb</code>, etc. with tags and branches at <code>/tags/projecta-1.0</code>, etc.). I would like to create distinct Git repos for each o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,488 | git | # Convert SVN Subdirectory to Git
I would like to ditch SVN for Git. My current SVN repository setup has projects under trunk (`/trunk/projecta`, `/trunk/projectb`, etc. with tags and branches at `/tags/projecta-1.0`, etc.). I would like to create distinct Git repos for each of these projects by pulling them out of SV... | This is tricky. To get, e.g., the tags for a project, all its tags have to be under a common directory, but your structure has all projects sharing a single tag directory.
Perhaps you could move /tags/projecta-1.0 to /tags/projecta/1.0 and so on, and then import projects into git one at a time:
```
git-svn init --tru... |
176137 | Java, convert lat/lon to UTM | 29 | 2008-10-06 20:50:24 | <p>Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.</p>
| 71,253 | 24,396 | 2019-05-06 15:21:25 | 176,925 | 20 | 2008-10-07 01:43:31 | 24,396 | 2009-09-03 23:48:38 | https://stackoverflow.com/q/176137 | https://stackoverflow.com/a/176925 | <p>I was able to use Geotools 2.4 to get something that works, based on some <a href="http://svn.geotools.org/trunk/demo/referencing/src/main/java/org/geotools/demo/referencing/CTSTutorial.java" rel="noreferrer">example code</a>.</p>
<pre><code>double utmZoneCenterLongitude = ... // Center lon of zone, example: zone ... | <p>I was able to use Geotools 2.4 to get something that works, based on some <a href="http://svn.geotools.org/trunk/demo/referencing/src/main/java/org/geotools/demo/referencing/CTSTutorial.java" rel="noreferrer">example code</a>.</p> <pre><code>double utmZoneCenterLongitude = ... // Center lon of zone, example: zone ... | 17, 3234, 10580, 20301, 56174 | geography, geolocation, geotools, java, latitude-longitude | <h1>Java, convert lat/lon to UTM</h1>
<p>Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,489 | git | # Java, convert lat/lon to UTM
Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious. | I was able to use Geotools 2.4 to get something that works, based on some [example code](http://svn.geotools.org/trunk/demo/referencing/src/main/java/org/geotools/demo/referencing/CTSTutorial.java).
```
double utmZoneCenterLongitude = ... // Center lon of zone, example: zone 10 = -123
int zoneNumber = ... ... |
56959154 | Git stash error "Cannot save the current status" | 28 | 2019-07-09 19:06:06 | <p>I'm getting this error when running "git stash"</p>
<pre><code>Cannot save the current status
</code></pre>
<p>with no other information.</p>
<p>Why is that?</p>
| 22,751 | 6,592,293 | 2023-12-22 18:12:09 | 56,960,329 | 20 | 2019-07-09 20:50:04 | 6,592,293 | 2023-12-22 18:12:09 | https://stackoverflow.com/q/56959154 | https://stackoverflow.com/a/56960329 | <p>Found the solution here: <a href="https://stackoverflow.com/questions/18480174/git-stash-fails-error-unable-to-resolve-reference-refs-stash-no-such-file-or">Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'</a></p>
<pre><code>rm -f .git/refs/stash .git/refs/stash.lock... | <p>Found the solution here: <a href="https://stackoverflow.com/questions/18480174/git-stash-fails-error-unable-to-resolve-reference-refs-stash-no-such-file-or">Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'</a></p> <pre><code>rm -f .git/refs/stash .git/refs/stash.lock... | 119 | git | <h1>Git stash error "Cannot save the current status"</h1>
<p>I'm getting this error when running "git stash"</p>
<pre><code>Cannot save the current status
</code></pre>
<p>with no other information.</p>
<p>Why is that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,490 | git | # Git stash error "Cannot save the current status"
I'm getting this error when running "git stash"
```
Cannot save the current status
```
with no other information.
Why is that? | Found the solution here: [Git stash fails 'error: unable to resolve reference refs/stash: No such file or directory'](https://stackoverflow.com/questions/18480174/git-stash-fails-error-unable-to-resolve-reference-refs-stash-no-such-file-or)
```
rm -f .git/refs/stash .git/refs/stash.lock
```
That fixed it |
3055492 | git best practices for quickly switching between branches | 27 | 2010-06-16 16:59:51 | <p>I have multiple active branches that I need to work on at the same time. Clearly I can create two working directories with a distinct branch per directory. Is that the only way to do it without having to "commit" and "checkout" in order to switch from one branch to another?</p>
| 36,152 | 99,542 | 2014-10-23 14:28:59 | 3,055,504 | 20 | 2010-06-16 17:01:33 | 54,249 | 2010-06-16 17:01:33 | https://stackoverflow.com/q/3055492 | https://stackoverflow.com/a/3055504 | <p>Yes, though you can use <code>git stash</code> instead of <code>commit</code> if you're not ready to finalize your current work in progress.</p>
| <p>Yes, though you can use <code>git stash</code> instead of <code>commit</code> if you're not ready to finalize your current work in progress.</p> | 119 | git | <h1>git best practices for quickly switching between branches</h1>
<p>I have multiple active branches that I need to work on at the same time. Clearly I can create two working directories with a distinct branch per directory. Is that the only way to do it without having to "commit" and "checkout" in order to switch f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,491 | git | # git best practices for quickly switching between branches
I have multiple active branches that I need to work on at the same time. Clearly I can create two working directories with a distinct branch per directory. Is that the only way to do it without having to "commit" and "checkout" in order to switch from one bra... | Yes, though you can use `git stash` instead of `commit` if you're not ready to finalize your current work in progress. |
28691602 | Git - Same file with different versions on two branches, when merge do not want to overwrite | 26 | 2015-02-24 08:59:25 | <p>We have two branches -- 'master' and 'release'</p>
<p>And we have one file, like <code>fileA</code>, we want to keep different version on these two branches.</p>
<p>But each time, we have to merge 'release' into 'master', how can we achieve, the <code>fileA</code> in 'master' will not be overwritten by the <code>f... | 9,813 | 1,886,734 | 2017-12-22 19:16:08 | 47,946,325 | 20 | 2017-12-22 19:16:08 | 123,109 | 2017-12-22 19:16:08 | https://stackoverflow.com/q/28691602 | https://stackoverflow.com/a/47946325 | <p><a href="https://git-scm.com/book/en/v2" rel="noreferrer">Pro Git</a> describes how to get this effect in the <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies" rel="noreferrer">“Merge Strategies”</a> section of <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attrib... | <p><a href="https://git-scm.com/book/en/v2" rel="noreferrer">Pro Git</a> describes how to get this effect in the <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies" rel="noreferrer">“Merge Strategies”</a> section of <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Attrib... | 119, 20151, 53847 | branching-and-merging, git, multiple-versions | <h1>Git - Same file with different versions on two branches, when merge do not want to overwrite</h1>
<p>We have two branches -- 'master' and 'release'</p>
<p>And we have one file, like <code>fileA</code>, we want to keep different version on these two branches.</p>
<p>But each time, we have to merge 'release' into '... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,492 | git | # Git - Same file with different versions on two branches, when merge do not want to overwrite
We have two branches -- 'master' and 'release'
And we have one file, like `fileA`, we want to keep different version on these two branches.
But each time, we have to merge 'release' into 'master', how can we achieve, the `... | [Pro Git](https://git-scm.com/book/en/v2) describes how to get this effect in the [“Merge Strategies”](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies) section of [8.2 Customizing Git — Git Attributes](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes).
> ### Merge Strategie... |
37351709 | Git: pull vs. fetch→pull | 26 | 2016-05-20 16:37:48 | <p>I've never been able to get a clear answer to this question.</p>
<p>For a long time, and at the advisement of a coworker, I've been doing this:</p>
<pre><code>git fetch origin
git pull origin <mybranch>
</code></pre>
<p>I've been told (and have seen) that <code>git pull</code> does not behave the same way i... | 9,184 | 2,069,516 | 2016-05-20 19:48:41 | 37,354,761 | 20 | 2016-05-20 19:48:41 | 1,256,452 | 2016-05-20 19:48:41 | https://stackoverflow.com/q/37351709 | https://stackoverflow.com/a/37354761 | <p>We should probably close this as a duplicate, but before that happens, let me see if I can squeeze this in.</p>
<p>While <code>git pull</code> really <em>is</em> <code>git fetch</code> followed by <code>git merge</code> (or <code>git rebase</code>), the <em>precise</em> difference lies in <em>how</em> <code>git pul... | <p>We should probably close this as a duplicate, but before that happens, let me see if I can squeeze this in.</p> <p>While <code>git pull</code> really <em>is</em> <code>git fetch</code> followed by <code>git merge</code> (or <code>git rebase</code>), the <em>precise</em> difference lies in <em>how</em> <code>git pul... | 119 | git | <h1>Git: pull vs. fetch→pull</h1>
<p>I've never been able to get a clear answer to this question.</p>
<p>For a long time, and at the advisement of a coworker, I've been doing this:</p>
<pre><code>git fetch origin
git pull origin <mybranch>
</code></pre>
<p>I've been told (and have seen) that <code>git pull</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,493 | git | # Git: pull vs. fetch→pull
I've never been able to get a clear answer to this question.
For a long time, and at the advisement of a coworker, I've been doing this:
```
git fetch origin
git pull origin <mybranch>
```
I've been told (and have seen) that `git pull` does not behave the same way if you do not first do `... | We should probably close this as a duplicate, but before that happens, let me see if I can squeeze this in.
While `git pull` really *is* `git fetch` followed by `git merge` (or `git rebase`), the *precise* difference lies in *how* `git pull` runs `git fetch`.
Specifically:
`$ git pull`
or:
`$ git pull remote-name ... |
5175208 | what are the different repository format versions (for the core.repositoryFormatVersion setting) in git? | 25 | 2011-03-03 00:26:24 | <p>I noticed a default option in git <code>core.repositoryFormatVersion</code> which defaults to 0, but what are "repository format versions" and what functional difference do they make?</p>
| 16,459 | 10,608 | 2022-02-22 23:05:37 | 33,464,086 | 20 | 2015-11-01 15:53:05 | 6,309 | 2022-02-22 23:05:37 | https://stackoverflow.com/q/5175208 | https://stackoverflow.com/a/33464086 | <p>git 2.7 (Nov. 2015) adds a lot more information in the new <a href="https://github.com/git/git/blob/00a09d57eb8a041e6a6b0470c53533719c049bab/Documentation/technical/repository-version.txt" rel="nofollow noreferrer"><code>Documentation/technical/repository-version.txt</code></a>.<br />
See <a href="https://github.com... | <p>git 2.7 (Nov. 2015) adds a lot more information in the new <a href="https://github.com/git/git/blob/00a09d57eb8a041e6a6b0470c53533719c049bab/Documentation/technical/repository-version.txt" rel="nofollow noreferrer"><code>Documentation/technical/repository-version.txt</code></a>.<br /> See <a href="https://github.com... | 119, 456, 725, 7330, 16207 | configuration, git, rcs, repository, version-control | <h1>what are the different repository format versions (for the core.repositoryFormatVersion setting) in git?</h1>
<p>I noticed a default option in git <code>core.repositoryFormatVersion</code> which defaults to 0, but what are "repository format versions" and what functional difference do they make?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,494 | git | # what are the different repository format versions (for the core.repositoryFormatVersion setting) in git?
I noticed a default option in git `core.repositoryFormatVersion` which defaults to 0, but what are "repository format versions" and what functional difference do they make? | git 2.7 (Nov. 2015) adds a lot more information in the new [`Documentation/technical/repository-version.txt`](https://github.com/git/git/blob/00a09d57eb8a041e6a6b0470c53533719c049bab/Documentation/technical/repository-version.txt).
See [commit 067fbd4](https://github.com/git/git/commit/067fbd4105c5aa8260a73cc6961854b... |
29774466 | What do two plus signs in a git diff mean? | 25 | 2015-04-21 14:01:55 | <p>I am doing a <code>git diff</code> and for the first time, I am seeing double plus-signs next to lines. </p>
<pre><code>++ if ($field_name == $selected) {
++
++ echo "field_type: {$field['type']}\n";
++ echo "field_name: {$field_name}\n";
++
++ foreach ( $node->$field_name as $languag... | 8,717 | 151,841 | 2015-12-01 14:33:19 | 29,774,630 | 20 | 2015-04-21 14:08:24 | 2,165,134 | 2015-04-21 14:08:24 | https://stackoverflow.com/q/29774466 | https://stackoverflow.com/a/29774630 | <p>These lines are added since the last version.</p>
<p>From the manual page:</p>
<pre><code>- static void describe(char *arg)
-static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
</code></pre>
<blockquote>
<p>In the above example output, the function signature ... | <p>These lines are added since the last version.</p> <p>From the manual page:</p> <pre><code>- static void describe(char *arg) -static void describe(struct commit *cmit, int last_one) ++static void describe(char *arg, int last_one) </code></pre> <blockquote> <p>In the above example output, the function signature ... | 119 | git | <h1>What do two plus signs in a git diff mean?</h1>
<p>I am doing a <code>git diff</code> and for the first time, I am seeing double plus-signs next to lines. </p>
<pre><code>++ if ($field_name == $selected) {
++
++ echo "field_type: {$field['type']}\n";
++ echo "field_name: {$field_name}\n";
++
+... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,495 | git | # What do two plus signs in a git diff mean?
I am doing a `git diff` and for the first time, I am seeing double plus-signs next to lines.
```
++ if ($field_name == $selected) {
++
++ echo "field_type: {$field['type']}\n";
++ echo "field_name: {$field_name}\n";
++
++ foreach ( $node->$field... | These lines are added since the last version.
From the manual page:
```
- static void describe(char *arg)
-static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
```
> In the above example output, the function signature was changed from
> both files (hence two - remo... |
25981292 | How to make composer NOT create a .git directory for a package | 25 | 2014-09-22 18:59:19 | <p>I found a couple related posts, but those don't really answer my question.
Let's say I want to install this package:
<a href="https://github.com/pear/Net_Socket" rel="noreferrer">https://github.com/pear/Net_Socket</a></p>
<p>an excerpt from my composer.json:</p>
<pre><code>{
"config": {
"preferred-inst... | 13,919 | 1,772,429 | 2023-10-24 07:09:11 | 26,028,702 | 20 | 2014-09-25 00:39:46 | 1,627,406 | 2014-09-25 00:39:46 | https://stackoverflow.com/q/25981292 | https://stackoverflow.com/a/26028702 | <p>If a package is seen as a git submodule, you haven't excluded the <code>vendor</code> folder from being committed to your own repository. It is recommended to add the vendor folder to <code>.gitignore</code>, and not commit these files, only commit <code>composer.lock</code> (and <code>composer.json</code> of course... | <p>If a package is seen as a git submodule, you haven't excluded the <code>vendor</code> folder from being committed to your own repository. It is recommended to add the vendor folder to <code>.gitignore</code>, and not commit these files, only commit <code>composer.lock</code> (and <code>composer.json</code> of course... | 119, 78546 | composer-php, git | <h1>How to make composer NOT create a .git directory for a package</h1>
<p>I found a couple related posts, but those don't really answer my question.
Let's say I want to install this package:
<a href="https://github.com/pear/Net_Socket" rel="noreferrer">https://github.com/pear/Net_Socket</a></p>
<p>an excerpt from my ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,496 | git | # How to make composer NOT create a .git directory for a package
I found a couple related posts, but those don't really answer my question.
Let's say I want to install this package:
<https://github.com/pear/Net_Socket>
an excerpt from my composer.json:
```
{
"config": {
"preferred-install": "dist"
},... | If a package is seen as a git submodule, you haven't excluded the `vendor` folder from being committed to your own repository. It is recommended to add the vendor folder to `.gitignore`, and not commit these files, only commit `composer.lock` (and `composer.json` of course).
Apart from that, running `composer install ... |
5094376 | View permissions change in Git | 25 | 2011-02-23 17:17:39 | <p>Before I commit some files, how can I see the file permission changes to files? I have some files that git status says had changed and should be added to commit but git diff doesn't show anything.
Thanks</p>
| 32,699 | 25,143 | 2019-09-11 19:58:05 | 5,095,881 | 20 | 2011-02-23 19:17:21 | 90,322 | 2019-09-11 19:58:05 | https://stackoverflow.com/q/5094376 | https://stackoverflow.com/a/5095881 | <p>Well, since the question has been edited to ask something different, here's a different answer:</p>
<p><code>git status -v</code> will list mode changes as well as diffs. You can filter this down to just mode changes by running it through grep with a context filter: <code>git status -v | grep '^old mode' -C 1</code... | <p>Well, since the question has been edited to ask something different, here's a different answer:</p> <p><code>git status -v</code> will list mode changes as well as diffs. You can filter this down to just mode changes by running it through grep with a context filter: <code>git status -v | grep '^old mode' -C 1</code... | 119 | git | <h1>View permissions change in Git</h1>
<p>Before I commit some files, how can I see the file permission changes to files? I have some files that git status says had changed and should be added to commit but git diff doesn't show anything.
Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,497 | git | # View permissions change in Git
Before I commit some files, how can I see the file permission changes to files? I have some files that git status says had changed and should be added to commit but git diff doesn't show anything.
Thanks | Well, since the question has been edited to ask something different, here's a different answer:
`git status -v` will list mode changes as well as diffs. You can filter this down to just mode changes by running it through grep with a context filter: `git status -v | grep '^old mode' -C 1` (sample result below)
```
dif... |
7895798 | How do I pull/fetch with Git *INTO* a bare repository? | 24 | 2011-10-25 20:58:37 | <p>I'm writing a tool to backup all my repositories from <a href="https://bitbucket.org/" rel="noreferrer">Bitbucket</a> (which supports Git and Mercurial) to my local machine.</p>
<p>It already works for Mercurial, where I do it like this:</p>
<ul>
<li>create a new empty repository without a working copy on the loca... | 11,145 | 6,884 | 2016-05-16 12:57:42 | 7,895,827 | 20 | 2011-10-25 21:01:17 | 95,382 | 2016-02-13 00:38:06 | https://stackoverflow.com/q/7895798 | https://stackoverflow.com/a/7895827 | <p>Try</p>
<pre><code>git fetch https://github.com/SamSaffron/dapper-dot-net.git master:master
</code></pre>
| <p>Try</p> <pre><code>git fetch https://github.com/SamSaffron/dapper-dot-net.git master:master </code></pre> | 119, 28896, 33720 | git, git-fetch, git-pull | <h1>How do I pull/fetch with Git *INTO* a bare repository?</h1>
<p>I'm writing a tool to backup all my repositories from <a href="https://bitbucket.org/" rel="noreferrer">Bitbucket</a> (which supports Git and Mercurial) to my local machine.</p>
<p>It already works for Mercurial, where I do it like this:</p>
<ul>
<li>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,499 | git | # How do I pull/fetch with Git *INTO* a bare repository?
I'm writing a tool to backup all my repositories from [Bitbucket](https://bitbucket.org/) (which supports Git and Mercurial) to my local machine.
It already works for Mercurial, where I do it like this:
- create a new empty repository without a working copy on... | Try
```
git fetch https://github.com/SamSaffron/dapper-dot-net.git master:master
``` |
5628236 | When git rebasing two branches with some shared history, is there an easy way to have the common history remain common? | 24 | 2011-04-11 22:20:36 | <p>Suppose we have the following revision graph:</p>
<pre><code>A-X-Z--B
\
\-C
</code></pre>
<p>with A preceding both B and C. Further suppose I rebase A from upstream, creating a new commit A*, and then rebase both B and C onto A*. The resulting revision graph is the following:</p>
<pre><code>A*-X'-Z'-B
... | 7,705 | 329,781 | 2018-04-08 13:13:08 | 5,631,439 | 20 | 2011-04-12 06:53:06 | 1,864,976 | 2011-05-28 07:50:21 | https://stackoverflow.com/q/5628236 | https://stackoverflow.com/a/5631439 | <pre><code>git rebase --committer-date-is-author-date --preserve-merges --onto A* A C
git rebase --committer-date-is-author-date --preserve-merges --onto A* A B
</code></pre>
<p>This should keep the common commits having the same sha1 and any merges preserved. Preserve merges is not required in this case, but will bec... | <pre><code>git rebase --committer-date-is-author-date --preserve-merges --onto A* A C git rebase --committer-date-is-author-date --preserve-merges --onto A* A B </code></pre> <p>This should keep the common commits having the same sha1 and any merges preserved. Preserve merges is not required in this case, but will bec... | 119, 29934 | git, git-rebase | <h1>When git rebasing two branches with some shared history, is there an easy way to have the common history remain common?</h1>
<p>Suppose we have the following revision graph:</p>
<pre><code>A-X-Z--B
\
\-C
</code></pre>
<p>with A preceding both B and C. Further suppose I rebase A from upstream, creating ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,500 | git | # When git rebasing two branches with some shared history, is there an easy way to have the common history remain common?
Suppose we have the following revision graph:
```
A-X-Z--B
\
\-C
```
with A preceding both B and C. Further suppose I rebase A from upstream, creating a new commit A*, and then rebase ... | ```
git rebase --committer-date-is-author-date --preserve-merges --onto A* A C
git rebase --committer-date-is-author-date --preserve-merges --onto A* A B
```
This should keep the common commits having the same sha1 and any merges preserved. Preserve merges is not required in this case, but will become an issue with a ... |
2729109 | Should I merge .pbxproj files with git using merge=union? | 24 | 2010-04-28 11:50:37 | <p>I'm wondering whether the merge=union option in .gitattributes makes sense for .pbxproj files.</p>
<p>The manpage states for this option:</p>
<blockquote>
<p>Run 3-way file level merge for text files, but take lines from both versions, instead of leaving conflict markers. This tends to leave the added lines in t... | 11,038 | 235,297 | 2013-08-16 13:57:47 | 2,729,657 | 20 | 2010-04-28 13:08:38 | 6,309 | 2012-10-11 09:38:51 | https://stackoverflow.com/q/2729109 | https://stackoverflow.com/a/2729657 | <p>Not a <em>direct</em> experience, but:</p>
<ul>
<li>This <a href="https://stackoverflow.com/questions/1549578/git-and-pbxproj">SO question</a> really advices again merging <code>.pbxproj</code> files.</li>
</ul>
<blockquote>
<p>The <code>pbxproj</code> file isn't really human mergable.<br>
While it is plain AS... | <p>Not a <em>direct</em> experience, but:</p> <ul> <li>This <a href="https://stackoverflow.com/questions/1549578/git-and-pbxproj">SO question</a> really advices again merging <code>.pbxproj</code> files.</li> </ul> <blockquote> <p>The <code>pbxproj</code> file isn't really human mergable.<br> While it is plain AS... | 119, 717, 994, 7003 | cocoa, git, merge, objective-c | <h1>Should I merge .pbxproj files with git using merge=union?</h1>
<p>I'm wondering whether the merge=union option in .gitattributes makes sense for .pbxproj files.</p>
<p>The manpage states for this option:</p>
<blockquote>
<p>Run 3-way file level merge for text files, but take lines from both versions, instead of... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,501 | git | # Should I merge .pbxproj files with git using merge=union?
I'm wondering whether the merge=union option in .gitattributes makes sense for .pbxproj files.
The manpage states for this option:
> Run 3-way file level merge for text files, but take lines from both versions, instead of leaving conflict markers. This tend... | Not a *direct* experience, but:
- This [SO question](https://stackoverflow.com/questions/1549578/git-and-pbxproj) really advices again merging `.pbxproj` files.
> The `pbxproj` file isn't really human mergable.
> While it is plain ASCII text, it's a ~~form of JSON~~. Essentially you want to treat it as a binary fil... |
2121080 | GIT for a solo developer | 24 | 2010-01-22 22:46:02 | <p>Outside of work I use SVN for my personal projects I wish to keep private. I use it to synchronise sources between my laptop and desktop, for off site backup and the normal advantages SCM brings. The current trendy source control system is GIT and I must admit I'm considering moving to it. But given what I use it... | 2,921 | null | 2011-12-09 19:01:58 | 2,121,107 | 20 | 2010-01-22 22:50:49 | 69,755 | 2010-01-22 23:56:15 | https://stackoverflow.com/q/2121080 | https://stackoverflow.com/a/2121107 | <ul>
<li>It's faster than Subversion</li>
<li>You can have all of your history with you on your laptop</li>
<li>You can sync between machines without having to worry about whether your server is online/accessible/etc.</li>
<li><a href="http://git-scm.com/docs/git-stash" rel="noreferrer"><code>git stash</code></a> is gr... | <ul> <li>It's faster than Subversion</li> <li>You can have all of your history with you on your laptop</li> <li>You can sync between machines without having to worry about whether your server is online/accessible/etc.</li> <li><a href="http://git-scm.com/docs/git-stash" rel="noreferrer"><code>git stash</code></a> is gr... | 63, 119 | git, svn | <h1>GIT for a solo developer</h1>
<p>Outside of work I use SVN for my personal projects I wish to keep private. I use it to synchronise sources between my laptop and desktop, for off site backup and the normal advantages SCM brings. The current trendy source control system is GIT and I must admit I'm considering movi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,502 | git | # GIT for a solo developer
Outside of work I use SVN for my personal projects I wish to keep private. I use it to synchronise sources between my laptop and desktop, for off site backup and the normal advantages SCM brings. The current trendy source control system is GIT and I must admit I'm considering moving to it. B... | - It's faster than Subversion
- You can have all of your history with you on your laptop
- You can sync between machines without having to worry about whether your server is online/accessible/etc.
- [`git stash`](http://git-scm.com/docs/git-stash) is great for stowing away half-done changes
- You can create a new repos... |
24965307 | How to manipulate Bitbucket repository with token? | 23 | 2014-07-25 22:15:57 | <p>I followed this documentation to get a token value and a token secret from bitbucket:<br>
<a href="https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket" rel="noreferrer">https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket</a></p>
<p>After that I want to push/pull to a given repo b... | 54,019 | 2,955,724 | 2024-02-15 10:34:58 | 24,967,371 | 20 | 2014-07-26 03:53:15 | 6,309 | 2018-02-10 20:17:57 | https://stackoverflow.com/q/24965307 | https://stackoverflow.com/a/24967371 | <p>This <a href="https://bitbucket.org/site/master/issues/7735/allow-http-access-to-repositories-via#comment-19378911" rel="noreferrer">BitBucket page mentions</a>:</p>
<blockquote>
<p>We recently introduced OAuth 2 and also added the ability to use them as <a href="https://confluence.atlassian.com/bitbucket/oauth-on-b... | <p>This <a href="https://bitbucket.org/site/master/issues/7735/allow-http-access-to-repositories-via#comment-19378911" rel="noreferrer">BitBucket page mentions</a>:</p> <blockquote> <p>We recently introduced OAuth 2 and also added the ability to use them as <a href="https://confluence.atlassian.com/bitbucket/oauth-on-b... | 119, 802, 5769, 8337 | bitbucket, git, mercurial, oauth | <h1>How to manipulate Bitbucket repository with token?</h1>
<p>I followed this documentation to get a token value and a token secret from bitbucket:<br>
<a href="https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket" rel="noreferrer">https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,504 | git | # How to manipulate Bitbucket repository with token?
I followed this documentation to get a token value and a token secret from bitbucket:
<https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket>
After that I want to push/pull to a given repo by using that token.
At Github I can use the token like t... | This [BitBucket page mentions](https://bitbucket.org/site/master/issues/7735/allow-http-access-to-repositories-via#comment-19378911):
> We recently introduced OAuth 2 and also added the ability to use them as [HTTP Basic Auth credentials](https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.ht... |
13675216 | Why should I use .gitignore? | 23 | 2012-12-02 23:38:56 | <p>Currently, whenever I create a file that I'd like Git to track I simply add it to the index. If I don't add it to the index Git would not "see it". So why should I use a .gitignore file, as opposed to just not adding it to the index?</p>
| 22,121 | 1,424,561 | 2019-06-27 08:10:08 | 13,675,249 | 20 | 2012-12-02 23:43:10 | 372,643 | 2012-12-02 23:43:10 | https://stackoverflow.com/q/13675216 | https://stackoverflow.com/a/13675249 | <p>You'll generally find that adding each and every file one by one can become tedious when your project becomes bigger.</p>
<p>In Java, you may end up with many <code>.class</code> files that you wouldn't want to add to your repository. Similarly, you may end up with many <code>.o</code> files in C, or <code>.pyc</co... | <p>You'll generally find that adding each and every file one by one can become tedious when your project becomes bigger.</p> <p>In Java, you may end up with many <code>.class</code> files that you wouldn't want to add to your repository. Similarly, you may end up with many <code>.o</code> files in C, or <code>.pyc</co... | 119 | git | <h1>Why should I use .gitignore?</h1>
<p>Currently, whenever I create a file that I'd like Git to track I simply add it to the index. If I don't add it to the index Git would not "see it". So why should I use a .gitignore file, as opposed to just not adding it to the index?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,505 | git | # Why should I use .gitignore?
Currently, whenever I create a file that I'd like Git to track I simply add it to the index. If I don't add it to the index Git would not "see it". So why should I use a .gitignore file, as opposed to just not adding it to the index? | You'll generally find that adding each and every file one by one can become tedious when your project becomes bigger.
In Java, you may end up with many `.class` files that you wouldn't want to add to your repository. Similarly, you may end up with many `.o` files in C, or `.pyc` in Python (for example).
Having patter... |
13447884 | nicely display file rename history in git log | 23 | 2012-11-19 04:56:29 | <p>The <code>git</code> command</p>
<pre><code>git log --format='%H' --follow -- foo.txt
</code></pre>
<p>will give you the series of commits that touch <code>foo.txt</code>, following it across renames.</p>
<p>I'm wondering if there's a <code>git log</code> command that will also print the corresponding historical ... | 6,487 | 1,205,529 | 2016-05-29 20:04:41 | 13,620,202 | 20 | 2012-11-29 06:40:12 | 1,710,229 | 2012-11-29 06:40:12 | https://stackoverflow.com/q/13447884 | https://stackoverflow.com/a/13620202 | <p>You can simplify it a little bit like this:</p>
<pre><code>git log --format='%H' --name-only --follow -- README.md
</code></pre>
<p>which will give you output kind of like this</p>
<pre><code>621175c4998dfda8da
README.md
d0d6ef0a3d22269b96
README.md
</code></pre>
<p>which should be a little easier to parse. F... | <p>You can simplify it a little bit like this:</p> <pre><code>git log --format='%H' --name-only --follow -- README.md </code></pre> <p>which will give you output kind of like this</p> <pre><code>621175c4998dfda8da README.md d0d6ef0a3d22269b96 README.md </code></pre> <p>which should be a little easier to parse. F... | 119 | git | <h1>nicely display file rename history in git log</h1>
<p>The <code>git</code> command</p>
<pre><code>git log --format='%H' --follow -- foo.txt
</code></pre>
<p>will give you the series of commits that touch <code>foo.txt</code>, following it across renames.</p>
<p>I'm wondering if there's a <code>git log</code> com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,506 | git | # nicely display file rename history in git log
The `git` command
```
git log --format='%H' --follow -- foo.txt
```
will give you the series of commits that touch `foo.txt`, following it across renames.
I'm wondering if there's a `git log` command that will also print the corresponding historical file name beside e... | You can simplify it a little bit like this:
```
git log --format='%H' --name-only --follow -- README.md
```
which will give you output kind of like this
```
621175c4998dfda8da
README.md
d0d6ef0a3d22269b96
README.md
```
which should be a little easier to parse. For instance you can use a sentinel and sed out the n... |
6035725 | How to move commits to another branch? | 23 | 2011-05-17 18:57:49 | <p>I'd like to move my last few commits from master into a branch of their own.</p>
<p>The tree on my PC looks like that:</p>
<pre><code> W (some branch)
/
X1--X2--X3--X4--Y--Z1--Z2 (master)
</code></pre>
<p>I'd like it to look like:</p>
<pre><code> W (some branch)
/
X1--X2--X3--X4 (master)
... | 10,434 | 348,183 | 2017-08-28 14:11:05 | 6,035,890 | 20 | 2011-05-17 19:13:26 | 223,092 | 2011-05-17 19:13:26 | https://stackoverflow.com/q/6035725 | https://stackoverflow.com/a/6035890 | <p>(I assume <code><commit_id></code> is the object name of <code>X4</code>...)</p>
<p>Those commands will indeed end you up with what you want locally. (You might want to use <code>git reset --hard</code> to keep the working tree and index the same as the commit you're resetting to, but as usual, be very caref... | <p>(I assume <code><commit_id></code> is the object name of <code>X4</code>...)</p> <p>Those commands will indeed end you up with what you want locally. (You might want to use <code>git reset --hard</code> to keep the working tree and index the same as the commit you're resetting to, but as usual, be very caref... | 119, 1879, 4236, 5597 | branch, commit, git, push | <h1>How to move commits to another branch?</h1>
<p>I'd like to move my last few commits from master into a branch of their own.</p>
<p>The tree on my PC looks like that:</p>
<pre><code> W (some branch)
/
X1--X2--X3--X4--Y--Z1--Z2 (master)
</code></pre>
<p>I'd like it to look like:</p>
<pre><code> W (so... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,507 | git | # How to move commits to another branch?
I'd like to move my last few commits from master into a branch of their own.
The tree on my PC looks like that:
```
W (some branch)
/
X1--X2--X3--X4--Y--Z1--Z2 (master)
```
I'd like it to look like:
```
W (some branch)
/
X1--X2--X3--X4 (master)
... | (I assume `<commit_id>` is the object name of `X4`...)
Those commands will indeed end you up with what you want locally. (You might want to use `git reset --hard` to keep the working tree and index the same as the commit you're resetting to, but as usual, be very careful that `git status` is clean before you use that ... |
4881190 | git equivalent for hg rollback | 23 | 2011-02-02 23:34:03 | <p>How would I "rollback" the last commit in git without deleting any changes?</p>
<p>This is something I've done often in hg:</p>
<ul>
<li>Commit "Fixed 107."</li>
<li>Remembered that I forgot to do <em>something</em></li>
<li>hg rollback</li>
<li>Do <em>something</em></li>
<li>Commit "Fixed 107."</li>
</ul>
| 3,685 | 1,959 | 2016-09-29 10:01:37 | 4,881,267 | 20 | 2011-02-02 23:43:11 | 349,931 | 2011-02-02 23:43:11 | https://stackoverflow.com/q/4881190 | https://stackoverflow.com/a/4881267 | <p>With git you may actually prefer to use the <code>--amend</code> option in that case.</p>
<ul>
<li>Commit "Fixed 107."</li>
<li>Remembered that I forgot to do something</li>
<li>Do something</li>
<li><code>git commit --amend</code> and edit the notes</li>
</ul>
<p>If you need to rollback for other reasons take a l... | <p>With git you may actually prefer to use the <code>--amend</code> option in that case.</p> <ul> <li>Commit "Fixed 107."</li> <li>Remembered that I forgot to do something</li> <li>Do something</li> <li><code>git commit --amend</code> and edit the notes</li> </ul> <p>If you need to rollback for other reasons take a l... | 119 | git | <h1>git equivalent for hg rollback</h1>
<p>How would I "rollback" the last commit in git without deleting any changes?</p>
<p>This is something I've done often in hg:</p>
<ul>
<li>Commit "Fixed 107."</li>
<li>Remembered that I forgot to do <em>something</em></li>
<li>hg rollback</li>
<li>Do <em>something</em></li>
<l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 20,508 | git | # git equivalent for hg rollback
How would I "rollback" the last commit in git without deleting any changes?
This is something I've done often in hg:
- Commit "Fixed 107."
- Remembered that I forgot to do *something*
- hg rollback
- Do *something*
- Commit "Fixed 107." | With git you may actually prefer to use the `--amend` option in that case.
- Commit "Fixed 107."
- Remembered that I forgot to do something
- Do something
- `git commit --amend` and edit the notes
If you need to rollback for other reasons take a look at `git revert` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.