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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11420701 | Git submodule is returning blank? | 30 | 2012-07-10 19:41:58 | <p>I'm trying to use <code>git submodule update</code> and it's not returning anything, nor does any of the <code>git submodule</code> commands, and I have checked the <code>.gitmodules</code> file and it is correct?</p>
<p>I have no idea if git can be debugged or what, and it's really annoying.</p>
<p>There's no err... | 21,949 | 230,419 | 2022-01-17 17:58:24 | 11,422,652 | 17 | 2012-07-10 21:56:22 | 1,864,976 | 2012-12-27 03:59:36 | https://stackoverflow.com/q/11420701 | https://stackoverflow.com/a/11422652 | <p>Remove any submodule entries from your <code>.git/config</code>. <code>git rm --cached path/to/submodule</code> to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:</p>
<pre><code>git submodule init
</code></pre>
<p>All this does is populate your config with the ... | <p>Remove any submodule entries from your <code>.git/config</code>. <code>git rm --cached path/to/submodule</code> to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:</p> <pre><code>git submodule init </code></pre> <p>All this does is populate your config with the ... | 119 | git | <h1>Git submodule is returning blank?</h1>
<p>I'm trying to use <code>git submodule update</code> and it's not returning anything, nor does any of the <code>git submodule</code> commands, and I have checked the <code>.gitmodules</code> file and it is correct?</p>
<p>I have no idea if git can be debugged or what, and i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,219 | git | # Git submodule is returning blank?
I'm trying to use `git submodule update` and it's not returning anything, nor does any of the `git submodule` commands, and I have checked the `.gitmodules` file and it is correct?
I have no idea if git can be debugged or what, and it's really annoying.
There's no errors or anythi... | Remove any submodule entries from your `.git/config`. `git rm --cached path/to/submodule` to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:
```
git submodule init
```
All this does is populate your config with the urls that are in the `.gitmodules` file. Now you c... |
36667383 | Configure a merge tool for GitKraken on Windows10 | 29 | 2016-04-16 17:30:01 | <p>I downloaded GitKraken for working with Git repositories and it works great for everything I need, but I haven't been able to configure it to use a merge tool like WinMerge or Meld.</p>
<p>When the program sees a conflict it shows up a button which says "Open in merge tool". Since I haven't configured a Merge tool,... | 28,116 | 3,730,586 | 2019-05-22 04:22:38 | 41,554,219 | 17 | 2017-01-09 18:09:59 | 139,793 | 2017-01-09 18:09:59 | https://stackoverflow.com/q/36667383 | https://stackoverflow.com/a/41554219 | <p>GitKraken has finally added support for choosing one of the merge tools listed in your <code>.gitconfig</code> file.</p>
<p><a href="https://i.sstatic.net/FeqN3.png" rel="noreferrer"><img src="https://i.sstatic.net/FeqN3.png" alt="enter image description here"></a></p>
| <p>GitKraken has finally added support for choosing one of the merge tools listed in your <code>.gitconfig</code> file.</p> <p><a href="https://i.sstatic.net/FeqN3.png" rel="noreferrer"><img src="https://i.sstatic.net/FeqN3.png" alt="enter image description here"></a></p> | 119, 25165 | git, mergetool | <h1>Configure a merge tool for GitKraken on Windows10</h1>
<p>I downloaded GitKraken for working with Git repositories and it works great for everything I need, but I haven't been able to configure it to use a merge tool like WinMerge or Meld.</p>
<p>When the program sees a conflict it shows up a button which says "Op... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,220 | git | # Configure a merge tool for GitKraken on Windows10
I downloaded GitKraken for working with Git repositories and it works great for everything I need, but I haven't been able to configure it to use a merge tool like WinMerge or Meld.
When the program sees a conflict it shows up a button which says "Open in merge tool... | GitKraken has finally added support for choosing one of the merge tools listed in your `.gitconfig` file.
[](https://i.sstatic.net/FeqN3.png) |
34570348 | What is the meaning of these red bars in git file difference | 26 | 2016-01-02 20:22:48 | <p><a href="https://i.sstatic.net/YYPa6.png" rel="noreferrer"><img src="https://i.sstatic.net/YYPa6.png" alt="enter image description here"></a></p>
<p>There is a red bar after + sign. What is this ?</p>
| 14,187 | 4,659,530 | 2021-08-10 08:32:32 | 34,570,369 | 17 | 2016-01-02 20:25:14 | 707,111 | 2016-01-02 20:25:14 | https://stackoverflow.com/q/34570348 | https://stackoverflow.com/a/34570369 | <p>Potentially bad indentation. You may have used tabs when you configured Git to prefer spaces, or vice-versa.</p>
<p>Check <code>git config core.whitespace</code>; it might contain <code>tab-in-indent</code>, <code>space-before-tab</code>, or <code>indent-with-non-tab</code>. You should change it to suit your prefer... | <p>Potentially bad indentation. You may have used tabs when you configured Git to prefer spaces, or vice-versa.</p> <p>Check <code>git config core.whitespace</code>; it might contain <code>tab-in-indent</code>, <code>space-before-tab</code>, or <code>indent-with-non-tab</code>. You should change it to suit your prefer... | 119, 9033 | git, git-diff | <h1>What is the meaning of these red bars in git file difference</h1>
<p><a href="https://i.sstatic.net/YYPa6.png" rel="noreferrer"><img src="https://i.sstatic.net/YYPa6.png" alt="enter image description here"></a></p>
<p>There is a red bar after + sign. What is this ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,222 | git | # What is the meaning of these red bars in git file difference
[](https://i.sstatic.net/YYPa6.png)
There is a red bar after + sign. What is this ? | Potentially bad indentation. You may have used tabs when you configured Git to prefer spaces, or vice-versa.
Check `git config core.whitespace`; it might contain `tab-in-indent`, `space-before-tab`, or `indent-with-non-tab`. You should change it to suit your preferences if this isn’t really a mistake. |
15765366 | How does git track file changes internally? | 26 | 2013-04-02 13:27:04 | <p>Could somebody explain how git knows internally that files X, Y and Z have changed? What is the process behind the scenes that recognizes when a file has not yet been added or has modifications? I am asking because, with Subversion it's simple to figure out that it keeps track of these things by having a <code>.svn<... | 19,431 | 774,183 | 2021-08-06 20:06:07 | 15,766,762 | 17 | 2013-04-02 14:28:32 | 729,881 | 2013-04-02 14:28:32 | https://stackoverflow.com/q/15765366 | https://stackoverflow.com/a/15766762 | <p>The mechanisms by which one determines the status of a file is fairly straightforward. To know what files have been staged, one simply diffs the <code>HEAD</code> tree with the index. Any items that appear only in the index have been staged for addition, any items that appear only in <code>HEAD</code> have been re... | <p>The mechanisms by which one determines the status of a file is fairly straightforward. To know what files have been staged, one simply diffs the <code>HEAD</code> tree with the index. Any items that appear only in the index have been staged for addition, any items that appear only in <code>HEAD</code> have been re... | 119, 456 | git, version-control | <h1>How does git track file changes internally?</h1>
<p>Could somebody explain how git knows internally that files X, Y and Z have changed? What is the process behind the scenes that recognizes when a file has not yet been added or has modifications? I am asking because, with Subversion it's simple to figure out that i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,224 | git | # How does git track file changes internally?
Could somebody explain how git knows internally that files X, Y and Z have changed? What is the process behind the scenes that recognizes when a file has not yet been added or has modifications? I am asking because, with Subversion it's simple to figure out that it keeps t... | The mechanisms by which one determines the status of a file is fairly straightforward. To know what files have been staged, one simply diffs the `HEAD` tree with the index. Any items that appear only in the index have been staged for addition, any items that appear only in `HEAD` have been removed and any items that ar... |
7752304 | How to maintain long running git branches | 24 | 2011-10-13 09:50:20 | <p>Git branches ideally should last for short time, probably for 1-2 days. Then it gets merged into some mainline.</p>
<p>But in some cases, where we work on very big features, we maintain branches. And when 2 or 3 people each work on these very big features in exclusive areas of code, it becomes kinda tough to mainta... | 11,472 | 104,450 | 2017-05-16 10:47:12 | 7,754,301 | 17 | 2011-10-13 12:42:36 | 11,687 | 2011-10-13 12:42:36 | https://stackoverflow.com/q/7752304 | https://stackoverflow.com/a/7754301 | <p>Merging in the stable branch every now and then is actually the easiest and best thing you can do to keep your feature branch up to date. I wouldn't recommend rebasing because there might be more people working on the feature at the same time and they would have to reset their local branches a lot every time there w... | <p>Merging in the stable branch every now and then is actually the easiest and best thing you can do to keep your feature branch up to date. I wouldn't recommend rebasing because there might be more people working on the feature at the same time and they would have to reset their local branches a lot every time there w... | 119 | git | <h1>How to maintain long running git branches</h1>
<p>Git branches ideally should last for short time, probably for 1-2 days. Then it gets merged into some mainline.</p>
<p>But in some cases, where we work on very big features, we maintain branches. And when 2 or 3 people each work on these very big features in exclus... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,227 | git | # How to maintain long running git branches
Git branches ideally should last for short time, probably for 1-2 days. Then it gets merged into some mainline.
But in some cases, where we work on very big features, we maintain branches. And when 2 or 3 people each work on these very big features in exclusive areas of cod... | Merging in the stable branch every now and then is actually the easiest and best thing you can do to keep your feature branch up to date. I wouldn't recommend rebasing because there might be more people working on the feature at the same time and they would have to reset their local branches a lot every time there was ... |
31265680 | git checkout only certain file types for entire project | 23 | 2015-07-07 10:10:41 | <p>Is there a way to perform a git checkout for only certain file types (.xlf), which recurses down through the entire repository? The results should contain the struture of the repository, meaning the folders, and the contained files of a certain extension.</p>
<p><strong>Repo A</strong></p>
<pre><code>file.xlf
file... | 16,858 | 5,088,790 | 2020-06-12 02:13:11 | 31,310,644 | 17 | 2015-07-09 07:20:14 | 417,652 | 2019-01-17 15:24:38 | https://stackoverflow.com/q/31265680 | https://stackoverflow.com/a/31310644 | <p><strong>UPDATE:</strong> Check <a href="https://stackoverflow.com/questions/31265680/git-checkout-only-certain-file-types-for-entire-project/#44957542">Dadaso's answer</a> for a solution that will work in most of cases.</p>
<p>You can try something like this, using <code>git ls-tree</code> and <code>grep</code>:</p... | <p><strong>UPDATE:</strong> Check <a href="https://stackoverflow.com/questions/31265680/git-checkout-only-certain-file-types-for-entire-project/#44957542">Dadaso's answer</a> for a solution that will work in most of cases.</p> <p>You can try something like this, using <code>git ls-tree</code> and <code>grep</code>:</p... | 119 | git | <h1>git checkout only certain file types for entire project</h1>
<p>Is there a way to perform a git checkout for only certain file types (.xlf), which recurses down through the entire repository? The results should contain the struture of the repository, meaning the folders, and the contained files of a certain extensi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,228 | git | # git checkout only certain file types for entire project
Is there a way to perform a git checkout for only certain file types (.xlf), which recurses down through the entire repository? The results should contain the struture of the repository, meaning the folders, and the contained files of a certain extension.
**Re... | **UPDATE:** Check [Dadaso's answer](https://stackoverflow.com/questions/31265680/git-checkout-only-certain-file-types-for-entire-project/#44957542) for a solution that will work in most of cases.
You can try something like this, using `git ls-tree` and `grep`:
```
git checkout origin/master -- `git ls-tree origin/mas... |
50505459 | How to setup server side pre-receive hook? | 22 | 2018-05-24 09:15:57 | <p>I am new to git hooks and server side git functionality. I worked on client side git to commit and push my code and we do git merge using <strong>Application Lifecycle management(ALM) tools</strong>.
I am trying to write git hooks to do some testing on new/modified files in the repository. I am able to write and tes... | 30,379 | 3,610,740 | 2023-03-22 23:25:12 | 50,508,775 | 17 | 2018-05-24 11:55:29 | 4,632,019 | 2023-03-22 23:25:12 | https://stackoverflow.com/q/50505459 | https://stackoverflow.com/a/50508775 | <p>You should look into <a href="https://www.atlassian.com/git/tutorials/git-hooks#server-side-hooks" rel="nofollow noreferrer">Server side hooks</a> documentation section.</p>
<blockquote>
<p>There are three hooks that let you react to different stages of the git push process.</p>
</blockquote>
<ul>
<li>pre-receive</l... | <p>You should look into <a href="https://www.atlassian.com/git/tutorials/git-hooks#server-side-hooks" rel="nofollow noreferrer">Server side hooks</a> documentation section.</p> <blockquote> <p>There are three hooks that let you react to different stages of the git push process.</p> </blockquote> <ul> <li>pre-receive</l... | 119, 43087 | git, githooks | <h1>How to setup server side pre-receive hook?</h1>
<p>I am new to git hooks and server side git functionality. I worked on client side git to commit and push my code and we do git merge using <strong>Application Lifecycle management(ALM) tools</strong>.
I am trying to write git hooks to do some testing on new/modified... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,231 | git | # How to setup server side pre-receive hook?
I am new to git hooks and server side git functionality. I worked on client side git to commit and push my code and we do git merge using **Application Lifecycle management(ALM) tools**.
I am trying to write git hooks to do some testing on new/modified files in the reposito... | You should look into [Server side hooks](https://www.atlassian.com/git/tutorials/git-hooks#server-side-hooks) documentation section.
> There are three hooks that let you react to different stages of the git push process.
- pre-receive
- update
- post-receive
When you push to server `pre-receive` hook is triggered. T... |
49858890 | git fake merge (marking a commit as merged without a real merge) | 22 | 2018-04-16 13:47:24 | <p>Assume I have the following history in my repository:</p>
<pre><code> E--F
/
A--B--C---D
</code></pre>
<p>And I want to modify it to be this:</p>
<pre><code> E--F
/ \
A--B--C---D
</code></pre>
<p>I don't want to modify file content of revisions, I just want to "draw a merge arrow". How can I d... | 10,148 | 5,447,906 | 2018-04-16 15:00:53 | 49,859,979 | 17 | 2018-04-16 14:38:29 | 5,447,906 | 2018-04-16 15:00:53 | https://stackoverflow.com/q/49858890 | https://stackoverflow.com/a/49859979 | <p>This worked for me:</p>
<pre><code>git checkout D~1
git merge F -s ours --no-ff --no-commit
git cherry-pick D -n
git commit -C D
git branch -f D
git checkout D
</code></pre>
| <p>This worked for me:</p> <pre><code>git checkout D~1 git merge F -s ours --no-ff --no-commit git cherry-pick D -n git commit -C D git branch -f D git checkout D </code></pre> | 119, 717, 30968 | git, git-amend, merge | <h1>git fake merge (marking a commit as merged without a real merge)</h1>
<p>Assume I have the following history in my repository:</p>
<pre><code> E--F
/
A--B--C---D
</code></pre>
<p>And I want to modify it to be this:</p>
<pre><code> E--F
/ \
A--B--C---D
</code></pre>
<p>I don't want to modify f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,232 | git | # git fake merge (marking a commit as merged without a real merge)
Assume I have the following history in my repository:
```
E--F
/
A--B--C---D
```
And I want to modify it to be this:
```
E--F
/ \
A--B--C---D
```
I don't want to modify file content of revisions, I just want to "draw a merge ar... | This worked for me:
```
git checkout D~1
git merge F -s ours --no-ff --no-commit
git cherry-pick D -n
git commit -C D
git branch -f D
git checkout D
``` |
25452151 | Is there a preferred path where I should initialise my Git repo on Mac OS X? | 22 | 2014-08-22 17:02:36 | <p>Where should I be building my repos? My tutorial repos went to root, but I thought since I would have a test of my production site, that I should build them in <code>~/sites/</code>.</p>
<p>It might seem trivial, but most introductions to Git I've seen don't really specify a particular location.</p>
| 26,656 | 1,241,285 | 2014-08-22 18:27:46 | 25,452,818 | 17 | 2014-08-22 17:47:16 | 368,630 | 2014-08-22 17:47:16 | https://stackoverflow.com/q/25452151 | https://stackoverflow.com/a/25452818 | <p>When you work with Git, there are multiple <em>repositories</em> you may be working with.</p>
<p>First, there's the local repository. This is a complete repository that lives on your local system. You must have a local repository to use Git, and everyone who does work with this project will have a copy of this repo... | <p>When you work with Git, there are multiple <em>repositories</em> you may be working with.</p> <p>First, there's the local repository. This is a complete repository that lives on your local system. You must have a local repository to use Git, and everyone who does work with this project will have a copy of this repo... | 119, 7330, 8951 | git, repository, repository-design | <h1>Is there a preferred path where I should initialise my Git repo on Mac OS X?</h1>
<p>Where should I be building my repos? My tutorial repos went to root, but I thought since I would have a test of my production site, that I should build them in <code>~/sites/</code>.</p>
<p>It might seem trivial, but most introduc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,233 | git | # Is there a preferred path where I should initialise my Git repo on Mac OS X?
Where should I be building my repos? My tutorial repos went to root, but I thought since I would have a test of my production site, that I should build them in `~/sites/`.
It might seem trivial, but most introductions to Git I've seen don'... | When you work with Git, there are multiple *repositories* you may be working with.
First, there's the local repository. This is a complete repository that lives on your local system. You must have a local repository to use Git, and everyone who does work with this project will have a copy of this repository locally on... |
19523456 | Selectively merging *parts* of a file with git? | 22 | 2013-10-22 16:31:44 | <p>I'm looking to selectively merge <em>parts</em> of a file with git.</p>
<p>I've got two branches -- call them master and changed -- that are one commit apart; if I merge master into changed, it would just fast-forward.</p>
<p>However, I just want to incorporate a number of parts -- within one file -- from changed ... | 3,701 | 1,090,142 | 2020-10-14 02:40:53 | 19,523,586 | 17 | 2013-10-22 16:39:01 | 148,870 | 2020-10-14 02:40:53 | https://stackoverflow.com/q/19523456 | https://stackoverflow.com/a/19523586 | <p>Try this:</p>
<pre><code>git merge --no-ff --no-commit changed # Merge in 'changed' but don't commit
git reset <path/to/your/file> # Reset the stage state but not
# the working version of the file
git add -p <path/to/your/file> # Start add... | <p>Try this:</p> <pre><code>git merge --no-ff --no-commit changed # Merge in 'changed' but don't commit git reset <path/to/your/file> # Reset the stage state but not # the working version of the file git add -p <path/to/your/file> # Start add... | 119, 28897 | git, git-merge | <h1>Selectively merging *parts* of a file with git?</h1>
<p>I'm looking to selectively merge <em>parts</em> of a file with git.</p>
<p>I've got two branches -- call them master and changed -- that are one commit apart; if I merge master into changed, it would just fast-forward.</p>
<p>However, I just want to incorpor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,234 | git | # Selectively merging *parts* of a file with git?
I'm looking to selectively merge *parts* of a file with git.
I've got two branches -- call them master and changed -- that are one commit apart; if I merge master into changed, it would just fast-forward.
However, I just want to incorporate a number of parts -- withi... | Try this:
```
git merge --no-ff --no-commit changed # Merge in 'changed' but don't commit
git reset <path/to/your/file> # Reset the stage state but not
# the working version of the file
git add -p <path/to/your/file> # Start adding in interactive mode
... |
23253420 | Cloning / Reading only history /log of a git repository | 21 | 2014-04-23 19:24:02 | <p>Within a locally cloned git repository I can watch the history with</p>
<pre><code>git log
</code></pre>
<p>In a small tool I only need the history of a repository, not the code.
Is there a way to clone a repository without the code (history only)?</p>
<p>Is there any other way to get the history only from a git rep... | 12,059 | 593,461 | 2024-05-28 20:57:54 | 23,253,517 | 17 | 2014-04-23 19:29:07 | 2,044,940 | 2017-12-23 10:37:46 | https://stackoverflow.com/q/23253420 | https://stackoverflow.com/a/23253517 | <p>Clone the repository with the <code>--bare</code> flag:</p>
<pre><code>git clone --bare ...
</code></pre>
<blockquote>
<p>A <strong>"bare" repository</strong> in Git <strong>just contains the version control
information</strong> and no working files (no tree) and it doesn't contain the
special .git sub-direc... | <p>Clone the repository with the <code>--bare</code> flag:</p> <pre><code>git clone --bare ... </code></pre> <blockquote> <p>A <strong>"bare" repository</strong> in Git <strong>just contains the version control information</strong> and no working files (no tree) and it doesn't contain the special .git sub-direc... | 119 | git | <h1>Cloning / Reading only history /log of a git repository</h1>
<p>Within a locally cloned git repository I can watch the history with</p>
<pre><code>git log
</code></pre>
<p>In a small tool I only need the history of a repository, not the code.
Is there a way to clone a repository without the code (history only)?</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,237 | git | # Cloning / Reading only history /log of a git repository
Within a locally cloned git repository I can watch the history with
```
git log
```
In a small tool I only need the history of a repository, not the code.
Is there a way to clone a repository without the code (history only)?
Is there any other way to get the... | Clone the repository with the `--bare` flag:
```
git clone --bare ...
```
> A **"bare" repository** in Git **just contains the version control
> information** and no working files (no tree) and it doesn't contain the
> special .git sub-directory. Instead, it contains all the contents of
> the .git sub-directory direc... |
17436024 | Adapting the git-flow model for pre-production environments | 21 | 2013-07-02 21:20:13 | <p>I am thinking of extending the git-flow model for my current workplace, due to a particular scenario. But my scenario is so common that I'm surprised no-one's done this before with the git-flow model, and this makes me think I've missed an obvious problem. My question is: Is my proposed extension flawed?</p>
<p>The ... | 13,735 | 1,830,955 | 2022-08-15 14:53:13 | 17,437,963 | 17 | 2013-07-03 00:35:21 | 2,452,553 | 2015-10-14 00:22:21 | https://stackoverflow.com/q/17436024 | https://stackoverflow.com/a/17437963 | <p>There is no reason I can see to adapt the flow against your model. You say you work sequentially SIT -> UAT -> Pre-Prod. Perfect. Once develop is stable (i.e. all features due for release are feature-finish[ed]) then do <code>release start</code> and move this to your SIT platform for QA. Once the release start has ... | <p>There is no reason I can see to adapt the flow against your model. You say you work sequentially SIT -> UAT -> Pre-Prod. Perfect. Once develop is stable (i.e. all features due for release are feature-finish[ed]) then do <code>release start</code> and move this to your SIT platform for QA. Once the release start has ... | 119, 190, 15488, 64339 | deployment, git, git-flow, release-management | <h1>Adapting the git-flow model for pre-production environments</h1>
<p>I am thinking of extending the git-flow model for my current workplace, due to a particular scenario. But my scenario is so common that I'm surprised no-one's done this before with the git-flow model, and this makes me think I've missed an obvious ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,238 | git | # Adapting the git-flow model for pre-production environments
I am thinking of extending the git-flow model for my current workplace, due to a particular scenario. But my scenario is so common that I'm surprised no-one's done this before with the git-flow model, and this makes me think I've missed an obvious problem. ... | There is no reason I can see to adapt the flow against your model. You say you work sequentially SIT -> UAT -> Pre-Prod. Perfect. Once develop is stable (i.e. all features due for release are feature-finish[ed]) then do `release start` and move this to your SIT platform for QA. Once the release start has taken place, d... |
11955305 | What is the meaning of pull strategy when creating a branch with egit? | 21 | 2012-08-14 15:06:14 | <p>In EGit when I got to <code>Team > Switch to > New branch</code> I end up with the dialog box below. What is the meaning of the various pull strategies listed on this dialog box?</p>
<p><img src="https://i.sstatic.net/pvksP.png" alt="enter image description here"></p>
| 8,910 | 438,319 | 2012-08-14 16:04:16 | 11,955,403 | 17 | 2012-08-14 15:11:08 | 325,742 | 2012-08-14 16:04:16 | https://stackoverflow.com/q/11955305 | https://stackoverflow.com/a/11955403 | <p>Take a look at this from <strong><a href="http://wiki.eclipse.org/EGit/User_Guide#Branch_Creation_Dialog" rel="noreferrer">here</a></strong> :</p>
<p><img src="https://i.sstatic.net/sVHwT.png" alt="enter image description here"></p>
<p>From the above link : </p>
<blockquote>
<p>The "Pull Strategy" group is only... | <p>Take a look at this from <strong><a href="http://wiki.eclipse.org/EGit/User_Guide#Branch_Creation_Dialog" rel="noreferrer">here</a></strong> :</p> <p><img src="https://i.sstatic.net/sVHwT.png" alt="enter image description here"></p> <p>From the above link : </p> <blockquote> <p>The "Pull Strategy" group is only... | 53, 119, 43702, 61058 | eclipse, egit, git, jgit | <h1>What is the meaning of pull strategy when creating a branch with egit?</h1>
<p>In EGit when I got to <code>Team > Switch to > New branch</code> I end up with the dialog box below. What is the meaning of the various pull strategies listed on this dialog box?</p>
<p><img src="https://i.sstatic.net/pvksP.png" a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,239 | git | # What is the meaning of pull strategy when creating a branch with egit?
In EGit when I got to `Team > Switch to > New branch` I end up with the dialog box below. What is the meaning of the various pull strategies listed on this dialog box?
 | Take a look at this from **[here](http://wiki.eclipse.org/EGit/User_Guide#Branch_Creation_Dialog)** :

From the above link :
> The "Pull Strategy" group is only visible when a branch is selected in
> the combo and allows to override the default setup fo... |
10555563 | git staging and committing between multiple branches | 21 | 2012-05-11 16:55:55 | <p>I clearly do not understand git at all. This is what I'm getting:</p>
<pre><code>git branch (outputs that I'm on master)
git checkout -b foo
echo "next line" >> file (file is an existing file)
git add file (stages)
git checkout master
git status (shows that file has "next line" and is staged!!)
git commit (... | 10,989 | 1,339,987 | 2017-05-06 00:56:59 | 10,555,775 | 17 | 2012-05-11 17:11:57 | 147,356 | 2014-09-25 21:29:49 | https://stackoverflow.com/q/10555563 | https://stackoverflow.com/a/10555775 | <p>It doesn't matter what branch you're on when you <em>add</em> a file, only when you <em>commit</em> it. So if you do this:</p>
<pre><code>git add file
git checkout master
git commit
</code></pre>
<p>You have committed the file to the master branch.</p>
<p>Here's a complete example, with output. We start with a ... | <p>It doesn't matter what branch you're on when you <em>add</em> a file, only when you <em>commit</em> it. So if you do this:</p> <pre><code>git add file git checkout master git commit </code></pre> <p>You have committed the file to the master branch.</p> <p>Here's a complete example, with output. We start with a ... | 119, 1879 | branch, git | <h1>git staging and committing between multiple branches</h1>
<p>I clearly do not understand git at all. This is what I'm getting:</p>
<pre><code>git branch (outputs that I'm on master)
git checkout -b foo
echo "next line" >> file (file is an existing file)
git add file (stages)
git checkout master
git status ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,240 | git | # git staging and committing between multiple branches
I clearly do not understand git at all. This is what I'm getting:
```
git branch (outputs that I'm on master)
git checkout -b foo
echo "next line" >> file (file is an existing file)
git add file (stages)
git checkout master
git status (shows that file has "next ... | It doesn't matter what branch you're on when you *add* a file, only when you *commit* it. So if you do this:
```
git add file
git checkout master
git commit
```
You have committed the file to the master branch.
Here's a complete example, with output. We start with a new repository:
```
$ git init
Initialized empty ... |
47475712 | Git: How to list specific trailers (footers) in git-log format? | 20 | 2017-11-24 14:54:30 | <p>Given the following example git commit message:</p>
<pre><code>My commit message summary
Some more body in this message...
Signed-off-by: My name <my.name@example.com>
Issue: MYPROJ-123
</code></pre>
<p>I can now parse these '<a href="https://git-scm.com/docs/git-interpret-trailers" rel="noreferrer">traile... | 5,361 | 1,254,292 | 2020-02-26 23:07:12 | 60,423,945 | 17 | 2020-02-26 23:07:12 | 12,969,331 | 2020-02-26 23:07:12 | https://stackoverflow.com/q/47475712 | https://stackoverflow.com/a/60423945 | <p>This is possible using <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem" rel="noreferrer">trailers options</a>. Following your example the command line would be:</p>
<pre><code>git log --format="%h %s %(trailers:key=Issue,valueonly)"
</code></pre>
| <p>This is possible using <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem" rel="noreferrer">trailers options</a>. Following your example the command line would be:</p> <pre><code>git log --format="%h %s %(trailers:key=Issue,valueonly)" </code></pre> | 119, 47913 | git, git-log | <h1>Git: How to list specific trailers (footers) in git-log format?</h1>
<p>Given the following example git commit message:</p>
<pre><code>My commit message summary
Some more body in this message...
Signed-off-by: My name <my.name@example.com>
Issue: MYPROJ-123
</code></pre>
<p>I can now parse these '<a href=... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,241 | git | # Git: How to list specific trailers (footers) in git-log format?
Given the following example git commit message:
```
My commit message summary
Some more body in this message...
Signed-off-by: My name <my.name@example.com>
Issue: MYPROJ-123
```
I can now parse these '[trailers](https://git-scm.com/docs/git-interpr... | This is possible using [trailers options](https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem). Following your example the command line would be:
```
git log --format="%h %s %(trailers:key=Issue,valueonly)"
``` |
34673683 | How to squash commits on Bitbucket after they have been pushed? | 20 | 2016-01-08 09:36:58 | <p>I am currently working on a project with multiple others. The problem is that we created a fork of an existed project and need to squash all our commits from after the forking process to a single commit for a pull-request on <a href="https://bitbucket.org/" rel="noreferrer">Bitbucket</a>. </p>
<p>Is there any way (... | 67,168 | 5,761,911 | 2020-10-27 02:13:00 | 34,881,686 | 17 | 2016-01-19 16:14:56 | 5,761,911 | 2020-10-27 02:12:29 | https://stackoverflow.com/q/34673683 | https://stackoverflow.com/a/34881686 | <p>Found a nice summary of the posted answers. This one is a bit more clear:
<a href="https://bitbucket.org/chromiumembedded/cef/wiki/ContributingWithGit#markdown-header-modifying-a-commit" rel="noreferrer">squash pushed commits</a>.
It will require creating a second branch upon the creation of the fork. This second br... | <p>Found a nice summary of the posted answers. This one is a bit more clear: <a href="https://bitbucket.org/chromiumembedded/cef/wiki/ContributingWithGit#markdown-header-modifying-a-commit" rel="noreferrer">squash pushed commits</a>. It will require creating a second branch upon the creation of the fork. This second br... | 119, 8337, 115976 | bitbucket, git, sourcetree | <h1>How to squash commits on Bitbucket after they have been pushed?</h1>
<p>I am currently working on a project with multiple others. The problem is that we created a fork of an existed project and need to squash all our commits from after the forking process to a single commit for a pull-request on <a href="https://bi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,242 | git | # How to squash commits on Bitbucket after they have been pushed?
I am currently working on a project with multiple others. The problem is that we created a fork of an existed project and need to squash all our commits from after the forking process to a single commit for a pull-request on [Bitbucket](https://bitbucke... | Found a nice summary of the posted answers. This one is a bit more clear:
[squash pushed commits](https://bitbucket.org/chromiumembedded/cef/wiki/ContributingWithGit#markdown-header-modifying-a-commit).
It will require creating a second branch upon the creation of the fork. This second branch can have as many pushes to... |
11198542 | Restore deleted file from repository | 20 | 2012-06-25 22:53:36 | <p>I'm being in a transition from SVN to GIT and got a question for which I cannot find an answer.
I'll describe am usual scenario when I work with some open source projects via SVN.</p>
<ol>
<li>make a checkout</li>
<li>start messing around with files, make changes, to test how the project works.</li>
<li>after p.2 s... | 22,733 | 200,759 | 2018-03-07 16:05:50 | 11,198,571 | 17 | 2012-06-25 22:56:23 | 216,074 | 2012-06-25 22:56:23 | https://stackoverflow.com/q/11198542 | https://stackoverflow.com/a/11198571 | <p>Try to checkout the current branch (or <code>HEAD</code>):</p>
<pre><code>git checkout HEAD
</code></pre>
<p>Or if you want to revert <em>everything</em> to the last commited state (<em>warning:</em> this will permanently delete all uncommited changes!), you can also reset hard:</p>
<pre><code>git reset --hard
</... | <p>Try to checkout the current branch (or <code>HEAD</code>):</p> <pre><code>git checkout HEAD </code></pre> <p>Or if you want to revert <em>everything</em> to the last commited state (<em>warning:</em> this will permanently delete all uncommited changes!), you can also reset hard:</p> <pre><code>git reset --hard </... | 63, 119 | git, svn | <h1>Restore deleted file from repository</h1>
<p>I'm being in a transition from SVN to GIT and got a question for which I cannot find an answer.
I'll describe am usual scenario when I work with some open source projects via SVN.</p>
<ol>
<li>make a checkout</li>
<li>start messing around with files, make changes, to te... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,244 | git | # Restore deleted file from repository
I'm being in a transition from SVN to GIT and got a question for which I cannot find an answer.
I'll describe am usual scenario when I work with some open source projects via SVN.
1. make a checkout
2. start messing around with files, make changes, to test how the project works.... | Try to checkout the current branch (or `HEAD`):
```
git checkout HEAD
```
Or if you want to revert *everything* to the last commited state (*warning:* this will permanently delete all uncommited changes!), you can also reset hard:
```
git reset --hard
``` |
9110528 | Git: How to check if the local and remote branches point to the same commit (i.e. in sync)? | 20 | 2012-02-02 10:15:30 | <p>How could I check if <code>feature_branch</code> and <code>origin/feature_branch</code> point to the same commit?</p>
| 13,912 | 247,243 | 2017-08-13 03:59:07 | 9,110,581 | 17 | 2012-02-02 10:19:21 | 223,092 | 2012-02-02 10:31:02 | https://stackoverflow.com/q/9110528 | https://stackoverflow.com/a/9110581 | <p>You can compare the output of <code>git-rev-parse</code>, such as in this bit of shell script:</p>
<pre><code>export BRANCH_A=feature_branch
export BRANCH_B=origin/feature_branch
if [ x"$(git rev-parse $BRANCH_A)" = x"$(git rev-parse $BRANCH_B)" ]
then
echo $BRANCH_A and $BRANCH_B are the same
fi
</code></pre>... | <p>You can compare the output of <code>git-rev-parse</code>, such as in this bit of shell script:</p> <pre><code>export BRANCH_A=feature_branch export BRANCH_B=origin/feature_branch if [ x"$(git rev-parse $BRANCH_A)" = x"$(git rev-parse $BRANCH_B)" ] then echo $BRANCH_A and $BRANCH_B are the same fi </code></pre>... | 119 | git | <h1>Git: How to check if the local and remote branches point to the same commit (i.e. in sync)?</h1>
<p>How could I check if <code>feature_branch</code> and <code>origin/feature_branch</code> point to the same commit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,245 | git | # Git: How to check if the local and remote branches point to the same commit (i.e. in sync)?
How could I check if `feature_branch` and `origin/feature_branch` point to the same commit? | You can compare the output of `git-rev-parse`, such as in this bit of shell script:
```
export BRANCH_A=feature_branch
export BRANCH_B=origin/feature_branch
if [ x"$(git rev-parse $BRANCH_A)" = x"$(git rev-parse $BRANCH_B)" ]
then
echo $BRANCH_A and $BRANCH_B are the same
fi
```
If you're not interested in using... |
8598937 | git update-index --assume-unchanged returns error | 20 | 2011-12-22 02:49:37 | <p><code>git update-index --assume-unchanged <filename></code> returns <code>fatal: Unable to mark file <filename></code>.</p>
<p>What do I need to do to fix this? What is it complaining about and why?</p>
| 18,303 | 992,421 | 2022-07-09 05:56:23 | 8,599,021 | 17 | 2011-12-22 03:04:46 | 1,074,361 | 2013-08-16 19:50:13 | https://stackoverflow.com/q/8598937 | https://stackoverflow.com/a/8599021 | <p>Is it added to the repository, not in <code>.git/info/exclude</code> and not on <code>.gitignore</code>?</p>
<p>If the answer is yes to either of those, then the file is not in the repository and this is the reason for the error.</p>
<p>Try <code>git ls-files -o</code> and see if the file is there. It should not b... | <p>Is it added to the repository, not in <code>.git/info/exclude</code> and not on <code>.gitignore</code>?</p> <p>If the answer is yes to either of those, then the file is not in the repository and this is the reason for the error.</p> <p>Try <code>git ls-files -o</code> and see if the file is there. It should not b... | 119, 4333 | git, ignore | <h1>git update-index --assume-unchanged returns error</h1>
<p><code>git update-index --assume-unchanged <filename></code> returns <code>fatal: Unable to mark file <filename></code>.</p>
<p>What do I need to do to fix this? What is it complaining about and why?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,246 | git | # git update-index --assume-unchanged returns error
`git update-index --assume-unchanged <filename>` returns `fatal: Unable to mark file <filename>`.
What do I need to do to fix this? What is it complaining about and why? | Is it added to the repository, not in `.git/info/exclude` and not on `.gitignore`?
If the answer is yes to either of those, then the file is not in the repository and this is the reason for the error.
Try `git ls-files -o` and see if the file is there. It should not be. |
25570947 | How to use git interactive rebase for signing off a series of commits | 19 | 2014-08-29 14:59:13 | <p>I would like to <strong>sign off all commits on a branch</strong> that I have finished and want to send to an upstream project (e.g. via a pull request on GitHub).</p>
<p>A recommended way I've found is to use</p>
<pre><code>git rebase -i [base-commit]
# Set all commits to "edit"
git commit --amend --signoff # do... | 8,850 | 263,061 | 2024-06-20 06:08:26 | 43,726,007 | 17 | 2017-05-01 20:25:49 | 6,309 | 2024-06-20 06:08:26 | https://stackoverflow.com/q/25570947 | https://stackoverflow.com/a/43726007 | <p>With Git 2.13 (Q2 2017), no more "<code>git commit --amend --signoff</code>" needed:<br />
See <a href="https://github.com/git/git/commit/9f79524a6af0527e380742ee103ca4fbcd440b42" rel="nofollow noreferrer">commit 9f79524</a> (18 Apr 2017), and <a href="https://github.com/git/git/commit/0fb3c4fc9a20cc3d7869... | <p>With Git 2.13 (Q2 2017), no more "<code>git commit --amend --signoff</code>" needed:<br /> See <a href="https://github.com/git/git/commit/9f79524a6af0527e380742ee103ca4fbcd440b42" rel="nofollow noreferrer">commit 9f79524</a> (18 Apr 2017), and <a href="https://github.com/git/git/commit/0fb3c4fc9a20cc3d7869... | 119, 29934, 53850 | git, git-commit, git-rebase | <h1>How to use git interactive rebase for signing off a series of commits</h1>
<p>I would like to <strong>sign off all commits on a branch</strong> that I have finished and want to send to an upstream project (e.g. via a pull request on GitHub).</p>
<p>A recommended way I've found is to use</p>
<pre><code>git rebase ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,247 | git | # How to use git interactive rebase for signing off a series of commits
I would like to **sign off all commits on a branch** that I have finished and want to send to an upstream project (e.g. via a pull request on GitHub).
A recommended way I've found is to use
```
git rebase -i [base-commit]
# Set all commits to "e... | With Git 2.13 (Q2 2017), no more "`git commit --amend --signoff`" needed:
See [commit 9f79524](https://github.com/git/git/commit/9f79524a6af0527e380742ee103ca4fbcd440b42) (18 Apr 2017), and [commit 0fb3c4f](https://github.com/git/git/commit/0fb3c4fc9a20cc3d7869d46bb8a774e4038fc62c), [commit b7cc705](https://github.co... |
40720595 | With git, how to save/pause a ongoing big rebase to do something else, then go back to it? | 19 | 2016-11-21 12:47:58 | <p>So I have started to rebase a big branch on my current master (75 commits). I know it will take me a day or so. In the meantime, I need to address some comments on another PR. </p>
<p>How can I suspend my current rebase to amend my PR without re-cloning the repo or copying the folder (these would work of course)? I... | 4,287 | 1,528,985 | 2025-11-17 18:11:04 | 40,724,525 | 17 | 2016-11-21 16:10:40 | 631,429 | 2016-11-21 16:10:40 | https://stackoverflow.com/q/40720595 | https://stackoverflow.com/a/40724525 | <p>There is no built-in way to "pause" a rebase that I know of, although you can certainly accomplish something like it with enough git finesse.</p>
<p>However, in the case you've described, a much simpler solution is simply to do your rebase in one working directory, and do the other changes you need to do in a diffe... | <p>There is no built-in way to "pause" a rebase that I know of, although you can certainly accomplish something like it with enough git finesse.</p> <p>However, in the case you've described, a much simpler solution is simply to do your rebase in one working directory, and do the other changes you need to do in a diffe... | 119 | git | <h1>With git, how to save/pause a ongoing big rebase to do something else, then go back to it?</h1>
<p>So I have started to rebase a big branch on my current master (75 commits). I know it will take me a day or so. In the meantime, I need to address some comments on another PR. </p>
<p>How can I suspend my current reb... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,248 | git | # With git, how to save/pause a ongoing big rebase to do something else, then go back to it?
So I have started to rebase a big branch on my current master (75 commits). I know it will take me a day or so. In the meantime, I need to address some comments on another PR.
How can I suspend my current rebase to amend my P... | There is no built-in way to "pause" a rebase that I know of, although you can certainly accomplish something like it with enough git finesse.
However, in the case you've described, a much simpler solution is simply to do your rebase in one working directory, and do the other changes you need to do in a different worki... |
27336028 | How can I restore only a few lines from a file recorded in a given commit? | 19 | 2014-12-06 20:16:19 | <p>I want to restore a few lines from a file recorded in an older commit. I can see those lines by running</p>
<pre><code>git log -p
</code></pre>
<p>As a last resort, I'm ready to simply copy those lines from the output of that log, but that would hurt my purist's heart and seems rather unprofessional.</p>
<p>I do ... | 1,679 | 547,819 | 2015-02-23 07:46:19 | 27,336,339 | 17 | 2014-12-06 20:49:25 | 2,541,573 | 2015-02-23 07:46:19 | https://stackoverflow.com/q/27336028 | https://stackoverflow.com/a/27336339 | <h2>Use interactive checkout</h2>
<p>The following <code>git-checkout</code> syntax,</p>
<pre><code>git checkout --patch <tree-ish> -- <paths>
</code></pre>
<p>or, equivalently,</p>
<pre><code>git checkout -p <tree-ish> -- <paths>
</code></pre>
<p>allows you to interactively check out hunks... | <h2>Use interactive checkout</h2> <p>The following <code>git-checkout</code> syntax,</p> <pre><code>git checkout --patch <tree-ish> -- <paths> </code></pre> <p>or, equivalently,</p> <pre><code>git checkout -p <tree-ish> -- <paths> </code></pre> <p>allows you to interactively check out hunks... | 119, 37230 | git, git-checkout | <h1>How can I restore only a few lines from a file recorded in a given commit?</h1>
<p>I want to restore a few lines from a file recorded in an older commit. I can see those lines by running</p>
<pre><code>git log -p
</code></pre>
<p>As a last resort, I'm ready to simply copy those lines from the output of that log, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,249 | git | # How can I restore only a few lines from a file recorded in a given commit?
I want to restore a few lines from a file recorded in an older commit. I can see those lines by running
```
git log -p
```
As a last resort, I'm ready to simply copy those lines from the output of that log, but that would hurt my purist's h... | ## Use interactive checkout
The following `git-checkout` syntax,
```
git checkout --patch <tree-ish> -- <paths>
```
or, equivalently,
```
git checkout -p <tree-ish> -- <paths>
```
allows you to interactively check out hunks from one or more files, listed in `<paths>`, as recorded in `<tree-ish>` (most commonly, a ... |
17429442 | Git: How does git svn fetch work? | 19 | 2013-07-02 15:19:36 | <p>How does <code>git svn fetch</code> work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because <code>git remote</code> doesn't give me anything on my <code>git svn</code> repository?</p>
| 26,152 | 1,007,758 | 2016-03-24 20:17:04 | 17,501,946 | 17 | 2013-07-06 10:17:33 | 1,007,758 | 2013-07-06 10:17:33 | https://stackoverflow.com/q/17429442 | https://stackoverflow.com/a/17501946 | <p>This is how <code>git svn fetch</code> works:</p>
<p>When using <code>git-svn</code> you don't have <em>remotes</em> of the <em>svn</em> server as you have when using <em>git</em>, you just have a link to the remote <em>svn</em> server in your local <em>.gitconfig</em> file.</p>
<p>If you want to update your curre... | <p>This is how <code>git svn fetch</code> works:</p> <p>When using <code>git-svn</code> you don't have <em>remotes</em> of the <em>svn</em> server as you have when using <em>git</em>, you just have a link to the remote <em>svn</em> server in your local <em>.gitconfig</em> file.</p> <p>If you want to update your curre... | 119, 6452, 28897, 29934, 33720 | git, git-fetch, git-merge, git-rebase, git-svn | <h1>Git: How does git svn fetch work?</h1>
<p>How does <code>git svn fetch</code> work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because <code>git remote</code> doesn't give me anything on my <code>git svn</code> repository?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,250 | git | # Git: How does git svn fetch work?
How does `git svn fetch` work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because `git remote` doesn't give me anything on my `git svn` repository? | This is how `git svn fetch` works:
When using `git-svn` you don't have *remotes* of the *svn* server as you have when using *git*, you just have a link to the remote *svn* server in your local *.gitconfig* file.
If you want to update your current branch to the last revision you can use `git svn rebase`. But if your s... |
11331582 | How to make "git diff" output normal diff format (non-unified, non-context)? | 19 | 2012-07-04 15:04:23 | <p>I want <code>git diff</code> to output normal, plain old diff output (not unified diff, and not context diff).</p>
<p>I want this:</p>
<pre><code>$ diff file1 file2
2c2
< b
---
> B
4d3
< d
5a5
> f
</code></pre>
<p>I do NOT want unified output:</p>
<pre><code>$ diff -u file1 file2
--- file1 2012... | 5,465 | 875,915 | 2013-11-28 14:20:35 | 11,354,123 | 17 | 2012-07-05 23:54:47 | 875,915 | 2013-11-28 14:20:35 | https://stackoverflow.com/q/11331582 | https://stackoverflow.com/a/11354123 | <pre><code>git difftool --extcmd=diff
</code></pre>
<p>or, without prompting:</p>
<pre><code>git difftool --extcmd=diff --no-prompt
</code></pre>
<p>This is <code>git difftool</code> rather than <code>git diff</code> but it is doing what I want.</p>
| <pre><code>git difftool --extcmd=diff </code></pre> <p>or, without prompting:</p> <pre><code>git difftool --extcmd=diff --no-prompt </code></pre> <p>This is <code>git difftool</code> rather than <code>git diff</code> but it is doing what I want.</p> | 119, 606 | diff, git | <h1>How to make "git diff" output normal diff format (non-unified, non-context)?</h1>
<p>I want <code>git diff</code> to output normal, plain old diff output (not unified diff, and not context diff).</p>
<p>I want this:</p>
<pre><code>$ diff file1 file2
2c2
< b
---
> B
4d3
< d
5a5
> f
</code></pre>
<p>I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,251 | git | # How to make "git diff" output normal diff format (non-unified, non-context)?
I want `git diff` to output normal, plain old diff output (not unified diff, and not context diff).
I want this:
```
$ diff file1 file2
2c2
< b
---
> B
4d3
< d
5a5
> f
```
I do NOT want unified output:
```
$ diff -u file1 file2
--- file... | ```
git difftool --extcmd=diff
```
or, without prompting:
```
git difftool --extcmd=diff --no-prompt
```
This is `git difftool` rather than `git diff` but it is doing what I want. |
7618876 | Replaced third party code with git submodules, now I can't switch branches | 19 | 2011-10-01 07:31:03 | <p>Here's the story:
I have 2 git branches <code>master</code> and <code>develop</code>
I'm currently on <code>develop</code>.</p>
<p>I've long since had the source files of a third party library included in my repo in the directory <code>Vendor/MGTwitterEngine</code>. This code was already merged into master.</p>
<p... | 2,235 | 80,559 | 2019-03-25 11:02:30 | 7,619,075 | 17 | 2011-10-01 08:19:20 | 223,092 | 2015-11-25 17:27:08 | https://stackoverflow.com/q/7618876 | https://stackoverflow.com/a/7619075 | <p>Unfortunately, I think this is just one of the drawbacks of using submodules. These problems are described in a section called <a href="https://git-scm.com/book/en/v1/Git-Tools-Submodules#Issues-with-Submodules" rel="nofollow">"Issues with Submodules" in Pro Git</a>, but in short, the simplest workaround is to move... | <p>Unfortunately, I think this is just one of the drawbacks of using submodules. These problems are described in a section called <a href="https://git-scm.com/book/en/v1/Git-Tools-Submodules#Issues-with-Submodules" rel="nofollow">"Issues with Submodules" in Pro Git</a>, but in short, the simplest workaround is to move... | 119, 28897, 41612 | git, git-merge, git-submodules | <h1>Replaced third party code with git submodules, now I can't switch branches</h1>
<p>Here's the story:
I have 2 git branches <code>master</code> and <code>develop</code>
I'm currently on <code>develop</code>.</p>
<p>I've long since had the source files of a third party library included in my repo in the directory <c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,252 | git | # Replaced third party code with git submodules, now I can't switch branches
Here's the story:
I have 2 git branches `master` and `develop`
I'm currently on `develop`.
I've long since had the source files of a third party library included in my repo in the directory `Vendor/MGTwitterEngine`. This code was already mer... | Unfortunately, I think this is just one of the drawbacks of using submodules. These problems are described in a section called ["Issues with Submodules" in Pro Git](https://git-scm.com/book/en/v1/Git-Tools-Submodules#Issues-with-Submodules), but in short, the simplest workaround is to move the submodule directory out o... |
42886031 | How can I diff two git branches in bitbucket pipeline | 18 | 2017-03-19 11:28:14 | <h2>Background</h2>
<p>I want to make sure that all commit messages on the pushed branch have a time log in it</p>
<p>ie. <code>add readme /spend 5m</code></p>
<h2>Problem</h2>
<p>I want to get the commit diff between two git branches in bitbucket pipeline,</p>
<p>this is my yaml pipeline config:</p>
<pre><code>p... | 7,167 | 4,885,802 | 2017-11-17 16:37:39 | 47,355,353 | 17 | 2017-11-17 16:37:39 | 492,410 | 2017-11-17 16:37:39 | https://stackoverflow.com/q/42886031 | https://stackoverflow.com/a/47355353 | <p>As you rightfully point out, Bitbucket pipelines will only clone the specific branch that triggered the build.</p>
<p>As such, the <a href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec" rel="noreferrer">RefSpec</a> will be set to the specific branch, and you'll be unable to merge or diff other branches.... | <p>As you rightfully point out, Bitbucket pipelines will only clone the specific branch that triggered the build.</p> <p>As such, the <a href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec" rel="noreferrer">RefSpec</a> will be set to the specific branch, and you'll be unable to merge or diff other branches.... | 119, 8337 | bitbucket, git | <h1>How can I diff two git branches in bitbucket pipeline</h1>
<h2>Background</h2>
<p>I want to make sure that all commit messages on the pushed branch have a time log in it</p>
<p>ie. <code>add readme /spend 5m</code></p>
<h2>Problem</h2>
<p>I want to get the commit diff between two git branches in bitbucket pipel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,253 | git | # How can I diff two git branches in bitbucket pipeline
## Background
I want to make sure that all commit messages on the pushed branch have a time log in it
ie. `add readme /spend 5m`
## Problem
I want to get the commit diff between two git branches in bitbucket pipeline,
this is my yaml pipeline config:
```
pi... | As you rightfully point out, Bitbucket pipelines will only clone the specific branch that triggered the build.
As such, the [RefSpec](https://git-scm.com/book/en/v2/Git-Internals-The-Refspec) will be set to the specific branch, and you'll be unable to merge or diff other branches.
For example, if the build was trigge... |
45677569 | How do I keep ASP.net connection string passwords secure on a git repository? | 18 | 2017-08-14 15:06:19 | <p>Up until now I have been using gitignore to ignore my web.congfig and web.release.config files so that my connections strings (including passwords) do not get stored in the git repository.</p>
<p>This has been fine with changes to the web.config being passed around on encrypted removable media.</p>
<p>BUT I have j... | 7,405 | 3,541,717 | 2022-02-16 07:59:15 | 45,706,222 | 17 | 2017-08-16 06:10:31 | 4,346,969 | 2017-08-16 06:10:31 | https://stackoverflow.com/q/45677569 | https://stackoverflow.com/a/45706222 | <p>You can achieve that by moving your connection string details to external configuration file. Say you move your connection string to connections.config file</p>
<pre><code><connectionStrings>
<add name="Name"
providerName="System.Data.ProviderName"
connectionString="Valid Connection String;... | <p>You can achieve that by moving your connection string details to external configuration file. Say you move your connection string to connections.config file</p> <pre><code><connectionStrings> <add name="Name" providerName="System.Data.ProviderName" connectionString="Valid Connection String;... | 9, 96, 119, 1066 | asp.net, c#, continuous-integration, git | <h1>How do I keep ASP.net connection string passwords secure on a git repository?</h1>
<p>Up until now I have been using gitignore to ignore my web.congfig and web.release.config files so that my connections strings (including passwords) do not get stored in the git repository.</p>
<p>This has been fine with changes t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,254 | git | # How do I keep ASP.net connection string passwords secure on a git repository?
Up until now I have been using gitignore to ignore my web.congfig and web.release.config files so that my connections strings (including passwords) do not get stored in the git repository.
This has been fine with changes to the web.config... | You can achieve that by moving your connection string details to external configuration file. Say you move your connection string to connections.config file
```
<connectionStrings>
<add name="Name"
providerName="System.Data.ProviderName"
connectionString="Valid Connection String;" />
</connectionStri... |
8131692 | Bitbucket + XCode 4.2 + Git | 18 | 2011-11-15 04:59:19 | <p>I've been looking for a solution with Bitbucket and XCode.</p>
<p>As everybody knows, XCode 4.2 comes with git support.
I've created a bitbucket account and I wanted to push my changes to my repository, </p>
<p>I've followed this tutorial
<a href="https://confluence.atlassian.com/display/BITBUCKET/Use+the+SSH+prot... | 22,464 | 1,031,846 | 2016-03-22 19:49:19 | 9,271,409 | 17 | 2012-02-14 03:44:54 | 824,118 | 2012-02-14 03:44:54 | https://stackoverflow.com/q/8131692 | https://stackoverflow.com/a/9271409 | <p>It worked for me by using the HTTPS URI, but I needed to remove my user name from it. For example change:</p>
<p><code>https://username@bitbucket.org/username/myrepo.git</code></p>
<p>to</p>
<p><code>https://bitbucket.org/username/myrepo.git</code></p>
<p>then supply your username and password when prompted.</p>... | <p>It worked for me by using the HTTPS URI, but I needed to remove my user name from it. For example change:</p> <p><code>https://username@bitbucket.org/username/myrepo.git</code></p> <p>to</p> <p><code>https://bitbucket.org/username/myrepo.git</code></p> <p>then supply your username and password when prompted.</p>... | 119, 908, 8337, 69874 | bitbucket, git, xcode, xcode4.2 | <h1>Bitbucket + XCode 4.2 + Git</h1>
<p>I've been looking for a solution with Bitbucket and XCode.</p>
<p>As everybody knows, XCode 4.2 comes with git support.
I've created a bitbucket account and I wanted to push my changes to my repository, </p>
<p>I've followed this tutorial
<a href="https://confluence.atlassian.c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,257 | git | # Bitbucket + XCode 4.2 + Git
I've been looking for a solution with Bitbucket and XCode.
As everybody knows, XCode 4.2 comes with git support.
I've created a bitbucket account and I wanted to push my changes to my repository,
I've followed this tutorial
<https://confluence.atlassian.com/display/BITBUCKET/Use+the+SSH... | It worked for me by using the HTTPS URI, but I needed to remove my user name from it. For example change:
`https://username@bitbucket.org/username/myrepo.git`
to
`https://bitbucket.org/username/myrepo.git`
then supply your username and password when prompted. |
5948354 | How two laptops can git push/pull to each other with no internet | 18 | 2011-05-10 09:59:06 | <p>Say my co-hacker and I find ourselves on a desert island. Normally we push and pull to github to sync with each other. How would you recommend we do so when we have no connection to the outside world?</p>
<p>(User <a href="https://stackoverflow.com/users/58164/bee">@bee</a> and I actually have that problem as I typ... | 5,119 | 4,234 | 2013-02-07 06:52:41 | 5,948,452 | 17 | 2011-05-10 10:07:10 | 98,117 | 2011-05-10 10:07:10 | https://stackoverflow.com/q/5948354 | https://stackoverflow.com/a/5948452 | <p>The simplest solution is probably to just set up an ad-hoc wireless and SSH to eachother's laptops. You can set up your remote with</p>
<pre><code>$ git remote add cohacker myuser@cohackers-laptop:/path/to/repo.git
</code></pre>
<p>Now you can push/pull to your heart's content:</p>
<pre><code>$ git pull cohacker ... | <p>The simplest solution is probably to just set up an ad-hoc wireless and SSH to eachother's laptops. You can set up your remote with</p> <pre><code>$ git remote add cohacker myuser@cohackers-laptop:/path/to/repo.git </code></pre> <p>Now you can push/pull to your heart's content:</p> <pre><code>$ git pull cohacker ... | 119 | git | <h1>How two laptops can git push/pull to each other with no internet</h1>
<p>Say my co-hacker and I find ourselves on a desert island. Normally we push and pull to github to sync with each other. How would you recommend we do so when we have no connection to the outside world?</p>
<p>(User <a href="https://stackoverfl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,258 | git | # How two laptops can git push/pull to each other with no internet
Say my co-hacker and I find ourselves on a desert island. Normally we push and pull to github to sync with each other. How would you recommend we do so when we have no connection to the outside world?
(User [@bee](https://stackoverflow.com/users/58164... | The simplest solution is probably to just set up an ad-hoc wireless and SSH to eachother's laptops. You can set up your remote with
```
$ git remote add cohacker myuser@cohackers-laptop:/path/to/repo.git
```
Now you can push/pull to your heart's content:
```
$ git pull cohacker master
... hack away ...
$ git push c... |
37667324 | How do I get the current "status" of a git bisect? | 17 | 2016-06-06 21:42:04 | <p>I am making some personal modifications to oh-my-git (shows the git status on the terminal) and I would like to display the "status" of the current bisect. Specifically, I want to get the number of remaining commits and approximate number of steps that are a result of the last bisect command, e.g.:</p>
<p><code>Bi... | 6,667 | 185,828 | 2020-07-10 08:01:14 | 37,668,768 | 17 | 2016-06-07 00:29:20 | 1,250,772 | 2016-06-07 00:29:20 | https://stackoverflow.com/q/37667324 | https://stackoverflow.com/a/37668768 | <p>Completely naive answer based on extremely limited testing:</p>
<p>The range of commits left to probe can be obtained with <code>git bisect visualize</code>, and this can be crudely counted with <code>git bisect visualize | wc -l</code> or what have you.</p>
<p>The message that was printed prior to getting into th... | <p>Completely naive answer based on extremely limited testing:</p> <p>The range of commits left to probe can be obtained with <code>git bisect visualize</code>, and this can be crudely counted with <code>git bisect visualize | wc -l</code> or what have you.</p> <p>The message that was printed prior to getting into th... | 119, 47326 | git, git-bisect | <h1>How do I get the current "status" of a git bisect?</h1>
<p>I am making some personal modifications to oh-my-git (shows the git status on the terminal) and I would like to display the "status" of the current bisect. Specifically, I want to get the number of remaining commits and approximate number of steps that are... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,262 | git | # How do I get the current "status" of a git bisect?
I am making some personal modifications to oh-my-git (shows the git status on the terminal) and I would like to display the "status" of the current bisect. Specifically, I want to get the number of remaining commits and approximate number of steps that are a result ... | Completely naive answer based on extremely limited testing:
The range of commits left to probe can be obtained with `git bisect visualize`, and this can be crudely counted with `git bisect visualize | wc -l` or what have you.
The message that was printed prior to getting into this state appears to be based roughly on... |
35447092 | Git: checkout without running post-checkout hook | 17 | 2016-02-17 03:02:27 | <p>I have a post-checkout hook that I like – most of the time – but from time to time I know that it would be waste of time to run it, or, since it drops and rebuilds my development database, I don't want it to do its thing.</p>
<p>Is there a git option that skips hooks? So fair I've struck out looking for one.</p>
| 7,332 | 5,115,046 | 2020-06-05 09:13:21 | 35,447,455 | 17 | 2016-02-17 03:39:16 | 147,356 | 2016-02-17 03:39:16 | https://stackoverflow.com/q/35447092 | https://stackoverflow.com/a/35447455 | <p>I don't think there's a command line option to do what you want, but you can trivially solve this by using an environment variable as a flag. In your <code>post-checkout</code> script, start with:</p>
<pre><code>#!/bin/sh
[ "$SKIP_POST_CHECKOUT" = 1 ] && exit 0
</code></pre>
<p>And then when you want to s... | <p>I don't think there's a command line option to do what you want, but you can trivially solve this by using an environment variable as a flag. In your <code>post-checkout</code> script, start with:</p> <pre><code>#!/bin/sh [ "$SKIP_POST_CHECKOUT" = 1 ] && exit 0 </code></pre> <p>And then when you want to s... | 119 | git | <h1>Git: checkout without running post-checkout hook</h1>
<p>I have a post-checkout hook that I like – most of the time – but from time to time I know that it would be waste of time to run it, or, since it drops and rebuilds my development database, I don't want it to do its thing.</p>
<p>Is there a git option that sk... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,263 | git | # Git: checkout without running post-checkout hook
I have a post-checkout hook that I like – most of the time – but from time to time I know that it would be waste of time to run it, or, since it drops and rebuilds my development database, I don't want it to do its thing.
Is there a git option that skips hooks? So fa... | I don't think there's a command line option to do what you want, but you can trivially solve this by using an environment variable as a flag. In your `post-checkout` script, start with:
```
#!/bin/sh
[ "$SKIP_POST_CHECKOUT" = 1 ] && exit 0
```
And then when you want to skip the `post-checkout` script:
```
SKIP_POST_... |
25102750 | squash more then two commits in sourcetree? | 17 | 2014-08-03 07:58:03 | <p>I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash all 20 commits into one commit, preferably using sourcetree? I want to do this so I can just push one commit to origi... | 10,178 | 1,272,421 | 2025-07-12 06:49:50 | 25,102,911 | 17 | 2014-08-03 08:23:09 | 6,309 | 2014-08-03 08:23:09 | https://stackoverflow.com/q/25102750 | https://stackoverflow.com/a/25102911 | <p>Easier solution (than a rebase):</p>
<p>Select the "origin/master" commit in the log entry, click on "<code>Reset <branch> to this commit</code>". </p>
<p><img src="https://i.sstatic.net/DKLNE.png" alt="http://i.imgur.com/nWDzb6k.png"></p>
<p>Use the default mixed mode.</p>
<p><img src="https://i.sstatic.... | <p>Easier solution (than a rebase):</p> <p>Select the "origin/master" commit in the log entry, click on "<code>Reset <branch> to this commit</code>". </p> <p><img src="https://i.sstatic.net/DKLNE.png" alt="http://i.imgur.com/nWDzb6k.png"></p> <p>Use the default mixed mode.</p> <p><img src="https://i.sstatic.... | 119, 42532, 90056 | atlassian-sourcetree, git, squash | <h1>squash more then two commits in sourcetree?</h1>
<p>I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash all 20 commits into one commit, preferably using sourcetree? I w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,264 | git | # squash more then two commits in sourcetree?
I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash all 20 commits into one commit, preferably using sourcetree? I want to do th... | Easier solution (than a rebase):
Select the "origin/master" commit in the log entry, click on "`Reset <branch> to this commit`".

Use the default mixed mode.

Then add and commit: all... |
13680212 | Find and extract file from Git stash | 17 | 2012-12-03 09:19:21 | <p>Maybe I'm using git stash too often, but that's what I usually do when I want to throw away my experiments in the project.</p>
<p>Question 1:</p>
<ul>
<li>How could I search for a filename in all my current stashes?</li>
</ul>
<p>Question 2:</p>
<ul>
<li><p>How could I extract this file to separate folder?</p></... | 10,938 | 139,361 | 2025-09-23 19:54:37 | 13,692,875 | 17 | 2012-12-03 22:26:03 | 85,371 | 2017-08-30 00:05:53 | https://stackoverflow.com/q/13680212 | https://stackoverflow.com/a/13692875 | <p>A little more to the point would be to recognize that <code>refs/stash</code> is reflog of a a pseudo-branch (ref):</p>
<pre><code>git rev-list --walk-reflogs stash # (long option)
git rev-list -g stash # (short option)
</code></pre>
<p>So you could locate the file:</p>
<pre><code>for sha in $(git rev-list -g sta... | <p>A little more to the point would be to recognize that <code>refs/stash</code> is reflog of a a pseudo-branch (ref):</p> <pre><code>git rev-list --walk-reflogs stash # (long option) git rev-list -g stash # (short option) </code></pre> <p>So you could locate the file:</p> <pre><code>for sha in $(git rev-list -g sta... | 119 | git | <h1>Find and extract file from Git stash</h1>
<p>Maybe I'm using git stash too often, but that's what I usually do when I want to throw away my experiments in the project.</p>
<p>Question 1:</p>
<ul>
<li>How could I search for a filename in all my current stashes?</li>
</ul>
<p>Question 2:</p>
<ul>
<li><p>How could... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,265 | git | # Find and extract file from Git stash
Maybe I'm using git stash too often, but that's what I usually do when I want to throw away my experiments in the project.
Question 1:
- How could I search for a filename in all my current stashes?
Question 2:
- How could I extract this file to separate folder?
- or another o... | A little more to the point would be to recognize that `refs/stash` is reflog of a a pseudo-branch (ref):
```
git rev-list --walk-reflogs stash # (long option)
git rev-list -g stash # (short option)
```
So you could locate the file:
```
for sha in $(git rev-list -g stash);
do
git ls-tree -r $sha:;
done |
g... |
7007758 | How to draw(edit) an ascii git tree | 17 | 2011-08-10 08:18:19 | <p>How the git tree shown in the git documentation like the one below</p>
<pre><code> G H I J
\ / \ /
D E F
\ | / \
\ | / |
\|/ |
B C
\ /
\ /
A
</code></pre>
<p>is drawn(edited)... | 8,737 | 579,689 | 2018-01-15 13:00:49 | 7,007,871 | 17 | 2011-08-10 08:28:24 | 6,309 | 2011-08-10 08:28:24 | https://stackoverflow.com/q/7007758 | https://stackoverflow.com/a/7007871 | <p>You don't have natively a way to reproduced that <em>exact</em> type of schema, but a git log that this one is a good start:</p>
<pre><code>git log --graph --pretty=format:'%Cred%h%Creset%n' --abbrev-commit --date=relative --branches --all
</code></pre>
| <p>You don't have natively a way to reproduced that <em>exact</em> type of schema, but a git log that this one is a good start:</p> <pre><code>git log --graph --pretty=format:'%Cred%h%Creset%n' --abbrev-commit --date=relative --branches --all </code></pre> | 119, 1469, 20685 | ascii-art, git, text | <h1>How to draw(edit) an ascii git tree</h1>
<p>How the git tree shown in the git documentation like the one below</p>
<pre><code> G H I J
\ / \ /
D E F
\ | / \
\ | / |
\|/ |
B C
\ /
\ /
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,266 | git | # How to draw(edit) an ascii git tree
How the git tree shown in the git documentation like the one below
```
G H I J
\ / \ /
D E F
\ | / \
\ | / |
\|/ |
B C
\ /
\ /
A
```
is d... | You don't have natively a way to reproduced that *exact* type of schema, but a git log that this one is a good start:
```
git log --graph --pretty=format:'%Cred%h%Creset%n' --abbrev-commit --date=relative --branches --all
``` |
6808653 | Fatal: The remote end hung up unexpectedly while pushing to Git repository | 17 | 2011-07-24 18:07:40 | <p>I created a new repository called DirectorySocket, and from my project directory called DirectorySocket I did the following:</p>
<pre><code>$ git init
$ git add .
$ git remote add origin git@github.com:neilghosh/DirectorySocket.git
$ git commit -m "Initial version"
$ git push origin master
</code></pre>
<p>And I g... | 48,492 | 747,456 | 2017-04-25 18:03:50 | 6,808,697 | 17 | 2011-07-24 18:14:33 | 526,535 | 2011-07-24 18:22:54 | https://stackoverflow.com/q/6808653 | https://stackoverflow.com/a/6808697 | <p>Since it is your repository, check if the keys and token are setup properly as per the instructions provided by GitHub.</p>
<p><a href="http://help.github.com/win-set-up-git/" rel="noreferrer">http://help.github.com/win-set-up-git/</a></p>
<p>As a first step, see if </p>
<pre><code> ssh -T git@github.com
</code><... | <p>Since it is your repository, check if the keys and token are setup properly as per the instructions provided by GitHub.</p> <p><a href="http://help.github.com/win-set-up-git/" rel="noreferrer">http://help.github.com/win-set-up-git/</a></p> <p>As a first step, see if </p> <pre><code> ssh -T git@github.com </code><... | 119, 4236 | git, push | <h1>Fatal: The remote end hung up unexpectedly while pushing to Git repository</h1>
<p>I created a new repository called DirectorySocket, and from my project directory called DirectorySocket I did the following:</p>
<pre><code>$ git init
$ git add .
$ git remote add origin git@github.com:neilghosh/DirectorySocket.git
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,267 | git | # Fatal: The remote end hung up unexpectedly while pushing to Git repository
I created a new repository called DirectorySocket, and from my project directory called DirectorySocket I did the following:
```
$ git init
$ git add .
$ git remote add origin git@github.com:neilghosh/DirectorySocket.git
$ git commit -m "Ini... | Since it is your repository, check if the keys and token are setup properly as per the instructions provided by GitHub.
<http://help.github.com/win-set-up-git/>
As a first step, see if
```
ssh -T git@github.com
```
works. |
44286795 | Why does git rev-parse --short use a non-default length? | 16 | 2017-05-31 13:57:38 | <p>When running <code>git rev-parse --short HEAD</code> on repository A I get a hash output of length 7 as that is the default length for the <code>--short</code> option in the <a href="https://git-scm.com/docs/git-rev-parse" rel="noreferrer">git documentation</a>.</p>
<p>When running the same command within repositor... | 5,085 | 758,446 | 2017-05-31 14:06:25 | 44,287,003 | 17 | 2017-05-31 14:06:25 | 758,446 | 2017-05-31 14:06:25 | https://stackoverflow.com/q/44286795 | https://stackoverflow.com/a/44287003 | <p>Looks like the documentation is out of date. This could happen due to one of two things:</p>
<ol>
<li>There is a duplicate hash of length 8 in repository B. <code>git rev-parse --short</code> will try to return a unique hash string. This seems unlikely but theoretically possible.</li>
</ol>
<p>OR</p>
<ol start="2... | <p>Looks like the documentation is out of date. This could happen due to one of two things:</p> <ol> <li>There is a duplicate hash of length 8 in repository B. <code>git rev-parse --short</code> will try to return a unique hash string. This seems unlikely but theoretically possible.</li> </ol> <p>OR</p> <ol start="2... | 119 | git | <h1>Why does git rev-parse --short use a non-default length?</h1>
<p>When running <code>git rev-parse --short HEAD</code> on repository A I get a hash output of length 7 as that is the default length for the <code>--short</code> option in the <a href="https://git-scm.com/docs/git-rev-parse" rel="noreferrer">git documen... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,272 | git | # Why does git rev-parse --short use a non-default length?
When running `git rev-parse --short HEAD` on repository A I get a hash output of length 7 as that is the default length for the `--short` option in the [git documentation](https://git-scm.com/docs/git-rev-parse).
When running the same command within repositor... | Looks like the documentation is out of date. This could happen due to one of two things:
1. There is a duplicate hash of length 8 in repository B. `git rev-parse --short` will try to return a unique hash string. This seems unlikely but theoretically possible.
OR
2. There are a lot of packed objects in this repo and ... |
28721365 | How to set environment variables for Laravel 5 on AWS EC2 with MySQL | 16 | 2015-02-25 14:19:42 | <p>I have successfully deployed my laravel 5 app to AWS EC2. I have also created a MySQL database with AWS RDS and associated it with my app instance.</p>
<p>Now I want to set my env variables so it uses homesteads default values when on my local machine in development, and my AWS database when deployed and in product... | 16,793 | 3,668,625 | 2015-06-02 13:17:16 | 30,534,003 | 17 | 2015-05-29 15:57:41 | 860,787 | 2015-05-29 16:04:50 | https://stackoverflow.com/q/28721365 | https://stackoverflow.com/a/30534003 | <p>You could create a new .env on your ec2 instance and add all the env vars in there. One option would be ssh-ing into the box and creating the file via vi or cat. Or you could write a script to remotely pull the .env in from an external location.</p>
<p>You could also ssh into the box and <code>export APP_ENV=produc... | <p>You could create a new .env on your ec2 instance and add all the env vars in there. One option would be ssh-ing into the box and creating the file via vi or cat. Or you could write a script to remotely pull the .env in from an external location.</p> <p>You could also ssh into the box and <code>export APP_ENV=produc... | 21, 119, 9013, 33388, 106940 | amazon-web-services, environment-variables, git, laravel-5, mysql | <h1>How to set environment variables for Laravel 5 on AWS EC2 with MySQL</h1>
<p>I have successfully deployed my laravel 5 app to AWS EC2. I have also created a MySQL database with AWS RDS and associated it with my app instance.</p>
<p>Now I want to set my env variables so it uses homesteads default values when on my ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,273 | git | # How to set environment variables for Laravel 5 on AWS EC2 with MySQL
I have successfully deployed my laravel 5 app to AWS EC2. I have also created a MySQL database with AWS RDS and associated it with my app instance.
Now I want to set my env variables so it uses homesteads default values when on my local machine in... | You could create a new .env on your ec2 instance and add all the env vars in there. One option would be ssh-ing into the box and creating the file via vi or cat. Or you could write a script to remotely pull the .env in from an external location.
You could also ssh into the box and `export APP_ENV=production` all your ... |
15075783 | Add line break to git commit -m from command line on Windows | 16 | 2013-02-25 20:22:11 | <p>My company has a policy that all checkins to a particular project must follow a specific multi-line template for git commits. How can I most simply create a single commit message that has multiple lines from the command line in Windows?</p>
<p><sub><em>This is almost exactly a duplicate of</em> "<a href="https://st... | 8,093 | 405,017 | 2024-02-16 09:19:53 | 15,076,344 | 17 | 2013-02-25 20:56:30 | 1,253,222 | 2013-02-25 20:56:30 | https://stackoverflow.com/q/15075783 | https://stackoverflow.com/a/15076344 | <p>Either create a file that contains your commit message in the right format and use <code>git commit -F <message_file></code>, after which you can continually edit and reuse that same file, or create a template file and use <code>git commit -t <template_file></code> to open your editor with the pre-cooked... | <p>Either create a file that contains your commit message in the right format and use <code>git commit -F <message_file></code>, after which you can continually edit and reuse that same file, or create a template file and use <code>git commit -t <template_file></code> to open your editor with the pre-cooked... | 64, 119 | git, windows | <h1>Add line break to git commit -m from command line on Windows</h1>
<p>My company has a policy that all checkins to a particular project must follow a specific multi-line template for git commits. How can I most simply create a single commit message that has multiple lines from the command line in Windows?</p>
<p><s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,274 | git | # Add line break to git commit -m from command line on Windows
My company has a policy that all checkins to a particular project must follow a specific multi-line template for git commits. How can I most simply create a single commit message that has multiple lines from the command line in Windows?
*This is almost ex... | Either create a file that contains your commit message in the right format and use `git commit -F <message_file>`, after which you can continually edit and reuse that same file, or create a template file and use `git commit -t <template_file>` to open your editor with the pre-cooked template to be filled in. The second... |
8692664 | How do I execute a Capistrano task locally? | 16 | 2012-01-01 10:17:29 | <p>I have defined a custom Capistrano task that's supposed to run locally (on my development machine):</p>
<pre><code>desc "Push code to Dreamhost"
task :push do
run "git push dreamhost"
end
</code></pre>
<p>however when I try to run <code>cap push</code> it executes it on the remote machine, ie.</p>
<pre><code>* ... | 20,620 | 780,384 | 2013-12-12 22:24:06 | 8,692,730 | 17 | 2012-01-01 10:45:22 | 893,390 | 2012-01-01 10:45:22 | https://stackoverflow.com/q/8692664 | https://stackoverflow.com/a/8692730 | <p>I suggest using : </p>
<pre><code>system("git push dreamhost")
</code></pre>
<p>or</p>
<pre><code>output = %x[git push dreamhost]
</code></pre>
<p>That's just plain Ruby !</p>
| <p>I suggest using : </p> <pre><code>system("git push dreamhost") </code></pre> <p>or</p> <pre><code>output = %x[git push dreamhost] </code></pre> <p>That's just plain Ruby !</p> | 119, 2831 | capistrano, git | <h1>How do I execute a Capistrano task locally?</h1>
<p>I have defined a custom Capistrano task that's supposed to run locally (on my development machine):</p>
<pre><code>desc "Push code to Dreamhost"
task :push do
run "git push dreamhost"
end
</code></pre>
<p>however when I try to run <code>cap push</code> it exec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,275 | git | # How do I execute a Capistrano task locally?
I have defined a custom Capistrano task that's supposed to run locally (on my development machine):
```
desc "Push code to Dreamhost"
task :push do
run "git push dreamhost"
end
```
however when I try to run `cap push` it executes it on the remote machine, ie.
```
* ex... | I suggest using :
```
system("git push dreamhost")
```
or
```
output = %x[git push dreamhost]
```
That's just plain Ruby ! |
7211092 | How do I find out the numbering of merge commit parents? | 16 | 2011-08-26 22:16:43 | <p>I need to do a git revert -m , but I have not been able to find any documentation on how the commit parents are numbered. Everything I've seen (including the help pages for rev-parse) just tells me that the parents are numbered but do not say how they are numbered. Could someone point out to me where this is defined... | 8,427 | 267,934 | 2016-07-05 15:53:41 | 7,211,140 | 17 | 2011-08-26 22:26:44 | 148,870 | 2011-08-26 22:26:44 | https://stackoverflow.com/q/7211092 | https://stackoverflow.com/a/7211140 | <pre><code>git show --format="%P" <SHA>
</code></pre>
<p>will give you the parent SHAs of the given commit in numerical order. Most often the one you'll want to specify for <code>git revert</code> will be <code>1</code>.</p>
<p>In the case of most merges, the SHA of the branch that was checked out will be the f... | <pre><code>git show --format="%P" <SHA> </code></pre> <p>will give you the parent SHAs of the given commit in numerical order. Most often the one you'll want to specify for <code>git revert</code> will be <code>1</code>.</p> <p>In the case of most merges, the SHA of the branch that was checked out will be the f... | 119, 717 | git, merge | <h1>How do I find out the numbering of merge commit parents?</h1>
<p>I need to do a git revert -m , but I have not been able to find any documentation on how the commit parents are numbered. Everything I've seen (including the help pages for rev-parse) just tells me that the parents are numbered but do not say how they... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,276 | git | # How do I find out the numbering of merge commit parents?
I need to do a git revert -m , but I have not been able to find any documentation on how the commit parents are numbered. Everything I've seen (including the help pages for rev-parse) just tells me that the parents are numbered but do not say how they are numb... | ```
git show --format="%P" <SHA>
```
will give you the parent SHAs of the given commit in numerical order. Most often the one you'll want to specify for `git revert` will be `1`.
In the case of most merges, the SHA of the branch that was checked out will be the first parent, and the SHA of the branch that was merged ... |
4019501 | Git Alias Problem | 16 | 2010-10-25 22:50:37 | <p>I was trying to set up some git aliases by adding these lines to my <code>~/.gitconfig</code> file:</p>
<pre><code>[alias]
st = status
ci = commit
br = branch
</code></pre>
<p>And when I go to run these commands in the terminal: <code>git st</code>, I get the following error <code>fatal: cannot exec 'git-st'... | 6,428 | 427,494 | 2014-10-16 08:46:05 | 4,110,132 | 17 | 2010-11-05 21:11:51 | 6,309 | 2012-02-09 20:47:04 | https://stackoverflow.com/q/4019501 | https://stackoverflow.com/a/4110132 | <p><a href="https://stackoverflow.com/users/190597/unutbu">unutbu</a> correctly pointed out to the <a href="http://code.google.com/p/git-osx-installer/issues/detail?id=53#c5" rel="noreferrer">git-osx-installer issue 53</a>, which states:</p>
<blockquote>
<p>Basically, I had <code>/root/bin</code> in my path and didn't ... | <p><a href="https://stackoverflow.com/users/190597/unutbu">unutbu</a> correctly pointed out to the <a href="http://code.google.com/p/git-osx-installer/issues/detail?id=53#c5" rel="noreferrer">git-osx-installer issue 53</a>, which states:</p> <blockquote> <p>Basically, I had <code>/root/bin</code> in my path and didn't ... | 119, 1448 | alias, git | <h1>Git Alias Problem</h1>
<p>I was trying to set up some git aliases by adding these lines to my <code>~/.gitconfig</code> file:</p>
<pre><code>[alias]
st = status
ci = commit
br = branch
</code></pre>
<p>And when I go to run these commands in the terminal: <code>git st</code>, I get the following error <code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,277 | git | # Git Alias Problem
I was trying to set up some git aliases by adding these lines to my `~/.gitconfig` file:
```
[alias]
st = status
ci = commit
br = branch
```
And when I go to run these commands in the terminal: `git st`, I get the following error `fatal: cannot exec 'git-st': Not a directory`. I do not know... | [unutbu](https://stackoverflow.com/users/190597/unutbu) correctly pointed out to the [git-osx-installer issue 53](http://code.google.com/p/git-osx-installer/issues/detail?id=53#c5), which states:
> Basically, I had `/root/bin` in my path and didn't have permissions for that directory.
>
> Interestingly, this was not a... |
2771033 | git-svn - #object# doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4706 | 16 | 2010-05-05 06:28:19 | <p>on</p>
<pre><code>git svn dcommit
</code></pre>
<p>it starts commiting and then I get this</p>
<pre><code>A spec/controllers/authenticated_system_spec.rb
A spec/controllers/sessions_controller_spec.rb
A spec/controllers/users_controller_spec.rb
A spec/fixtures/users.yml
A spec/helpers/users_helper_spec.... | 2,638 | 77,339 | 2016-01-21 16:56:14 | 2,773,869 | 17 | 2010-05-05 14:02:14 | 6,309 | 2010-05-05 14:02:14 | https://stackoverflow.com/q/2771033 | https://stackoverflow.com/a/2773869 | <p>Did you create <strong><a href="http://kernel.org/pub/software/scm/git/docs/git-submodule.html" rel="noreferrer">submodules</a></strong> in your Git repo ?<br>
This <a href="http://de-co-de.blogspot.com/2009/02/git-svn-and-submodules.html" rel="noreferrer">blog post</a> seems to mention that as an issue.</p>
<block... | <p>Did you create <strong><a href="http://kernel.org/pub/software/scm/git/docs/git-submodule.html" rel="noreferrer">submodules</a></strong> in your Git repo ?<br> This <a href="http://de-co-de.blogspot.com/2009/02/git-svn-and-submodules.html" rel="noreferrer">blog post</a> seems to mention that as an issue.</p> <block... | 119, 6452 | git, git-svn | <h1>git-svn - #object# doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4706</h1>
<p>on</p>
<pre><code>git svn dcommit
</code></pre>
<p>it starts commiting and then I get this</p>
<pre><code>A spec/controllers/authenticated_system_spec.rb
A spec/controllers/sessions_controller_spec.rb
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,278 | git | # git-svn - #object# doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4706
on
```
git svn dcommit
```
it starts commiting and then I get this
```
A spec/controllers/authenticated_system_spec.rb
A spec/controllers/sessions_controller_spec.rb
A spec/controllers/users_controller_spec.r... | Did you create **[submodules](http://kernel.org/pub/software/scm/git/docs/git-submodule.html)** in your Git repo ?
This [blog post](http://de-co-de.blogspot.com/2009/02/git-svn-and-submodules.html) seems to mention that as an issue.
> As of Jan 2009 `git-svn` does NOT work with submodules.
> There is no good way t... |
74012449 | Git - includeIf hasconfig:remote.*.url not working | 15 | 2022-10-10 09:02:14 | <p>I want to use two separate GitHub accounts on the same computer so I setup ssh keys for both of them. Both are working fine. I don't want to config my email and name each time I create a new repo so I looked around and found git's "includeIf" section.</p>
<p>I am using git version 2.37.3</p>
<p>These are m... | 5,821 | 15,859,850 | 2025-04-28 16:47:28 | 74,012,889 | 17 | 2022-10-10 09:39:05 | 86,072 | 2023-07-10 10:22:46 | https://stackoverflow.com/q/74012449 | https://stackoverflow.com/a/74012889 | <p>An <code>includeIf...</code> statement only allows, as its name suggests, to include another <em>file</em> (as opposed to: a config section within the same file).</p>
<p>You would have to put your <code>email, name</code> parameters in a separate file, and point to that file using <code>path = ...</code> in your mai... | <p>An <code>includeIf...</code> statement only allows, as its name suggests, to include another <em>file</em> (as opposed to: a config section within the same file).</p> <p>You would have to put your <code>email, name</code> parameters in a separate file, and point to that file using <code>path = ...</code> in your mai... | 119, 32868 | git, git-config | <h1>Git - includeIf hasconfig:remote.*.url not working</h1>
<p>I want to use two separate GitHub accounts on the same computer so I setup ssh keys for both of them. Both are working fine. I don't want to config my email and name each time I create a new repo so I looked around and found git's "includeIf" sect... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,279 | git | # Git - includeIf hasconfig:remote.*.url not working
I want to use two separate GitHub accounts on the same computer so I setup ssh keys for both of them. Both are working fine. I don't want to config my email and name each time I create a new repo so I looked around and found git's "includeIf" section.
I am using gi... | An `includeIf...` statement only allows, as its name suggests, to include another *file* (as opposed to: a config section within the same file).
You would have to put your `email, name` parameters in a separate file, and point to that file using `path = ...` in your main config file.
---
quoting the relevant example... |
35211547 | Where is a submodule commit number stored (and how do I change it)? | 15 | 2016-02-04 21:01:14 | <p>In order to get a project with submodules, you run this command after cloning the project:</p>
<pre><code>git submodule init
</code></pre>
<p>This command reads <code>.gitmodules</code> and writes information about the module into the index.</p>
<p>Then you run </p>
<pre><code>git submodule update
</code></pre>
... | 7,790 | 284,111 | 2023-07-04 02:51:40 | 35,211,854 | 17 | 2016-02-04 21:21:05 | 147,356 | 2016-02-04 21:21:05 | https://stackoverflow.com/q/35211547 | https://stackoverflow.com/a/35211854 | <blockquote>
<p>How does git know which commit in particular to get? Where is this information stored? </p>
</blockquote>
<p>This information is stored as an object in the git filestore. For example, take the <a href="http://github.com/ansible/ansible/" rel="noreferrer">ansible</a> repository, which includes the fo... | <blockquote> <p>How does git know which commit in particular to get? Where is this information stored? </p> </blockquote> <p>This information is stored as an object in the git filestore. For example, take the <a href="http://github.com/ansible/ansible/" rel="noreferrer">ansible</a> repository, which includes the fo... | 119, 41612 | git, git-submodules | <h1>Where is a submodule commit number stored (and how do I change it)?</h1>
<p>In order to get a project with submodules, you run this command after cloning the project:</p>
<pre><code>git submodule init
</code></pre>
<p>This command reads <code>.gitmodules</code> and writes information about the module into the ind... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,282 | git | # Where is a submodule commit number stored (and how do I change it)?
In order to get a project with submodules, you run this command after cloning the project:
```
git submodule init
```
This command reads `.gitmodules` and writes information about the module into the index.
Then you run
```
git submodule update
... | > How does git know which commit in particular to get? Where is this information stored?
This information is stored as an object in the git filestore. For example, take the [ansible](http://github.com/ansible/ansible/) repository, which includes the following submodules:
```
$ git submodule
+ce6619bf5db87f94001625c9... |
33123802 | Merge after rebasing feature branch in git | 15 | 2015-10-14 11:13:02 | <p>I rebase my feature branch on origin/develop to be current on the current state of develop.</p>
<pre><code>git checkout feature-X
git rebase origin/develop
</code></pre>
<p>But when I do this I have to merge immediately after. This makes things messy.</p>
<p>I thought that the whole idea of rebasing was that you ... | 22,512 | 102,315 | 2015-10-14 12:39:28 | 33,125,444 | 17 | 2015-10-14 12:33:30 | 1,782,570 | 2015-10-14 12:39:28 | https://stackoverflow.com/q/33123802 | https://stackoverflow.com/a/33125444 | <p>Assuming <code>feature-X</code> has been branched off <code>develop</code>, a better way to do it would be to pull changes from remote onto your local <code>develop</code> branch and rebasing <code>feature-X</code> from the local branch. That will avoid the merge commit. You can merge feature-X later into your local... | <p>Assuming <code>feature-X</code> has been branched off <code>develop</code>, a better way to do it would be to pull changes from remote onto your local <code>develop</code> branch and rebasing <code>feature-X</code> from the local branch. That will avoid the merge commit. You can merge feature-X later into your local... | 119, 717, 8974 | git, merge, rebase | <h1>Merge after rebasing feature branch in git</h1>
<p>I rebase my feature branch on origin/develop to be current on the current state of develop.</p>
<pre><code>git checkout feature-X
git rebase origin/develop
</code></pre>
<p>But when I do this I have to merge immediately after. This makes things messy.</p>
<p>I t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,283 | git | # Merge after rebasing feature branch in git
I rebase my feature branch on origin/develop to be current on the current state of develop.
```
git checkout feature-X
git rebase origin/develop
```
But when I do this I have to merge immediately after. This makes things messy.
I thought that the whole idea of rebasing w... | Assuming `feature-X` has been branched off `develop`, a better way to do it would be to pull changes from remote onto your local `develop` branch and rebasing `feature-X` from the local branch. That will avoid the merge commit. You can merge feature-X later into your local `develop` and then push it.
If feature-X has ... |
22074247 | Git Hook under Windows | 15 | 2014-02-27 16:19:10 | <p>I have the following code to checkout in a working directory in the hook post-receive:</p>
<pre><code>#!/bin/sh
git --work-tree=d:/websites/__gitweb --git-dir=d:/_gitrepo.git/ checkout -f
</code></pre>
<p>Unfortunately it doesn't seem to work. However, the command does work when I enter just this in the windows co... | 39,825 | 3,359,563 | 2014-06-12 18:24:46 | 22,091,492 | 17 | 2014-02-28 09:45:18 | 3,359,563 | 2014-02-28 09:45:18 | https://stackoverflow.com/q/22074247 | https://stackoverflow.com/a/22091492 | <p>I finally got it working!
This is really weird. I had to type a <code>pwd</code> to see where actually is the batch being located and it showed the hook location on the server. However, in the next line I added a <code>hostname</code> and it showed me my local hostname.
Then I add the whole path just like: </p>
<pr... | <p>I finally got it working! This is really weird. I had to type a <code>pwd</code> to see where actually is the batch being located and it showed the hook location on the server. However, in the next line I added a <code>hostname</code> and it showed me my local hostname. Then I add the whole path just like: </p> <pr... | 64, 119, 853, 904 | git, hook, post, windows | <h1>Git Hook under Windows</h1>
<p>I have the following code to checkout in a working directory in the hook post-receive:</p>
<pre><code>#!/bin/sh
git --work-tree=d:/websites/__gitweb --git-dir=d:/_gitrepo.git/ checkout -f
</code></pre>
<p>Unfortunately it doesn't seem to work. However, the command does work when I e... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,284 | git | # Git Hook under Windows
I have the following code to checkout in a working directory in the hook post-receive:
```
#!/bin/sh
git --work-tree=d:/websites/__gitweb --git-dir=d:/_gitrepo.git/ checkout -f
```
Unfortunately it doesn't seem to work. However, the command does work when I enter just this in the windows com... | I finally got it working!
This is really weird. I had to type a `pwd` to see where actually is the batch being located and it showed the hook location on the server. However, in the next line I added a `hostname` and it showed me my local hostname.
Then I add the whole path just like:
```
#!/bin/sh
echo "Starting copy... |
16667169 | How to deactivate the Xcode git feature? (remove git integration) | 15 | 2013-05-21 09:57:23 | <p>My Xcode project is on git, but I don't like the XCode git integration and sometime, I have <a href="https://stackoverflow.com/questions/7388560/error-fatal-not-a-git-repository-or-any-of-the-parent-directories-git/14023458?noredirect=1#comment23887112_14023458">errors coming from Xcode</a></p>
<p>So I would like t... | 6,853 | 193,181 | 2024-09-17 01:43:38 | 16,667,259 | 17 | 2013-05-21 10:01:33 | 191,596 | 2013-05-21 10:18:07 | https://stackoverflow.com/q/16667169 | https://stackoverflow.com/a/16667259 | <p>It's unsupported, but it has appeared to work fine for me in the past:</p>
<ul>
<li>Quit Xcode</li>
<li>Remove this bundle from its folder: <code>Xcode.app/Contents/Plugins/IDEGit.ideplugin</code> or change the bundle's extension.</li>
<li>Restart Xcode</li>
</ul>
<p>This disables the extension which provides git ... | <p>It's unsupported, but it has appeared to work fine for me in the past:</p> <ul> <li>Quit Xcode</li> <li>Remove this bundle from its folder: <code>Xcode.app/Contents/Plugins/IDEGit.ideplugin</code> or change the bundle's extension.</li> <li>Restart Xcode</li> </ul> <p>This disables the extension which provides git ... | 119, 908 | git, xcode | <h1>How to deactivate the Xcode git feature? (remove git integration)</h1>
<p>My Xcode project is on git, but I don't like the XCode git integration and sometime, I have <a href="https://stackoverflow.com/questions/7388560/error-fatal-not-a-git-repository-or-any-of-the-parent-directories-git/14023458?noredirect=1#comme... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,285 | git | # How to deactivate the Xcode git feature? (remove git integration)
My Xcode project is on git, but I don't like the XCode git integration and sometime, I have [errors coming from Xcode](https://stackoverflow.com/questions/7388560/error-fatal-not-a-git-repository-or-any-of-the-parent-directories-git/14023458?noredirec... | It's unsupported, but it has appeared to work fine for me in the past:
- Quit Xcode
- Remove this bundle from its folder: `Xcode.app/Contents/Plugins/IDEGit.ideplugin` or change the bundle's extension.
- Restart Xcode
This disables the extension which provides git support in Xcode. You can still use Git for version c... |
9976705 | Hesitating between git and fossil | 15 | 2012-04-02 12:45:16 | <p>Newbie to Fossil (or any other version control system) here. Used a proprietary one earlier, but never set one up myself.</p>
<p>Currently, I am looking to set one up so that my friends and I can use it for a project.</p>
<p>I chose Fossil primarily because distributed seems to be the way to go, it seems lightweig... | 5,983 | 1,076,302 | 2012-07-11 11:04:20 | 9,981,980 | 17 | 2012-04-02 18:42:54 | 457,352 | 2012-07-11 11:04:20 | https://stackoverflow.com/q/9976705 | https://stackoverflow.com/a/9981980 | <p>Just some thoughts, not organized.</p>
<p>If your friends are already used to gitting, Git is a good and robust distributed SCM, with great hosting services available, like Github or Gitorious.</p>
<p>Though, Git concepts are not easy to comprehend. Fossil has similar concepts, but is probably easier to start with... | <p>Just some thoughts, not organized.</p> <p>If your friends are already used to gitting, Git is a good and robust distributed SCM, with great hosting services available, like Github or Gitorious.</p> <p>Though, Git concepts are not easy to comprehend. Fossil has similar concepts, but is probably easier to start with... | 119, 3531, 11746 | fossil, git, shared-hosting | <h1>Hesitating between git and fossil</h1>
<p>Newbie to Fossil (or any other version control system) here. Used a proprietary one earlier, but never set one up myself.</p>
<p>Currently, I am looking to set one up so that my friends and I can use it for a project.</p>
<p>I chose Fossil primarily because distributed se... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,286 | git | # Hesitating between git and fossil
Newbie to Fossil (or any other version control system) here. Used a proprietary one earlier, but never set one up myself.
Currently, I am looking to set one up so that my friends and I can use it for a project.
I chose Fossil primarily because distributed seems to be the way to go... | Just some thoughts, not organized.
If your friends are already used to gitting, Git is a good and robust distributed SCM, with great hosting services available, like Github or Gitorious.
Though, Git concepts are not easy to comprehend. Fossil has similar concepts, but is probably easier to start with (no staging area... |
39773912 | What's ignoring the gradle wrapper? | 14 | 2016-09-29 15:07:08 | <h1>The setup</h1>
<p>New intellij install, new sourcetree installation, new android project, <code>.gitignore</code> has been initialized as:</p>
<pre><code>*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
</code></pre>
<h1>The problem</h1>
<p>The files in the gradle... | 11,378 | 360,211 | 2018-05-09 20:15:16 | 50,261,337 | 17 | 2018-05-09 20:15:16 | 777,789 | 2018-05-09 20:15:16 | https://stackoverflow.com/q/39773912 | https://stackoverflow.com/a/50261337 | <p>It sounds like a global ignore file is what’s gumming up the works here. You can use <code>git check-ignore --verbose gradle/wrapper/gradle-wrapper.jar</code> to see exactly what pattern from which file is determining git’s ignore behavior. (<a href="https://git-scm.com/docs/git-check-ignore" rel="noreferrer">Docs o... | <p>It sounds like a global ignore file is what’s gumming up the works here. You can use <code>git check-ignore --verbose gradle/wrapper/gradle-wrapper.jar</code> to see exactly what pattern from which file is determining git’s ignore behavior. (<a href="https://git-scm.com/docs/git-check-ignore" rel="noreferrer">Docs o... | 119, 115976 | git, sourcetree | <h1>What's ignoring the gradle wrapper?</h1>
<h1>The setup</h1>
<p>New intellij install, new sourcetree installation, new android project, <code>.gitignore</code> has been initialized as:</p>
<pre><code>*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
</code></pre>
<h1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,290 | git | # What's ignoring the gradle wrapper?
# The setup
New intellij install, new sourcetree installation, new android project, `.gitignore` has been initialized as:
```
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
```
# The problem
The files in the gradle wrapper, tha... | It sounds like a global ignore file is what’s gumming up the works here. You can use `git check-ignore --verbose gradle/wrapper/gradle-wrapper.jar` to see exactly what pattern from which file is determining git’s ignore behavior. ([Docs on `git check-ignore`](https://git-scm.com/docs/git-check-ignore))
I think the bes... |
44989520 | Android Studio - CRLF vs LF for a Git-based multiplatform project | 14 | 2017-07-08 18:31:13 | <p>I'm working on an Android project involving multiple developers, some of which are on Windows, others Linux/MacOS. Since I'm on Windows, I've been instructed to configure Git as follows to avoid issues:</p>
<pre><code>autocrlf = true
safecrlf = true
</code></pre>
<p>This works mostly fine. Any .java/XML/etc files ... | 14,731 | 2,967,079 | 2023-08-17 17:51:45 | 44,993,831 | 17 | 2017-07-09 06:53:53 | 6,309 | 2023-08-17 17:51:45 | https://stackoverflow.com/q/44989520 | https://stackoverflow.com/a/44993831 | <p>I would <em>not</em> set <code>core.autocrlf</code> to <code>true</code> (I have advised <a href="https://stackoverflow.com/a/2354278/6309">against it since 2010</a>); leave it to false.</p>
<p>For any file you want to be managed in a <a href="https://git-scm.com/docs/gitattributes" rel="nofollow noreferrer"><code>.... | <p>I would <em>not</em> set <code>core.autocrlf</code> to <code>true</code> (I have advised <a href="https://stackoverflow.com/a/2354278/6309">against it since 2010</a>); leave it to false.</p> <p>For any file you want to be managed in a <a href="https://git-scm.com/docs/gitattributes" rel="nofollow noreferrer"><code>.... | 119, 1386, 59139, 91905 | android, android-studio, core.autocrlf, git | <h1>Android Studio - CRLF vs LF for a Git-based multiplatform project</h1>
<p>I'm working on an Android project involving multiple developers, some of which are on Windows, others Linux/MacOS. Since I'm on Windows, I've been instructed to configure Git as follows to avoid issues:</p>
<pre><code>autocrlf = true
safecrl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,291 | git | # Android Studio - CRLF vs LF for a Git-based multiplatform project
I'm working on an Android project involving multiple developers, some of which are on Windows, others Linux/MacOS. Since I'm on Windows, I've been instructed to configure Git as follows to avoid issues:
```
autocrlf = true
safecrlf = true
```
This w... | I would *not* set `core.autocrlf` to `true` (I have advised [against it since 2010](https://stackoverflow.com/a/2354278/6309)); leave it to false.
For any file you want to be managed in a [`.gitattributes` file](https://git-scm.com/docs/gitattributes), especially [since Git 2.10](https://stackoverflow.com/a/42135910/6... |
40784842 | git fetch branches with specified prefix | 14 | 2016-11-24 11:08:03 | <p>I have following branches in remote origin.</p>
<pre><code>ft_d_feature_abc
ft_d_feature_xyz
ft_d_feature_lam
ft_d_feature_ton
ft_m_feature_mak
ft_m_feature_echo
ft_m_feature_laa
ft_m_feature_pol
</code></pre>
<p>I want to fetch branches which are starting with <code>ft_d</code>. How can I achieve this with <code>... | 5,292 | 3,079,520 | 2016-11-24 16:56:27 | 40,787,680 | 17 | 2016-11-24 13:29:12 | 1,256,452 | 2016-11-24 13:29:12 | https://stackoverflow.com/q/40784842 | https://stackoverflow.com/a/40787680 | <p>Since Git version 2.6, you can specify partial substrings (with simple glob-style matching) in a fetch or push refspec. Hence:</p>
<pre><code>git fetch origin 'refs/heads/ft_d*:refs/remotes/origin/ft_d*'
</code></pre>
<p>would do what you are asking for. Generalized regular expressions are <em>not</em> available... | <p>Since Git version 2.6, you can specify partial substrings (with simple glob-style matching) in a fetch or push refspec. Hence:</p> <pre><code>git fetch origin 'refs/heads/ft_d*:refs/remotes/origin/ft_d*' </code></pre> <p>would do what you are asking for. Generalized regular expressions are <em>not</em> available... | 119, 33720, 76220 | git, git-branch, git-fetch | <h1>git fetch branches with specified prefix</h1>
<p>I have following branches in remote origin.</p>
<pre><code>ft_d_feature_abc
ft_d_feature_xyz
ft_d_feature_lam
ft_d_feature_ton
ft_m_feature_mak
ft_m_feature_echo
ft_m_feature_laa
ft_m_feature_pol
</code></pre>
<p>I want to fetch branches which are starting with <co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,293 | git | # git fetch branches with specified prefix
I have following branches in remote origin.
```
ft_d_feature_abc
ft_d_feature_xyz
ft_d_feature_lam
ft_d_feature_ton
ft_m_feature_mak
ft_m_feature_echo
ft_m_feature_laa
ft_m_feature_pol
```
I want to fetch branches which are starting with `ft_d`. How can I achieve this with ... | Since Git version 2.6, you can specify partial substrings (with simple glob-style matching) in a fetch or push refspec. Hence:
```
git fetch origin 'refs/heads/ft_d*:refs/remotes/origin/ft_d*'
```
would do what you are asking for. Generalized regular expressions are *not* available, nor generalized globs: only the on... |
40590039 | How to get the file list for a commit with JGit | 14 | 2016-11-14 13:36:38 | <p>I have been working on a Java based product for which the Git features are going to be integrated. Using one of the Git features, I have done adding 10+ files into the Git repository by staging followed by committing them in a single commit.</p>
<p>Is the reverse of the above process possible? I.e Finding the list ... | 13,048 | 4,898,613 | 2022-10-28 17:08:17 | 40,609,231 | 17 | 2016-11-15 11:54:26 | 2,986,905 | 2021-03-26 13:25:53 | https://stackoverflow.com/q/40590039 | https://stackoverflow.com/a/40609231 | <p>Each commit points to a <em>tree</em> that denotes all files that make up the commit.</p>
<p><strong>Note, that this not only includes the files that were added, modified, or removed with this particular commit but all files contained in this revision.</strong></p>
<p>If the commit is represented as a <code>RevCommi... | <p>Each commit points to a <em>tree</em> that denotes all files that make up the commit.</p> <p><strong>Note, that this not only includes the files that were added, modified, or removed with this particular commit but all files contained in this revision.</strong></p> <p>If the commit is represented as a <code>RevCommi... | 17, 61058 | java, jgit | <h1>How to get the file list for a commit with JGit</h1>
<p>I have been working on a Java based product for which the Git features are going to be integrated. Using one of the Git features, I have done adding 10+ files into the Git repository by staging followed by committing them in a single commit.</p>
<p>Is the rev... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,294 | git | # How to get the file list for a commit with JGit
I have been working on a Java based product for which the Git features are going to be integrated. Using one of the Git features, I have done adding 10+ files into the Git repository by staging followed by committing them in a single commit.
Is the reverse of the abov... | Each commit points to a *tree* that denotes all files that make up the commit.
**Note, that this not only includes the files that were added, modified, or removed with this particular commit but all files contained in this revision.**
If the commit is represented as a `RevCommit`, the ID of the tree can be obtained l... |
34852512 | Is it possible to mark a git commit as work-in-progress? | 14 | 2016-01-18 10:31:20 | <p>I'm aware that there are various opinions and philosophies about whether or not all commits on the master branch should leave the project in a valid, working state. I'm not asking for these opinions.</p>
<p>For the sake of argument, let's assume that somewhere in the <code>master</code> branch history I identified ... | 25,494 | 1,546,844 | 2022-03-30 20:33:41 | 34,852,712 | 17 | 2016-01-18 10:42:04 | 520,162 | 2016-01-18 10:42:04 | https://stackoverflow.com/q/34852512 | https://stackoverflow.com/a/34852712 | <p>Use <a href="http://git-scm.com/docs/git-notes" rel="noreferrer"><code>git notes</code></a> to add notes to certain commits without touching their commit hash.</p>
<p>If you want to annotate <code>HEAD~5</code> with a note, do</p>
<pre><code>git notes add HEAD~5 -m "better don't use this commit. It breaks the buil... | <p>Use <a href="http://git-scm.com/docs/git-notes" rel="noreferrer"><code>git notes</code></a> to add notes to certain commits without touching their commit hash.</p> <p>If you want to annotate <code>HEAD~5</code> with a note, do</p> <pre><code>git notes add HEAD~5 -m "better don't use this commit. It breaks the buil... | 119, 456, 47326, 60718 | git, git-bisect, git-tag, version-control | <h1>Is it possible to mark a git commit as work-in-progress?</h1>
<p>I'm aware that there are various opinions and philosophies about whether or not all commits on the master branch should leave the project in a valid, working state. I'm not asking for these opinions.</p>
<p>For the sake of argument, let's assume that... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,295 | git | # Is it possible to mark a git commit as work-in-progress?
I'm aware that there are various opinions and philosophies about whether or not all commits on the master branch should leave the project in a valid, working state. I'm not asking for these opinions.
For the sake of argument, let's assume that somewhere in th... | Use [`git notes`](http://git-scm.com/docs/git-notes) to add notes to certain commits without touching their commit hash.
If you want to annotate `HEAD~5` with a note, do
```
git notes add HEAD~5 -m "better don't use this commit. It breaks the build"
```
Publish your notes with
```
git push origin refs/notes/*
```
... |
30540608 | How to replay a commit onto a branch that already contains the commit? | 14 | 2015-05-29 23:36:05 | <p>Lets say our commit history looks like</p>
<pre>
1--2--3--4
^
HEAD
</pre>
<p>Where 4 is the most recent commit.</p>
<p>Is there a way to replay the changes from commit 2 (the differences between 2 and 1) onto commit 4?</p>
<p>You are probably wondering why anyone would want to do tha... | 12,324 | 3,470,632 | 2015-05-30 00:30:21 | 30,540,652 | 17 | 2015-05-29 23:41:09 | 631,619 | 2015-05-29 23:41:09 | https://stackoverflow.com/q/30540608 | https://stackoverflow.com/a/30540652 | <p><code>git cherry-pick A</code> can do that.</p>
<p>See <a href="http://git-scm.com/docs/git-cherry-pick" rel="noreferrer">http://git-scm.com/docs/git-cherry-pick</a><br>
<em>Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to ... | <p><code>git cherry-pick A</code> can do that.</p> <p>See <a href="http://git-scm.com/docs/git-cherry-pick" rel="noreferrer">http://git-scm.com/docs/git-cherry-pick</a><br> <em>Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to ... | 119, 53850, 76220 | git, git-branch, git-commit | <h1>How to replay a commit onto a branch that already contains the commit?</h1>
<p>Lets say our commit history looks like</p>
<pre>
1--2--3--4
^
HEAD
</pre>
<p>Where 4 is the most recent commit.</p>
<p>Is there a way to replay the changes from commit 2 (the differences between 2 and 1) o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,296 | git | # How to replay a commit onto a branch that already contains the commit?
Lets say our commit history looks like
```
1--2--3--4
^
HEAD
```
Where 4 is the most recent commit.
Is there a way to replay the changes from commit 2 (the differences between 2 and 1) onto commit 4?
You are proba... | `git cherry-pick A` can do that.
See <http://git-scm.com/docs/git-cherry-pick>
*Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modifications from the HEAD commit).*
For example `git cherry-pick master~4 maste... |
25090803 | Linux kernel : Kernel version string appended with either ''+" or "-dirty" | 14 | 2014-08-02 01:30:02 | <p>I am trying to install latest kernel from git of Linus Torvalds, i.e., version 3.16-rc7. I have created a new branch by following using following commands:
<code>git checkout -b v_3_16 v3.16-rc7</code>
Then I checkout on the branch v_3_16 and fire following commands
<code>make menuconfig</code> and check the option ... | 20,934 | 2,178,389 | 2017-06-27 15:31:55 | 25,091,076 | 17 | 2014-08-02 02:26:28 | 3,692,399 | 2014-08-02 04:00:42 | https://stackoverflow.com/q/25090803 | https://stackoverflow.com/a/25091076 | <p>If Linux kernel images are being built with "-dirty" on the end of the version string, this simply means that modifications in the source directory have not been committed. Use <code>git status</code> to check for uncommitted files. </p>
<p>When you see the dirty string, it appends the kernel version string with th... | <p>If Linux kernel images are being built with "-dirty" on the end of the version string, this simply means that modifications in the source directory have not been committed. Use <code>git status</code> to check for uncommitted files. </p> <p>When you see the dirty string, it appends the kernel version string with th... | 58, 119, 21990 | git, linux, linux-kernel | <h1>Linux kernel : Kernel version string appended with either ''+" or "-dirty"</h1>
<p>I am trying to install latest kernel from git of Linus Torvalds, i.e., version 3.16-rc7. I have created a new branch by following using following commands:
<code>git checkout -b v_3_16 v3.16-rc7</code>
Then I checkout on the branch v... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,297 | git | # Linux kernel : Kernel version string appended with either ''+" or "-dirty"
I am trying to install latest kernel from git of Linus Torvalds, i.e., version 3.16-rc7. I have created a new branch by following using following commands:
`git checkout -b v_3_16 v3.16-rc7`
Then I checkout on the branch v_3_16 and fire follo... | If Linux kernel images are being built with "-dirty" on the end of the version string, this simply means that modifications in the source directory have not been committed. Use `git status` to check for uncommitted files.
When you see the dirty string, it appends the kernel version string with the last `abbreviated co... |
20840866 | How can I untrack files in Git according to my .gitignore file? | 14 | 2013-12-30 13:49:44 | <p>I have tracked many many files early, but I don't want Git to track them any more from now on. </p>
<p>Can I untrack those files according to a <code>.gitignore</code> file?</p>
<p>There are too many files and they are separated in many different directories, so it is not practical to remove them one-by-one, inste... | 2,441 | 1,253,826 | 2019-12-02 19:48:15 | 20,841,198 | 17 | 2013-12-30 14:08:43 | 2,235,132 | 2013-12-30 14:08:43 | https://stackoverflow.com/q/20840866 | https://stackoverflow.com/a/20841198 | <p>You need to remove the files from the index.</p>
<pre><code>git rm -r --cached .
</code></pre>
<p>and then add</p>
<pre><code>git add .
</code></pre>
<p>Finally commit:</p>
<pre><code>git commit -a -m "Untrack ignored files!"
</code></pre>
| <p>You need to remove the files from the index.</p> <pre><code>git rm -r --cached . </code></pre> <p>and then add</p> <pre><code>git add . </code></pre> <p>Finally commit:</p> <pre><code>git commit -a -m "Untrack ignored files!" </code></pre> | 119, 25056 | git, gitignore | <h1>How can I untrack files in Git according to my .gitignore file?</h1>
<p>I have tracked many many files early, but I don't want Git to track them any more from now on. </p>
<p>Can I untrack those files according to a <code>.gitignore</code> file?</p>
<p>There are too many files and they are separated in many diffe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,299 | git | # How can I untrack files in Git according to my .gitignore file?
I have tracked many many files early, but I don't want Git to track them any more from now on.
Can I untrack those files according to a `.gitignore` file?
There are too many files and they are separated in many different directories, so it is not prac... | You need to remove the files from the index.
```
git rm -r --cached .
```
and then add
```
git add .
```
Finally commit:
```
git commit -a -m "Untrack ignored files!"
``` |
13203728 | Where does Git store remote tracking branches | 14 | 2012-11-02 22:12:19 | <p>I have two Git repositories <code>repo1</code> and <code>repo2</code>. There are three branches <code>master</code>, <code>alpha</code> and <code>beta</code> in <code>repo1</code>. <code>repo2</code> clones from <code>repo1</code>.</p>
<p>In <code>repo2</code>, I can see remote tracking branches with <code>git branc... | 3,123 | 418,966 | 2025-05-17 03:17:24 | 13,204,410 | 17 | 2012-11-02 23:27:02 | 19,563 | 2012-11-02 23:27:02 | https://stackoverflow.com/q/13203728 | https://stackoverflow.com/a/13204410 | <p>The refs are probably "packed" in <code>.git/packed-refs</code>.</p>
| <p>The refs are probably "packed" in <code>.git/packed-refs</code>.</p> | 119 | git | <h1>Where does Git store remote tracking branches</h1>
<p>I have two Git repositories <code>repo1</code> and <code>repo2</code>. There are three branches <code>master</code>, <code>alpha</code> and <code>beta</code> in <code>repo1</code>. <code>repo2</code> clones from <code>repo1</code>.</p>
<p>In <code>repo2</code>, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,301 | git | # Where does Git store remote tracking branches
I have two Git repositories `repo1` and `repo2`. There are three branches `master`, `alpha` and `beta` in `repo1`. `repo2` clones from `repo1`.
In `repo2`, I can see remote tracking branches with `git branch -a`:
```
remotes/origin/HEAD -> origin/master
remotes/origin/... | The refs are probably "packed" in `.git/packed-refs`. |
11099347 | git diff and git difftool do nothing and give no output | 14 | 2012-06-19 10:44:37 | <p>I am trying to get <code>git diff</code> to work on Windows 7 64 bit. When I run the following commands from a windows command prompt: </p>
<pre><code>C:\temp\mygrit>git diff
</code></pre>
<p>or </p>
<pre><code>C:\temp\mygrit>git difftool
</code></pre>
<p>I get no output and no external program launches. H... | 6,461 | 824,903 | 2018-07-04 13:48:33 | 11,099,597 | 17 | 2012-06-19 11:01:04 | 824,903 | 2018-07-04 13:48:33 | https://stackoverflow.com/q/11099347 | https://stackoverflow.com/a/11099597 | <p>OK, simple answer. The default behaviour for <code>git diff</code> is to show the all files which have been modified but not staged. If you have no modified files then there is no output. </p>
<p><code>git difftool</code> uses the output of <code>git diff</code> so if there's no output from the previous command <co... | <p>OK, simple answer. The default behaviour for <code>git diff</code> is to show the all files which have been modified but not staged. If you have no modified files then there is no output. </p> <p><code>git difftool</code> uses the output of <code>git diff</code> so if there's no output from the previous command <co... | 64, 119, 456 | git, version-control, windows | <h1>git diff and git difftool do nothing and give no output</h1>
<p>I am trying to get <code>git diff</code> to work on Windows 7 64 bit. When I run the following commands from a windows command prompt: </p>
<pre><code>C:\temp\mygrit>git diff
</code></pre>
<p>or </p>
<pre><code>C:\temp\mygrit>git difftool
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,302 | git | # git diff and git difftool do nothing and give no output
I am trying to get `git diff` to work on Windows 7 64 bit. When I run the following commands from a windows command prompt:
```
C:\temp\mygrit>git diff
```
or
```
C:\temp\mygrit>git difftool
```
I get no output and no external program launches. Here is my .... | OK, simple answer. The default behaviour for `git diff` is to show the all files which have been modified but not staged. If you have no modified files then there is no output.
`git difftool` uses the output of `git diff` so if there's no output from the previous command `git difftool` will do nothing as well.
**Solu... |
8901542 | How to delete a 'git commit' from LOG, like it had never existed | 14 | 2012-01-17 20:48:35 | <p>I have made a mistake in one of the commits. Now I want to completely delete this commit, so it looks like it has never existed. I don't want to see this in log.</p>
<p>I have tried all tips from <a href="https://stackoverflow.com/questions/1338728/how-to-delete-a-git-commit">this question ("<em>How to delete a... | 35,572 | 632,472 | 2023-10-19 02:36:44 | 8,901,583 | 17 | 2012-01-17 20:52:16 | 1,119,701 | 2012-01-17 21:35:01 | https://stackoverflow.com/q/8901542 | https://stackoverflow.com/a/8901583 | <p>If it is the last commit</p>
<pre><code>git reset --hard HEAD^
</code></pre>
<p>if it is not the last commit</p>
<pre><code>git rebase -i commit_hash^
</code></pre>
<p>an editor will open, delete the whole line with the commit, save and quit.</p>
<p>Note that rewriting history or rebasing if the branch has alre... | <p>If it is the last commit</p> <pre><code>git reset --hard HEAD^ </code></pre> <p>if it is not the last commit</p> <pre><code>git rebase -i commit_hash^ </code></pre> <p>an editor will open, delete the whole line with the commit, save and quit.</p> <p>Note that rewriting history or rebasing if the branch has alre... | 119 | git | <h1>How to delete a 'git commit' from LOG, like it had never existed</h1>
<p>I have made a mistake in one of the commits. Now I want to completely delete this commit, so it looks like it has never existed. I don't want to see this in log.</p>
<p>I have tried all tips from <a href="https://stackoverflow.com/questions/13... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,303 | git | # How to delete a 'git commit' from LOG, like it had never existed
I have made a mistake in one of the commits. Now I want to completely delete this commit, so it looks like it has never existed. I don't want to see this in log.
I have tried all tips from [this question ("*How to delete a 'git commit'*")](https://sta... | If it is the last commit
```
git reset --hard HEAD^
```
if it is not the last commit
```
git rebase -i commit_hash^
```
an editor will open, delete the whole line with the commit, save and quit.
Note that rewriting history or rebasing if the branch has already been pushed is usually a bad idea and you may prefer t... |
6366966 | Create git repository after project creation | 14 | 2011-06-16 04:03:33 | <p>I know there's an option to make a local repository for your project when you first create it, but is there an option create a repository after you've created your project?</p>
| 5,307 | 269,970 | 2015-08-02 00:46:53 | 6,367,115 | 17 | 2011-06-16 04:30:13 | 893 | 2011-06-16 04:30:13 | https://stackoverflow.com/q/6366966 | https://stackoverflow.com/a/6367115 | <p>Sure, just run the following command in your project directory:</p>
<pre><code>git init
</code></pre>
<p>This will create the <code>.git</code> directory containing an empty repository. Then, add and commit your files.</p>
| <p>Sure, just run the following command in your project directory:</p> <pre><code>git init </code></pre> <p>This will create the <code>.git</code> directory containing an empty repository. Then, add and commit your files.</p> | 119, 908, 7330, 59704 | git, repository, xcode, xcode4 | <h1>Create git repository after project creation</h1>
<p>I know there's an option to make a local repository for your project when you first create it, but is there an option create a repository after you've created your project?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,304 | git | # Create git repository after project creation
I know there's an option to make a local repository for your project when you first create it, but is there an option create a repository after you've created your project? | Sure, just run the following command in your project directory:
```
git init
```
This will create the `.git` directory containing an empty repository. Then, add and commit your files. |
6234666 | Android Repo init failed | 14 | 2011-06-04 04:21:57 | <p>I think i follow instruction from this site very carefully</p>
<p><a href="http://source.android.com/source/downloading.html" rel="nofollow noreferrer">http://source.android.com/source/downloading.html</a></p>
<p>but when i try this </p>
<pre><code>repo init -u https://android.googlesource.com/platform/manifest
<... | 26,342 | 366,489 | 2017-07-24 10:30:16 | 6,234,875 | 17 | 2011-06-04 05:16:13 | 88,442 | 2017-07-24 10:28:51 | https://stackoverflow.com/q/6234666 | https://stackoverflow.com/a/6234875 | <p>Check your <code>repo</code> file.</p>
<p>Sometimes the server would return a "server loading too high" page instead of giving you the <code>repo</code> script. In this case, you have to download your <code>repo</code> file again. </p>
<p>Alternativly, you can get the source of <code>repo</code> from git:</p>
<p... | <p>Check your <code>repo</code> file.</p> <p>Sometimes the server would return a "server loading too high" page instead of giving you the <code>repo</code> script. In this case, you have to download your <code>repo</code> file again. </p> <p>Alternativly, you can get the source of <code>repo</code> from git:</p> <p... | 119, 549, 1386, 7330, 47738 | android, android-source, git, repository, ubuntu | <h1>Android Repo init failed</h1>
<p>I think i follow instruction from this site very carefully</p>
<p><a href="http://source.android.com/source/downloading.html" rel="nofollow noreferrer">http://source.android.com/source/downloading.html</a></p>
<p>but when i try this </p>
<pre><code>repo init -u https://android.go... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,305 | git | # Android Repo init failed
I think i follow instruction from this site very carefully
<http://source.android.com/source/downloading.html>
but when i try this
```
repo init -u https://android.googlesource.com/platform/manifest
```
i got the following error.
```
repo init -u https://android.googlesource.com/platfo... | Check your `repo` file.
Sometimes the server would return a "server loading too high" page instead of giving you the `repo` script. In this case, you have to download your `repo` file again.
Alternativly, you can get the source of `repo` from git:
```
git clone https://android.googlesource.com/tools/repo
``` |
825478 | How to set Araxis as diff / merge tool for MSYS git? | 14 | 2009-05-05 15:37:37 | <p>I'm trying to use <a href="http://www.araxis.com/merge/" rel="noreferrer">Araxis Merge</a> as my diff / merge tool for MSYSGit.</p>
<p>I found a few resources on the net:</p>
<ul>
<li>On the <a href="http://www.araxis.com/merge/scm_integration.html#Git" rel="noreferrer">Araxis site</a>, they mention an "easy&qu... | 17,343 | 82,682 | 2014-09-03 21:42:28 | 1,429,891 | 17 | 2009-09-15 22:11:04 | 173,985 | 2009-09-15 22:27:07 | https://stackoverflow.com/q/825478 | https://stackoverflow.com/a/1429891 | <p>If you want to have 'git diff' always use araxis you can use the instructions in the help file, but if you want to have control to use 'git diff' as you normally would from the command line and 'git difftool' to engage the Araxis GUI.</p>
<p>Try adding the following to your git config::</p>
<pre><code>[difftool "a... | <p>If you want to have 'git diff' always use araxis you can use the instructions in the help file, but if you want to have control to use 'git diff' as you normally would from the command line and 'git difftool' to engage the Araxis GUI.</p> <p>Try adding the following to your git config::</p> <pre><code>[difftool "a... | 64, 119, 606, 21628, 29560 | araxis, diff, git, msysgit, windows | <h1>How to set Araxis as diff / merge tool for MSYS git?</h1>
<p>I'm trying to use <a href="http://www.araxis.com/merge/" rel="noreferrer">Araxis Merge</a> as my diff / merge tool for MSYSGit.</p>
<p>I found a few resources on the net:</p>
<ul>
<li>On the <a href="http://www.araxis.com/merge/scm_integration.html#Git" r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,306 | git | # How to set Araxis as diff / merge tool for MSYS git?
I'm trying to use [Araxis Merge](http://www.araxis.com/merge/) as my diff / merge tool for MSYSGit.
I found a few resources on the net:
- On the [Araxis site](http://www.araxis.com/merge/scm_integration.html#Git), they mention an "easy" way, but it implies a exe... | If you want to have 'git diff' always use araxis you can use the instructions in the help file, but if you want to have control to use 'git diff' as you normally would from the command line and 'git difftool' to engage the Araxis GUI.
Try adding the following to your git config::
```
[difftool "araxis"]
path = "/... |
44777043 | Git: Copy history of file from one repository to another | 13 | 2017-06-27 09:42:03 | <p>I've two git repositories say A and B, both contains a file named file1.cc.
Is it possible to merge/copy the history of file1.cc in repo A to file1.cc in repo B?</p>
<p>The problem is we've already moved the files from repo A to repo B and the history of all the files are lost. but now some of the developers alread... | 20,023 | 938,394 | 2018-04-20 08:41:58 | 44,782,681 | 17 | 2017-06-27 14:18:28 | 7,050,130 | 2018-04-20 08:41:58 | https://stackoverflow.com/q/44777043 | https://stackoverflow.com/a/44782681 | <p>It can be done, but it may not be easy. But first things first: there is no "moving the history of a file". There is only moving commits, so if you want commits that represent the history of a subset of files, then creating those commits is the first challenge.</p>
<p>The simplest thing would be to transfer <em>a... | <p>It can be done, but it may not be easy. But first things first: there is no "moving the history of a file". There is only moving commits, so if you want commits that represent the history of a subset of files, then creating those commits is the first challenge.</p> <p>The simplest thing would be to transfer <em>a... | 119 | git | <h1>Git: Copy history of file from one repository to another</h1>
<p>I've two git repositories say A and B, both contains a file named file1.cc.
Is it possible to merge/copy the history of file1.cc in repo A to file1.cc in repo B?</p>
<p>The problem is we've already moved the files from repo A to repo B and the histor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,307 | git | # Git: Copy history of file from one repository to another
I've two git repositories say A and B, both contains a file named file1.cc.
Is it possible to merge/copy the history of file1.cc in repo A to file1.cc in repo B?
The problem is we've already moved the files from repo A to repo B and the history of all the fil... | It can be done, but it may not be easy. But first things first: there is no "moving the history of a file". There is only moving commits, so if you want commits that represent the history of a subset of files, then creating those commits is the first challenge.
The simplest thing would be to transfer *all* history. (I... |
23263781 | GIT stashed date | 13 | 2014-04-24 08:32:44 | <p>Given the following stash content:</p>
<pre><code>$ git stash list
stash@{0}: On fixes: animations-fixes
stash@{1}: WIP on master: 62aecaa Merge pull request #10 from SOURCE/branch-name
</code></pre>
<p>is there any way to have the same list, but including the date on which the stash was created?</p>
| 1,343 | 304,174 | 2019-12-05 12:13:31 | 23,264,031 | 17 | 2014-04-24 08:45:30 | 43,681 | 2014-04-24 08:45:30 | https://stackoverflow.com/q/23263781 | https://stackoverflow.com/a/23264031 | <p>A stash entry is just a regular git commit internally. So you can read its date ("commit date" or "author date") to know when it was created.</p>
<p>As mentioned in the manpage of <code>git stash</code>, you can use the formatting options for <code>git log</code> when invoking <code>git stash list</code>. So to get... | <p>A stash entry is just a regular git commit internally. So you can read its date ("commit date" or "author date") to know when it was created.</p> <p>As mentioned in the manpage of <code>git stash</code>, you can use the formatting options for <code>git log</code> when invoking <code>git stash list</code>. So to get... | 119 | git | <h1>GIT stashed date</h1>
<p>Given the following stash content:</p>
<pre><code>$ git stash list
stash@{0}: On fixes: animations-fixes
stash@{1}: WIP on master: 62aecaa Merge pull request #10 from SOURCE/branch-name
</code></pre>
<p>is there any way to have the same list, but including the date on which the stash was ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,311 | git | # GIT stashed date
Given the following stash content:
```
$ git stash list
stash@{0}: On fixes: animations-fixes
stash@{1}: WIP on master: 62aecaa Merge pull request #10 from SOURCE/branch-name
```
is there any way to have the same list, but including the date on which the stash was created? | A stash entry is just a regular git commit internally. So you can read its date ("commit date" or "author date") to know when it was created.
As mentioned in the manpage of `git stash`, you can use the formatting options for `git log` when invoking `git stash list`. So to get the date, you could use `git log`'s option... |
18878489 | Retrieving orphaned commit object after push --force | 13 | 2013-09-18 17:20:33 | <p>Doing <code>push --force</code> is always kinda risky and here is an example of how it could produce some problems like loosing revisions remotely.</p>
<p>Suppose, there is some person <strong>Bob</strong> that has updated remote <code>master</code> branch from <code>B</code> to <code>C</code>. And there is another... | 6,686 | 570,689 | 2021-05-21 19:26:09 | 18,910,545 | 17 | 2013-09-20 06:50:17 | 570,689 | 2013-09-20 06:50:17 | https://stackoverflow.com/q/18878489 | https://stackoverflow.com/a/18910545 | <p>Anyone who has commit <code>C</code> locally can use <code>git branch some-name C</code> to give <code>C</code> a name, then <code>git push origin some-name:master</code> to (try to) append <code>C</code> back to master on origin.</p>
<p>Anyone who doesn't have <code>C</code> can't recover <code>C</code> at all (ev... | <p>Anyone who has commit <code>C</code> locally can use <code>git branch some-name C</code> to give <code>C</code> a name, then <code>git push origin some-name:master</code> to (try to) append <code>C</code> back to master on origin.</p> <p>Anyone who doesn't have <code>C</code> can't recover <code>C</code> at all (ev... | 119 | git | <h1>Retrieving orphaned commit object after push --force</h1>
<p>Doing <code>push --force</code> is always kinda risky and here is an example of how it could produce some problems like loosing revisions remotely.</p>
<p>Suppose, there is some person <strong>Bob</strong> that has updated remote <code>master</code> bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,313 | git | # Retrieving orphaned commit object after push --force
Doing `push --force` is always kinda risky and here is an example of how it could produce some problems like loosing revisions remotely.
Suppose, there is some person **Bob** that has updated remote `master` branch from `B` to `C`. And there is another person **M... | Anyone who has commit `C` locally can use `git branch some-name C` to give `C` a name, then `git push origin some-name:master` to (try to) append `C` back to master on origin.
Anyone who doesn't have `C` can't recover `C` at all (even if it's in origin's object store).
**Mike** *cannot* fix the problem except using a... |
12632666 | Git: currently in merge/conflict with private remote repo. How to tell Git to just use my local files? | 13 | 2012-09-28 02:08:54 | <p>Trying to use/learn git with a personal project. There's only me and a remote git repo, a few commits, and I'm stuck in a failed merge. A lot of my files have Git merge conflict markup now too.</p>
<p>How do I tell git to just throw everything out, just use mine?</p>
<p>A specific example of how I got into the sta... | 12,423 | 234,593 | 2013-03-20 23:41:07 | 12,957,129 | 17 | 2012-10-18 14:35:30 | 234,593 | 2013-03-20 23:41:07 | https://stackoverflow.com/q/12632666 | https://stackoverflow.com/a/12957129 | <pre><code>git checkout --ours . # checkout our local version of all files
git add -u # mark all conflicted files as merged/resolved
git commit # commit the merge
</code></pre>
<p>There is a messy alternative that can break the repo for everyone else using the same remote origin. Only consider it... | <pre><code>git checkout --ours . # checkout our local version of all files git add -u # mark all conflicted files as merged/resolved git commit # commit the merge </code></pre> <p>There is a messy alternative that can break the repo for everyone else using the same remote origin. Only consider it... | 119, 717, 3146, 62599 | conflict, git, merge, merge-conflict-resolution | <h1>Git: currently in merge/conflict with private remote repo. How to tell Git to just use my local files?</h1>
<p>Trying to use/learn git with a personal project. There's only me and a remote git repo, a few commits, and I'm stuck in a failed merge. A lot of my files have Git merge conflict markup now too.</p>
<p>How... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,315 | git | # Git: currently in merge/conflict with private remote repo. How to tell Git to just use my local files?
Trying to use/learn git with a personal project. There's only me and a remote git repo, a few commits, and I'm stuck in a failed merge. A lot of my files have Git merge conflict markup now too.
How do I tell git t... | ```
git checkout --ours . # checkout our local version of all files
git add -u # mark all conflicted files as merged/resolved
git commit # commit the merge
```
There is a messy alternative that can break the repo for everyone else using the same remote origin. Only consider it if you're the only ... |
10971221 | What's the difference between git add * and git add ., if any? | 13 | 2012-06-10 18:26:03 | <p><a href="http://git-animals.tumblr.com/post/24638261758/git-init-git-add-git-commit-a-m-initial" rel="noreferrer">git animals</a> had this series of commands:</p>
<pre><code>git init
git add *
git commit -a -m ‘initial commit and release!’
</code></pre>
<p>What does <code>git add *</code> do compared to <code>git ... | 3,479 | 29,347 | 2022-08-04 07:06:44 | 10,971,285 | 17 | 2012-06-10 18:33:26 | 19,563 | 2012-06-10 18:33:26 | https://stackoverflow.com/q/10971221 | https://stackoverflow.com/a/10971285 | <p><code>git add *</code> will add all the paths that are the result of the <em>shell</em> expansion of <code>*</code> whereas <code>git add .</code> will tell git to add the current directory.</p>
<p><code>git add *</code> won't add paths that begin with a <code>.</code> as the shell expansion of <code>*</code> consi... | <p><code>git add *</code> will add all the paths that are the result of the <em>shell</em> expansion of <code>*</code> whereas <code>git add .</code> will tell git to add the current directory.</p> <p><code>git add *</code> won't add paths that begin with a <code>.</code> as the shell expansion of <code>*</code> consi... | 119, 34792 | git, git-add | <h1>What's the difference between git add * and git add ., if any?</h1>
<p><a href="http://git-animals.tumblr.com/post/24638261758/git-init-git-add-git-commit-a-m-initial" rel="noreferrer">git animals</a> had this series of commands:</p>
<pre><code>git init
git add *
git commit -a -m ‘initial commit and release!’
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,316 | git | # What's the difference between git add * and git add ., if any?
[git animals](http://git-animals.tumblr.com/post/24638261758/git-init-git-add-git-commit-a-m-initial) had this series of commands:
```
git init
git add *
git commit -a -m ‘initial commit and release!’
```
What does `git add *` do compared to `git add .... | `git add *` will add all the paths that are the result of the *shell* expansion of `*` whereas `git add .` will tell git to add the current directory.
`git add *` won't add paths that begin with a `.` as the shell expansion of `*` considers these to be "hidden" paths.
`git add *` will also fail if any expanded path i... |
9440706 | Accidentally created branch with name origin/master | 13 | 2012-02-25 02:40:23 | <p>In a fit of unbelievable stupidity I accidentally ran</p>
<p>git checkout -b origin/master</p>
<p>And now have a branch named origin/master which ruins everything. Is it safe to just run</p>
<p>git -D origin/master?</p>
<p>I tried looking in the config for the branch but its not defined there. Yet when I run g... | 2,710 | 830,610 | 2012-02-25 02:45:39 | 9,440,733 | 17 | 2012-02-25 02:45:39 | 602,094 | 2012-02-25 02:45:39 | https://stackoverflow.com/q/9440706 | https://stackoverflow.com/a/9440733 | <p><code>git branch -D origin/master</code> will delete your local <code>origin/master</code> branch. </p>
<p>This will not delete your <code>origin</code>'s (remote) <code>master</code> branch. Deleting your remote branches would be either:</p>
<p>(git 1.7.0)</p>
<p><code>git push origin --delete branch</code></p... | <p><code>git branch -D origin/master</code> will delete your local <code>origin/master</code> branch. </p> <p>This will not delete your <code>origin</code>'s (remote) <code>master</code> branch. Deleting your remote branches would be either:</p> <p>(git 1.7.0)</p> <p><code>git push origin --delete branch</code></p... | 119 | git | <h1>Accidentally created branch with name origin/master</h1>
<p>In a fit of unbelievable stupidity I accidentally ran</p>
<p>git checkout -b origin/master</p>
<p>And now have a branch named origin/master which ruins everything. Is it safe to just run</p>
<p>git -D origin/master?</p>
<p>I tried looking in the confi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,317 | git | # Accidentally created branch with name origin/master
In a fit of unbelievable stupidity I accidentally ran
git checkout -b origin/master
And now have a branch named origin/master which ruins everything. Is it safe to just run
git -D origin/master?
I tried looking in the config for the branch but its not defined t... | `git branch -D origin/master` will delete your local `origin/master` branch.
This will not delete your `origin`'s (remote) `master` branch. Deleting your remote branches would be either:
(git 1.7.0)
`git push origin --delete branch`
or
`git push origin :branch` |
6528936 | switching a subdirectory managed by git to a submodule | 13 | 2011-06-30 00:56:57 | <p>We used to have a local hack of delayed_job in a Rails app, in vendor/plugins/delayed_job. It was installed as a one-time event and checked into git in the main app repo.</p>
<p>Now we decided to fork delayed_job on github and replace the subdirectory by a git submodule, as described e.g. here:</p>
<p><a href="ht... | 3,703 | 95,078 | 2015-02-18 01:44:01 | 6,529,536 | 17 | 2011-06-30 02:57:00 | 193,688 | 2011-06-30 02:57:00 | https://stackoverflow.com/q/6528936 | https://stackoverflow.com/a/6529536 | <p>Assuming that you do not care about the current contents of <code>vendor/plugins/delayed_job</code> in your working tree (i.e. the content that will be checked out as a submodule is already a suitable replacement for the content in your working tree), the normal procedure for converting a directory into a submodule ... | <p>Assuming that you do not care about the current contents of <code>vendor/plugins/delayed_job</code> in your working tree (i.e. the content that will be checked out as a submodule is already a suitable replacement for the content in your working tree), the normal procedure for converting a directory into a submodule ... | 119, 35799, 41612 | git, git-submodules, ruby-on-rails-plugins | <h1>switching a subdirectory managed by git to a submodule</h1>
<p>We used to have a local hack of delayed_job in a Rails app, in vendor/plugins/delayed_job. It was installed as a one-time event and checked into git in the main app repo.</p>
<p>Now we decided to fork delayed_job on github and replace the subdirectory... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,318 | git | # switching a subdirectory managed by git to a submodule
We used to have a local hack of delayed_job in a Rails app, in vendor/plugins/delayed_job. It was installed as a one-time event and checked into git in the main app repo.
Now we decided to fork delayed_job on github and replace the subdirectory by a git submodu... | Assuming that you do not care about the current contents of `vendor/plugins/delayed_job` in your working tree (i.e. the content that will be checked out as a submodule is already a suitable replacement for the content in your working tree), the normal procedure for converting a directory into a submodule looks like thi... |
5088143 | What happens behind the scenes when I do a repo sync? | 13 | 2011-02-23 07:36:52 | <p>What happens behind the scenes when I do a <code>repo sync</code> in my Android repository?</p>
<p>Is it equivalent to <code>repo forall -c "git pull"</code> or maybe git fetch? Or does it do something more complex?</p>
<p>Thanks</p>
| 10,996 | 81,398 | 2016-07-26 11:29:34 | 5,088,759 | 17 | 2011-02-23 08:55:45 | 223,092 | 2016-07-26 11:29:34 | https://stackoverflow.com/q/5088143 | https://stackoverflow.com/a/5088759 | <p>There's a description on <a href="https://source.android.com/source/using-repo.html#sync" rel="noreferrer">this page</a> of what <code>repo sync</code> does. In the usual case it will be more like <code>git pull --rebase</code> than <code>git pull</code>. To quote what that page says:</p>
<blockquote>
<h3>How R... | <p>There's a description on <a href="https://source.android.com/source/using-repo.html#sync" rel="noreferrer">this page</a> of what <code>repo sync</code> does. In the usual case it will be more like <code>git pull --rebase</code> than <code>git pull</code>. To quote what that page says:</p> <blockquote> <h3>How R... | 119, 1386, 7330 | android, git, repository | <h1>What happens behind the scenes when I do a repo sync?</h1>
<p>What happens behind the scenes when I do a <code>repo sync</code> in my Android repository?</p>
<p>Is it equivalent to <code>repo forall -c "git pull"</code> or maybe git fetch? Or does it do something more complex?</p>
<p>Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,319 | git | # What happens behind the scenes when I do a repo sync?
What happens behind the scenes when I do a `repo sync` in my Android repository?
Is it equivalent to `repo forall -c "git pull"` or maybe git fetch? Or does it do something more complex?
Thanks | There's a description on [this page](https://source.android.com/source/using-repo.html#sync) of what `repo sync` does. In the usual case it will be more like `git pull --rebase` than `git pull`. To quote what that page says:
> ### How Repo synchronization works
>
> When you run repo sync, this is what happens:
>
> 1. ... |
4601430 | git create local branch for a forked upstream tag | 13 | 2011-01-05 06:33:41 | <p>I've been trying to find a way to create a local branch that starts from a tag on an upstream repo I've forked and haven't found anything that helps.</p>
<p>I have the upstream master on a master branch locally but I'm not sure what I need to do to branch the upstream tag.</p>
<p>I've tried:</p>
<pre><code>git br... | 12,528 | 563,551 | 2020-10-02 05:56:18 | 4,601,643 | 17 | 2011-01-05 07:12:29 | 6,309 | 2020-10-02 05:56:18 | https://stackoverflow.com/q/4601430 | https://stackoverflow.com/a/4601643 | <p>If the tag is fetched (your <code>master</code> reflects <code>upstream/master</code>)</p>
<pre><code>git checkout -b aNewBranch aTagName
</code></pre>
<p>You need to make sure you <a href="https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch">have fetched the tags first</a>.<br />
That ... | <p>If the tag is fetched (your <code>master</code> reflects <code>upstream/master</code>)</p> <pre><code>git checkout -b aNewBranch aTagName </code></pre> <p>You need to make sure you <a href="https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch">have fetched the tags first</a>.<br /> That ... | 119, 1879, 2347 | branch, fork, git | <h1>git create local branch for a forked upstream tag</h1>
<p>I've been trying to find a way to create a local branch that starts from a tag on an upstream repo I've forked and haven't found anything that helps.</p>
<p>I have the upstream master on a master branch locally but I'm not sure what I need to do to branch t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,320 | git | # git create local branch for a forked upstream tag
I've been trying to find a way to create a local branch that starts from a tag on an upstream repo I've forked and haven't found anything that helps.
I have the upstream master on a master branch locally but I'm not sure what I need to do to branch the upstream tag.... | If the tag is fetched (your `master` reflects `upstream/master`)
```
git checkout -b aNewBranch aTagName
```
You need to make sure you [have fetched the tags first](https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch).
That means `git fetch upstream` *and then* `git fetch upstream --ta... |
3864934 | How do I re-integrate a svn and git repository without a common history? | 13 | 2010-10-05 15:02:15 | <p>I have a github-based git repository that represents development up to a certain point, and then a svn repository, not initialized with git svn, that has further development. I want to bring the svn changes into the git repository, start using the git repo for development, and push changes using git svn dcommit. I... | 3,520 | 10,612 | 2010-10-13 14:19:32 | 3,924,664 | 17 | 2010-10-13 14:19:32 | 10,612 | 2010-10-13 14:19:32 | https://stackoverflow.com/q/3864934 | https://stackoverflow.com/a/3924664 | <p>Here's what worked for me:</p>
<ol>
<li>Import the git and svn histories into one repository,</li>
<li>Use grafts and filter-branch to attach the svn tree to the git head, and</li>
<li>Reset the git-svn metadata to use the new history.</li>
</ol>
<h2>Import Histories</h2>
<p>This part was already described in the... | <p>Here's what worked for me:</p> <ol> <li>Import the git and svn histories into one repository,</li> <li>Use grafts and filter-branch to attach the svn tree to the git head, and</li> <li>Reset the git-svn metadata to use the new history.</li> </ol> <h2>Import Histories</h2> <p>This part was already described in the... | 119, 6452 | git, git-svn | <h1>How do I re-integrate a svn and git repository without a common history?</h1>
<p>I have a github-based git repository that represents development up to a certain point, and then a svn repository, not initialized with git svn, that has further development. I want to bring the svn changes into the git repository, st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,321 | git | # How do I re-integrate a svn and git repository without a common history?
I have a github-based git repository that represents development up to a certain point, and then a svn repository, not initialized with git svn, that has further development. I want to bring the svn changes into the git repository, start using ... | Here's what worked for me:
1. Import the git and svn histories into one repository,
2. Use grafts and filter-branch to attach the svn tree to the git head, and
3. Reset the git-svn metadata to use the new history.
## Import Histories
This part was already described in the question:
```
$ git clone git://github.com/... |
1501853 | JIRA code validation commit hook for 'git' | 13 | 2009-10-01 04:10:27 | <p>Does anyone have a git commit hook I can use that will ensure a JIRA issue number appears in the checkin message? I've got no experience driving JIRA from a git commit hook so any help would be appreciated -- working source even more so!</p>
| 11,707 | 826 | 2015-10-02 21:46:44 | 1,885,202 | 17 | 2009-12-11 01:06:20 | 9,843 | 2009-12-11 01:06:20 | https://stackoverflow.com/q/1501853 | https://stackoverflow.com/a/1885202 | <p>First, make the hook executable:</p>
<pre><code>chmod a+x .git/hooks/commit-msg
</code></pre>
<p>Append the following lines, substituting PROJECT with your project's code.</p>
<pre><code>test "" != "$(grep 'PROJECT-' "$1")" || {
echo >&2 "ERROR: Commit message is missing Jira issue number."
... | <p>First, make the hook executable:</p> <pre><code>chmod a+x .git/hooks/commit-msg </code></pre> <p>Append the following lines, substituting PROJECT with your project's code.</p> <pre><code>test "" != "$(grep 'PROJECT-' "$1")" || { echo >&2 "ERROR: Commit message is missing Jira issue number." ... | 119, 3809, 6004 | commit-message, git, jira | <h1>JIRA code validation commit hook for 'git'</h1>
<p>Does anyone have a git commit hook I can use that will ensure a JIRA issue number appears in the checkin message? I've got no experience driving JIRA from a git commit hook so any help would be appreciated -- working source even more so!</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,322 | git | # JIRA code validation commit hook for 'git'
Does anyone have a git commit hook I can use that will ensure a JIRA issue number appears in the checkin message? I've got no experience driving JIRA from a git commit hook so any help would be appreciated -- working source even more so! | First, make the hook executable:
```
chmod a+x .git/hooks/commit-msg
```
Append the following lines, substituting PROJECT with your project's code.
```
test "" != "$(grep 'PROJECT-' "$1")" || {
echo >&2 "ERROR: Commit message is missing Jira issue number."
exit 1
}
``` |
1824264 | What is a trivial merge in git? | 13 | 2009-12-01 06:00:54 | <p>Sometimes when I do a pull instead of a rebase after a simple one file change commit I see the following in the master log:</p>
<blockquote>
<p>Trivial merge</p>
</blockquote>
<p>But there's no diff of what changed? What's the point of this log message? Did anything change I don't know of? It scares me.</p>
| 4,988 | 66,475 | 2012-09-05 15:14:13 | 1,824,297 | 17 | 2009-12-01 06:08:23 | 19,563 | 2009-12-01 06:08:23 | https://stackoverflow.com/q/1824264 | https://stackoverflow.com/a/1824297 | <p><code>git</code> doesn't insert this message into the log at any point. I'm going to take a wild guess and assume that you've seen this message in gitweb.</p>
<p>gitweb prints this message if there is no output from a combined diff. This happens when the only differences were all in chunks were only one side of the... | <p><code>git</code> doesn't insert this message into the log at any point. I'm going to take a wild guess and assume that you've seen this message in gitweb.</p> <p>gitweb prints this message if there is no output from a combined diff. This happens when the only differences were all in chunks were only one side of the... | 119, 717, 28897 | git, git-merge, merge | <h1>What is a trivial merge in git?</h1>
<p>Sometimes when I do a pull instead of a rebase after a simple one file change commit I see the following in the master log:</p>
<blockquote>
<p>Trivial merge</p>
</blockquote>
<p>But there's no diff of what changed? What's the point of this log message? Did anything chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,323 | git | # What is a trivial merge in git?
Sometimes when I do a pull instead of a rebase after a simple one file change commit I see the following in the master log:
> Trivial merge
But there's no diff of what changed? What's the point of this log message? Did anything change I don't know of? It scares me. | `git` doesn't insert this message into the log at any point. I'm going to take a wild guess and assume that you've seen this message in gitweb.
gitweb prints this message if there is no output from a combined diff. This happens when the only differences were all in chunks were only one side of the merge changed, and t... |
66663679 | How to reference packages from repository in Flutter? | 12 | 2021-03-16 21:30:28 | <p>I'm trying to modify an existing package on pub.dev. I need to update one of the dependencies in the package. I've seen how to do this from <a href="https://medium.com/flutter-community/how-to-modify-an-existing-pub-package-to-use-in-your-flutter-project-4e909452ee66" rel="noreferrer">here</a></p>
<pre><code>depende... | 6,349 | 2,387,962 | 2021-03-17 11:29:08 | 66,664,042 | 17 | 2021-03-16 22:03:16 | 6,919,963 | 2021-03-16 22:51:07 | https://stackoverflow.com/q/66663679 | https://stackoverflow.com/a/66664042 | <p>That's because that's a repo with multiple packages. You need to reference the path and branch directly, just like so, for example for the <code>master</code> branch:</p>
<pre><code>graphql_flutter:
git:
url: https://github.com/zino-app/graphql-flutter.git
ref: master
path: packages/graphql_flu... | <p>That's because that's a repo with multiple packages. You need to reference the path and branch directly, just like so, for example for the <code>master</code> branch:</p> <pre><code>graphql_flutter: git: url: https://github.com/zino-app/graphql-flutter.git ref: master path: packages/graphql_flu... | 119, 13613, 115695, 150034 | flutter, git, package, pubspec | <h1>How to reference packages from repository in Flutter?</h1>
<p>I'm trying to modify an existing package on pub.dev. I need to update one of the dependencies in the package. I've seen how to do this from <a href="https://medium.com/flutter-community/how-to-modify-an-existing-pub-package-to-use-in-your-flutter-project... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,325 | git | # How to reference packages from repository in Flutter?
I'm trying to modify an existing package on pub.dev. I need to update one of the dependencies in the package. I've seen how to do this from [here](https://medium.com/flutter-community/how-to-modify-an-existing-pub-package-to-use-in-your-flutter-project-4e909452ee... | That's because that's a repo with multiple packages. You need to reference the path and branch directly, just like so, for example for the `master` branch:
```
graphql_flutter:
git:
url: https://github.com/zino-app/graphql-flutter.git
ref: master
path: packages/graphql_flutter
```
If you want bo... |
59160266 | Git and Permissions | 12 | 2019-12-03 15:22:11 | <p>So it seems this is a common problem and there are plenty of ad hoc solutions, but I'd like to understand why git is built this way in general.</p>
<p>Problem: I clone a repository where files have a certain permission, and immediately git status shows that a ton of my files have "changed", due to the permissions b... | 9,541 | 6,539,586 | 2019-12-03 18:15:50 | 59,163,100 | 17 | 2019-12-03 18:15:50 | 1,256,452 | 2019-12-03 18:15:50 | https://stackoverflow.com/q/59160266 | https://stackoverflow.com/a/59163100 | <p>Git only keeps one permission bit for files. For the most part, Git only <em>stores</em> files—it doesn't store directories (or folders if you prefer that term), it just creates them on demand instead. While Git does store symbolic links, symbolic links don't have associated permissions—at least not in Git (and us... | <p>Git only keeps one permission bit for files. For the most part, Git only <em>stores</em> files—it doesn't store directories (or folders if you prefer that term), it just creates them on demand instead. While Git does store symbolic links, symbolic links don't have associated permissions—at least not in Git (and us... | 119, 2120 | file-permissions, git | <h1>Git and Permissions</h1>
<p>So it seems this is a common problem and there are plenty of ad hoc solutions, but I'd like to understand why git is built this way in general.</p>
<p>Problem: I clone a repository where files have a certain permission, and immediately git status shows that a ton of my files have "chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,327 | git | # Git and Permissions
So it seems this is a common problem and there are plenty of ad hoc solutions, but I'd like to understand why git is built this way in general.
Problem: I clone a repository where files have a certain permission, and immediately git status shows that a ton of my files have "changed", due to the ... | Git only keeps one permission bit for files. For the most part, Git only *stores* files—it doesn't store directories (or folders if you prefer that term), it just creates them on demand instead. While Git does store symbolic links, symbolic links don't have associated permissions—at least not in Git (and usually not in... |
47424343 | Error message "Someone has already registered this as a deploy key" on BitBucket | 12 | 2017-11-21 23:19:29 | <p>I'm trying to clone a git repo on my bitbucket account, but am getting this error message when trying to do the clone this repo. to a new PC I've set up:</p>
<p>Cloning into 'xxxxx'...
repository access denied. deployment key is not associated with the requested repository.
fatal: Could not read from remote reposit... | 8,449 | 411,180 | 2022-08-04 18:53:18 | 47,424,546 | 17 | 2017-11-21 23:38:21 | 5,054,717 | 2017-11-21 23:38:21 | https://stackoverflow.com/q/47424343 | https://stackoverflow.com/a/47424546 | <p>You can see where that key has been added with an SSH command: <code>ssh -Ti /path/to/key git@bitbucket.org</code>. It should come back with something like this:</p>
<pre><code>authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access... | <p>You can see where that key has been added with an SSH command: <code>ssh -Ti /path/to/key git@bitbucket.org</code>. It should come back with something like this:</p> <pre><code>authenticated via a deploy key. You can use git or hg to connect to Bitbucket. Shell access is disabled. This deploy key has read access... | 119, 8337, 25308, 34099 | bitbucket, git, git-clone, ssh-keys | <h1>Error message "Someone has already registered this as a deploy key" on BitBucket</h1>
<p>I'm trying to clone a git repo on my bitbucket account, but am getting this error message when trying to do the clone this repo. to a new PC I've set up:</p>
<p>Cloning into 'xxxxx'...
repository access denied. deployment key ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,329 | git | # Error message "Someone has already registered this as a deploy key" on BitBucket
I'm trying to clone a git repo on my bitbucket account, but am getting this error message when trying to do the clone this repo. to a new PC I've set up:
Cloning into 'xxxxx'...
repository access denied. deployment key is not associate... | You can see where that key has been added with an SSH command: `ssh -Ti /path/to/key git@bitbucket.org`. It should come back with something like this:
```
authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access to the following reposit... |
32043533 | GIT multiple local checkouts | 12 | 2015-08-17 05:48:13 | <p>I want to checkout multiple branches of the same git repostiory on the same Computer (Linux and Windows). However as the repository might be huge, I would prefer to have the repository once and only multiple working directories.</p>
<p>Is this possible?
How so?</p>
| 4,883 | 50,750 | 2025-03-05 16:47:43 | 32,043,748 | 17 | 2015-08-17 06:07:09 | 6,309 | 2015-08-17 06:07:09 | https://stackoverflow.com/q/32043533 | https://stackoverflow.com/a/32043748 | <p>It is possible since Git 2.5 and its <code>git worktree</code> command.</p>
<p>It replaces an older script <code>contrib/workdir/git-new-workdir</code>, with a more robust mechanism where those "linked" working trees are actually recorded in the main repo new <code>$GIT_DIR/worktrees</code> folder (so that work on ... | <p>It is possible since Git 2.5 and its <code>git worktree</code> command.</p> <p>It replaces an older script <code>contrib/workdir/git-new-workdir</code>, with a more robust mechanism where those "linked" working trees are actually recorded in the main repo new <code>$GIT_DIR/worktrees</code> folder (so that work on ... | 119, 456, 7330, 37230 | git, git-checkout, repository, version-control | <h1>GIT multiple local checkouts</h1>
<p>I want to checkout multiple branches of the same git repostiory on the same Computer (Linux and Windows). However as the repository might be huge, I would prefer to have the repository once and only multiple working directories.</p>
<p>Is this possible?
How so?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,332 | git | # GIT multiple local checkouts
I want to checkout multiple branches of the same git repostiory on the same Computer (Linux and Windows). However as the repository might be huge, I would prefer to have the repository once and only multiple working directories.
Is this possible?
How so? | It is possible since Git 2.5 and its `git worktree` command.
It replaces an older script `contrib/workdir/git-new-workdir`, with a more robust mechanism where those "linked" working trees are actually recorded in the main repo new `$GIT_DIR/worktrees` folder (so that work on any OS, including Windows).
Once you have ... |
28573000 | Rebasing to change parent of a merge commit | 12 | 2015-02-17 23:11:12 | <p>Suppose I've got the following history, where the top line is the master branch, the lower one is a feature branch that's merged with master at one point, and <code>D</code> just reverts <code>C</code> (which means that the working directory is the same in <code>B</code> and <code>D</code>). </p>
<pre><code>A---B--... | 9,131 | 334,519 | 2015-02-18 02:40:09 | 28,573,405 | 17 | 2015-02-17 23:45:57 | 1,256,452 | 2015-02-17 23:51:25 | https://stackoverflow.com/q/28573000 | https://stackoverflow.com/a/28573405 | <p>Most methods will be somewhat painful. There's a moderately painless version using <code>git filter-branch</code>, except that filter-branch itself is painful. :-) (You'd filter commits <code>F</code> and <code>G</code> and write a commit-filter that substitutes in the new parents you want for <code>F'</code>, and... | <p>Most methods will be somewhat painful. There's a moderately painless version using <code>git filter-branch</code>, except that filter-branch itself is painful. :-) (You'd filter commits <code>F</code> and <code>G</code> and write a commit-filter that substitutes in the new parents you want for <code>F'</code>, and... | 119, 29934 | git, git-rebase | <h1>Rebasing to change parent of a merge commit</h1>
<p>Suppose I've got the following history, where the top line is the master branch, the lower one is a feature branch that's merged with master at one point, and <code>D</code> just reverts <code>C</code> (which means that the working directory is the same in <code>B... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,333 | git | # Rebasing to change parent of a merge commit
Suppose I've got the following history, where the top line is the master branch, the lower one is a feature branch that's merged with master at one point, and `D` just reverts `C` (which means that the working directory is the same in `B` and `D`).
```
A---B---C---D ... | Most methods will be somewhat painful. There's a moderately painless version using `git filter-branch`, except that filter-branch itself is painful. :-) (You'd filter commits `F` and `G` and write a commit-filter that substitutes in the new parents you want for `F'`, and let the filter-branch operation replace the pare... |
26017432 | Git. Rebase local branch atop local master. How do I ignore a single files changes? | 12 | 2014-09-24 12:53:19 | <p>With Git I am on a branch. I am rebasing the branch atop master. There is a conflict that I want to resolve by ignoring the branch's version and accepting master's version. How do I indicate I want to use master's version of the file during the rebase?</p>
| 14,960 | 116,169 | 2023-08-31 21:11:05 | 26,018,187 | 17 | 2014-09-24 13:27:51 | 2,274,224 | 2016-03-24 16:28:43 | https://stackoverflow.com/q/26017432 | https://stackoverflow.com/a/26018187 | <p><code>git checkout --ours <path-to-file></code> is the command you are looking for. </p>
<p>It will checkout the <em>master</em> version of the file which you then can add to the index (to mark the conflict resolved) and continue your rebase.</p>
<p>You can take a look at the <a href="http://git-scm.com/doc... | <p><code>git checkout --ours <path-to-file></code> is the command you are looking for. </p> <p>It will checkout the <em>master</em> version of the file which you then can add to the index (to mark the conflict resolved) and continue your rebase.</p> <p>You can take a look at the <a href="http://git-scm.com/doc... | 119, 8974 | git, rebase | <h1>Git. Rebase local branch atop local master. How do I ignore a single files changes?</h1>
<p>With Git I am on a branch. I am rebasing the branch atop master. There is a conflict that I want to resolve by ignoring the branch's version and accepting master's version. How do I indicate I want to use master's version of... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,334 | git | # Git. Rebase local branch atop local master. How do I ignore a single files changes?
With Git I am on a branch. I am rebasing the branch atop master. There is a conflict that I want to resolve by ignoring the branch's version and accepting master's version. How do I indicate I want to use master's version of the file... | `git checkout --ours <path-to-file>` is the command you are looking for.
It will checkout the *master* version of the file which you then can add to the index (to mark the conflict resolved) and continue your rebase.
You can take a look at the [checkout documentation](http://git-scm.com/docs/git-checkout) for more in... |
21487190 | How do I turn off GIT_TRACE? | 12 | 2014-01-31 18:15:45 | <p>I suddenly started receiving permission denied errors when trying to <code>fetch</code> from our git server. According to <a href="https://confluence.atlassian.com/display/STASHKB/Git+Operations+Fail+-+Permission+denied+-+publickey" rel="noreferrer">this document</a>, I used the <code>GIT_TRACE_PACKET</code> AND <co... | 14,281 | 341,611 | 2017-10-04 17:52:30 | 21,487,965 | 17 | 2014-01-31 18:58:05 | 1,256,452 | 2014-01-31 18:58:05 | https://stackoverflow.com/q/21487190 | https://stackoverflow.com/a/21487965 | <p>As everyone said in comments, those are not actually commands. There is a command involved (<code>export</code>) but it's a <em>shell</em> (<code>bash</code> in your case, although there are other shells) command, not a <em>git</em> command. It changes the set of environment-variables that the shell provides to ot... | <p>As everyone said in comments, those are not actually commands. There is a command involved (<code>export</code>) but it's a <em>shell</em> (<code>bash</code> in your case, although there are other shells) command, not a <em>git</em> command. It changes the set of environment-variables that the shell provides to ot... | 119 | git | <h1>How do I turn off GIT_TRACE?</h1>
<p>I suddenly started receiving permission denied errors when trying to <code>fetch</code> from our git server. According to <a href="https://confluence.atlassian.com/display/STASHKB/Git+Operations+Fail+-+Permission+denied+-+publickey" rel="noreferrer">this document</a>, I used the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,336 | git | # How do I turn off GIT_TRACE?
I suddenly started receiving permission denied errors when trying to `fetch` from our git server. According to [this document](https://confluence.atlassian.com/display/STASHKB/Git+Operations+Fail+-+Permission+denied+-+publickey), I used the `GIT_TRACE_PACKET` AND `GIT_TRACE` commands. We... | As everyone said in comments, those are not actually commands. There is a command involved (`export`) but it's a *shell* (`bash` in your case, although there are other shells) command, not a *git* command. It changes the set of environment-variables that the shell provides to other commands.
So, you just need to un-do... |
18073106 | On local branch, don't want to commit changes, but need to switch to another branch | 12 | 2013-08-06 06:30:05 | <p>I am working on branch <code>branch-A</code> and the feature/task is not done yet. Then I need to switch to another branch <code>branch-B</code> for a quick fix. When I try to switch on another branch Git forces me to save my local changes otherwise I will lose my all local changes.</p>
<p>I need to commit my incomp... | 24,158 | 822,580 | 2023-10-10 07:34:53 | 18,073,482 | 17 | 2013-08-06 06:52:31 | null | 2021-03-04 15:16:40 | https://stackoverflow.com/q/18073106 | https://stackoverflow.com/a/18073482 | <p>One option, as <a href="https://stackoverflow.com/questions/18073106/git-working-on-a-local-branch-and-dont-want-to-commit-any-changes-but-need-to/18073178#18073178">mipadi demonstrates</a>, is to simply use <code>git stash</code>.</p>
<p>Another option is to simply just commit your current work in progress, switch ... | <p>One option, as <a href="https://stackoverflow.com/questions/18073106/git-working-on-a-local-branch-and-dont-want-to-commit-any-changes-but-need-to/18073178#18073178">mipadi demonstrates</a>, is to simply use <code>git stash</code>.</p> <p>Another option is to simply just commit your current work in progress, switch ... | 119, 13091, 37230, 53850 | git, git-checkout, git-commit, git-stash | <h1>On local branch, don't want to commit changes, but need to switch to another branch</h1>
<p>I am working on branch <code>branch-A</code> and the feature/task is not done yet. Then I need to switch to another branch <code>branch-B</code> for a quick fix. When I try to switch on another branch Git forces me to save m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,337 | git | # On local branch, don't want to commit changes, but need to switch to another branch
I am working on branch `branch-A` and the feature/task is not done yet. Then I need to switch to another branch `branch-B` for a quick fix. When I try to switch on another branch Git forces me to save my local changes otherwise I wil... | One option, as [mipadi demonstrates](https://stackoverflow.com/questions/18073106/git-working-on-a-local-branch-and-dont-want-to-commit-any-changes-but-need-to/18073178#18073178), is to simply use `git stash`.
Another option is to simply just commit your current work in progress, switch branches, and then when you're ... |
15326093 | git-flow vs. normal git commands | 12 | 2013-03-10 18:48:09 | <p>I've read a couple of information about git-flow, but still don't understand why it should be used instead of plain git commands. To me it looks like it propagates a (fairly complicated) branch-setup. OK, this should be easily adoptable. Git-flow also adds some higher-level commands around the lower-level, normal gi... | 5,648 | 209,706 | 2013-03-10 18:55:55 | 15,326,182 | 17 | 2013-03-10 18:55:55 | 554,327 | 2013-03-10 18:55:55 | https://stackoverflow.com/q/15326093 | https://stackoverflow.com/a/15326182 | <p>I believe git-flow allows you to implement a certain process within the dev team. It enforces certain practices such as naming conventions for your branches and assists with the <code>flow</code> from development, to release, to master.</p>
<p>git-flow doesn't offer anything that basic git commands can't do. With t... | <p>I believe git-flow allows you to implement a certain process within the dev team. It enforces certain practices such as naming conventions for your branches and assists with the <code>flow</code> from development, to release, to master.</p> <p>git-flow doesn't offer anything that basic git commands can't do. With t... | 119, 64339 | git, git-flow | <h1>git-flow vs. normal git commands</h1>
<p>I've read a couple of information about git-flow, but still don't understand why it should be used instead of plain git commands. To me it looks like it propagates a (fairly complicated) branch-setup. OK, this should be easily adoptable. Git-flow also adds some higher-level ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,338 | git | # git-flow vs. normal git commands
I've read a couple of information about git-flow, but still don't understand why it should be used instead of plain git commands. To me it looks like it propagates a (fairly complicated) branch-setup. OK, this should be easily adoptable. Git-flow also adds some higher-level commands ... | I believe git-flow allows you to implement a certain process within the dev team. It enforces certain practices such as naming conventions for your branches and assists with the `flow` from development, to release, to master.
git-flow doesn't offer anything that basic git commands can't do. With the `start` and `finis... |
14526780 | Is it possible to have local Git branches working with remote SVN repositories? | 12 | 2013-01-25 17:05:44 | <p>We have a SVN repository with our source code. We really want to use local Git branches to develop new features and take advantage of Git capabilities like the merging algorithms.</p>
<p>Is that possible? If yes, could someone provide some information about how to perform that?</p>
| 3,980 | 1,681,272 | 2013-01-25 17:26:55 | 14,526,879 | 17 | 2013-01-25 17:11:16 | 501,250 | 2013-01-25 17:11:16 | https://stackoverflow.com/q/14526780 | https://stackoverflow.com/a/14526879 | <p>Yes. You will need to use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html" rel="noreferrer">git-svn</a>.</p>
<p>First you will need to <code>git svn clone</code> your SVN repository. Note that this will fetch <em>every revision</em> from the SVN server, and recreate the history as a Git repos... | <p>Yes. You will need to use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html" rel="noreferrer">git-svn</a>.</p> <p>First you will need to <code>git svn clone</code> your SVN repository. Note that this will fetch <em>every revision</em> from the SVN server, and recreate the history as a Git repos... | 63, 119 | git, svn | <h1>Is it possible to have local Git branches working with remote SVN repositories?</h1>
<p>We have a SVN repository with our source code. We really want to use local Git branches to develop new features and take advantage of Git capabilities like the merging algorithms.</p>
<p>Is that possible? If yes, could someone ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,339 | git | # Is it possible to have local Git branches working with remote SVN repositories?
We have a SVN repository with our source code. We really want to use local Git branches to develop new features and take advantage of Git capabilities like the merging algorithms.
Is that possible? If yes, could someone provide some inf... | Yes. You will need to use [git-svn](http://www.kernel.org/pub/software/scm/git/docs/git-svn.html).
First you will need to `git svn clone` your SVN repository. Note that this will fetch *every revision* from the SVN server, and recreate the history as a Git repository. **These Git repositories should not be shared by m... |
13362288 | Heroku push rejected, Submodule install failed | 12 | 2012-11-13 14:15:39 | <p>My repo uses a customized version of Recurly-js, and I have packaged it as a submodule using these instructions <a href="https://devcenter.heroku.com/articles/git-submodules" rel="noreferrer">https://devcenter.heroku.com/articles/git-submodules</a> . However, I get the following error now when I try to deploy:</p>
... | 6,168 | 1,065,036 | 2019-10-20 00:21:57 | 13,363,958 | 17 | 2012-11-13 15:50:00 | 459,852 | 2012-11-19 14:19:36 | https://stackoverflow.com/q/13362288 | https://stackoverflow.com/a/13363958 | <p>I gave the answer as a comment to @jeffrey-k's answer, but now I'm even more sure of it, I'll write it here.</p>
<p>My repo suddenly stopped pushing, and these two things 'fixed' it:</p>
<ol>
<li>Change all public submodule URLs (if any) from using the ssh transport URLs to readonly git transport URLs (i.e., from ... | <p>I gave the answer as a comment to @jeffrey-k's answer, but now I'm even more sure of it, I'll write it here.</p> <p>My repo suddenly stopped pushing, and these two things 'fixed' it:</p> <ol> <li>Change all public submodule URLs (if any) from using the ssh transport URLs to readonly git transport URLs (i.e., from ... | 119, 8279, 41612 | git, git-submodules, heroku | <h1>Heroku push rejected, Submodule install failed</h1>
<p>My repo uses a customized version of Recurly-js, and I have packaged it as a submodule using these instructions <a href="https://devcenter.heroku.com/articles/git-submodules" rel="noreferrer">https://devcenter.heroku.com/articles/git-submodules</a> . However, I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,340 | git | # Heroku push rejected, Submodule install failed
My repo uses a customized version of Recurly-js, and I have packaged it as a submodule using these instructions <https://devcenter.heroku.com/articles/git-submodules> . However, I get the following error now when I try to deploy:
```
----> Heroku receiving push
----->... | I gave the answer as a comment to @jeffrey-k's answer, but now I'm even more sure of it, I'll write it here.
My repo suddenly stopped pushing, and these two things 'fixed' it:
1. Change all public submodule URLs (if any) from using the ssh transport URLs to readonly git transport URLs (i.e., from `git@github.com:yani... |
5738204 | Can't understand how gitignore ignores the folders | 12 | 2011-04-21 00:34:01 | <p>I want to create repository for my Magento project. There are lots of folders and files in root directory and I change time to time only one folder: app/code/local/ </p>
<p>Everything else I want to ignore. But.. can't. My .gitignore file:</p>
<pre><code>*
!app/code/local/
!app/code/local/*
</code></pre>
<p>Then ... | 4,068 | 718,085 | 2014-08-07 14:08:39 | 5,740,857 | 17 | 2011-04-21 07:20:29 | 526,535 | 2012-08-10 08:12:26 | https://stackoverflow.com/q/5738204 | https://stackoverflow.com/a/5740857 | <p>Try below to ignore like you need:</p>
<pre><code>/*
!/app/
/app/*
!/app/code/
/app/code/*
!/app/code/local/
</code></pre>
<p>The following discussion was helpful: <a href="http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067.html">http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-... | <p>Try below to ignore like you need:</p> <pre><code>/* !/app/ /app/* !/app/code/ /app/code/* !/app/code/local/ </code></pre> <p>The following discussion was helpful: <a href="http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067.html">http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-... | 119, 25056 | git, gitignore | <h1>Can't understand how gitignore ignores the folders</h1>
<p>I want to create repository for my Magento project. There are lots of folders and files in root directory and I change time to time only one folder: app/code/local/ </p>
<p>Everything else I want to ignore. But.. can't. My .gitignore file:</p>
<pre><code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,341 | git | # Can't understand how gitignore ignores the folders
I want to create repository for my Magento project. There are lots of folders and files in root directory and I change time to time only one folder: app/code/local/
Everything else I want to ignore. But.. can't. My .gitignore file:
```
*
!app/code/local/
!app/code... | Try below to ignore like you need:
```
/*
!/app/
/app/*
!/app/code/
/app/code/*
!/app/code/local/
```
The following discussion was helpful: <http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067.html> , especially the following from Linus:
`That's by design. You've chosen to ignore those directo... |
4857031 | GIt Deployment + Configuration Files + Heroku | 12 | 2011-01-31 22:50:04 | <p>I'm using Heroku to host a Rails app, which means using Git to deploy to Heroku. Because of the "pure Git workflow" on Heroku, anything that needs to go upstream to the server has to be configured identically on my local box.</p>
<p>However I need to have certain configuration files be different depending on whethe... | 3,581 | 417,872 | 2012-10-31 02:50:43 | 4,872,126 | 17 | 2011-02-02 08:17:46 | 597,992 | 2012-10-31 02:50:43 | https://stackoverflow.com/q/4857031 | https://stackoverflow.com/a/4872126 | <p>You can have config vars persistently stored ON each heroku app's local setup so they do not have to be in your code at all! so the same code can run on multiple heroku sites but with different configuration. It very simple, easy, elegant...</p>
<p>It's the approach we used. (We used it for the SAME thing... we hav... | <p>You can have config vars persistently stored ON each heroku app's local setup so they do not have to be in your code at all! so the same code can run on multiple heroku sites but with different configuration. It very simple, easy, elegant...</p> <p>It's the approach we used. (We used it for the SAME thing... we hav... | 12, 119, 725, 8279, 64108 | configuration, git, heroku, ruby, ruby-on-rails-3 | <h1>GIt Deployment + Configuration Files + Heroku</h1>
<p>I'm using Heroku to host a Rails app, which means using Git to deploy to Heroku. Because of the "pure Git workflow" on Heroku, anything that needs to go upstream to the server has to be configured identically on my local box.</p>
<p>However I need to have certa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,342 | git | # GIt Deployment + Configuration Files + Heroku
I'm using Heroku to host a Rails app, which means using Git to deploy to Heroku. Because of the "pure Git workflow" on Heroku, anything that needs to go upstream to the server has to be configured identically on my local box.
However I need to have certain configuration... | You can have config vars persistently stored ON each heroku app's local setup so they do not have to be in your code at all! so the same code can run on multiple heroku sites but with different configuration. It very simple, easy, elegant...
It's the approach we used. (We used it for the SAME thing... we have multiple... |
3592351 | How can I specify custom global gitconfig path? | 12 | 2010-08-28 20:34:58 | <p>I'm in a bit of a bind with <code>Git</code>. I'm trying to execute <code>git commit</code> but I need to be able to swtich between <code>~/.gitconfig1</code> and <code>~/.gitconfig2</code> Is there a command line switch - or anyway to have <code>Git</code> use a different gitconfig file then the ones found at <code... | 13,377 | 196,832 | 2023-11-27 12:14:10 | 3,595,258 | 17 | 2010-08-29 15:07:58 | 196,832 | 2022-04-13 22:06:56 | https://stackoverflow.com/q/3592351 | https://stackoverflow.com/a/3595258 | <p>I found a way to execute this - it wasn't elegant but it did work - and so far seems to be the only way to get this to work.</p>
<p>Git uses the <code>HOME</code> path to determine where <code>.gitconfig</code> is. I was able to perform something like this:</p>
<pre><code>/home/marco/.silly/.gitconfig
/home/marco/.s... | <p>I found a way to execute this - it wasn't elegant but it did work - and so far seems to be the only way to get this to work.</p> <p>Git uses the <code>HOME</code> path to determine where <code>.gitconfig</code> is. I was able to perform something like this:</p> <pre><code>/home/marco/.silly/.gitconfig /home/marco/.s... | 119, 725 | configuration, git | <h1>How can I specify custom global gitconfig path?</h1>
<p>I'm in a bit of a bind with <code>Git</code>. I'm trying to execute <code>git commit</code> but I need to be able to swtich between <code>~/.gitconfig1</code> and <code>~/.gitconfig2</code> Is there a command line switch - or anyway to have <code>Git</code> us... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,343 | git | # How can I specify custom global gitconfig path?
I'm in a bit of a bind with `Git`. I'm trying to execute `git commit` but I need to be able to swtich between `~/.gitconfig1` and `~/.gitconfig2` Is there a command line switch - or anyway to have `Git` use a different gitconfig file then the ones found at `/etc/gitcon... | I found a way to execute this - it wasn't elegant but it did work - and so far seems to be the only way to get this to work.
Git uses the `HOME` path to determine where `.gitconfig` is. I was able to perform something like this:
```
/home/marco/.silly/.gitconfig
/home/marco/.stupid/.gitconfig
/home/marco/.gitconfig
`... |
3260584 | restore - git reset --hard HEAD^ | 12 | 2010-07-15 22:24:52 | <p>Unfortunately I did several times <code>git reset --hard HEAD^</code> losing a quite big chunk of code in several files. Is there a way to restore those commits or in this case to forward where the HEAD was before, so I can bring up those lines that I lost?</p>
| 2,478 | 393,295 | 2017-05-23 23:23:38 | 3,260,611 | 17 | 2010-07-15 22:31:21 | 893 | 2017-05-23 23:23:38 | https://stackoverflow.com/q/3260584 | https://stackoverflow.com/a/3260611 | <p>Use the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html" rel="nofollow noreferrer">reflog</a> to recover the sha1 of the previous HEAD. In particular, the article <a href="http://www.gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html" rel="nofollow noreferrer">reflog, your safe... | <p>Use the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html" rel="nofollow noreferrer">reflog</a> to recover the sha1 of the previous HEAD. In particular, the article <a href="http://www.gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html" rel="nofollow noreferrer">reflog, your safe... | 119, 5597, 59545 | commit, git, reflog | <h1>restore - git reset --hard HEAD^</h1>
<p>Unfortunately I did several times <code>git reset --hard HEAD^</code> losing a quite big chunk of code in several files. Is there a way to restore those commits or in this case to forward where the HEAD was before, so I can bring up those lines that I lost?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,344 | git | # restore - git reset --hard HEAD^
Unfortunately I did several times `git reset --hard HEAD^` losing a quite big chunk of code in several files. Is there a way to restore those commits or in this case to forward where the HEAD was before, so I can bring up those lines that I lost? | Use the [reflog](http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html) to recover the sha1 of the previous HEAD. In particular, the article [reflog, your safety net](http://www.gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html) will be particularly relevant to you. From that article:
> The mo... |
2097328 | Calculating total lines added/deleted after a merge? | 12 | 2010-01-19 21:42:18 | <p>I recently took a branch with a lot of commits and merged it back into my master branch. If I needed to go back and see how many lines were added or deleted because of that merge, how would I go about doing that?</p>
| 6,712 | 69,230 | 2017-11-17 18:03:51 | 2,097,656 | 17 | 2010-01-19 22:29:58 | 198,244 | 2010-01-19 22:29:58 | https://stackoverflow.com/q/2097328 | https://stackoverflow.com/a/2097656 | <p><code>git diff</code> has a <code>--shortstat</code> option which would have been useful before the merge as then you could've just done <code>git diff --shortstat ..branch/to/merge</code> from your main branch. </p>
<p>If the merge wasn't a fast-forward, then you'll have generated a merge commit. That will have ... | <p><code>git diff</code> has a <code>--shortstat</code> option which would have been useful before the merge as then you could've just done <code>git diff --shortstat ..branch/to/merge</code> from your main branch. </p> <p>If the merge wasn't a fast-forward, then you'll have generated a merge commit. That will have ... | 119, 717 | git, merge | <h1>Calculating total lines added/deleted after a merge?</h1>
<p>I recently took a branch with a lot of commits and merged it back into my master branch. If I needed to go back and see how many lines were added or deleted because of that merge, how would I go about doing that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,345 | git | # Calculating total lines added/deleted after a merge?
I recently took a branch with a lot of commits and merged it back into my master branch. If I needed to go back and see how many lines were added or deleted because of that merge, how would I go about doing that? | `git diff` has a `--shortstat` option which would have been useful before the merge as then you could've just done `git diff --shortstat ..branch/to/merge` from your main branch.
If the merge wasn't a fast-forward, then you'll have generated a merge commit. That will have the parent information for both branches. You ... |
58319730 | Git rebase branch onto older commit | 11 | 2019-10-10 09:29:58 | <p>Note: How this situation came to be is more of a tale that anything and not really relevant IMO.</p>
<p>Given the following git commit graph, starting from oldest, all pushed to origin</p>
<pre><code> start
|
breaking
/ \
fix #0 work
| |
f... | 23,922 | 5,511,972 | 2019-10-10 10:00:40 | 58,319,869 | 17 | 2019-10-10 09:36:59 | 1,506,009 | 2019-10-10 10:00:40 | https://stackoverflow.com/q/58319730 | https://stackoverflow.com/a/58319869 | <p>You should use interactive rebase to get rid of the <code>breaking</code> commit from your <code>issue-fix</code> branch.</p>
<p>In your case you should, checkout to the <code>issue-fix</code> branch and do:</p>
<p><code>git rebase -i HEAD~3</code></p>
<p>Then when the editor is open you should be able to choose ... | <p>You should use interactive rebase to get rid of the <code>breaking</code> commit from your <code>issue-fix</code> branch.</p> <p>In your case you should, checkout to the <code>issue-fix</code> branch and do:</p> <p><code>git rebase -i HEAD~3</code></p> <p>Then when the editor is open you should be able to choose ... | 119, 29934 | git, git-rebase | <h1>Git rebase branch onto older commit</h1>
<p>Note: How this situation came to be is more of a tale that anything and not really relevant IMO.</p>
<p>Given the following git commit graph, starting from oldest, all pushed to origin</p>
<pre><code> start
|
breaking
/ \
fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,348 | git | # Git rebase branch onto older commit
Note: How this situation came to be is more of a tale that anything and not really relevant IMO.
Given the following git commit graph, starting from oldest, all pushed to origin
```
start
|
breaking
/ \
fix #0 work
|... | You should use interactive rebase to get rid of the `breaking` commit from your `issue-fix` branch.
In your case you should, checkout to the `issue-fix` branch and do:
`git rebase -i HEAD~3`
Then when the editor is open you should be able to choose which commits you want to leave and which you want to get rid of:
`... |
51814990 | Git: How do you replace your current working directory with a previous commit without branching or git revert? | 11 | 2018-08-13 03:54:06 | <p>Is there an easy way to the following with git?</p>
<p><a href="https://i.sstatic.net/Vdypb.png" rel="noreferrer"><img src="https://i.sstatic.net/Vdypb.png" alt="commit copy paste diagram"></a></p>
<p>Basically I want to create a new commit at the top of my commit history that is equivalent to a previous commit fr... | 5,689 | 1,789,688 | 2018-08-21 13:21:02 | 51,815,311 | 17 | 2018-08-13 04:41:58 | 6,309 | 2018-08-13 04:41:58 | https://stackoverflow.com/q/51814990 | https://stackoverflow.com/a/51815311 | <p>To create a new commit, restoring the content of an old commit, you can:</p>
<ul>
<li><p>First, mark the current HEAD of your branch (assuming <code>master</code> here): we will need to move that HEAD <em>without</em> modifying <code>master</code>, so let's create a new temporary branch called '<code>tmp</code>' wh... | <p>To create a new commit, restoring the content of an old commit, you can:</p> <ul> <li><p>First, mark the current HEAD of your branch (assuming <code>master</code> here): we will need to move that HEAD <em>without</em> modifying <code>master</code>, so let's create a new temporary branch called '<code>tmp</code>' wh... | 119 | git | <h1>Git: How do you replace your current working directory with a previous commit without branching or git revert?</h1>
<p>Is there an easy way to the following with git?</p>
<p><a href="https://i.sstatic.net/Vdypb.png" rel="noreferrer"><img src="https://i.sstatic.net/Vdypb.png" alt="commit copy paste diagram"></a></p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,349 | git | # Git: How do you replace your current working directory with a previous commit without branching or git revert?
Is there an easy way to the following with git?
[](https://i.sstatic.net/Vdypb.png)
Basically I want to create a new commit at the top of my co... | To create a new commit, restoring the content of an old commit, you can:
- First, mark the current HEAD of your branch (assuming `master` here): we will need to move that HEAD *without* modifying `master`, so let's create a new temporary branch called '`tmp`' where `master` is.
```
git checkout master
git check... |
37985275 | How can I exclude pull requests from git mirror clone | 11 | 2016-06-23 07:47:16 | <p>I want to mirror clone a Bitbucket Repository to another Bitbucket Repository.
I manage this with a shell script, which does the following:</p>
<pre><code>git clone --mirror <sourceUrl>
git remote set-url --push origin <targetUrl>
git push --mirror
</code></pre>
<p>Now I'm getting the following error w... | 7,898 | 5,291,492 | 2018-05-16 20:28:57 | 39,764,408 | 17 | 2016-09-29 07:50:38 | 5,291,492 | 2016-09-29 07:50:38 | https://stackoverflow.com/q/37985275 | https://stackoverflow.com/a/39764408 | <p>Thanks to Ivan.</p>
<p>His command solved my Problem. I only had to add the "-r" parameter to xargs to react on empty greps:</p>
<pre><code>git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d
</code></pre>
| <p>Thanks to Ivan.</p> <p>His command solved my Problem. I only had to add the "-r" parameter to xargs to react on empty greps:</p> <pre><code>git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d </code></pre> | 119, 8337 | bitbucket, git | <h1>How can I exclude pull requests from git mirror clone</h1>
<p>I want to mirror clone a Bitbucket Repository to another Bitbucket Repository.
I manage this with a shell script, which does the following:</p>
<pre><code>git clone --mirror <sourceUrl>
git remote set-url --push origin <targetUrl>
git push -... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,350 | git | # How can I exclude pull requests from git mirror clone
I want to mirror clone a Bitbucket Repository to another Bitbucket Repository.
I manage this with a shell script, which does the following:
```
git clone --mirror <sourceUrl>
git remote set-url --push origin <targetUrl>
git push --mirror
```
Now I'm getting the... | Thanks to Ivan.
His command solved my Problem. I only had to add the "-r" parameter to xargs to react on empty greps:
```
git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d
``` |
13104495 | Get time of last commit for Git repository files via Python? | 11 | 2012-10-27 21:50:30 | <p>I have a Git repository with several thousand files, and would like to get the date and time of the last commit for each individual file. Can this be done using Python (e.g., by using something like <code>os.path.getmtime(path)</code>)?</p>
| 14,073 | 1,712,389 | 2023-07-25 22:13:29 | 35,464,230 | 17 | 2016-02-17 17:58:08 | 1,228,491 | 2022-06-05 17:23:58 | https://stackoverflow.com/q/13104495 | https://stackoverflow.com/a/35464230 | <p>With <a href="https://gitpython.readthedocs.org/" rel="noreferrer">GitPython</a>, this would do the job:</p>
<pre><code>import git
repo = git.Repo("./repo")
tree = repo.tree()
for blob in tree:
commit = next(repo.iter_commits(paths=blob.path, max_count=1))
print(blob.path, commit.committed_date)
</... | <p>With <a href="https://gitpython.readthedocs.org/" rel="noreferrer">GitPython</a>, this would do the job:</p> <pre><code>import git repo = git.Repo("./repo") tree = repo.tree() for blob in tree: commit = next(repo.iter_commits(paths=blob.path, max_count=1)) print(blob.path, commit.committed_date) </... | 16, 119 | git, python | <h1>Get time of last commit for Git repository files via Python?</h1>
<p>I have a Git repository with several thousand files, and would like to get the date and time of the last commit for each individual file. Can this be done using Python (e.g., by using something like <code>os.path.getmtime(path)</code>)?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,353 | git | # Get time of last commit for Git repository files via Python?
I have a Git repository with several thousand files, and would like to get the date and time of the last commit for each individual file. Can this be done using Python (e.g., by using something like `os.path.getmtime(path)`)? | With [GitPython](https://gitpython.readthedocs.org/), this would do the job:
```
import git
repo = git.Repo("./repo")
tree = repo.tree()
for blob in tree:
commit = next(repo.iter_commits(paths=blob.path, max_count=1))
print(blob.path, commit.committed_date)
```
Note that `commit.committed_date` is in "seconds... |
33294383 | devtools::install_git Over SSH | 11 | 2015-10-23 03:24:35 | <p>I've written an R package that I keep in a (bare) git repository on an SSH server, and I want to be able to install it on a local machine without needing to clone the repository by hand.</p>
<p>I've attempted the following:</p>
<pre><code>devtools::install_git("ssh://user_name@remote/path/to/repository")
</code></... | 6,527 | 5,042,495 | 2016-10-25 15:00:01 | 33,620,182 | 17 | 2015-11-09 23:19:50 | 2,639,561 | 2016-10-25 15:00:01 | https://stackoverflow.com/q/33294383 | https://stackoverflow.com/a/33620182 | <p>Ran into this issue myself. I know this question is a bit old, but for anybody else running into the same issue (like me), here's what I've found.</p>
<h1>The Problem</h1>
<p>Likely you don't have the library that <a href="https://github.com/ropensci/git2r" rel="noreferrer"><code>git2r</code></a> (the package that... | <p>Ran into this issue myself. I know this question is a bit old, but for anybody else running into the same issue (like me), here's what I've found.</p> <h1>The Problem</h1> <p>Likely you don't have the library that <a href="https://github.com/ropensci/git2r" rel="noreferrer"><code>git2r</code></a> (the package that... | 119, 386, 4452, 7187 | devtools, git, r, ssh | <h1>devtools::install_git Over SSH</h1>
<p>I've written an R package that I keep in a (bare) git repository on an SSH server, and I want to be able to install it on a local machine without needing to clone the repository by hand.</p>
<p>I've attempted the following:</p>
<pre><code>devtools::install_git("ssh://user_na... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,354 | git | # devtools::install_git Over SSH
I've written an R package that I keep in a (bare) git repository on an SSH server, and I want to be able to install it on a local machine without needing to clone the repository by hand.
I've attempted the following:
```
devtools::install_git("ssh://user_name@remote/path/to/repositor... | Ran into this issue myself. I know this question is a bit old, but for anybody else running into the same issue (like me), here's what I've found.
# The Problem
Likely you don't have the library that [`git2r`](https://github.com/ropensci/git2r) (the package that `devtools` uses to interact with `git`) uses to communi... |
26350876 | What is the difference between these `git fetch` syntaxes? | 11 | 2014-10-14 00:19:33 | <p>I've bare-cloned a repository (<code>git clone --bare</code>) and apparently <code>git fetch</code> doesn't update it, but <code>git fetch origin master:master</code> does. I don't understand all the nuances between these syntaxes:</p>
<ul>
<li><code>git fetch</code></li>
<li><code>git fetch origin</code></li>
<li>... | 5,934 | 1,842,511 | 2014-10-15 00:10:04 | 26,355,802 | 17 | 2014-10-14 08:13:36 | 1,256,452 | 2014-10-14 17:40:00 | https://stackoverflow.com/q/26350876 | https://stackoverflow.com/a/26355802 | <p><a href="https://stackoverflow.com/questions/26350876/what-is-the-difference-between-these-git-fetch-syntaxes#comment41363832_26350876">Andrew C's comment</a> contains the key here, but I'll expound a bit:</p>
<ul>
<li><p><code>git fetch</code>, with no additional arguments, chooses a remote name by looking at the ... | <p><a href="https://stackoverflow.com/questions/26350876/what-is-the-difference-between-these-git-fetch-syntaxes#comment41363832_26350876">Andrew C's comment</a> contains the key here, but I'll expound a bit:</p> <ul> <li><p><code>git fetch</code>, with no additional arguments, chooses a remote name by looking at the ... | 119, 367, 18283 | fetch, git, syntax | <h1>What is the difference between these `git fetch` syntaxes?</h1>
<p>I've bare-cloned a repository (<code>git clone --bare</code>) and apparently <code>git fetch</code> doesn't update it, but <code>git fetch origin master:master</code> does. I don't understand all the nuances between these syntaxes:</p>
<ul>
<li><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,357 | git | # What is the difference between these `git fetch` syntaxes?
I've bare-cloned a repository (`git clone --bare`) and apparently `git fetch` doesn't update it, but `git fetch origin master:master` does. I don't understand all the nuances between these syntaxes:
- `git fetch`
- `git fetch origin`
- `git fetch origin mas... | [Andrew C's comment](https://stackoverflow.com/questions/26350876/what-is-the-difference-between-these-git-fetch-syntaxes#comment41363832_26350876) contains the key here, but I'll expound a bit:
- `git fetch`, with no additional arguments, chooses a remote name by looking at the current branch, or uses `origin` (see t... |
18900774 | Equivalent of "svn checkout" for Git | 11 | 2013-09-19 16:59:04 | <p>What Git command should I use to be equivalent to <code>svn checkout</code>?</p>
<pre><code>git checkout(?)
</code></pre>
| 18,815 | 1,720,085 | 2023-12-29 22:01:16 | 19,030,339 | 17 | 2013-09-26 13:58:35 | 1,720,085 | 2023-12-29 22:01:16 | https://stackoverflow.com/q/18900774 | https://stackoverflow.com/a/19030339 | <p>This is exactly what I wanted:</p>
<p>SVN</p>
<pre><code>svn checkout svn://foo.googlecode.com/svn/trunk foo
# Make your changes
svn commit -m "my first commit"
</code></pre>
<p>Git</p>
<pre><code>git clone git@github.com:pjhyett/foo.git
# Make your changes
git commit -a -m "my first commit"
git ... | <p>This is exactly what I wanted:</p> <p>SVN</p> <pre><code>svn checkout svn://foo.googlecode.com/svn/trunk foo # Make your changes svn commit -m "my first commit" </code></pre> <p>Git</p> <pre><code>git clone git@github.com:pjhyett/foo.git # Make your changes git commit -a -m "my first commit" git ... | 63, 119, 37230, 65722 | git, git-checkout, svn, svn-checkout | <h1>Equivalent of "svn checkout" for Git</h1>
<p>What Git command should I use to be equivalent to <code>svn checkout</code>?</p>
<pre><code>git checkout(?)
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,358 | git | # Equivalent of "svn checkout" for Git
What Git command should I use to be equivalent to `svn checkout`?
```
git checkout(?)
``` | This is exactly what I wanted:
SVN
```
svn checkout svn://foo.googlecode.com/svn/trunk foo
# Make your changes
svn commit -m "my first commit"
```
Git
```
git clone git@github.com:pjhyett/foo.git
# Make your changes
git commit -a -m "my first commit"
git push
```
From
*[Git for beginners: The definitive practical ... |
18036754 | Git tracking entire home directory. Get error - fatal: bad default revision 'HEAD' | 11 | 2013-08-03 19:59:28 | <p>I'm completely new to git. I'm working in Mac Terminal.</p>
<p>Whenever I do a <code>git status</code> in my home directory, all untracked files, files in the stage directory, and committed files in my entire home directory appear. When I do a <code>git log</code> in my home directory, I get the following error:</p... | 22,228 | 1,116,668 | 2015-10-04 13:35:53 | 18,037,832 | 17 | 2013-08-03 22:18:17 | 2,158,473 | 2013-08-03 22:18:17 | https://stackoverflow.com/q/18036754 | https://stackoverflow.com/a/18037832 | <p>The reason for that error is because you haven't made an initial commit. But it also looks like you initialized the git repository in the wrong directory.</p>
<p>It looks like you ran the <code>git init</code> command in the wrong directory. Navigate to the directory you originally ran that command in (Looks like i... | <p>The reason for that error is because you haven't made an initial commit. But it also looks like you initialized the git repository in the wrong directory.</p> <p>It looks like you ran the <code>git init</code> command in the wrong directory. Navigate to the directory you originally ran that command in (Looks like i... | 119 | git | <h1>Git tracking entire home directory. Get error - fatal: bad default revision 'HEAD'</h1>
<p>I'm completely new to git. I'm working in Mac Terminal.</p>
<p>Whenever I do a <code>git status</code> in my home directory, all untracked files, files in the stage directory, and committed files in my entire home directory ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,359 | git | # Git tracking entire home directory. Get error - fatal: bad default revision 'HEAD'
I'm completely new to git. I'm working in Mac Terminal.
Whenever I do a `git status` in my home directory, all untracked files, files in the stage directory, and committed files in my entire home directory appear. When I do a `git lo... | The reason for that error is because you haven't made an initial commit. But it also looks like you initialized the git repository in the wrong directory.
It looks like you ran the `git init` command in the wrong directory. Navigate to the directory you originally ran that command in (Looks like it was your Home Direc... |
17106612 | How to get the last commit from HEAD in a git repository using libGit2Sharp? | 11 | 2013-06-14 10:40:15 | <p>How can I get the last Commit from the current Head? </p>
<p>I guess I need to get the current Branch (repo.Head), then the SHA1 (how?) and then lookup the commit using the SHA1 (how?).</p>
| 6,000 | 1,130,329 | 2013-07-07 18:45:50 | 17,107,518 | 17 | 2013-06-14 11:32:35 | 335,418 | 2013-06-14 11:44:42 | https://stackoverflow.com/q/17106612 | https://stackoverflow.com/a/17107518 | <blockquote>
<p>I need to get the last Commit from the current Head. How can I do that? </p>
</blockquote>
<p><code>repo.Head</code> returns the current <code>Branch</code> or the repository.</p>
<p>A <code>Branch</code> exposes a <code>Tip</code> property which points to the latest <code>Commit</code>.</p>
<p>Thu... | <blockquote> <p>I need to get the last Commit from the current Head. How can I do that? </p> </blockquote> <p><code>repo.Head</code> returns the current <code>Branch</code> or the repository.</p> <p>A <code>Branch</code> exposes a <code>Tip</code> property which points to the latest <code>Commit</code>.</p> <p>Thu... | 119, 66800, 74777 | git, libgit2, libgit2sharp | <h1>How to get the last commit from HEAD in a git repository using libGit2Sharp?</h1>
<p>How can I get the last Commit from the current Head? </p>
<p>I guess I need to get the current Branch (repo.Head), then the SHA1 (how?) and then lookup the commit using the SHA1 (how?).</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,360 | git | # How to get the last commit from HEAD in a git repository using libGit2Sharp?
How can I get the last Commit from the current Head?
I guess I need to get the current Branch (repo.Head), then the SHA1 (how?) and then lookup the commit using the SHA1 (how?). | > I need to get the last Commit from the current Head. How can I do that?
`repo.Head` returns the current `Branch` or the repository.
A `Branch` exposes a `Tip` property which points to the latest `Commit`.
Thus:
- `repo.Head.Tip` will return the latest commit of the current `Head`.
- `repo.Head.Tip.Id` the sha of ... |
15132325 | How to set tab size for pager used in git diff? | 11 | 2013-02-28 09:50:30 | <p>I use the pager <strong>most</strong> </p>
<p>It's pain to see diff output with tabsize=8. How can I specify tabsize==2 ?</p>
<pre><code>@@ -48,6 +49,7 @@
<div class="content_inner">
<%= yield %>
... | 1,563 | 1,079,225 | 2013-02-28 09:57:33 | 15,132,484 | 17 | 2013-02-28 09:57:33 | 777,292 | 2013-02-28 09:57:33 | https://stackoverflow.com/q/15132325 | https://stackoverflow.com/a/15132484 | <p>For a <code>less</code> pager, you can update the pager </p>
<p><code>git config --global core.pager 'less -x2'</code></p>
<p>You can do the same with <code>most</code>if this one has an option to change the tab size</p>
| <p>For a <code>less</code> pager, you can update the pager </p> <p><code>git config --global core.pager 'less -x2'</code></p> <p>You can do the same with <code>most</code>if this one has an option to change the tab size</p> | 119, 555, 606 | diff, formatting, git | <h1>How to set tab size for pager used in git diff?</h1>
<p>I use the pager <strong>most</strong> </p>
<p>It's pain to see diff output with tabsize=8. How can I specify tabsize==2 ?</p>
<pre><code>@@ -48,6 +49,7 @@
<div class="content_inner">
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 21,361 | git | # How to set tab size for pager used in git diff?
I use the pager **most**
It's pain to see diff output with tabsize=8. How can I specify tabsize==2 ?
```
@@ -48,6 +49,7 @@
<div class="content_inner">
<%= yield %>... | For a `less` pager, you can update the pager
`git config --global core.pager 'less -x2'`
You can do the same with `most`if this one has an option to change the tab size |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.