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
5917249
Git symbolic links in Windows
378
2011-05-06 21:33:50
<p>Our developers use a mix of Windows and Unix-based OSes. Therefore, symbolic links created on Unix machines become a problem for Windows developers. In Windows (<a href="https://github.com/msysgit/" rel="noreferrer">MSysGit</a>), the symbolic link is converted to a text file with a path to the file it points to. Ins...
215,469
615,315
2025-11-21 09:04:13
5,930,443
123
2011-05-08 21:17:33
19,750
2011-05-08 21:17:33
https://stackoverflow.com/q/5917249
https://stackoverflow.com/a/5930443
<p>You can find the symlinks by looking for files that have a mode of <code>120000</code>, possibly with this command:</p> <pre><code>git ls-files -s | awk '/120000/{print $4}' </code></pre> <p>Once you replace the links, I would recommend marking them as unchanged with <code>git update-index --assume-unchanged</code...
<p>You can find the symlinks by looking for files that have a mode of <code>120000</code>, possibly with this command:</p> <pre><code>git ls-files -s | awk '/120000/{print $4}' </code></pre> <p>Once you replace the links, I would recommend marking them as unchanged with <code>git update-index --assume-unchanged</code...
64, 119, 1122
git, symlink, windows
<h1>Git symbolic links in Windows</h1> <p>Our developers use a mix of Windows and Unix-based OSes. Therefore, symbolic links created on Unix machines become a problem for Windows developers. In Windows (<a href="https://github.com/msysgit/" rel="noreferrer">MSysGit</a>), the symbolic link is converted to a text file wi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,680
git
# Git symbolic links in Windows Our developers use a mix of Windows and Unix-based OSes. Therefore, symbolic links created on Unix machines become a problem for Windows developers. In Windows ([MSysGit](https://github.com/msysgit/)), the symbolic link is converted to a text file with a path to the file it points to. I...
You can find the symlinks by looking for files that have a mode of `120000`, possibly with this command: ``` git ls-files -s | awk '/120000/{print $4}' ``` Once you replace the links, I would recommend marking them as unchanged with `git update-index --assume-unchanged`, rather than listing them in `.git/info/exclude...
17626944
Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes
148
2013-07-13 04:21:53
<p>I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which have worked.</p> <p>Anyways, I am simply unable to push, pull, or fetch from my Heroku repository ...
107,084
2,345,415
2016-06-13 16:35:09
17,631,730
123
2013-07-13 15:46:49
2,345,415
2013-07-13 15:46:49
https://stackoverflow.com/q/17626944
https://stackoverflow.com/a/17631730
<p>I just thought I'd share that I found the answer to my own question.</p> <p>Writing out my problem made it even more clear to me, and I further investigated into where I thought my problem lay: the ssh key</p> <p>Turns out I was right. The issue wasn't with the key itself, but rather that I had not added it to my ...
<p>I just thought I'd share that I found the answer to my own question.</p> <p>Writing out my problem made it even more clear to me, and I further investigated into where I thought my problem lay: the ssh key</p> <p>Turns out I was right. The issue wasn't with the key itself, but rather that I had not added it to my ...
119, 386, 7330, 8279, 57931
git, heroku, public-key, repository, ssh
<h1>Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes</h1> <p>I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,681
git
# Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which have worke...
I just thought I'd share that I found the answer to my own question. Writing out my problem made it even more clear to me, and I further investigated into where I thought my problem lay: the ssh key Turns out I was right. The issue wasn't with the key itself, but rather that I had not added it to my local Mac's list ...
26785118
HEAD~ vs HEAD^ vs HEAD@{} also known as tilde vs caret vs at sign
108
2014-11-06 16:59:53
<p>HEAD is a pointer at the current branch. I have seen a variety of notations for ancestors of HEAD including </p> <ul> <li><code>HEAD~2</code></li> <li><code>HEAD^2</code></li> <li><code>HEAD@{2}</code></li> <li><code>HEAD~~</code></li> <li><code>HEAD^^</code></li> </ul> <p>What does each of the above mean, exactly...
24,520
1,108,891
2021-10-22 14:27:04
26,785,200
123
2014-11-06 17:04:40
1,843,331
2021-10-22 14:27:04
https://stackoverflow.com/q/26785118
https://stackoverflow.com/a/26785200
<p>From the docs <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection" rel="noreferrer">here</a>.</p> <ul> <li><code>HEAD~2</code> : 2 commits older than HEAD</li> <li><code>HEAD^2</code> : the second parent of HEAD, if HEAD was a merge, otherwise illegal</li> <li><code>HEAD@{2}</code> : refers to the 3...
<p>From the docs <a href="https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection" rel="noreferrer">here</a>.</p> <ul> <li><code>HEAD~2</code> : 2 commits older than HEAD</li> <li><code>HEAD^2</code> : the second parent of HEAD, if HEAD was a merge, otherwise illegal</li> <li><code>HEAD@{2}</code> : refers to the 3...
119
git
<h1>HEAD~ vs HEAD^ vs HEAD@{} also known as tilde vs caret vs at sign</h1> <p>HEAD is a pointer at the current branch. I have seen a variety of notations for ancestors of HEAD including </p> <ul> <li><code>HEAD~2</code></li> <li><code>HEAD^2</code></li> <li><code>HEAD@{2}</code></li> <li><code>HEAD~~</code></li> <li><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,682
git
# HEAD~ vs HEAD^ vs HEAD@{} also known as tilde vs caret vs at sign HEAD is a pointer at the current branch. I have seen a variety of notations for ancestors of HEAD including - `HEAD~2` - `HEAD^2` - `HEAD@{2}` - `HEAD~~` - `HEAD^^` What does each of the above mean, exactly? Where is the documentation for this?
From the docs [here](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection). - `HEAD~2` : 2 commits older than HEAD - `HEAD^2` : the second parent of HEAD, if HEAD was a merge, otherwise illegal - `HEAD@{2}` : refers to the 3rd listing in the overview of `git reflog` - `HEAD~~` : 2 commits older than HEAD - `HEA...
2071288
Equivalent in git of "hg cat" or "svn cat"
93
2010-01-15 12:07:25
<p>I want to extract a copy of the latest version of a file held in a git repository, and pass it into a script for some processing. With svn or hg, I just use the "cat" command:</p> <blockquote> <p>Print the specified files as they were at the given revision. If no revision is given, the parent of the working di...
16,790
142,293
2015-06-09 03:45:59
2,071,300
123
2010-01-15 12:09:39
228,936
2010-01-15 12:09:39
https://stackoverflow.com/q/2071288
https://stackoverflow.com/a/2071300
<pre><code>git show rev:path/to/file </code></pre> <p>Where <em>rev</em> is the revision.</p> <p>See <a href="http://git.or.cz/course/svn.html" rel="noreferrer">http://git.or.cz/course/svn.html</a> for a comparison of git and svn commands.</p>
<pre><code>git show rev:path/to/file </code></pre> <p>Where <em>rev</em> is the revision.</p> <p>See <a href="http://git.or.cz/course/svn.html" rel="noreferrer">http://git.or.cz/course/svn.html</a> for a comparison of git and svn commands.</p>
119, 456
git, version-control
<h1>Equivalent in git of "hg cat" or "svn cat"</h1> <p>I want to extract a copy of the latest version of a file held in a git repository, and pass it into a script for some processing. With svn or hg, I just use the "cat" command:</p> <blockquote> <p>Print the specified files as they were at the given revision. If ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,683
git
# Equivalent in git of "hg cat" or "svn cat" I want to extract a copy of the latest version of a file held in a git repository, and pass it into a script for some processing. With svn or hg, I just use the "cat" command: > Print the specified files as they were at the given revision. If > no revision is given, the pa...
``` git show rev:path/to/file ``` Where *rev* is the revision. See <http://git.or.cz/course/svn.html> for a comparison of git and svn commands.
35507239
Merge and delete branch in one step/command
77
2016-02-19 14:06:40
<p>Is it possible, to <code>merge</code> a branch and automatically <code>delete</code> it with a single command? The delete step should only be executed if merging was successful.</p>
85,386
2,630,261
2022-09-10 01:14:43
35,507,680
123
2016-02-19 14:29:36
4,787,126
2018-05-08 17:49:53
https://stackoverflow.com/q/35507239
https://stackoverflow.com/a/35507680
<p>No, git doesn't support this at the same time.</p> <p>However, you can run the commands in a shell conditionally:</p> <pre><code>git merge source-branch &amp;&amp; git branch -d source-branch </code></pre> <p><strong>Edit:</strong></p> <p><code>-d</code> will only remove merged branches while <code>-D</code> wil...
<p>No, git doesn't support this at the same time.</p> <p>However, you can run the commands in a shell conditionally:</p> <pre><code>git merge source-branch &amp;&amp; git branch -d source-branch </code></pre> <p><strong>Edit:</strong></p> <p><code>-d</code> will only remove merged branches while <code>-D</code> wil...
119, 717, 53847, 76220
branching-and-merging, git, git-branch, merge
<h1>Merge and delete branch in one step/command</h1> <p>Is it possible, to <code>merge</code> a branch and automatically <code>delete</code> it with a single command? The delete step should only be executed if merging was successful.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,686
git
# Merge and delete branch in one step/command Is it possible, to `merge` a branch and automatically `delete` it with a single command? The delete step should only be executed if merging was successful.
No, git doesn't support this at the same time. However, you can run the commands in a shell conditionally: ``` git merge source-branch && git branch -d source-branch ``` **Edit:** `-d` will only remove merged branches while `-D` will also remove unmerged branches, so `-d` will ensure that the branch is merged and y...
41716793
How to get complete git commit hash from short hash?
68
2017-01-18 10:23:02
<p>I have a short git commit hash of length 8 characters. I want to get a complete hash from remote server. I tried getting the branch name from the commit hash and then getting the full commit hash from branch name but it only works for the latest commit. What could be the best possible way to achieve what I want? </p...
44,561
3,464,599
2017-01-18 10:36:57
41,717,108
123
2017-01-18 10:36:57
733,345
2017-01-18 10:36:57
https://stackoverflow.com/q/41716793
https://stackoverflow.com/a/41717108
<p><code>git rev-parse</code> will give you what you want.</p> <pre><code>$ git rev-parse 3cdd5d 3cdd5d19178a54d2e51b5098d43b57571241d0ab </code></pre>
<p><code>git rev-parse</code> will give you what you want.</p> <pre><code>$ git rev-parse 3cdd5d 3cdd5d19178a54d2e51b5098d43b57571241d0ab </code></pre>
119
git
<h1>How to get complete git commit hash from short hash?</h1> <p>I have a short git commit hash of length 8 characters. I want to get a complete hash from remote server. I tried getting the branch name from the commit hash and then getting the full commit hash from branch name but it only works for the latest commit. W...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,687
git
# How to get complete git commit hash from short hash? I have a short git commit hash of length 8 characters. I want to get a complete hash from remote server. I tried getting the branch name from the commit hash and then getting the full commit hash from branch name but it only works for the latest commit. What could...
`git rev-parse` will give you what you want. ``` $ git rev-parse 3cdd5d 3cdd5d19178a54d2e51b5098d43b57571241d0ab ```
10657315
Git merge left HEAD marks in my files
135
2012-05-18 17:41:33
<p>I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted. </p> <p>I thought that was the end of it, but then I realized there are gitmarks in my files. Like so:</p> <pre><code>start = expression validchar = [0-9a-zA-Z_?!+\-=@#$%^&amp;*/.] int...
98,119
387,405
2022-06-25 21:04:11
10,657,351
122
2012-05-18 17:44:24
148,870
2012-05-18 17:52:49
https://stackoverflow.com/q/10657315
https://stackoverflow.com/a/10657351
<p>Those are <a href="https://stackoverflow.com/questions/7901864/git-conflict-markers">conflict markers</a>. You're still in the process of merging, but there were some parts that Git couldn't merge automatically. You'll <a href="http://schacon.github.com/git/user-manual.html#resolving-a-merge" rel="noreferrer">need t...
<p>Those are <a href="https://stackoverflow.com/questions/7901864/git-conflict-markers">conflict markers</a>. You're still in the process of merging, but there were some parts that Git couldn't merge automatically. You'll <a href="http://schacon.github.com/git/user-manual.html#resolving-a-merge" rel="noreferrer">need t...
119, 28897, 62599, 106113
git, git-merge, git-merge-conflict, merge-conflict-resolution
<h1>Git merge left HEAD marks in my files</h1> <p>I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted. </p> <p>I thought that was the end of it, but then I realized there are gitmarks in my files. Like so:</p> <pre><code>start = expression validc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,689
git
# Git merge left HEAD marks in my files I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted. I thought that was the end of it, but then I realized there are gitmarks in my files. Like so: ``` start = expression validchar = [0-9a-zA-Z_?!+\-=...
Those are [conflict markers](https://stackoverflow.com/questions/7901864/git-conflict-markers). You're still in the process of merging, but there were some parts that Git couldn't merge automatically. You'll [need to hand-edit those parts](http://schacon.github.com/git/user-manual.html#resolving-a-merge) to what you wa...
1558719
Using a remote repository with non-standard port
134
2009-10-13 07:37:23
<p>I am setting up my local git project for a remote repository. The remote repository is being served on a non-standard port (4019).</p> <p>But it doesn't work. Instead I get the following error message:</p> <pre><code>ssh: connect to host git.host.de:4019 port 22: Connection refused fatal: The remote end hung up un...
155,113
175,927
2015-09-21 01:32:36
1,558,735
122
2009-10-13 07:42:08
19,563
2009-10-13 07:49:15
https://stackoverflow.com/q/1558719
https://stackoverflow.com/a/1558735
<p>If you put something like this in your <code>.ssh/config</code>:</p> <pre><code>Host githost HostName git.host.de Port 4019 User root </code></pre> <p>then you should be able to use the basic syntax:</p> <pre><code>git push githost:/var/cache/git/project.git master </code></pre>
<p>If you put something like this in your <code>.ssh/config</code>:</p> <pre><code>Host githost HostName git.host.de Port 4019 User root </code></pre> <p>then you should be able to use the basic syntax:</p> <pre><code>git push githost:/var/cache/git/project.git master </code></pre>
119
git
<h1>Using a remote repository with non-standard port</h1> <p>I am setting up my local git project for a remote repository. The remote repository is being served on a non-standard port (4019).</p> <p>But it doesn't work. Instead I get the following error message:</p> <pre><code>ssh: connect to host git.host.de:4019 po...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,690
git
# Using a remote repository with non-standard port I am setting up my local git project for a remote repository. The remote repository is being served on a non-standard port (4019). But it doesn't work. Instead I get the following error message: ``` ssh: connect to host git.host.de:4019 port 22: Connection refused f...
If you put something like this in your `.ssh/config`: ``` Host githost HostName git.host.de Port 4019 User root ``` then you should be able to use the basic syntax: ``` git push githost:/var/cache/git/project.git master ```
28011104
Undo git add --all
105
2015-01-18 15:00:28
<p>I made a mistake and called <code>git add -all</code>, now all files are added. I did not make a <code>commit</code> and <code>push</code>. How can I <em>undo</em> my action?</p>
97,486
2,630,261
2017-06-17 06:15:18
28,011,139
122
2015-01-18 15:03:30
123,527
2015-01-18 15:03:30
https://stackoverflow.com/q/28011104
https://stackoverflow.com/a/28011139
<p>It has already been answered several times:</p> <blockquote> <p>You can use <code>git reset</code>. This will 'unstage' all the files you've added after your last commit.</p> <p>If you want to unstage only some files, use <code>git reset -- &lt;file 1&gt; &lt;file 2&gt; &lt;file n&gt;</code>.</p> <p...
<p>It has already been answered several times:</p> <blockquote> <p>You can use <code>git reset</code>. This will 'unstage' all the files you've added after your last commit.</p> <p>If you want to unstage only some files, use <code>git reset -- &lt;file 1&gt; &lt;file 2&gt; &lt;file n&gt;</code>.</p> <p...
119, 34792
git, git-add
<h1>Undo git add --all</h1> <p>I made a mistake and called <code>git add -all</code>, now all files are added. I did not make a <code>commit</code> and <code>push</code>. How can I <em>undo</em> my action?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,691
git
# Undo git add --all I made a mistake and called `git add -all`, now all files are added. I did not make a `commit` and `push`. How can I *undo* my action?
It has already been answered several times: > You can use `git reset`. This will 'unstage' all the files you've > added after your last commit. > > If you want to unstage only some files, use `git reset -- <file 1> > <file 2> <file n>`. > > Also it's possible to unstage some of the changes in files by using > `git res...
7147680
Accidentally reverted to master, lost uncommitted changes
105
2011-08-22 12:47:05
<p>While working on Master branch, I forgot to create new branch. Made changes to files then inadvertently reverted to the master, loosing all updates. I didn't commit the updated files.</p> <p>How can I retrieve them?</p>
177,228
267,096
2024-04-08 10:35:40
7,147,749
122
2011-08-22 12:52:41
566,627
2018-11-16 21:20:24
https://stackoverflow.com/q/7147680
https://stackoverflow.com/a/7147749
<p>If you had not <strong>commited</strong>, <strong>staged</strong>, or <strong>stashed</strong> the changes you made, there is no way you can recover those changes.</p> <p>EDIT: Recovering lost changes. Adding this on <a href="https://stackoverflow.com/users/223092/mark-longair">Mark Longair's</a> suggestion (in the...
<p>If you had not <strong>commited</strong>, <strong>staged</strong>, or <strong>stashed</strong> the changes you made, there is no way you can recover those changes.</p> <p>EDIT: Recovering lost changes. Adding this on <a href="https://stackoverflow.com/users/223092/mark-longair">Mark Longair's</a> suggestion (in the...
119
git
<h1>Accidentally reverted to master, lost uncommitted changes</h1> <p>While working on Master branch, I forgot to create new branch. Made changes to files then inadvertently reverted to the master, loosing all updates. I didn't commit the updated files.</p> <p>How can I retrieve them?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,692
git
# Accidentally reverted to master, lost uncommitted changes While working on Master branch, I forgot to create new branch. Made changes to files then inadvertently reverted to the master, loosing all updates. I didn't commit the updated files. How can I retrieve them?
If you had not **commited**, **staged**, or **stashed** the changes you made, there is no way you can recover those changes. EDIT: Recovering lost changes. Adding this on [Mark Longair's](https://stackoverflow.com/users/223092/mark-longair) suggestion (in the comment). This also includes a couple of SO links from his ...
7499938
Git show files that were changed in the last 2 days
85
2011-09-21 12:44:24
<p>How can I have a list with all the files that were changed in the last 2 days? I know about </p> <pre><code>git log --name-status --since="2 days ago" </code></pre> <p>but this will show me ids, dates and commit messages. All I need is the list of the file names which were changed.</p> <p>Is that possible with g...
45,528
86,112
2019-05-15 12:29:21
7,500,276
122
2011-09-21 13:07:51
204,388
2011-09-21 13:42:56
https://stackoverflow.com/q/7499938
https://stackoverflow.com/a/7500276
<pre><code>git log --pretty=format: --name-only --since="2 days ago" </code></pre> <p>if some files duplicate in multiple commits, you can use pipe to filter it</p> <pre><code>git log --pretty=format: --name-only --since="2 days ago" | sort | uniq </code></pre>
<pre><code>git log --pretty=format: --name-only --since="2 days ago" </code></pre> <p>if some files duplicate in multiple commits, you can use pipe to filter it</p> <pre><code>git log --pretty=format: --name-only --since="2 days ago" | sort | uniq </code></pre>
119, 942, 5310, 45879, 47913
file, fileupdate, git, git-log, logging
<h1>Git show files that were changed in the last 2 days</h1> <p>How can I have a list with all the files that were changed in the last 2 days? I know about </p> <pre><code>git log --name-status --since="2 days ago" </code></pre> <p>but this will show me ids, dates and commit messages. All I need is the list of the f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,693
git
# Git show files that were changed in the last 2 days How can I have a list with all the files that were changed in the last 2 days? I know about ``` git log --name-status --since="2 days ago" ``` but this will show me ids, dates and commit messages. All I need is the list of the file names which were changed. Is t...
``` git log --pretty=format: --name-only --since="2 days ago" ``` if some files duplicate in multiple commits, you can use pipe to filter it ``` git log --pretty=format: --name-only --since="2 days ago" | sort | uniq ```
5551556
Changing file names in a Git repository
82
2011-04-05 12:09:24
<p>How does Git handle filename changes?</p> <p>Will a file name change be detected as a modification or will there be a &quot;lost&quot; file which needs to be removed and the new file needs to then be added with <code>git add</code>?</p>
90,565
356,387
2021-04-16 16:01:11
5,551,578
122
2011-04-05 12:11:56
106,205
2021-04-16 15:51:16
https://stackoverflow.com/q/5551556
https://stackoverflow.com/a/5551578
<p>It will automatically be detected as a modification and the &quot;new&quot; file will be added to the index, so you only need one command:</p> <pre><code>$ git mv application.py newApplication.py $ git status # On branch buildServer # Changes to be committed: # (use &quot;git reset HEAD &lt;file&gt;...&quot; to un...
<p>It will automatically be detected as a modification and the &quot;new&quot; file will be added to the index, so you only need one command:</p> <pre><code>$ git mv application.py newApplication.py $ git status # On branch buildServer # Changes to be committed: # (use &quot;git reset HEAD &lt;file&gt;...&quot; to un...
119
git
<h1>Changing file names in a Git repository</h1> <p>How does Git handle filename changes?</p> <p>Will a file name change be detected as a modification or will there be a &quot;lost&quot; file which needs to be removed and the new file needs to then be added with <code>git add</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,694
git
# Changing file names in a Git repository How does Git handle filename changes? Will a file name change be detected as a modification or will there be a "lost" file which needs to be removed and the new file needs to then be added with `git add`?
It will automatically be detected as a modification and the "new" file will be added to the index, so you only need one command: ``` $ git mv application.py newApplication.py $ git status # On branch buildServer # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # renamed: applicatio...
50316434
Add all files using git add except one directory
64
2018-05-13 13:05:00
<p>I am trying to add all the files to my git index using </p> <pre><code>git add -A </code></pre> <p>However, there is one directory with very large files that is causing this error:</p> <pre><code>fatal: confused by unstable object source data for 9f8c02a8d2a04d7fffed08b299a0cb8996ab7ecb </code></pre> <p>Therefor...
55,339
432,648
2023-10-05 16:36:58
50,316,635
122
2018-05-13 13:28:24
6,330,106
2022-10-27 08:28:22
https://stackoverflow.com/q/50316434
https://stackoverflow.com/a/50316635
<p>If your Git version is new enough,</p> <pre><code>git add -- . ':!&lt;path&gt;' </code></pre> <p><code>.</code> means all under the current directory, and <code>':!&lt;path&gt;'</code> means to exclude the path. So it means to add all except <code>path</code>.</p> <p>The term for <code>. ':!&lt;path&gt;'</code> is <...
<p>If your Git version is new enough,</p> <pre><code>git add -- . ':!&lt;path&gt;' </code></pre> <p><code>.</code> means all under the current directory, and <code>':!&lt;path&gt;'</code> means to exclude the path. So it means to add all except <code>path</code>.</p> <p>The term for <code>. ':!&lt;path&gt;'</code> is <...
119
git
<h1>Add all files using git add except one directory</h1> <p>I am trying to add all the files to my git index using </p> <pre><code>git add -A </code></pre> <p>However, there is one directory with very large files that is causing this error:</p> <pre><code>fatal: confused by unstable object source data for 9f8c02a8d...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,695
git
# Add all files using git add except one directory I am trying to add all the files to my git index using ``` git add -A ``` However, there is one directory with very large files that is causing this error: ``` fatal: confused by unstable object source data for 9f8c02a8d2a04d7fffed08b299a0cb8996ab7ecb ``` Therefor...
If your Git version is new enough, ``` git add -- . ':!<path>' ``` `.` means all under the current directory, and `':!<path>'` means to exclude the path. So it means to add all except `path`. The term for `. ':!<path>'` is [pathspec](https://www.git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathsp...
40228651
How do i delete the last 3 commits?
63
2016-10-24 22:35:36
<p><strong>How do i delete the last 3 commits?</strong> there is probably many examples but I think i ma being very specific here with what I want.</p> <p>So for example I have done a <code>git add .</code> and <code>git commit -m "message"</code> and a <code>git push -u origin master</code> for all these.</p> <p>I h...
62,222
2,392,358
2025-10-20 12:10:38
40,228,667
122
2016-10-24 22:37:26
429,521
2016-10-24 23:11:19
https://stackoverflow.com/q/40228651
https://stackoverflow.com/a/40228667
<p>use can use <code>git reset</code> for that</p> <pre><code>git reset --hard HEAD~3 git push --force origin master </code></pre> <p>where <code>HEAD~3</code> means <em>go back 3 commits</em></p> <p>You can also use the commit number instead of <em>3 commits</em>, so that you are sure where you are going back in t...
<p>use can use <code>git reset</code> for that</p> <pre><code>git reset --hard HEAD~3 git push --force origin master </code></pre> <p>where <code>HEAD~3</code> means <em>go back 3 commits</em></p> <p>You can also use the commit number instead of <em>3 commits</em>, so that you are sure where you are going back in t...
119, 456
git, version-control
<h1>How do i delete the last 3 commits?</h1> <p><strong>How do i delete the last 3 commits?</strong> there is probably many examples but I think i ma being very specific here with what I want.</p> <p>So for example I have done a <code>git add .</code> and <code>git commit -m "message"</code> and a <code>git push -u or...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,696
git
# How do i delete the last 3 commits? **How do i delete the last 3 commits?** there is probably many examples but I think i ma being very specific here with what I want. So for example I have done a `git add .` and `git commit -m "message"` and a `git push -u origin master` for all these. I have the following output...
use can use `git reset` for that ``` git reset --hard HEAD~3 git push --force origin master ``` where `HEAD~3` means *go back 3 commits* You can also use the commit number instead of *3 commits*, so that you are sure where you are going back in time, like ``` git reset --hard 8315cd7962c902d39160fcf2fd018f249e7cf7...
19154302
git push to specific branch
207
2013-10-03 08:25:50
<p>Even after reading this question: <a href="https://stackoverflow.com/questions/948354/git-push-current-branch">git-push-current-branch</a>, I am still having difficulty figuring out how I should write my <code>git push</code> command. As mentioned in the question link, it's not clear from the documentation.</p> <p>I...
568,204
2,298,137
2023-03-01 01:17:45
19,154,504
121
2013-10-03 08:36:47
1,039,952
2016-05-04 19:09:37
https://stackoverflow.com/q/19154302
https://stackoverflow.com/a/19154504
<p><code>git push origin amd_qlp_tester</code> will work for you. If you just type <code>git push</code>, then the remote of the current branch is the default value. </p> <p>Syntax of push looks like this - <code>git push &lt;remote&gt; &lt;branch&gt;</code>. If you look at your remote in <code>.git/config</code> fil...
<p><code>git push origin amd_qlp_tester</code> will work for you. If you just type <code>git push</code>, then the remote of the current branch is the default value. </p> <p>Syntax of push looks like this - <code>git push &lt;remote&gt; &lt;branch&gt;</code>. If you look at your remote in <code>.git/config</code> fil...
119, 456, 4236
git, push, version-control
<h1>git push to specific branch</h1> <p>Even after reading this question: <a href="https://stackoverflow.com/questions/948354/git-push-current-branch">git-push-current-branch</a>, I am still having difficulty figuring out how I should write my <code>git push</code> command. As mentioned in the question link, it's not c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,698
git
# git push to specific branch Even after reading this question: [git-push-current-branch](https://stackoverflow.com/questions/948354/git-push-current-branch), I am still having difficulty figuring out how I should write my `git push` command. As mentioned in the question link, it's not clear from the documentation. I...
`git push origin amd_qlp_tester` will work for you. If you just type `git push`, then the remote of the current branch is the default value. Syntax of push looks like this - `git push <remote> <branch>`. If you look at your remote in `.git/config` file, you will see an entry `[remote "origin"]` which specifies url of ...
9587686
Easier way to keep a git feature branch up to date
133
2012-03-06 16:22:05
<p>I was wondering if anyone would have a better suggestion for keeping a feature branch in sync with it's parent branch. </p> <p>We typically have multiple feature branches that are being worked on at a time, each derived from our <code>develop</code> branch. It's fairly common for feature branches to be merged into ...
175,804
332,904
2022-07-15 20:09:30
9,587,781
121
2012-03-06 16:28:22
473,770
2022-07-15 20:09:30
https://stackoverflow.com/q/9587686
https://stackoverflow.com/a/9587781
<p>Well, git is really set up for wrapping things you do frequently into a script and then calling the script instead. There isn't a huge number of variations on the above. They all will require pulling the upstream branch, and then integrating your changes with the upstream's. Some things that may shorten it for yo...
<p>Well, git is really set up for wrapping things you do frequently into a script and then calling the script instead. There isn't a huge number of variations on the above. They all will require pulling the upstream branch, and then integrating your changes with the upstream's. Some things that may shorten it for yo...
119
git
<h1>Easier way to keep a git feature branch up to date</h1> <p>I was wondering if anyone would have a better suggestion for keeping a feature branch in sync with it's parent branch. </p> <p>We typically have multiple feature branches that are being worked on at a time, each derived from our <code>develop</code> branch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,699
git
# Easier way to keep a git feature branch up to date I was wondering if anyone would have a better suggestion for keeping a feature branch in sync with it's parent branch. We typically have multiple feature branches that are being worked on at a time, each derived from our `develop` branch. It's fairly common for fea...
Well, git is really set up for wrapping things you do frequently into a script and then calling the script instead. There isn't a huge number of variations on the above. They all will require pulling the upstream branch, and then integrating your changes with the upstream's. Some things that may shorten it for you migh...
19593909
git diff sees whole file as changed when it's not
81
2013-10-25 15:29:24
<p>The git diff engine is seeing a whole file as changed when it has not. For example, take this commit: <a href="https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51" rel="noreferrer">https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51</a></p> <p>...
77,908
392,921
2013-10-26 19:44:08
19,594,092
121
2013-10-25 15:39:03
77,567
2013-10-25 15:39:03
https://stackoverflow.com/q/19593909
https://stackoverflow.com/a/19594092
<p>In <code>vboxconnector.php_1</code>, every line is terminated by a <code>CR</code> <code>LF</code> sequence.</p> <p>In <code>vboxconnector.php_2</code>, every line is terminated by just <code>LF</code>.</p> <p>Thus every line of the file has changed.</p> <p>Try using <code>git diff --ignore-space-at-eol</code>.</...
<p>In <code>vboxconnector.php_1</code>, every line is terminated by a <code>CR</code> <code>LF</code> sequence.</p> <p>In <code>vboxconnector.php_2</code>, every line is terminated by just <code>LF</code>.</p> <p>Thus every line of the file has changed.</p> <p>Try using <code>git diff --ignore-space-at-eol</code>.</...
119, 9033
git, git-diff
<h1>git diff sees whole file as changed when it's not</h1> <p>The git diff engine is seeing a whole file as changed when it has not. For example, take this commit: <a href="https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51" rel="noreferrer">https://github.com/etiago/phpvirtualbox/c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,701
git
# git diff sees whole file as changed when it's not The git diff engine is seeing a whole file as changed when it has not. For example, take this commit: <https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51> Here we see that the file **lib/vboxconnector.php** has 2807 additions and...
In `vboxconnector.php_1`, every line is terminated by a `CR` `LF` sequence. In `vboxconnector.php_2`, every line is terminated by just `LF`. Thus every line of the file has changed. Try using `git diff --ignore-space-at-eol`. You may also find some useful information in [the answers to this question](https://stacko...
9707562
Git is not detecting a file and is not in .gitignore
78
2012-03-14 18:05:04
<p>I have a file git is not detecting. It doesn't detect it if I delete it either, but it does detect if I change the name of the file. But I need it with that name. The file is not in the .gitignore file.</p>
111,089
1,123,579
2025-12-29 15:59:57
28,918,909
121
2015-03-07 19:16:42
55,075
2019-05-27 16:37:39
https://stackoverflow.com/q/9707562
https://stackoverflow.com/a/28918909
<p>Use <code>git check-ignore</code> command to debug your gitignore file (exclude files).</p> <p>In example:</p> <pre><code>$ git check-ignore -v config.php .gitignore:2:src config.php </code></pre> <p>The above output details about the matching pattern (if any) for each given pathname (including line).</p> <p>...
<p>Use <code>git check-ignore</code> command to debug your gitignore file (exclude files).</p> <p>In example:</p> <pre><code>$ git check-ignore -v config.php .gitignore:2:src config.php </code></pre> <p>The above output details about the matching pattern (if any) for each given pathname (including line).</p> <p>...
119
git
<h1>Git is not detecting a file and is not in .gitignore</h1> <p>I have a file git is not detecting. It doesn't detect it if I delete it either, but it does detect if I change the name of the file. But I need it with that name. The file is not in the .gitignore file.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,702
git
# Git is not detecting a file and is not in .gitignore I have a file git is not detecting. It doesn't detect it if I delete it either, but it does detect if I change the name of the file. But I need it with that name. The file is not in the .gitignore file.
Use `git check-ignore` command to debug your gitignore file (exclude files). In example: ``` $ git check-ignore -v config.php .gitignore:2:src config.php ``` The above output details about the matching pattern (if any) for each given pathname (including line). So maybe your file extension is not ignored, but the...
15566025
IntelliJ IDEA with Git remember author
76
2013-03-22 08:43:16
<p>I'm using IntelliJ with a Git project, and have setup my <code>user.name</code> and <code>user.email</code> properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but sometimes I forget to do that, and it's a pain to amme...
89,654
327,679
2022-07-22 06:03:39
15,569,008
121
2013-03-22 11:16:36
104,891
2020-09-14 07:40:56
https://stackoverflow.com/q/15566025
https://stackoverflow.com/a/15569008
<p>IntelliJ IDEA doesn't pre-select author in the combobox which is a <a href="http://youtrack.jetbrains.com/issue/IDEA-63926" rel="noreferrer">known cosmetic issue</a>, however it should use the author defined in the git configuration by default.</p> <p>Please double check that <code>user.name</code> and <code>user.em...
<p>IntelliJ IDEA doesn't pre-select author in the combobox which is a <a href="http://youtrack.jetbrains.com/issue/IDEA-63926" rel="noreferrer">known cosmetic issue</a>, however it should use the author defined in the git configuration by default.</p> <p>Please double check that <code>user.name</code> and <code>user.em...
119, 8945
git, intellij-idea
<h1>IntelliJ IDEA with Git remember author</h1> <p>I'm using IntelliJ with a Git project, and have setup my <code>user.name</code> and <code>user.email</code> properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but someti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,703
git
# IntelliJ IDEA with Git remember author I'm using IntelliJ with a Git project, and have setup my `user.name` and `user.email` properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but sometimes I forget to do that, and it...
IntelliJ IDEA doesn't pre-select author in the combobox which is a [known cosmetic issue](http://youtrack.jetbrains.com/issue/IDEA-63926), however it should use the author defined in the git configuration by default. Please double check that `user.name` and `user.email` is specified properly in the global git configur...
40253526
Get changes from another branch without affecting current branch at all
72
2016-10-26 04:01:26
<p>Is there a simple way to get changes from another branch without merge or rebase. And keep those changes as untracked (for new files) or not staged for commit (for existing files)?</p>
58,904
6,202,519
2024-04-02 16:24:00
40,253,689
121
2016-10-26 04:22:34
4,605,105
2022-03-15 05:56:07
https://stackoverflow.com/q/40253526
https://stackoverflow.com/a/40253689
<p>do a merge to get the change then cancel the merge but keep modification:</p> <pre><code>git merge --no-ff feature git reset HEAD~1 </code></pre>
<p>do a merge to get the change then cancel the merge but keep modification:</p> <pre><code>git merge --no-ff feature git reset HEAD~1 </code></pre>
119
git
<h1>Get changes from another branch without affecting current branch at all</h1> <p>Is there a simple way to get changes from another branch without merge or rebase. And keep those changes as untracked (for new files) or not staged for commit (for existing files)?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,704
git
# Get changes from another branch without affecting current branch at all Is there a simple way to get changes from another branch without merge or rebase. And keep those changes as untracked (for new files) or not staged for commit (for existing files)?
do a merge to get the change then cancel the merge but keep modification: ``` git merge --no-ff feature git reset HEAD~1 ```
4826639
Repack of Git repository fails
69
2011-01-28 09:30:18
<p>I have a git repository residing on a server with limited memory. When I try to clone an existing repository from the server I get the following error</p> <pre><code>hemi@ubuntu:$ git clone ssh://hemi@servername.dk/home/hemi/repos/articles Initialized empty Git repository in /home/hemi/Skrivebord/articles/.git/ he...
80,513
185,475
2023-08-17 16:01:09
4,829,883
121
2011-01-28 15:25:48
223,092
2012-01-17 20:33:39
https://stackoverflow.com/q/4826639
https://stackoverflow.com/a/4829883
<p>Your solution has got you a working copy locally and remotely, but will cause problems again when the remote repository decides to repack itself again. Fortunately, you can set config options that will reduce the amount of memory needed for repacking in both repositories -- these essentially make the command line p...
<p>Your solution has got you a working copy locally and remotely, but will cause problems again when the remote repository decides to repack itself again. Fortunately, you can set config options that will reduce the amount of memory needed for repacking in both repositories -- these essentially make the command line p...
119, 7330
git, repository
<h1>Repack of Git repository fails</h1> <p>I have a git repository residing on a server with limited memory. When I try to clone an existing repository from the server I get the following error</p> <pre><code>hemi@ubuntu:$ git clone ssh://hemi@servername.dk/home/hemi/repos/articles Initialized empty Git repository in...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,705
git
# Repack of Git repository fails I have a git repository residing on a server with limited memory. When I try to clone an existing repository from the server I get the following error ``` hemi@ubuntu:$ git clone ssh://hemi@servername.dk/home/hemi/repos/articles Initialized empty Git repository in /home/hemi/Skrivebor...
Your solution has got you a working copy locally and remotely, but will cause problems again when the remote repository decides to repack itself again. Fortunately, you can set config options that will reduce the amount of memory needed for repacking in both repositories -- these essentially make the command line param...
19980631
What is `git checkout --orphan` used for?
92
2013-11-14 14:44:54
<p>I've just discovered <code>git checkout --orphan</code>, but I don't know how to use it. Its help page says it creates a <strong>new unparented branch</strong>. </p> <p>In the <code>master</code> branch, I've tried <code>git checkout --orphan br</code>, only to see the files in the working directory change to &ldqu...
65,556
2,298,986
2023-04-17 20:23:25
19,981,375
120
2013-11-14 15:16:42
12,274
2019-04-11 19:52:21
https://stackoverflow.com/q/19980631
https://stackoverflow.com/a/19981375
<p>The core use for <code>git checkout --orphan</code> is to create a branch in a <code>git init</code>-like state on a non-new repository.</p> <p>Without this ability, <em>all</em> of your git branches would have a common ancestor, your initial commit. This is a common case, but in no way the only one. For example,...
<p>The core use for <code>git checkout --orphan</code> is to create a branch in a <code>git init</code>-like state on a non-new repository.</p> <p>Without this ability, <em>all</em> of your git branches would have a common ancestor, your initial commit. This is a common case, but in no way the only one. For example,...
119, 37230, 76220
git, git-branch, git-checkout
<h1>What is `git checkout --orphan` used for?</h1> <p>I've just discovered <code>git checkout --orphan</code>, but I don't know how to use it. Its help page says it creates a <strong>new unparented branch</strong>. </p> <p>In the <code>master</code> branch, I've tried <code>git checkout --orphan br</code>, only to see...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,707
git
# What is `git checkout --orphan` used for? I've just discovered `git checkout --orphan`, but I don't know how to use it. Its help page says it creates a **new unparented branch**. In the `master` branch, I've tried `git checkout --orphan br`, only to see the files in the working directory change to “Changes to be co...
The core use for `git checkout --orphan` is to create a branch in a `git init`-like state on a non-new repository. Without this ability, *all* of your git branches would have a common ancestor, your initial commit. This is a common case, but in no way the only one. For example, git allows you to track multiple indepen...
6794717
Git-ignore certain files in sub-directories, but not all
92
2011-07-22 18:53:51
<p>I have a structure similar to the following: </p> <pre><code>/root/ /root/data/ /root/data/script.php /root/data/some.json /root/data/feature/one.json /root/data/feature/two.json /root/data/other-feature/one.json /root/data/other-feature/important-script.php </code></pre> <p>I'd like git to ignore <em>any</em> <co...
92,705
26,196
2023-05-04 08:22:42
6,794,737
120
2011-07-22 18:55:22
104,344
2015-07-02 11:04:05
https://stackoverflow.com/q/6794717
https://stackoverflow.com/a/6794737
<p>I've written a post about such problem recently. See <a href="http://sparethought.wordpress.com/2011/07/19/double-star-pattern-in-gitignore/" rel="noreferrer">here</a>.</p> <p>Basically what you need is to put one <code>.gitignore</code> with <code>*.json</code> in the <code>/data/</code> directory.</p> <p><strong...
<p>I've written a post about such problem recently. See <a href="http://sparethought.wordpress.com/2011/07/19/double-star-pattern-in-gitignore/" rel="noreferrer">here</a>.</p> <p>Basically what you need is to put one <code>.gitignore</code> with <code>*.json</code> in the <code>/data/</code> directory.</p> <p><strong...
119, 25056
git, gitignore
<h1>Git-ignore certain files in sub-directories, but not all</h1> <p>I have a structure similar to the following: </p> <pre><code>/root/ /root/data/ /root/data/script.php /root/data/some.json /root/data/feature/one.json /root/data/feature/two.json /root/data/other-feature/one.json /root/data/other-feature/important-sc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,708
git
# Git-ignore certain files in sub-directories, but not all I have a structure similar to the following: ``` /root/ /root/data/ /root/data/script.php /root/data/some.json /root/data/feature/one.json /root/data/feature/two.json /root/data/other-feature/one.json /root/data/other-feature/important-script.php ``` I'd lik...
I've written a post about such problem recently. See [here](http://sparethought.wordpress.com/2011/07/19/double-star-pattern-in-gitignore/). Basically what you need is to put one `.gitignore` with `*.json` in the `/data/` directory. **UPD**: Since git [1.8.4](http://git-blame.blogspot.com/2013/08/git-184.html) ([1.8....
4154485
"git describe" ignores a tag
88
2010-11-11 12:44:12
<p>In the following lines:</p> <pre><code>$ git tag -n1 v1.8 Tagged the day before yesterday v1.9 Tagged yesterday v2.0 Tagged today $ git describe v1.9-500-ga6a8c67 $ </code></pre> <p>Can anyone explain why the v2.0 tag is not used by "git describe", and how to fix this? The v2.0 tag is already...
51,804
166,442
2020-10-21 06:36:32
4,154,518
120
2010-11-11 12:48:28
112,968
2020-10-21 06:36:32
https://stackoverflow.com/q/4154485
https://stackoverflow.com/a/4154518
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a> uses only annotated tags by default. Specify the <code>--tags</code> option to make it use lightweight tags as well.</p> <p>Make sure you've checked out the correct commit (<code>git rev-parse H...
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a> uses only annotated tags by default. Specify the <code>--tags</code> option to make it use lightweight tags as well.</p> <p>Make sure you've checked out the correct commit (<code>git rev-parse H...
119, 60718, 80455
git, git-describe, git-tag
<h1>"git describe" ignores a tag</h1> <p>In the following lines:</p> <pre><code>$ git tag -n1 v1.8 Tagged the day before yesterday v1.9 Tagged yesterday v2.0 Tagged today $ git describe v1.9-500-ga6a8c67 $ </code></pre> <p>Can anyone explain why the v2.0 tag is not used by "git describe", and ho...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,709
git
# "git describe" ignores a tag In the following lines: ``` $ git tag -n1 v1.8 Tagged the day before yesterday v1.9 Tagged yesterday v2.0 Tagged today $ git describe v1.9-500-ga6a8c67 $ ``` Can anyone explain why the v2.0 tag is not used by "git describe", and how to fix this? The v2.0 tag is alr...
[`git describe`](http://www.kernel.org/pub/software/scm/git/docs/git-describe.html) uses only annotated tags by default. Specify the `--tags` option to make it use lightweight tags as well. Make sure you've checked out the correct commit (`git rev-parse HEAD`). Annotated tags are created with `git tag -a`. If you do `...
18536863
Git refuses to reset/discard files
81
2013-08-30 15:46:01
<p>I have a project with certain js files which I cannot update. I run OSX locally and my remote/staging server is Linux (CentOS).</p> <p>Right after cloning my project locally, i noticed I have all those files with git status <code>modified</code>. I never modified them, so I tried to <code>discard changes</code> or ...
48,390
522,337
2024-12-09 17:36:23
18,875,915
120
2013-09-18 15:06:37
761,202
2014-01-21 17:30:56
https://stackoverflow.com/q/18536863
https://stackoverflow.com/a/18875915
<h2>Normalize line endings</h2> <blockquote> <p>The change that is in the modification is deleting all lines and adding them again.</p> </blockquote> <p>This is because the newlines are being changed between the committed files and the files on disk.</p> <p>Github has a <a href="https://help.github.com/articles/dealing...
<h2>Normalize line endings</h2> <blockquote> <p>The change that is in the modification is deleting all lines and adding them again.</p> </blockquote> <p>This is because the newlines are being changed between the committed files and the files on disk.</p> <p>Github has a <a href="https://help.github.com/articles/dealing...
119, 54839
git, git-status
<h1>Git refuses to reset/discard files</h1> <p>I have a project with certain js files which I cannot update. I run OSX locally and my remote/staging server is Linux (CentOS).</p> <p>Right after cloning my project locally, i noticed I have all those files with git status <code>modified</code>. I never modified them, so...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,710
git
# Git refuses to reset/discard files I have a project with certain js files which I cannot update. I run OSX locally and my remote/staging server is Linux (CentOS). Right after cloning my project locally, i noticed I have all those files with git status `modified`. I never modified them, so I tried to `discard change...
## Normalize line endings > The change that is in the modification is deleting all lines and adding them again. This is because the newlines are being changed between the committed files and the files on disk. Github has a [handy page](https://help.github.com/articles/dealing-with-line-endings) detailing how to deal...
8883189
How can I turn on a pager for the output of git status?
78
2012-01-16 16:39:05
<p>I want the output of <code>git status</code> to be returned in a <code>less</code>-like environment. This already works for <code>git diff</code>, but not <code>git status</code>. I already tried adding the following to <code>~/.gitconfig</code>, but it didn't work:</p> <pre><code>[core] pager = less </code></pre...
17,183
1,152,276
2021-03-03 23:24:25
8,883,248
120
2012-01-16 16:43:40
229,044
2021-03-03 23:24:25
https://stackoverflow.com/q/8883189
https://stackoverflow.com/a/8883248
<p>You can turn on and off paging of specific commands with the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer"><code>pager.&lt;cmd&gt;</code></a> setting, in this case <code>pager.status</code>:</p> <blockquote> <p>If the value is boolean, turns on or off pagination of the o...
<p>You can turn on and off paging of specific commands with the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer"><code>pager.&lt;cmd&gt;</code></a> setting, in this case <code>pager.status</code>:</p> <blockquote> <p>If the value is boolean, turns on or off pagination of the o...
119
git
<h1>How can I turn on a pager for the output of git status?</h1> <p>I want the output of <code>git status</code> to be returned in a <code>less</code>-like environment. This already works for <code>git diff</code>, but not <code>git status</code>. I already tried adding the following to <code>~/.gitconfig</code>, but i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,711
git
# How can I turn on a pager for the output of git status? I want the output of `git status` to be returned in a `less`-like environment. This already works for `git diff`, but not `git status`. I already tried adding the following to `~/.gitconfig`, but it didn't work: ``` [core] pager = less ``` What am I missing...
You can turn on and off paging of specific commands with the [`pager.<cmd>`](https://www.kernel.org/pub/software/scm/git/docs/git-config.html) setting, in this case `pager.status`: > If the value is boolean, turns on or off pagination of the output of a particular Git subcommand when writing to a tty. Otherwise, turns...
2808177
How can I 'git clone' from another machine?
66
2010-05-11 05:00:06
<p>On one machine (IP address 192.168.1.2), I create a Git repository by</p> <pre><code>$ cd /home/hap/working $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit' </code></pre> <p>And I have another machine on the same Wi-Fi network. How can I get clone from the other machine?</p>
67,077
128,983
2022-04-19 05:34:56
2,808,221
120
2010-05-11 05:11:25
64,053
2013-03-18 19:32:35
https://stackoverflow.com/q/2808177
https://stackoverflow.com/a/2808221
<p>You need to use a git+ssh <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" rel="noreferrer">URL</a> to perform the Git cloning:</p> <pre><code>git clone git+ssh://hap@192.168.1.2/~/working </code></pre> <p>To break it down:</p> <ul> <li><code>git+ssh</code> tells Git that you want to use ssh to con...
<p>You need to use a git+ssh <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" rel="noreferrer">URL</a> to perform the Git cloning:</p> <pre><code>git clone git+ssh://hap@192.168.1.2/~/working </code></pre> <p>To break it down:</p> <ul> <li><code>git+ssh</code> tells Git that you want to use ssh to con...
119, 34099
git, git-clone
<h1>How can I 'git clone' from another machine?</h1> <p>On one machine (IP address 192.168.1.2), I create a Git repository by</p> <pre><code>$ cd /home/hap/working $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit' </code></pre> <p>And I have another machine on the same Wi-Fi network. How can ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,712
git
# How can I 'git clone' from another machine? On one machine (IP address 192.168.1.2), I create a Git repository by ``` $ cd /home/hap/working $ git init $ (add some files) $ git add . $ git commit -m 'Initial commit' ``` And I have another machine on the same Wi-Fi network. How can I get clone from the other machin...
You need to use a git+ssh [URL](http://en.wikipedia.org/wiki/Uniform_Resource_Locator) to perform the Git cloning: ``` git clone git+ssh://hap@192.168.1.2/~/working ``` To break it down: - `git+ssh` tells Git that you want to use ssh to connect to the Git repository. - `hap` is your username (I assume based on the h...
13059991
update package.json version automatically
312
2012-10-25 00:40:22
<p>Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.</p> <p>Is there a way to edit the file <code>package.json</code> automatically?</p> <p>Would using a <code>git pre-release hook</code> help?</p>
281,894
632,968
2025-01-09 11:10:34
15,265,365
119
2013-03-07 07:24:41
1,256,496
2013-03-07 07:24:41
https://stackoverflow.com/q/13059991
https://stackoverflow.com/a/15265365
<p><code>npm version</code> is probably the correct answer. Just to give an alternative I recommend <a href="https://github.com/vojtajina/grunt-bump">grunt-bump</a>. It is maintained by one of the guys from angular.js.</p> <p>Usage:</p> <pre><code>grunt bump &gt;&gt; Version bumped to 0.0.2 grunt bump:patch &gt;&gt;...
<p><code>npm version</code> is probably the correct answer. Just to give an alternative I recommend <a href="https://github.com/vojtajina/grunt-bump">grunt-bump</a>. It is maintained by one of the guys from angular.js.</p> <p>Usage:</p> <pre><code>grunt bump &gt;&gt; Version bumped to 0.0.2 grunt bump:patch &gt;&gt;...
119, 43087, 46426, 61387
git, githooks, node.js, npm
<h1>update package.json version automatically</h1> <p>Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.</p> <p>Is there a way to edit the file <code>package.json</code> automatically?</p> <p>Would using a <code>git pre-release hook</code> help?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,714
git
# update package.json version automatically Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program. Is there a way to edit the file `package.json` automatically? Would using a `git pre-release hook` help?
`npm version` is probably the correct answer. Just to give an alternative I recommend [grunt-bump](https://github.com/vojtajina/grunt-bump). It is maintained by one of the guys from angular.js. Usage: ``` grunt bump >> Version bumped to 0.0.2 grunt bump:patch >> Version bumped to 0.0.3 grunt bump:minor >> Version b...
5126765
How to get rid of Git submodules untracked status?
195
2011-02-26 12:02:18
<p>Running <code>git status</code> tells me that there is untracked content in some submodules:</p> <pre class="lang-none prettyprint-override"><code># On branch master # Changes not staged for commit: # (use &quot;git add &lt;file&gt;...&quot; to update what will be committed) # (use &quot;git checkout -- &lt;file...
151,574
145,427
2025-09-02 23:34:45
5,126,905
119
2011-02-26 12:30:38
6,309
2018-01-26 00:12:17
https://stackoverflow.com/q/5126765
https://stackoverflow.com/a/5126905
<p>Since the git status reports untracked content, the actual way to have a clean status would be to go into each one of those submodules and:</p> <ul> <li>add and commit the untracked contents,</li> <li>or reference the untracked contents in a <code>.gitignore</code> specific to each module. </li> <li>or you can add...
<p>Since the git status reports untracked content, the actual way to have a clean status would be to go into each one of those submodules and:</p> <ul> <li>add and commit the untracked contents,</li> <li>or reference the untracked contents in a <code>.gitignore</code> specific to each module. </li> <li>or you can add...
119, 41612
git, git-submodules
<h1>How to get rid of Git submodules untracked status?</h1> <p>Running <code>git status</code> tells me that there is untracked content in some submodules:</p> <pre class="lang-none prettyprint-override"><code># On branch master # Changes not staged for commit: # (use &quot;git add &lt;file&gt;...&quot; to update wha...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,715
git
# How to get rid of Git submodules untracked status? Running `git status` tells me that there is untracked content in some submodules: ``` # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in worki...
Since the git status reports untracked content, the actual way to have a clean status would be to go into each one of those submodules and: - add and commit the untracked contents, - or reference the untracked contents in a `.gitignore` specific to each module. - or you can add the same ignored content to the submodul...
10147475
git checkout tag, git pull fails in branch
140
2012-04-13 19:55:46
<p>I have cloned a git repository and then checked out a tag:</p> <pre><code># git checkout 2.4.33 -b my_branch </code></pre> <p>This is OK, but when I try to run <code>git pull</code> in my branch, git spits out this error: </p> <blockquote> <p>There is no tracking information for the current branch. Please spe...
142,543
644,986
2018-11-23 18:33:58
15,949,751
119
2013-04-11 13:13:49
2,134,775
2014-11-17 18:12:04
https://stackoverflow.com/q/10147475
https://stackoverflow.com/a/15949751
<p><strong>Edit:</strong> For newer versions of Git, <code>--set-upstream master</code> has been deprecated, you should use <code>--set-upstream-to</code> instead:</p> <pre><code>git branch --set-upstream-to=origin/master master </code></pre> <hr> <p>As it prompted, you can just run:</p> <pre><code>git branch --set...
<p><strong>Edit:</strong> For newer versions of Git, <code>--set-upstream master</code> has been deprecated, you should use <code>--set-upstream-to</code> instead:</p> <pre><code>git branch --set-upstream-to=origin/master master </code></pre> <hr> <p>As it prompted, you can just run:</p> <pre><code>git branch --set...
119, 28896, 37230
git, git-checkout, git-pull
<h1>git checkout tag, git pull fails in branch</h1> <p>I have cloned a git repository and then checked out a tag:</p> <pre><code># git checkout 2.4.33 -b my_branch </code></pre> <p>This is OK, but when I try to run <code>git pull</code> in my branch, git spits out this error: </p> <blockquote> <p>There is no track...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,716
git
# git checkout tag, git pull fails in branch I have cloned a git repository and then checked out a tag: ``` # git checkout 2.4.33 -b my_branch ``` This is OK, but when I try to run `git pull` in my branch, git spits out this error: > There is no tracking information for the current branch. Please > specify which br...
**Edit:** For newer versions of Git, `--set-upstream master` has been deprecated, you should use `--set-upstream-to` instead: ``` git branch --set-upstream-to=origin/master master ``` --- As it prompted, you can just run: ``` git branch --set-upstream master origin/master ``` After that, you can simply run `git pu...
18345157
How can I tell if one commit is an ancestor of another commit (or vice-versa)?
90
2013-08-20 21:20:42
<p>Git is a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="noreferrer">DAG</a> of snapshots, with each node on the graph representing a commit. Each commit can have 'n' parent commits.</p> <p>Given any two commits, is there a single, concise way to discern the "order" of these two in the DAG. <co...
20,365
150,447
2021-01-19 04:50:12
18,345,268
119
2013-08-20 21:29:39
null
2021-01-19 04:50:12
https://stackoverflow.com/q/18345157
https://stackoverflow.com/a/18345268
<h2>Use <code>git merge-base --is-ancestor &lt;commit1&gt; &lt;commit2&gt;</code></h2> <p>There is more than one way to find the answer to this. The simplest is to use</p> <pre><code>git merge-base --is-ancestor &lt;possible-ancestor-commit&gt; &lt;commit&gt; </code></pre> <p>From the documentation for <a href="http://...
<h2>Use <code>git merge-base --is-ancestor &lt;commit1&gt; &lt;commit2&gt;</code></h2> <p>There is more than one way to find the answer to this. The simplest is to use</p> <pre><code>git merge-base --is-ancestor &lt;possible-ancestor-commit&gt; &lt;commit&gt; </code></pre> <p>From the documentation for <a href="http://...
119, 106104
git, git-history-graph
<h1>How can I tell if one commit is an ancestor of another commit (or vice-versa)?</h1> <p>Git is a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="noreferrer">DAG</a> of snapshots, with each node on the graph representing a commit. Each commit can have 'n' parent commits.</p> <p>Given any two comm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,719
git
# How can I tell if one commit is an ancestor of another commit (or vice-versa)? Git is a [DAG](https://en.wikipedia.org/wiki/Directed_acyclic_graph) of snapshots, with each node on the graph representing a commit. Each commit can have 'n' parent commits. Given any two commits, is there a single, concise way to disce...
## Use `git merge-base --is-ancestor <commit1> <commit2>` There is more than one way to find the answer to this. The simplest is to use ``` git merge-base --is-ancestor <possible-ancestor-commit> <commit> ``` From the documentation for [`git merge-base`](http://jk.gs/git-merge-base.html): > ``` > --is-ancestor > ``...
22532943
How to resolve git error: "Updates were rejected because the tip of your current branch is behind"
85
2014-03-20 12:24:13
<p>A well meaning colleague has pushed changes to the Master instead of making a branch. This means that when I try to commit I get the error:</p> <blockquote> <p>Updates were rejected because the tip of your current branch is behind</p> </blockquote> <p>I know this should be resolved by making a pull request to re-sy...
292,398
787,645
2023-10-18 00:23:06
22,533,518
119
2014-03-20 12:47:08
1,825,727
2017-11-19 14:56:55
https://stackoverflow.com/q/22532943
https://stackoverflow.com/a/22533518
<p>If you have already made some commits, you can do the following</p> <pre><code>git pull --rebase </code></pre> <p>This will place all your local commits on top of newly pulled changes.</p> <p><strong>BE VERY CAREFUL WITH THIS</strong>: this will probably overwrite all your present files with the files as they are...
<p>If you have already made some commits, you can do the following</p> <pre><code>git pull --rebase </code></pre> <p>This will place all your local commits on top of newly pulled changes.</p> <p><strong>BE VERY CAREFUL WITH THIS</strong>: this will probably overwrite all your present files with the files as they are...
119, 8337, 28897
bitbucket, git, git-merge
<h1>How to resolve git error: "Updates were rejected because the tip of your current branch is behind"</h1> <p>A well meaning colleague has pushed changes to the Master instead of making a branch. This means that when I try to commit I get the error:</p> <blockquote> <p>Updates were rejected because the tip of your cu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,720
git
# How to resolve git error: "Updates were rejected because the tip of your current branch is behind" A well meaning colleague has pushed changes to the Master instead of making a branch. This means that when I try to commit I get the error: > Updates were rejected because the tip of your current branch is behind I k...
If you have already made some commits, you can do the following ``` git pull --rebase ``` This will place all your local commits on top of newly pulled changes. **BE VERY CAREFUL WITH THIS**: this will probably overwrite all your present files with the files as they are at the head of the branch in the remote repo! ...
5775580
Git pulling changes between two local repositories
85
2011-04-25 05:44:35
<p>I have two clones of same remote repository. I have made some changes to one local repository, how can I pull these changes to the other local repository without pushing it to the remote?</p>
37,859
7,965
2024-07-17 11:58:42
5,775,607
119
2011-04-25 05:49:16
159,607
2024-07-17 11:58:42
https://stackoverflow.com/q/5775580
https://stackoverflow.com/a/5775607
<p>You can treat the second clone the same way you treat a remote respository on another system. You can perform all of the same operations, e.g.</p> <pre><code>~/repo1 $ git remote add repo2 ~/repo2 ~/repo1 $ git fetch repo2 </code></pre> <p>You'd then have all your second clone's commits in your main clone, labeled w...
<p>You can treat the second clone the same way you treat a remote respository on another system. You can perform all of the same operations, e.g.</p> <pre><code>~/repo1 $ git remote add repo2 ~/repo2 ~/repo1 $ git fetch repo2 </code></pre> <p>You'd then have all your second clone's commits in your main clone, labeled w...
119, 28896
git, git-pull
<h1>Git pulling changes between two local repositories</h1> <p>I have two clones of same remote repository. I have made some changes to one local repository, how can I pull these changes to the other local repository without pushing it to the remote?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,721
git
# Git pulling changes between two local repositories I have two clones of same remote repository. I have made some changes to one local repository, how can I pull these changes to the other local repository without pushing it to the remote?
You can treat the second clone the same way you treat a remote respository on another system. You can perform all of the same operations, e.g. ``` ~/repo1 $ git remote add repo2 ~/repo2 ~/repo1 $ git fetch repo2 ``` You'd then have all your second clone's commits in your main clone, labeled with `repo2/` (just like y...
1405030
Using Git, how can I selectively merge changes from one commit on another 'fork'?
82
2009-09-10 12:36:02
<p>Take this scenario:</p> <ol> <li>I decide to 'fork' a codebase on <a href="https://en.wikipedia.org/wiki/GitHub" rel="nofollow noreferrer">GitHub</a>, and start doing my routine: Edit, commit, and push; AKA hack hack hack.</li> <li>After I made some changes, I see some changes another person has made on the same pro...
33,151
168,992
2025-04-12 19:47:56
1,405,189
119
2009-09-10 13:05:46
168,992
2025-04-12 19:43:25
https://stackoverflow.com/q/1405030
https://stackoverflow.com/a/1405189
<p>After trolling the waves of the <a href="https://en.wikipedia.org/wiki/Internet_Relay_Chat" rel="nofollow noreferrer">IRC</a> world, someone gave a great solution:</p> <pre class="lang-none prettyprint-override"><code>git cherry-pick SHA1 --no-commit git add --patch </code></pre> <p>Hopefully that helps anyone else ...
<p>After trolling the waves of the <a href="https://en.wikipedia.org/wiki/Internet_Relay_Chat" rel="nofollow noreferrer">IRC</a> world, someone gave a great solution:</p> <pre class="lang-none prettyprint-override"><code>git cherry-pick SHA1 --no-commit git add --patch </code></pre> <p>Hopefully that helps anyone else ...
119, 717, 4860
git, merge, pull
<h1>Using Git, how can I selectively merge changes from one commit on another 'fork'?</h1> <p>Take this scenario:</p> <ol> <li>I decide to 'fork' a codebase on <a href="https://en.wikipedia.org/wiki/GitHub" rel="nofollow noreferrer">GitHub</a>, and start doing my routine: Edit, commit, and push; AKA hack hack hack.</li...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,722
git
# Using Git, how can I selectively merge changes from one commit on another 'fork'? Take this scenario: 1. I decide to 'fork' a codebase on [GitHub](https://en.wikipedia.org/wiki/GitHub), and start doing my routine: Edit, commit, and push; AKA hack hack hack. 2. After I made some changes, I see some changes another p...
After trolling the waves of the [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) world, someone gave a great solution: ``` git cherry-pick SHA1 --no-commit git add --patch ``` Hopefully that helps anyone else with the same question! OK, maybe it isn't quite that simple. Here are the full steps: 1. First you...
5678699
Creating branches on an empty project in git
71
2011-04-15 15:05:12
<p>Let's say I am about to implement 3 different features in 3 different files (fileA, fileB an fileC) for a new project of mine.</p> <p>I thought I'd just need to add my (currently empty) project to git:</p> <pre><code>git init </code></pre> <p>and then create 3 different branches:</p> <pre><code>git branch file1_...
59,806
130,758
2021-06-09 10:15:55
5,678,869
119
2011-04-15 15:17:41
69,755
2011-04-15 15:17:41
https://stackoverflow.com/q/5678699
https://stackoverflow.com/a/5678869
<p>Git represents branches as pointers to the latest commit in that branch. If you haven't created a commit yet, there's nothing for that branch to point to. So you can't really create branches until you have at least one commit.</p> <p>Git represents commits as reference to one or more parent commits (or an all-zeros...
<p>Git represents branches as pointers to the latest commit in that branch. If you haven't created a commit yet, there's nothing for that branch to point to. So you can't really create branches until you have at least one commit.</p> <p>Git represents commits as reference to one or more parent commits (or an all-zeros...
119, 456
git, version-control
<h1>Creating branches on an empty project in git</h1> <p>Let's say I am about to implement 3 different features in 3 different files (fileA, fileB an fileC) for a new project of mine.</p> <p>I thought I'd just need to add my (currently empty) project to git:</p> <pre><code>git init </code></pre> <p>and then create 3...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,723
git
# Creating branches on an empty project in git Let's say I am about to implement 3 different features in 3 different files (fileA, fileB an fileC) for a new project of mine. I thought I'd just need to add my (currently empty) project to git: ``` git init ``` and then create 3 different branches: ``` git branch fil...
Git represents branches as pointers to the latest commit in that branch. If you haven't created a commit yet, there's nothing for that branch to point to. So you can't really create branches until you have at least one commit. Git represents commits as reference to one or more parent commits (or an all-zeros parent if...
66246587
How to fix error 'not found husky-run' when committing new code?
68
2021-02-17 17:00:51
<p>When committing on a project that uses Husky, I get an error that says <code>not found husky-run</code></p> <p>I checked the <code>package.json</code> and it has husky as a dependency, and I can see the pre-commit hook configuration for Husky in the <code>package.json</code>. So I don't know what to do to fix this. ...
184,636
586,809
2024-03-07 01:55:19
66,246,588
119
2021-02-17 17:00:51
586,809
2021-12-22 06:50:11
https://stackoverflow.com/q/66246587
https://stackoverflow.com/a/66246588
<p>To fix this there are two methods, depending on which version of Husky you are already on.</p> <p>If you're using Husky v4 or lower, do the following:</p> <pre class="lang-sh prettyprint-override"><code>rm -rf .git/hooks npm install </code></pre> <p>For Husky v7 or greater, do the following:</p> <pre class="lang-sh ...
<p>To fix this there are two methods, depending on which version of Husky you are already on.</p> <p>If you're using Husky v4 or lower, do the following:</p> <pre class="lang-sh prettyprint-override"><code>rm -rf .git/hooks npm install </code></pre> <p>For Husky v7 or greater, do the following:</p> <pre class="lang-sh ...
119, 124263
git, husky
<h1>How to fix error 'not found husky-run' when committing new code?</h1> <p>When committing on a project that uses Husky, I get an error that says <code>not found husky-run</code></p> <p>I checked the <code>package.json</code> and it has husky as a dependency, and I can see the pre-commit hook configuration for Husky ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,724
git
# How to fix error 'not found husky-run' when committing new code? When committing on a project that uses Husky, I get an error that says `not found husky-run` I checked the `package.json` and it has husky as a dependency, and I can see the pre-commit hook configuration for Husky in the `package.json`. So I don't kno...
To fix this there are two methods, depending on which version of Husky you are already on. If you're using Husky v4 or lower, do the following: ``` rm -rf .git/hooks npm install ``` For Husky v7 or greater, do the following: ``` # For NPM npm install husky@7 --save-dev \ && npx husky-init \ && npm exec...
12084227
gitignore - fatal: no files added
53
2012-08-23 03:11:25
<p>I have an issue with git, more precisely with gitignore.</p> <p>I have created an empty folder Initialized git</p> <pre><code>mkdir fold cd fold git init </code></pre> <p>Updated gitignore (as below)</p> <pre><code> *.prjx </code></pre> <p>Committed gitignore</p> <pre><code>git add .gitignore git commit -m "up...
17,280
284,257
2017-10-16 14:13:52
12,084,247
119
2012-08-23 03:13:49
258,689
2012-08-23 03:45:55
https://stackoverflow.com/q/12084227
https://stackoverflow.com/a/12084247
<p>you should run <code>git add .</code> rather than <code>git add *</code></p> <p>the <code>*</code> is interpreted by the shell and substituted with all file and folder in the current location. obviously <strong>ftc.prjx</strong> is one of them and git is just warning that the file is in the ignorelist.</p>
<p>you should run <code>git add .</code> rather than <code>git add *</code></p> <p>the <code>*</code> is interpreted by the shell and substituted with all file and folder in the current location. obviously <strong>ftc.prjx</strong> is one of them and git is just warning that the file is in the ignorelist.</p>
119
git
<h1>gitignore - fatal: no files added</h1> <p>I have an issue with git, more precisely with gitignore.</p> <p>I have created an empty folder Initialized git</p> <pre><code>mkdir fold cd fold git init </code></pre> <p>Updated gitignore (as below)</p> <pre><code> *.prjx </code></pre> <p>Committed gitignore</p> <pre...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,725
git
# gitignore - fatal: no files added I have an issue with git, more precisely with gitignore. I have created an empty folder Initialized git ``` mkdir fold cd fold git init ``` Updated gitignore (as below) ``` *.prjx ``` Committed gitignore ``` git add .gitignore git commit -m "update gitignore" ``` Now I have ...
you should run `git add .` rather than `git add *` the `*` is interpreted by the shell and substituted with all file and folder in the current location. obviously **ftc.prjx** is one of them and git is just warning that the file is in the ignorelist.
4114887
Is it possible to do a sparse checkout without checking out the whole repository first?
274
2010-11-06 19:52:06
<p>I'm working with a repository with a very large number of files that takes hours to checkout. I'm looking into the possibility of whether Git would work well with this kind of repository now that it supports sparse checkouts but every example that I can find does the following:</p> <pre><code>git clone &lt;path&gt;...
270,964
271,599
2023-07-29 16:08:04
63,786,181
118
2020-09-08 01:58:46
2,437,224
2023-03-28 02:53:48
https://stackoverflow.com/q/4114887
https://stackoverflow.com/a/63786181
<p>Works in git v2.37.1+</p> <pre><code>git clone --filter=blob:none --no-checkout --depth 1 --sparse &lt;project-url&gt; cd &lt;project&gt; </code></pre> <p>Specify the folders you want to clone</p> <pre><code>git sparse-checkout add &lt;folder1&gt; &lt;folder2&gt; git checkout </code></pre>
<p>Works in git v2.37.1+</p> <pre><code>git clone --filter=blob:none --no-checkout --depth 1 --sparse &lt;project-url&gt; cd &lt;project&gt; </code></pre> <p>Specify the folders you want to clone</p> <pre><code>git sparse-checkout add &lt;folder1&gt; &lt;folder2&gt; git checkout </code></pre>
119, 50925, 118645
git, git-sparse-checkout, sparse-checkout
<h1>Is it possible to do a sparse checkout without checking out the whole repository first?</h1> <p>I'm working with a repository with a very large number of files that takes hours to checkout. I'm looking into the possibility of whether Git would work well with this kind of repository now that it supports sparse check...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,726
git
# Is it possible to do a sparse checkout without checking out the whole repository first? I'm working with a repository with a very large number of files that takes hours to checkout. I'm looking into the possibility of whether Git would work well with this kind of repository now that it supports sparse checkouts but ...
Works in git v2.37.1+ ``` git clone --filter=blob:none --no-checkout --depth 1 --sparse <project-url> cd <project> ``` Specify the folders you want to clone ``` git sparse-checkout add <folder1> <folder2> git checkout ```
7149984
How do I execute a Git command without being in the repository?
259
2011-08-22 15:42:56
<p>Is there a way to execute Git commands against a repository without being in that repository?</p> <p>For example something like this: <code>git /home/repo log</code>?</p> <p>Please do not tell me to <code>cd</code> to it. I'm doing this via an <code>exec</code> call.</p>
88,958
283,055
2021-10-11 13:05:49
7,150,012
118
2011-08-22 15:45:30
356,716
2017-11-29 07:44:23
https://stackoverflow.com/q/7149984
https://stackoverflow.com/a/7150012
<p>Try:</p> <pre><code>git --git-dir=/home/repo/.git log </code></pre> <p>It is important to give the path all the way up to the .git directory of your repository. Otherwise you will get only an error message that says something like:</p> <pre><code>fatal: Not a git repository </code></pre>
<p>Try:</p> <pre><code>git --git-dir=/home/repo/.git log </code></pre> <p>It is important to give the path all the way up to the .git directory of your repository. Otherwise you will get only an error message that says something like:</p> <pre><code>fatal: Not a git repository </code></pre>
119
git
<h1>How do I execute a Git command without being in the repository?</h1> <p>Is there a way to execute Git commands against a repository without being in that repository?</p> <p>For example something like this: <code>git /home/repo log</code>?</p> <p>Please do not tell me to <code>cd</code> to it. I'm doing this via a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,727
git
# How do I execute a Git command without being in the repository? Is there a way to execute Git commands against a repository without being in that repository? For example something like this: `git /home/repo log`? Please do not tell me to `cd` to it. I'm doing this via an `exec` call.
Try: ``` git --git-dir=/home/repo/.git log ``` It is important to give the path all the way up to the .git directory of your repository. Otherwise you will get only an error message that says something like: ``` fatal: Not a git repository ```
223678
Which commit has this blob?
213
2008-10-21 22:00:45
<p>Given the hash of a blob, is there a way to get a list of commits that have this blob in their tree?</p>
72,528
4,883
2024-09-16 19:53:51
223,890
118
2008-10-21 23:11:22
9,410
2021-04-06 02:00:12
https://stackoverflow.com/q/223678
https://stackoverflow.com/a/223890
<p>Both of the following scripts take the blob’s SHA1 as the first argument, and after it, optionally, any arguments that <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>git log</code></a> will understand. E.g. <code>--all</code> to search in all branches instead of just the current one, or <code>-g</c...
<p>Both of the following scripts take the blob’s SHA1 as the first argument, and after it, optionally, any arguments that <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>git log</code></a> will understand. E.g. <code>--all</code> to search in all branches instead of just the current one, or <code>-g</c...
119, 456
git, version-control
<h1>Which commit has this blob?</h1> <p>Given the hash of a blob, is there a way to get a list of commits that have this blob in their tree?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,728
git
# Which commit has this blob? Given the hash of a blob, is there a way to get a list of commits that have this blob in their tree?
Both of the following scripts take the blob’s SHA1 as the first argument, and after it, optionally, any arguments that [`git log`](http://git-scm.com/docs/git-log) will understand. E.g. `--all` to search in all branches instead of just the current one, or `-g` to search in the reflog, or whatever else you fancy. Here ...
991801
Git Ignores and Maven targets
138
2009-06-13 23:46:51
<p>Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by Git?</p> <p>I'm looking to exclude all the <code>target</code> folders in a Maven project with a number of submodules. I know I can explicitly exclude each of them in a top level .gitignore, but I'd rea...
224,178
106,801
2024-10-10 12:12:37
991,873
118
2009-06-14 00:52:04
10,738
2012-06-08 03:09:52
https://stackoverflow.com/q/991801
https://stackoverflow.com/a/991873
<p>It is possible to use patterns in a <code>.gitignore</code> file. See the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">gitignore man page</a>. The pattern <code>*/target/*</code> should ignore any directory named target and anything under it. Or you may try <code>*/target/**</code> to ignore everythi...
<p>It is possible to use patterns in a <code>.gitignore</code> file. See the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">gitignore man page</a>. The pattern <code>*/target/*</code> should ignore any directory named target and anything under it. Or you may try <code>*/target/**</code> to ignore everythi...
119, 456, 1912, 25056
git, gitignore, maven-2, version-control
<h1>Git Ignores and Maven targets</h1> <p>Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by Git?</p> <p>I'm looking to exclude all the <code>target</code> folders in a Maven project with a number of submodules. I know I can explicitly exclude each of them...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,729
git
# Git Ignores and Maven targets Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by Git? I'm looking to exclude all the `target` folders in a Maven project with a number of submodules. I know I can explicitly exclude each of them in a top level .gitignore...
It is possible to use patterns in a `.gitignore` file. See the [gitignore man page](http://git-scm.com/docs/gitignore). The pattern `*/target/*` should ignore any directory named target and anything under it. Or you may try `*/target/**` to ignore everything under target.
22750028
In git, what does `--` (dash dash) mean?
115
2014-03-30 21:21:13
<p>When reading the man pages for Git commands, you will often see an optional <code>--</code> (dash dash). In my experience, the <code>--</code> is not necessary and makes no difference. When do you need it? What does it mean in general, given that it appears in so many commands?</p>
34,828
1,286,417
2024-09-24 23:54:13
22,750,480
118
2014-03-30 22:04:32
3,398,351
2023-07-14 12:56:28
https://stackoverflow.com/q/22750028
https://stackoverflow.com/a/22750480
<p>The double dash <code>--</code> in git means different things to different commands, but in general it separates options from parameters.</p> <p>In <strong>git</strong> specifically, the meaning of <code>--</code> depends on which subcommand you are using it with. It usually separates subcommand arguments (like the ...
<p>The double dash <code>--</code> in git means different things to different commands, but in general it separates options from parameters.</p> <p>In <strong>git</strong> specifically, the meaning of <code>--</code> depends on which subcommand you are using it with. It usually separates subcommand arguments (like the ...
119, 367
git, syntax
<h1>In git, what does `--` (dash dash) mean?</h1> <p>When reading the man pages for Git commands, you will often see an optional <code>--</code> (dash dash). In my experience, the <code>--</code> is not necessary and makes no difference. When do you need it? What does it mean in general, given that it appears in so man...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,730
git
# In git, what does `--` (dash dash) mean? When reading the man pages for Git commands, you will often see an optional `--` (dash dash). In my experience, the `--` is not necessary and makes no difference. When do you need it? What does it mean in general, given that it appears in so many commands?
The double dash `--` in git means different things to different commands, but in general it separates options from parameters. In **git** specifically, the meaning of `--` depends on which subcommand you are using it with. It usually separates subcommand arguments (like the branch name in `git checkout`) from revision...
31881885
How to rebase a branch off a rebased branch?
94
2015-08-07 15:50:39
<p>So my history looks like this:</p> <p><code> o---o---o---o master \ o---o---o A \ o B </code></p> <p>So, to explain:</p> <ul> <li>I have branch <code>A</code> which was started from <code>master</code></li> <li>I have branch <code>B</code> (with only 1 commit) which was...
20,073
995,822
2019-10-21 08:58:59
31,882,353
118
2015-08-07 16:17:29
2,475,036
2018-11-08 02:28:18
https://stackoverflow.com/q/31881885
https://stackoverflow.com/a/31882353
<p>Short answer to <strong>How can I effectively rebase B off A so that it looks like B started from A?</strong> <sub>Assuming you want to move <em>exactly one</em> commit:</sub></p> <pre><code>git rebase --onto A B~ B </code></pre> <p><sub>If you want to move <em>more then one</em> commit use:</sub></p> <pre><code>...
<p>Short answer to <strong>How can I effectively rebase B off A so that it looks like B started from A?</strong> <sub>Assuming you want to move <em>exactly one</em> commit:</sub></p> <pre><code>git rebase --onto A B~ B </code></pre> <p><sub>If you want to move <em>more then one</em> commit use:</sub></p> <pre><code>...
119, 1879, 8974, 29934
branch, git, git-rebase, rebase
<h1>How to rebase a branch off a rebased branch?</h1> <p>So my history looks like this:</p> <p><code> o---o---o---o master \ o---o---o A \ o B </code></p> <p>So, to explain:</p> <ul> <li>I have branch <code>A</code> which was started from <code>master</code></li> <li>I hav...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,733
git
# How to rebase a branch off a rebased branch? So my history looks like this: `o---o---o---o master \ o---o---o A \ o B` So, to explain: - I have branch `A` which was started from `master` - I have branch `B` (with only 1 commit) which was started from `A` What I want is this: `o---o---o---o master \ o---o---o A ...
Short answer to **How can I effectively rebase B off A so that it looks like B started from A?** Assuming you want to move *exactly one* commit: ``` git rebase --onto A B~ B ``` If you want to move *more then one* commit use: ``` git rebase --onto A old_A B ``` **The rest of the answer.** Your branch of B is still...
14995506
How to get a copy of an older version of a file in a git repository?
79
2013-02-21 05:54:48
<p>I have a version of a <code>.tex</code> file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want to replace the current version of the file. Rather, I want to just get a separate copy of it that reflec...
45,920
535,590
2019-10-17 16:04:52
14,996,309
118
2013-02-21 06:56:44
1,507,392
2013-09-28 12:18:08
https://stackoverflow.com/q/14995506
https://stackoverflow.com/a/14996309
<p>You can use <code>git cat-file</code> to dump the contents of the file to the standard output and redirect that into your desired destination:</p> <pre><code>git cat-file -p &lt;sha1&gt;:./file.tex &gt; wherever.tex </code></pre> <p>The <code>./</code> is necessary if you are in a subdirectory of the repository, i...
<p>You can use <code>git cat-file</code> to dump the contents of the file to the standard output and redirect that into your desired destination:</p> <pre><code>git cat-file -p &lt;sha1&gt;:./file.tex &gt; wherever.tex </code></pre> <p>The <code>./</code> is necessary if you are in a subdirectory of the repository, i...
119, 37230
git, git-checkout
<h1>How to get a copy of an older version of a file in a git repository?</h1> <p>I have a version of a <code>.tex</code> file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want to replace the current ver...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,734
git
# How to get a copy of an older version of a file in a git repository? I have a version of a `.tex` file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want to replace the current version of the file. Ra...
You can use `git cat-file` to dump the contents of the file to the standard output and redirect that into your desired destination: ``` git cat-file -p <sha1>:./file.tex > wherever.tex ``` The `./` is necessary if you are in a subdirectory of the repository, if you're in the top-level of the repository it may be omit...
7580542
Git: set branch to current ref
78
2011-09-28 08:45:05
<p>Due to the use of submodules in my projects I'm finding myself often on "(no branch)". As I'm also adding code to those submodules I'm committing in there. When I then want to push those submodules I need to be on a branch of course. Hence my question:</p> <p>Is there a way/shortcut in git (command line) to set a l...
54,128
880,584
2018-10-04 11:23:46
7,580,634
118
2011-09-28 08:52:14
11,343
2018-10-04 11:23:46
https://stackoverflow.com/q/7580542
https://stackoverflow.com/a/7580634
<p>Checkout the branch with <code>-B</code>: this will reset the branch to HEAD, which is the current ref.</p> <pre><code>git checkout -B &lt;branch&gt; </code></pre> <p>From the <a href="https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutem-b-Bltnewbranchgtltstartpointgt" rel="noreferrer">docs</a>:</p>...
<p>Checkout the branch with <code>-B</code>: this will reset the branch to HEAD, which is the current ref.</p> <pre><code>git checkout -B &lt;branch&gt; </code></pre> <p>From the <a href="https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutem-b-Bltnewbranchgtltstartpointgt" rel="noreferrer">docs</a>:</p>...
119
git
<h1>Git: set branch to current ref</h1> <p>Due to the use of submodules in my projects I'm finding myself often on "(no branch)". As I'm also adding code to those submodules I'm committing in there. When I then want to push those submodules I need to be on a branch of course. Hence my question:</p> <p>Is there a way/s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,736
git
# Git: set branch to current ref Due to the use of submodules in my projects I'm finding myself often on "(no branch)". As I'm also adding code to those submodules I'm committing in there. When I then want to push those submodules I need to be on a branch of course. Hence my question: Is there a way/shortcut in git (...
Checkout the branch with `-B`: this will reset the branch to HEAD, which is the current ref. ``` git checkout -B <branch> ``` From the [docs](https://git-scm.com/docs/git-checkout#git-checkout-emgitcheckoutem-b-Bltnewbranchgtltstartpointgt): > If -B is given, is created if it doesn’t exist; > otherwise, it is reset....
38302119
Revert a merged pull request on Bitbucket
75
2016-07-11 08:13:45
<p>I've created a pull request and I've merged it to an wrong branch. How can I revert it?</p> <p>As far I've been to figuring out taking a look over there, I'm able to hard reset the destination branch... but, how about the pull request in <code>origin</code> repository?</p> <p>I'm using Bitbucket and I've created t...
162,312
3,227,319
2023-06-09 21:14:07
38,302,342
118
2016-07-11 08:26:43
145,279
2018-02-18 02:05:45
https://stackoverflow.com/q/38302119
https://stackoverflow.com/a/38302342
<p>Unfortunately, there is no "Revert Pull Request" feature on Bitbucket as of this writing, but a <a href="https://bitbucket.org/site/master/issues/10228/revert-pull-request-button-bb-11090" rel="noreferrer">feature request exists for it</a>.</p> <p><strong>Note</strong>: Before you proceed, make sure your working co...
<p>Unfortunately, there is no "Revert Pull Request" feature on Bitbucket as of this writing, but a <a href="https://bitbucket.org/site/master/issues/10228/revert-pull-request-button-bb-11090" rel="noreferrer">feature request exists for it</a>.</p> <p><strong>Note</strong>: Before you proceed, make sure your working co...
119, 8337, 90056
atlassian-sourcetree, bitbucket, git
<h1>Revert a merged pull request on Bitbucket</h1> <p>I've created a pull request and I've merged it to an wrong branch. How can I revert it?</p> <p>As far I've been to figuring out taking a look over there, I'm able to hard reset the destination branch... but, how about the pull request in <code>origin</code> reposit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,738
git
# Revert a merged pull request on Bitbucket I've created a pull request and I've merged it to an wrong branch. How can I revert it? As far I've been to figuring out taking a look over there, I'm able to hard reset the destination branch... but, how about the pull request in `origin` repository? I'm using Bitbucket a...
Unfortunately, there is no "Revert Pull Request" feature on Bitbucket as of this writing, but a [feature request exists for it](https://bitbucket.org/site/master/issues/10228/revert-pull-request-button-bb-11090). **Note**: Before you proceed, make sure your working copy is clean, with no uncommitted or unpushed change...
1192180
Deleting a badly named git branch
69
2009-07-28 06:13:08
<p>I know this isn't strictly a programming question, but it is related to git. I accidentally have created a branch in git called <code>--track</code> (I got the order of options wrong when merging a remote branch)</p> <p>The regular command doesn't work:</p> <pre><code>git branch -D "--track" </code></pre> <p>I ...
16,099
92,650
2025-01-08 02:29:10
1,192,194
118
2009-07-28 06:17:35
6,309
2025-01-08 02:29:10
https://stackoverflow.com/q/1192180
https://stackoverflow.com/a/1192194
<p>Did you try</p> <pre><code>git branch -D -- --track </code></pre> <p>? the &quot;<code>--</code>&quot; is usually the convention for &quot;what follows is not an option, whatever its name&quot;</p> <hr /> <p>From &quot;<a href="http://www.catb.org/esr/writings/taoup/html/" rel="nofollow noreferrer">The Art of Unix P...
<p>Did you try</p> <pre><code>git branch -D -- --track </code></pre> <p>? the &quot;<code>--</code>&quot; is usually the convention for &quot;what follows is not an option, whatever its name&quot;</p> <hr /> <p>From &quot;<a href="http://www.catb.org/esr/writings/taoup/html/" rel="nofollow noreferrer">The Art of Unix P...
119, 76220
git, git-branch
<h1>Deleting a badly named git branch</h1> <p>I know this isn't strictly a programming question, but it is related to git. I accidentally have created a branch in git called <code>--track</code> (I got the order of options wrong when merging a remote branch)</p> <p>The regular command doesn't work:</p> <pre><code>git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,739
git
# Deleting a badly named git branch I know this isn't strictly a programming question, but it is related to git. I accidentally have created a branch in git called `--track` (I got the order of options wrong when merging a remote branch) The regular command doesn't work: ``` git branch -D "--track" ``` I have tried...
Did you try ``` git branch -D -- --track ``` ? the "`--`" is usually the convention for "what follows is not an option, whatever its name" --- From "[The Art of Unix Programming](http://www.catb.org/esr/writings/taoup/html/)", section "[Command-Line Options](http://www.catb.org/esr/writings/taoup/html/ch10s05.html)...
31652094
Commiter email address does not match in IntelliJ even changing it to correct one
39
2015-07-27 11:38:57
<p>When I try to push my commits from git repository to gerrit remote repository from Linux environment in IntelliJ idea I get the following error:</p> <pre><code>remote: ERROR: committer email address ***** [K remote: ERROR: does not match your user account.[K </code></pre> <p>Even if I changed the settings to the...
82,744
null
2020-05-29 16:33:57
31,652,155
118
2015-07-27 11:42:03
4,296,747
2016-09-14 11:29:15
https://stackoverflow.com/q/31652094
https://stackoverflow.com/a/31652155
<p>you need to reconfigure your email </p> <pre><code>$ git config user.email &lt;your email&gt; $ git commit --amend --reset-author </code></pre> <p><code>git commit --amend</code> updates your last commits</p>
<p>you need to reconfigure your email </p> <pre><code>$ git config user.email &lt;your email&gt; $ git commit --amend --reset-author </code></pre> <p><code>git commit --amend</code> updates your last commits</p>
119, 8945, 52272
gerrit, git, intellij-idea
<h1>Commiter email address does not match in IntelliJ even changing it to correct one</h1> <p>When I try to push my commits from git repository to gerrit remote repository from Linux environment in IntelliJ idea I get the following error:</p> <pre><code>remote: ERROR: committer email address ***** [K remote: ERROR: ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,742
git
# Commiter email address does not match in IntelliJ even changing it to correct one When I try to push my commits from git repository to gerrit remote repository from Linux environment in IntelliJ idea I get the following error: ``` remote: ERROR: committer email address ***** [K remote: ERROR: does not match your ...
you need to reconfigure your email ``` $ git config user.email <your email> $ git commit --amend --reset-author ``` `git commit --amend` updates your last commits
7759193
git diff renamed file
147
2011-10-13 19:08:52
<p>I have a file <code>a.txt</code>.</p> <pre><code>cat a.txt &gt; hello </code></pre> <p>The contents of <code>a.txt</code> is "hello".</p> <p>I make a commit.</p> <pre><code>git add a.txt git commit -m "first commit" </code></pre> <p>I then move <code>a.txt</code> into a <code>test</code> dir.</p> <pre><code>mk...
46,813
615,315
2025-06-17 20:13:49
7,759,392
117
2011-10-13 19:26:03
19,563
2011-10-13 19:34:47
https://stackoverflow.com/q/7759193
https://stackoverflow.com/a/7759392
<p>The issue with the difference between <code>HEAD^^</code> and <code>HEAD</code> is that you have an <code>a.txt</code> in both commits, so just considering those two commits (which is what diff does), there is no rename, there is a copy and a change.</p> <p>To detect copies, you can use <code>-C</code>:</p> <pre><...
<p>The issue with the difference between <code>HEAD^^</code> and <code>HEAD</code> is that you have an <code>a.txt</code> in both commits, so just considering those two commits (which is what diff does), there is no rename, there is a copy and a change.</p> <p>To detect copies, you can use <code>-C</code>:</p> <pre><...
119, 606, 4510
diff, git, rename
<h1>git diff renamed file</h1> <p>I have a file <code>a.txt</code>.</p> <pre><code>cat a.txt &gt; hello </code></pre> <p>The contents of <code>a.txt</code> is "hello".</p> <p>I make a commit.</p> <pre><code>git add a.txt git commit -m "first commit" </code></pre> <p>I then move <code>a.txt</code> into a <code>test...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,743
git
# git diff renamed file I have a file `a.txt`. ``` cat a.txt > hello ``` The contents of `a.txt` is "hello". I make a commit. ``` git add a.txt git commit -m "first commit" ``` I then move `a.txt` into a `test` dir. ``` mkdir test mv a.txt test ``` I then make my second commit. ``` git add -A git commit -m "se...
The issue with the difference between `HEAD^^` and `HEAD` is that you have an `a.txt` in both commits, so just considering those two commits (which is what diff does), there is no rename, there is a copy and a change. To detect copies, you can use `-C`: ``` git diff -C HEAD^^ HEAD ``` Result: ``` index ce01362..dd7...
21457407
Git Gui: Perpetually getting "This repository currently has approximately 320 loose objects."
121
2014-01-30 13:07:08
<p>Every time I start Git Gui on a particular project I get this message:</p> <blockquote> <p>This repository currently has approximately 320 loose objects.</p> </blockquote> <p><img src="https://i.sstatic.net/BLyCk.png" alt="enter image description here"></p> <p>I then proceed to click <em>Yes</em>, and I get thi...
37,492
492,336
2019-11-14 11:11:09
21,458,411
117
2014-01-30 13:53:34
3,092,298
2014-01-30 13:53:34
https://stackoverflow.com/q/21457407
https://stackoverflow.com/a/21458411
<p>Just simply skipping the pop up, as <a href="https://stackoverflow.com/questions/1106529/how-to-skip-loose-object-popup-when-running-git-gui">How to skip &quot;Loose Object&quot; popup when running &#39;git gui&#39;</a> suggests in the accepted answer is overlooking the fact that Git is communicating a possible perf...
<p>Just simply skipping the pop up, as <a href="https://stackoverflow.com/questions/1106529/how-to-skip-loose-object-popup-when-running-git-gui">How to skip &quot;Loose Object&quot; popup when running &#39;git gui&#39;</a> suggests in the accepted answer is overlooking the fact that Git is communicating a possible perf...
119, 33729
git, git-gui
<h1>Git Gui: Perpetually getting "This repository currently has approximately 320 loose objects."</h1> <p>Every time I start Git Gui on a particular project I get this message:</p> <blockquote> <p>This repository currently has approximately 320 loose objects.</p> </blockquote> <p><img src="https://i.sstatic.net/BLy...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,744
git
# Git Gui: Perpetually getting "This repository currently has approximately 320 loose objects." Every time I start Git Gui on a particular project I get this message: > This repository currently has approximately 320 loose objects. ![enter image description here](https://i.sstatic.net/BLyCk.png) I then proceed to c...
Just simply skipping the pop up, as [How to skip "Loose Object" popup when running 'git gui'](https://stackoverflow.com/questions/1106529/how-to-skip-loose-object-popup-when-running-git-gui) suggests in the accepted answer is overlooking the fact that Git is communicating a possible performance issue to you. This shoul...
39220870
In Git, list names of branches with unpushed commits
85
2016-08-30 07:02:54
<p>Given a project with several local branches, each tracking some remote branch, is there a command that lists all branches that have unpushed commits? (That is, even if none of those branches are checked out.)</p> <p>I don't want to see the commits themselves, nor do I want to see branches that are up-to-date, I jus...
17,105
188,535
2020-06-17 02:57:45
48,180,899
117
2018-01-10 05:34:18
188,535
2018-01-10 05:34:18
https://stackoverflow.com/q/39220870
https://stackoverflow.com/a/48180899
<p>The <code>--no-walk</code> option to <code>log</code> seems to do a better job of what I need than <code>--simplify-by-decoration</code>. My full command is:</p> <p><code>git log --branches --not --remotes --no-walk --decorate --oneline</code></p> <p>...which I've aliased to <code>unpushed</code>.</p>
<p>The <code>--no-walk</code> option to <code>log</code> seems to do a better job of what I need than <code>--simplify-by-decoration</code>. My full command is:</p> <p><code>git log --branches --not --remotes --no-walk --decorate --oneline</code></p> <p>...which I've aliased to <code>unpushed</code>.</p>
119, 1879
branch, git
<h1>In Git, list names of branches with unpushed commits</h1> <p>Given a project with several local branches, each tracking some remote branch, is there a command that lists all branches that have unpushed commits? (That is, even if none of those branches are checked out.)</p> <p>I don't want to see the commits themse...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,746
git
# In Git, list names of branches with unpushed commits Given a project with several local branches, each tracking some remote branch, is there a command that lists all branches that have unpushed commits? (That is, even if none of those branches are checked out.) I don't want to see the commits themselves, nor do I w...
The `--no-walk` option to `log` seems to do a better job of what I need than `--simplify-by-decoration`. My full command is: `git log --branches --not --remotes --no-walk --decorate --oneline` ...which I've aliased to `unpushed`.
28195778
'git stash apply' with Interactive Mode
72
2015-01-28 15:16:21
<p>I have a serie of files into a stash (<code>stash{0}</code>) and I would like to <code>git apply</code> <strong>just</strong> some parts/hunks of these files (usually known as <em>Interactive mode</em>).</p> <p>Is it possible?</p> <p>I've seen that is possible to perform a</p> <pre><code>git stash save -p 'Stash ...
29,656
3,088,045
2021-04-12 19:55:06
43,687,885
117
2017-04-28 19:47:47
1,273,938
2021-04-12 19:55:06
https://stackoverflow.com/q/28195778
https://stackoverflow.com/a/43687885
<blockquote> <p>Is it possible?</p> </blockquote> <h1>Yes it is!</h1> <pre><code>git checkout -p stash@{0} </code></pre> <p>Where you can replace the <code>0</code> in <code>stash@{0}</code> with the index of the stash you want to apply.</p> <p>Use <code>git stash list</code> and <code>git show -p stash@{n}</code> if u...
<blockquote> <p>Is it possible?</p> </blockquote> <h1>Yes it is!</h1> <pre><code>git checkout -p stash@{0} </code></pre> <p>Where you can replace the <code>0</code> in <code>stash@{0}</code> with the index of the stash you want to apply.</p> <p>Use <code>git stash list</code> and <code>git show -p stash@{n}</code> if u...
119, 13091, 22013, 30669
chunks, git, git-stash, interactive-mode
<h1>'git stash apply' with Interactive Mode</h1> <p>I have a serie of files into a stash (<code>stash{0}</code>) and I would like to <code>git apply</code> <strong>just</strong> some parts/hunks of these files (usually known as <em>Interactive mode</em>).</p> <p>Is it possible?</p> <p>I've seen that is possible to pe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,747
git
# 'git stash apply' with Interactive Mode I have a serie of files into a stash (`stash{0}`) and I would like to `git apply` **just** some parts/hunks of these files (usually known as *Interactive mode*). Is it possible? I've seen that is possible to perform a ``` git stash save -p 'Stash name' ``` but it seems not...
> Is it possible? # Yes it is! ``` git checkout -p stash@{0} ``` Where you can replace the `0` in `stash@{0}` with the index of the stash you want to apply. Use `git stash list` and `git show -p stash@{n}` if unsure which `n` is the stash you want to apply. Don't forget to `git stash drop stash@{n}` when you know ...
18506456
git: How to delete a local ref branch?
56
2013-08-29 08:59:34
<p>I have bit of a difficulty in deleting a local ref branch(refs/notes/origin/commits). I was able to delete the branch(refs/notes/origin/commits) in the remote repository using the command</p> <pre><code>git push origin :refs/notes/origin/commits </code></pre> <p>but when i try to delete the same branch on my local...
85,150
2,663,585
2023-11-30 10:22:08
18,506,532
117
2013-08-29 09:03:19
1,616,951
2013-08-29 09:45:26
https://stackoverflow.com/q/18506456
https://stackoverflow.com/a/18506532
<p>Just do</p> <pre><code>git branch -d commits </code></pre> <p>to delete the local branch.</p> <p>Use the <code>-D</code> switch to delete it irrespective of its merged status.</p> <p>Use</p> <pre><code>git update-ref -d refs/notes/origin/commits </code></pre> <p>to delete the ref.</p> <p>You can also hard-del...
<p>Just do</p> <pre><code>git branch -d commits </code></pre> <p>to delete the local branch.</p> <p>Use the <code>-D</code> switch to delete it irrespective of its merged status.</p> <p>Use</p> <pre><code>git update-ref -d refs/notes/origin/commits </code></pre> <p>to delete the ref.</p> <p>You can also hard-del...
119, 88239
git, git-notes
<h1>git: How to delete a local ref branch?</h1> <p>I have bit of a difficulty in deleting a local ref branch(refs/notes/origin/commits). I was able to delete the branch(refs/notes/origin/commits) in the remote repository using the command</p> <pre><code>git push origin :refs/notes/origin/commits </code></pre> <p>but ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,749
git
# git: How to delete a local ref branch? I have bit of a difficulty in deleting a local ref branch(refs/notes/origin/commits). I was able to delete the branch(refs/notes/origin/commits) in the remote repository using the command ``` git push origin :refs/notes/origin/commits ``` but when i try to delete the same bra...
Just do ``` git branch -d commits ``` to delete the local branch. Use the `-D` switch to delete it irrespective of its merged status. Use ``` git update-ref -d refs/notes/origin/commits ``` to delete the ref. You can also hard-delete it as mentioned in other answers with ``` rm -rf .git/refs/notes ```
9853681
Git create branch from range of previous commits?
42
2012-03-24 17:07:46
<p>I have a bunch of commits for an OS project and I want to pull out just the last say 20 commits into another branch so I can pull request.</p> <p>How could I do this? The reason being is I have maybe 150 commits, but most of those are for a much larger contribute, which isn't ready yet. But the next version is bein...
25,709
150,062
2015-10-27 22:28:11
9,853,814
117
2012-03-24 17:22:40
148,870
2012-03-24 17:22:40
https://stackoverflow.com/q/9853681
https://stackoverflow.com/a/9853814
<p>You can do this with <code>cherry-pick</code>. If your history of <code>long_branch</code> looks like this:</p> <pre><code>A-B &lt;-- master \ C-D-E-F-G-H &lt;-- long_branch </code></pre> <p>and you want to move the contents of, say, F through H to a different branch, say, <code>short_branch</code>, which...
<p>You can do this with <code>cherry-pick</code>. If your history of <code>long_branch</code> looks like this:</p> <pre><code>A-B &lt;-- master \ C-D-E-F-G-H &lt;-- long_branch </code></pre> <p>and you want to move the contents of, say, F through H to a different branch, say, <code>short_branch</code>, which...
119
git
<h1>Git create branch from range of previous commits?</h1> <p>I have a bunch of commits for an OS project and I want to pull out just the last say 20 commits into another branch so I can pull request.</p> <p>How could I do this? The reason being is I have maybe 150 commits, but most of those are for a much larger cont...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,751
git
# Git create branch from range of previous commits? I have a bunch of commits for an OS project and I want to pull out just the last say 20 commits into another branch so I can pull request. How could I do this? The reason being is I have maybe 150 commits, but most of those are for a much larger contribute, which is...
You can do this with `cherry-pick`. If your history of `long_branch` looks like this: ``` A-B <-- master \ C-D-E-F-G-H <-- long_branch ``` and you want to move the contents of, say, F through H to a different branch, say, `short_branch`, which is based off of `master`: ``` git checkout master -b short_branc...
9264314
Git commits are duplicated in the same branch after doing a rebase
228
2012-02-13 16:42:00
<p>I understand the scenario presented in Pro Git about <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_rebase_peril" rel="noreferrer">The Perils of Rebasing</a>. The author basically tells you how to avoid duplicated commits:</p> <blockquote> <p>Do not rebase commits that you have pushed to a public...
144,230
592,454
2022-02-15 14:32:18
9,264,653
116
2012-02-13 17:03:38
265,575
2012-02-13 17:03:38
https://stackoverflow.com/q/9264314
https://stackoverflow.com/a/9264653
<p>You should not be using rebase here, a simple merge will suffice. The Pro Git book that you linked basically explains this exact situation. The inner workings might be slightly different, but here's how I visualize it:</p> <ul> <li><code>C5</code> and <code>C6</code> are temporarily pulled out of <code>dev</code></...
<p>You should not be using rebase here, a simple merge will suffice. The Pro Git book that you linked basically explains this exact situation. The inner workings might be slightly different, but here's how I visualize it:</p> <ul> <li><code>C5</code> and <code>C6</code> are temporarily pulled out of <code>dev</code></...
119, 1879, 8974
branch, git, rebase
<h1>Git commits are duplicated in the same branch after doing a rebase</h1> <p>I understand the scenario presented in Pro Git about <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_rebase_peril" rel="noreferrer">The Perils of Rebasing</a>. The author basically tells you how to avoid duplicated commits:</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,752
git
# Git commits are duplicated in the same branch after doing a rebase I understand the scenario presented in Pro Git about [The Perils of Rebasing](https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_rebase_peril). The author basically tells you how to avoid duplicated commits: > Do not rebase commits that you have...
You should not be using rebase here, a simple merge will suffice. The Pro Git book that you linked basically explains this exact situation. The inner workings might be slightly different, but here's how I visualize it: - `C5` and `C6` are temporarily pulled out of `dev` - `C7` is applied to `dev` - `C5` and `C6` are p...
4878358
Why would I want stage before committing in Git?
158
2011-02-02 18:33:14
<p>I'm new to version control and I understand that "committing" is essentially creating a backup while updating the new 'current' version of what you're working on.</p> <p>What I don't understand is what staging for is from a practical perspective. Is staging something that exists in name only or does it serve a purp...
69,893
175,250
2021-10-06 23:09:45
4,878,399
116
2011-02-02 18:37:18
479,989
2011-02-02 18:37:18
https://stackoverflow.com/q/4878358
https://stackoverflow.com/a/4878399
<p>When you commit it's only going to commit the changes in the index (the "staged" files). There are many uses for this, but the most obvious is to break up your working changes into smaller, self-contained pieces. Perhaps you fixed a bug while you were implementing a feature. You can <code>git add</code> just that...
<p>When you commit it's only going to commit the changes in the index (the "staged" files). There are many uses for this, but the most obvious is to break up your working changes into smaller, self-contained pieces. Perhaps you fixed a bug while you were implementing a feature. You can <code>git add</code> just that...
119
git
<h1>Why would I want stage before committing in Git?</h1> <p>I'm new to version control and I understand that "committing" is essentially creating a backup while updating the new 'current' version of what you're working on.</p> <p>What I don't understand is what staging for is from a practical perspective. Is staging ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,753
git
# Why would I want stage before committing in Git? I'm new to version control and I understand that "committing" is essentially creating a backup while updating the new 'current' version of what you're working on. What I don't understand is what staging for is from a practical perspective. Is staging something that e...
When you commit it's only going to commit the changes in the index (the "staged" files). There are many uses for this, but the most obvious is to break up your working changes into smaller, self-contained pieces. Perhaps you fixed a bug while you were implementing a feature. You can `git add` just that file (or `git ad...
7080803
How can I commit files with git?
118
2011-08-16 15:31:36
<p>None of the tutorials will help!<br> They all do that thing where they just assume I know what to do..</p> <p>Currently, my terminal window starts with..</p> <pre><code># Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch...
306,721
537,998
2023-09-01 06:21:10
7,080,914
116
2011-08-16 15:38:40
189,179
2011-08-16 18:53:36
https://stackoverflow.com/q/7080803
https://stackoverflow.com/a/7080914
<p>When you run <code>git commit</code> with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit.</p> <p>It looks like your default editor is Vi or Vim. The reason "weird stuff" happens when you type is that Vi doesn't star...
<p>When you run <code>git commit</code> with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit.</p> <p>It looks like your default editor is Vi or Vim. The reason "weird stuff" happens when you type is that Vi doesn't star...
119
git
<h1>How can I commit files with git?</h1> <p>None of the tutorials will help!<br> They all do that thing where they just assume I know what to do..</p> <p>Currently, my terminal window starts with..</p> <pre><code># Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an em...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,754
git
# How can I commit files with git? None of the tutorials will help! They all do that thing where they just assume I know what to do.. Currently, my terminal window starts with.. ``` # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit...
When you run `git commit` with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit. It looks like your default editor is Vi or Vim. The reason "weird stuff" happens when you type is that Vi doesn't start in insert mode - you...
1741143
'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?
92
2009-11-16 09:50:35
<p>I just observed something odd about <code>git pull</code>, which I don't understand.</p> <p>On Friday, I worked on a local branch. let's call it <code>mybranch</code>. Before leaving the office I pushed it to origin (which is my github repo): <code>git push origin mybranch</code>.</p> <p>Yesterday at home, I <code...
32,041
127,013
2013-11-08 08:27:03
1,743,870
116
2009-11-16 18:08:24
19,563
2013-11-08 08:27:03
https://stackoverflow.com/q/1741143
https://stackoverflow.com/a/1743870
<p><code>git pull</code> calls <code>git fetch</code> with the appropriate parameters before merging the explicitly fetched heads (or if none the remote branch configured for merge) into the current branch.</p> <p>The syntax: <code>git fetch &lt;repository&gt; &lt;ref&gt;</code> where <code>&lt;ref&gt;</code> is just ...
<p><code>git pull</code> calls <code>git fetch</code> with the appropriate parameters before merging the explicitly fetched heads (or if none the remote branch configured for merge) into the current branch.</p> <p>The syntax: <code>git fetch &lt;repository&gt; &lt;ref&gt;</code> where <code>&lt;ref&gt;</code> is just ...
119, 456, 28896
git, git-pull, version-control
<h1>'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?</h1> <p>I just observed something odd about <code>git pull</code>, which I don't understand.</p> <p>On Friday, I worked on a local branch. let's call it <code>mybranch</code>. Before leaving the office I pushed it to origin (which is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,755
git
# 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why? I just observed something odd about `git pull`, which I don't understand. On Friday, I worked on a local branch. let's call it `mybranch`. Before leaving the office I pushed it to origin (which is my github repo): `git push origin mybr...
`git pull` calls `git fetch` with the appropriate parameters before merging the explicitly fetched heads (or if none the remote branch configured for merge) into the current branch. The syntax: `git fetch <repository> <ref>` where `<ref>` is just a branch name with no colon is a 'one shot' fetch that doesn't do a stan...
6294224
check if pushed tag is on the git remote
83
2011-06-09 14:15:15
<p>Anyone know how to check if a tag is on the git remote after the tag is pushed from the local?</p> <p>It seems that the only way to do it is to fetch the remote. </p>
35,258
779,656
2018-07-19 14:38:22
6,295,385
116
2011-06-09 15:30:15
215,168
2011-06-09 15:30:15
https://stackoverflow.com/q/6294224
https://stackoverflow.com/a/6295385
<p>Try</p> <pre><code>git ls-remote --tags origin </code></pre>
<p>Try</p> <pre><code>git ls-remote --tags origin </code></pre>
119
git
<h1>check if pushed tag is on the git remote</h1> <p>Anyone know how to check if a tag is on the git remote after the tag is pushed from the local?</p> <p>It seems that the only way to do it is to fetch the remote. </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,756
git
# check if pushed tag is on the git remote Anyone know how to check if a tag is on the git remote after the tag is pushed from the local? It seems that the only way to do it is to fetch the remote.
Try ``` git ls-remote --tags origin ```
53034303
Should XCSharedData be checked into Git Repo for Xcode project?
72
2018-10-28 17:33:30
<p>I just made some changes and I see a pending file that has not been added to the repo. The filenames path is */xcshareddata/IDEWorkspaceChecks.plist. Can someone explain the reason for this file and why or why not it needs to be added to the repo?</p>
25,826
455,570
2019-08-14 01:30:52
53,039,267
116
2018-10-29 05:30:44
1,033,581
2019-08-14 01:30:52
https://stackoverflow.com/q/53034303
https://stackoverflow.com/a/53039267
<p>The files in <code>xcshareddata/</code> should be added to the repo (but not the ones in <code>xcuserdata/</code>):</p> <blockquote> <p>Xcode 9.3 adds a new IDEWorkspaceChecks.plist file to a workspace's shared data, to store the state of necessary workspace checks. Committing this file to source control will pre...
<p>The files in <code>xcshareddata/</code> should be added to the repo (but not the ones in <code>xcuserdata/</code>):</p> <blockquote> <p>Xcode 9.3 adds a new IDEWorkspaceChecks.plist file to a workspace's shared data, to store the state of necessary workspace checks. Committing this file to source control will pre...
119, 908, 25056
git, gitignore, xcode
<h1>Should XCSharedData be checked into Git Repo for Xcode project?</h1> <p>I just made some changes and I see a pending file that has not been added to the repo. The filenames path is */xcshareddata/IDEWorkspaceChecks.plist. Can someone explain the reason for this file and why or why not it needs to be added to the re...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,757
git
# Should XCSharedData be checked into Git Repo for Xcode project? I just made some changes and I see a pending file that has not been added to the repo. The filenames path is */xcshareddata/IDEWorkspaceChecks.plist. Can someone explain the reason for this file and why or why not it needs to be added to the repo?
The files in `xcshareddata/` should be added to the repo (but not the ones in `xcuserdata/`): > Xcode 9.3 adds a new IDEWorkspaceChecks.plist file to a workspace's shared data, to store the state of necessary workspace checks. Committing this file to source control will prevent unnecessary rerunning of those checks fo...
1591107
Reset other branch to current without a checkout
178
2009-10-19 20:56:16
<p>I'm writing some scripts for my Git workflow.</p> <p>I need to reset other (existing) branch to the current one, without checkout.</p> <p>Before:</p> <pre><code> CurrentBranch: commit A OtherBranch: commit B </code></pre> <p>After:</p> <pre><code> CurrentBranch: commit A OtherBranch: commit A </code></pre> <...
37,258
6,236
2022-08-23 13:53:30
1,591,255
115
2009-10-19 21:25:23
158,676
2009-10-19 21:42:13
https://stackoverflow.com/q/1591107
https://stackoverflow.com/a/1591255
<p>The workflows you describe are not equivalent: when you perform <code>reset --hard</code> you lose all the changes in the working tree (you might want to make it <code>reset --soft</code>).</p> <p>What you need is </p> <pre><code>git update-ref refs/heads/OtherBranch refs/heads/CurrentBranch </code></pre>
<p>The workflows you describe are not equivalent: when you perform <code>reset --hard</code> you lose all the changes in the working tree (you might want to make it <code>reset --soft</code>).</p> <p>What you need is </p> <pre><code>git update-ref refs/heads/OtherBranch refs/heads/CurrentBranch </code></pre>
119
git
<h1>Reset other branch to current without a checkout</h1> <p>I'm writing some scripts for my Git workflow.</p> <p>I need to reset other (existing) branch to the current one, without checkout.</p> <p>Before:</p> <pre><code> CurrentBranch: commit A OtherBranch: commit B </code></pre> <p>After:</p> <pre><code> Curre...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,761
git
# Reset other branch to current without a checkout I'm writing some scripts for my Git workflow. I need to reset other (existing) branch to the current one, without checkout. Before: ``` CurrentBranch: commit A OtherBranch: commit B ``` After: ``` CurrentBranch: commit A OtherBranch: commit A ``` Equivalent ...
The workflows you describe are not equivalent: when you perform `reset --hard` you lose all the changes in the working tree (you might want to make it `reset --soft`). What you need is ``` git update-ref refs/heads/OtherBranch refs/heads/CurrentBranch ```
7912022
Do you ignore a git submodule in your .gitignore or commit it to your repo?
148
2011-10-27 05:28:02
<p>I've added a submodule to my project in <code>project_dir/vendor/submodule_one</code> now each time I run <code>git status</code> I get <code>modified: vendor/submodule_one (new commits)</code>.</p> <p>My question is whats the best way to deal with this? Do I add the <code>vendor/submodule_one</code>-folder to my <...
111,643
771,489
2022-09-03 14:50:37
7,912,101
115
2011-10-27 05:42:39
6,309
2018-06-09 04:48:50
https://stackoverflow.com/q/7912022
https://stackoverflow.com/a/7912101
<p>No, you don't need to add your submodule to your <code>.gitignore</code>: what the parent will see from your submodule is a <strong>gitlink</strong> (a <a href="https://stackoverflow.com/a/16581096/6309">special entry, <code>mode 160000</code></a>).</p> <p>That means: any change directly made in a submodule needs t...
<p>No, you don't need to add your submodule to your <code>.gitignore</code>: what the parent will see from your submodule is a <strong>gitlink</strong> (a <a href="https://stackoverflow.com/a/16581096/6309">special entry, <code>mode 160000</code></a>).</p> <p>That means: any change directly made in a submodule needs t...
119
git
<h1>Do you ignore a git submodule in your .gitignore or commit it to your repo?</h1> <p>I've added a submodule to my project in <code>project_dir/vendor/submodule_one</code> now each time I run <code>git status</code> I get <code>modified: vendor/submodule_one (new commits)</code>.</p> <p>My question is whats the best...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,762
git
# Do you ignore a git submodule in your .gitignore or commit it to your repo? I've added a submodule to my project in `project_dir/vendor/submodule_one` now each time I run `git status` I get `modified: vendor/submodule_one (new commits)`. My question is whats the best way to deal with this? Do I add the `vendor/subm...
No, you don't need to add your submodule to your `.gitignore`: what the parent will see from your submodule is a **gitlink** (a [special entry, `mode 160000`](https://stackoverflow.com/a/16581096/6309)). That means: any change directly made in a submodule needs to be followed by a commit in the parent directory. Tha...
9320218
How to list files ignored by git that are currently staged or committed?
98
2012-02-16 22:39:07
<p>How does one get a list of those files that match a rule in .gitignore file, but that have been staged or committed in the past?</p>
17,817
152,860
2023-03-12 22:36:42
9,370,094
115
2012-02-20 23:39:44
712,605
2013-08-24 19:33:53
https://stackoverflow.com/q/9320218
https://stackoverflow.com/a/9370094
<p>The documentation to <code>ls-files</code> is not exactly clearly written, but it appears that the following simple alias does the job:</p> <pre><code>git config --global alias.showtrackedignored "ls-files -i --exclude-standard" </code></pre> <p>The above command creates an alias called <code>showtrackedignored</c...
<p>The documentation to <code>ls-files</code> is not exactly clearly written, but it appears that the following simple alias does the job:</p> <pre><code>git config --global alias.showtrackedignored "ls-files -i --exclude-standard" </code></pre> <p>The above command creates an alias called <code>showtrackedignored</c...
119
git
<h1>How to list files ignored by git that are currently staged or committed?</h1> <p>How does one get a list of those files that match a rule in .gitignore file, but that have been staged or committed in the past?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,764
git
# How to list files ignored by git that are currently staged or committed? How does one get a list of those files that match a rule in .gitignore file, but that have been staged or committed in the past?
The documentation to `ls-files` is not exactly clearly written, but it appears that the following simple alias does the job: ``` git config --global alias.showtrackedignored "ls-files -i --exclude-standard" ``` The above command creates an alias called `showtrackedignored`. To use, run: ``` git showtrackedignored ``...
5307417
How to skip the commit message step in "git commit --amend"?
91
2011-03-15 04:04:33
<p>I'm running a very rapid code-compile-test loop where I am amending changes to my commits far more often than not.</p> <p>For example:</p> <pre><code># Make some changes $ git commit -m "Added feature X" # Compile, test # Fix bugs $ git commit -a --amend </code></pre> <p>I usually want the same commit message aft...
17,642
117,104
2018-09-11 08:08:33
5,307,443
115
2011-03-15 04:09:17
1,864,976
2012-10-04 21:02:21
https://stackoverflow.com/q/5307417
https://stackoverflow.com/a/5307443
<p>You can just add <code>--no-edit</code> to use the last message. This option existed since 2005 but only recently has been enabled for the <code>--amend</code> option.</p> <p>The other way is to add <code>-C HEAD</code> to the commit command with amend option. This allows you to not just use the current commit's me...
<p>You can just add <code>--no-edit</code> to use the last message. This option existed since 2005 but only recently has been enabled for the <code>--amend</code> option.</p> <p>The other way is to add <code>-C HEAD</code> to the commit command with amend option. This allows you to not just use the current commit's me...
119, 456, 3809
commit-message, git, version-control
<h1>How to skip the commit message step in "git commit --amend"?</h1> <p>I'm running a very rapid code-compile-test loop where I am amending changes to my commits far more often than not.</p> <p>For example:</p> <pre><code># Make some changes $ git commit -m "Added feature X" # Compile, test # Fix bugs $ git commit -...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,765
git
# How to skip the commit message step in "git commit --amend"? I'm running a very rapid code-compile-test loop where I am amending changes to my commits far more often than not. For example: ``` # Make some changes $ git commit -m "Added feature X" # Compile, test # Fix bugs $ git commit -a --amend ``` I usually wa...
You can just add `--no-edit` to use the last message. This option existed since 2005 but only recently has been enabled for the `--amend` option. The other way is to add `-C HEAD` to the commit command with amend option. This allows you to not just use the current commit's message but you can specify any other referen...
43995
Why is branching and merging easier in Mercurial than in Subversion?
91
2008-09-04 15:16:36
<p>Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but I don't know why. Does anyone else know?</p> <p>My question stems from the f...
12,147
4,003
2010-07-05 13:27:13
44,708
115
2008-09-04 20:32:43
3,844
2008-09-04 20:32:43
https://stackoverflow.com/q/43995
https://stackoverflow.com/a/44708
<blockquote> <p>In Subversion (and CVS), the repository is first and foremost. In git and mercurial there is not really the concept of a repository in the same way; here changes are the central theme.</p> </blockquote> <p>+1</p> <p>The hassle in CVS/SVN comes from the fact that these systems do <strong>not</str...
<blockquote> <p>In Subversion (and CVS), the repository is first and foremost. In git and mercurial there is not really the concept of a repository in the same way; here changes are the central theme.</p> </blockquote> <p>+1</p> <p>The hassle in CVS/SVN comes from the fact that these systems do <strong>not</str...
63, 119, 456, 802
git, mercurial, svn, version-control
<h1>Why is branching and merging easier in Mercurial than in Subversion?</h1> <p>Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,766
git
# Why is branching and merging easier in Mercurial than in Subversion? Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but I don't ...
> In Subversion (and CVS), the repository is first and foremost. In git > and mercurial there is not really the concept of a repository in the > same way; here changes are the central theme. +1 The hassle in CVS/SVN comes from the fact that these systems do **not** remember the parenthood of changes. In Git and Mercu...
15166722
Use own username/password with git and bitbucket
83
2013-03-01 20:54:13
<p>I'm in a team of three; two are working locally, and I am working on the server. </p> <p>My coworker set up the account, but gave me full privileges to the repository.</p> <p>I set my username and email in git:</p> <pre><code>git config --global user.name "bozdoz" git config --global user.email email@email.com <...
320,244
488,784
2022-01-27 07:04:51
15,167,400
115
2013-03-01 21:46:14
1,028,762
2013-03-01 21:46:14
https://stackoverflow.com/q/15166722
https://stackoverflow.com/a/15167400
<p>Run</p> <pre><code>git remote -v </code></pre> <p>and check whether your origin's URL has your co-worker's username hardcoded in there. If so, substitute it with your own:</p> <pre><code>git remote set-url origin &lt;url-with-your-username&gt; </code></pre>
<p>Run</p> <pre><code>git remote -v </code></pre> <p>and check whether your origin's URL has your co-worker's username hardcoded in there. If so, substitute it with your own:</p> <pre><code>git remote set-url origin &lt;url-with-your-username&gt; </code></pre>
119, 8337
bitbucket, git
<h1>Use own username/password with git and bitbucket</h1> <p>I'm in a team of three; two are working locally, and I am working on the server. </p> <p>My coworker set up the account, but gave me full privileges to the repository.</p> <p>I set my username and email in git:</p> <pre><code>git config --global user.name...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,767
git
# Use own username/password with git and bitbucket I'm in a team of three; two are working locally, and I am working on the server. My coworker set up the account, but gave me full privileges to the repository. I set my username and email in git: ``` git config --global user.name "bozdoz" git config --global user.e...
Run ``` git remote -v ``` and check whether your origin's URL has your co-worker's username hardcoded in there. If so, substitute it with your own: ``` git remote set-url origin <url-with-your-username> ```
2476718
How to I add something to the .gitignore so that the match is not recursive?
69
2010-03-19 11:12:58
<p>How to I add something to the <code>.gitignore</code> so that the match is not recursive?</p> <p>For example, I wish to ignore the directory <code>foo</code> and the file <code>bar.txt</code> in the current directory, but not any that exist in subdirectories.</p> <p>I have tried this for my <code>.gitignore</code>...
19,158
755
2018-03-12 18:09:28
2,476,760
115
2010-03-19 11:22:03
755
2010-03-19 11:22:03
https://stackoverflow.com/q/2476718
https://stackoverflow.com/a/2476760
<p>The solution is to place a leading slash on the <code>.gitignore</code> entries:</p> <pre><code>/foo/ /bar.txt </code></pre> <p>(I thought I tried this before posting on StackOverflow, but clearly I hadn't tried it properly, as this works perfectly.)</p>
<p>The solution is to place a leading slash on the <code>.gitignore</code> entries:</p> <pre><code>/foo/ /bar.txt </code></pre> <p>(I thought I tried this before posting on StackOverflow, but clearly I hadn't tried it properly, as this works perfectly.)</p>
119, 4333, 25056
git, gitignore, ignore
<h1>How to I add something to the .gitignore so that the match is not recursive?</h1> <p>How to I add something to the <code>.gitignore</code> so that the match is not recursive?</p> <p>For example, I wish to ignore the directory <code>foo</code> and the file <code>bar.txt</code> in the current directory, but not any ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,769
git
# How to I add something to the .gitignore so that the match is not recursive? How to I add something to the `.gitignore` so that the match is not recursive? For example, I wish to ignore the directory `foo` and the file `bar.txt` in the current directory, but not any that exist in subdirectories. I have tried this ...
The solution is to place a leading slash on the `.gitignore` entries: ``` /foo/ /bar.txt ``` (I thought I tried this before posting on StackOverflow, but clearly I hadn't tried it properly, as this works perfectly.)
22540577
Uninitialize git repository
66
2014-03-20 17:21:38
<p>I have Initialized a git repository and have made some commit in that now for some reason I do not want to track any files in it and want to remove git from my local repo. Is there some way I can Uninitialize it?</p>
123,794
2,908,528
2025-01-04 14:04:47
22,540,611
115
2014-03-20 17:23:20
2,082,964
2025-01-04 14:04:47
https://stackoverflow.com/q/22540577
https://stackoverflow.com/a/22540611
<p>git stores all the repository related data in a folder named &quot;.git&quot; inside your repository folder. So you just want to keep your files but change it into a &quot;not-git-repository&quot;. Warning: this is irreversible!</p> <pre><code>cd path/to/repo rm -rf .git </code></pre> <p>The only files that might re...
<p>git stores all the repository related data in a folder named &quot;.git&quot; inside your repository folder. So you just want to keep your files but change it into a &quot;not-git-repository&quot;. Warning: this is irreversible!</p> <pre><code>cd path/to/repo rm -rf .git </code></pre> <p>The only files that might re...
119
git
<h1>Uninitialize git repository</h1> <p>I have Initialized a git repository and have made some commit in that now for some reason I do not want to track any files in it and want to remove git from my local repo. Is there some way I can Uninitialize it?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,770
git
# Uninitialize git repository I have Initialized a git repository and have made some commit in that now for some reason I do not want to track any files in it and want to remove git from my local repo. Is there some way I can Uninitialize it?
git stores all the repository related data in a folder named ".git" inside your repository folder. So you just want to keep your files but change it into a "not-git-repository". Warning: this is irreversible! ``` cd path/to/repo rm -rf .git ``` The only files that might remain are hidden ".gitignore" files (but only ...
5545715
how do I add /usr/local/git/bin/ to the PATH on mac osx?
41
2011-04-05 00:01:13
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1835837/git-command-not-found">git: command not found</a> </p> </blockquote> <p>how do I add /usr/local/git/bin/ to the PATH on mac osx? I just installed git but it is not recognizing commands. It only responds...
99,043
692,011
2011-04-05 00:08:48
5,545,748
115
2011-04-05 00:08:48
597,633
2011-04-05 00:08:48
https://stackoverflow.com/q/5545715
https://stackoverflow.com/a/5545748
<p>You can add the following to ~/.bash_profile:</p> <pre><code>export PATH=/usr/local/git/bin:$PATH </code></pre> <p>The change will get applied with the next terminal window you open.</p>
<p>You can add the following to ~/.bash_profile:</p> <pre><code>export PATH=/usr/local/git/bin:$PATH </code></pre> <p>The change will get applied with the next terminal window you open.</p>
119, 369
git, macos
<h1>how do I add /usr/local/git/bin/ to the PATH on mac osx?</h1> <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1835837/git-command-not-found">git: command not found</a> </p> </blockquote> <p>how do I add /usr/local/git/bin/ to the PATH on mac osx? I just ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,772
git
# how do I add /usr/local/git/bin/ to the PATH on mac osx? > **Possible Duplicate:** > [git: command not found](https://stackoverflow.com/questions/1835837/git-command-not-found) how do I add /usr/local/git/bin/ to the PATH on mac osx? I just installed git but it is not recognizing commands. It only responds with "...
You can add the following to ~/.bash_profile: ``` export PATH=/usr/local/git/bin:$PATH ``` The change will get applied with the next terminal window you open.
505467
Can I store the .git folder outside the files I want tracked?
181
2009-02-02 23:41:54
<p>I have an unusual idea to use git as a backup system. So let's say I have a directory ./backup/myfiles and I want to back that up using git. To keep things clean I don't want to have a .git directory in the myfiles folder, so I thought I could create ./backup/git_repos/myfiles. From looking at the git docs, I've tri...
65,147
161,922
2022-09-05 09:17:21
505,517
114
2009-02-02 23:58:03
43,582
2016-02-24 04:15:13
https://stackoverflow.com/q/505467
https://stackoverflow.com/a/505517
<pre><code>git --git-dir=../repo --work-tree=. add foo </code></pre> <p>This will do what you want but will obviously suck when you have to specify it with every git command you ever use.</p> <p>You can export <code>GIT_WORK_TREE=.</code> and <code>GIT_DIR=../backup</code> and Git will pick them up on each command. T...
<pre><code>git --git-dir=../repo --work-tree=. add foo </code></pre> <p>This will do what you want but will obviously suck when you have to specify it with every git command you ever use.</p> <p>You can export <code>GIT_WORK_TREE=.</code> and <code>GIT_DIR=../backup</code> and Git will pick them up on each command. T...
119
git
<h1>Can I store the .git folder outside the files I want tracked?</h1> <p>I have an unusual idea to use git as a backup system. So let's say I have a directory ./backup/myfiles and I want to back that up using git. To keep things clean I don't want to have a .git directory in the myfiles folder, so I thought I could cr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,773
git
# Can I store the .git folder outside the files I want tracked? I have an unusual idea to use git as a backup system. So let's say I have a directory ./backup/myfiles and I want to back that up using git. To keep things clean I don't want to have a .git directory in the myfiles folder, so I thought I could create ./ba...
``` git --git-dir=../repo --work-tree=. add foo ``` This will do what you want but will obviously suck when you have to specify it with every git command you ever use. You can export `GIT_WORK_TREE=.` and `GIT_DIR=../backup` and Git will pick them up on each command. That will only comfortably allow you to work in a ...
1398329
Take all my changes on the current branch and move them to a new branch in Git
115
2009-09-09 08:31:45
<p>I started work on what I thought would be a minor bug fix on my master branch. However, it has spiraled out of control to the point where I wish I had created a separate branch to do the development in the first place.</p> <p>So right now what I'd like to do is:</p> <ol> <li>Create a new branch called (say) "edge"...
37,855
25,068
2013-03-20 06:15:16
1,398,379
114
2009-09-09 08:42:44
12,274
2009-09-09 08:42:44
https://stackoverflow.com/q/1398329
https://stackoverflow.com/a/1398379
<p>If you haven't been committing anything yet, you're already in the right position.</p> <ol> <li>Create a new branch: <code>git checkout -b edge</code> </li> <li>Your files haven't changed. Just <code>git add</code> what needs to and commit as usual.</li> <li>When you're done committing on <code>edge</code>, switch...
<p>If you haven't been committing anything yet, you're already in the right position.</p> <ol> <li>Create a new branch: <code>git checkout -b edge</code> </li> <li>Your files haven't changed. Just <code>git add</code> what needs to and commit as usual.</li> <li>When you're done committing on <code>edge</code>, switch...
119, 1879
branch, git
<h1>Take all my changes on the current branch and move them to a new branch in Git</h1> <p>I started work on what I thought would be a minor bug fix on my master branch. However, it has spiraled out of control to the point where I wish I had created a separate branch to do the development in the first place.</p> <p>So...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,774
git
# Take all my changes on the current branch and move them to a new branch in Git I started work on what I thought would be a minor bug fix on my master branch. However, it has spiraled out of control to the point where I wish I had created a separate branch to do the development in the first place. So right now what ...
If you haven't been committing anything yet, you're already in the right position. 1. Create a new branch: `git checkout -b edge` 2. Your files haven't changed. Just `git add` what needs to and commit as usual. 3. When you're done committing on `edge`, switch back to `master` with `git checkout` and `git merge edge`.
28536980
GIT: change commit date to author date
103
2015-02-16 08:07:34
<p>Is it possible to change the commit date from my commit to the author date?</p> <p>I adapted some commits and now the dates are all the same. I want to set it back to the old dates (or the author dates). Is this possible?</p> <p>I am using Sourcetree so I have the git command line but I am not a pro at that. My ex...
36,799
1,423,434
2022-11-04 10:42:08
28,537,098
114
2015-02-16 08:16:39
1,256,452
2017-08-19 15:56:47
https://stackoverflow.com/q/28536980
https://stackoverflow.com/a/28537098
<p>Since git 1.6.3 <code>git rebase</code> has <code>--committer-date-is-author-date</code> for this purpose.</p> <pre><code>git rebase --committer-date-is-author-date </code></pre> <p><em>Original answer:</em><br> There's no easy way to set the <em>committer</em> dates (edit: but see "edit 2" below). The <em>author...
<p>Since git 1.6.3 <code>git rebase</code> has <code>--committer-date-is-author-date</code> for this purpose.</p> <pre><code>git rebase --committer-date-is-author-date </code></pre> <p><em>Original answer:</em><br> There's no easy way to set the <em>committer</em> dates (edit: but see "edit 2" below). The <em>author...
119, 5002, 8337, 90056
atlassian-sourcetree, bitbucket, date, git
<h1>GIT: change commit date to author date</h1> <p>Is it possible to change the commit date from my commit to the author date?</p> <p>I adapted some commits and now the dates are all the same. I want to set it back to the old dates (or the author dates). Is this possible?</p> <p>I am using Sourcetree so I have the gi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,775
git
# GIT: change commit date to author date Is it possible to change the commit date from my commit to the author date? I adapted some commits and now the dates are all the same. I want to set it back to the old dates (or the author dates). Is this possible? I am using Sourcetree so I have the git command line but I am...
Since git 1.6.3 `git rebase` has `--committer-date-is-author-date` for this purpose. ``` git rebase --committer-date-is-author-date ``` *Original answer:* There's no easy way to set the *committer* dates (edit: but see "edit 2" below). The *author* dates are easy to adjust (at commit time) since `--date` will let y...
30052104
How to avoid merge commits from Git pull when pushing to remote
87
2015-05-05 11:47:04
<p>I have a repository and some local changes to commit. Before committing, I pulled the changes onto my local using Egit in Eclipse.</p> <p>It creates a merge commit and I submit my commit over it.</p> <p>Now when I am trying to push to origin, it is showing that it will push my commit as well as merge commit. But i...
89,172
1,036,999
2021-11-12 16:15:21
30,054,231
114
2015-05-05 13:22:34
948,169
2015-05-05 13:22:34
https://stackoverflow.com/q/30052104
https://stackoverflow.com/a/30054231
<p>Use rebase option whenever you pull from remote repository. Please follow the below steps,</p> <ol> <li>Commit your changes - It will create a new commit in your local.</li> <li>Now do <code>git pull --rebase &lt;remote-name&gt; &lt;branch-name&gt;</code>.</li> <li>Basically the rebase take out your commits that yo...
<p>Use rebase option whenever you pull from remote repository. Please follow the below steps,</p> <ol> <li>Commit your changes - It will create a new commit in your local.</li> <li>Now do <code>git pull --rebase &lt;remote-name&gt; &lt;branch-name&gt;</code>.</li> <li>Basically the rebase take out your commits that yo...
119, 717, 4860
git, merge, pull
<h1>How to avoid merge commits from Git pull when pushing to remote</h1> <p>I have a repository and some local changes to commit. Before committing, I pulled the changes onto my local using Egit in Eclipse.</p> <p>It creates a merge commit and I submit my commit over it.</p> <p>Now when I am trying to push to origin,...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,777
git
# How to avoid merge commits from Git pull when pushing to remote I have a repository and some local changes to commit. Before committing, I pulled the changes onto my local using Egit in Eclipse. It creates a merge commit and I submit my commit over it. Now when I am trying to push to origin, it is showing that it ...
Use rebase option whenever you pull from remote repository. Please follow the below steps, 1. Commit your changes - It will create a new commit in your local. 2. Now do `git pull --rebase <remote-name> <branch-name>`. 3. Basically the rebase take out your commits that you committed on the current branch HEAD as a patc...
16538372
Git proxy bypass
82
2013-05-14 08:28:21
<p>Git works in a proxied environment by setting the http.proxy configuration parameter. </p> <p>For certain addresses I need to bypass the proxy. Is there a no-proxy/bypass-proxy configuration parameter?</p>
154,596
281,121
2024-05-07 04:09:41
16,612,442
114
2013-05-17 15:10:45
1,581,440
2013-05-17 15:10:45
https://stackoverflow.com/q/16538372
https://stackoverflow.com/a/16612442
<p>The proxy can be overridden on a per-remote basis - see <a href="http://git-scm.com/docs/git-config">http://git-scm.com/docs/git-config</a> (look for the "http.proxy" and "remote.&lt;name&gt;.proxy" settings). Assuming you have the remote called "origin" then the command you could use to bypass proxy for this remot...
<p>The proxy can be overridden on a per-remote basis - see <a href="http://git-scm.com/docs/git-config">http://git-scm.com/docs/git-config</a> (look for the "http.proxy" and "remote.&lt;name&gt;.proxy" settings). Assuming you have the remote called "origin" then the command you could use to bypass proxy for this remot...
119, 760, 5210
git, http, proxy
<h1>Git proxy bypass</h1> <p>Git works in a proxied environment by setting the http.proxy configuration parameter. </p> <p>For certain addresses I need to bypass the proxy. Is there a no-proxy/bypass-proxy configuration parameter?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,779
git
# Git proxy bypass Git works in a proxied environment by setting the http.proxy configuration parameter. For certain addresses I need to bypass the proxy. Is there a no-proxy/bypass-proxy configuration parameter?
The proxy can be overridden on a per-remote basis - see <http://git-scm.com/docs/git-config> (look for the "http.proxy" and "remote.<name>.proxy" settings). Assuming you have the remote called "origin" then the command you could use to bypass proxy for this remote is: ``` git config --add remote.origin.proxy "" ```
5270917
Why doesn't my global .gitignore file ignore?
53
2011-03-11 09:05:23
<pre><code>$ cat ~/.gitconfig [core] editor = vim excludefiles = /home/augustin/.gitignore $ cat ~/.gitignore toto $ mkdir git_test $ cd git_test/ $ git init $ touch toto $ git status # On branch master # # Initial commit # # Untracked files: # (use "git add &lt;file&gt;..." to include in what will b...
24,261
401,523
2018-09-10 19:53:21
5,271,411
114
2011-03-11 09:55:52
581,351
2011-03-11 09:55:52
https://stackoverflow.com/q/5270917
https://stackoverflow.com/a/5271411
<p><code>git config --global core.excludesfile ~/.gitignore</code></p>
<p><code>git config --global core.excludesfile ~/.gitignore</code></p>
25056
gitignore
<h1>Why doesn't my global .gitignore file ignore?</h1> <pre><code>$ cat ~/.gitconfig [core] editor = vim excludefiles = /home/augustin/.gitignore $ cat ~/.gitignore toto $ mkdir git_test $ cd git_test/ $ git init $ touch toto $ git status # On branch master # # Initial commit # # Untracked files: # (...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,780
git
# Why doesn't my global .gitignore file ignore? ``` $ cat ~/.gitconfig [core] editor = vim excludefiles = /home/augustin/.gitignore $ cat ~/.gitignore toto $ mkdir git_test $ cd git_test/ $ git init $ touch toto $ git status # On branch master # # Initial commit # # Untracked files: # (use "git add ...
`git config --global core.excludesfile ~/.gitignore`
14961255
What is `git merge` doing?
140
2013-02-19 15:35:13
<p>I want to know an exact algorithm (or near that) behind <code>git merge</code>. The answers at least to these sub-questions will be helpful:</p> <ul> <li>How does Git detect the context of a particular non-conflicting change?</li> <li>How does Git find out that there is a conflict in these exact lines?</li> <li>Whic...
65,176
377,393
2025-02-27 17:09:45
14,962,580
113
2013-02-19 16:33:24
1,253,222
2025-02-27 17:09:45
https://stackoverflow.com/q/14961255
https://stackoverflow.com/a/14962580
<p>You might be best off looking for a description of a 3-way merge algorithm. A high-level description would go something like this:</p> <ol> <li>Find a suitable merge base <code>B</code> - a version of the file that is an ancestor of both of the new versions (<code>X</code> and <code>Y</code>), and usually the most r...
<p>You might be best off looking for a description of a 3-way merge algorithm. A high-level description would go something like this:</p> <ol> <li>Find a suitable merge base <code>B</code> - a version of the file that is an ancestor of both of the new versions (<code>X</code> and <code>Y</code>), and usually the most r...
119, 28897, 62599
git, git-merge, merge-conflict-resolution
<h1>What is `git merge` doing?</h1> <p>I want to know an exact algorithm (or near that) behind <code>git merge</code>. The answers at least to these sub-questions will be helpful:</p> <ul> <li>How does Git detect the context of a particular non-conflicting change?</li> <li>How does Git find out that there is a conflict...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,781
git
# What is `git merge` doing? I want to know an exact algorithm (or near that) behind `git merge`. The answers at least to these sub-questions will be helpful: - How does Git detect the context of a particular non-conflicting change? - How does Git find out that there is a conflict in these exact lines? - Which things...
You might be best off looking for a description of a 3-way merge algorithm. A high-level description would go something like this: 1. Find a suitable merge base `B` - a version of the file that is an ancestor of both of the new versions (`X` and `Y`), and usually the most recent such base (although there are cases whe...
35790561
Working while waiting for pending PR
117
2016-03-04 07:40:23
<p>I'm working on a project and I submitted my first pull request and while I'm waiting I want to continue on working on my project building up from what I worked on the merge that's still pending on. Right now I have :</p> <pre><code>*master user_story_1 </code></pre> <p><code>user_story_1</code> has an open pull re...
28,174
5,772,567
2019-02-25 17:59:12
35,793,095
113
2016-03-04 10:03:13
1,288,760
2016-03-04 10:03:13
https://stackoverflow.com/q/35790561
https://stackoverflow.com/a/35793095
<p>I'm assuming you want to start the new <code>user_story_2</code> branch on top of the work you've done in <code>user_story_1</code>. Here's the workflow I use in this sort of scenario:</p> <ol> <li><p>Open Pull Request for <code>user_story_1</code>:</p> <pre><code> * (user_story_1) * / * (master) * * </code></...
<p>I'm assuming you want to start the new <code>user_story_2</code> branch on top of the work you've done in <code>user_story_1</code>. Here's the workflow I use in this sort of scenario:</p> <ol> <li><p>Open Pull Request for <code>user_story_1</code>:</p> <pre><code> * (user_story_1) * / * (master) * * </code></...
119, 64512
git, pull-request
<h1>Working while waiting for pending PR</h1> <p>I'm working on a project and I submitted my first pull request and while I'm waiting I want to continue on working on my project building up from what I worked on the merge that's still pending on. Right now I have :</p> <pre><code>*master user_story_1 </code></pre> <p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,782
git
# Working while waiting for pending PR I'm working on a project and I submitted my first pull request and while I'm waiting I want to continue on working on my project building up from what I worked on the merge that's still pending on. Right now I have : ``` *master user_story_1 ``` `user_story_1` has an open pull ...
I'm assuming you want to start the new `user_story_2` branch on top of the work you've done in `user_story_1`. Here's the workflow I use in this sort of scenario: 1. Open Pull Request for `user_story_1`: ``` * (user_story_1) * / * (master) * * ``` 2. Create new branch `user_story_2` based...
17756753
Where do the settings in my Git configuration come from?
111
2013-07-19 22:57:22
<p>I've noticed that I have two listings for <code>core.autocrlf</code> when I run <code>git config -l</code></p> <pre class="lang-none prettyprint-override"><code>git config -l </code></pre> <p>Output:</p> <pre class="lang-none prettyprint-override"><code>core.symlinks=false core.autocrlf=false color.diff=auto color.s...
92,018
1,843
2025-05-04 14:46:43
17,756,808
113
2013-07-19 23:03:52
null
2019-09-08 16:25:07
https://stackoverflow.com/q/17756753
https://stackoverflow.com/a/17756808
<p>Git checks four places for a configuration file:</p> <ol> <li>Your machine's system <code>.gitconfig</code> file.</li> <li>Your user <code>.gitconfig</code> file located at <code>~/.gitconfig</code>.</li> <li>A second user-specific configuration file located at <code>$XDG_CONFIG_HOME/git/config</code> or <code>$HOM...
<p>Git checks four places for a configuration file:</p> <ol> <li>Your machine's system <code>.gitconfig</code> file.</li> <li>Your user <code>.gitconfig</code> file located at <code>~/.gitconfig</code>.</li> <li>A second user-specific configuration file located at <code>$XDG_CONFIG_HOME/git/config</code> or <code>$HOM...
119, 21628, 32868
git, git-config, msysgit
<h1>Where do the settings in my Git configuration come from?</h1> <p>I've noticed that I have two listings for <code>core.autocrlf</code> when I run <code>git config -l</code></p> <pre class="lang-none prettyprint-override"><code>git config -l </code></pre> <p>Output:</p> <pre class="lang-none prettyprint-override"><co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,783
git
# Where do the settings in my Git configuration come from? I've noticed that I have two listings for `core.autocrlf` when I run `git config -l` ``` git config -l ``` Output: ``` core.symlinks=false core.autocrlf=false color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g h...
Git checks four places for a configuration file: 1. Your machine's system `.gitconfig` file. 2. Your user `.gitconfig` file located at `~/.gitconfig`. 3. A second user-specific configuration file located at `$XDG_CONFIG_HOME/git/config` or `$HOME/.config/git/config`. 4. The local repository's configuration file `.git/...
24121709
Git error: previous rebase directory .git/rebase-apply still exists but mbox given
100
2014-06-09 13:50:17
<p>I'm trying to apply a patch with Git, but I'm getting this error:</p> <pre><code>$ git am --signoff &lt; my.patch previous rebase directory /home/sashoalm/Desktop/wine-git/.git/rebase-apply still exists but mbox given. </code></pre> <p>What does this error mean and how do I fix it?</p>
74,716
492,336
2025-05-22 08:25:02
31,828,239
113
2015-08-05 09:15:49
895,245
2015-08-28 15:30:39
https://stackoverflow.com/q/24121709
https://stackoverflow.com/a/31828239
<pre><code>git am --abort </code></pre> <p>worked for me, but <code>git rebase --abort</code> did not.</p> <p>What happened: I tried to apply a patch but it had been corrupted (likely by <a href="https://productforums.google.com/forum/#!topic/gmail/HasB4x0gdz8;context-place=forum/gmail">Gmail copy pasting in body</a>...
<pre><code>git am --abort </code></pre> <p>worked for me, but <code>git rebase --abort</code> did not.</p> <p>What happened: I tried to apply a patch but it had been corrupted (likely by <a href="https://productforums.google.com/forum/#!topic/gmail/HasB4x0gdz8;context-place=forum/gmail">Gmail copy pasting in body</a>...
119, 2132
git, patch
<h1>Git error: previous rebase directory .git/rebase-apply still exists but mbox given</h1> <p>I'm trying to apply a patch with Git, but I'm getting this error:</p> <pre><code>$ git am --signoff &lt; my.patch previous rebase directory /home/sashoalm/Desktop/wine-git/.git/rebase-apply still exists but mbox given. </code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,784
git
# Git error: previous rebase directory .git/rebase-apply still exists but mbox given I'm trying to apply a patch with Git, but I'm getting this error: ``` $ git am --signoff < my.patch previous rebase directory /home/sashoalm/Desktop/wine-git/.git/rebase-apply still exists but mbox given. ``` What does this error me...
``` git am --abort ``` worked for me, but `git rebase --abort` did not. What happened: I tried to apply a patch but it had been corrupted (likely by [Gmail copy pasting in body](https://productforums.google.com/forum/#!topic/gmail/HasB4x0gdz8;context-place=forum/gmail)): ``` git am bad.patch ``` And Git said: ``` ...
39651
git-stash vs. git-branch
97
2008-09-02 14:22:44
<p>In a <a href="https://stackoverflow.com/questions/21848/switch-branch-names-in-git">previous Git question</a>, Daniel Benamy was talking about a workflow in Git:</p> <blockquote> <p>I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and t...
38,329
4,161
2020-11-24 10:12:38
39,862
113
2008-09-02 15:54:59
4,272
2008-09-02 15:54:59
https://stackoverflow.com/q/39651
https://stackoverflow.com/a/39862
<p>'stash' takes the uncommitted, "<em>dirty</em>" stuff on your working copy, and stashes it away, leaving you with a clean working copy.</p> <p>It doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do:</p> <pre><code>git stash branch &lt;branchname&gt; ...
<p>'stash' takes the uncommitted, "<em>dirty</em>" stuff on your working copy, and stashes it away, leaving you with a clean working copy.</p> <p>It doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do:</p> <pre><code>git stash branch &lt;branchname&gt; ...
119
git
<h1>git-stash vs. git-branch</h1> <p>In a <a href="https://stackoverflow.com/questions/21848/switch-branch-names-in-git">previous Git question</a>, Daniel Benamy was talking about a workflow in Git:</p> <blockquote> <p>I was working on master and committed some stuff and then decided I wanted to put that work on hol...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,785
git
# git-stash vs. git-branch In a [previous Git question](https://stackoverflow.com/questions/21848/switch-branch-names-in-git), Daniel Benamy was talking about a workflow in Git: > I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then br...
'stash' takes the uncommitted, "*dirty*" stuff on your working copy, and stashes it away, leaving you with a clean working copy. It doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do: ``` git stash branch <branchname> [<stash>] ``` to apply the stash ...
45491328
Git add a worktree from existing remote branch
91
2017-08-03 17:50:43
<p>In my remote repository there are 3 branches (master and 2 long running branches):</p> <pre><code>master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) </code></pre> <p>At my office PC, I add 2 <code>worktree</code...
127,434
1,014,320
2025-02-26 18:38:01
45,491,767
113
2017-08-03 18:17:31
1,256,452
2017-08-03 18:17:31
https://stackoverflow.com/q/45491328
https://stackoverflow.com/a/45491767
<p>TL;DR: you probably wanted <code>git worktree add ../north north</code></p> <p>First, a reminder (or information for others coming across this question): <code>git worktree add</code> wants to create a new work-tree <em>and</em>, at the same time, make sure that this new work-tree is using a <em>different branch na...
<p>TL;DR: you probably wanted <code>git worktree add ../north north</code></p> <p>First, a reminder (or information for others coming across this question): <code>git worktree add</code> wants to create a new work-tree <em>and</em>, at the same time, make sure that this new work-tree is using a <em>different branch na...
119, 41346, 76220, 117020
git, git-branch, git-remote, git-worktree
<h1>Git add a worktree from existing remote branch</h1> <p>In my remote repository there are 3 branches (master and 2 long running branches):</p> <pre><code>master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) </code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,786
git
# Git add a worktree from existing remote branch In my remote repository there are 3 branches (master and 2 long running branches): ``` master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) ``` At my office PC, I add...
TL;DR: you probably wanted `git worktree add ../north north` First, a reminder (or information for others coming across this question): `git worktree add` wants to create a new work-tree *and*, at the same time, make sure that this new work-tree is using a *different branch name* from every other work-tree. This is be...
5113425
How to make Git log show all of today's commits?
91
2011-02-25 03:54:21
<p>I want to be able to see all of the commits I made today using <code>git log</code>. I came up with <code>git log --after="yesterday"</code><br> However, that seems a little awkward to me, is there a simpler command to achieve the same effect?</p>
22,552
427,494
2019-05-14 16:28:47
5,178,739
113
2011-03-03 09:20:17
573
2013-08-13 06:53:53
https://stackoverflow.com/q/5113425
https://stackoverflow.com/a/5178739
<p>Edit: Since this is the accepted answer I can't delete it, so I'm posting here @Simon's answer:</p> <pre><code>git log --since="6am" </code></pre> <p>And of course you can adjust the time to whatever is "morning" enough for you :)</p>
<p>Edit: Since this is the accepted answer I can't delete it, so I'm posting here @Simon's answer:</p> <pre><code>git log --since="6am" </code></pre> <p>And of course you can adjust the time to whatever is "morning" enough for you :)</p>
119, 47913
git, git-log
<h1>How to make Git log show all of today's commits?</h1> <p>I want to be able to see all of the commits I made today using <code>git log</code>. I came up with <code>git log --after="yesterday"</code><br> However, that seems a little awkward to me, is there a simpler command to achieve the same effect?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,787
git
# How to make Git log show all of today's commits? I want to be able to see all of the commits I made today using `git log`. I came up with `git log --after="yesterday"` However, that seems a little awkward to me, is there a simpler command to achieve the same effect?
Edit: Since this is the accepted answer I can't delete it, so I'm posting here @Simon's answer: ``` git log --since="6am" ``` And of course you can adjust the time to whatever is "morning" enough for you :)
9658110
git diff on date?
86
2012-03-11 19:22:09
<p>I'm accustomed to running a git comparison that will allow comparison with local git revs like:</p> <pre><code>git diff HEAD HEAD~110 -- some/file/path/file.ext </code></pre> <p>Is it possible to use the date instead? And if so, how? I would like to be able insert in place of the "110" in the above example, a date...
41,091
320,681
2025-01-14 08:54:18
9,658,178
113
2012-03-11 19:31:37
383,402
2013-06-19 07:38:44
https://stackoverflow.com/q/9658110
https://stackoverflow.com/a/9658178
<pre><code>git diff HEAD 'HEAD@{3 weeks ago}' -- some/file/path/file.ext </code></pre> <p>This is not, strictly speaking, the revision made three weeks ago. Instead, it's the position <code>HEAD</code> was at three weeks prior to the present. But it's probably close enough for your purposes - it will be very accurate ...
<pre><code>git diff HEAD 'HEAD@{3 weeks ago}' -- some/file/path/file.ext </code></pre> <p>This is not, strictly speaking, the revision made three weeks ago. Instead, it's the position <code>HEAD</code> was at three weeks prior to the present. But it's probably close enough for your purposes - it will be very accurate ...
119
git
<h1>git diff on date?</h1> <p>I'm accustomed to running a git comparison that will allow comparison with local git revs like:</p> <pre><code>git diff HEAD HEAD~110 -- some/file/path/file.ext </code></pre> <p>Is it possible to use the date instead? And if so, how? I would like to be able insert in place of the "110" i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,789
git
# git diff on date? I'm accustomed to running a git comparison that will allow comparison with local git revs like: ``` git diff HEAD HEAD~110 -- some/file/path/file.ext ``` Is it possible to use the date instead? And if so, how? I would like to be able insert in place of the "110" in the above example, a date such ...
``` git diff HEAD 'HEAD@{3 weeks ago}' -- some/file/path/file.ext ``` This is not, strictly speaking, the revision made three weeks ago. Instead, it's the position `HEAD` was at three weeks prior to the present. But it's probably close enough for your purposes - it will be very accurate if the current branch's `HEAD` ...
28555062
Can I use "git checkout --" on two files?
59
2015-02-17 05:10:57
<p>Is it possible to use git checkout -- on multiple files in order to discard the changes? </p> <p>If so how would I specify multiple files?</p>
49,355
4,290,309
2020-07-23 18:00:36
28,555,154
113
2015-02-17 05:18:27
1,188,035
2016-11-22 16:59:12
https://stackoverflow.com/q/28555062
https://stackoverflow.com/a/28555154
<p>Run the command multiple times</p> <pre><code>git checkout -- path/to/file/one git checkout -- path/to/file/two </code></pre> <p>Or specify the multiple files in the same line:</p> <pre><code>git checkout -- path/to/file/one path/to/file/two </code></pre> <p>You can also specify entire folders which will recurse...
<p>Run the command multiple times</p> <pre><code>git checkout -- path/to/file/one git checkout -- path/to/file/two </code></pre> <p>Or specify the multiple files in the same line:</p> <pre><code>git checkout -- path/to/file/one path/to/file/two </code></pre> <p>You can also specify entire folders which will recurse...
119, 37230
git, git-checkout
<h1>Can I use "git checkout --" on two files?</h1> <p>Is it possible to use git checkout -- on multiple files in order to discard the changes? </p> <p>If so how would I specify multiple files?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,790
git
# Can I use "git checkout --" on two files? Is it possible to use git checkout -- on multiple files in order to discard the changes? If so how would I specify multiple files?
Run the command multiple times ``` git checkout -- path/to/file/one git checkout -- path/to/file/two ``` Or specify the multiple files in the same line: ``` git checkout -- path/to/file/one path/to/file/two ``` You can also specify entire folders which will recurse to all files below them. ``` git checkout -- path...
60579900
How to fix "invalid version" and "could not read Username" in "go get" of a private repository?
40
2020-03-07 16:45:29
<p>I want to use private repositories that are hosted at GitHub in another GoLang-project.</p> <p>What I did:</p> <ol> <li>I created a private access token at my GitHub account settings</li> <li><p>did then:</p> <p>git config --global url."<a href="https://xxxxxx:ACCESS_TOKEN@github.com" rel="noreferrer">https://xxx...
45,106
4,769,503
2023-05-25 15:43:24
60,580,085
113
2020-03-07 17:05:08
1,397,160
2023-05-25 15:43:24
https://stackoverflow.com/q/60579900
https://stackoverflow.com/a/60580085
<p>You did almost everything right, and only forgot one important step.</p> <p>You need to tell Go to not check checksums, as you are operating on your own private repositories:</p> <pre class="lang-bash prettyprint-override"><code> go env -w GOPRIVATE=github.com/mycompany/* </code></pre> <p>Replace <code>mycompany<...
<p>You did almost everything right, and only forgot one important step.</p> <p>You need to tell Go to not check checksums, as you are operating on your own private repositories:</p> <pre class="lang-bash prettyprint-override"><code> go env -w GOPRIVATE=github.com/mycompany/* </code></pre> <p>Replace <code>mycompany<...
119, 15627
git, go
<h1>How to fix "invalid version" and "could not read Username" in "go get" of a private repository?</h1> <p>I want to use private repositories that are hosted at GitHub in another GoLang-project.</p> <p>What I did:</p> <ol> <li>I created a private access token at my GitHub account settings</li> <li><p>did then:</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,792
git
# How to fix "invalid version" and "could not read Username" in "go get" of a private repository? I want to use private repositories that are hosted at GitHub in another GoLang-project. What I did: 1. I created a private access token at my GitHub account settings 2. did then: git config --global url."<https://xx...
You did almost everything right, and only forgot one important step. You need to tell Go to not check checksums, as you are operating on your own private repositories: ``` go env -w GOPRIVATE=github.com/mycompany/* ``` Replace `mycompany` with your username on github or the name of your company and `go get` will...
3382679
How do I update my bare repo?
168
2010-08-01 16:02:33
<p>I created a bare repo to publish my repository, but I can't figure out how to update the bare repo with the current state of the main repository.</p>
118,770
211,659
2025-01-28 17:59:40
3,382,703
112
2010-08-01 16:07:40
14,637
2025-01-10 23:25:28
https://stackoverflow.com/q/3382679
https://stackoverflow.com/a/3382703
<p>If you want to duplicate all the objects from the main repo, do this inside the main repo:</p> <pre><code>git push --all &lt;url-of-bare-repo&gt; </code></pre> <p>Alternatively, do a fetch inside the bare repo:</p> <pre><code>git fetch &lt;url-of-main-repo&gt; </code></pre> <p>You cannot do a pull, because a pull wa...
<p>If you want to duplicate all the objects from the main repo, do this inside the main repo:</p> <pre><code>git push --all &lt;url-of-bare-repo&gt; </code></pre> <p>Alternatively, do a fetch inside the bare repo:</p> <pre><code>git fetch &lt;url-of-main-repo&gt; </code></pre> <p>You cannot do a pull, because a pull wa...
119
git
<h1>How do I update my bare repo?</h1> <p>I created a bare repo to publish my repository, but I can't figure out how to update the bare repo with the current state of the main repository.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,795
git
# How do I update my bare repo? I created a bare repo to publish my repository, but I can't figure out how to update the bare repo with the current state of the main repository.
If you want to duplicate all the objects from the main repo, do this inside the main repo: ``` git push --all <url-of-bare-repo> ``` Alternatively, do a fetch inside the bare repo: ``` git fetch <url-of-main-repo> ``` You cannot do a pull, because a pull wants to merge with `HEAD`, which a bare repo does not have. ...
12222186
Are git hooks pushed to the remote when I 'git push'?
127
2012-08-31 20:38:36
<p>If I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run "git push" are the hooks pushed to the remote? Then, when the other developers run "git pull" from the same origin will they get my new hooks? </p>
54,747
66,289
2022-11-07 14:15:39
12,222,225
112
2012-08-31 20:42:13
582
2012-08-31 20:42:13
https://stackoverflow.com/q/12222186
https://stackoverflow.com/a/12222225
<p>No. Hooks are per-repository and are never pushed. Similarly, the repo config isn't pushed either, nor is anything in <code>.git/info</code>, or a number of other things.</p> <p>Pushing and pulling only exchanges branches/tags and commit objects (and anything reachable from a commit, e.g. trees, blobs).</p>
<p>No. Hooks are per-repository and are never pushed. Similarly, the repo config isn't pushed either, nor is anything in <code>.git/info</code>, or a number of other things.</p> <p>Pushing and pulling only exchanges branches/tags and commit objects (and anything reachable from a commit, e.g. trees, blobs).</p>
119, 43087
git, githooks
<h1>Are git hooks pushed to the remote when I 'git push'?</h1> <p>If I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run "git push" are the hooks pushed to the remote? Then, when the other developers run "git pull" from the same origin will they get my new hooks? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,796
git
# Are git hooks pushed to the remote when I 'git push'? If I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run "git push" are the hooks pushed to the remote? Then, when the other developers run "git pull" from the same origin will they get my new hooks?
No. Hooks are per-repository and are never pushed. Similarly, the repo config isn't pushed either, nor is anything in `.git/info`, or a number of other things. Pushing and pulling only exchanges branches/tags and commit objects (and anything reachable from a commit, e.g. trees, blobs).
13756055
Why can't I push this up-to-date Git subtree?
100
2012-12-07 02:27:22
<p>I am using Git subtree with a couple of projects that I am working on, in order to share some base code between them. The base code gets updated often, and the upgrades can happen in anyone of the projects, with all of them getting updated, eventually.</p> <p>I have ran into a problem where git reports that my subt...
28,226
1,086,672
2020-02-21 20:38:46
15,623,469
112
2013-03-25 19:49:57
1,139,784
2013-03-25 19:49:57
https://stackoverflow.com/q/13756055
https://stackoverflow.com/a/15623469
<p>I found the answer on this blog comment <a href="https://coderwall.com/p/ssxp5q">https://coderwall.com/p/ssxp5q</a></p> <blockquote> <p>If you come across the "Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull')" problem when you're pushing (due to ...
<p>I found the answer on this blog comment <a href="https://coderwall.com/p/ssxp5q">https://coderwall.com/p/ssxp5q</a></p> <blockquote> <p>If you come across the "Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull')" problem when you're pushing (due to ...
119, 68200
git, git-subtree
<h1>Why can't I push this up-to-date Git subtree?</h1> <p>I am using Git subtree with a couple of projects that I am working on, in order to share some base code between them. The base code gets updated often, and the upgrades can happen in anyone of the projects, with all of them getting updated, eventually.</p> <p>I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,798
git
# Why can't I push this up-to-date Git subtree? I am using Git subtree with a couple of projects that I am working on, in order to share some base code between them. The base code gets updated often, and the upgrades can happen in anyone of the projects, with all of them getting updated, eventually. I have ran into a...
I found the answer on this blog comment <https://coderwall.com/p/ssxp5q> > If you come across the "Updates were rejected because the tip of your current branch is > behind. Merge the remote changes (e.g. 'git pull')" problem when you're pushing (due to > whatever reason, esp screwing about with git history) then you'l...
10845051
Git: show total file size difference between two commits?
94
2012-06-01 05:48:08
<p>Is it possible to show the total file size difference between two commits? Something like:</p> <pre><code>$ git file-size-diff 7f3219 bad418 # I wish this worked :) -1234 bytes </code></pre> <p>I’ve tried:</p> <pre><code>$ git diff --patch-with-stat </code></pre> <p>And that shows the file size difference for ea...
49,620
96,656
2025-05-19 20:24:32
10,847,242
112
2012-06-01 08:54:13
291,641
2022-11-23 14:59:51
https://stackoverflow.com/q/10845051
https://stackoverflow.com/a/10847242
<p><code>git cat-file -s</code> will output the size in bytes of an object in git. <code>git diff-tree</code> can tell you the differences between one tree and another.</p> <p>Putting this together into a script called <code>git-file-size-diff</code> located somewhere on your PATH will give you the ability to call <cod...
<p><code>git cat-file -s</code> will output the size in bytes of an object in git. <code>git diff-tree</code> can tell you the differences between one tree and another.</p> <p>Putting this together into a script called <code>git-file-size-diff</code> located somewhere on your PATH will give you the ability to call <cod...
119, 8071, 9033
filesize, git, git-diff
<h1>Git: show total file size difference between two commits?</h1> <p>Is it possible to show the total file size difference between two commits? Something like:</p> <pre><code>$ git file-size-diff 7f3219 bad418 # I wish this worked :) -1234 bytes </code></pre> <p>I’ve tried:</p> <pre><code>$ git diff --patch-with-st...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,799
git
# Git: show total file size difference between two commits? Is it possible to show the total file size difference between two commits? Something like: ``` $ git file-size-diff 7f3219 bad418 # I wish this worked :) -1234 bytes ``` I’ve tried: ``` $ git diff --patch-with-stat ``` And that shows the file size differe...
`git cat-file -s` will output the size in bytes of an object in git. `git diff-tree` can tell you the differences between one tree and another. Putting this together into a script called `git-file-size-diff` located somewhere on your PATH will give you the ability to call `git file-size-diff <tree-ish> <tree-ish>`. We...
374316
Round a double to x significant figures
88
2008-12-17 11:52:09
<p>If I have a double (234.004223), etc., I would like to round this to x significant digits in C#.</p> <p>So far I can only find ways to round to x decimal places, but this simply removes the precision if there are any 0s in the number.</p> <p>For example, 0.086 to one decimal place becomes 0.1, but I would like it ...
83,676
47,026
2023-04-14 18:53:16
374,470
112
2008-12-17 13:01:38
36,388
2013-05-03 12:15:45
https://stackoverflow.com/q/374316
https://stackoverflow.com/a/374470
<p>The framework doesn't have a built-in function to round (or truncate, as in your example) to a number of significant digits. One way you can do this, though, is to scale your number so that your first significant digit is right after the decimal point, round (or truncate), then scale back. The following code shoul...
<p>The framework doesn't have a built-in function to round (or truncate, as in your example) to a number of significant digits. One way you can do this, though, is to scale your number so that your first significant digit is right after the decimal point, round (or truncate), then scale back. The following code shoul...
9, 259, 9069, 12414
c#, math, rounding, significant-digits
<h1>Round a double to x significant figures</h1> <p>If I have a double (234.004223), etc., I would like to round this to x significant digits in C#.</p> <p>So far I can only find ways to round to x decimal places, but this simply removes the precision if there are any 0s in the number.</p> <p>For example, 0.086 to on...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,801
git
# Round a double to x significant figures If I have a double (234.004223), etc., I would like to round this to x significant digits in C#. So far I can only find ways to round to x decimal places, but this simply removes the precision if there are any 0s in the number. For example, 0.086 to one decimal place becomes...
The framework doesn't have a built-in function to round (or truncate, as in your example) to a number of significant digits. One way you can do this, though, is to scale your number so that your first significant digit is right after the decimal point, round (or truncate), then scale back. The following code should do ...
4181870
Git on Windows: What do the crlf settings mean?
84
2010-11-15 06:10:40
<p>I don't understand the complexities related to CrLf settings in git: <code>core.autocrlf</code>, <code>core.safecrlf</code></p> <p>I'm developing a cross-platform project in a team and would like both Windows and Linux developers to be able to work together without git marking files as modified just because of line...
25,449
348,545
2018-12-03 12:43:26
4,182,346
112
2010-11-15 07:38:21
119,963
2011-12-14 10:23:21
https://stackoverflow.com/q/4181870
https://stackoverflow.com/a/4182346
<p>The three values for <code>autocrlf</code>:</p> <ul> <li><p><code>true</code> - when content goes into the repository (is committed), its line endings will be converted to LF, and when content comes out of the repository (is checked out), the line endings be converted to CRLF. This is in general meant for clueless ...
<p>The three values for <code>autocrlf</code>:</p> <ul> <li><p><code>true</code> - when content goes into the repository (is committed), its line endings will be converted to LF, and when content comes out of the repository (is checked out), the line endings be converted to CRLF. This is in general meant for clueless ...
58, 64, 119, 3705, 59139
core.autocrlf, git, linux, newline, windows
<h1>Git on Windows: What do the crlf settings mean?</h1> <p>I don't understand the complexities related to CrLf settings in git: <code>core.autocrlf</code>, <code>core.safecrlf</code></p> <p>I'm developing a cross-platform project in a team and would like both Windows and Linux developers to be able to work together w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,802
git
# Git on Windows: What do the crlf settings mean? I don't understand the complexities related to CrLf settings in git: `core.autocrlf`, `core.safecrlf` I'm developing a cross-platform project in a team and would like both Windows and Linux developers to be able to work together without git marking files as modified j...
The three values for `autocrlf`: - `true` - when content goes into the repository (is committed), its line endings will be converted to LF, and when content comes out of the repository (is checked out), the line endings be converted to CRLF. This is in general meant for clueless windows users/editors. Given the assump...
29876342
How to get (only) author name or email in git given SHA1?
79
2015-04-26 10:13:47
<p>I would like to check for author's e-mail and name, surname to verify who's pushing to my repo.</p> <p>Is there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit?</p> <p>This is what I came up with but it's far from ideal solution (the first solution is f...
94,508
675,100
2024-02-07 10:54:10
29,876,744
112
2015-04-26 10:56:54
3,306,465
2018-08-17 23:10:23
https://stackoverflow.com/q/29876342
https://stackoverflow.com/a/29876744
<p>You can use the following command:</p> <pre><code> git log --format='%ae' HASH^! </code></pre> <p>It works with <code>git show</code> as well. You need to include <code>-s</code> to suppress the diff.</p> <pre><code>git show -s --format='%ae' HASH </code></pre>
<p>You can use the following command:</p> <pre><code> git log --format='%ae' HASH^! </code></pre> <p>It works with <code>git show</code> as well. You need to include <code>-s</code> to suppress the diff.</p> <pre><code>git show -s --format='%ae' HASH </code></pre>
119, 3190, 3953, 5597
author, commit, git, sha1
<h1>How to get (only) author name or email in git given SHA1?</h1> <p>I would like to check for author's e-mail and name, surname to verify who's pushing to my repo.</p> <p>Is there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit?</p> <p>This is what I cam...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,803
git
# How to get (only) author name or email in git given SHA1? I would like to check for author's e-mail and name, surname to verify who's pushing to my repo. Is there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit? This is what I came up with but it's far ...
You can use the following command: ``` git log --format='%ae' HASH^! ``` It works with `git show` as well. You need to include `-s` to suppress the diff. ``` git show -s --format='%ae' HASH ```
9933004
How to to disable Git end-of-line (CRLF to LF) across all clones/machines?
66
2012-03-29 20:27:51
<p>As one can glean <a href="https://stackoverflow.com/questions/2332349/best-practices-for-cross-platform-git-config">from</a> <a href="https://stackoverflow.com/questions/2016673/definitive-recommendation-for-git-autocrlf-settings">other</a> <a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windo...
23,120
64,257
2023-01-11 15:36:57
10,017,566
112
2012-04-04 19:00:04
64,257
2023-01-11 15:36:57
https://stackoverflow.com/q/9933004
https://stackoverflow.com/a/10017566
<p>The best way to avoid having to set <code>core.autocrlf</code> separately on each machine seems to be checking a <code>.gitattributes</code> file into the repository containing the single line</p> <pre><code>* -text </code></pre> <p>Or, if you have an older version of Git then</p> <pre><code>* -crlf </code></pre> <p...
<p>The best way to avoid having to set <code>core.autocrlf</code> separately on each machine seems to be checking a <code>.gitattributes</code> file into the repository containing the single line</p> <pre><code>* -text </code></pre> <p>Or, if you have an older version of Git then</p> <pre><code>* -crlf </code></pre> <p...
119, 3705, 56102, 59139
core.autocrlf, git, gitattributes, newline
<h1>How to to disable Git end-of-line (CRLF to LF) across all clones/machines?</h1> <p>As one can glean <a href="https://stackoverflow.com/questions/2332349/best-practices-for-cross-platform-git-config">from</a> <a href="https://stackoverflow.com/questions/2016673/definitive-recommendation-for-git-autocrlf-settings">ot...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,804
git
# How to to disable Git end-of-line (CRLF to LF) across all clones/machines? As one can glean [from](https://stackoverflow.com/questions/2332349/best-practices-for-cross-platform-git-config) [other](https://stackoverflow.com/questions/2016673/definitive-recommendation-for-git-autocrlf-settings) [posts](https://stackov...
The best way to avoid having to set `core.autocrlf` separately on each machine seems to be checking a `.gitattributes` file into the repository containing the single line ``` * -text ``` Or, if you have an older version of Git then ``` * -crlf ``` This tells Git that, for all paths (thus the `*`), end-of-line norma...
8131322
Enabling Git syntax highlighting for Mac's terminal
65
2011-11-15 04:00:22
<p>I miss the Git syntax highlighting I had on Windows for every "git .*" command like green staged filenames, some bolding, etc.</p> <p>How do I enable Git syntax highlighting for Mac's terminal?</p>
29,171
133,900
2015-03-23 15:43:42
8,131,356
112
2011-11-15 04:06:21
77,567
2011-11-15 06:43:58
https://stackoverflow.com/q/8131322
https://stackoverflow.com/a/8131356
<pre><code>git config --global color.ui auto </code></pre>
<pre><code>git config --global color.ui auto </code></pre>
119, 391, 4717
git, syntax-highlighting, terminal
<h1>Enabling Git syntax highlighting for Mac's terminal</h1> <p>I miss the Git syntax highlighting I had on Windows for every "git .*" command like green staged filenames, some bolding, etc.</p> <p>How do I enable Git syntax highlighting for Mac's terminal?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,805
git
# Enabling Git syntax highlighting for Mac's terminal I miss the Git syntax highlighting I had on Windows for every "git .*" command like green staged filenames, some bolding, etc. How do I enable Git syntax highlighting for Mac's terminal?
``` git config --global color.ui auto ```
30862558
Checkout branch on different remote
62
2015-06-16 08:36:09
<p>I have a repo that has another remote <code>upstream</code> besides <code>origin</code>. I can do <code>git checkout origin/master</code>, but when I run <code>git checkout upstream/master</code>, I get:</p> <pre><code>error: pathspec 'upstream/master' did not match any file(s) known to git. </code></pre> <p>This ...
49,285
547,578
2021-10-21 05:02:44
30,862,668
112
2015-06-16 08:41:39
1,860,929
2015-06-18 08:15:55
https://stackoverflow.com/q/30862558
https://stackoverflow.com/a/30862668
<p>Just fetch the refs from the remote (this will fetch all branch, commit, refs etc for the upstream repo)</p> <pre><code>git fetch upstream </code></pre> <p>After this, checkout the needed branch (this creates a local copy of the branch)</p> <pre><code>git checkout -b &lt;branchname&gt; --track upstream/&lt;branch...
<p>Just fetch the refs from the remote (this will fetch all branch, commit, refs etc for the upstream repo)</p> <pre><code>git fetch upstream </code></pre> <p>After this, checkout the needed branch (this creates a local copy of the branch)</p> <pre><code>git checkout -b &lt;branchname&gt; --track upstream/&lt;branch...
119, 1879
branch, git
<h1>Checkout branch on different remote</h1> <p>I have a repo that has another remote <code>upstream</code> besides <code>origin</code>. I can do <code>git checkout origin/master</code>, but when I run <code>git checkout upstream/master</code>, I get:</p> <pre><code>error: pathspec 'upstream/master' did not match any ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,807
git
# Checkout branch on different remote I have a repo that has another remote `upstream` besides `origin`. I can do `git checkout origin/master`, but when I run `git checkout upstream/master`, I get: ``` error: pathspec 'upstream/master' did not match any file(s) known to git. ``` This does not work either: ``` $ git...
Just fetch the refs from the remote (this will fetch all branch, commit, refs etc for the upstream repo) ``` git fetch upstream ``` After this, checkout the needed branch (this creates a local copy of the branch) ``` git checkout -b <branchname> --track upstream/<branchname> ``` Now if you want to pull the changes ...
44600721
Can't make git stop tracking package-lock.json
49
2017-06-17 04:21:45
<p>With npm v5 here is now <code>package-lock.json</code> file being created after <code>npm install</code></p> <p>It is recommended to commit this file, but I have issue that this file is different for some reason between my dev machine and my server. Even if I push that file to repo, after <code>npm install</code> o...
55,775
811,400
2024-04-25 15:04:08
44,600,762
112
2017-06-17 04:27:52
3,857
2017-06-17 04:27:52
https://stackoverflow.com/q/44600721
https://stackoverflow.com/a/44600762
<p>You need to remove it from your repo (<code>git rm package-lock.json</code>) in order for git to stop tracking it.</p> <p>.gitignore only works for untracked files. If you have a tracked file that is also in your .gitignore, the fact that the file is tracked overrides the fact that it is also in .gitignore.</p>
<p>You need to remove it from your repo (<code>git rm package-lock.json</code>) in order for git to stop tracking it.</p> <p>.gitignore only works for untracked files. If you have a tracked file that is also in your .gitignore, the fact that the file is tracked overrides the fact that it is also in .gitignore.</p>
119, 46426, 61387
git, node.js, npm
<h1>Can't make git stop tracking package-lock.json</h1> <p>With npm v5 here is now <code>package-lock.json</code> file being created after <code>npm install</code></p> <p>It is recommended to commit this file, but I have issue that this file is different for some reason between my dev machine and my server. Even if I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,808
git
# Can't make git stop tracking package-lock.json With npm v5 here is now `package-lock.json` file being created after `npm install` It is recommended to commit this file, but I have issue that this file is different for some reason between my dev machine and my server. Even if I push that file to repo, after `npm ins...
You need to remove it from your repo (`git rm package-lock.json`) in order for git to stop tracking it. .gitignore only works for untracked files. If you have a tracked file that is also in your .gitignore, the fact that the file is tracked overrides the fact that it is also in .gitignore.
30105210
Git Overwrite master with branch
45
2015-05-07 15:16:13
<p>I want to overrite master with a particular branch after making changes to it, what I done to do it is:</p> <p>Step 1: Checkout brranch from Git, using command :</p> <pre><code>git checkout branch_name </code></pre> <p>Step 2: I done some changes in code, now I want to make this branch as master, for that I first...
79,637
3,118,209
2020-07-05 19:26:53
30,106,024
112
2015-05-07 15:52:06
390,363
2020-07-05 19:26:53
https://stackoverflow.com/q/30105210
https://stackoverflow.com/a/30106024
<p><code>git branch -f master dev_branch</code> will rewrite local master branch.</p> <p><code>git push remote +dev_branch:master</code> will rewrite remote branch.</p> <ul> <li>NOTE: If the above doesn't work, the name <code>remote</code> could be <code>origin</code> for you (i.e. <code>git push origin +dev_branch:mas...
<p><code>git branch -f master dev_branch</code> will rewrite local master branch.</p> <p><code>git push remote +dev_branch:master</code> will rewrite remote branch.</p> <ul> <li>NOTE: If the above doesn't work, the name <code>remote</code> could be <code>origin</code> for you (i.e. <code>git push origin +dev_branch:mas...
119
git
<h1>Git Overwrite master with branch</h1> <p>I want to overrite master with a particular branch after making changes to it, what I done to do it is:</p> <p>Step 1: Checkout brranch from Git, using command :</p> <pre><code>git checkout branch_name </code></pre> <p>Step 2: I done some changes in code, now I want to ma...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,809
git
# Git Overwrite master with branch I want to overrite master with a particular branch after making changes to it, what I done to do it is: Step 1: Checkout brranch from Git, using command : ``` git checkout branch_name ``` Step 2: I done some changes in code, now I want to make this branch as master, for that I fir...
`git branch -f master dev_branch` will rewrite local master branch. `git push remote +dev_branch:master` will rewrite remote branch. - NOTE: If the above doesn't work, the name `remote` could be `origin` for you (i.e. `git push origin +dev_branch:master`)
2855140
Recursively add files by pattern
227
2010-05-18 07:11:40
<p>How do I recursively add files by a pattern (or glob) located in different directories?</p> <p>For example, I'd like to add <code>A/B/C/foo.java</code> and <code>D/E/F/bar.java</code> (and several other java files) with one command:</p> <pre class="lang-bash prettyprint-override"><code>git add '*.java' </code></pre>...
121,984
309,962
2024-03-07 13:51:36
2,857,909
111
2010-05-18 13:57:44
119,963
2024-03-07 13:48:53
https://stackoverflow.com/q/2855140
https://stackoverflow.com/a/2857909
<p><a href="https://stackoverflow.com/a/2855161">Sergio Acosta's answer</a> is probably your best bet if some of the files to be added may not already be tracked. If you want to limit yourself to files git already knows about, you could combine <code>git-ls-files</code> with a filter:</p> <pre class="lang-bash prettypr...
<p><a href="https://stackoverflow.com/a/2855161">Sergio Acosta's answer</a> is probably your best bet if some of the files to be added may not already be tracked. If you want to limit yourself to files git already knows about, you could combine <code>git-ls-files</code> with a filter:</p> <pre class="lang-bash prettypr...
119, 3889, 38451
filepattern, git, glob
<h1>Recursively add files by pattern</h1> <p>How do I recursively add files by a pattern (or glob) located in different directories?</p> <p>For example, I'd like to add <code>A/B/C/foo.java</code> and <code>D/E/F/bar.java</code> (and several other java files) with one command:</p> <pre class="lang-bash prettyprint-over...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,810
git
# Recursively add files by pattern How do I recursively add files by a pattern (or glob) located in different directories? For example, I'd like to add `A/B/C/foo.java` and `D/E/F/bar.java` (and several other java files) with one command: ``` git add '*.java' ``` Unfortunately, that doesn't work as expected.
[Sergio Acosta's answer](https://stackoverflow.com/a/2855161) is probably your best bet if some of the files to be added may not already be tracked. If you want to limit yourself to files git already knows about, you could combine `git-ls-files` with a filter: ``` git ls-files [path] | grep '\.java$' | xargs git add `...
3207029
How to resolve git status "Unmerged paths:"?
126
2010-07-08 19:06:06
<p>I merged branch <code>dog</code> into <code>animal</code>. When I go to commit, I get the following:</p> <pre><code>Unmerged paths: (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage) (use &quot;git add &lt;file&gt;...&quot; to mark resolution both deleted: ../public/images/originals/dog.ai added by t...
282,853
251,257
2020-10-19 23:52:13
3,207,101
111
2010-07-08 19:18:04
119,963
2020-10-19 23:38:49
https://stackoverflow.com/q/3207029
https://stackoverflow.com/a/3207101
<p>All you should need to do is:</p> <pre><code># if the file in the right place isn't already committed: git add &lt;path to desired file&gt; # remove the &quot;both deleted&quot; file from the index: git rm --cached ../public/images/originals/dog.ai # commit the merge: git commit </code></pre>
<p>All you should need to do is:</p> <pre><code># if the file in the right place isn't already committed: git add &lt;path to desired file&gt; # remove the &quot;both deleted&quot; file from the index: git rm --cached ../public/images/originals/dog.ai # commit the merge: git commit </code></pre>
119, 717, 28897, 54839
git, git-merge, git-status, merge
<h1>How to resolve git status "Unmerged paths:"?</h1> <p>I merged branch <code>dog</code> into <code>animal</code>. When I go to commit, I get the following:</p> <pre><code>Unmerged paths: (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage) (use &quot;git add &lt;file&gt;...&quot; to mark resolution both delet...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,811
git
# How to resolve git status "Unmerged paths:"? I merged branch `dog` into `animal`. When I go to commit, I get the following: ``` Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark resolution both deleted: ../public/images/originals/dog.ai added by them: ../public/...
All you should need to do is: ``` # if the file in the right place isn't already committed: git add <path to desired file> # remove the "both deleted" file from the index: git rm --cached ../public/images/originals/dog.ai # commit the merge: git commit ```
14203952
git reset asks 'more?'
113
2013-01-07 21:01:30
<p>Git windows command line, version 1.8.0</p> <p>I have 3 commits so far and when I type</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>new line comes up with</p> <pre><code>More? </code></pre> <p>and flashing cursor for input</p> <p>Then, whatever I type, I always get </p> <blockquote> <p>fatal: ambi...
41,192
1,921,669
2024-06-25 13:14:33
14,204,318
111
2013-01-07 21:27:14
1,864,976
2013-01-07 21:27:14
https://stackoverflow.com/q/14203952
https://stackoverflow.com/a/14204318
<p>see if <code>git log HEAD^</code> works. If it doesn't, it may be something with your localization or terminal. It seems to be filtering out the <code>^</code> symbol. As a workaround, use <code>git reset --soft HEAD~1</code> for now.</p>
<p>see if <code>git log HEAD^</code> works. If it doesn't, it may be something with your localization or terminal. It seems to be filtering out the <code>^</code> symbol. As a workaround, use <code>git reset --soft HEAD~1</code> for now.</p>
119, 456
git, version-control
<h1>git reset asks 'more?'</h1> <p>Git windows command line, version 1.8.0</p> <p>I have 3 commits so far and when I type</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>new line comes up with</p> <pre><code>More? </code></pre> <p>and flashing cursor for input</p> <p>Then, whatever I type, I always get </p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,812
git
# git reset asks 'more?' Git windows command line, version 1.8.0 I have 3 commits so far and when I type ``` git reset --soft HEAD^ ``` new line comes up with ``` More? ``` and flashing cursor for input Then, whatever I type, I always get > fatal: ambiguous argument 'HEAD > ': unknown revision or path not in th...
see if `git log HEAD^` works. If it doesn't, it may be something with your localization or terminal. It seems to be filtering out the `^` symbol. As a workaround, use `git reset --soft HEAD~1` for now.