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
22270938
git filter-branch - discard the changes to a set of files in a range of commits
9
2014-03-08 15:02:48
<p>Say I have a branch <code>dev</code> and I want to <em>discard</em> all the changes made <em>to a set of files</em> in the rage of commits in <code>dev</code> branch since it diverged from <code>master</code>. If a commit in this range <em>only touches those files</em> I'd liked it pruned. The closest I got was :</p...
2,733
281,545
2014-03-09 20:59:11
22,274,266
13
2014-03-08 19:54:30
1,256,452
2014-03-09 20:59:11
https://stackoverflow.com/q/22270938
https://stackoverflow.com/a/22274266
<p>Fundamentally, what filter-branch does is this—everything else is optimization and/or edge-cases:<sup>1</sup></p> <ul> <li>For each commit in the listed revision(s): <ol> <li>check out that commit;</li> <li>apply the filter(s);</li> <li>create a new commit, which may or may not be the same as the old commit depend...
<p>Fundamentally, what filter-branch does is this—everything else is optimization and/or edge-cases:<sup>1</sup></p> <ul> <li>For each commit in the listed revision(s): <ol> <li>check out that commit;</li> <li>apply the filter(s);</li> <li>create a new commit, which may or may not be the same as the old commit depend...
119, 46509
git, git-filter-branch
<h1>git filter-branch - discard the changes to a set of files in a range of commits</h1> <p>Say I have a branch <code>dev</code> and I want to <em>discard</em> all the changes made <em>to a set of files</em> in the rage of commits in <code>dev</code> branch since it diverged from <code>master</code>. If a commit in thi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,718
git
# git filter-branch - discard the changes to a set of files in a range of commits Say I have a branch `dev` and I want to *discard* all the changes made *to a set of files* in the rage of commits in `dev` branch since it diverged from `master`. If a commit in this range *only touches those files* I'd liked it pruned. ...
Fundamentally, what filter-branch does is this—everything else is optimization and/or edge-cases:1 - For each commit in the listed revision(s): 1. check out that commit; 2. apply the filter(s); 3. create a new commit, which may or may not be the same as the old commit depending on step 2 (i.e., this new copy is ...
22231257
How to generate a CUSIP check digit
9
2014-03-06 17:08:55
<p>CUSIPs are a 9-digit alphanumeric code for uniquely identifying a financial security. </p> <p><a href="https://en.wikipedia.org/wiki/CUSIP" rel="noreferrer">https://en.wikipedia.org/wiki/CUSIP</a></p> <p>They were invented in the 1964, and given the reliability of data transmission in the 60's, the 9th digit is ac...
15,620
1,238,895
2024-04-08 18:49:19
22,231,258
13
2014-03-06 17:08:55
1,238,895
2022-06-05 02:01:33
https://stackoverflow.com/q/22231257
https://stackoverflow.com/a/22231258
<pre><code>public string GenerateCheckDigit(string cusip) { int sum = 0; char[] digits = cusip.ToUpper().ToCharArray(); string alphabet = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#&quot;; for (int i = 0; i &lt; digits.Length; i++) { int val; if (!int.TryParse(digits[i].ToString(), ...
<pre><code>public string GenerateCheckDigit(string cusip) { int sum = 0; char[] digits = cusip.ToUpper().ToCharArray(); string alphabet = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#&quot;; for (int i = 0; i &lt; digits.Length; i++) { int val; if (!int.TryParse(digits[i].ToString(), ...
9, 17, 248, 2354, 24792
algorithm, c#, check-digit, finance, java
<h1>How to generate a CUSIP check digit</h1> <p>CUSIPs are a 9-digit alphanumeric code for uniquely identifying a financial security. </p> <p><a href="https://en.wikipedia.org/wiki/CUSIP" rel="noreferrer">https://en.wikipedia.org/wiki/CUSIP</a></p> <p>They were invented in the 1964, and given the reliability of data ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,719
git
# How to generate a CUSIP check digit CUSIPs are a 9-digit alphanumeric code for uniquely identifying a financial security. <https://en.wikipedia.org/wiki/CUSIP> They were invented in the 1964, and given the reliability of data transmission in the 60's, the 9th digit is actually a check digit used to confirm the val...
``` public string GenerateCheckDigit(string cusip) { int sum = 0; char[] digits = cusip.ToUpper().ToCharArray(); string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#"; for (int i = 0; i < digits.Length; i++) { int val; if (!int.TryParse(digits[i].ToString(), out val)) ...
18215595
Error when reordering commits with git rebase -i
9
2013-08-13 17:34:04
<p>I'm trying to reorder 2 commits, and I keep getting an error without any kind of explanation, so I have no idea what I'm doing wrong.</p> <p>This is the repo:</p> <pre><code>$ git lol * c0000ca (HEAD, master) added a title * 132247f Turned colors to html * 0ddaef3 Added last sentences * 95f8007 initial commit </co...
8,733
74,415
2013-08-13 18:06:29
18,216,138
13
2013-08-13 18:06:29
2,033,034
2013-08-13 18:06:29
https://stackoverflow.com/q/18215595
https://stackoverflow.com/a/18216138
<p>It looks like what's happening is that you successfully resolved the first merge conflict when applying "Turned colors to html" then hit another merge conflict when applying the next commit "Added last sentences".</p> <p>Simply do a <code>git status</code> to see what the merge conflicts are, resolve them then cont...
<p>It looks like what's happening is that you successfully resolved the first merge conflict when applying "Turned colors to html" then hit another merge conflict when applying the next commit "Added last sentences".</p> <p>Simply do a <code>git status</code> to see what the merge conflicts are, resolve them then cont...
119, 8974, 29934
git, git-rebase, rebase
<h1>Error when reordering commits with git rebase -i</h1> <p>I'm trying to reorder 2 commits, and I keep getting an error without any kind of explanation, so I have no idea what I'm doing wrong.</p> <p>This is the repo:</p> <pre><code>$ git lol * c0000ca (HEAD, master) added a title * 132247f Turned colors to html * ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,722
git
# Error when reordering commits with git rebase -i I'm trying to reorder 2 commits, and I keep getting an error without any kind of explanation, so I have no idea what I'm doing wrong. This is the repo: ``` $ git lol * c0000ca (HEAD, master) added a title * 132247f Turned colors to html * 0ddaef3 Added last sentence...
It looks like what's happening is that you successfully resolved the first merge conflict when applying "Turned colors to html" then hit another merge conflict when applying the next commit "Added last sentences". Simply do a `git status` to see what the merge conflicts are, resolve them then continue with `git rebase...
17995608
Git detached head issue
9
2013-08-01 13:36:15
<p>I've read many posts related to this issue today( one useful one here: <a href="https://stackoverflow.com/questions/10228760/how-to-fix-a-git-detached-head">Fix a Git detached head?</a> &amp; <a href="https://stackoverflow.com/questions/3965676/why-did-git-detach-my-head">Why did my Git repo enter a detached HEAD s...
8,794
543,087
2013-08-01 14:20:16
17,995,952
13
2013-08-01 13:50:22
520,162
2013-08-01 14:20:16
https://stackoverflow.com/q/17995608
https://stackoverflow.com/a/17995952
<p>To get back to the last checked-out branch, simply type</p> <pre><code>git checkout - </code></pre> <p>Seems a bit under-documented (search for <code>You may also specify</code> in the docs of <a href="https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"><code>git checkout</code></a>), but works for...
<p>To get back to the last checked-out branch, simply type</p> <pre><code>git checkout - </code></pre> <p>Seems a bit under-documented (search for <code>You may also specify</code> in the docs of <a href="https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"><code>git checkout</code></a>), but works for...
119
git
<h1>Git detached head issue</h1> <p>I've read many posts related to this issue today( one useful one here: <a href="https://stackoverflow.com/questions/10228760/how-to-fix-a-git-detached-head">Fix a Git detached head?</a> &amp; <a href="https://stackoverflow.com/questions/3965676/why-did-git-detach-my-head">Why did my...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,723
git
# Git detached head issue I've read many posts related to this issue today( one useful one here: [Fix a Git detached head?](https://stackoverflow.com/questions/10228760/how-to-fix-a-git-detached-head) & [Why did my Git repo enter a detached HEAD state?](https://stackoverflow.com/questions/3965676/why-did-git-detach-my...
To get back to the last checked-out branch, simply type ``` git checkout - ``` Seems a bit under-documented (search for `You may also specify` in the docs of [`git checkout`](https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html)), but works for me. Could also be used as a handy shortcut for switching ...
14894238
merge branches without commit messages
9
2013-02-15 11:57:26
<p>Assuming following "workflow"</p> <pre><code>create branch master add + commit some files create and checkout branch dev edit and commit several times with silly commit messages checkout master merge dev branch into master branch </code></pre> <p>in the last step is it possible to not introduce all the (silly) com...
15,068
1,285,655
2018-11-06 10:33:12
14,896,065
13
2013-02-15 13:42:19
1,761,499
2013-02-15 13:42:19
https://stackoverflow.com/q/14894238
https://stackoverflow.com/a/14896065
<p>You want <strong>commit-squashing</strong>, which can be done in several ways:</p> <ul> <li>If you want fine-grained control over which commits are contained in the squash, if you want to squash your feature commits into more than one commit (e.g. to split up logical changes), or if you only want to change the comm...
<p>You want <strong>commit-squashing</strong>, which can be done in several ways:</p> <ul> <li>If you want fine-grained control over which commits are contained in the squash, if you want to squash your feature commits into more than one commit (e.g. to split up logical changes), or if you only want to change the comm...
119, 717
git, merge
<h1>merge branches without commit messages</h1> <p>Assuming following "workflow"</p> <pre><code>create branch master add + commit some files create and checkout branch dev edit and commit several times with silly commit messages checkout master merge dev branch into master branch </code></pre> <p>in the last step is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,724
git
# merge branches without commit messages Assuming following "workflow" ``` create branch master add + commit some files create and checkout branch dev edit and commit several times with silly commit messages checkout master merge dev branch into master branch ``` in the last step is it possible to not introduce all ...
You want **commit-squashing**, which can be done in several ways: - If you want fine-grained control over which commits are contained in the squash, if you want to squash your feature commits into more than one commit (e.g. to split up logical changes), or if you only want to change the commit messages, **"rebasing in...
11524088
is it possible to display the latest commit when i use "git branch"?
9
2012-07-17 13:58:23
<p>So, on each branch if I do "git log" or "git lg", it will show a list of commits done.</p> <p>Now, is there a way to display the latest commit on each branch when I enter "git branch -arg"? I find it a bit annoying/tedious to have to checkout each branch then check the commits using "git log".</p>
6,066
802,281
2023-05-26 10:19:15
11,524,351
13
2012-07-17 14:11:42
5,168
2012-07-17 14:11:42
https://stackoverflow.com/q/11524088
https://stackoverflow.com/a/11524351
<p><code>git branch -v</code> lists branch names and the SHA and commit message of the latest commit on each branch.</p> <p>See the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">git branch manual page</a>.</p>
<p><code>git branch -v</code> lists branch names and the SHA and commit message of the latest commit on each branch.</p> <p>See the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">git branch manual page</a>.</p>
119, 5597
commit, git
<h1>is it possible to display the latest commit when i use "git branch"?</h1> <p>So, on each branch if I do "git log" or "git lg", it will show a list of commits done.</p> <p>Now, is there a way to display the latest commit on each branch when I enter "git branch -arg"? I find it a bit annoying/tedious to have to chec...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,725
git
# is it possible to display the latest commit when i use "git branch"? So, on each branch if I do "git log" or "git lg", it will show a list of commits done. Now, is there a way to display the latest commit on each branch when I enter "git branch -arg"? I find it a bit annoying/tedious to have to checkout each branch...
`git branch -v` lists branch names and the SHA and commit message of the latest commit on each branch. See the [git branch manual page](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html).
6828121
How to include only selected files into git repository and exclude all the rest?
9
2011-07-26 09:42:29
<p>Is there any chance to do an opposite to what .gitignore file does? I mean include only specified files and exclude all the rest? Thank you in advance.</p>
3,905
619,978
2016-08-09 09:06:57
6,828,163
13
2011-07-26 09:46:32
11,343
2011-07-26 11:11:37
https://stackoverflow.com/q/6828121
https://stackoverflow.com/a/6828163
<p>You can try the following:</p> <pre><code>#ignore everything * #except .c source !*.c </code></pre> <p>(<code>!</code> negates the patterns specified in gitignore)</p>
<p>You can try the following:</p> <pre><code>#ignore everything * #except .c source !*.c </code></pre> <p>(<code>!</code> negates the patterns specified in gitignore)</p>
119, 25056
git, gitignore
<h1>How to include only selected files into git repository and exclude all the rest?</h1> <p>Is there any chance to do an opposite to what .gitignore file does? I mean include only specified files and exclude all the rest? Thank you in advance.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,729
git
# How to include only selected files into git repository and exclude all the rest? Is there any chance to do an opposite to what .gitignore file does? I mean include only specified files and exclude all the rest? Thank you in advance.
You can try the following: ``` #ignore everything * #except .c source !*.c ``` (`!` negates the patterns specified in gitignore)
5887358
When using git submodule update how can you tell it to clone the dependencies with HTTP instead of GIT?
9
2011-05-04 17:23:15
<p>We have port 9418 blocked here so I can't seem to clone with git://xyz.git </p> <p>Is there a way to make git use HTTP instead? If I do it manually it works but when I run git submodule update it always wants to use git:</p>
3,299
1,975
2011-05-04 19:27:23
5,888,836
13
2011-05-04 19:27:23
223,092
2011-05-04 19:27:23
https://stackoverflow.com/q/5887358
https://stackoverflow.com/a/5888836
<p>You need to change the configuration variable <code>submodule.&lt;submodule-name&gt;.url</code> for each submodule, e.g.:</p> <pre><code>git config submodule.whatever.url http://github.com/nvie/shFlags.git </code></pre> <p>Then when you do <code>git submodule update</code>, the <code>git fetch</code> which is run ...
<p>You need to change the configuration variable <code>submodule.&lt;submodule-name&gt;.url</code> for each submodule, e.g.:</p> <pre><code>git config submodule.whatever.url http://github.com/nvie/shFlags.git </code></pre> <p>Then when you do <code>git submodule update</code>, the <code>git fetch</code> which is run ...
119
git
<h1>When using git submodule update how can you tell it to clone the dependencies with HTTP instead of GIT?</h1> <p>We have port 9418 blocked here so I can't seem to clone with git://xyz.git </p> <p>Is there a way to make git use HTTP instead? If I do it manually it works but when I run git submodule update it always...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,731
git
# When using git submodule update how can you tell it to clone the dependencies with HTTP instead of GIT? We have port 9418 blocked here so I can't seem to clone with git://xyz.git Is there a way to make git use HTTP instead? If I do it manually it works but when I run git submodule update it always wants to use git:
You need to change the configuration variable `submodule.<submodule-name>.url` for each submodule, e.g.: ``` git config submodule.whatever.url http://github.com/nvie/shFlags.git ``` Then when you do `git submodule update`, the `git fetch` which is run in that submodule will use the URL from that configuration variabl...
5817095
What tools exist for simple one-off sharing of a git repo?
9
2011-04-28 10:20:39
<p>I seem to often come across scenarios where I'd like to quickly give someone the means to clone a git repo from e.g. my laptop, and I'd like to perform this feat without running an SSH daemon, git daemon or any other kind of service requiring configuration (or even access control).</p> <p>The simplest way I've come...
940
15,064
2011-04-28 10:54:10
5,817,441
13
2011-04-28 10:53:11
229,602
2011-04-28 10:53:11
https://stackoverflow.com/q/5817095
https://stackoverflow.com/a/5817441
<p>Run this from somewhere. </p> <pre><code>git daemon --export-all --base-path=/tmp --port=9090 /tmp/foo/.git </code></pre> <p><code>/tmp/foo/.git</code> is the directory you want to expose. </p> <p>Then you can clone it somewhere else like so</p> <pre><code>git clone git://localhost:9090/foo testdir </code></pre>...
<p>Run this from somewhere. </p> <pre><code>git daemon --export-all --base-path=/tmp --port=9090 /tmp/foo/.git </code></pre> <p><code>/tmp/foo/.git</code> is the directory you want to expose. </p> <p>Then you can clone it somewhere else like so</p> <pre><code>git clone git://localhost:9090/foo testdir </code></pre>...
119
git
<h1>What tools exist for simple one-off sharing of a git repo?</h1> <p>I seem to often come across scenarios where I'd like to quickly give someone the means to clone a git repo from e.g. my laptop, and I'd like to perform this feat without running an SSH daemon, git daemon or any other kind of service requiring config...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,732
git
# What tools exist for simple one-off sharing of a git repo? I seem to often come across scenarios where I'd like to quickly give someone the means to clone a git repo from e.g. my laptop, and I'd like to perform this feat without running an SSH daemon, git daemon or any other kind of service requiring configuration (...
Run this from somewhere. ``` git daemon --export-all --base-path=/tmp --port=9090 /tmp/foo/.git ``` `/tmp/foo/.git` is the directory you want to expose. Then you can clone it somewhere else like so ``` git clone git://localhost:9090/foo testdir ``` And you'll get the repository in testdir. Kill the server with `^...
5359714
django - django-taggit form
9
2011-03-19 02:48:22
<p>I would like to use <code>django-taggit</code> (<a href="https://github.com/alex/django-taggit" rel="noreferrer">click here</a> ). The documentation ( <a href="http://readthedocs.org/docs/django-taggit/en/latest/forms.html" rel="noreferrer" title="here"> click here</a>) talks about using <code>ModelForm</code> to ge...
7,557
509,807
2020-12-08 17:46:14
5,361,504
13
2011-03-19 10:23:23
635,411
2011-03-19 10:41:48
https://stackoverflow.com/q/5359714
https://stackoverflow.com/a/5361504
<p>I'm not too familiar with the django taggit app, but it looks like if you want to use the same field and widget setup the app uses, you can import them from the taggit.forms (<a href="https://github.com/alex/django-taggit/blob/master/taggit/forms.py"><code>https://github.com/alex/django-taggit/blob/master/taggit/for...
<p>I'm not too familiar with the django taggit app, but it looks like if you want to use the same field and widget setup the app uses, you can import them from the taggit.forms (<a href="https://github.com/alex/django-taggit/blob/master/taggit/forms.py"><code>https://github.com/alex/django-taggit/blob/master/taggit/for...
243, 10742, 15108, 23506, 67475
django, django-forms, django-models, django-taggit, django-views
<h1>django - django-taggit form</h1> <p>I would like to use <code>django-taggit</code> (<a href="https://github.com/alex/django-taggit" rel="noreferrer">click here</a> ). The documentation ( <a href="http://readthedocs.org/docs/django-taggit/en/latest/forms.html" rel="noreferrer" title="here"> click here</a>) talks abo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,733
git
# django - django-taggit form I would like to use `django-taggit` ([click here](https://github.com/alex/django-taggit) ). The documentation ( [click here](http://readthedocs.org/docs/django-taggit/en/latest/forms.html "here")) talks about using `ModelForm` to generate the form but I have already my form that I would ...
I'm not too familiar with the django taggit app, but it looks like if you want to use the same field and widget setup the app uses, you can import them from the taggit.forms ([`https://github.com/alex/django-taggit/blob/master/taggit/forms.py`](https://github.com/alex/django-taggit/blob/master/taggit/forms.py)): your ...
4826779
Git switching branch
9
2011-01-28 09:47:03
<p>There is something I don't get yet with Git. It is branching.</p> <p>So let’s say that I have a local repository <code>A</code> which I clone from a remote one <code>B</code>. So now <code>A</code> have the <em>master</em> branch checked out.</p> <p>So when I push from <code>A</code> it goes to <code>B</code> <em>ma...
29,870
343,957
2023-12-30 20:33:54
4,826,871
13
2011-01-28 09:56:26
216,074
2011-01-28 09:56:26
https://stackoverflow.com/q/4826779
https://stackoverflow.com/a/4826871
<pre><code>git fetch C git checkout C/stable-branch git checkout -b myCopy </code></pre> <p>Then <code>myCopy</code> is a local (copied) branch of C's stable one.</p>
<pre><code>git fetch C git checkout C/stable-branch git checkout -b myCopy </code></pre> <p>Then <code>myCopy</code> is a local (copied) branch of C's stable one.</p>
119, 1879
branch, git
<h1>Git switching branch</h1> <p>There is something I don't get yet with Git. It is branching.</p> <p>So let’s say that I have a local repository <code>A</code> which I clone from a remote one <code>B</code>. So now <code>A</code> have the <em>master</em> branch checked out.</p> <p>So when I push from <code>A</code> it...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,734
git
# Git switching branch There is something I don't get yet with Git. It is branching. So let’s say that I have a local repository `A` which I clone from a remote one `B`. So now `A` have the *master* branch checked out. So when I push from `A` it goes to `B` *master*. `B` is just a clone on [GitHub](https://en.wikip...
``` git fetch C git checkout C/stable-branch git checkout -b myCopy ``` Then `myCopy` is a local (copied) branch of C's stable one.
3492186
Git on Windows: Why I suddenly have untracked directory that used to be tracked?
9
2010-08-16 10:09:00
<p>When i hit 'git status', it shows 2 folders that contains files that are tracked long time ago:</p> <pre><code>$ git status # On branch master # Untracked files: # (use "git add &lt;file&gt;..." to include in what will be committed) # # src/UI/Views/Shared/EditorTemplates/ # src/Web/helpers/ nothing ...
6,348
82,062
2012-12-13 11:14:52
4,094,451
13
2010-11-04 06:47:07
6,309
2010-11-04 06:47:07
https://stackoverflow.com/q/3492186
https://stackoverflow.com/a/4094451
<p><a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> correctly diagnosed the problem in the comments: "<code>git add</code>" on a case insensitive Os.</p> <p>It is linked to <a href="http://code.google.com/p/msysgit/issues/detail?id=286" rel="nofollow noreferrer">issue 286</a> of msysgi...
<p><a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> correctly diagnosed the problem in the comments: "<code>git add</code>" on a case insensitive Os.</p> <p>It is linked to <a href="http://code.google.com/p/msysgit/issues/detail?id=286" rel="nofollow noreferrer">issue 286</a> of msysgi...
64, 119
git, windows
<h1>Git on Windows: Why I suddenly have untracked directory that used to be tracked?</h1> <p>When i hit 'git status', it shows 2 folders that contains files that are tracked long time ago:</p> <pre><code>$ git status # On branch master # Untracked files: # (use "git add &lt;file&gt;..." to include in what will be co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,735
git
# Git on Windows: Why I suddenly have untracked directory that used to be tracked? When i hit 'git status', it shows 2 folders that contains files that are tracked long time ago: ``` $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # src/UI/...
[Charles Bailey](https://stackoverflow.com/users/19563/charles-bailey) correctly diagnosed the problem in the comments: "`git add`" on a case insensitive Os. It is linked to [issue 286](http://code.google.com/p/msysgit/issues/detail?id=286) of msysgit: "Case Sensitity of Directory Names", and the issue remains (again,...
3174090
What's the simplest way to edit conflicted files in one go when using git and an editor like Vim or textmate?
9
2010-07-04 07:49:25
<p>I'm trying to tweak a little</p> <p>When I type in git status on the commandline, I get a list of files that need to be resolved like so:</p> <pre><code># Unmerged paths: # # (use "git reset HEAD &lt;file&gt;..." to unstage) # (use "git add &lt;file&gt;..." to mark resolution) # # both modified: apache2...
3,431
15,479
2011-08-18 20:02:20
3,175,317
13
2010-07-04 16:11:14
119,963
2010-07-04 16:11:14
https://stackoverflow.com/q/3174090
https://stackoverflow.com/a/3175317
<p>Here are a pair of aliases I have in my gitconfig, taken from the <a href="https://git.wiki.kernel.org/index.php/Aliases#Editing.2Fadding_conflicted_files" rel="noreferrer">git wiki</a>:</p> <pre><code>edit-unmerged = \ "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`" add-unmerged = \ "!f()...
<p>Here are a pair of aliases I have in my gitconfig, taken from the <a href="https://git.wiki.kernel.org/index.php/Aliases#Editing.2Fadding_conflicted_files" rel="noreferrer">git wiki</a>:</p> <pre><code>edit-unmerged = \ "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`" add-unmerged = \ "!f()...
119, 3146, 5025
conflict, editor, git
<h1>What's the simplest way to edit conflicted files in one go when using git and an editor like Vim or textmate?</h1> <p>I'm trying to tweak a little</p> <p>When I type in git status on the commandline, I get a list of files that need to be resolved like so:</p> <pre><code># Unmerged paths: # # (use "git reset HEA...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,736
git
# What's the simplest way to edit conflicted files in one go when using git and an editor like Vim or textmate? I'm trying to tweak a little When I type in git status on the commandline, I get a list of files that need to be resolved like so: ``` # Unmerged paths: # # (use "git reset HEAD <file>..." to unstage) # ...
Here are a pair of aliases I have in my gitconfig, taken from the [git wiki](https://git.wiki.kernel.org/index.php/Aliases#Editing.2Fadding_conflicted_files): ``` edit-unmerged = \ "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`" add-unmerged = \ "!f() { git ls-files --unmerged | cut -f2 | sor...
1294085
How does one clone a git repository with only a non-master branch?
9
2009-08-18 14:00:41
<p>In cases where you don't want to download unneeded files.</p>
5,920
96,257
2009-08-18 16:22:42
1,294,111
13
2009-08-18 14:05:27
43,582
2009-08-18 14:28:00
https://stackoverflow.com/q/1294085
https://stackoverflow.com/a/1294111
<p><code>git clone</code> always clones the complete repository unless you specify the <code>--depth &lt;n&gt;</code> parameter which limits the repository to the latest <em>n</em> revisions (a so-called “shallow clone”).</p> <p>However, you can create a local repository and use <code>git fetch</code> to only fetch pa...
<p><code>git clone</code> always clones the complete repository unless you specify the <code>--depth &lt;n&gt;</code> parameter which limits the repository to the latest <em>n</em> revisions (a so-called “shallow clone”).</p> <p>However, you can create a local repository and use <code>git fetch</code> to only fetch pa...
119
git
<h1>How does one clone a git repository with only a non-master branch?</h1> <p>In cases where you don't want to download unneeded files.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,737
git
# How does one clone a git repository with only a non-master branch? In cases where you don't want to download unneeded files.
`git clone` always clones the complete repository unless you specify the `--depth <n>` parameter which limits the repository to the latest *n* revisions (a so-called “shallow clone”). However, you can create a local repository and use `git fetch` to only fetch parts of the remote repository. ``` cd /path/foo git init...
945372
How to efficiently rebase and push a local git branch?
9
2009-06-03 15:19:41
<p>We're using a central git repository which I've cloned and I'm working on a local branch.</p> <p>When I want to make my changes available in the central repository, I have to issue the following commands (starting on <code>mybranch</code>):</p> <pre><code>#Stash local changes not yet ready for checkin git stash #...
9,981
116,638
2015-09-14 21:27:19
953,034
13
2009-06-04 20:55:06
19,563
2009-06-04 20:55:06
https://stackoverflow.com/q/945372
https://stackoverflow.com/a/953034
<p>There is no need to touch your local master branch if you don't need to update it and this seems to be causing a lot of your unnecessary branch switching.</p> <p>This is a more minimal workflow.</p> <pre><code>git fetch # ensure that everything is committed # perhaps git commit -a is required... git rebase origi...
<p>There is no need to touch your local master branch if you don't need to update it and this seems to be causing a lot of your unnecessary branch switching.</p> <p>This is a more minimal workflow.</p> <pre><code>git fetch # ensure that everything is committed # perhaps git commit -a is required... git rebase origi...
119, 717, 8974
git, merge, rebase
<h1>How to efficiently rebase and push a local git branch?</h1> <p>We're using a central git repository which I've cloned and I'm working on a local branch.</p> <p>When I want to make my changes available in the central repository, I have to issue the following commands (starting on <code>mybranch</code>):</p> <pre><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,738
git
# How to efficiently rebase and push a local git branch? We're using a central git repository which I've cloned and I'm working on a local branch. When I want to make my changes available in the central repository, I have to issue the following commands (starting on `mybranch`): ``` #Stash local changes not yet read...
There is no need to touch your local master branch if you don't need to update it and this seems to be causing a lot of your unnecessary branch switching. This is a more minimal workflow. ``` git fetch # ensure that everything is committed # perhaps git commit -a is required... git rebase origin/master # If you d...
909628
How do I create a new git branch from the changes I have in the working tree?
9
2009-05-26 08:38:26
<p>I have edits to my working tree which I would like to continue working on in a branch. Will <code>git checkout -b new_branch</code> wipe out my current changes to the working tree? If so, how do I create a new branch and switch to it without reverting my working tree?</p>
709
10,728
2009-05-26 11:54:29
909,644
13
2009-05-26 08:43:34
3,146
2009-05-26 08:43:34
https://stackoverflow.com/q/909628
https://stackoverflow.com/a/909644
<p>Just do <code>git checkout -b new_branch</code>. It will create the new branch with the changes in your working tree untouched.</p>
<p>Just do <code>git checkout -b new_branch</code>. It will create the new branch with the changes in your working tree untouched.</p>
119, 1879
branch, git
<h1>How do I create a new git branch from the changes I have in the working tree?</h1> <p>I have edits to my working tree which I would like to continue working on in a branch. Will <code>git checkout -b new_branch</code> wipe out my current changes to the working tree? If so, how do I create a new branch and switch to...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,739
git
# How do I create a new git branch from the changes I have in the working tree? I have edits to my working tree which I would like to continue working on in a branch. Will `git checkout -b new_branch` wipe out my current changes to the working tree? If so, how do I create a new branch and switch to it without revertin...
Just do `git checkout -b new_branch`. It will create the new branch with the changes in your working tree untouched.
70128573
Django Celery with Redis Issues on Digital Ocean App Platform
8
2021-11-26 18:13:47
<p>After quite a bit of trial and error and a step by step attempt to find solutions I thought I share the problems here and answer them myself according to what I've found. There is not too much documentation on this anywhere except small bits and pieces and this will hopefully help others in the future.</p> <p>Please...
2,335
11,829,999
2022-06-09 06:47:30
70,128,574
13
2021-11-26 18:13:47
11,829,999
2021-11-26 18:13:47
https://stackoverflow.com/q/70128573
https://stackoverflow.com/a/70128574
<p><strong>PART 1:</strong></p> <p>While Digital Ocean might remedy this in the future here is an approach that will offer a workaround. The problem is the not supported execution pool. Google &quot;celery execution pools&quot; if you want to know more and how they work. The default one is <code>prefork</code>. But wha...
<p><strong>PART 1:</strong></p> <p>While Digital Ocean might remedy this in the future here is an approach that will offer a workaround. The problem is the not supported execution pool. Google &quot;celery execution pools&quot; if you want to know more and how they work. The default one is <code>prefork</code>. But wha...
243, 43464, 45273, 70330, 97102
celery, celerybeat, digital-ocean, django, redis
<h1>Django Celery with Redis Issues on Digital Ocean App Platform</h1> <p>After quite a bit of trial and error and a step by step attempt to find solutions I thought I share the problems here and answer them myself according to what I've found. There is not too much documentation on this anywhere except small bits and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,741
git
# Django Celery with Redis Issues on Digital Ocean App Platform After quite a bit of trial and error and a step by step attempt to find solutions I thought I share the problems here and answer them myself according to what I've found. There is not too much documentation on this anywhere except small bits and pieces an...
**PART 1:** While Digital Ocean might remedy this in the future here is an approach that will offer a workaround. The problem is the not supported execution pool. Google "celery execution pools" if you want to know more and how they work. The default one is `prefork`. But what you need is either `gevent` or `eventlet`...
67879615
git clone not working with error " To access this repository, you must use the HTTPS remote with a personal access token or SSH with an SSH key"
8
2021-06-07 23:08:01
<p>Git is throwing below error when trying to run the command</p> <pre class="lang-sh prettyprint-override"><code>git clone &lt;&lt;clone url&gt;&gt;: remote: this repository, you must use the HTTPS remote with a personal access token remote: or SSH with an SSH key and passphrase remote: that has been authorized for th...
21,322
4,464,806
2025-03-27 12:43:12
67,881,995
13
2021-06-08 05:41:17
6,309
2021-06-08 05:41:17
https://stackoverflow.com/q/67879615
https://stackoverflow.com/a/67881995
<p>Check that, for your SSH key, you have (<a href="https://stackoverflow.com/a/60146283/6309">as in here</a>):</p> <ul> <li>enable SSO</li> <li>authorize your organization</li> </ul> <p>Then try again, using an SSH URL</p> <pre><code>git clone git@github.com:&lt;organization&gt;/&lt;repo&gt; </code></pre>
<p>Check that, for your SSH key, you have (<a href="https://stackoverflow.com/a/60146283/6309">as in here</a>):</p> <ul> <li>enable SSO</li> <li>authorize your organization</li> </ul> <p>Then try again, using an SSH URL</p> <pre><code>git clone git@github.com:&lt;organization&gt;/&lt;repo&gt; </code></pre>
119, 386
git, ssh
<h1>git clone not working with error " To access this repository, you must use the HTTPS remote with a personal access token or SSH with an SSH key"</h1> <p>Git is throwing below error when trying to run the command</p> <pre class="lang-sh prettyprint-override"><code>git clone &lt;&lt;clone url&gt;&gt;: remote: this re...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,743
git
# git clone not working with error " To access this repository, you must use the HTTPS remote with a personal access token or SSH with an SSH key" Git is throwing below error when trying to run the command ``` git clone <<clone url>>: remote: this repository, you must use the HTTPS remote with a personal access token...
Check that, for your SSH key, you have ([as in here](https://stackoverflow.com/a/60146283/6309)): - enable SSO - authorize your organization Then try again, using an SSH URL ``` git clone git@github.com:<organization>/<repo> ```
65061121
Git repository within docker python image
8
2020-11-29 14:22:21
<p>I have a dockerfile, where my image is python:3.7-alpine.</p> <p>In my project, I use a git repository I need to download. Is there any way to do that ?</p> <p>My Dockerfile :</p> <pre><code>FROM python:3.7-alpine ENV DOCKER_APP True COPY requirements.txt . RUN pip install -r requirements.txt COPY . app/ WORKDI...
14,481
9,947,412
2020-11-29 20:14:46
65,064,697
13
2020-11-29 20:14:46
14,719,161
2020-11-29 20:14:46
https://stackoverflow.com/q/65061121
https://stackoverflow.com/a/65064697
<p>add the following to your dockerfile</p> <pre><code>RUN apk update RUN apk add git </code></pre>
<p>add the following to your dockerfile</p> <pre><code>RUN apk update RUN apk add git </code></pre>
16, 119, 90304
docker, git, python
<h1>Git repository within docker python image</h1> <p>I have a dockerfile, where my image is python:3.7-alpine.</p> <p>In my project, I use a git repository I need to download. Is there any way to do that ?</p> <p>My Dockerfile :</p> <pre><code>FROM python:3.7-alpine ENV DOCKER_APP True COPY requirements.txt . RUN p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,746
git
# Git repository within docker python image I have a dockerfile, where my image is python:3.7-alpine. In my project, I use a git repository I need to download. Is there any way to do that ? My Dockerfile : ``` FROM python:3.7-alpine ENV DOCKER_APP True COPY requirements.txt . RUN pip install -r requirements.txt ...
add the following to your dockerfile ``` RUN apk update RUN apk add git ```
60212973
Can you make git apply with a dry run?
8
2020-02-13 16:56:02
<p>I would like to know, which files would be written when applying a .patch file with git apply.</p> <p>Is there a way to apply a .patch file in git with a dry run? </p>
6,822
8,555,403
2024-01-29 22:49:21
60,213,015
13
2020-02-13 16:57:53
1,057,485
2022-12-05 11:12:48
https://stackoverflow.com/q/60212973
https://stackoverflow.com/a/60213015
<pre><code>git apply --summary path/to/file.patch </code></pre> <p>would output info <em>without</em> applying the patch.</p> <p>See in the <a href="https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---summary" rel="nofollow noreferrer">doc</a>.</p>
<pre><code>git apply --summary path/to/file.patch </code></pre> <p>would output info <em>without</em> applying the patch.</p> <p>See in the <a href="https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---summary" rel="nofollow noreferrer">doc</a>.</p>
119, 2132, 94361
git, git-apply, patch
<h1>Can you make git apply with a dry run?</h1> <p>I would like to know, which files would be written when applying a .patch file with git apply.</p> <p>Is there a way to apply a .patch file in git with a dry run? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,749
git
# Can you make git apply with a dry run? I would like to know, which files would be written when applying a .patch file with git apply. Is there a way to apply a .patch file in git with a dry run?
``` git apply --summary path/to/file.patch ``` would output info *without* applying the patch. See in the [doc](https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---summary).
55348731
Why can't Git resolve remote branches when --single-branch is used?
8
2019-03-26 01:47:17
<p>So, we frequently optimize clones by effectively cloning with --single-branch. However, we are then unable to get additional branches later. What is the difference, plumbing-wise, between a git clone with and without --single-branch? How can we fetch down additional branches later?</p> <p>A standard clone:</p> <pre>...
1,620
706,421
2022-04-30 13:22:25
55,348,897
13
2019-03-26 02:12:58
211,563
2022-04-20 16:30:35
https://stackoverflow.com/q/55348731
https://stackoverflow.com/a/55348897
<p><code>--single-branch</code> works by setting the remote’s <code>fetch</code> property to only be the single branch name, instead of a glob:</p> <pre><code>$ git config --get-all remote.origin.fetch +refs/heads/master:refs/remotes/origin/master </code></pre> <p>So let’s add an entry with <a href="https://git-scm.com...
<p><code>--single-branch</code> works by setting the remote’s <code>fetch</code> property to only be the single branch name, instead of a glob:</p> <pre><code>$ git config --get-all remote.origin.fetch +refs/heads/master:refs/remotes/origin/master </code></pre> <p>So let’s add an entry with <a href="https://git-scm.com...
119
git
<h1>Why can't Git resolve remote branches when --single-branch is used?</h1> <p>So, we frequently optimize clones by effectively cloning with --single-branch. However, we are then unable to get additional branches later. What is the difference, plumbing-wise, between a git clone with and without --single-branch? How ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,750
git
# Why can't Git resolve remote branches when --single-branch is used? So, we frequently optimize clones by effectively cloning with --single-branch. However, we are then unable to get additional branches later. What is the difference, plumbing-wise, between a git clone with and without --single-branch? How can we fetc...
`--single-branch` works by setting the remote’s `fetch` property to only be the single branch name, instead of a glob: ``` $ git config --get-all remote.origin.fetch +refs/heads/master:refs/remotes/origin/master ``` So let’s add an entry with [`git remote set-branches`](https://git-scm.com/docs/git-remote#Documentati...
53525204
How to add git submodule and tag it to a release?
8
2018-11-28 17:42:01
<pre><code>git clone my-new-repo-url mkdir deps cd deps git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git </code></pre> <p>yields</p> <pre><code>fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it Unable to checkout submodule 'deps/tinyxml2' </code></pre> <p>does...
14,376
1,734,357
2018-11-28 17:42:01
53,525,205
13
2018-11-28 17:42:01
1,734,357
2018-11-28 17:42:01
https://stackoverflow.com/q/53525204
https://stackoverflow.com/a/53525205
<p>A branch and a release tag are not the same thing. A branch may continue to be developed and change over time. Having the flag in .gitmodules <code>branch = something</code> means the submodule will track that branch when asked to update.</p> <hr> <p><code>git submodule add https://github.com/leethomason/tinyxml2....
<p>A branch and a release tag are not the same thing. A branch may continue to be developed and change over time. Having the flag in .gitmodules <code>branch = something</code> means the submodule will track that branch when asked to update.</p> <hr> <p><code>git submodule add https://github.com/leethomason/tinyxml2....
119, 41612
git, git-submodules
<h1>How to add git submodule and tag it to a release?</h1> <pre><code>git clone my-new-repo-url mkdir deps cd deps git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git </code></pre> <p>yields</p> <pre><code>fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it Unable t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,751
git
# How to add git submodule and tag it to a release? ``` git clone my-new-repo-url mkdir deps cd deps git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git ``` yields ``` fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it Unable to checkout submodule 'deps/tinyxml2' ...
A branch and a release tag are not the same thing. A branch may continue to be developed and change over time. Having the flag in .gitmodules `branch = something` means the submodule will track that branch when asked to update. --- `git submodule add https://github.com/leethomason/tinyxml2.git` populates .gitmodules ...
49571915
Checkout a commit without updating HEAD
8
2018-03-30 09:33:06
<p>I need to update working directory and index to the state of some commit. When I run <code>git checkout</code> Git updates <code>HEAD</code>, <code>index</code> and a <code>working directory</code>. I know I can checkout a single file from a commit without updating <code>HEAD</code> by simply specifying a path to th...
932
2,545,680
2018-03-30 14:35:25
49,572,040
13
2018-03-30 09:43:16
1,542,723
2018-03-30 14:35:25
https://stackoverflow.com/q/49571915
https://stackoverflow.com/a/49572040
<p>Use <code>git checkout</code> with a <code>dot</code> as a path</p> <pre><code>git checkout COMMIT_ID . </code></pre> <p>From the man page of <a href="https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutemlttree-ishgt--ltpathspecgt82308203" rel="noreferrer">git checkout</a>:</p> <blockquote> <p><cod...
<p>Use <code>git checkout</code> with a <code>dot</code> as a path</p> <pre><code>git checkout COMMIT_ID . </code></pre> <p>From the man page of <a href="https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutemlttree-ishgt--ltpathspecgt82308203" rel="noreferrer">git checkout</a>:</p> <blockquote> <p><cod...
119
git
<h1>Checkout a commit without updating HEAD</h1> <p>I need to update working directory and index to the state of some commit. When I run <code>git checkout</code> Git updates <code>HEAD</code>, <code>index</code> and a <code>working directory</code>. I know I can checkout a single file from a commit without updating <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,753
git
# Checkout a commit without updating HEAD I need to update working directory and index to the state of some commit. When I run `git checkout` Git updates `HEAD`, `index` and a `working directory`. I know I can checkout a single file from a commit without updating `HEAD` by simply specifying a path to the file. But wha...
Use `git checkout` with a `dot` as a path ``` git checkout COMMIT_ID . ``` From the man page of [git checkout](https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutemlttree-ishgt--ltpathspecgt82308203): > `git checkout [<tree-ish>] [--] <pathspec>…​` > > Overwrite paths in the working tree by replacing wi...
48689415
'git clone ...' works but not 'pip install ...' for the same remote url
8
2018-02-08 15:45:08
<p>I want to install a package via pipenv or pip + virtualenv from a private, ssh accessed, remote repository. While cloning works:</p> <pre><code>git clone git@remoteurl:username/package.git </code></pre> <p>directly installing doesn't:</p> <pre><code>pip install git+ssh://git@remoteurl:username/package.git </code>...
3,454
3,767,046
2018-02-08 15:47:58
48,689,468
13
2018-02-08 15:47:58
21,501
2018-02-08 15:47:58
https://stackoverflow.com/q/48689415
https://stackoverflow.com/a/48689468
<blockquote> <p>ssh://git@remoteurl:username/package.git</p> </blockquote> <p>That's the wrong syntax for that kind of URLs.</p> <p>Git understands two syntaxes of SSH URLs:</p> <ul> <li><code>user@host:path/to/repo.git</code></li> <li><code>ssh://user@host/path/to/repo.git</code></li> </ul> <p>So, try:</p> <pre...
<blockquote> <p>ssh://git@remoteurl:username/package.git</p> </blockquote> <p>That's the wrong syntax for that kind of URLs.</p> <p>Git understands two syntaxes of SSH URLs:</p> <ul> <li><code>user@host:path/to/repo.git</code></li> <li><code>ssh://user@host/path/to/repo.git</code></li> </ul> <p>So, try:</p> <pre...
16, 119, 386, 5119, 128625
git, pip, pipenv, python, ssh
<h1>'git clone ...' works but not 'pip install ...' for the same remote url</h1> <p>I want to install a package via pipenv or pip + virtualenv from a private, ssh accessed, remote repository. While cloning works:</p> <pre><code>git clone git@remoteurl:username/package.git </code></pre> <p>directly installing doesn't:...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,754
git
# 'git clone ...' works but not 'pip install ...' for the same remote url I want to install a package via pipenv or pip + virtualenv from a private, ssh accessed, remote repository. While cloning works: ``` git clone git@remoteurl:username/package.git ``` directly installing doesn't: ``` pip install git+ssh://git@r...
> ssh://git@remoteurl:username/package.git That's the wrong syntax for that kind of URLs. Git understands two syntaxes of SSH URLs: - `user@host:path/to/repo.git` - `ssh://user@host/path/to/repo.git` So, try: ``` $ pip install git+ssh://git@remoteurl/username/package.git ```
43170343
git checkout .(dot) interactive
8
2017-04-02 15:53:49
<p>I know <code>git checkout .</code> is one of the most dangerous commands in the git universe (rightfully so). Is there a way to make it interactive? Like how the <code>rm</code> command works with <code>-i</code> option.</p> <p>I am looking for something along the lines of </p> <pre><code>git checkout . -i </code>...
3,062
3,886,740
2017-04-02 16:01:34
43,170,379
13
2017-04-02 15:57:10
35,070
2017-04-02 16:01:34
https://stackoverflow.com/q/43170343
https://stackoverflow.com/a/43170379
<p><code>git checkout</code> (and <code>git add</code> as well) support the <code>-p</code> option, which will ask you for every hunk, like this:</p> <pre><code>diff --git a/post.so b/post.so index b111bdd..ddba6b1 100644 --- a/post.so +++ b/post.so @@ -1 +1,3 @@ -`git checkout` (and `git add` as well) support the `-p...
<p><code>git checkout</code> (and <code>git add</code> as well) support the <code>-p</code> option, which will ask you for every hunk, like this:</p> <pre><code>diff --git a/post.so b/post.so index b111bdd..ddba6b1 100644 --- a/post.so +++ b/post.so @@ -1 +1,3 @@ -`git checkout` (and `git add` as well) support the `-p...
119
git
<h1>git checkout .(dot) interactive</h1> <p>I know <code>git checkout .</code> is one of the most dangerous commands in the git universe (rightfully so). Is there a way to make it interactive? Like how the <code>rm</code> command works with <code>-i</code> option.</p> <p>I am looking for something along the lines of <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,756
git
# git checkout .(dot) interactive I know `git checkout .` is one of the most dangerous commands in the git universe (rightfully so). Is there a way to make it interactive? Like how the `rm` command works with `-i` option. I am looking for something along the lines of ``` git checkout . -i ```
`git checkout` (and `git add` as well) support the `-p` option, which will ask you for every hunk, like this: ``` diff --git a/post.so b/post.so index b111bdd..ddba6b1 100644 --- a/post.so +++ b/post.so @@ -1 +1,3 @@ -`git checkout` (and `git add` as well) support the `-p` option. +`git checkout` (and `git add` as wel...
39581198
How do you make `git grep` output look like `ack` output?
8
2016-09-19 20:04:23
<p>I've recently found <code>git grep</code> and come to like its speed and de facto searching of only the files in the repo. But coming from <code>ack</code> (<code>ack-grep</code> in Ubuntu), one thing left to be desired is the output formatting, which is unfortunately much more like <code>grep</code> than <code>ack<...
1,878
2,125,392
2020-05-26 08:39:51
39,583,968
13
2016-09-20 00:28:03
1,256,452
2018-03-30 20:10:12
https://stackoverflow.com/q/39581198
https://stackoverflow.com/a/39583968
<p>You've already answered part of your own question (<code>--break</code> inserts a blank line between files, <code>--heading</code> prints the file name separately, and <code>-n</code> or <code>--line-number</code> gives you line numbers on each line).</p> <p>The rest is just color options, which are <a href="https:...
<p>You've already answered part of your own question (<code>--break</code> inserts a blank line between files, <code>--heading</code> prints the file name separately, and <code>-n</code> or <code>--line-number</code> gives you line numbers on each line).</p> <p>The rest is just color options, which are <a href="https:...
119, 1271, 26784
ack, git, grep
<h1>How do you make `git grep` output look like `ack` output?</h1> <p>I've recently found <code>git grep</code> and come to like its speed and de facto searching of only the files in the repo. But coming from <code>ack</code> (<code>ack-grep</code> in Ubuntu), one thing left to be desired is the output formatting, whic...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,759
git
# How do you make `git grep` output look like `ack` output? I've recently found `git grep` and come to like its speed and de facto searching of only the files in the repo. But coming from `ack` (`ack-grep` in Ubuntu), one thing left to be desired is the output formatting, which is unfortunately much more like `grep` t...
You've already answered part of your own question (`--break` inserts a blank line between files, `--heading` prints the file name separately, and `-n` or `--line-number` gives you line numbers on each line). The rest is just color options, which are [set in `git config`](https://www.kernel.org/pub/software/scm/git/doc...
39514510
Exclude directories from tar archive with a .tarignore file
8
2016-09-15 15:07:26
<p>In a similar way to <code>.gitignore</code>, is it possible to do that a <code>.tarignore</code> file in a subdirectory makes it excluded from archive when doing</p> <pre><code>tar cfjvh backup.tar.bz2 . </code></pre> <p>(I know the <code>--exclude</code> parameter of <code>tar</code> but here it's not what I want...
10,209
1,422,096
2022-07-19 10:01:06
39,521,013
13
2016-09-15 22:03:58
164,344
2021-12-01 23:13:27
https://stackoverflow.com/q/39514510
https://stackoverflow.com/a/39521013
<p>Using the <a href="https://www.gnu.org/software/tar/manual/html_node/exclude.html#index-exclude_002dignore" rel="noreferrer"><code>--exclude-ignore=.tarignore</code></a> option causes Tar to use <code>.tarignore</code> files in a similar way that git uses <code>.gitignore</code> files. Use the same syntax as you wou...
<p>Using the <a href="https://www.gnu.org/software/tar/manual/html_node/exclude.html#index-exclude_002dignore" rel="noreferrer"><code>--exclude-ignore=.tarignore</code></a> option causes Tar to use <code>.tarignore</code> files in a similar way that git uses <code>.gitignore</code> files. Use the same syntax as you wou...
58, 4333, 8773, 9655, 25056
archive, gitignore, ignore, linux, tar
<h1>Exclude directories from tar archive with a .tarignore file</h1> <p>In a similar way to <code>.gitignore</code>, is it possible to do that a <code>.tarignore</code> file in a subdirectory makes it excluded from archive when doing</p> <pre><code>tar cfjvh backup.tar.bz2 . </code></pre> <p>(I know the <code>--exclu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,760
git
# Exclude directories from tar archive with a .tarignore file In a similar way to `.gitignore`, is it possible to do that a `.tarignore` file in a subdirectory makes it excluded from archive when doing ``` tar cfjvh backup.tar.bz2 . ``` (I know the `--exclude` parameter of `tar` but here it's not what I want).
Using the [`--exclude-ignore=.tarignore`](https://www.gnu.org/software/tar/manual/html_node/exclude.html#index-exclude_002dignore) option causes Tar to use `.tarignore` files in a similar way that git uses `.gitignore` files. Use the same syntax as you would usually use in `.gitignore` files, so if you want to ignore a...
38652605
Pull from git while having unpushed commits
8
2016-07-29 07:11:15
<p>I have several commits that aren't pushed yet. But there're several new commits in the repository. I want to pull the new commits and push my commits, but I'm not sure what's the correct way to do this. If I do a pull as is I think it tries to merge and I'm not sure what becomes of my commits, please suggest what's ...
5,456
1,779,743
2016-07-29 13:37:52
38,652,699
13
2016-07-29 07:15:46
1,863,229
2016-07-29 07:15:46
https://stackoverflow.com/q/38652605
https://stackoverflow.com/a/38652699
<p>You have two main options here, you can either merge the remote branch into your branch then push, or you can rebase your branch on the remote, and then fast-forward the remote branch.</p> <p><strong>Option 1: merge</strong></p> <pre><code>git pull origin yourBranch # does a fetch, followed by a merge gi...
<p>You have two main options here, you can either merge the remote branch into your branch then push, or you can rebase your branch on the remote, and then fast-forward the remote branch.</p> <p><strong>Option 1: merge</strong></p> <pre><code>git pull origin yourBranch # does a fetch, followed by a merge gi...
119, 28896, 28898
git, git-pull, git-push
<h1>Pull from git while having unpushed commits</h1> <p>I have several commits that aren't pushed yet. But there're several new commits in the repository. I want to pull the new commits and push my commits, but I'm not sure what's the correct way to do this. If I do a pull as is I think it tries to merge and I'm not su...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,761
git
# Pull from git while having unpushed commits I have several commits that aren't pushed yet. But there're several new commits in the repository. I want to pull the new commits and push my commits, but I'm not sure what's the correct way to do this. If I do a pull as is I think it tries to merge and I'm not sure what b...
You have two main options here, you can either merge the remote branch into your branch then push, or you can rebase your branch on the remote, and then fast-forward the remote branch. **Option 1: merge** ``` git pull origin yourBranch # does a fetch, followed by a merge git push origin yourBranch ...
32029063
How do I tell all my AWS EC2 instances to pull from git / codecommit?
8
2015-08-15 20:30:00
<p>I am using AWS CodeCommit which seems to be like a stripped down version of git.</p> <p>If all these EC2 instances have the same role tag how do I accomplish this?</p> <p>I don't want to do anything fancy, all I want is to be specify a tag, click a button and all those EC2 instances with that tag pull for CodeComm...
5,286
964,634
2015-09-05 01:36:00
32,407,664
13
2015-09-04 22:57:55
5,095,975
2015-09-05 01:36:00
https://stackoverflow.com/q/32029063
https://stackoverflow.com/a/32407664
<p>For EC2 instances that are launched with an IAM role, you don't even have to bake in SSH keys. Git can get CodeCommit credentials from the EC2 instance metadata. Bake a Linux-based AMI with the latest AWS CLI package and the following lines in ~/.gitconfig:</p> <pre><code>[credential] helper = !aws --profile ...
<p>For EC2 instances that are launched with an IAM role, you don't even have to bake in SSH keys. Git can get CodeCommit credentials from the EC2 instance metadata. Bake a Linux-based AMI with the latest AWS CLI package and the following lines in ~/.gitconfig:</p> <pre><code>[credential] helper = !aws --profile ...
119, 12375, 33388, 114185
amazon-ec2, amazon-web-services, aws-codecommit, git
<h1>How do I tell all my AWS EC2 instances to pull from git / codecommit?</h1> <p>I am using AWS CodeCommit which seems to be like a stripped down version of git.</p> <p>If all these EC2 instances have the same role tag how do I accomplish this?</p> <p>I don't want to do anything fancy, all I want is to be specify a ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,764
git
# How do I tell all my AWS EC2 instances to pull from git / codecommit? I am using AWS CodeCommit which seems to be like a stripped down version of git. If all these EC2 instances have the same role tag how do I accomplish this? I don't want to do anything fancy, all I want is to be specify a tag, click a button and...
For EC2 instances that are launched with an IAM role, you don't even have to bake in SSH keys. Git can get CodeCommit credentials from the EC2 instance metadata. Bake a Linux-based AMI with the latest AWS CLI package and the following lines in ~/.gitconfig: ``` [credential] helper = !aws --profile default codecomm...
30265980
Android studio git message: following untracked working tree files would be overwritten by merge, but not showing which files
8
2015-05-15 18:02:03
<p>I'm working on an android project in android studio and using VCS for working on git with the other members of the team. Last time I tried to pull from origin, the following error came up: "following untracked working tree files would be overwritten by merge", but it doesn't show me any file that caused the error. I...
11,692
4,116,960
2015-05-15 18:26:58
30,266,388
13
2015-05-15 18:26:58
1,992,360
2015-05-15 18:26:58
https://stackoverflow.com/q/30265980
https://stackoverflow.com/a/30266388
<p>When you pull files from a remote branch your working directory should be clean. Try <code>git status</code>(check if there are modified files in your working directory) -- it will show a list of files. Stash the changes/ reset them and try pulling again. This time it will work!</p>
<p>When you pull files from a remote branch your working directory should be clean. Try <code>git status</code>(check if there are modified files in your working directory) -- it will show a list of files. Stash the changes/ reset them and try pulling again. This time it will work!</p>
119, 1386, 28896
android, git, git-pull
<h1>Android studio git message: following untracked working tree files would be overwritten by merge, but not showing which files</h1> <p>I'm working on an android project in android studio and using VCS for working on git with the other members of the team. Last time I tried to pull from origin, the following error ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,766
git
# Android studio git message: following untracked working tree files would be overwritten by merge, but not showing which files I'm working on an android project in android studio and using VCS for working on git with the other members of the team. Last time I tried to pull from origin, the following error came up: "f...
When you pull files from a remote branch your working directory should be clean. Try `git status`(check if there are modified files in your working directory) -- it will show a list of files. Stash the changes/ reset them and try pulling again. This time it will work!
29209516
How can I make a complex octopus merge?
8
2015-03-23 11:51:56
<p>I just make 8 different suggestions off of the tip of master, and I want to make a commit that merges all of them together. I've done the merges by manually resolving merge conflicts one-by-one (and then squashed them together with <code>git merge --squash</code>), but now, when I try to make an octopus merge commit...
2,450
34,799
2025-04-23 17:55:58
29,209,881
13
2015-03-23 12:10:38
24,762
2015-03-23 12:10:38
https://stackoverflow.com/q/29209516
https://stackoverflow.com/a/29209881
<p>It sounds like you have a tree with the right content, and now you want to create a commit with that content and the right parents. I'm not entirely sure how you'd use git porcelains to make the commits you want, but as you've got the plumbing accessible to you, you may use that directly if you'd like.</p> <p>If y...
<p>It sounds like you have a tree with the right content, and now you want to create a commit with that content and the right parents. I'm not entirely sure how you'd use git porcelains to make the commits you want, but as you've got the plumbing accessible to you, you may use that directly if you'd like.</p> <p>If y...
119, 717
git, merge
<h1>How can I make a complex octopus merge?</h1> <p>I just make 8 different suggestions off of the tip of master, and I want to make a commit that merges all of them together. I've done the merges by manually resolving merge conflicts one-by-one (and then squashed them together with <code>git merge --squash</code>), bu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,767
git
# How can I make a complex octopus merge? I just make 8 different suggestions off of the tip of master, and I want to make a commit that merges all of them together. I've done the merges by manually resolving merge conflicts one-by-one (and then squashed them together with `git merge --squash`), but now, when I try to...
It sounds like you have a tree with the right content, and now you want to create a commit with that content and the right parents. I'm not entirely sure how you'd use git porcelains to make the commits you want, but as you've got the plumbing accessible to you, you may use that directly if you'd like. If you've got a...
28983458
How to split a branch in two with Git?
8
2015-03-11 09:59:43
<p>I've made a <code>feature</code> branch from <code>master</code> and then realize at some point that it will be better to start a new branch from this branch. </p> <p>So, how to split a branch in two at a specific commit ?</p> <p>Let me explain with this little schema:</p> <p>I have this:</p> <pre><code>master ─...
3,133
717,147
2025-07-20 09:26:49
28,983,843
13
2015-03-11 10:16:33
6,309
2025-07-20 09:26:49
https://stackoverflow.com/q/28983458
https://stackoverflow.com/a/28983843
<p>The first step is to create <code>feature_test</code> where <code>feature</code> is:</p> <pre><code>git switch -c feature-test feature </code></pre> <p>But you <em>also</em> need to reset <code>feature</code> to <code>&lt;sha1 split here&gt;</code>:</p> <pre><code>git switch -C feature &lt;sha1 split here&gt; </code...
<p>The first step is to create <code>feature_test</code> where <code>feature</code> is:</p> <pre><code>git switch -c feature-test feature </code></pre> <p>But you <em>also</em> need to reset <code>feature</code> to <code>&lt;sha1 split here&gt;</code>:</p> <pre><code>git switch -C feature &lt;sha1 split here&gt; </code...
119, 1879, 2193, 4257, 8974
branch, cut, git, rebase, split
<h1>How to split a branch in two with Git?</h1> <p>I've made a <code>feature</code> branch from <code>master</code> and then realize at some point that it will be better to start a new branch from this branch. </p> <p>So, how to split a branch in two at a specific commit ?</p> <p>Let me explain with this little schem...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,768
git
# How to split a branch in two with Git? I've made a `feature` branch from `master` and then realize at some point that it will be better to start a new branch from this branch. So, how to split a branch in two at a specific commit ? Let me explain with this little schema: I have this: ``` master ───●──●──●──●──●─...
The first step is to create `feature_test` where `feature` is: ``` git switch -c feature-test feature ``` But you *also* need to reset `feature` to `<sha1 split here>`: ``` git switch -C feature <sha1 split here> ``` Note that if you already pushed `feature`, you will need to do a `git push --force`. And that mig...
28875670
How to automatically add a prefix to commit messages?
8
2015-03-05 10:31:56
<p>Is it possible to define a global prefix for all the commit messages relating to a specific repository ? </p>
6,721
1,448,340
2020-09-10 10:47:01
28,875,772
13
2015-03-05 10:36:23
1,794,631
2020-09-10 10:47:01
https://stackoverflow.com/q/28875670
https://stackoverflow.com/a/28875772
<p>You can use the <code>commit.template</code> setting as discussed <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_commit_template" rel="nofollow noreferrer">here</a></p> <pre><code>$ git config commit.template /path/to/git-commit-template.txt </code></pre> <p>This will set the template for...
<p>You can use the <code>commit.template</code> setting as discussed <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_commit_template" rel="nofollow noreferrer">here</a></p> <pre><code>$ git config commit.template /path/to/git-commit-template.txt </code></pre> <p>This will set the template for...
119
git
<h1>How to automatically add a prefix to commit messages?</h1> <p>Is it possible to define a global prefix for all the commit messages relating to a specific repository ? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,769
git
# How to automatically add a prefix to commit messages? Is it possible to define a global prefix for all the commit messages relating to a specific repository ?
You can use the `commit.template` setting as discussed [here](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_commit_template) ``` $ git config commit.template /path/to/git-commit-template.txt ``` This will set the template for the current repository only. You can add the `--global` flag to apply to...
25315687
Ignore specific files when pulling from forked upstream origin
8
2014-08-14 18:59:46
<p>In git, how do you exempt certain files when pulling from an upstream origin (i.e. the original project)?</p> <p>I have a project that I'm working on that was originally forked from a repository that is very active. I've added the original as a remote named "upstream" so that it's possible to run:</p> <pre><code>g...
6,572
1,284,725
2014-08-14 21:36:45
25,315,991
13
2014-08-14 19:20:06
1,587,370
2014-08-14 20:52:00
https://stackoverflow.com/q/25315687
https://stackoverflow.com/a/25315991
<p>Yes you can do that.</p> <blockquote> <p><strong>git pull is shorthand for git fetch followed by git merge FETCH_HEAD</strong></p> </blockquote> <p>So first you can do a,</p> <pre><code>git fetch upstream </code></pre> <p>followed by,</p> <pre><code>git merge --no-log --no-ff --no-commit upstream/branch </cod...
<p>Yes you can do that.</p> <blockquote> <p><strong>git pull is shorthand for git fetch followed by git merge FETCH_HEAD</strong></p> </blockquote> <p>So first you can do a,</p> <pre><code>git fetch upstream </code></pre> <p>followed by,</p> <pre><code>git merge --no-log --no-ff --no-commit upstream/branch </cod...
119, 4860
git, pull
<h1>Ignore specific files when pulling from forked upstream origin</h1> <p>In git, how do you exempt certain files when pulling from an upstream origin (i.e. the original project)?</p> <p>I have a project that I'm working on that was originally forked from a repository that is very active. I've added the original as a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,770
git
# Ignore specific files when pulling from forked upstream origin In git, how do you exempt certain files when pulling from an upstream origin (i.e. the original project)? I have a project that I'm working on that was originally forked from a repository that is very active. I've added the original as a remote named "u...
Yes you can do that. > **git pull is shorthand for git fetch followed by git merge FETCH_HEAD** So first you can do a, ``` git fetch upstream ``` followed by, ``` git merge --no-log --no-ff --no-commit upstream/branch ``` Git will stop before committing. So, you should be able to modify the merge, and exclude the...
19580194
Can I set an alias in git for "pull --rebase"?
8
2013-10-25 02:37:34
<p>I'm using git to create alias with this command:</p> <pre><code>git config --global alias.pr=pull --rebase </code></pre> <p>But it reminds me that: </p> <pre><code>error: invalid key: alias.pr=pull </code></pre> <p>I also tried:</p> <pre><code>git config --global alias.pr="pull --rebase" git config --global ali...
5,526
342,235
2018-09-05 21:14:49
19,580,518
13
2013-10-25 03:19:10
2,888,753
2013-10-25 03:19:10
https://stackoverflow.com/q/19580194
https://stackoverflow.com/a/19580518
<p>Do not use the equals character in your commands, and use quotation marks around the contents you want to provide an alias for, for example:</p> <pre><code>git config --global alias.pr 'pull --rebase' </code></pre> <p>Alternatively, you can set up your aliases by directly editing your <code>.gitconfig</code> file....
<p>Do not use the equals character in your commands, and use quotation marks around the contents you want to provide an alias for, for example:</p> <pre><code>git config --global alias.pr 'pull --rebase' </code></pre> <p>Alternatively, you can set up your aliases by directly editing your <code>.gitconfig</code> file....
119, 1448
alias, git
<h1>Can I set an alias in git for "pull --rebase"?</h1> <p>I'm using git to create alias with this command:</p> <pre><code>git config --global alias.pr=pull --rebase </code></pre> <p>But it reminds me that: </p> <pre><code>error: invalid key: alias.pr=pull </code></pre> <p>I also tried:</p> <pre><code>git config -...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,771
git
# Can I set an alias in git for "pull --rebase"? I'm using git to create alias with this command: ``` git config --global alias.pr=pull --rebase ``` But it reminds me that: ``` error: invalid key: alias.pr=pull ``` I also tried: ``` git config --global alias.pr="pull --rebase" git config --global alias.pr='pull -...
Do not use the equals character in your commands, and use quotation marks around the contents you want to provide an alias for, for example: ``` git config --global alias.pr 'pull --rebase' ``` Alternatively, you can set up your aliases by directly editing your `.gitconfig` file. See this **[link](https://git.wiki.ke...
18910305
Strange behavior from git log --since
8
2013-09-20 06:34:50
<p>I have a test repository with 18 commits. <code>git log | grep Date:</code> returns the following: </p> <pre><code>Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200 Date: Thu Sep 19 09:53:10 2013 +0200 Date: Wed Sep 18 17:04:41 2013 +0200 Date:...
3,926
2,247,747
2017-11-09 12:12:04
18,911,032
13
2013-09-20 07:20:22
506,613
2017-11-09 12:12:04
https://stackoverflow.com/q/18910305
https://stackoverflow.com/a/18911032
<p>By default, the date in <code>git log</code> will show in the default format.</p> <blockquote> <p>--date=default shows timestamps in the original timezone (either committer’s or author’s).</p> </blockquote> <p>Based on <a href="https://www.kernel.org/pub/software/scm/git/docs/git-log.html" rel="noreferrer">Git help ...
<p>By default, the date in <code>git log</code> will show in the default format.</p> <blockquote> <p>--date=default shows timestamps in the original timezone (either committer’s or author’s).</p> </blockquote> <p>Based on <a href="https://www.kernel.org/pub/software/scm/git/docs/git-log.html" rel="noreferrer">Git help ...
119
git
<h1>Strange behavior from git log --since</h1> <p>I have a test repository with 18 commits. <code>git log | grep Date:</code> returns the following: </p> <pre><code>Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200 Date: Thu Sep 19 09:53:10 2013 +02...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,772
git
# Strange behavior from git log --since I have a test repository with 18 commits. `git log | grep Date:` returns the following: ``` Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200 Date: Thu Sep 19 09:53:10 2013 +0200 Date: Wed Sep 18 17:04:41 20...
By default, the date in `git log` will show in the default format. > --date=default shows timestamps in the original timezone (either committer’s or author’s). Based on [Git help log](https://www.kernel.org/pub/software/scm/git/docs/git-log.html) > --date=local shows timestamps in user’s local timezone. > > --date=d...
16286517
How to "toggle" the date format of git-log? How to display both relative and absolute dates simultaneously in the same git log?
8
2013-04-29 19:19:34
<p>My current default git log line runs as follows:</p> <pre><code>git log --graph --date=relative --pretty=format:'%Cblue%h%Creset %Cgreen(%cr)%Creset -%C(yellow)%d%Creset %s' --abbrev-commit -7 </code></pre> <p>Sometimes, however, I'd prefer an absolute date/time format, rather than relative, so I tried: <code>--da...
3,363
2,153,622
2013-04-29 19:26:47
16,286,647
13
2013-04-29 19:26:47
477,878
2013-04-29 19:26:47
https://stackoverflow.com/q/16286517
https://stackoverflow.com/a/16286647
<blockquote> <p>--pretty=format:'%Cblue%h%Creset %Cgreen(<strong>%cr</strong>)%Creset -%C(yellow)%d%Creset %s'</p> </blockquote> <p><code>%cr</code> in a format string means relative committer date.</p> <p>From <code>git help log</code>;</p> <ul> <li><code>%cd</code>: committer date</li> <li><code>%cD</code>: comm...
<blockquote> <p>--pretty=format:'%Cblue%h%Creset %Cgreen(<strong>%cr</strong>)%Creset -%C(yellow)%d%Creset %s'</p> </blockquote> <p><code>%cr</code> in a format string means relative committer date.</p> <p>From <code>git help log</code>;</p> <ul> <li><code>%cd</code>: committer date</li> <li><code>%cD</code>: comm...
119, 5002, 47913
date, git, git-log
<h1>How to "toggle" the date format of git-log? How to display both relative and absolute dates simultaneously in the same git log?</h1> <p>My current default git log line runs as follows:</p> <pre><code>git log --graph --date=relative --pretty=format:'%Cblue%h%Creset %Cgreen(%cr)%Creset -%C(yellow)%d%Creset %s' --abb...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,773
git
# How to "toggle" the date format of git-log? How to display both relative and absolute dates simultaneously in the same git log? My current default git log line runs as follows: ``` git log --graph --date=relative --pretty=format:'%Cblue%h%Creset %Cgreen(%cr)%Creset -%C(yellow)%d%Creset %s' --abbrev-commit -7 ``` S...
> --pretty=format:'%Cblue%h%Creset %Cgreen(**%cr**)%Creset -%C(yellow)%d%Creset %s' `%cr` in a format string means relative committer date. From `git help log`; - `%cd`: committer date - `%cD`: committer date, RFC2822 style - `%cr`: committer date, relative - `%ct`: committer date, UNIX timestamp - `%ci`: committer ...
11518818
Add php composer packages to my git repository
8
2012-07-17 08:36:14
<p>I've installed composer and added some packages via 'composer install'. It installed them under "my_project\vendor" path but some of the packages were cloned using git, so when I committed "my_project", those cloned packages were ignored. </p> <p>The problem is that when other developers are cloning "my_project", t...
6,043
224,743
2013-03-07 23:20:38
15,283,807
13
2013-03-07 23:20:38
186,623
2013-03-07 23:20:38
https://stackoverflow.com/q/11518818
https://stackoverflow.com/a/15283807
<p>Preface: Jordi - I love composer, keep up the great work, and if I'm mistaken on any of this let me know and I'll both update my workflow and edit the post :D</p> <hr> <p>Unfortunately this isn't the "general recommendation" depending on who you ask, it's by far a developer-only perspective. And the caveats to us...
<p>Preface: Jordi - I love composer, keep up the great work, and if I'm mistaken on any of this let me know and I'll both update my workflow and edit the post :D</p> <hr> <p>Unfortunately this isn't the "general recommendation" depending on who you ask, it's by far a developer-only perspective. And the caveats to us...
5, 41612, 78546
composer-php, git-submodules, php
<h1>Add php composer packages to my git repository</h1> <p>I've installed composer and added some packages via 'composer install'. It installed them under "my_project\vendor" path but some of the packages were cloned using git, so when I committed "my_project", those cloned packages were ignored. </p> <p>The problem i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,774
git
# Add php composer packages to my git repository I've installed composer and added some packages via 'composer install'. It installed them under "my_project\vendor" path but some of the packages were cloned using git, so when I committed "my_project", those cloned packages were ignored. The problem is that when other...
Preface: Jordi - I love composer, keep up the great work, and if I'm mistaken on any of this let me know and I'll both update my workflow and edit the post :D --- Unfortunately this isn't the "general recommendation" depending on who you ask, it's by far a developer-only perspective. And the caveats to using the prac...
15192485
How to disable SSH in GitBash and use HTTPS instead
8
2013-03-04 00:00:52
<p>I'm using SSH at the moment when connecting to Bitbucket and suddenly the port 22 where Bitbucket uses has been blocked so I decided to use HTTPS option instead. How to disable the ssh in git bash and use HTTPS instead? I already reinstalled git but it still it uses SSH/Putty to connect.</p> <p>Thanks.</p>
24,751
1,420,723
2013-03-04 01:20:09
15,192,517
13
2013-03-04 00:04:49
11,343
2013-03-04 00:12:14
https://stackoverflow.com/q/15192485
https://stackoverflow.com/a/15192517
<p>It's not at git settings, but in your repository settings.</p> <p>You need to change the address of your remote repository and specify the <code>https://</code> protocol</p> <pre><code>git remote set-url origin &lt;repo-https-url&gt; </code></pre> <p>However with https you'll have to type your password on each pu...
<p>It's not at git settings, but in your repository settings.</p> <p>You need to change the address of your remote repository and specify the <code>https://</code> protocol</p> <pre><code>git remote set-url origin &lt;repo-https-url&gt; </code></pre> <p>However with https you'll have to type your password on each pu...
119, 386, 642
git, https, ssh
<h1>How to disable SSH in GitBash and use HTTPS instead</h1> <p>I'm using SSH at the moment when connecting to Bitbucket and suddenly the port 22 where Bitbucket uses has been blocked so I decided to use HTTPS option instead. How to disable the ssh in git bash and use HTTPS instead? I already reinstalled git but it sti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,775
git
# How to disable SSH in GitBash and use HTTPS instead I'm using SSH at the moment when connecting to Bitbucket and suddenly the port 22 where Bitbucket uses has been blocked so I decided to use HTTPS option instead. How to disable the ssh in git bash and use HTTPS instead? I already reinstalled git but it still it use...
It's not at git settings, but in your repository settings. You need to change the address of your remote repository and specify the `https://` protocol ``` git remote set-url origin <repo-https-url> ``` However with https you'll have to type your password on each push/pull operation, but see [Is there a way to skip ...
15167797
Update local master to remote master from another branch
8
2013-03-01 22:16:33
<p>I have a <strong>devel</strong> branch and <strong>origin/master</strong> has been updated. I run <code>git pull</code> and I can see the remote changes. However, my local <strong>master</strong> is still where I left it when I previously did <code>git checkout devel</code>. I want to merge the <strong>origin/ma...
7,731
1,880,339
2015-01-15 23:10:25
15,167,856
13
2013-03-01 22:21:47
582
2013-03-01 22:21:47
https://stackoverflow.com/q/15167797
https://stackoverflow.com/a/15167856
<p>The only difference between updating your local <code>master</code> to <code>origin/master</code> and then merging it, vs. just merging <code>origin/master</code> directly, is the pre-generated commit message on the merge (well, assuming you eventually update <code>master</code>). So I say just merge in <code>origin...
<p>The only difference between updating your local <code>master</code> to <code>origin/master</code> and then merging it, vs. just merging <code>origin/master</code> directly, is the pre-generated commit message on the merge (well, assuming you eventually update <code>master</code>). So I say just merge in <code>origin...
119
git
<h1>Update local master to remote master from another branch</h1> <p>I have a <strong>devel</strong> branch and <strong>origin/master</strong> has been updated. I run <code>git pull</code> and I can see the remote changes. However, my local <strong>master</strong> is still where I left it when I previously did <code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,776
git
# Update local master to remote master from another branch I have a **devel** branch and **origin/master** has been updated. I run `git pull` and I can see the remote changes. However, my local **master** is still where I left it when I previously did `git checkout devel`. I want to merge the **origin/master** changes...
The only difference between updating your local `master` to `origin/master` and then merging it, vs. just merging `origin/master` directly, is the pre-generated commit message on the merge (well, assuming you eventually update `master`). So I say just merge in `origin/master`. --- That said, to answer the question "h...
14829436
How to checkout old version of folder in git
8
2013-02-12 09:36:29
<p>I need to pull changes from origin. Problem is that one of libs was updated to newest version and it crashes my part of application. I would like to pull recent changes and then go back to previous (or specific) version for only one folder, which contains that problem causing lib. Is there any way to do that?</p>
9,734
356,959
2013-02-12 09:41:17
14,829,505
13
2013-02-12 09:41:17
113,195
2013-02-12 09:41:17
https://stackoverflow.com/q/14829436
https://stackoverflow.com/a/14829505
<pre><code>git checkout LAST_WORKING_COMMIT -- vendor/library/in/question </code></pre> <p>This will check out the folder in the version of <code>LAST_WORKING_COMMIT</code>. However, <code>git status</code> will then tell, that the files are modified:</p> <pre><code>$ git status # On branch master # Changes not stage...
<pre><code>git checkout LAST_WORKING_COMMIT -- vendor/library/in/question </code></pre> <p>This will check out the folder in the version of <code>LAST_WORKING_COMMIT</code>. However, <code>git status</code> will then tell, that the files are modified:</p> <pre><code>$ git status # On branch master # Changes not stage...
119
git
<h1>How to checkout old version of folder in git</h1> <p>I need to pull changes from origin. Problem is that one of libs was updated to newest version and it crashes my part of application. I would like to pull recent changes and then go back to previous (or specific) version for only one folder, which contains that pr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,777
git
# How to checkout old version of folder in git I need to pull changes from origin. Problem is that one of libs was updated to newest version and it crashes my part of application. I would like to pull recent changes and then go back to previous (or specific) version for only one folder, which contains that problem cau...
``` git checkout LAST_WORKING_COMMIT -- vendor/library/in/question ``` This will check out the folder in the version of `LAST_WORKING_COMMIT`. However, `git status` will then tell, that the files are modified: ``` $ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update ...
14615992
Remove a folder from Git
8
2013-01-30 23:43:58
<p>I have a local folder that is under git, when I was playing with some git stuff in different IDES, etc it got added to the git but I don't want it to be under git control, I just want it to be a normal folder for now! until I decide to add it to some repo later.</p> <p>I am new to git so don't know much commands bu...
13,763
320,724
2013-01-31 00:02:23
14,616,086
13
2013-01-30 23:52:38
77,939
2013-01-30 23:52:38
https://stackoverflow.com/q/14615992
https://stackoverflow.com/a/14616086
<p>It sounds like you want to remove a git <em>repository</em> that was automatically created by an IDE. (Note that <code>git</code> doesn't track <em>folders</em>, only files.)</p> <p>If that's the case, just remove the <code>.git</code> directory and you'll be left with a folder that isn't tracked by git at all.</p>...
<p>It sounds like you want to remove a git <em>repository</em> that was automatically created by an IDE. (Note that <code>git</code> doesn't track <em>folders</em>, only files.)</p> <p>If that's the case, just remove the <code>.git</code> directory and you'll be left with a folder that isn't tracked by git at all.</p>...
119
git
<h1>Remove a folder from Git</h1> <p>I have a local folder that is under git, when I was playing with some git stuff in different IDES, etc it got added to the git but I don't want it to be under git control, I just want it to be a normal folder for now! until I decide to add it to some repo later.</p> <p>I am new to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,778
git
# Remove a folder from Git I have a local folder that is under git, when I was playing with some git stuff in different IDES, etc it got added to the git but I don't want it to be under git control, I just want it to be a normal folder for now! until I decide to add it to some repo later. I am new to git so don't kno...
It sounds like you want to remove a git *repository* that was automatically created by an IDE. (Note that `git` doesn't track *folders*, only files.) If that's the case, just remove the `.git` directory and you'll be left with a folder that isn't tracked by git at all.
13226281
How can I get a Git log from local and/or remote HEAD?
8
2012-11-05 05:14:02
<p>I am originally an SVN user.</p> <p>In Git, <code>git log</code> shows only the log from the current commit.</p> <p>How can I get the log from <code>HEAD</code>?</p>
33,277
278,235
2023-09-28 20:22:44
13,226,324
13
2012-11-05 05:19:58
1,365,319
2012-11-08 05:58:21
https://stackoverflow.com/q/13226281
https://stackoverflow.com/a/13226324
<p>To get log from server-side HEAD, you need to fetch changes from the server first. Unlike <code>pull</code>, <code>fetch</code> is not going to affect your working tree. So, it's safe.</p> <ol> <li><p><code>git fetch origin</code></p> <p>Here <code>origin</code> is your remote repo. This command fetches the latest...
<p>To get log from server-side HEAD, you need to fetch changes from the server first. Unlike <code>pull</code>, <code>fetch</code> is not going to affect your working tree. So, it's safe.</p> <ol> <li><p><code>git fetch origin</code></p> <p>Here <code>origin</code> is your remote repo. This command fetches the latest...
119
git
<h1>How can I get a Git log from local and/or remote HEAD?</h1> <p>I am originally an SVN user.</p> <p>In Git, <code>git log</code> shows only the log from the current commit.</p> <p>How can I get the log from <code>HEAD</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,780
git
# How can I get a Git log from local and/or remote HEAD? I am originally an SVN user. In Git, `git log` shows only the log from the current commit. How can I get the log from `HEAD`?
To get log from server-side HEAD, you need to fetch changes from the server first. Unlike `pull`, `fetch` is not going to affect your working tree. So, it's safe. 1. `git fetch origin` Here `origin` is your remote repo. This command fetches the latest data from the remote repo. 2. `git log origin\master` Here ...
7153435
Git Archive of local Git repository
8
2011-08-22 20:49:46
<p>I have a Git repository on a server and on the same server I have a script which needs to do a <code>git archive</code> of the repository.</p> <p>Here's my sample <code>git archive</code> command which works well for remote Git repositories:</p> <pre><code>sudo git archive --remote=ssh://uname@dev.example.com/var/...
7,485
304,151
2012-11-09 17:32:14
7,153,485
13
2011-08-22 20:54:18
455,449
2012-11-09 17:32:14
https://stackoverflow.com/q/7153435
https://stackoverflow.com/a/7153485
<p>Use</p> <pre><code>cd .../yourcode sudo git archive --format=tar --output=src.tar development </code></pre> <p><em>(it is probably unnecessary to <code>sudo</code>)</em></p>
<p>Use</p> <pre><code>cd .../yourcode sudo git archive --format=tar --output=src.tar development </code></pre> <p><em>(it is probably unnecessary to <code>sudo</code>)</em></p>
34, 58, 119
git, linux, unix
<h1>Git Archive of local Git repository</h1> <p>I have a Git repository on a server and on the same server I have a script which needs to do a <code>git archive</code> of the repository.</p> <p>Here's my sample <code>git archive</code> command which works well for remote Git repositories:</p> <pre><code>sudo git arch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,781
git
# Git Archive of local Git repository I have a Git repository on a server and on the same server I have a script which needs to do a `git archive` of the repository. Here's my sample `git archive` command which works well for remote Git repositories: ``` sudo git archive --remote=ssh://uname@dev.example.com/var/repo...
Use ``` cd .../yourcode sudo git archive --format=tar --output=src.tar development ``` *(it is probably unnecessary to `sudo`)*
5819519
git - fetch an intermediate commit
8
2011-04-28 13:38:45
<p>Is there any git command to fetch an intermediate commit, just like 'svn co -r xxx' works? Thanks!</p>
10,827
721,441
2011-04-28 13:41:26
5,819,557
13
2011-04-28 13:41:26
11,343
2011-04-28 13:41:26
https://stackoverflow.com/q/5819519
https://stackoverflow.com/a/5819557
<p><code>git checkout &lt;commit-id&gt;</code>, where <code>&lt;commit-id&gt;</code> is the SHA1 of a commit, a tag, or a branch.</p> <p>Note that in git vocabulary, <code>fetch</code> refers to connecting to a remote repository and grabbing its commits.</p>
<p><code>git checkout &lt;commit-id&gt;</code>, where <code>&lt;commit-id&gt;</code> is the SHA1 of a commit, a tag, or a branch.</p> <p>Note that in git vocabulary, <code>fetch</code> refers to connecting to a remote repository and grabbing its commits.</p>
119
git
<h1>git - fetch an intermediate commit</h1> <p>Is there any git command to fetch an intermediate commit, just like 'svn co -r xxx' works? Thanks!</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,783
git
# git - fetch an intermediate commit Is there any git command to fetch an intermediate commit, just like 'svn co -r xxx' works? Thanks!
`git checkout <commit-id>`, where `<commit-id>` is the SHA1 of a commit, a tag, or a branch. Note that in git vocabulary, `fetch` refers to connecting to a remote repository and grabbing its commits.
2703782
Creating a new project from a project skeleton using git
8
2010-04-24 08:39:24
<p>In order to get a new django project up and running faster, I'd like to maintain a separate "project skeleton" on which I base all my new projects. It would be great if, as I improved the skeleton, I could bring those improvements into my active projects. How can I accomplish this with git?</p> <p>So, maybe in my r...
5,047
199,392
2010-04-24 10:06:10
2,703,815
13
2010-04-24 08:49:31
225,801
2010-04-24 08:49:31
https://stackoverflow.com/q/2703782
https://stackoverflow.com/a/2703815
<p>This is exactly what git (or any DVCS) is good at. Give the skeleton its own repo; to create a new project you'd typically <code>clone</code> the skeleton onto your workstation, work away, then <code>push</code> to a different location (e.g. myserver:repo-C). If you later improve the skeleton and push changes to it,...
<p>This is exactly what git (or any DVCS) is good at. Give the skeleton its own repo; to create a new project you'd typically <code>clone</code> the skeleton onto your workstation, work away, then <code>push</code> to a different location (e.g. myserver:repo-C). If you later improve the skeleton and push changes to it,...
119
git
<h1>Creating a new project from a project skeleton using git</h1> <p>In order to get a new django project up and running faster, I'd like to maintain a separate "project skeleton" on which I base all my new projects. It would be great if, as I improved the skeleton, I could bring those improvements into my active proje...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,784
git
# Creating a new project from a project skeleton using git In order to get a new django project up and running faster, I'd like to maintain a separate "project skeleton" on which I base all my new projects. It would be great if, as I improved the skeleton, I could bring those improvements into my active projects. How ...
This is exactly what git (or any DVCS) is good at. Give the skeleton its own repo; to create a new project you'd typically `clone` the skeleton onto your workstation, work away, then `push` to a different location (e.g. myserver:repo-C). If you later improve the skeleton and push changes to it, you can work them into a...
57700953
How can I disable "git checkout" in Git 2.23?
7
2019-08-28 22:54:31
<p>Now that Git 2.23 is out with support for <code>git switch</code> and <code>git restore</code>, I want to retrain my muscle memory by preventing <code>git checkout</code> from working. How can I make <code>git checkout</code> output an error message and exit with a non-zero status?</p>
1,346
736,156
2019-08-29 02:31:23
57,702,206
13
2019-08-29 02:31:23
8,705,432
2019-08-29 02:31:23
https://stackoverflow.com/q/57700953
https://stackoverflow.com/a/57702206
<p>There isn't a way to do what exactly what you're requesting.</p> <p>Git doesn't allow you to override a built-in subcommand with an alias, and for good reason. Other tooling you're using may use <code>git checkout</code> and allowing you to override it with something else would break all of that tooling.</p> <p>Y...
<p>There isn't a way to do what exactly what you're requesting.</p> <p>Git doesn't allow you to override a built-in subcommand with an alias, and for good reason. Other tooling you're using may use <code>git checkout</code> and allowing you to override it with something else would break all of that tooling.</p> <p>Y...
119
git
<h1>How can I disable "git checkout" in Git 2.23?</h1> <p>Now that Git 2.23 is out with support for <code>git switch</code> and <code>git restore</code>, I want to retrain my muscle memory by preventing <code>git checkout</code> from working. How can I make <code>git checkout</code> output an error message and exit wit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,789
git
# How can I disable "git checkout" in Git 2.23? Now that Git 2.23 is out with support for `git switch` and `git restore`, I want to retrain my muscle memory by preventing `git checkout` from working. How can I make `git checkout` output an error message and exit with a non-zero status?
There isn't a way to do what exactly what you're requesting. Git doesn't allow you to override a built-in subcommand with an alias, and for good reason. Other tooling you're using may use `git checkout` and allowing you to override it with something else would break all of that tooling. You can, however, override the...
53927623
Move master branch to another branch and start new master
7
2018-12-26 05:04:29
<p>I've been using master branch for development and want to clear it to only have release commits, how its meant to be used. How can I copy everything from master to a development branch then restart the master?</p>
14,003
10,741,902
2018-12-27 06:03:53
53,927,696
13
2018-12-26 05:17:10
1,508,671
2018-12-26 05:17:10
https://stackoverflow.com/q/53927623
https://stackoverflow.com/a/53927696
<blockquote> <p>Create development branch from master branch and delete master branch and recreate it incase if you dont want any commit history in master</p> </blockquote> <p>Step 1 : Create development branch</p> <pre><code>git checkout development git push origin development </code></pre> <p>Step 2 : Delete ...
<blockquote> <p>Create development branch from master branch and delete master branch and recreate it incase if you dont want any commit history in master</p> </blockquote> <p>Step 1 : Create development branch</p> <pre><code>git checkout development git push origin development </code></pre> <p>Step 2 : Delete ...
119
git
<h1>Move master branch to another branch and start new master</h1> <p>I've been using master branch for development and want to clear it to only have release commits, how its meant to be used. How can I copy everything from master to a development branch then restart the master?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,790
git
# Move master branch to another branch and start new master I've been using master branch for development and want to clear it to only have release commits, how its meant to be used. How can I copy everything from master to a development branch then restart the master?
> Create development branch from master branch and delete master branch > and recreate it incase if you dont want any commit history in master Step 1 : Create development branch ``` git checkout development git push origin development ``` Step 2 : Delete master branch (In-case master branch is protected you may not...
50768079
How can I add new changes to the last not-pushed commit?
7
2018-06-08 20:38:12
<ul> <li>I pulled the last version from the online repository <code>git pull origin master</code></li> <li>Then made some changes in the code-base and added them <code>git add .</code></li> <li>Then created a new commit <code>git commit -m "bug x fixed"</code></li> <li>Then made some new changes in the code base and I...
2,173
6,381,081
2018-06-08 21:57:31
50,768,128
13
2018-06-08 20:41:38
8,158,692
2018-06-08 21:00:21
https://stackoverflow.com/q/50768079
https://stackoverflow.com/a/50768128
<p>What you are looking for is:</p> <pre><code>git add your_changes git commit --amend </code></pre> <p>The <code>amend</code> option will take the last commit and replace it by a new one with the previous changes and the new staged changes (new files, rename, delete...).</p> <p>It should open the configurated edito...
<p>What you are looking for is:</p> <pre><code>git add your_changes git commit --amend </code></pre> <p>The <code>amend</code> option will take the last commit and replace it by a new one with the previous changes and the new staged changes (new files, rename, delete...).</p> <p>It should open the configurated edito...
119, 1231
command-line, git
<h1>How can I add new changes to the last not-pushed commit?</h1> <ul> <li>I pulled the last version from the online repository <code>git pull origin master</code></li> <li>Then made some changes in the code-base and added them <code>git add .</code></li> <li>Then created a new commit <code>git commit -m "bug x fixed"...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,792
git
# How can I add new changes to the last not-pushed commit? - I pulled the last version from the online repository `git pull origin master` - Then made some changes in the code-base and added them `git add .` - Then created a new commit `git commit -m "bug x fixed"` - Then made some new changes in the code base and I w...
What you are looking for is: ``` git add your_changes git commit --amend ``` The `amend` option will take the last commit and replace it by a new one with the previous changes and the new staged changes (new files, rename, delete...). It should open the configurated editor with the message of the previous commit, yo...
49804345
Git on Windows: "merging" 2 directories with the same name but different case
7
2018-04-12 19:20:19
<p>The word "merge" does not refer to a git merge, but just moving all the files to the same directory. </p> <p>We somehow came to have two directories with the same name but different cases in our git repository. Windows is case-insensetive in this respect so it works fine just checking out all the files from both d...
3,075
578
2018-04-13 13:06:03
49,817,659
13
2018-04-13 12:59:55
578
2018-04-13 13:06:03
https://stackoverflow.com/q/49804345
https://stackoverflow.com/a/49817659
<p>This worked for me:</p> <pre><code>git mv myfolder tmp_folder git mv tmp_folder MyFolder </code></pre> <p>Even though it initially removed <code>MyFolder</code> and moved all the files under <code>tmp_folder</code> after issuing the second <code>mv</code> it worked as expected staging renames for the files in <co...
<p>This worked for me:</p> <pre><code>git mv myfolder tmp_folder git mv tmp_folder MyFolder </code></pre> <p>Even though it initially removed <code>MyFolder</code> and moved all the files under <code>tmp_folder</code> after issuing the second <code>mv</code> it worked as expected staging renames for the files in <co...
64, 119, 218, 9708
case-sensitive, directory, git, windows
<h1>Git on Windows: "merging" 2 directories with the same name but different case</h1> <p>The word "merge" does not refer to a git merge, but just moving all the files to the same directory. </p> <p>We somehow came to have two directories with the same name but different cases in our git repository. Windows is case-i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,793
git
# Git on Windows: "merging" 2 directories with the same name but different case The word "merge" does not refer to a git merge, but just moving all the files to the same directory. We somehow came to have two directories with the same name but different cases in our git repository. Windows is case-insensetive in this...
This worked for me: ``` git mv myfolder tmp_folder git mv tmp_folder MyFolder ``` Even though it initially removed `MyFolder` and moved all the files under `tmp_folder` after issuing the second `mv` it worked as expected staging renames for the files in `myfolder` to be moved to `MyFolder`
46055656
Git subtree: move subtree to a different directory and pull it
7
2017-09-05 13:01:36
<p>Let's say I created a subtree like this:</p> <pre><code>git subtree --add --prefix=subdir &lt;path_to_remote&gt; &lt;remote_branch&gt; --squash </code></pre> <p>Then I wanted to move/rename subdir, so I do this: <code>git mv subdir dir2/subdir</code></p> <p>Now when I try to pull that subtree to a new prefix:</p>...
4,902
1,823,524
2025-01-31 08:12:05
46,310,507
13
2017-09-19 22:15:05
1,066,647
2017-09-19 22:15:05
https://stackoverflow.com/q/46055656
https://stackoverflow.com/a/46310507
<p>The <code>git subtree</code> command knows about your subtree, because it stores the name in the first commit when you <code>add</code> a subtree:</p> <pre><code>Add 'subdir/' from commit 'c7fbc973614eced220dcef1663d43dad90676e00' git-subtree-dir: subdir git-subtree-mainline: c166dc69165f6678d3c409df344c4ed9577a2e...
<p>The <code>git subtree</code> command knows about your subtree, because it stores the name in the first commit when you <code>add</code> a subtree:</p> <pre><code>Add 'subdir/' from commit 'c7fbc973614eced220dcef1663d43dad90676e00' git-subtree-dir: subdir git-subtree-mainline: c166dc69165f6678d3c409df344c4ed9577a2e...
119, 68200
git, git-subtree
<h1>Git subtree: move subtree to a different directory and pull it</h1> <p>Let's say I created a subtree like this:</p> <pre><code>git subtree --add --prefix=subdir &lt;path_to_remote&gt; &lt;remote_branch&gt; --squash </code></pre> <p>Then I wanted to move/rename subdir, so I do this: <code>git mv subdir dir2/subdir...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,796
git
# Git subtree: move subtree to a different directory and pull it Let's say I created a subtree like this: ``` git subtree --add --prefix=subdir <path_to_remote> <remote_branch> --squash ``` Then I wanted to move/rename subdir, so I do this: `git mv subdir dir2/subdir` Now when I try to pull that subtree to a new pr...
The `git subtree` command knows about your subtree, because it stores the name in the first commit when you `add` a subtree: ``` Add 'subdir/' from commit 'c7fbc973614eced220dcef1663d43dad90676e00' git-subtree-dir: subdir git-subtree-mainline: c166dc69165f6678d3c409df344c4ed9577a2e11 git-subtree-split: c7fbc973614ece...
45847724
How does git-rebase recognize "aliased" commits?
7
2017-08-23 19:14:01
<p>I'm trying to better understand the magic behind git-rebase. I was very pleasantly surprised today by the following behavior, which I didn't expect. </p> <p>TLDR: I rebased a shared branch, causing all commit sha1s to change. Despite this, a derived branch was able to accurately identify that its original commits w...
1,146
4,816,322
2017-08-24 06:03:58
45,848,295
13
2017-08-23 19:56:01
4,830,165
2017-08-24 06:03:58
https://stackoverflow.com/q/45847724
https://stackoverflow.com/a/45848295
<p>Internally, <code>git rebase</code> lists commits that should be rebased, and then computes a <a href="https://git-scm.com/docs/git-patch-id" rel="noreferrer">patch-id</a> for these commits. Unlike the commit id, it only hashes the content of the <em>patch</em>, not the content of the tree and commit objects. <stron...
<p>Internally, <code>git rebase</code> lists commits that should be rebased, and then computes a <a href="https://git-scm.com/docs/git-patch-id" rel="noreferrer">patch-id</a> for these commits. Unlike the commit id, it only hashes the content of the <em>patch</em>, not the content of the tree and commit objects. <stron...
119, 29934, 53850
git, git-commit, git-rebase
<h1>How does git-rebase recognize "aliased" commits?</h1> <p>I'm trying to better understand the magic behind git-rebase. I was very pleasantly surprised today by the following behavior, which I didn't expect. </p> <p>TLDR: I rebased a shared branch, causing all commit sha1s to change. Despite this, a derived branch w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,797
git
# How does git-rebase recognize "aliased" commits? I'm trying to better understand the magic behind git-rebase. I was very pleasantly surprised today by the following behavior, which I didn't expect. TLDR: I rebased a shared branch, causing all commit sha1s to change. Despite this, a derived branch was able to accura...
Internally, `git rebase` lists commits that should be rebased, and then computes a [patch-id](https://git-scm.com/docs/git-patch-id) for these commits. Unlike the commit id, it only hashes the content of the *patch*, not the content of the tree and commit objects. **So, A1 and A2, while having different identifiers, ha...
39047947
How would I git remote prune just a specific remote branch?
7
2016-08-19 21:31:07
<p>One of my coworkers "reused" a branch name, so every time I pull, I get an error message:</p> <pre><code>error: 'refs/remotes/origin/branch' exists; cannot create 'refs/remotes/origin/branch/subbranch' ... error: some local refs could not be updated; try running 'git remote prune origin' to remove any old, confli...
2,540
3,022,952
2016-08-19 21:47:15
39,048,117
13
2016-08-19 21:47:15
3,022,952
2016-08-19 21:47:15
https://stackoverflow.com/q/39047947
https://stackoverflow.com/a/39048117
<p>It looks like you can specifically delete the local reference branch, if you use the <code>-r</code> option of <code>git branch</code>:</p> <pre><code>git branch -r --delete origin/branch </code></pre> <p>After this, the new branch can be created appropriately, and fetch and pull happen without errors. (And <code>...
<p>It looks like you can specifically delete the local reference branch, if you use the <code>-r</code> option of <code>git branch</code>:</p> <pre><code>git branch -r --delete origin/branch </code></pre> <p>After this, the new branch can be created appropriately, and fetch and pull happen without errors. (And <code>...
119, 41346
git, git-remote
<h1>How would I git remote prune just a specific remote branch?</h1> <p>One of my coworkers "reused" a branch name, so every time I pull, I get an error message:</p> <pre><code>error: 'refs/remotes/origin/branch' exists; cannot create 'refs/remotes/origin/branch/subbranch' ... error: some local refs could not be updat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,798
git
# How would I git remote prune just a specific remote branch? One of my coworkers "reused" a branch name, so every time I pull, I get an error message: ``` error: 'refs/remotes/origin/branch' exists; cannot create 'refs/remotes/origin/branch/subbranch' ... error: some local refs could not be updated; try running 'g...
It looks like you can specifically delete the local reference branch, if you use the `-r` option of `git branch`: ``` git branch -r --delete origin/branch ``` After this, the new branch can be created appropriately, and fetch and pull happen without errors. (And `git remote prune --dry-run origin` still reports branc...
38885106
sphinx-apidoc picks up submodules, but autodoc doesn't document them
7
2016-08-10 23:28:07
<p>I've been working on a project for PyQt5 ( found here: <a href="https://github.com/MaVCArt/StyledPyQt5" rel="nofollow">https://github.com/MaVCArt/StyledPyQt5</a> ) which uses a package structure to make imports a bit more logical. I've been relatively successful in documenting the code so far with Sphinx, at least u...
9,095
5,457,552
2021-09-27 13:44:29
38,947,318
13
2016-08-14 22:52:34
5,457,552
2016-08-15 09:46:18
https://stackoverflow.com/q/38885106
https://stackoverflow.com/a/38947318
<p>I ended up fixing this problem eventually - it seems I was overlooking some errors, and sphinx worked just fine. I added all the paths the package contains in the conf.py and it just worked from there:</p> <p>conf.py:</p> <pre><code>sys.path.insert(0, os.path.abspath('../StyledPyQt5')) sys.path.insert(0, os.path.a...
<p>I ended up fixing this problem eventually - it seems I was overlooking some errors, and sphinx worked just fine. I added all the paths the package contains in the conf.py and it just worked from there:</p> <p>conf.py:</p> <pre><code>sys.path.insert(0, os.path.abspath('../StyledPyQt5')) sys.path.insert(0, os.path.a...
16, 119, 64757, 67136, 94814
autodoc, git, pyqt5, python, python-sphinx
<h1>sphinx-apidoc picks up submodules, but autodoc doesn't document them</h1> <p>I've been working on a project for PyQt5 ( found here: <a href="https://github.com/MaVCArt/StyledPyQt5" rel="nofollow">https://github.com/MaVCArt/StyledPyQt5</a> ) which uses a package structure to make imports a bit more logical. I've bee...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,799
git
# sphinx-apidoc picks up submodules, but autodoc doesn't document them I've been working on a project for PyQt5 ( found here: <https://github.com/MaVCArt/StyledPyQt5> ) which uses a package structure to make imports a bit more logical. I've been relatively successful in documenting the code so far with Sphinx, at leas...
I ended up fixing this problem eventually - it seems I was overlooking some errors, and sphinx worked just fine. I added all the paths the package contains in the conf.py and it just worked from there: conf.py: ``` sys.path.insert(0, os.path.abspath('../StyledPyQt5')) sys.path.insert(0, os.path.abspath('../StyledPyQt...
37901733
Sonar Lint Ruleset files: Gitignore?
7
2016-06-18 21:20:02
<p>I installed SonarLint and hooked it up to our server in Visual Studio, and when I did <code>git status</code> it showed all these net <code>.ruleset</code> files. Should I put this extension in the <code>.gitignore</code> file or add them to the repo?</p>
7,578
16,454
2016-12-24 16:49:33
37,910,054
13
2016-06-19 17:43:03
21,634
2016-12-24 16:49:33
https://stackoverflow.com/q/37901733
https://stackoverflow.com/a/37910054
<p>TLDR; Commit them to share them with your team. </p> <p>.ruleset files are collections of rules and their status (enabled, disabled, severity). When you bind your solution to SonarQube two things happen: </p> <p>a. analyzers are installed to your projects as nuget packages (this is how .net analyzers work btw, you...
<p>TLDR; Commit them to share them with your team. </p> <p>.ruleset files are collections of rules and their status (enabled, disabled, severity). When you bind your solution to SonarQube two things happen: </p> <p>a. analyzers are installed to your projects as nuget packages (this is how .net analyzers work btw, you...
25056, 33953, 98290
gitignore, sonarqube, visual-studio
<h1>Sonar Lint Ruleset files: Gitignore?</h1> <p>I installed SonarLint and hooked it up to our server in Visual Studio, and when I did <code>git status</code> it showed all these net <code>.ruleset</code> files. Should I put this extension in the <code>.gitignore</code> file or add them to the repo?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,800
git
# Sonar Lint Ruleset files: Gitignore? I installed SonarLint and hooked it up to our server in Visual Studio, and when I did `git status` it showed all these net `.ruleset` files. Should I put this extension in the `.gitignore` file or add them to the repo?
TLDR; Commit them to share them with your team. .ruleset files are collections of rules and their status (enabled, disabled, severity). When you bind your solution to SonarQube two things happen: a. analyzers are installed to your projects as nuget packages (this is how .net analyzers work btw, you install them just ...
29316831
git fatal: multiple stage entries for merged file
7
2015-03-28 11:51:38
<p>Git throws an error:</p> <pre><code>fatal: multiple stage entries for merged file </code></pre> <p>I've been on the side (<a href="https://stackoverflow.com/questions/27330446/getting-a-fatal-error-in-git-for-multiple-stage-entries">Getting a fatal error in git for multiple stage entries</a>) and read the workarou...
10,600
3,108,006
2016-03-23 21:41:43
34,859,102
13
2016-01-18 16:05:11
5,370,529
2016-01-18 16:59:59
https://stackoverflow.com/q/29316831
https://stackoverflow.com/a/34859102
<p>I resolved this problem:</p> <p>In your terminal, type this:</p> <pre><code>rm .git/index (press enter key) git add -A (press enter key) git commit -m "your commit instruction" </code></pre>
<p>I resolved this problem:</p> <p>In your terminal, type this:</p> <pre><code>rm .git/index (press enter key) git add -A (press enter key) git commit -m "your commit instruction" </code></pre>
119, 369
git, macos
<h1>git fatal: multiple stage entries for merged file</h1> <p>Git throws an error:</p> <pre><code>fatal: multiple stage entries for merged file </code></pre> <p>I've been on the side (<a href="https://stackoverflow.com/questions/27330446/getting-a-fatal-error-in-git-for-multiple-stage-entries">Getting a fatal error i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,802
git
# git fatal: multiple stage entries for merged file Git throws an error: ``` fatal: multiple stage entries for merged file ``` I've been on the side ([Getting a fatal error in git for multiple stage entries](https://stackoverflow.com/questions/27330446/getting-a-fatal-error-in-git-for-multiple-stage-entries)) and re...
I resolved this problem: In your terminal, type this: ``` rm .git/index (press enter key) git add -A (press enter key) git commit -m "your commit instruction" ```
29098942
Deletion of git repository
7
2015-03-17 12:21:19
<p>Consider following program:</p> <pre><code>var path = Path.Combine( Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); Directory.CreateDirectory(path); var testFile = Path.Combine(path, "test.txt"); File.WriteAllText(testFile, "Test file"); var source = Repository.Init(path);...
1,382
1,495,595
2021-10-25 07:01:56
29,099,355
13
2015-03-17 12:40:57
335,418
2021-10-25 07:01:56
https://stackoverflow.com/q/29098942
https://stackoverflow.com/a/29099355
<blockquote> <p>Is there anything else I should dispose of in order to delete the folder?</p> </blockquote> <p>Your disposing pattern is just fine. The mentioned issue has a different origin.</p> <p>As stated in the <strong><a href="https://msdn.microsoft.com/en-us/library/62t64db3(v=vs.110).aspx" rel="nofollow norefer...
<blockquote> <p>Is there anything else I should dispose of in order to delete the folder?</p> </blockquote> <p>Your disposing pattern is just fine. The mentioned issue has a different origin.</p> <p>As stated in the <strong><a href="https://msdn.microsoft.com/en-us/library/62t64db3(v=vs.110).aspx" rel="nofollow norefer...
9, 119, 74777
c#, git, libgit2sharp
<h1>Deletion of git repository</h1> <p>Consider following program:</p> <pre><code>var path = Path.Combine( Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); Directory.CreateDirectory(path); var testFile = Path.Combine(path, "test.txt"); File.WriteAllText(testFile, "Test file"); ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,808
git
# Deletion of git repository Consider following program: ``` var path = Path.Combine( Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); Directory.CreateDirectory(path); var testFile = Path.Combine(path, "test.txt"); File.WriteAllText(testFile, "Test file"); var source = Reposi...
> Is there anything else I should dispose of in order to delete the folder? Your disposing pattern is just fine. The mentioned issue has a different origin. As stated in the **[documentation](https://msdn.microsoft.com/en-us/library/62t64db3(v=vs.110).aspx)**, `UnauthorizedAccessException` is raised when there's a pe...
28448349
Git + Intellij - How to revert a local commit?
7
2015-02-11 07:01:48
<p>Working with git and intellij I have accidently commmited my changes to my local branch. </p> <p>I want to revert the commmit but keep the changes as before (ready for next commit).<br> I have looked in <a href="https://www.jetbrains.com/idea/help/resetting-head-commit.html" rel="noreferrer">this</a> page explaini...
16,360
450,602
2015-02-11 11:23:00
28,448,437
13
2015-02-11 07:07:20
1,079,354
2015-02-11 07:07:20
https://stackoverflow.com/q/28448349
https://stackoverflow.com/a/28448437
<p>If it's a single commit that you want to place back into staging, then you can do the following command:</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>You can replicate that in IntelliJ through these steps:</p> <ul> <li>VCS > Git > Reset HEAD</li> <li>Change reset type to "Soft"</li> <li>Change commit to...
<p>If it's a single commit that you want to place back into staging, then you can do the following command:</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>You can replicate that in IntelliJ through these steps:</p> <ul> <li>VCS > Git > Reset HEAD</li> <li>Change reset type to "Soft"</li> <li>Change commit to...
119, 8945
git, intellij-idea
<h1>Git + Intellij - How to revert a local commit?</h1> <p>Working with git and intellij I have accidently commmited my changes to my local branch. </p> <p>I want to revert the commmit but keep the changes as before (ready for next commit).<br> I have looked in <a href="https://www.jetbrains.com/idea/help/resetting-h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,809
git
# Git + Intellij - How to revert a local commit? Working with git and intellij I have accidently commmited my changes to my local branch. I want to revert the commmit but keep the changes as before (ready for next commit). I have looked in [this](https://www.jetbrains.com/idea/help/resetting-head-commit.html) page ...
If it's a single commit that you want to place back into staging, then you can do the following command: ``` git reset --soft HEAD^ ``` You can replicate that in IntelliJ through these steps: - VCS > Git > Reset HEAD - Change reset type to "Soft" - Change commit to `HEAD^`
21980073
Git submodules without detached head?
7
2014-02-24 06:05:08
<p>Maybe I'm using git-submodules not on purpose, but if there's any other git feature which satisfies my case, would be nice to find it.</p> <p>After cloning repository, I want submodule to be in master branch, I'll never store any additional files inside of chef-starter submodule.</p> <pre><code>git clone git@githu...
8,408
310,662
2017-08-25 21:05:30
21,980,365
13
2014-02-24 06:25:33
19,818
2014-02-24 17:34:52
https://stackoverflow.com/q/21980073
https://stackoverflow.com/a/21980365
<p>The submodule has a detached head because a submodule means "check out a specific commit from the submodule's repository". The <code>master</code> branch may have moved forward (it may point to a commit that descends from commit <code>0b6a803</code>), so Git checks out the specific revision instead of checking out a...
<p>The submodule has a detached head because a submodule means "check out a specific commit from the submodule's repository". The <code>master</code> branch may have moved forward (it may point to a commit that descends from commit <code>0b6a803</code>), so Git checks out the specific revision instead of checking out a...
119, 41612
git, git-submodules
<h1>Git submodules without detached head?</h1> <p>Maybe I'm using git-submodules not on purpose, but if there's any other git feature which satisfies my case, would be nice to find it.</p> <p>After cloning repository, I want submodule to be in master branch, I'll never store any additional files inside of chef-starter...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,811
git
# Git submodules without detached head? Maybe I'm using git-submodules not on purpose, but if there's any other git feature which satisfies my case, would be nice to find it. After cloning repository, I want submodule to be in master branch, I'll never store any additional files inside of chef-starter submodule. ```...
The submodule has a detached head because a submodule means "check out a specific commit from the submodule's repository". The `master` branch may have moved forward (it may point to a commit that descends from commit `0b6a803`), so Git checks out the specific revision instead of checking out a branch. `git-submodule`...
20169348
error: git was not found - installing laravel with composer windows
7
2013-11-23 23:44:47
<p>I'm getting an error saying:</p> <pre><code>failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as and internal or external command, operable program or batch file </code></pre> <p>when I try and run <code>composer create-...
27,593
1,248,009
2023-08-01 12:30:12
20,169,377
13
2013-11-23 23:48:58
2,558,778
2013-11-23 23:48:58
https://stackoverflow.com/q/20169348
https://stackoverflow.com/a/20169377
<p>You need to add the directory you installed git to to your PATH environment variable. </p> <ol> <li>Right click on <code>Computer</code>.</li> <li>Click Advanced System Settings</li> <li>Click Environment Variables inside the Advanced Menu</li> <li>Under System Variables, scroll to <code>PATH</code></li> <li>Add <c...
<p>You need to add the directory you installed git to to your PATH environment variable. </p> <ol> <li>Right click on <code>Computer</code>.</li> <li>Click Advanced System Settings</li> <li>Click Environment Variables inside the Advanced Menu</li> <li>Under System Variables, scroll to <code>PATH</code></li> <li>Add <c...
5, 119, 78546, 88458
composer-php, git, laravel-4, php
<h1>error: git was not found - installing laravel with composer windows</h1> <p>I'm getting an error saying:</p> <pre><code>failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as and internal or external command, operable prog...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,812
git
# error: git was not found - installing laravel with composer windows I'm getting an error saying: ``` failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as and internal or external command, operable program or batch file ``...
You need to add the directory you installed git to to your PATH environment variable. 1. Right click on `Computer`. 2. Click Advanced System Settings 3. Click Environment Variables inside the Advanced Menu 4. Under System Variables, scroll to `PATH` 5. Add `;"C:\path\to\git\bin";"C:\path\to\git\cmd"` Test the git com...
19859978
Git checkout in Chef recipe not working
7
2013-11-08 13:14:11
<p>I used the following chef stanza to try and checkout a github repository:</p> <pre><code> git "/home/ubuntu" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :checkout user "ubuntu" end </code></pre> <p>The chef run has no errors and the resource is shown as u...
4,405
2,627,085
2013-11-09 01:05:13
19,871,138
13
2013-11-09 01:05:13
914,967
2013-11-09 01:05:13
https://stackoverflow.com/q/19859978
https://stackoverflow.com/a/19871138
<p>Try:</p> <pre><code>git "/home/ubuntu/brukva" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :sync user "ubuntu" end </code></pre> <p>It does nothing if your target directory exists when using <code>:checkout</code> because it assumes your checkout is done already, you can s...
<p>Try:</p> <pre><code>git "/home/ubuntu/brukva" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :sync user "ubuntu" end </code></pre> <p>It does nothing if your target directory exists when using <code>:checkout</code> because it assumes your checkout is done already, you can s...
119, 8465, 46913
chef-infra, git, recipe
<h1>Git checkout in Chef recipe not working</h1> <p>I used the following chef stanza to try and checkout a github repository:</p> <pre><code> git "/home/ubuntu" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :checkout user "ubuntu" end </code></pre> <p>The chef...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,813
git
# Git checkout in Chef recipe not working I used the following chef stanza to try and checkout a github repository: ``` git "/home/ubuntu" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :checkout user "ubuntu" end ``` The chef run has no errors and the resour...
Try: ``` git "/home/ubuntu/brukva" do repository "git://github.com/kmerenkov/brukva.git" revision "master" action :sync user "ubuntu" end ``` It does nothing if your target directory exists when using `:checkout` because it assumes your checkout is done already, you can see chef tells "up to date". Refer to ...
17338792
Amending old commit
7
2013-06-27 08:55:32
<p>I have the commit history as below:</p> <pre><code>* 8cd26ba 2013-06-26 | history server-side (HEAD, noXHR) * bffd858 2013-06-25 | popups and modals * d95c5f4 2013-06-21 | Map update for new interaction ... </code></pre> <p>And when I've already committed '8cd26ba' I've found a bug in modal mechanism and want to f...
5,200
1,105,860
2014-02-22 02:48:21
17,339,096
13
2013-06-27 09:09:41
5,353
2013-06-27 09:58:11
https://stackoverflow.com/q/17338792
https://stackoverflow.com/a/17339096
<p>Your error is that when you do a rebase, you want to give the id of the parent of the earliest commit you want to modify. In your case, you wanted to modify <code>bffd858</code>, whose parent is <code>d95c5f4</code> also known as <code>bffd858^</code> or <code>bffd858~1</code> (I prefer that last syntax since it wor...
<p>Your error is that when you do a rebase, you want to give the id of the parent of the earliest commit you want to modify. In your case, you wanted to modify <code>bffd858</code>, whose parent is <code>d95c5f4</code> also known as <code>bffd858^</code> or <code>bffd858~1</code> (I prefer that last syntax since it wor...
119
git
<h1>Amending old commit</h1> <p>I have the commit history as below:</p> <pre><code>* 8cd26ba 2013-06-26 | history server-side (HEAD, noXHR) * bffd858 2013-06-25 | popups and modals * d95c5f4 2013-06-21 | Map update for new interaction ... </code></pre> <p>And when I've already committed '8cd26ba' I've found a bug in ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,815
git
# Amending old commit I have the commit history as below: ``` * 8cd26ba 2013-06-26 | history server-side (HEAD, noXHR) * bffd858 2013-06-25 | popups and modals * d95c5f4 2013-06-21 | Map update for new interaction ... ``` And when I've already committed '8cd26ba' I've found a bug in modal mechanism and want to fix i...
Your error is that when you do a rebase, you want to give the id of the parent of the earliest commit you want to modify. In your case, you wanted to modify `bffd858`, whose parent is `d95c5f4` also known as `bffd858^` or `bffd858~1` (I prefer that last syntax since it works with shell that do interpret `^` as a specia...
13364996
How to detect differences between a local repository and remote repository in Git
7
2012-11-13 16:50:07
<p>Say I did a Git clone from a URL for a repository. I made some changes to a file, did a Git commit.</p> <p>When I do a <code>git pull</code>, I see that it says &quot;Already up-to-date&quot;.</p> <p>Shouldn't it show something that says I am not up to date?</p> <p>My question is:</p> <ol> <li><p>say I did the chang...
18,464
971,888
2021-07-09 16:14:40
13,365,269
13
2012-11-13 17:05:48
912,144
2016-06-01 00:34:29
https://stackoverflow.com/q/13364996
https://stackoverflow.com/a/13365269
<p>My first advice is to not <code>git pull</code>. Do a <code>git fetch</code> followed by a <code>git merge</code>.</p> <p>To answer your zero'th question: In fact, you <em>are</em> up-to-date. You have all the commits that the remote repository has. So, there is nothing left to fetch or merge<sup>1</sup>.</p> <p>T...
<p>My first advice is to not <code>git pull</code>. Do a <code>git fetch</code> followed by a <code>git merge</code>.</p> <p>To answer your zero'th question: In fact, you <em>are</em> up-to-date. You have all the commits that the remote repository has. So, there is nothing left to fetch or merge<sup>1</sup>.</p> <p>T...
119
git
<h1>How to detect differences between a local repository and remote repository in Git</h1> <p>Say I did a Git clone from a URL for a repository. I made some changes to a file, did a Git commit.</p> <p>When I do a <code>git pull</code>, I see that it says &quot;Already up-to-date&quot;.</p> <p>Shouldn't it show somethin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,816
git
# How to detect differences between a local repository and remote repository in Git Say I did a Git clone from a URL for a repository. I made some changes to a file, did a Git commit. When I do a `git pull`, I see that it says "Already up-to-date". Shouldn't it show something that says I am not up to date? My quest...
My first advice is to not `git pull`. Do a `git fetch` followed by a `git merge`. To answer your zero'th question: In fact, you *are* up-to-date. You have all the commits that the remote repository has. So, there is nothing left to fetch or merge1. To answer your first question: 1. `git commit`: commit your changes ...
9366539
How to apply a very old patch in Git?
7
2012-02-20 18:36:23
<p>I have a git repository, and a very old patch (made in 2007) that I want to apply to it. The contents of the repository have changed significantly since then, and when I try to apply the patch, it fails due to conflicts.</p> <p>I would like to deal with the conflicts inside git, by adding the patch as a new branch ...
2,002
null
2016-07-23 21:39:21
9,366,590
13
2012-02-20 18:40:54
1,024,637
2012-02-20 18:40:54
https://stackoverflow.com/q/9366539
https://stackoverflow.com/a/9366590
<p>You should be able to do this with <code>git bisect</code>: start the bisection as normal, and then use:</p> <pre><code>git bisect run git apply --check ${patch} </code></pre> <p>That will use that command - "can this patch apply" - to determine if a revision is good or bad, automatically. You should shortly afte...
<p>You should be able to do this with <code>git bisect</code>: start the bisection as normal, and then use:</p> <pre><code>git bisect run git apply --check ${patch} </code></pre> <p>That will use that command - "can this patch apply" - to determine if a revision is good or bad, automatically. You should shortly afte...
119
git
<h1>How to apply a very old patch in Git?</h1> <p>I have a git repository, and a very old patch (made in 2007) that I want to apply to it. The contents of the repository have changed significantly since then, and when I try to apply the patch, it fails due to conflicts.</p> <p>I would like to deal with the conflicts i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,817
git
# How to apply a very old patch in Git? I have a git repository, and a very old patch (made in 2007) that I want to apply to it. The contents of the repository have changed significantly since then, and when I try to apply the patch, it fails due to conflicts. I would like to deal with the conflicts inside git, by ad...
You should be able to do this with `git bisect`: start the bisection as normal, and then use: ``` git bisect run git apply --check ${patch} ``` That will use that command - "can this patch apply" - to determine if a revision is good or bad, automatically. You should shortly afterwards have the right location turned o...
4769986
Git clone from remote ssh repository - change the machine on the remote network before executing the clone command
7
2011-01-22 19:16:12
<p>I'd like to clone a git repository from my company's servers to my personal computer. The only way to acces these servers from "outside" is by logging in per ssh to 'machine1'</p> <pre><code>ssh user@machine1.company.xy </code></pre> <p>Unfortunately, git ist not installed on that specific machine. So a git clone ...
16,891
585,869
2011-01-22 19:56:39
4,770,162
13
2011-01-22 19:51:23
36,723
2011-01-22 19:51:23
https://stackoverflow.com/q/4769986
https://stackoverflow.com/a/4770162
<p>You can do this by configuring a ssh proxy command. Note: this assumes <a href="http://netcat.sourceforge.net/">netcat</a> is available on the proxy server; you can replace netcat with a similar script in perl or whatever if needed.</p> <p>Add the following to your <code>~/.ssh/config</code>, creating it if needed:...
<p>You can do this by configuring a ssh proxy command. Note: this assumes <a href="http://netcat.sourceforge.net/">netcat</a> is available on the proxy server; you can replace netcat with a similar script in perl or whatever if needed.</p> <p>Add the following to your <code>~/.ssh/config</code>, creating it if needed:...
119, 386, 760, 34099
git, git-clone, proxy, ssh
<h1>Git clone from remote ssh repository - change the machine on the remote network before executing the clone command</h1> <p>I'd like to clone a git repository from my company's servers to my personal computer. The only way to acces these servers from "outside" is by logging in per ssh to 'machine1'</p> <pre><code>s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,818
git
# Git clone from remote ssh repository - change the machine on the remote network before executing the clone command I'd like to clone a git repository from my company's servers to my personal computer. The only way to acces these servers from "outside" is by logging in per ssh to 'machine1' ``` ssh user@machine1.com...
You can do this by configuring a ssh proxy command. Note: this assumes [netcat](http://netcat.sourceforge.net/) is available on the proxy server; you can replace netcat with a similar script in perl or whatever if needed. Add the following to your `~/.ssh/config`, creating it if needed: ``` Host machine1 User youruse...
3939055
Submodule's files are not checked out
7
2010-10-15 02:27:26
<p>I'm trying to add an external repo as a submodule of my repo, so I followed <a href="http://www.undefinedrange.com/posts/git-submodules-external-repositories-and-deployment" rel="noreferrer">these instructions</a>, doing:</p> <pre><code>git submodule add git:... vendor git submodule init git submodule update </code...
8,530
219,166
2010-11-14 11:13:33
4,177,209
13
2010-11-14 11:13:33
223,092
2010-11-14 11:13:33
https://stackoverflow.com/q/3939055
https://stackoverflow.com/a/4177209
<p>Since git version 1.6.5 you can use the <code>--recursive</code> and <code>--init</code> options to <code>git submodule update</code> to make sure that submodules are recursively initialized and updated. So, for your example, the following works for me:</p> <pre><code>$ git submodule add git://github.com/jbalogh/z...
<p>Since git version 1.6.5 you can use the <code>--recursive</code> and <code>--init</code> options to <code>git submodule update</code> to make sure that submodules are recursively initialized and updated. So, for your example, the following works for me:</p> <pre><code>$ git submodule add git://github.com/jbalogh/z...
119, 41612
git, git-submodules
<h1>Submodule's files are not checked out</h1> <p>I'm trying to add an external repo as a submodule of my repo, so I followed <a href="http://www.undefinedrange.com/posts/git-submodules-external-repositories-and-deployment" rel="noreferrer">these instructions</a>, doing:</p> <pre><code>git submodule add git:... vendor...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,819
git
# Submodule's files are not checked out I'm trying to add an external repo as a submodule of my repo, so I followed [these instructions](http://www.undefinedrange.com/posts/git-submodules-external-repositories-and-deployment), doing: ``` git submodule add git:... vendor git submodule init git submodule update ``` th...
Since git version 1.6.5 you can use the `--recursive` and `--init` options to `git submodule update` to make sure that submodules are recursively initialized and updated. So, for your example, the following works for me: ``` $ git submodule add git://github.com/jbalogh/zamboni-lib.git vendor remote: Counting objects: ...
73840583
Script to set multiple insteadOf cases in gitconfig
6
2022-09-24 21:07:19
<p>I need a script that will ensure the following content on the <code>.gitconfig</code> file:</p> <pre><code>[url &quot;git@&lt;IP addr&gt;:&quot;] insteadOf = https://&lt;IP addr&gt;/ insteadOf = https://&lt;domain name&gt;/ insteadOf = git@&lt;domain name&gt;: </code></pre> <p>This is meant to ensure tha...
2,979
3,007,075
2022-09-25 00:49:46
73,841,440
13
2022-09-25 00:49:46
1,290,731
2022-09-25 00:49:46
https://stackoverflow.com/q/73840583
https://stackoverflow.com/a/73841440
<p>It looks to me like a bug in the options parsing for intermixed-options-and-args style,</p> <pre><code>git config --global --replace-all url.git@&lt;IP addr&gt;:.insteadOf https://&lt;IP addr&gt;/ git config --global --add url.git@&lt;IP addr&gt;:.insteadOf https://&lt;domain name&gt;/ git config --global --...
<p>It looks to me like a bug in the options parsing for intermixed-options-and-args style,</p> <pre><code>git config --global --replace-all url.git@&lt;IP addr&gt;:.insteadOf https://&lt;IP addr&gt;/ git config --global --add url.git@&lt;IP addr&gt;:.insteadOf https://&lt;domain name&gt;/ git config --global --...
119, 32868
git, git-config
<h1>Script to set multiple insteadOf cases in gitconfig</h1> <p>I need a script that will ensure the following content on the <code>.gitconfig</code> file:</p> <pre><code>[url &quot;git@&lt;IP addr&gt;:&quot;] insteadOf = https://&lt;IP addr&gt;/ insteadOf = https://&lt;domain name&gt;/ insteadOf = git@&lt;...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,821
git
# Script to set multiple insteadOf cases in gitconfig I need a script that will ensure the following content on the `.gitconfig` file: ``` [url "git@<IP addr>:"] insteadOf = https://<IP addr>/ insteadOf = https://<domain name>/ insteadOf = git@<domain name>: ``` This is meant to ensure that the user will...
It looks to me like a bug in the options parsing for intermixed-options-and-args style, ``` git config --global --replace-all url.git@<IP addr>:.insteadOf https://<IP addr>/ git config --global --add url.git@<IP addr>:.insteadOf https://<domain name>/ git config --global --add url.git@<IP addr>:.instea...
61394748
How to get count of commits between head and a commit in history?
6
2020-04-23 18:45:21
<p>How can I get to know the number of commit before a particular commit? For example, I have these commit hash</p> <pre><code>f66a9f1df6 bf211314a6 a532e51fb2 59d11f1a2b 8eed94070f b849946aa2 f7fdee8bd3 </code></pre> <p><code>f66a9f1df6</code> being the head how can I know the total number of commit above <code>f7fd...
3,481
10,309,895
2020-04-23 19:37:33
61,395,451
13
2020-04-23 19:30:43
3,424,746
2020-04-23 19:37:33
https://stackoverflow.com/q/61394748
https://stackoverflow.com/a/61395451
<p><code>git rev-list COMMIT_HASH.. --count</code> will count the number of commits between COMMIT_HASH and the current commit. If you omit <code>--count</code> you will get a list of commit hashes. There are a number of other options available such as filtering by date, with documentation located in the man page for...
<p><code>git rev-list COMMIT_HASH.. --count</code> will count the number of commits between COMMIT_HASH and the current commit. If you omit <code>--count</code> you will get a list of commit hashes. There are a number of other options available such as filtering by date, with documentation located in the man page for...
119
git
<h1>How to get count of commits between head and a commit in history?</h1> <p>How can I get to know the number of commit before a particular commit? For example, I have these commit hash</p> <pre><code>f66a9f1df6 bf211314a6 a532e51fb2 59d11f1a2b 8eed94070f b849946aa2 f7fdee8bd3 </code></pre> <p><code>f66a9f1df6</code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,826
git
# How to get count of commits between head and a commit in history? How can I get to know the number of commit before a particular commit? For example, I have these commit hash ``` f66a9f1df6 bf211314a6 a532e51fb2 59d11f1a2b 8eed94070f b849946aa2 f7fdee8bd3 ``` `f66a9f1df6` being the head how can I know the total nu...
`git rev-list COMMIT_HASH.. --count` will count the number of commits between COMMIT_HASH and the current commit. If you omit `--count` you will get a list of commit hashes. There are a number of other options available such as filtering by date, with documentation located in the man page for `git-rev-list`.
60619641
Git module in Ansible gets permission denied on tmp directory
6
2020-03-10 14:25:46
<p>I'm trying to clone a remote repository by <em>Ansible</em> using the <code>git</code> module. Here's the task configuration:</p> <pre><code>- name: Clone repo git: repo: "{{ repository }}" dest: "/home/{{ username }}/abc" key_file: "{{ git_key_file }}" register: code_update </code></pre> <p>But un...
3,454
1,801,351
2020-03-11 03:45:54
60,622,281
13
2020-03-10 16:48:22
7,976,758
2020-03-10 16:48:22
https://stackoverflow.com/q/60619641
https://stackoverflow.com/a/60622281
<p><code>/tmp</code> at the server is mounted with option <code>noexec</code> so <code>ansible</code> cannot execute its own temporary scripts. The recommended fix is to set environment variable <code>TMPDIR</code>:</p> <pre><code> - name: Clone the git repo in a temporary directory environment: TMPDIR: ...
<p><code>/tmp</code> at the server is mounted with option <code>noexec</code> so <code>ansible</code> cannot execute its own temporary scripts. The recommended fix is to set environment variable <code>TMPDIR</code>:</p> <pre><code> - name: Clone the git repo in a temporary directory environment: TMPDIR: ...
119, 549, 86394, 111433
ansible, devops, git, ubuntu
<h1>Git module in Ansible gets permission denied on tmp directory</h1> <p>I'm trying to clone a remote repository by <em>Ansible</em> using the <code>git</code> module. Here's the task configuration:</p> <pre><code>- name: Clone repo git: repo: "{{ repository }}" dest: "/home/{{ username }}/abc" key_file...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,827
git
# Git module in Ansible gets permission denied on tmp directory I'm trying to clone a remote repository by *Ansible* using the `git` module. Here's the task configuration: ``` - name: Clone repo git: repo: "{{ repository }}" dest: "/home/{{ username }}/abc" key_file: "{{ git_key_file }}" register: cod...
`/tmp` at the server is mounted with option `noexec` so `ansible` cannot execute its own temporary scripts. The recommended fix is to set environment variable `TMPDIR`: ``` - name: Clone the git repo in a temporary directory environment: TMPDIR: "/home/{{ username }}/tmp" git: repo: "{{ re...
60029570
Does `git lfs track` do more than writing to `.gitattributes`?
6
2020-02-02 19:05:57
<p>From my understanding <code>.gitattributes</code> works similar as <code>.gitignore</code>. If I define a filter in <code>.gitattributes</code>, this filter will take effect and the files will be transferred to LFS.</p> <p>In every GIT LFS related document (official documentation, stackoverflow answers, ...) it is r...
4,042
2,230,045
2021-03-17 20:42:48
60,031,896
13
2020-02-03 00:33:56
8,705,432
2020-02-03 00:33:56
https://stackoverflow.com/q/60029570
https://stackoverflow.com/a/60031896
<p><code>git lfs track</code> does two things: modify <code>.gitattributes</code> and adjust timestamps so that Git picks up any existing files and converts them to LFS objects. In addition, it does some sanity-checking to avoid duplicates and common mistakes.</p> <p>There's no reason you can't just modify <code>.git...
<p><code>git lfs track</code> does two things: modify <code>.gitattributes</code> and adjust timestamps so that Git picks up any existing files and converts them to LFS objects. In addition, it does some sanity-checking to avoid duplicates and common mistakes.</p> <p>There's no reason you can't just modify <code>.git...
119, 115244
git, git-lfs
<h1>Does `git lfs track` do more than writing to `.gitattributes`?</h1> <p>From my understanding <code>.gitattributes</code> works similar as <code>.gitignore</code>. If I define a filter in <code>.gitattributes</code>, this filter will take effect and the files will be transferred to LFS.</p> <p>In every GIT LFS relat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,828
git
# Does `git lfs track` do more than writing to `.gitattributes`? From my understanding `.gitattributes` works similar as `.gitignore`. If I define a filter in `.gitattributes`, this filter will take effect and the files will be transferred to LFS. In every GIT LFS related document (official documentation, stackoverfl...
`git lfs track` does two things: modify `.gitattributes` and adjust timestamps so that Git picks up any existing files and converts them to LFS objects. In addition, it does some sanity-checking to avoid duplicates and common mistakes. There's no reason you can't just modify `.gitattributes` yourself, but note that if...
59622140
git merge vs git rebase for merge conflict scenarios
6
2020-01-07 04:22:30
<p>I want to make sure that I am looking at this correctly.</p> <p>When I do a git merge which results into a conflict, I see the file where there is conflict as:</p> <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;HEAD my local changes first ============= The remote github changes here. &gt;&gt;&gt;&gt;&gt;&gt;&gt;&g...
6,333
5,889,530
2020-01-07 18:43:37
59,634,237
13
2020-01-07 18:38:32
1,256,452
2020-01-07 18:43:37
https://stackoverflow.com/q/59622140
https://stackoverflow.com/a/59634237
<p><a href="https://stackoverflow.com/a/59622175/1256452">Tim Biegeleisen's answer</a> is right but I'd draw the diagram a bit differently. In your own (local) Git repository, you have a series of commits like this when you start:</p> <pre><code>...--G--H &lt;-- origin/somebranch \ I--J &lt;-- ...
<p><a href="https://stackoverflow.com/a/59622175/1256452">Tim Biegeleisen's answer</a> is right but I'd draw the diagram a bit differently. In your own (local) Git repository, you have a series of commits like this when you start:</p> <pre><code>...--G--H &lt;-- origin/somebranch \ I--J &lt;-- ...
119, 28897, 106113
git, git-merge, git-merge-conflict
<h1>git merge vs git rebase for merge conflict scenarios</h1> <p>I want to make sure that I am looking at this correctly.</p> <p>When I do a git merge which results into a conflict, I see the file where there is conflict as:</p> <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;HEAD my local changes first ============= ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,829
git
# git merge vs git rebase for merge conflict scenarios I want to make sure that I am looking at this correctly. When I do a git merge which results into a conflict, I see the file where there is conflict as: ``` <<<<<<<<<HEAD my local changes first ============= The remote github changes here. >>>>>>>>>> ``` Wherea...
[Tim Biegeleisen's answer](https://stackoverflow.com/a/59622175/1256452) is right but I'd draw the diagram a bit differently. In your own (local) Git repository, you have a series of commits like this when you start: ``` ...--G--H <-- origin/somebranch \ I--J <-- somebranch (HEAD) ``` That is, ...
52869520
Bitbucket repo clone with login credentials
6
2018-10-18 08:02:28
<p>I have a Basic git clone command to bitbucket in which I have to add Login credentials, is it possible to add Login credentials to a bitbucket git clone command?</p> <pre><code>https://myacc@bitbucket.org/myacc/app.git </code></pre> <p>Something like this?</p> <pre><code>https://myacc@bitbucket.org/myacc/app.git ...
30,420
10,122,013
2018-10-18 08:13:37
52,869,704
13
2018-10-18 08:13:37
10,495,683
2018-10-18 08:13:37
https://stackoverflow.com/q/52869520
https://stackoverflow.com/a/52869704
<p>You can, with: <br/></p> <pre><code>git clone https://user:password@bitbucket.org/myacc/app.git </code></pre> <p>But this will save your credentials in the origin url in <code>.git/config</code>.<br/> To avoid that you could change the origin afterwards <br/><code>git remote set-url origin https://myacc@bitbucket....
<p>You can, with: <br/></p> <pre><code>git clone https://user:password@bitbucket.org/myacc/app.git </code></pre> <p>But this will save your credentials in the origin url in <code>.git/config</code>.<br/> To avoid that you could change the origin afterwards <br/><code>git remote set-url origin https://myacc@bitbucket....
119, 8337, 34099
bitbucket, git, git-clone
<h1>Bitbucket repo clone with login credentials</h1> <p>I have a Basic git clone command to bitbucket in which I have to add Login credentials, is it possible to add Login credentials to a bitbucket git clone command?</p> <pre><code>https://myacc@bitbucket.org/myacc/app.git </code></pre> <p>Something like this?</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,831
git
# Bitbucket repo clone with login credentials I have a Basic git clone command to bitbucket in which I have to add Login credentials, is it possible to add Login credentials to a bitbucket git clone command? ``` https://myacc@bitbucket.org/myacc/app.git ``` Something like this? ``` https://myacc@bitbucket.org/myacc...
You can, with: ``` git clone https://user:password@bitbucket.org/myacc/app.git ``` But this will save your credentials in the origin url in `.git/config`. To avoid that you could change the origin afterwards `git remote set-url origin https://myacc@bitbucket.org/myacc/app.git`
51093087
Ignore node_modules with vim-fzf
6
2018-06-29 01:23:31
<p>I have defined a function to search for filename (<code>&lt;C-P&gt;</code>), and a string (<code>&lt;C-F&gt;</code>) from git root directory asynchronously with <code>fzf.vim</code> plugin (I also have <code>Ag</code> installed). However, I can not manipulate the definition to ignore <code>node_modules</code> direct...
8,140
1,398,479
2023-08-08 20:39:06
51,457,124
13
2018-07-21 14:45:23
1,398,479
2020-07-04 22:24:45
https://stackoverflow.com/q/51093087
https://stackoverflow.com/a/51457124
<p>Finally, I figured out a workaround by replacing <code>fzf#vim#files</code> with <code>:Gfiles</code></p> <p>New configuration is <code>silent! nmap &lt;C-P&gt; :GFiles&lt;CR&gt;</code></p> <p><code>&lt;C-F&gt;</code> mapping is kept the same as in the question.</p> <p>The demerit of this <code>:GFiles</code> soluti...
<p>Finally, I figured out a workaround by replacing <code>fzf#vim#files</code> with <code>:Gfiles</code></p> <p>New configuration is <code>silent! nmap &lt;C-P&gt; :GFiles&lt;CR&gt;</code></p> <p><code>&lt;C-F&gt;</code> mapping is kept the same as in the question.</p> <p>The demerit of this <code>:GFiles</code> soluti...
370, 25056, 107470, 113660
ag, fzf, gitignore, vim
<h1>Ignore node_modules with vim-fzf</h1> <p>I have defined a function to search for filename (<code>&lt;C-P&gt;</code>), and a string (<code>&lt;C-F&gt;</code>) from git root directory asynchronously with <code>fzf.vim</code> plugin (I also have <code>Ag</code> installed). However, I can not manipulate the definition ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,832
git
# Ignore node_modules with vim-fzf I have defined a function to search for filename (`<C-P>`), and a string (`<C-F>`) from git root directory asynchronously with `fzf.vim` plugin (I also have `Ag` installed). However, I can not manipulate the definition to ignore `node_modules` directory. The vim script is too hard to...
Finally, I figured out a workaround by replacing `fzf#vim#files` with `:Gfiles` New configuration is `silent! nmap <C-P> :GFiles<CR>` `<C-F>` mapping is kept the same as in the question. The demerit of this `:GFiles` solution is that files not added to `git` (untracked files) are not included in the search results. ...
37607393
git-p4 migrate branches in different subdirectories
6
2016-06-03 06:30:04
<p>I want to migrate source code tree from perforce to git. The source code contains several dev branches scattered across perforce depot, not necessarily in the same directory. for example the structure is something like this - </p> <pre><code>//depot/dev/project/master //depot/dev/project/branch1 //depot/dev/proje...
4,064
3,256,373
2017-07-10 11:25:58
37,673,794
13
2016-06-07 08:05:03
3,256,373
2016-06-07 09:39:20
https://stackoverflow.com/q/37607393
https://stackoverflow.com/a/37673794
<p><strong>Summary:</strong> It works, git-p4 is a great tool, very intelligent, comes with lot of configurable options. Multiple branches scattered wherever across depot tree migrated successfully. We need to run the import at highest level (topmost) perforce directory that covers all sub-directories or branches of ...
<p><strong>Summary:</strong> It works, git-p4 is a great tool, very intelligent, comes with lot of configurable options. Multiple branches scattered wherever across depot tree migrated successfully. We need to run the import at highest level (topmost) perforce directory that covers all sub-directories or branches of ...
119, 1286, 1879, 55021
branch, git, git-p4, perforce
<h1>git-p4 migrate branches in different subdirectories</h1> <p>I want to migrate source code tree from perforce to git. The source code contains several dev branches scattered across perforce depot, not necessarily in the same directory. for example the structure is something like this - </p> <pre><code>//depot/dev/p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,835
git
# git-p4 migrate branches in different subdirectories I want to migrate source code tree from perforce to git. The source code contains several dev branches scattered across perforce depot, not necessarily in the same directory. for example the structure is something like this - ``` //depot/dev/project/master //depo...
**Summary:** It works, git-p4 is a great tool, very intelligent, comes with lot of configurable options. Multiple branches scattered wherever across depot tree migrated successfully. We need to run the import at highest level (topmost) perforce directory that covers all sub-directories or branches of interest. For effi...
35868396
How do I git log with short commit hash + date/time?
6
2016-03-08 13:13:19
<p>Let's say I do this command: git log -4 --pretty=format:%h</p> <p>How do I add date/time to each result? </p>
8,318
834,333
2016-03-08 14:17:38
35,869,362
13
2016-03-08 13:58:29
1,993,125
2016-03-08 14:17:38
https://stackoverflow.com/q/35868396
https://stackoverflow.com/a/35869362
<p>For <em>Committer Date</em> use <code>%cd</code>:</p> <pre><code>git log -4 --pretty=format:"%h - %cd" </code></pre> <p>-</p> <p>For <em>Author Date</em> use <code>%ad</code>:</p> <pre><code>git log -4 --pretty=format:"%h - %ad" </code></pre> <p>-</p> <p>For more options refer <a href="https://git-scm.com/book...
<p>For <em>Committer Date</em> use <code>%cd</code>:</p> <pre><code>git log -4 --pretty=format:"%h - %cd" </code></pre> <p>-</p> <p>For <em>Author Date</em> use <code>%ad</code>:</p> <pre><code>git log -4 --pretty=format:"%h - %ad" </code></pre> <p>-</p> <p>For more options refer <a href="https://git-scm.com/book...
119
git
<h1>How do I git log with short commit hash + date/time?</h1> <p>Let's say I do this command: git log -4 --pretty=format:%h</p> <p>How do I add date/time to each result? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,837
git
# How do I git log with short commit hash + date/time? Let's say I do this command: git log -4 --pretty=format:%h How do I add date/time to each result?
For *Committer Date* use `%cd`: ``` git log -4 --pretty=format:"%h - %cd" ``` - For *Author Date* use `%ad`: ``` git log -4 --pretty=format:"%h - %ad" ``` - For more options refer [this](https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History).
33983138
How to undo git rm
6
2015-11-29 13:09:36
<p>I have accidentally added and committed a (huge) log file into my local git repository and then did a <code>git rm</code> (without --cached). So the history looks like this:</p> <pre><code>&gt; git status modified: Foo.java Untracked files: (use "git add &lt;file&gt;..." to include in what will be committed) ...
28,080
997,851
2023-05-11 19:53:30
33,983,188
13
2015-11-29 13:14:23
1,084,774
2015-11-29 16:06:50
https://stackoverflow.com/q/33983138
https://stackoverflow.com/a/33983188
<p>If it's just in the last commit, then do <code>git rm huge_file.log</code> and then <code>git commit --amend</code>.</p> <p>Git allows you to make <em>amend</em>s for the last error you've <em>commit</em>ted. Literally.</p>
<p>If it's just in the last commit, then do <code>git rm huge_file.log</code> and then <code>git commit --amend</code>.</p> <p>Git allows you to make <em>amend</em>s for the last error you've <em>commit</em>ted. Literally.</p>
119
git
<h1>How to undo git rm</h1> <p>I have accidentally added and committed a (huge) log file into my local git repository and then did a <code>git rm</code> (without --cached). So the history looks like this:</p> <pre><code>&gt; git status modified: Foo.java Untracked files: (use "git add &lt;file&gt;..." to include ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,838
git
# How to undo git rm I have accidentally added and committed a (huge) log file into my local git repository and then did a `git rm` (without --cached). So the history looks like this: ``` > git status modified: Foo.java Untracked files: (use "git add <file>..." to include in what will be committed) huge_fil...
If it's just in the last commit, then do `git rm huge_file.log` and then `git commit --amend`. Git allows you to make *amend*s for the last error you've *commit*ted. Literally.
29257491
Which branch do commits from a deleted branch belong to?
6
2015-03-25 13:45:30
<p>If I merge branch A into branch B and then delete A, which branch do commits from branch A (now deleted) belong to?</p>
256
4,319,323
2016-01-14 14:39:38
29,258,814
13
2015-03-25 14:41:37
2,541,573
2016-01-14 14:39:38
https://stackoverflow.com/q/29257491
https://stackoverflow.com/a/29258814
<p>Git branches are mere pointers to commits. Asking</p> <blockquote> <p>Which branch does this commit belong to?</p> </blockquote> <p>doesn't really make sense (at least, not in the general case) because commits may very well be reachable from multiple branches (or even from none at all!).</p> <p>Consider the fol...
<p>Git branches are mere pointers to commits. Asking</p> <blockquote> <p>Which branch does this commit belong to?</p> </blockquote> <p>doesn't really make sense (at least, not in the general case) because commits may very well be reachable from multiple branches (or even from none at all!).</p> <p>Consider the fol...
119, 76220
git, git-branch
<h1>Which branch do commits from a deleted branch belong to?</h1> <p>If I merge branch A into branch B and then delete A, which branch do commits from branch A (now deleted) belong to?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,841
git
# Which branch do commits from a deleted branch belong to? If I merge branch A into branch B and then delete A, which branch do commits from branch A (now deleted) belong to?
Git branches are mere pointers to commits. Asking > Which branch does this commit belong to? doesn't really make sense (at least, not in the general case) because commits may very well be reachable from multiple branches (or even from none at all!). Consider the following example: ![enter image description here](ht...
21017573
Xcode bot: git submodules not initialized
6
2014-01-09 10:26:36
<p>I'm trying to set up an Xcode bot with OSX server. After configuring the git repository and creating a bot, I run integrate. It fails because the repository is checked out only partially. More precisely: Of the 6 submodules configured, only 3 are initialized and checked out.</p> <pre><code>didi@mac:/Library/Server/...
4,244
261,952
2018-08-21 21:56:33
27,795,306
13
2015-01-06 09:06:15
463,432
2015-02-09 22:49:23
https://stackoverflow.com/q/21017573
https://stackoverflow.com/a/27795306
<p>On Xcode 6.1.1 and OS X Server 4.0, it looks like they fixed the submodules with detached HEAD issue, but there are still some bugs. One of my project has one its submodules being completely ignored by Xcode Server so the app fails to build:</p> <pre><code>$ git submodule 8a88bc41c9dc0f57c921d82bc4e7b93e1c4cbf7a I...
<p>On Xcode 6.1.1 and OS X Server 4.0, it looks like they fixed the submodules with detached HEAD issue, but there are still some bugs. One of my project has one its submodules being completely ignored by Xcode Server so the app fails to build:</p> <pre><code>$ git submodule 8a88bc41c9dc0f57c921d82bc4e7b93e1c4cbf7a I...
119, 908, 41612, 51541, 102030
git, git-submodules, osx-server, xcode, xcode-bots
<h1>Xcode bot: git submodules not initialized</h1> <p>I'm trying to set up an Xcode bot with OSX server. After configuring the git repository and creating a bot, I run integrate. It fails because the repository is checked out only partially. More precisely: Of the 6 submodules configured, only 3 are initialized and che...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,842
git
# Xcode bot: git submodules not initialized I'm trying to set up an Xcode bot with OSX server. After configuring the git repository and creating a bot, I run integrate. It fails because the repository is checked out only partially. More precisely: Of the 6 submodules configured, only 3 are initialized and checked out....
On Xcode 6.1.1 and OS X Server 4.0, it looks like they fixed the submodules with detached HEAD issue, but there are still some bugs. One of my project has one its submodules being completely ignored by Xcode Server so the app fails to build: ``` $ git submodule 8a88bc41c9dc0f57c921d82bc4e7b93e1c4cbf7a InAppStore (hea...
23965340
Windows Firewall, Tinywall and GIT
6
2014-05-31 00:48:17
<p>Just finally updated to Win7 from XP.<br> I am using Windows Firewall with added Tinywall (gives more control)</p> <p>But when I use Git Bash, the firewall blocks all commands. If I disable the firewall then everything works OK</p> <p>I cannot figure the proper exceptions to add to TinyWall whitelist.</p> <p>I ad...
4,213
218,761
2019-04-13 12:57:50
24,019,816
13
2014-06-03 16:04:25
218,761
2017-03-05 07:14:18
https://stackoverflow.com/q/23965340
https://stackoverflow.com/a/24019816
<p>To get TinyWall to work with git over SSH, you must white-list:</p> <pre><code>sh.exe git.exe ssh.exe </code></pre> <p>To work with git over HTTPS, you need only whitelist:</p> <pre><code>C:\Program Files (x86)\Git\libexec\git-core\git-remote-https.exe </code></pre> <p>or</p> <pre><code>C:\Program Files\Git\min...
<p>To get TinyWall to work with git over SSH, you must white-list:</p> <pre><code>sh.exe git.exe ssh.exe </code></pre> <p>To work with git over HTTPS, you need only whitelist:</p> <pre><code>C:\Program Files (x86)\Git\libexec\git-core\git-remote-https.exe </code></pre> <p>or</p> <pre><code>C:\Program Files\Git\min...
119, 8204, 34595
git, windows-7, windows-firewall
<h1>Windows Firewall, Tinywall and GIT</h1> <p>Just finally updated to Win7 from XP.<br> I am using Windows Firewall with added Tinywall (gives more control)</p> <p>But when I use Git Bash, the firewall blocks all commands. If I disable the firewall then everything works OK</p> <p>I cannot figure the proper exception...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,843
git
# Windows Firewall, Tinywall and GIT Just finally updated to Win7 from XP. I am using Windows Firewall with added Tinywall (gives more control) But when I use Git Bash, the firewall blocks all commands. If I disable the firewall then everything works OK I cannot figure the proper exceptions to add to TinyWall whit...
To get TinyWall to work with git over SSH, you must white-list: ``` sh.exe git.exe ssh.exe ``` To work with git over HTTPS, you need only whitelist: ``` C:\Program Files (x86)\Git\libexec\git-core\git-remote-https.exe ``` or ``` C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe ```
21972171
Are there crucial differences between stashing, pulling & popping vs. commiting & pull --rebase?
6
2014-02-23 18:04:38
<p>My workflow goal is often to avoid a meaningless merge. To accomplish that I often do one of two things:</p> <ol> <li>I commit my changes and <code>git pull --rebase</code> to prevent an unneeded merge. If I later wish to change an existing commit I make changes, commit and merge them in using <code>git rebase --in...
1,258
984,975
2014-02-23 20:38:00
21,974,197
13
2014-02-23 20:38:00
1,256,452
2014-02-23 20:38:00
https://stackoverflow.com/q/21972171
https://stackoverflow.com/a/21974197
<h3>TL;DR version</h3> <p>Using <code>git stash</code> avoids the "meaningless merge" only if you have no commits of your own. The <code>git pull --rebase</code> method is more general.</p> <h3>Long, tutorial-ish version: what's happening, why, etc.</h3> <p>Using <code>git stash</code> just makes some commits,<sup>...
<h3>TL;DR version</h3> <p>Using <code>git stash</code> avoids the "meaningless merge" only if you have no commits of your own. The <code>git pull --rebase</code> method is more general.</p> <h3>Long, tutorial-ish version: what's happening, why, etc.</h3> <p>Using <code>git stash</code> just makes some commits,<sup>...
119, 13091, 29934
git, git-rebase, git-stash
<h1>Are there crucial differences between stashing, pulling & popping vs. commiting & pull --rebase?</h1> <p>My workflow goal is often to avoid a meaningless merge. To accomplish that I often do one of two things:</p> <ol> <li>I commit my changes and <code>git pull --rebase</code> to prevent an unneeded merge. If I la...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,844
git
# Are there crucial differences between stashing, pulling & popping vs. commiting & pull --rebase? My workflow goal is often to avoid a meaningless merge. To accomplish that I often do one of two things: 1. I commit my changes and `git pull --rebase` to prevent an unneeded merge. If I later wish to change an existing...
### TL;DR version Using `git stash` avoids the "meaningless merge" only if you have no commits of your own. The `git pull --rebase` method is more general. ### Long, tutorial-ish version: what's happening, why, etc. Using `git stash` just makes some commits,1 so to a first approximation, stashing and committing are ...
18273879
git: get the commit-id and the note of a commit
6
2013-08-16 12:56:46
<p>I am writing a hook for validating url's which are entered in the notes section of the git log. I loop through each commit to get the note for that particular commit and do a string comparison for the url. The problem pops up if the commit is a new commit, since the new commit does not contain a note. </p> <p>examp...
3,526
2,663,585
2016-01-21 08:54:07
18,279,951
13
2013-08-16 18:31:42
1,256,452
2013-08-16 21:16:35
https://stackoverflow.com/q/18273879
https://stackoverflow.com/a/18279951
<p>You literally can't do this the way you showed. The problem boils down to the way notes work. As mart1n suggested in a comment, you need to push the notes either first, or simultaneously. Here's why:</p> <h2>How notes work</h2> <p>A note "attached to" a commit exists (and thus can be shown by <code>git log</cod...
<p>You literally can't do this the way you showed. The problem boils down to the way notes work. As mart1n suggested in a comment, you need to push the notes either first, or simultaneously. Here's why:</p> <h2>How notes work</h2> <p>A note "attached to" a commit exists (and thus can be shown by <code>git log</cod...
119
git
<h1>git: get the commit-id and the note of a commit</h1> <p>I am writing a hook for validating url's which are entered in the notes section of the git log. I loop through each commit to get the note for that particular commit and do a string comparison for the url. The problem pops up if the commit is a new commit, sin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,845
git
# git: get the commit-id and the note of a commit I am writing a hook for validating url's which are entered in the notes section of the git log. I loop through each commit to get the note for that particular commit and do a string comparison for the url. The problem pops up if the commit is a new commit, since the ne...
You literally can't do this the way you showed. The problem boils down to the way notes work. As mart1n suggested in a comment, you need to push the notes either first, or simultaneously. Here's why: ## How notes work A note "attached to" a commit exists (and thus can be shown by `git log` and `git show`) "now" if: ...
15959257
How can I generate/apply git patches only for commits that alter specific files
6
2013-04-11 21:33:12
<p>I have two git repos that are forks of each other and I need to occasionally import commits from one to the other.</p> <p>For example:</p> <p><code>git-repo1</code> has this directory structure:</p> <p><code>repo1/project1/src</code></p> <p><code>repo1/project2/src</code></p> <p>while <code>git-repo2</code> has...
5,731
379,360
2021-11-19 09:29:05
15,961,040
13
2013-04-12 00:15:29
1,290,731
2015-02-15 01:38:10
https://stackoverflow.com/q/15959257
https://stackoverflow.com/a/15961040
<blockquote> <p><code>git rev-list --reverse</code><em><code>series</code></em><code>-- repo1/project1/src/ \</code><br> <code>| xargs -I@ git format-patch --stdout @^! &gt;mystuff.patch</code></p> </blockquote> <p>will spit the commits in <em>series</em> that affect that subdirectory into <code>mystuff.patch</cod...
<blockquote> <p><code>git rev-list --reverse</code><em><code>series</code></em><code>-- repo1/project1/src/ \</code><br> <code>| xargs -I@ git format-patch --stdout @^! &gt;mystuff.patch</code></p> </blockquote> <p>will spit the commits in <em>series</em> that affect that subdirectory into <code>mystuff.patch</cod...
119, 9033, 62078
git, git-diff, git-patch
<h1>How can I generate/apply git patches only for commits that alter specific files</h1> <p>I have two git repos that are forks of each other and I need to occasionally import commits from one to the other.</p> <p>For example:</p> <p><code>git-repo1</code> has this directory structure:</p> <p><code>repo1/project1/sr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,846
git
# How can I generate/apply git patches only for commits that alter specific files I have two git repos that are forks of each other and I need to occasionally import commits from one to the other. For example: `git-repo1` has this directory structure: `repo1/project1/src` `repo1/project2/src` while `git-repo2` ha...
> `git rev-list --reverse`*`series`*`-- repo1/project1/src/ \` > `| xargs -I@ git format-patch --stdout @^! >mystuff.patch` will spit the commits in *series* that affect that subdirectory into `mystuff.patch` Then, ``` cat >mystuff.sed <<\EOD /^(From [0-9a-f]{40}|diff --git )/!{H;$!d} x /^From /b ${h;s,.*--,--,;x}...
13700429
adding android project to git
6
2012-12-04 10:09:40
<p>Which are the files that I have to ignore when adding a project to git? Should I add the .classpath file? What is the purpose of .classpath? Im using eclipse and pushing to a Jenkins server</p>
4,186
1,796,624
2012-12-04 10:13:06
13,700,503
13
2012-12-04 10:13:06
1,369,222
2012-12-04 10:13:06
https://stackoverflow.com/q/13700429
https://stackoverflow.com/a/13700503
<p>Typical gitignore file for android would include this:</p> <pre><code># built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties </code></pre> <p>From <a href="https://github.com/github/gi...
<p>Typical gitignore file for android would include this:</p> <pre><code># built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties </code></pre> <p>From <a href="https://github.com/github/gi...
17, 53, 119, 1386
android, eclipse, git, java
<h1>adding android project to git</h1> <p>Which are the files that I have to ignore when adding a project to git? Should I add the .classpath file? What is the purpose of .classpath? Im using eclipse and pushing to a Jenkins server</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,847
git
# adding android project to git Which are the files that I have to ignore when adding a project to git? Should I add the .classpath file? What is the purpose of .classpath? Im using eclipse and pushing to a Jenkins server
Typical gitignore file for android would include this: ``` # built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties ``` From [Gitignore on github](https://github.com/github/gitignore/blob/m...
9088543
going back to previous commit without destroying the current one
6
2012-01-31 23:20:36
<p>So I wanted to go back to my previous commit without destryoing the latest one I have now. How do I do this? Doing a git reset HARD will destroy my current commit right?</p>
14,150
957,225
2012-02-01 02:43:40
9,088,584
13
2012-01-31 23:23:59
1,024,637
2012-01-31 23:23:59
https://stackoverflow.com/q/9088543
https://stackoverflow.com/a/9088584
<p>Assuming you don't have any changes that you have not checked in, <code>git checkout $OLD_COMMIT</code> will take you there, and <code>git checkout $BRANCH</code> will take you back.</p> <p>That will put you, potentially, on a detached head; see <code>git checkout --help</code> for the details, but if all you want ...
<p>Assuming you don't have any changes that you have not checked in, <code>git checkout $OLD_COMMIT</code> will take you there, and <code>git checkout $BRANCH</code> will take you back.</p> <p>That will put you, potentially, on a detached head; see <code>git checkout --help</code> for the details, but if all you want ...
119
git
<h1>going back to previous commit without destroying the current one</h1> <p>So I wanted to go back to my previous commit without destryoing the latest one I have now. How do I do this? Doing a git reset HARD will destroy my current commit right?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,848
git
# going back to previous commit without destroying the current one So I wanted to go back to my previous commit without destryoing the latest one I have now. How do I do this? Doing a git reset HARD will destroy my current commit right?
Assuming you don't have any changes that you have not checked in, `git checkout $OLD_COMMIT` will take you there, and `git checkout $BRANCH` will take you back. That will put you, potentially, on a detached head; see `git checkout --help` for the details, but if all you want is to run tests on the old version or somet...
8438557
setup git to ignore index.php in root folder only and not all index.php files in subfolders
6
2011-12-08 22:10:03
<p>I have .gitignore as</p> <pre><code>index.php protected/config/ </code></pre> <p>I wanted to ignore only index.php in root but git is ignoring all files with index.php in sub-folders as well. How I can modify .gitignore to ignore only specific index.php file and not all files with name index.php</p>
2,925
519,538
2011-12-08 22:37:50
8,438,558
13
2011-12-08 22:17:41
534,476
2011-12-08 22:37:50
https://stackoverflow.com/q/8438557
https://stackoverflow.com/a/8438558
<p>Use <code>/index.php</code> in your <code>.gitignore</code></p>
<p>Use <code>/index.php</code> in your <code>.gitignore</code></p>
119
git
<h1>setup git to ignore index.php in root folder only and not all index.php files in subfolders</h1> <p>I have .gitignore as</p> <pre><code>index.php protected/config/ </code></pre> <p>I wanted to ignore only index.php in root but git is ignoring all files with index.php in sub-folders as well. How I can modify .git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,849
git
# setup git to ignore index.php in root folder only and not all index.php files in subfolders I have .gitignore as ``` index.php protected/config/ ``` I wanted to ignore only index.php in root but git is ignoring all files with index.php in sub-folders as well. How I can modify .gitignore to ignore only specific ind...
Use `/index.php` in your `.gitignore`
5586993
Automatically synchronizing a Subversion repository and a Git repository
6
2011-04-07 20:09:34
<p>My project has a Subversion repository on a network file system, and a new team would like to access it using Git, and be able to commit to it and get updates from it.</p> <p>What I have in mind is to create a new bare <code>git-svn</code> clone of the Subversion repository on the same network file system, and make...
9,473
223,267
2013-04-22 12:57:48
7,645,450
13
2011-10-04 08:58:53
223,267
2013-04-22 12:57:48
https://stackoverflow.com/q/5586993
https://stackoverflow.com/a/7645450
<p>Here is what I've come up with:</p> <ol> <li><p>Create the <code>git-svn</code> repository if it doesn't exist already:</p> <pre><code>git svn init --std-layout &lt;svn_url&gt; &lt;git-svn_path&gt; </code></pre> <p>The <code>master</code> branch is created automatically to track the <code>trunk</code>.</p></li> <...
<p>Here is what I've come up with:</p> <ol> <li><p>Create the <code>git-svn</code> repository if it doesn't exist already:</p> <pre><code>git svn init --std-layout &lt;svn_url&gt; &lt;git-svn_path&gt; </code></pre> <p>The <code>master</code> branch is created automatically to track the <code>trunk</code>.</p></li> <...
63, 119, 6452, 43087, 64649
git, githooks, git-svn, svn, svn-hooks
<h1>Automatically synchronizing a Subversion repository and a Git repository</h1> <p>My project has a Subversion repository on a network file system, and a new team would like to access it using Git, and be able to commit to it and get updates from it.</p> <p>What I have in mind is to create a new bare <code>git-svn</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,850
git
# Automatically synchronizing a Subversion repository and a Git repository My project has a Subversion repository on a network file system, and a new team would like to access it using Git, and be able to commit to it and get updates from it. What I have in mind is to create a new bare `git-svn` clone of the Subversi...
Here is what I've come up with: 1. Create the `git-svn` repository if it doesn't exist already: ``` git svn init --std-layout <svn_url> <git-svn_path> ``` The `master` branch is created automatically to track the `trunk`. 2. To avoid name ambiguities with Subversion-tracking branches, make the original S...
6191742
Git clone on Mac with HTTPS not working
6
2011-05-31 18:17:39
<p>I use Git in Windows and Linux on a daily basis and I was just trying to get it going on my Mac but am having an issue doing a simple <code>git clone</code>. I used the installer from the Git website as well as the bash script which adds the environment variable in <code>~/.MacOSX</code></p> <p>I say that because I...
11,058
407,202
2012-08-21 19:57:29
6,192,195
13
2011-05-31 18:59:19
407,202
2011-05-31 18:59:19
https://stackoverflow.com/q/6191742
https://stackoverflow.com/a/6192195
<p>This is what worked for me and it may or may not be the best solution but its certainly the easiest.</p> <p><code>git config --global --add http.sslVerify false</code></p>
<p>This is what worked for me and it may or may not be the best solution but its certainly the easiest.</p> <p><code>git config --global --add http.sslVerify false</code></p>
119, 369
git, macos
<h1>Git clone on Mac with HTTPS not working</h1> <p>I use Git in Windows and Linux on a daily basis and I was just trying to get it going on my Mac but am having an issue doing a simple <code>git clone</code>. I used the installer from the Git website as well as the bash script which adds the environment variable in <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,851
git
# Git clone on Mac with HTTPS not working I use Git in Windows and Linux on a daily basis and I was just trying to get it going on my Mac but am having an issue doing a simple `git clone`. I used the installer from the Git website as well as the bash script which adds the environment variable in `~/.MacOSX` I say tha...
This is what worked for me and it may or may not be the best solution but its certainly the easiest. `git config --global --add http.sslVerify false`
5962963
How to find out or change url for Git Repository server
6
2011-05-11 10:45:26
<p>I've installed Git and Gitosis on Ubuntu server which has 3 domain names parked. How do I know, which of these domain names are used by Git to construct Git access url, like for example, this: git@xxxxxxxx/repository.git Where can I set up this xxxxxxx value? Thank you in advance, Git looks to be great.</p>
16,209
469,575
2011-05-11 19:48:49
5,963,010
13
2011-05-11 10:50:13
449,342
2011-05-11 10:55:15
https://stackoverflow.com/q/5962963
https://stackoverflow.com/a/5963010
<p>(1) As for the domain names - as long as they all resolve to the server IP, it shouldn't matter. Git ultimately connects over SSH, in this case to your gitosis server. If you can connect via SSH to your machine via any of those parked domains, you can use it as your git url.</p> <p>I don't believe that git allows...
<p>(1) As for the domain names - as long as they all resolve to the server IP, it shouldn't matter. Git ultimately connects over SSH, in this case to your gitosis server. If you can connect via SSH to your machine via any of those parked domains, you can use it as your git url.</p> <p>I don't believe that git allows...
119, 549, 24526
git, gitosis, ubuntu
<h1>How to find out or change url for Git Repository server</h1> <p>I've installed Git and Gitosis on Ubuntu server which has 3 domain names parked. How do I know, which of these domain names are used by Git to construct Git access url, like for example, this: git@xxxxxxxx/repository.git Where can I set up this xxxxxxx...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,852
git
# How to find out or change url for Git Repository server I've installed Git and Gitosis on Ubuntu server which has 3 domain names parked. How do I know, which of these domain names are used by Git to construct Git access url, like for example, this: git@xxxxxxxx/repository.git Where can I set up this xxxxxxx value? T...
(1) As for the domain names - as long as they all resolve to the server IP, it shouldn't matter. Git ultimately connects over SSH, in this case to your gitosis server. If you can connect via SSH to your machine via any of those parked domains, you can use it as your git url. I don't believe that git allows you to list...
5598010
How to tag a Git repo from Xcode 4
6
2011-04-08 16:22:00
<p>It might be silly, but i just can't figure it out:</p> <p>i added git support for my project after creating it, by closing Xcode and, from terminal:</p> <pre><code>$ git init $ git commit -a -m "Initial commit" </code></pre> <p>When i reopen Xcode, it detects my local repository just fine, except for the fact tha...
3,888
495,904
2011-04-21 17:57:43
5,747,938
13
2011-04-21 17:57:43
431,272
2011-04-21 17:57:43
https://stackoverflow.com/q/5598010
https://stackoverflow.com/a/5747938
<p>Xcode 4 doesn't have a way to do a lot of SCM things, but it does cope with you doing most things via the command line (even while it is running). So if you want to make a tag make sure what you want tagged is committed and then do it like you would from the command line:</p> <pre><code>git tag -a -m "Mostly work...
<p>Xcode 4 doesn't have a way to do a lot of SCM things, but it does cope with you doing most things via the command line (even while it is running). So if you want to make a tag make sure what you want tagged is committed and then do it like you would from the command line:</p> <pre><code>git tag -a -m "Mostly work...
119, 154, 908, 7003
git, iphone, objective-c, xcode
<h1>How to tag a Git repo from Xcode 4</h1> <p>It might be silly, but i just can't figure it out:</p> <p>i added git support for my project after creating it, by closing Xcode and, from terminal:</p> <pre><code>$ git init $ git commit -a -m "Initial commit" </code></pre> <p>When i reopen Xcode, it detects my local r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,853
git
# How to tag a Git repo from Xcode 4 It might be silly, but i just can't figure it out: i added git support for my project after creating it, by closing Xcode and, from terminal: ``` $ git init $ git commit -a -m "Initial commit" ``` When i reopen Xcode, it detects my local repository just fine, except for the fact...
Xcode 4 doesn't have a way to do a lot of SCM things, but it does cope with you doing most things via the command line (even while it is running). So if you want to make a tag make sure what you want tagged is committed and then do it like you would from the command line: ``` git tag -a -m "Mostly works" project_v0.2 ...
5266340
how tell 'git' to 'forget' ALL prior commits?
6
2011-03-10 21:50:09
<p>I need to start a new project based on one tiny part of an another project of mine whose repo is at github.</p> <p>I did a git clone into a new project folder... fine.</p> <p>I deleted everything I didnt need, got rid of the old migrations etc.... fine.</p> <p>now it runs fine locally, BUT 'git log' shows ALL the...
972
597,992
2012-06-20 21:23:23
5,266,357
13
2011-03-10 21:51:30
37,020
2011-03-10 21:51:30
https://stackoverflow.com/q/5266340
https://stackoverflow.com/a/5266357
<p>Delete the <code>.git</code> folder, run <code>git init</code> and <code>git add</code> </p>
<p>Delete the <code>.git</code> folder, run <code>git init</code> and <code>git add</code> </p>
119
git
<h1>how tell 'git' to 'forget' ALL prior commits?</h1> <p>I need to start a new project based on one tiny part of an another project of mine whose repo is at github.</p> <p>I did a git clone into a new project folder... fine.</p> <p>I deleted everything I didnt need, got rid of the old migrations etc.... fine.</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,854
git
# how tell 'git' to 'forget' ALL prior commits? I need to start a new project based on one tiny part of an another project of mine whose repo is at github. I did a git clone into a new project folder... fine. I deleted everything I didnt need, got rid of the old migrations etc.... fine. now it runs fine locally, BU...
Delete the `.git` folder, run `git init` and `git add`
4340670
Git downloading trunk using subversion bridge
6
2010-12-02 22:30:19
<p>I am using the git to subversion bridge to check out a subversion repository. Initially I was using this command, </p> <pre><code>get svn clone -s svn://repositoryName/etc </code></pre> <p>But our subversion repository is massive, many years of development, many branches, etc.</p> <p>The consequence is that the p...
2,785
133,476
2010-12-02 23:36:38
4,341,053
13
2010-12-02 23:24:33
199,594
2010-12-02 23:36:38
https://stackoverflow.com/q/4340670
https://stackoverflow.com/a/4341053
<p>This should work:</p> <pre><code>git svn clone svn://repositoryName/whatever/trunk </code></pre> <p>The --trunk option isn't what you're looking for. It's a way to specify the name of the directory that's typically called "trunk". For example, if your svn repository used "/main" for primary development, "/release...
<p>This should work:</p> <pre><code>git svn clone svn://repositoryName/whatever/trunk </code></pre> <p>The --trunk option isn't what you're looking for. It's a way to specify the name of the directory that's typically called "trunk". For example, if your svn repository used "/main" for primary development, "/release...
63, 119, 6452
git, git-svn, svn
<h1>Git downloading trunk using subversion bridge</h1> <p>I am using the git to subversion bridge to check out a subversion repository. Initially I was using this command, </p> <pre><code>get svn clone -s svn://repositoryName/etc </code></pre> <p>But our subversion repository is massive, many years of development, ma...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,855
git
# Git downloading trunk using subversion bridge I am using the git to subversion bridge to check out a subversion repository. Initially I was using this command, ``` get svn clone -s svn://repositoryName/etc ``` But our subversion repository is massive, many years of development, many branches, etc. The consequence...
This should work: ``` git svn clone svn://repositoryName/whatever/trunk ``` The --trunk option isn't what you're looking for. It's a way to specify the name of the directory that's typically called "trunk". For example, if your svn repository used "/main" for primary development, "/releases" instead of "/tags" and "/...
1729924
Rebase many commits to one in Git. What am I doing wrong?
6
2009-11-13 15:27:28
<p>I would like to combine many commits in to one. I have followed the method described at a previous StackOverflow <a href="https://stackoverflow.com/questions/435646/how-do-i-combine-the-first-two-commits-of-a-git-repository">answer</a> which says:</p> <pre><code># Go back to the last commit that we want to form the...
2,959
200,265
2009-11-14 13:33:21
1,730,081
13
2009-11-13 15:49:41
122,661
2009-11-13 17:41:14
https://stackoverflow.com/q/1729924
https://stackoverflow.com/a/1730081
<p>If what you want to do is make this:</p> <pre><code>A-B-C-D-E </code></pre> <p>into:</p> <pre><code>A-BCD-E </code></pre> <p>You can simply give this command:</p> <pre><code>$ git rebase -i &lt;sha1_for_A&gt; </code></pre> <p>And then edit this:</p> <pre><code>pick B pick C pick D pick E </code></pre> <p>to ...
<p>If what you want to do is make this:</p> <pre><code>A-B-C-D-E </code></pre> <p>into:</p> <pre><code>A-BCD-E </code></pre> <p>You can simply give this command:</p> <pre><code>$ git rebase -i &lt;sha1_for_A&gt; </code></pre> <p>And then edit this:</p> <pre><code>pick B pick C pick D pick E </code></pre> <p>to ...
119
git
<h1>Rebase many commits to one in Git. What am I doing wrong?</h1> <p>I would like to combine many commits in to one. I have followed the method described at a previous StackOverflow <a href="https://stackoverflow.com/questions/435646/how-do-i-combine-the-first-two-commits-of-a-git-repository">answer</a> which says:</p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,856
git
# Rebase many commits to one in Git. What am I doing wrong? I would like to combine many commits in to one. I have followed the method described at a previous StackOverflow [answer](https://stackoverflow.com/questions/435646/how-do-i-combine-the-first-two-commits-of-a-git-repository) which says: ``` # Go back to the ...
If what you want to do is make this: ``` A-B-C-D-E ``` into: ``` A-BCD-E ``` You can simply give this command: ``` $ git rebase -i <sha1_for_A> ``` And then edit this: ``` pick B pick C pick D pick E ``` to read: ``` pick B squash C squash D pick E ``` If there are no conflicts, you are done. **However**, if...
6457044
Forgot "git rebase --continue" and did "git commit". How to fix?
140
2011-06-23 15:56:21
<p>I was rebasing code in git, I got some merge conflicts. I resolved the conflicts and did:</p> <pre><code>git add </code></pre> <p>At this point I forgot to do:</p> <pre><code>git rebase --continue </code></pre> <p>I continued coding and did:</p> <pre><code>git commit </code></pre> <p>for the changes. Now I am ...
85,148
326,658
2020-07-26 10:27:49
6,458,095
12
2011-06-23 17:23:06
65,977
2020-07-26 10:27:49
https://stackoverflow.com/q/6457044
https://stackoverflow.com/a/6458095
<p><strong>EDIT</strong>: Look at the answer below as well to see if that's an easier solution for you. <a href="https://stackoverflow.com/a/12163247/493106">https://stackoverflow.com/a/12163247/493106</a></p> <hr /> <p>I'd have to try it out, but I think this is what I would do:</p> <ol> <li>Tag your latest commit (o...
<p><strong>EDIT</strong>: Look at the answer below as well to see if that's an easier solution for you. <a href="https://stackoverflow.com/a/12163247/493106">https://stackoverflow.com/a/12163247/493106</a></p> <hr /> <p>I'd have to try it out, but I think this is what I would do:</p> <ol> <li>Tag your latest commit (o...
119
git
<h1>Forgot "git rebase --continue" and did "git commit". How to fix?</h1> <p>I was rebasing code in git, I got some merge conflicts. I resolved the conflicts and did:</p> <pre><code>git add </code></pre> <p>At this point I forgot to do:</p> <pre><code>git rebase --continue </code></pre> <p>I continued coding and di...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,857
git
# Forgot "git rebase --continue" and did "git commit". How to fix? I was rebasing code in git, I got some merge conflicts. I resolved the conflicts and did: ``` git add ``` At this point I forgot to do: ``` git rebase --continue ``` I continued coding and did: ``` git commit ``` for the changes. Now I am on `"no...
**EDIT**: Look at the answer below as well to see if that's an easier solution for you. <https://stackoverflow.com/a/12163247/493106> --- I'd have to try it out, but I think this is what I would do: 1. Tag your latest commit (or just write down its SHA1 somewhere so you don't lose it): `git tag temp` 2. `git rebase ...
19279937
How do I configure Git to automatically pull from current branch when using "git pull"?
60
2013-10-09 18:34:28
<p>With our current setup you always have to enter the branch name (ie: <code>git pull origin feature-branch</code>" when doing a pull. I've already made the mistake of pulling from one branch into another, accidentally merging two branches with two very different releases. I'd like to avoid this by configuring Git so ...
62,148
347,884
2023-04-26 19:56:32
19,279,975
12
2013-10-09 18:36:58
234,723
2015-05-27 10:23:54
https://stackoverflow.com/q/19279937
https://stackoverflow.com/a/19279975
<p>You can create a tracking branch. From the Git Book (<a href="http://git-scm.com/book/en/Git-Branching-Remote-Branches">http://git-scm.com/book/en/Git-Branching-Remote-Branches</a>): </p> <blockquote> <p>When you clone a repository, it generally automatically creates a <code>master</code> branch that tracks <co...
<p>You can create a tracking branch. From the Git Book (<a href="http://git-scm.com/book/en/Git-Branching-Remote-Branches">http://git-scm.com/book/en/Git-Branching-Remote-Branches</a>): </p> <blockquote> <p>When you clone a repository, it generally automatically creates a <code>master</code> branch that tracks <co...
119, 1879, 3574
branch, config, git
<h1>How do I configure Git to automatically pull from current branch when using "git pull"?</h1> <p>With our current setup you always have to enter the branch name (ie: <code>git pull origin feature-branch</code>" when doing a pull. I've already made the mistake of pulling from one branch into another, accidentally mer...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,858
git
# How do I configure Git to automatically pull from current branch when using "git pull"? With our current setup you always have to enter the branch name (ie: `git pull origin feature-branch`" when doing a pull. I've already made the mistake of pulling from one branch into another, accidentally merging two branches wi...
You can create a tracking branch. From the Git Book (<http://git-scm.com/book/en/Git-Branching-Remote-Branches>): > When you clone a repository, it generally automatically creates a > `master` branch that tracks `origin/master`. That’s why `git push` and > `git pull` work out of the box with no other arguments. Howeve...
37432290
Sonarqube: Missing blame information for the following files
58
2016-05-25 08:58:59
<p>I am getting the warning <code>Missing blame information for the following files</code> during analysis by SonarQube.</p> <pre><code>[INFO] [22:19:57.714] Sensor SCM Sensor [INFO] [22:19:57.715] SCM provider for this project is: git [INFO] [22:19:57.715] 48 files to be analyzed [INFO] [22:19:58.448] 0/48 files anal...
142,492
766,786
2025-03-27 05:45:48
37,568,637
12
2016-06-01 12:26:40
766,786
2016-06-01 12:26:40
https://stackoverflow.com/q/37432290
https://stackoverflow.com/a/37568637
<p>The cause was a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372" rel="noreferrer">JGit bug</a>. JGit does not support <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer"><code>.gitattributes</code></a>. I had <a href="https://stackoverflow.com/questions/1792838/how-do-i-enable-ident-strin...
<p>The cause was a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372" rel="noreferrer">JGit bug</a>. JGit does not support <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer"><code>.gitattributes</code></a>. I had <a href="https://stackoverflow.com/questions/1792838/how-do-i-enable-ident-strin...
17, 119, 41127, 64999, 98290
git, java, jenkins, maven, sonarqube
<h1>Sonarqube: Missing blame information for the following files</h1> <p>I am getting the warning <code>Missing blame information for the following files</code> during analysis by SonarQube.</p> <pre><code>[INFO] [22:19:57.714] Sensor SCM Sensor [INFO] [22:19:57.715] SCM provider for this project is: git [INFO] [22:19...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,859
git
# Sonarqube: Missing blame information for the following files I am getting the warning `Missing blame information for the following files` during analysis by SonarQube. ``` [INFO] [22:19:57.714] Sensor SCM Sensor [INFO] [22:19:57.715] SCM provider for this project is: git [INFO] [22:19:57.715] 48 files to be analyze...
The cause was a [JGit bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372). JGit does not support [`.gitattributes`](https://git-scm.com/docs/gitattributes). I had [`ident`](https://stackoverflow.com/questions/1792838/how-do-i-enable-ident-string-for-git-repos) in my `.gitattributes`. Plain console `git` checked ...
5440610
Git and DiffTool problems : What do LOCAL and REMOTE point to?
47
2011-03-26 05:55:03
<p>Ive been working on getting tortoisemerge working as the difftool option in Git with my .gitconfig file currently showing :</p> <pre><code> [diff] tool = tortoise [difftool "tortoise"] cmd = tortoisemerge.exe -mine:$LOCAL -base:$REMOTE [difftool] prompt = false </code></pre> <p>...
36,170
467,485
2013-09-17 08:06:52
5,440,680
12
2011-03-26 06:17:39
223,092
2011-03-26 06:17:39
https://stackoverflow.com/q/5440610
https://stackoverflow.com/a/5440680
<p>I think that means that <code>$LOCAL</code> is always the <code>a/whatever</code> in the diff output, while <code>$REMOTE</code> is the <code>b/whatever</code>. In other words, if you do:</p> <pre><code> git difftool master experiment -- Makefile </code></pre> <p><code>$LOCAL</code> will be a temporary file showi...
<p>I think that means that <code>$LOCAL</code> is always the <code>a/whatever</code> in the diff output, while <code>$REMOTE</code> is the <code>b/whatever</code>. In other words, if you do:</p> <pre><code> git difftool master experiment -- Makefile </code></pre> <p><code>$LOCAL</code> will be a temporary file showi...
119, 33608
difftool, git
<h1>Git and DiffTool problems : What do LOCAL and REMOTE point to?</h1> <p>Ive been working on getting tortoisemerge working as the difftool option in Git with my .gitconfig file currently showing :</p> <pre><code> [diff] tool = tortoise [difftool "tortoise"] cmd = tortoisemerge.exe -mine:$LOCAL...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,861
git
# Git and DiffTool problems : What do LOCAL and REMOTE point to? Ive been working on getting tortoisemerge working as the difftool option in Git with my .gitconfig file currently showing : ``` [diff] tool = tortoise [difftool "tortoise"] cmd = tortoisemerge.exe -mine:$LOCAL -base:$REMOTE ...
I think that means that `$LOCAL` is always the `a/whatever` in the diff output, while `$REMOTE` is the `b/whatever`. In other words, if you do: ``` git difftool master experiment -- Makefile ``` `$LOCAL` will be a temporary file showing the the state of `Makefile` in the `master` branch, while `$REMOTE` will be a te...
17527276
Git; code for a whole function disappeared after a merge
46
2013-07-08 12:58:13
<p>My colleague did a change a while back - introduced a new function - and that was (successfully) committed to Git. Now, though, that function has gone missing.</p> <p>Using <code>git log --reverse</code> I've managed to find the last commit where that function was still in the code (48d60a03). The next (e6f28bfd) co...
34,603
1,738,303
2022-06-07 21:41:57
17,528,427
12
2013-07-08 13:52:56
498,699
2022-06-07 21:38:32
https://stackoverflow.com/q/17527276
https://stackoverflow.com/a/17528427
<p>Because your history has already been pushed, the best way is to make a new commit. Otherwise, you run the risk of losing other code and messing up everyone's repos.</p> <p>Since you know where the commit that last had the function, you can <code>git checkout 48d60a03 -- &lt;name of file with function&gt;</code>. ...
<p>Because your history has already been pushed, the best way is to make a new commit. Otherwise, you run the risk of losing other code and messing up everyone's repos.</p> <p>Since you know where the commit that last had the function, you can <code>git checkout 48d60a03 -- &lt;name of file with function&gt;</code>. ...
119
git
<h1>Git; code for a whole function disappeared after a merge</h1> <p>My colleague did a change a while back - introduced a new function - and that was (successfully) committed to Git. Now, though, that function has gone missing.</p> <p>Using <code>git log --reverse</code> I've managed to find the last commit where that...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,862
git
# Git; code for a whole function disappeared after a merge My colleague did a change a while back - introduced a new function - and that was (successfully) committed to Git. Now, though, that function has gone missing. Using `git log --reverse` I've managed to find the last commit where that function was still in the...
Because your history has already been pushed, the best way is to make a new commit. Otherwise, you run the risk of losing other code and messing up everyone's repos. Since you know where the commit that last had the function, you can `git checkout 48d60a03 -- <name of file with function>`. Then you can commit the old/...
7072213
How to stop tracking a file without removing it from repo
44
2011-08-16 00:08:00
<p>I have a config file which I want to keep on the remote repository, but I don't want to track its changes on my computer. Adding it to .gitignore doesn't do the trick.</p> <p>The reason I don't want to track changes is because it's supposed to differ between computers depending on their environment.</p>
20,110
378,622
2024-11-25 09:39:44
7,072,230
12
2011-08-16 00:10:34
501,250
2011-08-16 00:10:34
https://stackoverflow.com/q/7072213
https://stackoverflow.com/a/7072230
<p>If that's the case then you shouldn't have the file versioned at all; you should version a template of the file. For example, if the configuration file is <code>foo/config.txt</code> then you should have a versioned <code>foo/config.txt.template</code> in the repository with example (or blank) configuration setting...
<p>If that's the case then you shouldn't have the file versioned at all; you should version a template of the file. For example, if the configuration file is <code>foo/config.txt</code> then you should have a versioned <code>foo/config.txt.template</code> in the repository with example (or blank) configuration setting...
119
git
<h1>How to stop tracking a file without removing it from repo</h1> <p>I have a config file which I want to keep on the remote repository, but I don't want to track its changes on my computer. Adding it to .gitignore doesn't do the trick.</p> <p>The reason I don't want to track changes is because it's supposed to diff...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,864
git
# How to stop tracking a file without removing it from repo I have a config file which I want to keep on the remote repository, but I don't want to track its changes on my computer. Adding it to .gitignore doesn't do the trick. The reason I don't want to track changes is because it's supposed to differ between comput...
If that's the case then you shouldn't have the file versioned at all; you should version a template of the file. For example, if the configuration file is `foo/config.txt` then you should have a versioned `foo/config.txt.template` in the repository with example (or blank) configuration settings. `foo/config.txt` should...
2285699
Git: How to create patches for a merge?
40
2010-02-18 01:21:51
<p>When I use <code>git format-patch</code>, it doesn't seem to include merges. How can I perform a merge and then e-mail it to someone as a set of patches?</p> <p>For example, let's say that I merge two branches and perform another commit on top of the merge:</p> <pre><code>git init echo "initial file" &gt; test.tx...
38,454
172,714
2022-01-20 10:32:15
2,286,618
12
2010-02-18 05:56:50
211,105
2010-02-18 05:56:50
https://stackoverflow.com/q/2285699
https://stackoverflow.com/a/2286618
<p>If you examine the content of the first two patches you'll see the issue:</p> <pre><code>diff --git a/test.txt b/test.txt --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +foo diff --git a/test.txt b/test.txt index 7c21ad4..5716ca5 100644 --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +bar </code><...
<p>If you examine the content of the first two patches you'll see the issue:</p> <pre><code>diff --git a/test.txt b/test.txt --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +foo diff --git a/test.txt b/test.txt index 7c21ad4..5716ca5 100644 --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +bar </code><...
119, 717, 2132
git, merge, patch
<h1>Git: How to create patches for a merge?</h1> <p>When I use <code>git format-patch</code>, it doesn't seem to include merges. How can I perform a merge and then e-mail it to someone as a set of patches?</p> <p>For example, let's say that I merge two branches and perform another commit on top of the merge:</p> <pre...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,865
git
# Git: How to create patches for a merge? When I use `git format-patch`, it doesn't seem to include merges. How can I perform a merge and then e-mail it to someone as a set of patches? For example, let's say that I merge two branches and perform another commit on top of the merge: ``` git init echo "initial file" >...
If you examine the content of the first two patches you'll see the issue: ``` diff --git a/test.txt b/test.txt --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +foo diff --git a/test.txt b/test.txt index 7c21ad4..5716ca5 100644 --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -initial file +bar ``` from the perspect...
39018619
How do you search for a branch in SourceTree
38
2016-08-18 12:45:22
<p>How do you search for a branch in SourceTree.</p> <p>It has gotten to the point where i have hundreds of branches and looking through a list in the remote branch tree is next to impossible.</p> <p>Is there a way of doing it?</p>
21,512
360,822
2025-09-11 11:37:26
39,018,759
12
2016-08-18 12:51:33
131,809
2016-08-18 12:51:33
https://stackoverflow.com/q/39018619
https://stackoverflow.com/a/39018759
<p>I don't think this is possible directly in SourceTree, but you can grep branches via the command line</p> <pre><code>git branch --all | grep &lt;query&gt; </code></pre> <p>for example</p> <pre><code>git branch --all | grep notifications </code></pre> <p>Will return all branches (remote or local) that contain <co...
<p>I don't think this is possible directly in SourceTree, but you can grep branches via the command line</p> <pre><code>git branch --all | grep &lt;query&gt; </code></pre> <p>for example</p> <pre><code>git branch --all | grep notifications </code></pre> <p>Will return all branches (remote or local) that contain <co...
119, 1879, 90056
atlassian-sourcetree, branch, git
<h1>How do you search for a branch in SourceTree</h1> <p>How do you search for a branch in SourceTree.</p> <p>It has gotten to the point where i have hundreds of branches and looking through a list in the remote branch tree is next to impossible.</p> <p>Is there a way of doing it?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
22,866
git
# How do you search for a branch in SourceTree How do you search for a branch in SourceTree. It has gotten to the point where i have hundreds of branches and looking through a list in the remote branch tree is next to impossible. Is there a way of doing it?
I don't think this is possible directly in SourceTree, but you can grep branches via the command line ``` git branch --all | grep <query> ``` for example ``` git branch --all | grep notifications ``` Will return all branches (remote or local) that contain `notifications` in the name.