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
18418718
Git still adds and tracks folders marked in .gitignore
44
2013-08-24 12:45:12
<p>I have a few folders in Git added in my ".gitignore" file. They contain over 100k files. Mainly images, tmp and cache stuff. What I need is to be able to commit changes to my code with out committing what happens in those folders. </p> <p>I thought adding them into the ".gitignore" would do the trick but for some r...
25,645
2,157,510
2013-08-25 20:41:27
18,418,757
103
2013-08-24 12:48:34
2,128,691
2013-08-24 12:48:34
https://stackoverflow.com/q/18418718
https://stackoverflow.com/a/18418757
<p>The reason it isn't working is (probably) because you added some of those files before you added the <code>.gitignore</code> - so you have to remove them from git before they're able to be ignored. </p> <p>Source: <a href="https://stackoverflow.com/a/1139797/2128691">https://stackoverflow.com/a/1139797/2128691</a>...
<p>The reason it isn't working is (probably) because you added some of those files before you added the <code>.gitignore</code> - so you have to remove them from git before they're able to be ignored. </p> <p>Source: <a href="https://stackoverflow.com/a/1139797/2128691">https://stackoverflow.com/a/1139797/2128691</a>...
119, 25056
git, gitignore
<h1>Git still adds and tracks folders marked in .gitignore</h1> <p>I have a few folders in Git added in my ".gitignore" file. They contain over 100k files. Mainly images, tmp and cache stuff. What I need is to be able to commit changes to my code with out committing what happens in those folders. </p> <p>I thought add...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,947
git
# Git still adds and tracks folders marked in .gitignore I have a few folders in Git added in my ".gitignore" file. They contain over 100k files. Mainly images, tmp and cache stuff. What I need is to be able to commit changes to my code with out committing what happens in those folders. I thought adding them into the...
The reason it isn't working is (probably) because you added some of those files before you added the `.gitignore` - so you have to remove them from git before they're able to be ignored. Source: <https://stackoverflow.com/a/1139797/2128691> First, **commit any outstanding code changes**, and then, run this command: ...
14720034
No submodule mapping found in .gitmodules for path
32
2013-02-06 01:22:19
<p>When I run</p> <pre><code>git submodule update No submodule mapping found in .gitmodules for path 'Classes/lib/AFKissXMLRequestOperation' </code></pre> <p>But I have no submodule <code>Classes/lib/AFKissXMLRequestOperation</code> in current repos</p> <p>My git config is:</p> <pre><code>[core] repositoryforma...
35,341
335,499
2019-08-02 02:44:33
14,722,829
103
2013-02-06 06:20:35
1,864,976
2013-02-06 06:20:35
https://stackoverflow.com/q/14720034
https://stackoverflow.com/a/14722829
<p>check that you have the proper setting in <code>.git/modules</code> as well. Since a few versions ago, git adds an entry there.</p> <p>Also, the tree probably has a commit object at that path. To get rid of it you can</p> <pre><code>git rm --cached Classes/lib/AFKissXMLRequestOperation </code></pre> <p>that shoul...
<p>check that you have the proper setting in <code>.git/modules</code> as well. Since a few versions ago, git adds an entry there.</p> <p>Also, the tree probably has a commit object at that path. To get rid of it you can</p> <pre><code>git rm --cached Classes/lib/AFKissXMLRequestOperation </code></pre> <p>that shoul...
119, 456, 41612
git, git-submodules, version-control
<h1>No submodule mapping found in .gitmodules for path</h1> <p>When I run</p> <pre><code>git submodule update No submodule mapping found in .gitmodules for path 'Classes/lib/AFKissXMLRequestOperation' </code></pre> <p>But I have no submodule <code>Classes/lib/AFKissXMLRequestOperation</code> in current repos</p> <p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,948
git
# No submodule mapping found in .gitmodules for path When I run ``` git submodule update No submodule mapping found in .gitmodules for path 'Classes/lib/AFKissXMLRequestOperation' ``` But I have no submodule `Classes/lib/AFKissXMLRequestOperation` in current repos My git config is: ``` [core] repositoryformatv...
check that you have the proper setting in `.git/modules` as well. Since a few versions ago, git adds an entry there. Also, the tree probably has a commit object at that path. To get rid of it you can ``` git rm --cached Classes/lib/AFKissXMLRequestOperation ``` that should get rid of it once and for all.
7199496
Git Checkout warning: unable to unlink files, permission denied
137
2011-08-26 02:42:21
<p>I am aware that there are similar issues about git relating to the 'unable to unlink' warning, but I have not been able to use them.</p> <p>The main difference is that this happened when I have not been dealing with submodules in any way (I have never dealt with them before). I created a branch called 'upgrade', d...
187,738
659,816
2022-05-05 12:25:25
7,199,888
102
2011-08-26 03:58:39
6,309
2018-10-22 20:24:34
https://stackoverflow.com/q/7199496
https://stackoverflow.com/a/7199888
<p>I usually see that kind of error when there is a process not releasing the handle of those files.</p> <p>Make sure nothing is running, and then try your checkout again.</p> <p>Note: it can also be related with the way Git has been installed (on Windows, UAC can generate problem if msysgit is installed in <code>C:\...
<p>I usually see that kind of error when there is a process not releasing the handle of those files.</p> <p>Make sure nothing is running, and then try your checkout again.</p> <p>Note: it can also be related with the way Git has been installed (on Windows, UAC can generate problem if msysgit is installed in <code>C:\...
119
git
<h1>Git Checkout warning: unable to unlink files, permission denied</h1> <p>I am aware that there are similar issues about git relating to the 'unable to unlink' warning, but I have not been able to use them.</p> <p>The main difference is that this happened when I have not been dealing with submodules in any way (I ha...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,949
git
# Git Checkout warning: unable to unlink files, permission denied I am aware that there are similar issues about git relating to the 'unable to unlink' warning, but I have not been able to use them. The main difference is that this happened when I have not been dealing with submodules in any way (I have never dealt w...
I usually see that kind of error when there is a process not releasing the handle of those files. Make sure nothing is running, and then try your checkout again. Note: it can also be related with the way Git has been installed (on Windows, UAC can generate problem if msysgit is installed in `C:\Program` or `C:\Progra...
5889878
Color in git-log
117
2011-05-04 21:07:00
<p>When you run <code>git log --decorate --pretty=oneline</code> the output will have entries like <code>(HEAD, refs/published/master, master)</code> with coloration.</p> <p>I also have the following in my gitconfig:</p> <pre><code>[color "branch"] current = yellow reverse local = yellow remote = green </...
57,347
231,463
2025-07-23 13:36:41
16,844,346
102
2013-05-30 19:26:46
2,263,682
2013-05-30 19:26:46
https://stackoverflow.com/q/5889878
https://stackoverflow.com/a/16844346
<p>As of git 1.8.3 (May 24, 2013), you can use <code>%C(auto)</code> to decorate <code>%d</code> in the format string of <code>git log</code>.</p> <p>From the <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt">release notes</a>:</p> <pre><code> * "git log --format" specifier learned %C(...
<p>As of git 1.8.3 (May 24, 2013), you can use <code>%C(auto)</code> to decorate <code>%d</code> in the format string of <code>git log</code>.</p> <p>From the <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt">release notes</a>:</p> <pre><code> * "git log --format" specifier learned %C(...
119, 47913
git, git-log
<h1>Color in git-log</h1> <p>When you run <code>git log --decorate --pretty=oneline</code> the output will have entries like <code>(HEAD, refs/published/master, master)</code> with coloration.</p> <p>I also have the following in my gitconfig:</p> <pre><code>[color "branch"] current = yellow reverse local = ye...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,950
git
# Color in git-log When you run `git log --decorate --pretty=oneline` the output will have entries like `(HEAD, refs/published/master, master)` with coloration. I also have the following in my gitconfig: ``` [color "branch"] current = yellow reverse local = yellow remote = green ``` How do you replicate...
As of git 1.8.3 (May 24, 2013), you can use `%C(auto)` to decorate `%d` in the format string of `git log`. From the [release notes](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt): ``` * "git log --format" specifier learned %C(auto) token that tells Git to use color when interpolating %d ...
16969768
What does the 'git add .' ('git add' single dot) command do?
87
2013-06-06 18:43:30
<p>I don't get what the Git command means, when adding files to the stage with the use of a period (or full stop, single dot):</p> <pre><code>git add . </code></pre> <p>What does this do?</p>
132,116
2,162,928
2024-10-09 13:44:11
16,969,786
102
2013-06-06 18:44:26
2,259,303
2013-06-06 18:56:52
https://stackoverflow.com/q/16969768
https://stackoverflow.com/a/16969786
<p><code>git add .</code> adds / stages all of the files in the current directory. This is for convenience, and can still be used if you have certain files you don't want to add by using a <code>.gitignore</code></p> <p>A tutorial for <code>.gitignore</code> is located <a href="https://devcenter.heroku.com/articles/gi...
<p><code>git add .</code> adds / stages all of the files in the current directory. This is for convenience, and can still be used if you have certain files you don't want to add by using a <code>.gitignore</code></p> <p>A tutorial for <code>.gitignore</code> is located <a href="https://devcenter.heroku.com/articles/gi...
119, 11225, 34792
command-line-interface, git, git-add
<h1>What does the 'git add .' ('git add' single dot) command do?</h1> <p>I don't get what the Git command means, when adding files to the stage with the use of a period (or full stop, single dot):</p> <pre><code>git add . </code></pre> <p>What does this do?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,951
git
# What does the 'git add .' ('git add' single dot) command do? I don't get what the Git command means, when adding files to the stage with the use of a period (or full stop, single dot): ``` git add . ``` What does this do?
`git add .` adds / stages all of the files in the current directory. This is for convenience, and can still be used if you have certain files you don't want to add by using a `.gitignore` A tutorial for `.gitignore` is located [here](https://devcenter.heroku.com/articles/gitignore). A deeper look into `git add .` vs ...
7610073
Get information about a SHA-1 commit object?
75
2011-09-30 12:04:28
<p>I searched for a topic of interest in a commit log:</p> <pre><code>$ git log --pretty=oneline | grep -i ... $SHA1 &lt; ... commit message ... &gt; </code></pre> <p>I now have a <code>SHA1</code>, and I want to know information about the files affecting that <code>SHA1</code> and maybe later <code>diff</code> them...
31,490
1,140,524
2021-06-16 18:30:33
7,610,164
102
2011-09-30 12:12:08
11,343
2011-09-30 12:12:08
https://stackoverflow.com/q/7610073
https://stackoverflow.com/a/7610164
<p><code>git show &lt;SHA1&gt;</code> will show the commit date, author, parent, and diff of files that changed from parent commit.</p>
<p><code>git show &lt;SHA1&gt;</code> will show the commit date, author, parent, and diff of files that changed from parent commit.</p>
119
git
<h1>Get information about a SHA-1 commit object?</h1> <p>I searched for a topic of interest in a commit log:</p> <pre><code>$ git log --pretty=oneline | grep -i ... $SHA1 &lt; ... commit message ... &gt; </code></pre> <p>I now have a <code>SHA1</code>, and I want to know information about the files affecting that <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,952
git
# Get information about a SHA-1 commit object? I searched for a topic of interest in a commit log: ``` $ git log --pretty=oneline | grep -i ... $SHA1 < ... commit message ... > ``` I now have a `SHA1`, and I want to know information about the files affecting that `SHA1` and maybe later `diff` them with their parent...
`git show <SHA1>` will show the commit date, author, parent, and diff of files that changed from parent commit.
22320058
Git: First rewinding head to replay
63
2014-03-11 08:24:43
<p>I am getting this message:</p> <pre><code> First, rewinding head to replay your work on top of it... </code></pre> <p>each time I do a <code>git pull --rebase origin &lt;branch&gt;</code>, however I would like to discard all my work that may be replayed on top of it.. Basically I would like to rebase only the origin...
120,236
2,017,866
2022-12-24 20:15:45
22,320,135
102
2014-03-11 08:28:16
390,363
2014-03-11 08:28:16
https://stackoverflow.com/q/22320058
https://stackoverflow.com/a/22320135
<p><code>git fetch origin; git reset --hard origin/&lt;branch&gt;</code></p>
<p><code>git fetch origin; git reset --hard origin/&lt;branch&gt;</code></p>
119, 8974, 76220
git, git-branch, rebase
<h1>Git: First rewinding head to replay</h1> <p>I am getting this message:</p> <pre><code> First, rewinding head to replay your work on top of it... </code></pre> <p>each time I do a <code>git pull --rebase origin &lt;branch&gt;</code>, however I would like to discard all my work that may be replayed on top of it.. Bas...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,956
git
# Git: First rewinding head to replay I am getting this message: ``` First, rewinding head to replay your work on top of it... ``` each time I do a `git pull --rebase origin <branch>`, however I would like to discard all my work that may be replayed on top of it.. Basically I would like to rebase only the origin br...
`git fetch origin; git reset --hard origin/<branch>`
43364233
Visual Studio Code - Connect to a remote Git repository and PUSH local files to a new remote repository
59
2017-04-12 08:27:55
<p>I have created a <strong>local project</strong> with Visual Studio Code that implements a <strong>local Git repository</strong>.</p> <p>Then I have create a Git repository on <strong>Visual Studio Online</strong> and I want to <em>push</em> all my project files to the remote repository...</p> <p>What is the correct ...
173,369
4,080,514
2023-05-11 09:10:46
43,364,619
102
2017-04-12 08:46:18
5,784,831
2020-09-01 01:26:39
https://stackoverflow.com/q/43364233
https://stackoverflow.com/a/43364619
<p>I assume you started to work in a directory and didn't use Git there. The following should work with <a href="https://superuser.com/questions/1053633/what-is-git-bash-for-windows-anyway">Git Bash</a>:</p> <pre><code>cd &quot;path to your repository&quot; git init git add . # If you want to commit everything. Otherwi...
<p>I assume you started to work in a directory and didn't use Git there. The following should work with <a href="https://superuser.com/questions/1053633/what-is-git-bash-for-windows-anyway">Git Bash</a>:</p> <pre><code>cd &quot;path to your repository&quot; git init git add . # If you want to commit everything. Otherwi...
119, 111608
git, visual-studio-code
<h1>Visual Studio Code - Connect to a remote Git repository and PUSH local files to a new remote repository</h1> <p>I have created a <strong>local project</strong> with Visual Studio Code that implements a <strong>local Git repository</strong>.</p> <p>Then I have create a Git repository on <strong>Visual Studio Online<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,958
git
# Visual Studio Code - Connect to a remote Git repository and PUSH local files to a new remote repository I have created a **local project** with Visual Studio Code that implements a **local Git repository**. Then I have create a Git repository on **Visual Studio Online** and I want to *push* all my project files to ...
I assume you started to work in a directory and didn't use Git there. The following should work with [Git Bash](https://superuser.com/questions/1053633/what-is-git-bash-for-windows-anyway): ``` cd "path to your repository" git init git add . # If you want to commit everything. Otherwise use .gitconfig files git commit...
1084969
Unable to track files within Git submodules
51
2009-07-05 22:34:26
<p><strong>Problem:</strong> to add files at <code>./shells/smallApps/*</code> to Git at <code>./.git/</code> when I do not have the files at <code>./.git/info/exclude</code> nor at any <code>.gitignore</code> -files.</p> <p>This question is based on <a href="https://stackoverflow.com/questions/1081173/unable-to-track...
32,641
54,964
2012-03-30 02:39:34
1,098,621
102
2009-07-08 14:58:23
63,147
2012-02-06 19:56:01
https://stackoverflow.com/q/1084969
https://stackoverflow.com/a/1098621
<p><strong>UPDATE</strong></p> <p>There are two general reasons why Git will ignore a file: <a href="http://schacon.github.com/git/gitignore.html" rel="noreferrer"><code>gitignore</code></a> and <a href="http://schacon.github.com/git/git-submodule.html" rel="noreferrer"><code>submodules</code></a>.</p> <p>To be more ...
<p><strong>UPDATE</strong></p> <p>There are two general reasons why Git will ignore a file: <a href="http://schacon.github.com/git/gitignore.html" rel="noreferrer"><code>gitignore</code></a> and <a href="http://schacon.github.com/git/git-submodule.html" rel="noreferrer"><code>submodules</code></a>.</p> <p>To be more ...
119, 14215, 41612
addition, git, git-submodules
<h1>Unable to track files within Git submodules</h1> <p><strong>Problem:</strong> to add files at <code>./shells/smallApps/*</code> to Git at <code>./.git/</code> when I do not have the files at <code>./.git/info/exclude</code> nor at any <code>.gitignore</code> -files.</p> <p>This question is based on <a href="https:...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,960
git
# Unable to track files within Git submodules **Problem:** to add files at `./shells/smallApps/*` to Git at `./.git/` when I do not have the files at `./.git/info/exclude` nor at any `.gitignore` -files. This question is based on [this tread](https://stackoverflow.com/questions/1081173/unable-to-track-files-in-long-p...
**UPDATE** There are two general reasons why Git will ignore a file: [`gitignore`](http://schacon.github.com/git/gitignore.html) and [`submodules`](http://schacon.github.com/git/git-submodule.html). To be more specific, the following conditions will cause Git to ignore a file when '`git add`' is invoked: 1. The file...
29971624
Visual Studio Code cannot detect installed Git
295
2015-04-30 15:21:13
<p>Visual Studio Code reports &quot;It look like git is not installed on your system.&quot; when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction (&quot;install it with Chocolatey or download it from git-scm...
593,190
272,258
2025-11-09 18:50:26
29,973,715
101
2015-04-30 17:02:41
729,881
2015-04-30 17:02:41
https://stackoverflow.com/q/29971624
https://stackoverflow.com/a/29973715
<p>Visual Studio Code simply looks in your <code>PATH</code> for <code>git</code>. Many UI clients ship with a "Portable Git" for simplicity, and do not add <code>git</code> to the path.</p> <p>If you add your existing git client to your <code>PATH</code> (so that it can find <code>git.exe</code>), Visual Studio Code...
<p>Visual Studio Code simply looks in your <code>PATH</code> for <code>git</code>. Many UI clients ship with a "Portable Git" for simplicity, and do not add <code>git</code> to the path.</p> <p>If you add your existing git client to your <code>PATH</code> (so that it can find <code>git.exe</code>), Visual Studio Code...
119, 111608
git, visual-studio-code
<h1>Visual Studio Code cannot detect installed Git</h1> <p>Visual Studio Code reports &quot;It look like git is not installed on your system.&quot; when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction (&quo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,961
git
# Visual Studio Code cannot detect installed Git Visual Studio Code reports "It look like git is not installed on your system." when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction ("install it with Chocol...
Visual Studio Code simply looks in your `PATH` for `git`. Many UI clients ship with a "Portable Git" for simplicity, and do not add `git` to the path. If you add your existing git client to your `PATH` (so that it can find `git.exe`), Visual Studio Code should enable Git source control management.
7669963
How can I get a side-by-side diff when I do "git diff"?
286
2011-10-06 03:10:00
<p>When I type <code>git diff</code>, I'd like to see a side-by-side diff, like with <code>diff -y</code>, or like to display the diff in an interactive diff tool like <code>kdiff3</code>. How can this be done?</p>
202,933
null
2025-01-15 07:03:10
7,669,988
101
2011-10-06 03:14:03
677,684
2023-12-09 21:29:55
https://stackoverflow.com/q/7669963
https://stackoverflow.com/a/7669988
<p>Although Git has an internal implementation of diff, you can set up an external tool instead.</p> <p>There are two different ways to specify an external diff tool:</p> <ol> <li>setting the <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</li> <li>configuring the external diff ...
<p>Although Git has an internal implementation of diff, you can set up an external tool instead.</p> <p>There are two different ways to specify an external diff tool:</p> <ol> <li>setting the <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</li> <li>configuring the external diff ...
119, 9033, 28440
code-visualization, git, git-diff
<h1>How can I get a side-by-side diff when I do "git diff"?</h1> <p>When I type <code>git diff</code>, I'd like to see a side-by-side diff, like with <code>diff -y</code>, or like to display the diff in an interactive diff tool like <code>kdiff3</code>. How can this be done?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,962
git
# How can I get a side-by-side diff when I do "git diff"? When I type `git diff`, I'd like to see a side-by-side diff, like with `diff -y`, or like to display the diff in an interactive diff tool like `kdiff3`. How can this be done?
Although Git has an internal implementation of diff, you can set up an external tool instead. There are two different ways to specify an external diff tool: 1. setting the `GIT_EXTERNAL_DIFF` and the `GIT_DIFF_OPTS` environment variables. 2. configuring the external diff tool via `git config` `ymattw`'s answer is al...
708202
Git format-patch to be svn compatible?
102
2009-04-02 03:45:13
<p>Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo?</p> <p>I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however the patch cannot be applied since git formats that...
37,292
31,278
2018-06-09 04:23:30
13,377,540
101
2012-11-14 11:01:21
741,595
2014-10-17 11:28:43
https://stackoverflow.com/q/708202
https://stackoverflow.com/a/13377540
<p>I always have to Google this but the way I've found that works perfectly (for me) is:</p> <ul> <li>Create the patch with <code>git diff --no-prefix master..branch &gt; somefile.diff</code>, the master and branch part are optional, depends how you want to get your diffs.</li> <li>Send it wherever and apply with <cod...
<p>I always have to Google this but the way I've found that works perfectly (for me) is:</p> <ul> <li>Create the patch with <code>git diff --no-prefix master..branch &gt; somefile.diff</code>, the master and branch part are optional, depends how you want to get your diffs.</li> <li>Send it wherever and apply with <cod...
63, 119, 27597
format-patch, git, svn
<h1>Git format-patch to be svn compatible?</h1> <p>Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo?</p> <p>I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,963
git
# Git format-patch to be svn compatible? Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo? I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however the patch cannot b...
I always have to Google this but the way I've found that works perfectly (for me) is: - Create the patch with `git diff --no-prefix master..branch > somefile.diff`, the master and branch part are optional, depends how you want to get your diffs. - Send it wherever and apply with `patch -p0 < somefile.diff`. It always...
10415565
How to revert multiple commits as part of a single commit
87
2012-05-02 14:16:17
<p>This is not a major problem, just something I want to know whether or not is possible.</p> <p>Let's say we have two commits, <code>abcd123</code> and <code>wxyz789</code>, that occur at non-adjacent, separate places, far back in a repo's history. Now let's say we want to revert them. Doing</p> <pre><code>git rev...
68,577
778,572
2015-12-08 02:08:20
10,415,744
101
2012-05-02 14:25:07
223,092
2012-05-02 14:25:07
https://stackoverflow.com/q/10415565
https://stackoverflow.com/a/10415744
<p>You can do:</p> <pre><code>git revert abcd123 git revert --no-commit wxyz789 git commit --amend </code></pre> <p>... and then write an appropriate commit message describing the combined effect of reverting both commits.</p>
<p>You can do:</p> <pre><code>git revert abcd123 git revert --no-commit wxyz789 git commit --amend </code></pre> <p>... and then write an appropriate commit message describing the combined effect of reverting both commits.</p>
119, 12309
git, revert
<h1>How to revert multiple commits as part of a single commit</h1> <p>This is not a major problem, just something I want to know whether or not is possible.</p> <p>Let's say we have two commits, <code>abcd123</code> and <code>wxyz789</code>, that occur at non-adjacent, separate places, far back in a repo's history. N...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,964
git
# How to revert multiple commits as part of a single commit This is not a major problem, just something I want to know whether or not is possible. Let's say we have two commits, `abcd123` and `wxyz789`, that occur at non-adjacent, separate places, far back in a repo's history. Now let's say we want to revert them. Do...
You can do: ``` git revert abcd123 git revert --no-commit wxyz789 git commit --amend ``` ... and then write an appropriate commit message describing the combined effect of reverting both commits.
54577475
AzureDevOps - Link git commit or branch to work item via command line
74
2019-02-07 16:06:34
<p>I've worked on projects with a Jira integration where I simply had to include the ticket number in the commit or branch name and that work would automatically link with the ticket in Jira. Exe:</p> <blockquote> <p><code>git commit -am '123 some commit'</code></p> </blockquote> <p>And on the ticket you'd see a li...
82,730
2,109,585
2021-08-25 06:15:47
54,577,835
101
2019-02-07 16:25:21
729,881
2020-10-12 14:50:37
https://stackoverflow.com/q/54577475
https://stackoverflow.com/a/54577835
<p>You can link a work item in Azure Boards to a commit in Azure Repos by specifying the work item ID after a pound sign. Eg, to update work item #3, you need to mention <code>#3</code> in the commit message. (The pound sign - <code>#</code> is required, it won't parse bare numbers and try to link work items.)</p> <p...
<p>You can link a work item in Azure Boards to a commit in Azure Repos by specifying the work item ID after a pound sign. Eg, to update work item #3, you need to mention <code>#3</code> in the commit message. (The pound sign - <code>#</code> is required, it won't parse bare numbers and try to link work items.)</p> <p...
119, 116537
azure-devops, git
<h1>AzureDevOps - Link git commit or branch to work item via command line</h1> <p>I've worked on projects with a Jira integration where I simply had to include the ticket number in the commit or branch name and that work would automatically link with the ticket in Jira. Exe:</p> <blockquote> <p><code>git commit -am ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,966
git
# AzureDevOps - Link git commit or branch to work item via command line I've worked on projects with a Jira integration where I simply had to include the ticket number in the commit or branch name and that work would automatically link with the ticket in Jira. Exe: > `git commit -am '123 some commit'` And on the tic...
You can link a work item in Azure Boards to a commit in Azure Repos by specifying the work item ID after a pound sign. Eg, to update work item #3, you need to mention `#3` in the commit message. (The pound sign - `#` is required, it won't parse bare numbers and try to link work items.) For example: ``` git commit -m"...
4922104
Is it possible to completely empty a remote Git repository?
68
2011-02-07 13:58:19
<p>Let's say I make a mistake in my first push to a remote Git repository. Can I somehow revert this so that the repository is back to it's initial state? I don't have access to the remote machine, so deleting .git directory is not possible.</p> <p>The problem, as far as I can see is that you can't "unset" the head.</...
106,873
94,895
2024-12-27 16:34:38
4,924,146
101
2011-02-07 17:08:48
119,963
2011-02-07 17:08:48
https://stackoverflow.com/q/4922104
https://stackoverflow.com/a/4924146
<p>I think you may have an XY problem. You don't actually need to get the remote repository back into its original state in order to start over; you simply need to start over locally, then force-push that to the remote.</p> <pre><code># create a new repository that has the initial commit that you want mkdir foo; cd fo...
<p>I think you may have an XY problem. You don't actually need to get the remote repository back into its original state in order to start over; you simply need to start over locally, then force-push that to the remote.</p> <pre><code># create a new repository that has the initial commit that you want mkdir foo; cd fo...
119
git
<h1>Is it possible to completely empty a remote Git repository?</h1> <p>Let's say I make a mistake in my first push to a remote Git repository. Can I somehow revert this so that the repository is back to it's initial state? I don't have access to the remote machine, so deleting .git directory is not possible.</p> <p>T...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,969
git
# Is it possible to completely empty a remote Git repository? Let's say I make a mistake in my first push to a remote Git repository. Can I somehow revert this so that the repository is back to it's initial state? I don't have access to the remote machine, so deleting .git directory is not possible. The problem, as f...
I think you may have an XY problem. You don't actually need to get the remote repository back into its original state in order to start over; you simply need to start over locally, then force-push that to the remote. ``` # create a new repository that has the initial commit that you want mkdir foo; cd foo; git init; ....
1475199
How can I print out the value of a git configuration setting (core.autocrlf) on Windows?
67
2009-09-25 02:54:51
<p>I'm trying to fix a problem with CRLF on Windows.</p> <p>How do I see what the value of the configuration setting <code>core.autocrlf</code> is set to on my system?</p>
57,574
178,665
2024-10-27 02:31:33
1,475,212
101
2009-09-25 02:58:56
29,689
2019-09-17 19:06:11
https://stackoverflow.com/q/1475199
https://stackoverflow.com/a/1475212
<p>If you're using Git Bash:</p> <pre><code>git config --get core.autocrlf </code></pre> <p>And for the global config:</p> <pre><code>git config --global --get core.autocrlf </code></pre>
<p>If you're using Git Bash:</p> <pre><code>git config --get core.autocrlf </code></pre> <p>And for the global config:</p> <pre><code>git config --global --get core.autocrlf </code></pre>
119, 3705
git, newline
<h1>How can I print out the value of a git configuration setting (core.autocrlf) on Windows?</h1> <p>I'm trying to fix a problem with CRLF on Windows.</p> <p>How do I see what the value of the configuration setting <code>core.autocrlf</code> is set to on my system?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,970
git
# How can I print out the value of a git configuration setting (core.autocrlf) on Windows? I'm trying to fix a problem with CRLF on Windows. How do I see what the value of the configuration setting `core.autocrlf` is set to on my system?
If you're using Git Bash: ``` git config --get core.autocrlf ``` And for the global config: ``` git config --global --get core.autocrlf ```
17798109
How can I diff a single file with magit?
56
2013-07-22 21:53:19
<p>Say I've made a number of unrelated changes to uncoupled files in my git repo. I want to review and commit each of the files separately.</p> <p>I run <code>magit-status</code>, and get a list of changed files. But the only magit diff commands I can find (<code>d</code> and <code>D</code>) diff entire revisons, not ...
17,358
789,750
2020-11-25 12:38:16
17,799,517
101
2013-07-23 00:16:01
324,105
2019-02-11 22:50:58
https://stackoverflow.com/q/17798109
https://stackoverflow.com/a/17799517
<p>Magit enables you to "review and commit each of the files separately" directly from the <code>magit-status</code> buffer, without the need for any separate diff buffers.</p> <p>You just expand the file(s) you're interested in (with <kbd>TAB</kbd>, which shows you the diff for the file at point); then you can stage ...
<p>Magit enables you to "review and commit each of the files separately" directly from the <code>magit-status</code> buffer, without the need for any separate diff buffers.</p> <p>You just expand the file(s) you're interested in (with <kbd>TAB</kbd>, which shows you the diff for the file at point); then you can stage ...
371, 9033, 41829
emacs, git-diff, magit
<h1>How can I diff a single file with magit?</h1> <p>Say I've made a number of unrelated changes to uncoupled files in my git repo. I want to review and commit each of the files separately.</p> <p>I run <code>magit-status</code>, and get a list of changed files. But the only magit diff commands I can find (<code>d</co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,971
git
# How can I diff a single file with magit? Say I've made a number of unrelated changes to uncoupled files in my git repo. I want to review and commit each of the files separately. I run `magit-status`, and get a list of changed files. But the only magit diff commands I can find (`d` and `D`) diff entire revisons, not...
Magit enables you to "review and commit each of the files separately" directly from the `magit-status` buffer, without the need for any separate diff buffers. You just expand the file(s) you're interested in (with `TAB`, which shows you the diff for the file at point); then you can stage the bits of it that you want t...
8639501
Jenkins could not run git
55
2011-12-26 22:18:25
<p>I've installed Jenkins on my mac (osx lion). But I couldn't get it work. This is the stacktrace I've got:</p> <pre><code>Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Using strategy: Default Checkout:workspace / /Users/Shared/J...
243,408
184,883
2025-10-29 13:15:36
9,397,678
101
2012-02-22 15:25:10
2,030
2019-02-05 15:45:15
https://stackoverflow.com/q/8639501
https://stackoverflow.com/a/9397678
<p>The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the <strong>Path to Git executable</strong> to <code>/usr/local/bin/git</code>.</p> <p><a href="https://i.sstatic.net/ILyHQ.png" rel="noreferrer"><img src="https://i.sstatic.net/ILyH...
<p>The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the <strong>Path to Git executable</strong> to <code>/usr/local/bin/git</code>.</p> <p><a href="https://i.sstatic.net/ILyHQ.png" rel="noreferrer"><img src="https://i.sstatic.net/ILyH...
119, 64999
git, jenkins
<h1>Jenkins could not run git</h1> <p>I've installed Jenkins on my mac (osx lion). But I couldn't get it work. This is the stacktrace I've got:</p> <pre><code>Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Using strategy: Default C...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,972
git
# Jenkins could not run git I've installed Jenkins on my mac (osx lion). But I couldn't get it work. This is the stacktrace I've got: ``` Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Using strategy: Default Checkout:workspace / ...
The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the **Path to Git executable** to `/usr/local/bin/git`. [![Global Tool Configuration](https://i.sstatic.net/ILyHQ.png)](https://i.sstatic.net/ILyHQ.png)
7053996
How do I install imagemagick with homebrew?
250
2011-08-13 23:41:48
<p>I'm trying to install Imagemagick on OSX Lion but something is not working as expected.</p> <pre><code>-&gt; brew install imagemagick /usr/local/git/bin/git ==&gt; Cloning https://github.com/adamv/ImageMagick.git Cloning into /Users/klebershimabuku/Library/Caches/Homebrew/imagemagick--git... fatal: https://github....
312,271
585,101
2025-03-06 21:12:58
7,407,154
100
2011-09-13 19:11:33
79,144
2014-08-22 01:44:46
https://stackoverflow.com/q/7053996
https://stackoverflow.com/a/7407154
<p>The quickest fix for me was doing the following:</p> <pre><code>cd /usr/local git reset --hard FETCH_HEAD </code></pre> <p>Then I retried <code>brew install imagemagick</code> and it correctly pulled the package from the new mirror, instead of adamv.</p> <p>If that does not work, ensure that <code>/Library/Caches...
<p>The quickest fix for me was doing the following:</p> <pre><code>cd /usr/local git reset --hard FETCH_HEAD </code></pre> <p>Then I retried <code>brew install imagemagick</code> and it correctly pulled the package from the new mirror, instead of adamv.</p> <p>If that does not work, ensure that <code>/Library/Caches...
119, 1067, 1477, 41296, 71219
gcc, gcc4, git, homebrew, osx-lion
<h1>How do I install imagemagick with homebrew?</h1> <p>I'm trying to install Imagemagick on OSX Lion but something is not working as expected.</p> <pre><code>-&gt; brew install imagemagick /usr/local/git/bin/git ==&gt; Cloning https://github.com/adamv/ImageMagick.git Cloning into /Users/klebershimabuku/Library/Cache...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,976
git
# How do I install imagemagick with homebrew? I'm trying to install Imagemagick on OSX Lion but something is not working as expected. ``` -> brew install imagemagick /usr/local/git/bin/git ==> Cloning https://github.com/adamv/ImageMagick.git Cloning into /Users/klebershimabuku/Library/Caches/Homebrew/imagemagick--gi...
The quickest fix for me was doing the following: ``` cd /usr/local git reset --hard FETCH_HEAD ``` Then I retried `brew install imagemagick` and it correctly pulled the package from the new mirror, instead of adamv. If that does not work, ensure that `/Library/Caches/Homebrew` does not contain any imagemagick files ...
2358643
Git: Discard all changes on a diverged local branch
177
2010-03-01 19:58:48
<p>I have a local topic branch that's tracking a remote branch. For the sake of argument, say the commit histories look like this:</p> <pre><code>A--B--C--O1--O2--O3 (origin/phobos) \ L1--L2--L3 (phobos) </code></pre> <p>Having looked at the relative commit histories, I now want to discard all the cha...
118,259
19,074
2025-01-01 21:13:51
2,358,675
100
2010-03-01 20:03:50
28,804
2025-01-01 21:13:51
https://stackoverflow.com/q/2358643
https://stackoverflow.com/a/2358675
<p>One extreme option is to delete the branch, then recreate it:</p> <pre><code>$ git branch -D phobos $ git checkout --track -b phobos origin/phobos </code></pre> <p>Be aware that deleting the branch blows away the branch's reflog.</p> <p>Resetting the branch (like shown in <a href="https://stackoverflow.com/a/2358764...
<p>One extreme option is to delete the branch, then recreate it:</p> <pre><code>$ git branch -D phobos $ git checkout --track -b phobos origin/phobos </code></pre> <p>Be aware that deleting the branch blows away the branch's reflog.</p> <p>Resetting the branch (like shown in <a href="https://stackoverflow.com/a/2358764...
119
git
<h1>Git: Discard all changes on a diverged local branch</h1> <p>I have a local topic branch that's tracking a remote branch. For the sake of argument, say the commit histories look like this:</p> <pre><code>A--B--C--O1--O2--O3 (origin/phobos) \ L1--L2--L3 (phobos) </code></pre> <p>Having looked at the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,977
git
# Git: Discard all changes on a diverged local branch I have a local topic branch that's tracking a remote branch. For the sake of argument, say the commit histories look like this: ``` A--B--C--O1--O2--O3 (origin/phobos) \ L1--L2--L3 (phobos) ``` Having looked at the relative commit histories, I now...
One extreme option is to delete the branch, then recreate it: ``` $ git branch -D phobos $ git checkout --track -b phobos origin/phobos ``` Be aware that deleting the branch blows away the branch's reflog. Resetting the branch (like shown in [the other answer](https://stackoverflow.com/a/2358764/2805305)) on the oth...
231211
Using Git how do I find changes between local and remote
162
2008-10-23 19:52:30
<p>Here are two different questions but I think they are related.</p> <ol> <li><p>When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command <code>hg outgoing</code>.</p></li> <li><p>When using Git, how do ...
108,975
796
2020-10-08 12:51:48
231,379
100
2008-10-23 20:31:36
4,272
2013-02-19 23:46:34
https://stackoverflow.com/q/231211
https://stackoverflow.com/a/231379
<p>Git can't send that kind of information over the network, like Hg can. But you can run <code>git fetch</code> (which is more like <code>hg pull</code> than <code>hg fetch</code>) to fetch new commits from your remote servers.</p> <p>So, if you have a branch called <code>master</code> and a remote called <code>origi...
<p>Git can't send that kind of information over the network, like Hg can. But you can run <code>git fetch</code> (which is more like <code>hg pull</code> than <code>hg fetch</code>) to fetch new commits from your remote servers.</p> <p>So, if you have a branch called <code>master</code> and a remote called <code>origi...
119, 802
git, mercurial
<h1>Using Git how do I find changes between local and remote</h1> <p>Here are two different questions but I think they are related.</p> <ol> <li><p>When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,978
git
# Using Git how do I find changes between local and remote Here are two different questions but I think they are related. 1. When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command `hg outgoing`. 2. Whe...
Git can't send that kind of information over the network, like Hg can. But you can run `git fetch` (which is more like `hg pull` than `hg fetch`) to fetch new commits from your remote servers. So, if you have a branch called `master` and a remote called `origin`, after running `git fetch`, you should also have a branc...
811251
How can I move a single directory from a git repository to a new repository whilst maintaining the history?
111
2009-05-01 13:01:24
<p>I have inherited a git repository containing multiple projects in separate directories. I'd like to split the repository into new individual repositories, one for each project and then have the master repository contain the projects as submodules. I'd like to do all this whilst maintaining the revision history of th...
21,697
74,653
2016-11-27 18:33:36
811,384
100
2009-05-01 13:39:42
69,755
2009-05-01 13:39:42
https://stackoverflow.com/q/811251
https://stackoverflow.com/a/811384
<p>You can use <a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git filter-branch</code></a> to rewrite the history of a project. From the documentation:</p> <blockquote> <p>To rewrite the repository to look as if foodir/ had been its project root, and discard all other history:</p> <p...
<p>You can use <a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git filter-branch</code></a> to rewrite the history of a project. From the documentation:</p> <blockquote> <p>To rewrite the repository to look as if foodir/ had been its project root, and discard all other history:</p> <p...
119, 41612
git, git-submodules
<h1>How can I move a single directory from a git repository to a new repository whilst maintaining the history?</h1> <p>I have inherited a git repository containing multiple projects in separate directories. I'd like to split the repository into new individual repositories, one for each project and then have the master...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,979
git
# How can I move a single directory from a git repository to a new repository whilst maintaining the history? I have inherited a git repository containing multiple projects in separate directories. I'd like to split the repository into new individual repositories, one for each project and then have the master reposito...
You can use [`git filter-branch`](http://git-scm.com/docs/git-filter-branch) to rewrite the history of a project. From the documentation: > To rewrite the repository to look as > if foodir/ had been its project root, > and discard all other history: > > ``` > git filter-branch --subdirectory-filter foodir -- --all > `...
34518389
Get hash of most recent git commit in Node
103
2015-12-29 20:17:10
<p>I'd like to get the id/hash of the most recent commit on the current branch in NodeJS.</p> <p>In NodeJS, I'd like to get the most recent id/hash, with respect to git and commits thereof.</p>
67,119
2,183,008
2021-04-27 23:26:39
34,518,749
100
2015-12-29 20:41:07
1,293,500
2021-04-27 23:26:39
https://stackoverflow.com/q/34518389
https://stackoverflow.com/a/34518749
<p>Solution #1 (git required, with callback):</p> <pre><code>require('child_process').exec('git rev-parse HEAD', function(err, stdout) { console.log('Last commit hash on this branch is:', stdout); }); </code></pre> <p>Optionally, you can use <code>execSync()</code> to avoid the callback.</p> <p>Solution #2 (no git ...
<p>Solution #1 (git required, with callback):</p> <pre><code>require('child_process').exec('git rev-parse HEAD', function(err, stdout) { console.log('Last commit hash on this branch is:', stdout); }); </code></pre> <p>Optionally, you can use <code>execSync()</code> to avoid the callback.</p> <p>Solution #2 (no git ...
119, 46426
git, node.js
<h1>Get hash of most recent git commit in Node</h1> <p>I'd like to get the id/hash of the most recent commit on the current branch in NodeJS.</p> <p>In NodeJS, I'd like to get the most recent id/hash, with respect to git and commits thereof.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,981
git
# Get hash of most recent git commit in Node I'd like to get the id/hash of the most recent commit on the current branch in NodeJS. In NodeJS, I'd like to get the most recent id/hash, with respect to git and commits thereof.
Solution #1 (git required, with callback): ``` require('child_process').exec('git rev-parse HEAD', function(err, stdout) { console.log('Last commit hash on this branch is:', stdout); }); ``` Optionally, you can use `execSync()` to avoid the callback. Solution #2 (no git required): - get contents of the file `.g...
8259851
Using git diff, how can I get added and modified lines numbers?
95
2011-11-24 16:11:01
<p>Assuming I have a text file</p> <pre><code>alex bob matrix will be removed git repo </code></pre> <p>and I have updated it to be</p> <pre><code>alex new line here another new line bob matrix git </code></pre> <p>Here, I have added lines number (2,3) and updated line number (6)</p> <p>How can I get these line nu...
75,482
833,179
2024-11-25 18:17:14
8,259,947
100
2011-11-24 16:19:01
317,273
2014-06-26 04:44:59
https://stackoverflow.com/q/8259851
https://stackoverflow.com/a/8259947
<p><code>git diff --stat</code> will show you the output you get when committing stuff which is the one you are referring to I guess.</p> <pre><code>git diff --stat </code></pre> <p>For showing exactly the line numbers that has been changed you can use</p> <pre class="lang-bash prettyprint-override"><code>git blame ...
<p><code>git diff --stat</code> will show you the output you get when committing stuff which is the one you are referring to I guess.</p> <pre><code>git diff --stat </code></pre> <p>For showing exactly the line numbers that has been changed you can use</p> <pre class="lang-bash prettyprint-override"><code>git blame ...
119, 606, 9033
diff, git, git-diff
<h1>Using git diff, how can I get added and modified lines numbers?</h1> <p>Assuming I have a text file</p> <pre><code>alex bob matrix will be removed git repo </code></pre> <p>and I have updated it to be</p> <pre><code>alex new line here another new line bob matrix git </code></pre> <p>Here, I have added lines num...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,982
git
# Using git diff, how can I get added and modified lines numbers? Assuming I have a text file ``` alex bob matrix will be removed git repo ``` and I have updated it to be ``` alex new line here another new line bob matrix git ``` Here, I have added lines number (2,3) and updated line number (6) How can I get thes...
`git diff --stat` will show you the output you get when committing stuff which is the one you are referring to I guess. ``` git diff --stat ``` For showing exactly the line numbers that has been changed you can use ``` git blame -p <file> | grep "Not Committed Yet" ``` And the line changed will be the last number b...
24022582
OSX 10.10 yosemite beta on git pull: git-sh-setup: No such file or directory
90
2014-06-03 18:41:26
<p>After upgrading to OSX 10.10 Yosemite Beta, running <code>git pull</code> is returning the following error:</p> <blockquote> <p>/Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory</p> </blockquote> <p>I've checked the referenced git-core directory a...
22,548
3,188,893
2015-01-29 09:03:20
24,051,529
100
2014-06-05 04:13:20
5,083
2014-07-15 16:39:13
https://stackoverflow.com/q/24022582
https://stackoverflow.com/a/24051529
<p>I think the cleanest solution for this for now is to change the initial command in your iTerm session to be</p> <pre><code>/usr/bin/login -f &lt;your user name&gt; </code></pre> <p>This fixes the issue for me.</p> <p>A further data point for analysis of the issue: It seems that in 10.10, multiple copies of the PA...
<p>I think the cleanest solution for this for now is to change the initial command in your iTerm session to be</p> <pre><code>/usr/bin/login -f &lt;your user name&gt; </code></pre> <p>This fixes the issue for me.</p> <p>A further data point for analysis of the issue: It seems that in 10.10, multiple copies of the PA...
119, 3791, 104811
git, osx-yosemite, zsh
<h1>OSX 10.10 yosemite beta on git pull: git-sh-setup: No such file or directory</h1> <p>After upgrading to OSX 10.10 Yosemite Beta, running <code>git pull</code> is returning the following error:</p> <blockquote> <p>/Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such fi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,983
git
# OSX 10.10 yosemite beta on git pull: git-sh-setup: No such file or directory After upgrading to OSX 10.10 Yosemite Beta, running `git pull` is returning the following error: > /Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory I've checked the refere...
I think the cleanest solution for this for now is to change the initial command in your iTerm session to be ``` /usr/bin/login -f <your user name> ``` This fixes the issue for me. A further data point for analysis of the issue: It seems that in 10.10, multiple copies of the PATH environment variable exist and subshe...
10130341
Go, go get, go install, local packages, and version control
70
2012-04-12 19:23:25
<p>I am having trouble understanding the workflow for creating a go project that has local packages.</p> <p>Say I create a new project, using git for version control, which has a main.go file and a tools.go file which will be in package utils. So I have a directory structure such as this:</p> <pre><code>/myproject/ ...
76,862
221,569
2020-04-23 14:05:01
10,142,340
100
2012-04-13 14:05:19
82,219
2012-04-13 14:05:19
https://stackoverflow.com/q/10130341
https://stackoverflow.com/a/10142340
<p>I've just written a short step-by-step guide on how I am using the new <a href="http://golang.org/cmd/go/">go tool</a> and <a href="http://github.com/">github.com</a>. You might find it useful:</p> <p><strong>1. Setup your GOPATH</strong></p> <p>You can set the environment variable <code>GOPATH</code> to any direc...
<p>I've just written a short step-by-step guide on how I am using the new <a href="http://golang.org/cmd/go/">go tool</a> and <a href="http://github.com/">github.com</a>. You might find it useful:</p> <p><strong>1. Setup your GOPATH</strong></p> <p>You can set the environment variable <code>GOPATH</code> to any direc...
119, 13613, 15627
git, go, package
<h1>Go, go get, go install, local packages, and version control</h1> <p>I am having trouble understanding the workflow for creating a go project that has local packages.</p> <p>Say I create a new project, using git for version control, which has a main.go file and a tools.go file which will be in package utils. So I h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,984
git
# Go, go get, go install, local packages, and version control I am having trouble understanding the workflow for creating a go project that has local packages. Say I create a new project, using git for version control, which has a main.go file and a tools.go file which will be in package utils. So I have a directory ...
I've just written a short step-by-step guide on how I am using the new [go tool](http://golang.org/cmd/go/) and [github.com](http://github.com/). You might find it useful: **1. Setup your GOPATH** You can set the environment variable `GOPATH` to any directory you like. If you have larger projects, it's probably a goo...
12694510
How to emulate git log --decorate's different colors per branch-type
67
2012-10-02 16:36:53
<p>In making my favorite git log view I've created this alias:</p> <p><code>graph = log --pretty=format:'%Cgreen%ad%Creset %C(yellow)%h%Creset%C(yellow)%d%Creset %s %C(cyan)[%an]%Creset %Cgreen(%ar)%Creset' --date=short --graph</code></p> <p>This creates an output like:</p> <p><img src="https://i.sstatic.net/Rokye.p...
6,533
230,422
2013-06-15 14:09:52
17,124,518
100
2013-06-15 14:09:52
55,948
2013-06-15 14:09:52
https://stackoverflow.com/q/12694510
https://stackoverflow.com/a/17124518
<p>Per <a href="https://stackoverflow.com/a/16844346/55948">https://stackoverflow.com/a/16844346/55948</a></p> <blockquote> <p>As of git 1.8.3 (May 24, 2013), you can use <code>%C(auto)</code> to decorate <code>%d</code> in the format string of <code>git log</code>.</p> <p>From the <a href="https://github.com...
<p>Per <a href="https://stackoverflow.com/a/16844346/55948">https://stackoverflow.com/a/16844346/55948</a></p> <blockquote> <p>As of git 1.8.3 (May 24, 2013), you can use <code>%C(auto)</code> to decorate <code>%d</code> in the format string of <code>git log</code>.</p> <p>From the <a href="https://github.com...
119, 32868
git, git-config
<h1>How to emulate git log --decorate's different colors per branch-type</h1> <p>In making my favorite git log view I've created this alias:</p> <p><code>graph = log --pretty=format:'%Cgreen%ad%Creset %C(yellow)%h%Creset%C(yellow)%d%Creset %s %C(cyan)[%an]%Creset %Cgreen(%ar)%Creset' --date=short --graph</code></p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,986
git
# How to emulate git log --decorate's different colors per branch-type In making my favorite git log view I've created this alias: `graph = log --pretty=format:'%Cgreen%ad%Creset %C(yellow)%h%Creset%C(yellow)%d%Creset %s %C(cyan)[%an]%Creset %Cgreen(%ar)%Creset' --date=short --graph` This creates an output like: ![...
Per <https://stackoverflow.com/a/16844346/55948> > As of git 1.8.3 (May 24, 2013), you can use `%C(auto)` to decorate > `%d` in the format string of `git log`. > > From the [release > notes](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt): > > ``` > * "git log --format" specifier learned %C(a...
14607584
Using vim for git commit messages broken after updating janus
51
2013-01-30 15:29:19
<p>After updating the janus vim distribution there appears to be a problem with using vim for commit messages. The best example of this is when doing a <code>git pull</code> to get someone else's changes. The vim editor is displayed, I type my commit message, I enter <kbd>:</kbd><kbd>w</kbd><kbd>q</kbd> but instead of ...
12,439
2,032,500
2017-06-07 19:40:53
14,607,585
100
2013-01-30 15:29:19
2,032,500
2017-06-07 19:40:53
https://stackoverflow.com/q/14607584
https://stackoverflow.com/a/14607585
<p>After a bit of googling, it turns out that the answer is to run the following:</p> <pre><code>git config --global core.editor $(which vim) </code></pre>
<p>After a bit of googling, it turns out that the answer is to run the following:</p> <pre><code>git config --global core.editor $(which vim) </code></pre>
119, 369, 370
git, macos, vim
<h1>Using vim for git commit messages broken after updating janus</h1> <p>After updating the janus vim distribution there appears to be a problem with using vim for commit messages. The best example of this is when doing a <code>git pull</code> to get someone else's changes. The vim editor is displayed, I type my commi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,988
git
# Using vim for git commit messages broken after updating janus After updating the janus vim distribution there appears to be a problem with using vim for commit messages. The best example of this is when doing a `git pull` to get someone else's changes. The vim editor is displayed, I type my commit message, I enter `...
After a bit of googling, it turns out that the answer is to run the following: ``` git config --global core.editor $(which vim) ```
23986685
Pull updates with git after cloned with --depth 1
93
2014-06-02 02:47:48
<p>This morning I made a shallow clone of the Linux sources</p> <pre><code>git clone --depth 1 https://github.com/torvalds/linux.git </code></pre> <p>which resulted in a <code>linux</code> folder of 851Mb.</p> <p>Now I would like to pull the latest changes, but</p> <pre><code>git pull </code></pre> <p>starts a see...
56,482
918,015
2022-11-18 13:15:57
23,987,039
99
2014-06-02 03:40:11
641,451
2017-03-26 13:27:40
https://stackoverflow.com/q/23986685
https://stackoverflow.com/a/23987039
<p>I think you can use <code>--depth 1</code> in <code>git pull</code> too, so it gets just what's needed for the newest commit in the repository.</p> <p>I don't know if the default behaviour is to pull everything missing, because my <code>git help pull</code> shows this option:</p> <pre><code>git pull --unshallow </...
<p>I think you can use <code>--depth 1</code> in <code>git pull</code> too, so it gets just what's needed for the newest commit in the repository.</p> <p>I don't know if the default behaviour is to pull everything missing, because my <code>git help pull</code> shows this option:</p> <pre><code>git pull --unshallow </...
119
git
<h1>Pull updates with git after cloned with --depth 1</h1> <p>This morning I made a shallow clone of the Linux sources</p> <pre><code>git clone --depth 1 https://github.com/torvalds/linux.git </code></pre> <p>which resulted in a <code>linux</code> folder of 851Mb.</p> <p>Now I would like to pull the latest changes, ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,990
git
# Pull updates with git after cloned with --depth 1 This morning I made a shallow clone of the Linux sources ``` git clone --depth 1 https://github.com/torvalds/linux.git ``` which resulted in a `linux` folder of 851Mb. Now I would like to pull the latest changes, but ``` git pull ``` starts a seemly huge downloa...
I think you can use `--depth 1` in `git pull` too, so it gets just what's needed for the newest commit in the repository. I don't know if the default behaviour is to pull everything missing, because my `git help pull` shows this option: ``` git pull --unshallow ``` or ``` git fetch --unshallow ``` > --unshallow >...
45338495
Fetch a single tag from remote repository
86
2017-07-26 22:31:18
<p>This command fetches <strong>all</strong> tags:</p> <pre><code>git fetch origin --tags </code></pre> <p>This command fetches a specific tag:</p> <pre><code>git fetch origin refs/tags/1.0.0 </code></pre> <p><strong>But</strong> that doesn't let me do:</p> <pre><code>git checkout tags/2.3.18 </code></pre> <p>How...
58,098
2,228,559
2020-04-28 14:17:17
45,338,695
99
2017-07-26 22:52:16
1,256,452
2017-07-26 22:52:16
https://stackoverflow.com/q/45338495
https://stackoverflow.com/a/45338695
<blockquote> <p><code>git fetch origin refs/tags/1.0.0</code></p> </blockquote> <p>This fails because it doesn't write a local reference: it obtains the remote's <code>refs/tags/1.0.0</code>, and any tag object(s), commits, etc., required to go with it; it drops those into <code>FETCH_HEAD</code> (as all <code>git f...
<blockquote> <p><code>git fetch origin refs/tags/1.0.0</code></p> </blockquote> <p>This fails because it doesn't write a local reference: it obtains the remote's <code>refs/tags/1.0.0</code>, and any tag object(s), commits, etc., required to go with it; it drops those into <code>FETCH_HEAD</code> (as all <code>git f...
119, 33720, 37230, 60718
git, git-checkout, git-fetch, git-tag
<h1>Fetch a single tag from remote repository</h1> <p>This command fetches <strong>all</strong> tags:</p> <pre><code>git fetch origin --tags </code></pre> <p>This command fetches a specific tag:</p> <pre><code>git fetch origin refs/tags/1.0.0 </code></pre> <p><strong>But</strong> that doesn't let me do:</p> <pre><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,991
git
# Fetch a single tag from remote repository This command fetches **all** tags: ``` git fetch origin --tags ``` This command fetches a specific tag: ``` git fetch origin refs/tags/1.0.0 ``` **But** that doesn't let me do: ``` git checkout tags/2.3.18 ``` How can I fetch a single tag and then perform a checkout?
> `git fetch origin refs/tags/1.0.0` This fails because it doesn't write a local reference: it obtains the remote's `refs/tags/1.0.0`, and any tag object(s), commits, etc., required to go with it; it drops those into `FETCH_HEAD` (as all `git fetch` commands always do); and ... that's it. It never creates reference `r...
9560184
Recover dangling blobs in Git
83
2012-03-05 00:18:20
<p>I did a &quot;git rm -rf .&quot; (trying to purge the cache of files I had removed after doing &quot;git add .&quot;) without thinking git would physically delete the files. I don't have an initial commit/branch yet.</p> <pre><code>$ git init $ git add . </code></pre> <p>I remember to add my &quot;.gitignore&quot;. ...
57,889
1,248,781
2021-08-31 01:33:44
9,560,317
99
2012-03-05 00:38:04
266,720
2012-03-05 00:51:21
https://stackoverflow.com/q/9560184
https://stackoverflow.com/a/9560317
<p>You can use <code>git show fce4a77b63b25abbc010859b4037589983820329</code>to see the content (or <code>git show fce4a &gt; somefile</code> to dump it to a file).</p> <p>File names are lost (unless there are also dangling trees or other sources of information like command history in <code>.bash_history</code>).</p> ...
<p>You can use <code>git show fce4a77b63b25abbc010859b4037589983820329</code>to see the content (or <code>git show fce4a &gt; somefile</code> to dump it to a file).</p> <p>File names are lost (unless there are also dangling trees or other sources of information like command history in <code>.bash_history</code>).</p> ...
119
git
<h1>Recover dangling blobs in Git</h1> <p>I did a &quot;git rm -rf .&quot; (trying to purge the cache of files I had removed after doing &quot;git add .&quot;) without thinking git would physically delete the files. I don't have an initial commit/branch yet.</p> <pre><code>$ git init $ git add . </code></pre> <p>I reme...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,992
git
# Recover dangling blobs in Git I did a "git rm -rf ." (trying to purge the cache of files I had removed after doing "git add .") without thinking git would physically delete the files. I don't have an initial commit/branch yet. ``` $ git init $ git add . ``` I remember to add my ".gitignore". Then, out of being laz...
You can use `git show fce4a77b63b25abbc010859b4037589983820329`to see the content (or `git show fce4a > somefile` to dump it to a file). File names are lost (unless there are also dangling trees or other sources of information like command history in `.bash_history`). If you can see (with `git ls-tree`) your root tre...
4550937
How to force update when doing git pull?
64
2010-12-29 01:53:20
<p>I'm doing git pull of an open source lib, I don't care what my local copy is I just want to update it with the origin's version.</p> <p>i.e. it can blow away my local changes.</p>
109,542
39,677
2021-12-06 03:37:24
4,550,966
99
2010-12-29 02:01:15
507,056
2010-12-29 02:01:15
https://stackoverflow.com/q/4550937
https://stackoverflow.com/a/4550966
<p>This should do the trick:</p> <pre><code>git reset --hard HEAD git pull </code></pre>
<p>This should do the trick:</p> <pre><code>git reset --hard HEAD git pull </code></pre>
119
git
<h1>How to force update when doing git pull?</h1> <p>I'm doing git pull of an open source lib, I don't care what my local copy is I just want to update it with the origin's version.</p> <p>i.e. it can blow away my local changes.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,993
git
# How to force update when doing git pull? I'm doing git pull of an open source lib, I don't care what my local copy is I just want to update it with the origin's version. i.e. it can blow away my local changes.
This should do the trick: ``` git reset --hard HEAD git pull ```
33172857
How do I force a subtree push to overwrite remote changes?
62
2015-10-16 14:24:39
<p>We use a subtree deployment a lá <a href="https://gist.github.com/cobyism/4730490">this Gist</a> to deploy a subdirectory of our <a href="http://yeoman.io/">Yeoman</a> project. In our case, the branch is called <em>production</em>, not <em>gh-pages</em>.</p> <p>This worked perfectly until yesterday when the Git ser...
21,785
1,457,116
2022-01-02 07:59:43
33,178,233
99
2015-10-16 19:29:02
1,457,116
2016-09-26 11:01:56
https://stackoverflow.com/q/33172857
https://stackoverflow.com/a/33178233
<p>The trick was to chain the subtree split into a forced push:</p> <pre><code>git push origin `git subtree split --prefix dist master`:production --force </code></pre> <p>I got this from the Addendum of <a href="http://clontz.org/blog/2014/05/08/git-subtree-push-for-deployment/" rel="noreferrer">http://clontz.org/bl...
<p>The trick was to chain the subtree split into a forced push:</p> <pre><code>git push origin `git subtree split --prefix dist master`:production --force </code></pre> <p>I got this from the Addendum of <a href="http://clontz.org/blog/2014/05/08/git-subtree-push-for-deployment/" rel="noreferrer">http://clontz.org/bl...
119, 68200, 83890
git, git-subtree, yeoman
<h1>How do I force a subtree push to overwrite remote changes?</h1> <p>We use a subtree deployment a lá <a href="https://gist.github.com/cobyism/4730490">this Gist</a> to deploy a subdirectory of our <a href="http://yeoman.io/">Yeoman</a> project. In our case, the branch is called <em>production</em>, not <em>gh-pages<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,994
git
# How do I force a subtree push to overwrite remote changes? We use a subtree deployment a lá [this Gist](https://gist.github.com/cobyism/4730490) to deploy a subdirectory of our [Yeoman](http://yeoman.io/) project. In our case, the branch is called *production*, not *gh-pages*. This worked perfectly until yesterday ...
The trick was to chain the subtree split into a forced push: ``` git push origin `git subtree split --prefix dist master`:production --force ``` I got this from the Addendum of <http://clontz.org/blog/2014/05/08/git-subtree-push-for-deployment/>, who actually references [this](https://stackoverflow.com/a/13403588/145...
38029810
How to get deleted files back with git pull?
55
2016-06-25 15:04:56
<p>I had up to date repository. Then I had deleted several files and this was mistake. I would like to get fresh repository back. I do</p> <pre><code>$ git pull origin master </code></pre> <p>And expect to get everything from server, but getting message that everything is up to date.</p> <p>How to get my sources fro...
103,585
1,501,700
2024-01-06 19:18:34
38,029,836
99
2016-06-25 15:08:59
4,233,593
2022-08-09 16:55:00
https://stackoverflow.com/q/38029810
https://stackoverflow.com/a/38029836
<p>You can reset local branch to what's at remote</p> <pre><code>git reset --hard origin/main </code></pre>
<p>You can reset local branch to what's at remote</p> <pre><code>git reset --hard origin/main </code></pre>
119, 493
backup, git
<h1>How to get deleted files back with git pull?</h1> <p>I had up to date repository. Then I had deleted several files and this was mistake. I would like to get fresh repository back. I do</p> <pre><code>$ git pull origin master </code></pre> <p>And expect to get everything from server, but getting message that every...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,995
git
# How to get deleted files back with git pull? I had up to date repository. Then I had deleted several files and this was mistake. I would like to get fresh repository back. I do ``` $ git pull origin master ``` And expect to get everything from server, but getting message that everything is up to date. How to get ...
You can reset local branch to what's at remote ``` git reset --hard origin/main ```
5009096
Files showing as modified directly after a Git clone
266
2011-02-15 20:24:49
<p>I'm having an issue with a repository at the moment, and though my Git-fu is usually good, I can't seem to solve this issue.</p> <p>When I clone this repository, then <code>cd</code> into the repository, <code>git status</code> shows several files as changed. Note: I haven't opened the repository in any editor or a...
134,661
261,393
2025-02-04 14:09:32
5,022,417
98
2011-02-16 21:35:48
261,393
2019-04-23 20:10:32
https://stackoverflow.com/q/5009096
https://stackoverflow.com/a/5022417
<p>I got it. All the other developers are on Ubuntu (I think) and thus have case-sensitive file systems. I, however, do not (as I'm on a Mac). Indeed, all the files had lowercase twins when I took a look at them using <code>git ls-tree HEAD &lt;path&gt;</code>.</p> <p>I'll get one of them to sort it out.</p>
<p>I got it. All the other developers are on Ubuntu (I think) and thus have case-sensitive file systems. I, however, do not (as I'm on a Mac). Indeed, all the files had lowercase twins when I took a look at them using <code>git ls-tree HEAD &lt;path&gt;</code>.</p> <p>I'll get one of them to sort it out.</p>
119, 34099
git, git-clone
<h1>Files showing as modified directly after a Git clone</h1> <p>I'm having an issue with a repository at the moment, and though my Git-fu is usually good, I can't seem to solve this issue.</p> <p>When I clone this repository, then <code>cd</code> into the repository, <code>git status</code> shows several files as cha...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,996
git
# Files showing as modified directly after a Git clone I'm having an issue with a repository at the moment, and though my Git-fu is usually good, I can't seem to solve this issue. When I clone this repository, then `cd` into the repository, `git status` shows several files as changed. Note: I haven't opened the repos...
I got it. All the other developers are on Ubuntu (I think) and thus have case-sensitive file systems. I, however, do not (as I'm on a Mac). Indeed, all the files had lowercase twins when I took a look at them using `git ls-tree HEAD <path>`. I'll get one of them to sort it out.
10935226
Git Interactive Merge?
101
2012-06-07 15:44:36
<p>I have two branches with the exact same file (incase you are wondering it is a .sql file) and I want to interactively merge it.</p> <p>Pretty much I want to open up a diff program like I do when there is a conflict (or command line) and select exactly what lines go where.</p> <p>Is there anyway to do this?</p>
95,891
150,062
2021-09-14 01:42:06
10,935,340
98
2012-06-07 15:51:29
90,002
2016-04-26 16:38:59
https://stackoverflow.com/q/10935226
https://stackoverflow.com/a/10935340
<p>Yes, but it will mostly be by manually making that happen. You'll tell Git you're merging the two relevant branches, but that it shouldn't try to commit the result on its own, (<em>edited to add:</em> nor fast-forward if it thinks the merge is trivial):</p> <pre><code>git merge --no-commit --no-ff branch-to-merge <...
<p>Yes, but it will mostly be by manually making that happen. You'll tell Git you're merging the two relevant branches, but that it shouldn't try to commit the result on its own, (<em>edited to add:</em> nor fast-forward if it thinks the merge is trivial):</p> <pre><code>git merge --no-commit --no-ff branch-to-merge <...
119, 456
git, version-control
<h1>Git Interactive Merge?</h1> <p>I have two branches with the exact same file (incase you are wondering it is a .sql file) and I want to interactively merge it.</p> <p>Pretty much I want to open up a diff program like I do when there is a conflict (or command line) and select exactly what lines go where.</p> <p>Is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
15,999
git
# Git Interactive Merge? I have two branches with the exact same file (incase you are wondering it is a .sql file) and I want to interactively merge it. Pretty much I want to open up a diff program like I do when there is a conflict (or command line) and select exactly what lines go where. Is there anyway to do this...
Yes, but it will mostly be by manually making that happen. You'll tell Git you're merging the two relevant branches, but that it shouldn't try to commit the result on its own, (*edited to add:* nor fast-forward if it thinks the merge is trivial): ``` git merge --no-commit --no-ff branch-to-merge ``` Then you'll ask g...
38837705
What is the difference between 'origin' and 'remote' in git commands?
92
2016-08-08 20:10:43
<p>In git lingo, are <code>origin</code> and <code>remote</code> the same thing? Or does <code>origin</code> refer to the local directory?</p> <p>In the case of <code>git push -u origin master</code>: Which of the following interpretation is correct?</p> <ol> <li>"push everything upstream to the remote repo called 'o...
53,360
5,965,865
2016-08-09 21:04:21
38,838,013
98
2016-08-08 20:31:11
123,487
2016-08-09 21:04:21
https://stackoverflow.com/q/38837705
https://stackoverflow.com/a/38838013
<p>In git lingo <code>origin</code> is just the default name for a remote from which a repo was originally cloned. It might equally have been called <code>source</code> or <code>remote1</code> or just <code>remote</code>.</p> <p>Remember that <code>git</code> is a peer-to-peer, distributed system, not one with any bu...
<p>In git lingo <code>origin</code> is just the default name for a remote from which a repo was originally cloned. It might equally have been called <code>source</code> or <code>remote1</code> or just <code>remote</code>.</p> <p>Remember that <code>git</code> is a peer-to-peer, distributed system, not one with any bu...
119, 41346
git, git-remote
<h1>What is the difference between 'origin' and 'remote' in git commands?</h1> <p>In git lingo, are <code>origin</code> and <code>remote</code> the same thing? Or does <code>origin</code> refer to the local directory?</p> <p>In the case of <code>git push -u origin master</code>: Which of the following interpretation i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,000
git
# What is the difference between 'origin' and 'remote' in git commands? In git lingo, are `origin` and `remote` the same thing? Or does `origin` refer to the local directory? In the case of `git push -u origin master`: Which of the following interpretation is correct? 1. "push everything upstream to the remote repo ...
In git lingo `origin` is just the default name for a remote from which a repo was originally cloned. It might equally have been called `source` or `remote1` or just `remote`. Remember that `git` is a peer-to-peer, distributed system, not one with any built-in notion of client/server, master/slave, parent/child relatio...
7241678
How to prevent many git conflicts when rebasing many commits?
92
2011-08-30 10:14:32
<p>Story: in the middle of a project my colleague created a new branch from <em>master</em> and started doing her heavy re-factoring work. I created my branch from <em>master</em> and started doing new stuff on the page. We are committing regularly, but only I can rebase code to <em>master</em> (because colleagues cha...
46,653
473,040
2025-09-02 06:06:55
7,241,744
98
2011-08-30 10:20:56
223,092
2025-09-02 06:06:55
https://stackoverflow.com/q/7241678
https://stackoverflow.com/a/7241744
<p>Fortunately, git has a mechanism for dealing with exactly this problem called <code>git rerere</code> - essentially, if you have <code>git rerere</code> enabled, then each time your resolve a conflict the fact that you resolved that exact conflict in a particular way is remembered. If the same conflict comes up aga...
<p>Fortunately, git has a mechanism for dealing with exactly this problem called <code>git rerere</code> - essentially, if you have <code>git rerere</code> enabled, then each time your resolve a conflict the fact that you resolved that exact conflict in a particular way is remembered. If the same conflict comes up aga...
119, 8974, 29934, 106113
git, git-merge-conflict, git-rebase, rebase
<h1>How to prevent many git conflicts when rebasing many commits?</h1> <p>Story: in the middle of a project my colleague created a new branch from <em>master</em> and started doing her heavy re-factoring work. I created my branch from <em>master</em> and started doing new stuff on the page. We are committing regularly...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,001
git
# How to prevent many git conflicts when rebasing many commits? Story: in the middle of a project my colleague created a new branch from *master* and started doing her heavy re-factoring work. I created my branch from *master* and started doing new stuff on the page. We are committing regularly, but only I can rebase ...
Fortunately, git has a mechanism for dealing with exactly this problem called `git rerere` - essentially, if you have `git rerere` enabled, then each time your resolve a conflict the fact that you resolved that exact conflict in a particular way is remembered. If the same conflict comes up again, the same resolution is...
922210
Unable to Git-push master to Github - 'origin' does not appear to be a git repository / permission denied
85
2009-05-28 17:36:45
<p>This question is related to my problem in <a href="https://stackoverflow.com/questions/904353/unable-to-understand-git-branch-merge-and-rebase/907799#907799">understanding rebase, branch and merge</a>, and to the problem</p> <blockquote> <p>How can you commit to your github account as you have a teamMate in your ...
116,252
54,964
2018-07-21 14:14:47
922,461
98
2009-05-28 18:27:27
6,309
2011-05-18 16:19:13
https://stackoverflow.com/q/922210
https://stackoverflow.com/a/922461
<p>What does</p> <pre><code>$ git config --get-regexp '^(remote|branch)\.' </code></pre> <p>returns (executed within your git repository) ?</p> <p>Origin is just a default naming convention for referring to a remote Git repository.</p> <p>If it does not refer to GitHub (but rather a path to your teammate repository, pa...
<p>What does</p> <pre><code>$ git config --get-regexp '^(remote|branch)\.' </code></pre> <p>returns (executed within your git repository) ?</p> <p>Origin is just a default naming convention for referring to a remote Git repository.</p> <p>If it does not refer to GitHub (but rather a path to your teammate repository, pa...
119, 456, 4236
git, push, version-control
<h1>Unable to Git-push master to Github - 'origin' does not appear to be a git repository / permission denied</h1> <p>This question is related to my problem in <a href="https://stackoverflow.com/questions/904353/unable-to-understand-git-branch-merge-and-rebase/907799#907799">understanding rebase, branch and merge</a>, ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,002
git
# Unable to Git-push master to Github - 'origin' does not appear to be a git repository / permission denied This question is related to my problem in [understanding rebase, branch and merge](https://stackoverflow.com/questions/904353/unable-to-understand-git-branch-merge-and-rebase/907799#907799), and to the problem ...
What does ``` $ git config --get-regexp '^(remote|branch)\.' ``` returns (executed within your git repository) ? Origin is just a default naming convention for referring to a remote Git repository. If it does not refer to GitHub (but rather a path to your teammate repository, path which may no longer be valid or av...
9242844
Aborting `git stash apply`
80
2012-02-11 18:29:16
<p>I regret having applied a stash (wrong branch). How can I undo this and have my stash back to my stash list in order to apply it later on the right branch?</p>
81,682
133,327
2025-05-22 18:38:20
9,242,872
98
2012-02-11 18:32:22
1,133,199
2025-05-22 18:38:20
https://stackoverflow.com/q/9242844
https://stackoverflow.com/a/9242872
<p>If you had uncommitted changes in your working space before you did the git stash apply, there is no generic answer.</p> <p><strong>But if your working space was clean</strong> (no uncommitted changes) before you did the git stash, one of these two cases should help you:</p> <h1>If you did not commit the applied sta...
<p>If you had uncommitted changes in your working space before you did the git stash apply, there is no generic answer.</p> <p><strong>But if your working space was clean</strong> (no uncommitted changes) before you did the git stash, one of these two cases should help you:</p> <h1>If you did not commit the applied sta...
119, 13091
git, git-stash
<h1>Aborting `git stash apply`</h1> <p>I regret having applied a stash (wrong branch). How can I undo this and have my stash back to my stash list in order to apply it later on the right branch?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,003
git
# Aborting `git stash apply` I regret having applied a stash (wrong branch). How can I undo this and have my stash back to my stash list in order to apply it later on the right branch?
If you had uncommitted changes in your working space before you did the git stash apply, there is no generic answer. **But if your working space was clean** (no uncommitted changes) before you did the git stash, one of these two cases should help you: # If you did not commit the applied stash If you **haven't commit...
110205
Want to download a Git repository, what do I need (windows machine)?
72
2008-09-21 03:53:57
<p>I want to download this open source application, and they are using Git. What do I need to download the code base?</p> <p><b>Update</b> How do I change the working directory when I am using Git Bash? (I want to download the repo at a certain directory, using pwd tells me I will be downloading the repo where I don...
144,932
1,368
2014-08-19 15:08:37
110,209
98
2008-09-21 03:55:47
893
2008-09-21 03:55:47
https://stackoverflow.com/q/110205
https://stackoverflow.com/a/110209
<p>Download <a href="http://code.google.com/p/msysgit/" rel="noreferrer">Git on Msys</a>. Then:</p> <pre><code>git clone git://project.url.here </code></pre>
<p>Download <a href="http://code.google.com/p/msysgit/" rel="noreferrer">Git on Msys</a>. Then:</p> <pre><code>git clone git://project.url.here </code></pre>
64, 119
git, windows
<h1>Want to download a Git repository, what do I need (windows machine)?</h1> <p>I want to download this open source application, and they are using Git. What do I need to download the code base?</p> <p><b>Update</b> How do I change the working directory when I am using Git Bash? (I want to download the repo at a ce...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,004
git
# Want to download a Git repository, what do I need (windows machine)? I want to download this open source application, and they are using Git. What do I need to download the code base? **Update** How do I change the working directory when I am using Git Bash? (I want to download the repo at a certain directory, usin...
Download [Git on Msys](http://code.google.com/p/msysgit/). Then: ``` git clone git://project.url.here ```
8611486
How to get the last commit date for a bunch of files in Git?
70
2011-12-23 01:51:33
<p>What's the simplest one-liner to get the last commit date for a bunch of files in a Git repository (i.e., for each file, the date of the last commit that changed that file)?</p> <p>The context for this is that I'm using other Bash commands to find a long list of files matching some criteria, and I'd like to just pi...
31,480
329,781
2023-12-01 17:24:16
8,611,514
98
2011-12-23 01:56:12
893
2011-12-23 01:56:12
https://stackoverflow.com/q/8611486
https://stackoverflow.com/a/8611514
<p>The following command will be helpful:</p> <pre><code>git log -1 --format=%cd filename.txt </code></pre> <p>This will print the latest change date for one file. The <code>-1</code> shows one log entry (the most recent), and <code>--format=%cd</code> shows the commit date. See the documentation for <a href="http://...
<p>The following command will be helpful:</p> <pre><code>git log -1 --format=%cd filename.txt </code></pre> <p>This will print the latest change date for one file. The <code>-1</code> shows one log entry (the most recent), and <code>--format=%cd</code> shows the commit date. See the documentation for <a href="http://...
119
git
<h1>How to get the last commit date for a bunch of files in Git?</h1> <p>What's the simplest one-liner to get the last commit date for a bunch of files in a Git repository (i.e., for each file, the date of the last commit that changed that file)?</p> <p>The context for this is that I'm using other Bash commands to fin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,005
git
# How to get the last commit date for a bunch of files in Git? What's the simplest one-liner to get the last commit date for a bunch of files in a Git repository (i.e., for each file, the date of the last commit that changed that file)? The context for this is that I'm using other Bash commands to find a long list of...
The following command will be helpful: ``` git log -1 --format=%cd filename.txt ``` This will print the latest change date for one file. The `-1` shows one log entry (the most recent), and `--format=%cd` shows the commit date. See the documentation for [`git-log`](http://schacon.github.com/git/git-log.html) for a ful...
3662543
Is there any way to undo the effects of "git revert head"?
67
2010-09-07 20:40:12
<p>I've accidentally run the command against the wrong branch in my repository - is there a way to undo this change?</p>
60,971
173,773
2018-03-24 12:18:53
3,662,556
98
2010-09-07 20:41:59
110,081
2010-09-07 20:41:59
https://stackoverflow.com/q/3662543
https://stackoverflow.com/a/3662556
<p><code>git revert</code> just creates a new commit -- you can "remove" it with <code>git reset --hard HEAD^</code> (be more careful with it, though!)</p>
<p><code>git revert</code> just creates a new commit -- you can "remove" it with <code>git reset --hard HEAD^</code> (be more careful with it, though!)</p>
119, 5766, 12309
git, revert, undo
<h1>Is there any way to undo the effects of "git revert head"?</h1> <p>I've accidentally run the command against the wrong branch in my repository - is there a way to undo this change?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,007
git
# Is there any way to undo the effects of "git revert head"? I've accidentally run the command against the wrong branch in my repository - is there a way to undo this change?
`git revert` just creates a new commit -- you can "remove" it with `git reset --hard HEAD^` (be more careful with it, though!)
17416691
How can I copy files from a branch to another using git?
66
2013-07-02 02:54:05
<p>I have a git repository with two branches: <code>master</code> and <code>gh-pages</code>. If I want to copy a file <code>foo</code> from <code>master</code> to <code>gh-pages</code> without merging them. What command should I use? Many thanks.</p>
48,571
2,398,070
2020-03-06 11:41:38
17,416,774
98
2013-07-02 03:05:09
1,646,106
2013-07-02 03:05:09
https://stackoverflow.com/q/17416691
https://stackoverflow.com/a/17416774
<p>You can:</p> <pre><code>git checkout gh-pages git checkout master foo git commit -m 'Add file foo to gh-pages.' </code></pre>
<p>You can:</p> <pre><code>git checkout gh-pages git checkout master foo git commit -m 'Add file foo to gh-pages.' </code></pre>
119
git
<h1>How can I copy files from a branch to another using git?</h1> <p>I have a git repository with two branches: <code>master</code> and <code>gh-pages</code>. If I want to copy a file <code>foo</code> from <code>master</code> to <code>gh-pages</code> without merging them. What command should I use? Many thanks.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,008
git
# How can I copy files from a branch to another using git? I have a git repository with two branches: `master` and `gh-pages`. If I want to copy a file `foo` from `master` to `gh-pages` without merging them. What command should I use? Many thanks.
You can: ``` git checkout gh-pages git checkout master foo git commit -m 'Add file foo to gh-pages.' ```
3882838
What's an easy way to detect modified files in a Git workspace?
61
2010-10-07 14:45:04
<p>During make, I create string fields which I embedded in the linked output. Very useful. </p> <p>Other than a complex <code>sed</code>/<code>grep</code> parsing of the <code>git status</code> command, how can I easily determine if files in the workspace have been modified according to <code>git</code>?</p>
41,443
32,836
2022-10-28 03:38:39
3,899,339
98
2010-10-10 06:53:49
193,688
2010-10-10 06:53:49
https://stackoverflow.com/q/3882838
https://stackoverflow.com/a/3899339
<p>If you just want a plain “Are there any differences from HEAD?”:</p> <pre><code>git diff-index --quiet HEAD </code></pre> <p>If the exit code is 0, then there were no differences.</p> <p>If you want “What files have changed from HEAD?”:</p> <pre><code>git diff-index --name-only HEAD </code></pre> <p>If you want...
<p>If you just want a plain “Are there any differences from HEAD?”:</p> <pre><code>git diff-index --quiet HEAD </code></pre> <p>If the exit code is 0, then there were no differences.</p> <p>If you want “What files have changed from HEAD?”:</p> <pre><code>git diff-index --name-only HEAD </code></pre> <p>If you want...
119, 1783, 4301
build-process, git, makefile
<h1>What's an easy way to detect modified files in a Git workspace?</h1> <p>During make, I create string fields which I embedded in the linked output. Very useful. </p> <p>Other than a complex <code>sed</code>/<code>grep</code> parsing of the <code>git status</code> command, how can I easily determine if files in th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,009
git
# What's an easy way to detect modified files in a Git workspace? During make, I create string fields which I embedded in the linked output. Very useful. Other than a complex `sed`/`grep` parsing of the `git status` command, how can I easily determine if files in the workspace have been modified according to `git`?
If you just want a plain “Are there any differences from HEAD?”: ``` git diff-index --quiet HEAD ``` If the exit code is 0, then there were no differences. If you want “What files have changed from HEAD?”: ``` git diff-index --name-only HEAD ``` If you want “What files have changed from HEAD, and in what ways have...
24310554
How do I squash specific commits on a local branch?
54
2014-06-19 15:34:06
<p>I can find a few answers out there that come close to what I want, but I'm afraid I'm not really experienced enough with Git to exactly understand how to achieve what I want.</p> <p>Given a local branch with commits A-B-C-D-E-F-G-H-I-J on it, I want to squash some of the commits together so that I end up with, for ...
54,190
360,424
2020-04-16 12:10:30
24,310,701
98
2014-06-19 15:40:40
283,078
2020-02-28 15:26:23
https://stackoverflow.com/q/24310554
https://stackoverflow.com/a/24310701
<p>You can do this with <code>rebase</code>. Assuming commits A–J are on a local branch <code>branchname</code> built on top of <code>master</code>, then you can do this:</p> <pre><code>git checkout branchname git rebase -i master </code></pre> <p>You'll be presented with an interactive window like this:</p> <pre><c...
<p>You can do this with <code>rebase</code>. Assuming commits A–J are on a local branch <code>branchname</code> built on top of <code>master</code>, then you can do this:</p> <pre><code>git checkout branchname git rebase -i master </code></pre> <p>You'll be presented with an interactive window like this:</p> <pre><c...
119
git
<h1>How do I squash specific commits on a local branch?</h1> <p>I can find a few answers out there that come close to what I want, but I'm afraid I'm not really experienced enough with Git to exactly understand how to achieve what I want.</p> <p>Given a local branch with commits A-B-C-D-E-F-G-H-I-J on it, I want to sq...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,010
git
# How do I squash specific commits on a local branch? I can find a few answers out there that come close to what I want, but I'm afraid I'm not really experienced enough with Git to exactly understand how to achieve what I want. Given a local branch with commits A-B-C-D-E-F-G-H-I-J on it, I want to squash some of the...
You can do this with `rebase`. Assuming commits A–J are on a local branch `branchname` built on top of `master`, then you can do this: ``` git checkout branchname git rebase -i master ``` You'll be presented with an interactive window like this: ``` pick A Commit message A pick B Commit message B pick C Commit messa...
26005031
What does GIT PUSH do exactly?
49
2014-09-23 21:30:16
<p>I can't seem to find a good explanation of this.</p> <p>I know what <strong>git pull</strong> does:</p> <p>1) a <strong>fetch</strong>, i.e. all the extra commits from the server are copied into the local repo and the <em>origin/master</em> branch pointer moves to the end of the commit chain</p> <p>2) a <strong>m...
44,833
1,646,170
2019-12-02 13:01:05
26,005,964
98
2014-09-23 22:54:51
1,256,452
2014-09-23 22:54:51
https://stackoverflow.com/q/26005031
https://stackoverflow.com/a/26005964
<p>Assuming you already understand git's "objects" model (your commits and files and so on are all just "objects in the git database", with "loose" objects—those not packed up to save space—stored in <code>.git/objects/12/34567...</code> and the like)...</p> <p>You are correct: <code>git fetch</code> retrieves objects...
<p>Assuming you already understand git's "objects" model (your commits and files and so on are all just "objects in the git database", with "loose" objects—those not packed up to save space—stored in <code>.git/objects/12/34567...</code> and the like)...</p> <p>You are correct: <code>git fetch</code> retrieves objects...
119, 28898
git, git-push
<h1>What does GIT PUSH do exactly?</h1> <p>I can't seem to find a good explanation of this.</p> <p>I know what <strong>git pull</strong> does:</p> <p>1) a <strong>fetch</strong>, i.e. all the extra commits from the server are copied into the local repo and the <em>origin/master</em> branch pointer moves to the end of...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,012
git
# What does GIT PUSH do exactly? I can't seem to find a good explanation of this. I know what **git pull** does: 1) a **fetch**, i.e. all the extra commits from the server are copied into the local repo and the *origin/master* branch pointer moves to the end of the commit chain 2) a **merge** of the *origin/master*...
Assuming you already understand git's "objects" model (your commits and files and so on are all just "objects in the git database", with "loose" objects—those not packed up to save space—stored in `.git/objects/12/34567...` and the like)... You are correct: `git fetch` retrieves objects "they" (`origin`, in this case)...
3672073
How to merge the current branch into another branch
193
2010-09-08 21:32:13
<p>I have two branches, master and dev. I always work on dev and only check code into the master branch once it's been approved for production use. When I do so, I have to do the following:</p> <pre><code>git checkout master git merge dev git checkout dev </code></pre> <p>That's awfully verbose, and since I do it fre...
93,956
34,942
2019-08-13 07:10:16
8,333,165
97
2011-11-30 21:28:17
1,074,270
2017-10-04 17:57:44
https://stackoverflow.com/q/3672073
https://stackoverflow.com/a/8333165
<p><strong>1.</strong> Add a remote alias for your local repository, ex:</p> <pre><code>git remote add self file:///path/to/your/repository </code></pre> <p>(Or on windows <code>git remote add self C:\path\to\your\repository</code>)</p> <p><strong>2.</strong> Push to the self remote, ex:</p> <pre><code>git push sel...
<p><strong>1.</strong> Add a remote alias for your local repository, ex:</p> <pre><code>git remote add self file:///path/to/your/repository </code></pre> <p>(Or on windows <code>git remote add self C:\path\to\your\repository</code>)</p> <p><strong>2.</strong> Push to the self remote, ex:</p> <pre><code>git push sel...
119, 456
git, version-control
<h1>How to merge the current branch into another branch</h1> <p>I have two branches, master and dev. I always work on dev and only check code into the master branch once it's been approved for production use. When I do so, I have to do the following:</p> <pre><code>git checkout master git merge dev git checkout dev </...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,013
git
# How to merge the current branch into another branch I have two branches, master and dev. I always work on dev and only check code into the master branch once it's been approved for production use. When I do so, I have to do the following: ``` git checkout master git merge dev git checkout dev ``` That's awfully ve...
**1.** Add a remote alias for your local repository, ex: ``` git remote add self file:///path/to/your/repository ``` (Or on windows `git remote add self C:\path\to\your\repository`) **2.** Push to the self remote, ex: ``` git push self dev:master ```
16386323
Following git-flow how should you handle a hotfix of an earlier release?
120
2013-05-05 15:53:35
<p>If you try to follow the git-flow branching model, <a href="http://nvie.com/posts/a-successful-git-branching-model/">documented here</a> and with <a href="https://github.com/nvie/gitflow">tools here</a>, how should you handle this situation:</p> <p>You have made a 1.0 release and a 2.0 release. Then you need to mak...
53,844
46,194
2018-12-20 16:53:22
33,052,352
97
2015-10-10 09:20:58
46,194
2015-10-10 09:20:58
https://stackoverflow.com/q/16386323
https://stackoverflow.com/a/33052352
<p>It seems that there is a concept of a "support" branch in git flow. This is used to add a hotfix to an earlier release.</p> <p><a href="https://groups.google.com/d/msg/gitflow-users/I9sErOSzYzE/AwVH06CuKT0J">This thread has more information</a>, with these examples:</p> <pre><code>git checkout 6.0 git checkout -b ...
<p>It seems that there is a concept of a "support" branch in git flow. This is used to add a hotfix to an earlier release.</p> <p><a href="https://groups.google.com/d/msg/gitflow-users/I9sErOSzYzE/AwVH06CuKT0J">This thread has more information</a>, with these examples:</p> <pre><code>git checkout 6.0 git checkout -b ...
119, 1879, 2923, 64339
branch, git, git-flow, hotfix
<h1>Following git-flow how should you handle a hotfix of an earlier release?</h1> <p>If you try to follow the git-flow branching model, <a href="http://nvie.com/posts/a-successful-git-branching-model/">documented here</a> and with <a href="https://github.com/nvie/gitflow">tools here</a>, how should you handle this situ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,014
git
# Following git-flow how should you handle a hotfix of an earlier release? If you try to follow the git-flow branching model, [documented here](http://nvie.com/posts/a-successful-git-branching-model/) and with [tools here](https://github.com/nvie/gitflow), how should you handle this situation: You have made a 1.0 rel...
It seems that there is a concept of a "support" branch in git flow. This is used to add a hotfix to an earlier release. [This thread has more information](https://groups.google.com/d/msg/gitflow-users/I9sErOSzYzE/AwVH06CuKT0J), with these examples: ``` git checkout 6.0 git checkout -b support/6.x git checkout -b hotf...
27417656
Should diff3 be default conflictstyle on git?
104
2014-12-11 07:42:20
<p>Recently I enabled diff3 and it's much easier to resolve conflict now.</p> <p>Previously in some cases I had to check the log to see why people did this and that to do the merge. But with diff3 the information is displayed all in one place</p> <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD THIS IS USEFUL ||||||| mer...
32,277
1,822,937
2023-09-08 10:58:41
27,417,871
97
2014-12-11 07:57:22
6,309
2021-12-17 01:21:25
https://stackoverflow.com/q/27417656
https://stackoverflow.com/a/27417871
<p>For other readers (and <a href="http://psung.blogspot.fr/2011/02/reducing-merge-headaches-git-meets.html" rel="noreferrer">from this article</a>):</p> <blockquote> <p>git has an option to display merge conflicts in <code>diff3</code> format (by default it only displays the two files to be merged). You can enable it ...
<p>For other readers (and <a href="http://psung.blogspot.fr/2011/02/reducing-merge-headaches-git-meets.html" rel="noreferrer">from this article</a>):</p> <blockquote> <p>git has an option to display merge conflicts in <code>diff3</code> format (by default it only displays the two files to be merged). You can enable it ...
119, 9033, 30103
diff3, git, git-diff
<h1>Should diff3 be default conflictstyle on git?</h1> <p>Recently I enabled diff3 and it's much easier to resolve conflict now.</p> <p>Previously in some cases I had to check the log to see why people did this and that to do the merge. But with diff3 the information is displayed all in one place</p> <pre><code>&lt;&...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,015
git
# Should diff3 be default conflictstyle on git? Recently I enabled diff3 and it's much easier to resolve conflict now. Previously in some cases I had to check the log to see why people did this and that to do the merge. But with diff3 the information is displayed all in one place ``` <<<<<<< HEAD THIS IS USEFUL ||||...
For other readers (and [from this article](http://psung.blogspot.fr/2011/02/reducing-merge-headaches-git-meets.html)): > git has an option to display merge conflicts in `diff3` format (by default it only displays the two files to be merged). You can enable it like so: ``` git config --global merge.conflictstyle diff3...
18268986
git: how to push messages added by git notes to the central git server?
82
2013-08-16 08:27:42
<p>it seems like there is no proper documentation regarding git notes. I have added some notes to one of the commit using git notes add command. but when i push the commit, and later do a separate clone, i dont see the note message there. Is there a way to push all the note messages added via git notes command?</p>
21,279
2,663,585
2024-09-19 20:36:23
18,269,026
97
2013-08-16 08:29:55
1,084,945
2024-08-30 10:26:17
https://stackoverflow.com/q/18268986
https://stackoverflow.com/a/18269026
<p>Push all notes:</p> <pre><code>git push &lt;remote&gt; 'refs/notes/*' </code></pre> <p>Fetch all notes:</p> <pre><code>git fetch origin 'refs/notes/*:refs/notes/*' </code></pre> <p>[<a href="https://web.archive.org/web/20180121193320/http://git-scm.com/blog/2010/08/25/notes.html" rel="noreferrer">[git-scm.org] (arch...
<p>Push all notes:</p> <pre><code>git push &lt;remote&gt; 'refs/notes/*' </code></pre> <p>Fetch all notes:</p> <pre><code>git fetch origin 'refs/notes/*:refs/notes/*' </code></pre> <p>[<a href="https://web.archive.org/web/20180121193320/http://git-scm.com/blog/2010/08/25/notes.html" rel="noreferrer">[git-scm.org] (arch...
119, 33720, 88239
git, git-fetch, git-notes
<h1>git: how to push messages added by git notes to the central git server?</h1> <p>it seems like there is no proper documentation regarding git notes. I have added some notes to one of the commit using git notes add command. but when i push the commit, and later do a separate clone, i dont see the note message there. ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,016
git
# git: how to push messages added by git notes to the central git server? it seems like there is no proper documentation regarding git notes. I have added some notes to one of the commit using git notes add command. but when i push the commit, and later do a separate clone, i dont see the note message there. Is there ...
Push all notes: ``` git push <remote> 'refs/notes/*' ``` Fetch all notes: ``` git fetch origin 'refs/notes/*:refs/notes/*' ``` [[[git-scm.org] (archive)](https://web.archive.org/web/20180121193320/http://git-scm.com/blog/2010/08/25/notes.html)] A word of warning: do not use `git pull` in place of `git fetch` (that...
14381044
How do I change a git commit message in Bitbucket?
80
2013-01-17 14:18:50
<p>I need to change an old git commit message in Bitbucket. I tried <code>git rebase -i</code> and reworded my message, but when I pulled and committed it just kept the old message in Bitbucket and merged my changes in.</p>
152,779
611,750
2025-10-05 16:29:25
41,253,332
97
2016-12-21 00:23:34
454,023
2018-03-25 23:59:18
https://stackoverflow.com/q/14381044
https://stackoverflow.com/a/41253332
<p>It's basically 4 step process. But a bit risky if multiple team member are working on the same branch and have their own copies. (If you are the only one working on it, go for it)</p> <p>This git manual explains it beautifully: <a href="https://help.github.com/articles/changing-a-commit-message/#amending-older-or-m...
<p>It's basically 4 step process. But a bit risky if multiple team member are working on the same branch and have their own copies. (If you are the only one working on it, go for it)</p> <p>This git manual explains it beautifully: <a href="https://help.github.com/articles/changing-a-commit-message/#amending-older-or-m...
119, 8337
bitbucket, git
<h1>How do I change a git commit message in Bitbucket?</h1> <p>I need to change an old git commit message in Bitbucket. I tried <code>git rebase -i</code> and reworded my message, but when I pulled and committed it just kept the old message in Bitbucket and merged my changes in.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,017
git
# How do I change a git commit message in Bitbucket? I need to change an old git commit message in Bitbucket. I tried `git rebase -i` and reworded my message, but when I pulled and committed it just kept the old message in Bitbucket and merged my changes in.
It's basically 4 step process. But a bit risky if multiple team member are working on the same branch and have their own copies. (If you are the only one working on it, go for it) This git manual explains it beautifully: [Amending older or multiple commit messages](https://help.github.com/articles/changing-a-commit-me...
12866832
What's the difference between git-tf and git-tfs?
80
2012-10-12 20:44:02
<p>I've recently been getting really fed up with TFS. I've heard that there is a light at the end of the tunnel though. Apparently I can use either git-tf or git-tfs and treat my code as if it was managed by git, but be able to push/pull to/from a central TFS server.</p> <p>My main question is I'm not sure which one o...
23,175
69,742
2021-05-09 13:26:58
12,867,309
97
2012-10-12 21:24:11
729,881
2017-07-25 15:44:27
https://stackoverflow.com/q/12866832
https://stackoverflow.com/a/12867309
<p>Disclaimer: I <a href="http://www.edwardthomson.com/blog/team-foundation-server-and-xcode-projects-with-git-tf" rel="noreferrer">started the <code>git-tf</code> project</a> and although the project is now in very capable hands without me as a frequent contributor, you should absolutely consider my opinions on this t...
<p>Disclaimer: I <a href="http://www.edwardthomson.com/blog/team-foundation-server-and-xcode-projects-with-git-tf" rel="noreferrer">started the <code>git-tf</code> project</a> and although the project is now in very capable hands without me as a frequent contributor, you should absolutely consider my opinions on this t...
119, 733, 66446, 83188, 104161
git, git-tf, git-tfs, tfs, tfvc
<h1>What's the difference between git-tf and git-tfs?</h1> <p>I've recently been getting really fed up with TFS. I've heard that there is a light at the end of the tunnel though. Apparently I can use either git-tf or git-tfs and treat my code as if it was managed by git, but be able to push/pull to/from a central TFS s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,018
git
# What's the difference between git-tf and git-tfs? I've recently been getting really fed up with TFS. I've heard that there is a light at the end of the tunnel though. Apparently I can use either git-tf or git-tfs and treat my code as if it was managed by git, but be able to push/pull to/from a central TFS server. M...
Disclaimer: I [started the `git-tf` project](http://www.edwardthomson.com/blog/team-foundation-server-and-xcode-projects-with-git-tf) and although the project is now in very capable hands without me as a frequent contributor, you should absolutely consider my opinions on this to be *strongly* biased. (And, assuming you...
1828252
How to display metadata about single commit in git?
70
2009-12-01 19:17:32
<p>I'd like to parse meta information from git repository. I'd like to fetch a single information for a commit, as in</p> <pre><code>git log --pretty=format:%an HEAD^..HEAD </code></pre> <p>Problem is, this is not working for the first commit in repository.</p> <pre><code>git show --pretty=format:%an HEAD^..HEAD </c...
25,868
123,558
2020-06-16 22:02:14
1,828,259
97
2009-12-01 19:19:02
19,563
2009-12-01 19:19:02
https://stackoverflow.com/q/1828252
https://stackoverflow.com/a/1828259
<p>Supply the quiet option to show to suppress the diff.</p> <pre><code>git show --quiet HEAD </code></pre> <p>So for your example, author name:</p> <pre><code>git show --quiet --pretty=format:%an </code></pre>
<p>Supply the quiet option to show to suppress the diff.</p> <pre><code>git show --quiet HEAD </code></pre> <p>So for your example, author name:</p> <pre><code>git show --quiet --pretty=format:%an </code></pre>
119
git
<h1>How to display metadata about single commit in git?</h1> <p>I'd like to parse meta information from git repository. I'd like to fetch a single information for a commit, as in</p> <pre><code>git log --pretty=format:%an HEAD^..HEAD </code></pre> <p>Problem is, this is not working for the first commit in repository....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,019
git
# How to display metadata about single commit in git? I'd like to parse meta information from git repository. I'd like to fetch a single information for a commit, as in ``` git log --pretty=format:%an HEAD^..HEAD ``` Problem is, this is not working for the first commit in repository. ``` git show --pretty=format:%a...
Supply the quiet option to show to suppress the diff. ``` git show --quiet HEAD ``` So for your example, author name: ``` git show --quiet --pretty=format:%an ```
52096430
How to remove remote git hooks?
69
2018-08-30 11:54:07
<p>I have pre-push hook implemented with Husky. Now I wanna remove it.</p> <p>Problem is that after <code>yarn remove husky</code> git hooks are still there inside <code>.git/hooks</code>.</p> <p>Because of that I get this error every time I want to commit or switch branch or commit, thus commiting is not even possib...
64,663
5,794,392
2023-08-19 09:18:59
52,096,854
97
2018-08-30 12:15:38
5,132,456
2019-04-29 13:27:56
https://stackoverflow.com/q/52096430
https://stackoverflow.com/a/52096854
<p>Assuming you have no non-husky hooks, you might want to keep: </p> <pre><code>rm -f .git/hooks/* </code></pre> <p>every file inside ".git/hooks/" is either a git-hook or ignored by git. By removing everything inside, you'll get rid of all hooks, and restore the default behavior. </p> <p>By default there are examp...
<p>Assuming you have no non-husky hooks, you might want to keep: </p> <pre><code>rm -f .git/hooks/* </code></pre> <p>every file inside ".git/hooks/" is either a git-hook or ignored by git. By removing everything inside, you'll get rid of all hooks, and restore the default behavior. </p> <p>By default there are examp...
119, 853, 1282, 124263
frontend, git, hook, husky
<h1>How to remove remote git hooks?</h1> <p>I have pre-push hook implemented with Husky. Now I wanna remove it.</p> <p>Problem is that after <code>yarn remove husky</code> git hooks are still there inside <code>.git/hooks</code>.</p> <p>Because of that I get this error every time I want to commit or switch branch or ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,020
git
# How to remove remote git hooks? I have pre-push hook implemented with Husky. Now I wanna remove it. Problem is that after `yarn remove husky` git hooks are still there inside `.git/hooks`. Because of that I get this error every time I want to commit or switch branch or commit, thus commiting is not even possible -...
Assuming you have no non-husky hooks, you might want to keep: ``` rm -f .git/hooks/* ``` every file inside ".git/hooks/" is either a git-hook or ignored by git. By removing everything inside, you'll get rid of all hooks, and restore the default behavior. By default there are example-hooks in there, but except for be...
11987731
go back to a specific commit then go back to the present
68
2012-08-16 13:01:46
<p>I'd like to see the file from a specific commit in the past, I'm thinking of <code>git reset --hard</code> but I won't be able to see the commits beyond that commit. How do I go back to a commit (together with the state of the files), have a look at the files, the go to the present again?</p>
37,344
1,099,531
2025-09-08 13:48:57
11,987,888
97
2012-08-16 13:09:40
223,092
2012-08-16 13:36:12
https://stackoverflow.com/q/11987731
https://stackoverflow.com/a/11987888
<p>Suppose your current branch is <code>master</code> and the old commit is <code>a1b2c3</code>, then you can change all the files in your working tree back to the old commit with:</p> <pre><code>git checkout a1b2c3 </code></pre> <p>... and return to <code>master</code> with:</p> <pre><code>git checkout master </cod...
<p>Suppose your current branch is <code>master</code> and the old commit is <code>a1b2c3</code>, then you can change all the files in your working tree back to the old commit with:</p> <pre><code>git checkout a1b2c3 </code></pre> <p>... and return to <code>master</code> with:</p> <pre><code>git checkout master </cod...
119
git
<h1>go back to a specific commit then go back to the present</h1> <p>I'd like to see the file from a specific commit in the past, I'm thinking of <code>git reset --hard</code> but I won't be able to see the commits beyond that commit. How do I go back to a commit (together with the state of the files), have a look at t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,022
git
# go back to a specific commit then go back to the present I'd like to see the file from a specific commit in the past, I'm thinking of `git reset --hard` but I won't be able to see the commits beyond that commit. How do I go back to a commit (together with the state of the files), have a look at the files, the go to ...
Suppose your current branch is `master` and the old commit is `a1b2c3`, then you can change all the files in your working tree back to the old commit with: ``` git checkout a1b2c3 ``` ... and return to `master` with: ``` git checkout master ``` This way of hopping about in your git history (i.e. checking out a comm...
5549479
git: check if commit xyz in remote repo?
67
2011-04-05 08:59:31
<p>I have a commit xyz in my local branch that I want to check if it is included in a remote release repository; can I do that in some easy way? I could clone the remote repo, but I'm hoping for a nicer+faster way. <code>git ls-remote</code> seemed promising, but found nothing of value to me there. Thanks!</p>
35,429
87,973
2024-08-21 09:57:01
5,549,506
97
2011-04-05 09:01:25
223,092
2011-04-05 09:13:35
https://stackoverflow.com/q/5549479
https://stackoverflow.com/a/5549506
<p>Let's suppose that the remote that refers to the remote repository is called <code>origin</code>. In that case, first update all your remote-tracking branches with:</p> <pre><code>git fetch origin </code></pre> <p>Now you can use the useful <code>--contains</code> option to <code>git branch</code> to find out whi...
<p>Let's suppose that the remote that refers to the remote repository is called <code>origin</code>. In that case, first update all your remote-tracking branches with:</p> <pre><code>git fetch origin </code></pre> <p>Now you can use the useful <code>--contains</code> option to <code>git branch</code> to find out whi...
119
git
<h1>git: check if commit xyz in remote repo?</h1> <p>I have a commit xyz in my local branch that I want to check if it is included in a remote release repository; can I do that in some easy way? I could clone the remote repo, but I'm hoping for a nicer+faster way. <code>git ls-remote</code> seemed promising, but found ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,023
git
# git: check if commit xyz in remote repo? I have a commit xyz in my local branch that I want to check if it is included in a remote release repository; can I do that in some easy way? I could clone the remote repo, but I'm hoping for a nicer+faster way. `git ls-remote` seemed promising, but found nothing of value to ...
Let's suppose that the remote that refers to the remote repository is called `origin`. In that case, first update all your remote-tracking branches with: ``` git fetch origin ``` Now you can use the useful `--contains` option to `git branch` to find out which of the remote branches contains that commit: ``` git bran...
28163022
Merge two remote branches in a Git repository
61
2015-01-27 04:00:41
<p>I have one remote repository with many branches. For example, my repository name is:</p> <pre><code>http://navis.com/MyRepo.git </code></pre> <p>Its branches are:</p> <pre><code>development production (master) testing </code></pre> <p>I would like to merge the <code>development</code> branch into the <code>produ...
108,926
1,210,779
2021-03-30 19:27:03
28,163,903
97
2015-01-27 05:36:38
3,784,227
2015-01-27 05:36:38
https://stackoverflow.com/q/28163022
https://stackoverflow.com/a/28163903
<p>If you have remote-tracking branches set up locally, it's as simple as:</p> <pre><code>git checkout production git merge development git push origin production </code></pre> <p>If you have not yet set up remote-tracking branches, you could do something like:</p> <pre><code>git fetch origin git checkout production...
<p>If you have remote-tracking branches set up locally, it's as simple as:</p> <pre><code>git checkout production git merge development git push origin production </code></pre> <p>If you have not yet set up remote-tracking branches, you could do something like:</p> <pre><code>git fetch origin git checkout production...
119, 717, 41346, 53847, 76220
branching-and-merging, git, git-branch, git-remote, merge
<h1>Merge two remote branches in a Git repository</h1> <p>I have one remote repository with many branches. For example, my repository name is:</p> <pre><code>http://navis.com/MyRepo.git </code></pre> <p>Its branches are:</p> <pre><code>development production (master) testing </code></pre> <p>I would like to merge t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,027
git
# Merge two remote branches in a Git repository I have one remote repository with many branches. For example, my repository name is: ``` http://navis.com/MyRepo.git ``` Its branches are: ``` development production (master) testing ``` I would like to merge the `development` branch into the `production` (master) br...
If you have remote-tracking branches set up locally, it's as simple as: ``` git checkout production git merge development git push origin production ``` If you have not yet set up remote-tracking branches, you could do something like: ``` git fetch origin git checkout production # or `git checkout -b production ...
46915350
got 'fatal: branch 'master' does not exist' in git
49
2017-10-24 16:13:21
<p>using <code>git</code> for a while, it's very powerful and beautiful.. </p> <p>but also got some confused about it: </p> <p>it should under branch master after I init a git repo, isn't it? </p> <p>but <code>git branch -a</code>, i got nothing man.<br> and I got <code>fatal: branch 'master' does not exist</co...
83,811
7,022,570
2017-10-24 17:39:33
46,916,790
97
2017-10-24 17:39:33
1,256,452
2017-10-24 17:39:33
https://stackoverflow.com/q/46915350
https://stackoverflow.com/a/46916790
<h3>TL;DR</h3> <p>You can <code>git checkout master</code> at this point.</p> <h3>Longer description (but still not that long)</h3> <p>You are doing this the hard way.</p> <p>In the future, instead of:</p> <pre><code>mkdir repo cd repo git init git remote add origin &lt;url&gt; git fetch origin git checkout master...
<h3>TL;DR</h3> <p>You can <code>git checkout master</code> at this point.</p> <h3>Longer description (but still not that long)</h3> <p>You are doing this the hard way.</p> <p>In the future, instead of:</p> <pre><code>mkdir repo cd repo git init git remote add origin &lt;url&gt; git fetch origin git checkout master...
119, 76220
git, git-branch
<h1>got 'fatal: branch 'master' does not exist' in git</h1> <p>using <code>git</code> for a while, it's very powerful and beautiful.. </p> <p>but also got some confused about it: </p> <p>it should under branch master after I init a git repo, isn't it? </p> <p>but <code>git branch -a</code>, i got nothing man.<b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,028
git
# got 'fatal: branch 'master' does not exist' in git using `git` for a while, it's very powerful and beautiful.. but also got some confused about it: it should under branch master after I init a git repo, isn't it? but `git branch -a`, i got nothing man. and I got `fatal: branch 'master' does not exist` when I tr...
### TL;DR You can `git checkout master` at this point. ### Longer description (but still not that long) You are doing this the hard way. In the future, instead of: ``` mkdir repo cd repo git init git remote add origin <url> git fetch origin git checkout master ``` you can simply run: ``` git clone <url> repo ```...
50942519
how to checkout a specific commit from git
40
2018-06-20 07:24:01
<p>My code isn't working and it seems I have merged a wrong piece of code in my <code>master</code> branch. I am unable to pin point the issue and thus I want to pull specific commits one by one to find out which version was working just before the wrong commit.</p> <p>How could I pull a specific commit? Eg, On Bitbuc...
122,477
6,703,783
2022-07-17 14:09:22
50,942,586
97
2018-06-20 07:27:42
6,881,240
2022-07-17 14:09:22
https://stackoverflow.com/q/50942519
https://stackoverflow.com/a/50942586
<p>The question has wrong terminology. You cannot pull a commit, you can only checkout a commit. Pulling a commit would defy the whole branch/commit structure saving memory. You pull all commits in a branch or repository, and if you want to check out a specific one, then well, check it out:</p> <pre><code>git checkout ...
<p>The question has wrong terminology. You cannot pull a commit, you can only checkout a commit. Pulling a commit would defy the whole branch/commit structure saving memory. You pull all commits in a branch or repository, and if you want to check out a specific one, then well, check it out:</p> <pre><code>git checkout ...
119, 8337
bitbucket, git
<h1>how to checkout a specific commit from git</h1> <p>My code isn't working and it seems I have merged a wrong piece of code in my <code>master</code> branch. I am unable to pin point the issue and thus I want to pull specific commits one by one to find out which version was working just before the wrong commit.</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,030
git
# how to checkout a specific commit from git My code isn't working and it seems I have merged a wrong piece of code in my `master` branch. I am unable to pin point the issue and thus I want to pull specific commits one by one to find out which version was working just before the wrong commit. How could I pull a speci...
The question has wrong terminology. You cannot pull a commit, you can only checkout a commit. Pulling a commit would defy the whole branch/commit structure saving memory. You pull all commits in a branch or repository, and if you want to check out a specific one, then well, check it out: ``` git checkout 9ce920d ``` ...
2621610
What Git branching models work for you?
392
2010-04-12 11:23:43
<p>Our company is currently using a simple trunk/release/hotfixes branching model and would like advice on what branching models work best for your company or development process.</p> <ol> <li><p><strong>Workflows / branching models</strong></p> <p>Below are the three main descriptions of this I have seen, but they a...
78,688
208,791
2015-11-05 22:39:08
2,621,837
96
2010-04-12 12:01:40
6,309
2010-04-12 12:01:40
https://stackoverflow.com/q/2621610
https://stackoverflow.com/a/2621837
<p>The most troubling feature new developers to DVCS need to realize is about the <a href="https://stackoverflow.com/questions/2473124/source-control-distributed-systems-vs-non-distributed-whats-the-difference/2473315#2473315">publication process</a>:</p> <ul> <li>you can import (fetch/pull) whatever remote repo you n...
<p>The most troubling feature new developers to DVCS need to realize is about the <a href="https://stackoverflow.com/questions/2473124/source-control-distributed-systems-vs-non-distributed-whats-the-difference/2473315#2473315">publication process</a>:</p> <ul> <li>you can import (fetch/pull) whatever remote repo you n...
119, 717, 758, 4243, 36489
cherry-pick, git, merge, release, workflow
<h1>What Git branching models work for you?</h1> <p>Our company is currently using a simple trunk/release/hotfixes branching model and would like advice on what branching models work best for your company or development process.</p> <ol> <li><p><strong>Workflows / branching models</strong></p> <p>Below are the three ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,031
git
# What Git branching models work for you? Our company is currently using a simple trunk/release/hotfixes branching model and would like advice on what branching models work best for your company or development process. 1. **Workflows / branching models** Below are the three main descriptions of this I have seen, ...
The most troubling feature new developers to DVCS need to realize is about the [publication process](https://stackoverflow.com/questions/2473124/source-control-distributed-systems-vs-non-distributed-whats-the-difference/2473315#2473315): - you can import (fetch/pull) whatever remote repo you need - you can publish (pu...
16937359
Git copy file preserving history
268
2013-06-05 10:20:00
<p>I have a somewhat confusing question in Git. Lets say, I have a file <code>dir1/A.txt</code> committed and git preserves a history of commits</p> <p>Now I need to copy the file into <code>dir2/A.txt</code> (not move, but copy). I know that there is a <code>git mv</code> command but I need <code>dir2/A.txt</code> to ...
191,943
605,153
2025-04-17 01:26:34
16,937,834
96
2013-06-05 10:43:11
2,213,720
2022-09-24 08:23:33
https://stackoverflow.com/q/16937359
https://stackoverflow.com/a/16937834
<p>Unlike subversion, git does not have a per-file history. If you look at the commit data structure, it only points to the previous commits and the new tree object for this commit. No explicit information is stored in the commit object which files are changed by the commit; nor the nature of these changes.</p> <p>The ...
<p>Unlike subversion, git does not have a per-file history. If you look at the commit data structure, it only points to the previous commits and the new tree object for this commit. No explicit information is stored in the commit object which files are changed by the commit; nor the nature of these changes.</p> <p>The ...
119, 1062, 4330, 5310
copy, file, filenames, git
<h1>Git copy file preserving history</h1> <p>I have a somewhat confusing question in Git. Lets say, I have a file <code>dir1/A.txt</code> committed and git preserves a history of commits</p> <p>Now I need to copy the file into <code>dir2/A.txt</code> (not move, but copy). I know that there is a <code>git mv</code> comm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,032
git
# Git copy file preserving history I have a somewhat confusing question in Git. Lets say, I have a file `dir1/A.txt` committed and git preserves a history of commits Now I need to copy the file into `dir2/A.txt` (not move, but copy). I know that there is a `git mv` command but I need `dir2/A.txt` to have the same his...
Unlike subversion, git does not have a per-file history. If you look at the commit data structure, it only points to the previous commits and the new tree object for this commit. No explicit information is stored in the commit object which files are changed by the commit; nor the nature of these changes. The tools to ...
57051056
Why does "git status" show I'm on the master branch and "git branch" does not in a newly created repository?
83
2019-07-16 06:15:06
<p>I'm trying to automate a process and issue the <code>git branch</code> command to find out what branch I am on. Everything is working fine except for a newly initialized repo where <code>git branch</code> returns nothing. Given I've done nothing with the repo, not even the initial commit, I can accept the answer. Ho...
16,776
4,074,201
2019-07-22 12:24:58
57,051,404
96
2019-07-16 06:41:08
1,256,452
2019-07-16 06:41:08
https://stackoverflow.com/q/57051056
https://stackoverflow.com/a/57051404
<p>I upvoted two other answers, but I think the way to think of this is simple: <strong>You can be on a branch that doesn't exist.</strong> That's <em>normal</em> in a new empty repository, too, because for a branch name to exist, that branch name <em>must</em> identify the hash ID of an existing, valid commit. A ne...
<p>I upvoted two other answers, but I think the way to think of this is simple: <strong>You can be on a branch that doesn't exist.</strong> That's <em>normal</em> in a new empty repository, too, because for a branch name to exist, that branch name <em>must</em> identify the hash ID of an existing, valid commit. A ne...
119
git
<h1>Why does "git status" show I'm on the master branch and "git branch" does not in a newly created repository?</h1> <p>I'm trying to automate a process and issue the <code>git branch</code> command to find out what branch I am on. Everything is working fine except for a newly initialized repo where <code>git branch</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,033
git
# Why does "git status" show I'm on the master branch and "git branch" does not in a newly created repository? I'm trying to automate a process and issue the `git branch` command to find out what branch I am on. Everything is working fine except for a newly initialized repo where `git branch` returns nothing. Given I'...
I upvoted two other answers, but I think the way to think of this is simple: **You can be on a branch that doesn't exist.** That's *normal* in a new empty repository, too, because for a branch name to exist, that branch name *must* identify the hash ID of an existing, valid commit. A new empty repository has no commits...
14990993
Override git's choice of binary file to text
81
2013-02-20 22:16:35
<p>I've seen several question asking how to make git treat a text file as binary, but haven't seen the opposite yet:</p> <p>How do I change git's choice of treating a text file as binary? I have a text file where in some configuration strings an EOT and ETX is used to separate parts of the configuration parameters.</p>...
39,455
1,217,206
2024-10-20 16:54:10
15,009,104
96
2013-02-21 17:57:06
893
2013-02-21 17:57:06
https://stackoverflow.com/q/14990993
https://stackoverflow.com/a/15009104
<p>The way files are actually stored inside the Git repository is not relevant to how they are treated when displayed. So the <code>git diff</code> program, when asked to compare two files, first obtains both complete files from the repository and then runs a difference algorithm against them.</p> <p>Normally, <code>g...
<p>The way files are actually stored inside the Git repository is not relevant to how they are treated when displayed. So the <code>git diff</code> program, when asked to compare two files, first obtains both complete files from the repository and then runs a difference algorithm against them.</p> <p>Normally, <code>g...
119, 368, 1469
binary, git, text
<h1>Override git's choice of binary file to text</h1> <p>I've seen several question asking how to make git treat a text file as binary, but haven't seen the opposite yet:</p> <p>How do I change git's choice of treating a text file as binary? I have a text file where in some configuration strings an EOT and ETX is used ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,034
git
# Override git's choice of binary file to text I've seen several question asking how to make git treat a text file as binary, but haven't seen the opposite yet: How do I change git's choice of treating a text file as binary? I have a text file where in some configuration strings an EOT and ETX is used to separate par...
The way files are actually stored inside the Git repository is not relevant to how they are treated when displayed. So the `git diff` program, when asked to compare two files, first obtains both complete files from the repository and then runs a difference algorithm against them. Normally, `git diff` looks for non-pri...
19720711
Git warning: push.default is unset; its implicit value is changing
73
2013-11-01 04:17:39
<p>When I push to remote in Git, I get this warning:</p> <pre><code>warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch t...
69,633
2,215,537
2021-07-17 16:39:15
19,723,478
96
2013-11-01 08:47:32
683,080
2013-11-01 08:47:32
https://stackoverflow.com/q/19720711
https://stackoverflow.com/a/19723478
<p>This warning was introduced in Git 1.7.11 along with the <code>simple</code> style of pushing. The issue is that the current default, <code>matching</code>, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end r...
<p>This warning was introduced in Git 1.7.11 along with the <code>simple</code> style of pushing. The issue is that the current default, <code>matching</code>, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end r...
119, 4236
git, push
<h1>Git warning: push.default is unset; its implicit value is changing</h1> <p>When I push to remote in Git, I get this warning:</p> <pre><code>warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the defa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,036
git
# Git warning: push.default is unset; its implicit value is changing When I push to remote in Git, I get this warning: ``` warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: ...
This warning was introduced in Git 1.7.11 along with the `simple` style of pushing. The issue is that the current default, `matching`, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end result is that they end up r...
27313309
List git commits to master branch between two dates
67
2014-12-05 10:03:12
<p>How can i get a list of all the git commits done to the master branch between 2014-01-01 and 2014-06-30?</p> <p>I know <code>git log</code> will give me roughly this format (repeated for all commits):</p> <pre><code>commit &lt;hash&gt; author: &lt;author name&gt; date: &lt;date&gt; &lt;comment&gt; </code></pre> <...
44,215
1,418,643
2020-10-26 14:58:23
27,313,444
96
2014-12-05 10:10:11
1,843,331
2019-04-02 08:44:39
https://stackoverflow.com/q/27313309
https://stackoverflow.com/a/27313444
<pre><code>$ git log --since "DEC 1 2014" --until "DEC 5 2014" --pretty=format:"%h %an %ad" </code></pre> <p>This will give the format you want for the commits between dec 1 2014 and dec 5 2014, you can change the dates as you like</p> <p>If you wish to change the format, you can <a href="https://git-scm.com/docs/git...
<pre><code>$ git log --since "DEC 1 2014" --until "DEC 5 2014" --pretty=format:"%h %an %ad" </code></pre> <p>This will give the format you want for the commits between dec 1 2014 and dec 5 2014, you can change the dates as you like</p> <p>If you wish to change the format, you can <a href="https://git-scm.com/docs/git...
119, 47913
git, git-log
<h1>List git commits to master branch between two dates</h1> <p>How can i get a list of all the git commits done to the master branch between 2014-01-01 and 2014-06-30?</p> <p>I know <code>git log</code> will give me roughly this format (repeated for all commits):</p> <pre><code>commit &lt;hash&gt; author: &lt;author...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,037
git
# List git commits to master branch between two dates How can i get a list of all the git commits done to the master branch between 2014-01-01 and 2014-06-30? I know `git log` will give me roughly this format (repeated for all commits): ``` commit <hash> author: <author name> date: <date> <comment> ``` But how can ...
``` $ git log --since "DEC 1 2014" --until "DEC 5 2014" --pretty=format:"%h %an %ad" ``` This will give the format you want for the commits between dec 1 2014 and dec 5 2014, you can change the dates as you like If you wish to change the format, you can [read about the options here](https://git-scm.com/docs/git-log#_...
14717120
List all modified files in git merge commit - even the fast forwarded
62
2013-02-05 21:19:23
<p>I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was changed in the branch just by seeing the merge commit. Is there a way to do...
68,065
450,598
2019-10-22 11:59:40
14,717,197
96
2013-02-05 21:23:42
498,699
2018-06-08 09:46:22
https://stackoverflow.com/q/14717120
https://stackoverflow.com/a/14717197
<p>I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:</p> <pre><code>git log -m --name-only </code></pre> <p>For only a list of filenames of the commit:</p> <pre><code>git log -m -1 --name-only --pretty="format:" &lt;Merge ...
<p>I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:</p> <pre><code>git log -m --name-only </code></pre> <p>For only a list of filenames of the commit:</p> <pre><code>git log -m -1 --name-only --pretty="format:" &lt;Merge ...
119, 717, 28897, 76220
git, git-branch, git-merge, merge
<h1>List all modified files in git merge commit - even the fast forwarded</h1> <p>I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,039
git
# List all modified files in git merge commit - even the fast forwarded I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was chang...
I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit: ``` git log -m --name-only ``` For only a list of filenames of the commit: ``` git log -m -1 --name-only --pretty="format:" <Merge SHA> ``` There is some white space due to...
38275583
create version.txt file in project dir via build.gradle task
60
2016-07-08 21:22:52
<p>Apologies in advance for my ignorance. I'm very new to gradle.</p> <p>My is goal is to have some task in my build.gradle file, wherein a file 'version.txt' is created in my project directory whenever I run the <code>gradle</code> terminal command in my project root. This 'version.txt' file needs to contain version ...
63,367
5,377,282
2019-07-10 03:35:16
38,275,875
96
2016-07-08 21:51:46
1,196,603
2019-07-10 03:35:16
https://stackoverflow.com/q/38275583
https://stackoverflow.com/a/38275875
<p>The example you're referring to is almost correct. With a couple of minor tweaks it works as expected:</p> <pre class="lang-groovy prettyprint-override"><code>import java.text.SimpleDateFormat import org.ajoberstar.grgit.Grgit plugins { id "org.ajoberstar.grgit" version "1.7.2" } version = 1.0 task versionTx...
<p>The example you're referring to is almost correct. With a couple of minor tweaks it works as expected:</p> <pre class="lang-groovy prettyprint-override"><code>import java.text.SimpleDateFormat import org.ajoberstar.grgit.Grgit plugins { id "org.ajoberstar.grgit" version "1.7.2" } version = 1.0 task versionTx...
81, 119, 5310, 32307, 93557
build.gradle, file, git, gradle, versioning
<h1>create version.txt file in project dir via build.gradle task</h1> <p>Apologies in advance for my ignorance. I'm very new to gradle.</p> <p>My is goal is to have some task in my build.gradle file, wherein a file 'version.txt' is created in my project directory whenever I run the <code>gradle</code> terminal command...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,040
git
# create version.txt file in project dir via build.gradle task Apologies in advance for my ignorance. I'm very new to gradle. My is goal is to have some task in my build.gradle file, wherein a file 'version.txt' is created in my project directory whenever I run the `gradle` terminal command in my project root. This '...
The example you're referring to is almost correct. With a couple of minor tweaks it works as expected: ``` import java.text.SimpleDateFormat import org.ajoberstar.grgit.Grgit plugins { id "org.ajoberstar.grgit" version "1.7.2" } version = 1.0 task versionTxt() { doLast { new File(projectDir, "versi...
24008982
Git access to private repository using HTTPS
55
2014-06-03 07:04:39
<p>Trying to clone a private repository I have access to using HTTPS protocol, as that is only allowed outgoing traffic.</p> <p>git does not ask for passwords, just failed.</p> <pre><code>error: The requested URL returned error: 403 Forbidden while accessing https://github.com/blah/blahblah.git/info/refs </code></pre...
131,905
2,681,383
2023-01-31 04:45:34
24,009,134
96
2014-06-03 07:14:20
257,090
2017-06-02 16:22:24
https://stackoverflow.com/q/24008982
https://stackoverflow.com/a/24009134
<p>Did you try inserting the username (and optionally password) in the clone URL?</p> <pre><code> git clone https://username@github.com/blah/blahblah.git </code></pre> <p>or if you accept the consequences of storing your password in plain view:</p> <pre><code> git clone https://username:password@github.com/blah/blah...
<p>Did you try inserting the username (and optionally password) in the clone URL?</p> <pre><code> git clone https://username@github.com/blah/blahblah.git </code></pre> <p>or if you accept the consequences of storing your password in plain view:</p> <pre><code> git clone https://username:password@github.com/blah/blah...
119, 34099
git, git-clone
<h1>Git access to private repository using HTTPS</h1> <p>Trying to clone a private repository I have access to using HTTPS protocol, as that is only allowed outgoing traffic.</p> <p>git does not ask for passwords, just failed.</p> <pre><code>error: The requested URL returned error: 403 Forbidden while accessing https...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,043
git
# Git access to private repository using HTTPS Trying to clone a private repository I have access to using HTTPS protocol, as that is only allowed outgoing traffic. git does not ask for passwords, just failed. ``` error: The requested URL returned error: 403 Forbidden while accessing https://github.com/blah/blahblah...
Did you try inserting the username (and optionally password) in the clone URL? ``` git clone https://username@github.com/blah/blahblah.git ``` or if you accept the consequences of storing your password in plain view: ``` git clone https://username:password@github.com/blah/blahblah.git ``` See this thread with a l...
39836190
Homebrew install: Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1
54
2016-10-03 16:26:41
<p>I ran the following command on terminal (Mac El Capitan) </p> <pre class="lang-none prettyprint-override"><code>$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </code></pre> <p>and got the following error message:</p> <pre class="lang-none prettyprint-overrid...
107,838
2,509,621
2024-02-18 12:05:33
39,859,369
96
2016-10-04 18:31:17
2,509,621
2022-05-03 08:43:58
https://stackoverflow.com/q/39836190
https://stackoverflow.com/a/39859369
<p>After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following</p> <pre><code>git config --global user.email yourgitemail@example.co...
<p>After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following</p> <pre><code>git config --global user.email yourgitemail@example.co...
12, 119, 369, 1067, 112573
git, homebrew, macos, osx-elcapitan, ruby
<h1>Homebrew install: Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1</h1> <p>I ran the following command on terminal (Mac El Capitan) </p> <pre class="lang-none prettyprint-override"><code>$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/insta...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,044
git
# Homebrew install: Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1 I ran the following command on terminal (Mac El Capitan) ``` $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` and got the following error message: ``` Failed dur...
After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following ``` git config --global user.email yourgitemail@example.com ``` Then rem...
5683253
Distributed Version Control Systems and the Enterprise - a Good mix?
51
2011-04-15 23:18:16
<p>I can see why distributed source control systems (DVCS - like Mercurial) make sense for open source projects.</p> <p>But do they make sense for an enterprise? (over a centralized Source Control System such as TFS)</p> <p>What features of a DVCS make it better or worse suited for an enterprise with many developers?...
8,345
44,815
2021-08-26 17:52:44
5,685,757
96
2011-04-16 10:01:32
6,309
2021-08-26 17:52:44
https://stackoverflow.com/q/5683253
https://stackoverflow.com/a/5685757
<p>I have just introduced a DVCS (Git in this case) in a large banking company, where Perforce, SVN or ClearCase was the centralized VCS of choices:<br /> I already knew of the challenges (see my previous answer &quot;<a href="https://stackoverflow.com/questions/3597747/can-we-finally-move-to-dvcs-in-corporate-software...
<p>I have just introduced a DVCS (Git in this case) in a large banking company, where Perforce, SVN or ClearCase was the centralized VCS of choices:<br /> I already knew of the challenges (see my previous answer &quot;<a href="https://stackoverflow.com/questions/3597747/can-we-finally-move-to-dvcs-in-corporate-software...
119, 456, 733, 802, 3346
dvcs, git, mercurial, tfs, version-control
<h1>Distributed Version Control Systems and the Enterprise - a Good mix?</h1> <p>I can see why distributed source control systems (DVCS - like Mercurial) make sense for open source projects.</p> <p>But do they make sense for an enterprise? (over a centralized Source Control System such as TFS)</p> <p>What features o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,045
git
# Distributed Version Control Systems and the Enterprise - a Good mix? I can see why distributed source control systems (DVCS - like Mercurial) make sense for open source projects. But do they make sense for an enterprise? (over a centralized Source Control System such as TFS) What features of a DVCS make it better ...
I have just introduced a DVCS (Git in this case) in a large banking company, where Perforce, SVN or ClearCase was the centralized VCS of choices: I already knew of the challenges (see my previous answer "[Can we finally move to DVCS in Corporate Software? Is SVN still a 'must have' for development?](https://stackover...
3921153
Git: File Rename
51
2010-10-13 06:02:36
<p>I wanted to rename a folder from "<code>Frameworks</code>" to "<code>frameworks</code>", but git would not let me add the new lowercase name. I guess it treats filenames case insensitive, does it?</p> <p>A <code>git add frameworks/ -f</code> didn't help</p>
23,175
null
2015-04-19 09:56:36
3,921,179
96
2010-10-13 06:09:38
6,309
2015-04-19 09:56:36
https://stackoverflow.com/q/3921153
https://stackoverflow.com/a/3921179
<p>You can try:</p> <ul> <li><code>&quot;git mv -f foo.txt Foo.txt&quot;</code> (note: this is <a href="https://stackoverflow.com/a/24979063/6309">no longer needed since git 2.0.1</a>)</li> <li>to set <code>ignorecase</code> to false in the config file.</li> </ul> <hr /> <p>But the issue of case (on Windows for instanc...
<p>You can try:</p> <ul> <li><code>&quot;git mv -f foo.txt Foo.txt&quot;</code> (note: this is <a href="https://stackoverflow.com/a/24979063/6309">no longer needed since git 2.0.1</a>)</li> <li>to set <code>ignorecase</code> to false in the config file.</li> </ul> <hr /> <p>But the issue of case (on Windows for instanc...
119, 369, 11057
case-insensitive, git, macos
<h1>Git: File Rename</h1> <p>I wanted to rename a folder from "<code>Frameworks</code>" to "<code>frameworks</code>", but git would not let me add the new lowercase name. I guess it treats filenames case insensitive, does it?</p> <p>A <code>git add frameworks/ -f</code> didn't help</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,046
git
# Git: File Rename I wanted to rename a folder from "`Frameworks`" to "`frameworks`", but git would not let me add the new lowercase name. I guess it treats filenames case insensitive, does it? A `git add frameworks/ -f` didn't help
You can try: - `"git mv -f foo.txt Foo.txt"` (note: this is [no longer needed since git 2.0.1](https://stackoverflow.com/a/24979063/6309)) - to set `ignorecase` to false in the config file. --- But the issue of case (on Windows for instance) is described in the [msysgit issue 228](http://code.google.com/p/msysgit/is...
11849636
Maximum Lat and Long bounds for the world - Google Maps API LatLngBounds()
46
2012-08-07 15:52:31
<p>The Google Maps terrain view by default has unlimited panning of the map tile. You can use <code>LatLngBounds()</code> to limit this, but what are the maximum and minimum coordinates I should use to set the viewport as just the earth and not outside the map region? </p> <p>Coordinates for North America:</p> <pre><...
94,987
1,095,883
2019-12-03 14:57:48
13,824,556
96
2012-12-11 16:40:32
1,148,249
2019-12-03 14:57:48
https://stackoverflow.com/q/11849636
https://stackoverflow.com/a/13824556
<p>The links provided by @Marcelo &amp; @Doc are <em>good</em> for understanding the <em>derivation</em> of the Lat Lng:</p> <ul> <li><a href="http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&amp;lang=en" rel="noreferrer">http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&amp;lang=e...
<p>The links provided by @Marcelo &amp; @Doc are <em>good</em> for understanding the <em>derivation</em> of the Lat Lng:</p> <ul> <li><a href="http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&amp;lang=en" rel="noreferrer">http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&amp;lang=e...
3, 1819, 20301, 39308
google-maps, google-maps-api-3, javascript, latitude-longitude
<h1>Maximum Lat and Long bounds for the world - Google Maps API LatLngBounds()</h1> <p>The Google Maps terrain view by default has unlimited panning of the map tile. You can use <code>LatLngBounds()</code> to limit this, but what are the maximum and minimum coordinates I should use to set the viewport as just the earth...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,047
git
# Maximum Lat and Long bounds for the world - Google Maps API LatLngBounds() The Google Maps terrain view by default has unlimited panning of the map tile. You can use `LatLngBounds()` to limit this, but what are the maximum and minimum coordinates I should use to set the viewport as just the earth and not outside the...
The links provided by @Marcelo & @Doc are *good* for understanding the *derivation* of the Lat Lng: - <http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&lang=en> - <https://groups.google.com/forum/?hl=en&fromgroups=#!msg/google-maps-api/oJkyualxzyY/pNv1SE7qpBoJ> - <https://en.wikipedia.org/wiki/Merca...
16944826
How to revert an unnecessary "git reset HEAD~1"
43
2013-06-05 16:11:42
<p>After running <code>git reset HEAD~1</code>, I noticed that actually there was nothing else to do and the commit was fine. Is there a way to revert this command?</p>
37,614
1,967,100
2016-06-22 13:45:34
16,945,153
96
2013-06-05 16:27:50
1,870,481
2013-06-05 16:27:50
https://stackoverflow.com/q/16944826
https://stackoverflow.com/a/16945153
<p>You can use:</p> <pre><code>git reset HEAD@{1} </code></pre> <p>This uses the last entry in the reflog. See <code>git reflog</code> if you did other things in between.</p>
<p>You can use:</p> <pre><code>git reset HEAD@{1} </code></pre> <p>This uses the last entry in the reflog. See <code>git reflog</code> if you did other things in between.</p>
119
git
<h1>How to revert an unnecessary "git reset HEAD~1"</h1> <p>After running <code>git reset HEAD~1</code>, I noticed that actually there was nothing else to do and the commit was fine. Is there a way to revert this command?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,048
git
# How to revert an unnecessary "git reset HEAD~1" After running `git reset HEAD~1`, I noticed that actually there was nothing else to do and the commit was fine. Is there a way to revert this command?
You can use: ``` git reset HEAD@{1} ``` This uses the last entry in the reflog. See `git reflog` if you did other things in between.
7393274
Is it possible to view multiple git branches at the same time for the same project?
101
2011-09-12 20:00:18
<p>I have 2 branches, which are not ready to be merged yet, but have some complementary logic, which I'd like to review (before merging)</p> <p>Can I check out multiple git branches of the same project? Is it possible?</p>
59,947
359,862
2017-04-04 11:25:58
7,393,302
95
2011-09-12 20:02:57
229,044
2017-04-04 11:25:58
https://stackoverflow.com/q/7393274
https://stackoverflow.com/a/7393302
<p>You can simply copy the repository to a new location (either by literally copying the directory, or using <a href="https://git-scm.com/docs/git-clone#git-clone---shared" rel="noreferrer"><code>git clone --shared</code></a>) and check out one branch per location.</p> <p>You can also use <a href="https://git-scm.com/...
<p>You can simply copy the repository to a new location (either by literally copying the directory, or using <a href="https://git-scm.com/docs/git-clone#git-clone---shared" rel="noreferrer"><code>git clone --shared</code></a>) and check out one branch per location.</p> <p>You can also use <a href="https://git-scm.com/...
119, 1879, 37230
branch, git, git-checkout
<h1>Is it possible to view multiple git branches at the same time for the same project?</h1> <p>I have 2 branches, which are not ready to be merged yet, but have some complementary logic, which I'd like to review (before merging)</p> <p>Can I check out multiple git branches of the same project? Is it possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,049
git
# Is it possible to view multiple git branches at the same time for the same project? I have 2 branches, which are not ready to be merged yet, but have some complementary logic, which I'd like to review (before merging) Can I check out multiple git branches of the same project? Is it possible?
You can simply copy the repository to a new location (either by literally copying the directory, or using [`git clone --shared`](https://git-scm.com/docs/git-clone#git-clone---shared)) and check out one branch per location. You can also use [`git-worktree`](https://git-scm.com/docs/git-worktree) for creating multiple ...
14550802
What does "fatal: bad revision" mean?
97
2013-01-27 18:41:40
<p>In the context: </p> <pre><code>git revert HEAD~2 myFile fatal: bad revision '/Users/rose/gitTest/myFile' </code></pre> <p>I'm sure HEAD~2 exists.</p> <p><strong>EDIT</strong> Amber is correct. I meant to use <code>reset</code> instead of <code>revert</code>.</p>
218,042
365,298
2023-06-09 08:37:24
14,550,819
95
2013-01-27 18:43:06
148,870
2013-01-27 18:43:06
https://stackoverflow.com/q/14550802
https://stackoverflow.com/a/14550819
<p>If you only want to revert a single file to its state in a given commit, you actually want to use the <code>checkout</code> command:</p> <pre><code>git checkout HEAD~2 myFile </code></pre> <hr> <p>The <code>revert</code> command is used for reverting entire commits (and it doesn't revert you <em>to</em> that comm...
<p>If you only want to revert a single file to its state in a given commit, you actually want to use the <code>checkout</code> command:</p> <pre><code>git checkout HEAD~2 myFile </code></pre> <hr> <p>The <code>revert</code> command is used for reverting entire commits (and it doesn't revert you <em>to</em> that comm...
119
git
<h1>What does "fatal: bad revision" mean?</h1> <p>In the context: </p> <pre><code>git revert HEAD~2 myFile fatal: bad revision '/Users/rose/gitTest/myFile' </code></pre> <p>I'm sure HEAD~2 exists.</p> <p><strong>EDIT</strong> Amber is correct. I meant to use <code>reset</code> instead of <code>revert</code>.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,050
git
# What does "fatal: bad revision" mean? In the context: ``` git revert HEAD~2 myFile fatal: bad revision '/Users/rose/gitTest/myFile' ``` I'm sure HEAD~2 exists. **EDIT** Amber is correct. I meant to use `reset` instead of `revert`.
If you only want to revert a single file to its state in a given commit, you actually want to use the `checkout` command: ``` git checkout HEAD~2 myFile ``` --- The `revert` command is used for reverting entire commits (and it doesn't revert you *to* that commit; it actually just reverts the changes *made* by that c...
38163380
How to revert project back to a previous commit in android studio
81
2016-07-02 18:42:55
<p>I am working on a project in android studio and would like to revert to a previous push. I attempted<br> VCS => Git => Reset Head (Hard)<br> but my project in Android Studio is unchanged, likely because I'm doing something wrong. I would like to revert the project in Android Studio to a specific earlier commit that ...
110,219
2,049,247
2023-11-14 07:25:47
38,163,480
95
2016-07-02 18:53:33
5,279,040
2018-12-18 16:01:00
https://stackoverflow.com/q/38163380
https://stackoverflow.com/a/38163480
<p><strong>Android Studio Instructions</strong>: if you want to do this in Android Studio, press <code>alt + 9</code> (or <code>Command + 9</code> on Mac) to open the Version Control panel. Switch to the <code>Log</code> tab and right click on a previous commit. Select <code>Checkout Revision</code>.</p> <hr> <p><str...
<p><strong>Android Studio Instructions</strong>: if you want to do this in Android Studio, press <code>alt + 9</code> (or <code>Command + 9</code> on Mac) to open the Version Control panel. Switch to the <code>Log</code> tab and right click on a previous commit. Select <code>Checkout Revision</code>.</p> <hr> <p><str...
119, 1386, 91905
android, android-studio, git
<h1>How to revert project back to a previous commit in android studio</h1> <p>I am working on a project in android studio and would like to revert to a previous push. I attempted<br> VCS => Git => Reset Head (Hard)<br> but my project in Android Studio is unchanged, likely because I'm doing something wrong. I would like...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,051
git
# How to revert project back to a previous commit in android studio I am working on a project in android studio and would like to revert to a previous push. I attempted VCS => Git => Reset Head (Hard) but my project in Android Studio is unchanged, likely because I'm doing something wrong. I would like to revert th...
**Android Studio Instructions**: if you want to do this in Android Studio, press `alt + 9` (or `Command + 9` on Mac) to open the Version Control panel. Switch to the `Log` tab and right click on a previous commit. Select `Checkout Revision`. --- **Command line instructions**: Open the command line tool you are using....
12224773
Refname 'master' is ambiguous
76
2012-09-01 03:55:45
<p>I've looked at all of the other ambiguous refname questions and none of them seem to help. Why am I getting this warning?</p> <pre><code>$ git checkout master warning: refname 'master' is ambiguous. $ git show-ref master eef61c00da690f093063ac5a728e22fd21648104 refs/heads/master $ git branch -a checkers exercis...
85,574
503,402
2024-10-01 21:03:51
12,225,704
95
2012-09-01 07:07:01
6,309
2024-10-01 21:03:51
https://stackoverflow.com/q/12224773
https://stackoverflow.com/a/12225704
<p>TL;DR: save and delete the tag, as <a href="https://stackoverflow.com/users/325742/ashutosh-jindal">Ashutosh Jindal</a> <a href="https://stackoverflow.com/questions/12224773/git-refname-master-is-ambiguous/12225704?noredirect=1#comment28041784_12225704">comments</a> (see &quot;<a href="https://stackoverflow.com/q/10...
<p>TL;DR: save and delete the tag, as <a href="https://stackoverflow.com/users/325742/ashutosh-jindal">Ashutosh Jindal</a> <a href="https://stackoverflow.com/questions/12224773/git-refname-master-is-ambiguous/12225704?noredirect=1#comment28041784_12225704">comments</a> (see &quot;<a href="https://stackoverflow.com/q/10...
119
git
<h1>Refname 'master' is ambiguous</h1> <p>I've looked at all of the other ambiguous refname questions and none of them seem to help. Why am I getting this warning?</p> <pre><code>$ git checkout master warning: refname 'master' is ambiguous. $ git show-ref master eef61c00da690f093063ac5a728e22fd21648104 refs/heads/mast...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,052
git
# Refname 'master' is ambiguous I've looked at all of the other ambiguous refname questions and none of them seem to help. Why am I getting this warning? ``` $ git checkout master warning: refname 'master' is ambiguous. $ git show-ref master eef61c00da690f093063ac5a728e22fd21648104 refs/heads/master $ git branch -a ...
TL;DR: save and delete the tag, as [Ashutosh Jindal](https://stackoverflow.com/users/325742/ashutosh-jindal) [comments](https://stackoverflow.com/questions/12224773/git-refname-master-is-ambiguous/12225704?noredirect=1#comment28041784_12225704) (see "[Rename a tag in git?](https://stackoverflow.com/q/1028649/6309)"): ...
3885850
Git not removing files when switching branch
69
2010-10-07 20:59:57
<p>Sometimes when switching branches using Git (version 1.7.2.1) it does not seem to remove the files/directories I created specific to the branch I switched away from. Neither does it list it as untracked when running <code>git status</code> or any log entries for those files.</p> <p>This only happens occasionally an...
27,037
330,777
2018-12-04 03:48:08
3,885,862
95
2010-10-07 21:02:10
171,742
2010-10-07 21:02:10
https://stackoverflow.com/q/3885850
https://stackoverflow.com/a/3885862
<p>I have seen this too. I usually just do a <code>git reset --hard</code> followed by a <code>git clean -f -d</code> and it usually does the trick.</p> <p>It seems to definitely happen the most often when my IDE has a lock on one of the files in the branch i'm switching from.</p>
<p>I have seen this too. I usually just do a <code>git reset --hard</code> followed by a <code>git clean -f -d</code> and it usually does the trick.</p> <p>It seems to definitely happen the most often when my IDE has a lock on one of the files in the branch i'm switching from.</p>
119, 369
git, macos
<h1>Git not removing files when switching branch</h1> <p>Sometimes when switching branches using Git (version 1.7.2.1) it does not seem to remove the files/directories I created specific to the branch I switched away from. Neither does it list it as untracked when running <code>git status</code> or any log entries for ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,053
git
# Git not removing files when switching branch Sometimes when switching branches using Git (version 1.7.2.1) it does not seem to remove the files/directories I created specific to the branch I switched away from. Neither does it list it as untracked when running `git status` or any log entries for those files. This o...
I have seen this too. I usually just do a `git reset --hard` followed by a `git clean -f -d` and it usually does the trick. It seems to definitely happen the most often when my IDE has a lock on one of the files in the branch i'm switching from.
36918540
Gitignore all folders beginning with a period
67
2016-04-28 15:03:36
<p>I want to use a <code>.gitignore</code> file to ignore all folders beginning with a period (hidden folders of linux). </p> <p>I can't figure out the syntax, though I'm sure it's simple.</p> <p>How's it done?</p>
58,562
222,151
2019-11-07 03:33:03
36,918,678
95
2016-04-28 15:09:20
1,755,598
2016-04-28 21:29:28
https://stackoverflow.com/q/36918540
https://stackoverflow.com/a/36918678
<p>Use one of these patterns:</p> <pre><code># ignore all . files but include . folders .* !.*/ </code></pre> <hr> <pre><code># ignore all . files and . folders .* # Dont ignore .gitignore (this file) # This is just for verbosity, you can leave it out if # .gitignore is already tracked or if you use -f to # force-a...
<p>Use one of these patterns:</p> <pre><code># ignore all . files but include . folders .* !.*/ </code></pre> <hr> <pre><code># ignore all . files and . folders .* # Dont ignore .gitignore (this file) # This is just for verbosity, you can leave it out if # .gitignore is already tracked or if you use -f to # force-a...
119, 3889, 25056
git, gitignore, glob
<h1>Gitignore all folders beginning with a period</h1> <p>I want to use a <code>.gitignore</code> file to ignore all folders beginning with a period (hidden folders of linux). </p> <p>I can't figure out the syntax, though I'm sure it's simple.</p> <p>How's it done?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,054
git
# Gitignore all folders beginning with a period I want to use a `.gitignore` file to ignore all folders beginning with a period (hidden folders of linux). I can't figure out the syntax, though I'm sure it's simple. How's it done?
Use one of these patterns: ``` # ignore all . files but include . folders .* !.*/ ``` --- ``` # ignore all . files and . folders .* # Dont ignore .gitignore (this file) # This is just for verbosity, you can leave it out if # .gitignore is already tracked or if you use -f to # force-add it if you just created it !/....
6618730
Git: Apply part of a commit to another branch
65
2011-07-08 00:35:05
<p>How can I apply <em>part</em> of a commit from one branch to another? I understand that I can cherry-pick a commit, but I need to go one step further and "cherry pick" some of the changes introduced by that commit and apply them to another (target) branch.</p> <p>Is there a clean way to do this, or should I just ap...
14,707
287,451
2013-09-04 04:12:34
6,618,784
95
2011-07-08 00:44:14
54,249
2011-07-08 00:44:14
https://stackoverflow.com/q/6618730
https://stackoverflow.com/a/6618784
<p><code>git cherry-pick -n &lt;SHA&gt;</code> will stage the changes but not commit them. You can then use <code>git reset -p</code> to unstage the bits you don't want, or <code>git reset HEAD</code> and <code>git add -Ap</code> to stage only the changes you want.</p>
<p><code>git cherry-pick -n &lt;SHA&gt;</code> will stage the changes but not commit them. You can then use <code>git reset -p</code> to unstage the bits you don't want, or <code>git reset HEAD</code> and <code>git add -Ap</code> to stage only the changes you want.</p>
119
git
<h1>Git: Apply part of a commit to another branch</h1> <p>How can I apply <em>part</em> of a commit from one branch to another? I understand that I can cherry-pick a commit, but I need to go one step further and "cherry pick" some of the changes introduced by that commit and apply them to another (target) branch.</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,055
git
# Git: Apply part of a commit to another branch How can I apply *part* of a commit from one branch to another? I understand that I can cherry-pick a commit, but I need to go one step further and "cherry pick" some of the changes introduced by that commit and apply them to another (target) branch. Is there a clean way...
`git cherry-pick -n <SHA>` will stage the changes but not commit them. You can then use `git reset -p` to unstage the bits you don't want, or `git reset HEAD` and `git add -Ap` to stage only the changes you want.
9622131
Git rebase (Merge Squash) my feature branch onto another branch
58
2012-03-08 17:36:06
<p>I'm looking for a git command to help me with my feature branches when they're ready to go into Master. This git command would squash all my changes on my branch into a single commit on top of master. I do this today with:</p> <pre><code>git rebase origin/master git rebase -i HEAD~4 </code></pre> <p>Where 4 is the...
42,016
461,974
2016-12-29 04:58:01
9,625,775
95
2012-03-08 22:06:12
520,162
2016-08-09 06:31:39
https://stackoverflow.com/q/9622131
https://stackoverflow.com/a/9625775
<p>All you have to do is:</p> <pre><code>git checkout feature_branch git rebase master git checkout master git merge --squash feature_branch </code></pre> <p>As the <a href="http://linux.die.net/man/1/git-merge" rel="noreferrer">docs</a> for <code>git merge --squash</code> say:</p> <blockquote> <p>Produce the work...
<p>All you have to do is:</p> <pre><code>git checkout feature_branch git rebase master git checkout master git merge --squash feature_branch </code></pre> <p>As the <a href="http://linux.die.net/man/1/git-merge" rel="noreferrer">docs</a> for <code>git merge --squash</code> say:</p> <blockquote> <p>Produce the work...
119, 28897, 98455
git, git-merge, git-squash
<h1>Git rebase (Merge Squash) my feature branch onto another branch</h1> <p>I'm looking for a git command to help me with my feature branches when they're ready to go into Master. This git command would squash all my changes on my branch into a single commit on top of master. I do this today with:</p> <pre><code>git r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,057
git
# Git rebase (Merge Squash) my feature branch onto another branch I'm looking for a git command to help me with my feature branches when they're ready to go into Master. This git command would squash all my changes on my branch into a single commit on top of master. I do this today with: ``` git rebase origin/master ...
All you have to do is: ``` git checkout feature_branch git rebase master git checkout master git merge --squash feature_branch ``` As the [docs](http://linux.die.net/man/1/git-merge) for `git merge --squash` say: > Produce the working tree and index state as if a real merge happened (except for the merge information...
2333424
Distributing git configuration with the code
57
2010-02-25 10:59:51
<p>In trying to standardise the platform for the developers, one of my needs would be to commit the <code>.git/config</code> so that everybody have the same CRLF config without forgetting to set it by hand.</p> <p>How do I set this up?</p> <p>I'm a bit concerned by all this negativity against <code>autocrlf</code>. W...
50,958
72,637
2022-10-17 17:38:58
2,354,278
95
2010-03-01 06:52:12
6,309
2022-10-17 17:38:58
https://stackoverflow.com/q/2333424
https://stackoverflow.com/a/2354278
<p>I have always found the <code>autocrlf</code> config property problematic. (as expressed in my answer <a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination</a>)</p> <ul> <...
<p>I have always found the <code>autocrlf</code> config property problematic. (as expressed in my answer <a href="https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133">Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination</a>)</p> <ul> <...
119
git
<h1>Distributing git configuration with the code</h1> <p>In trying to standardise the platform for the developers, one of my needs would be to commit the <code>.git/config</code> so that everybody have the same CRLF config without forgetting to set it by hand.</p> <p>How do I set this up?</p> <p>I'm a bit concerned b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,058
git
# Distributing git configuration with the code In trying to standardise the platform for the developers, one of my needs would be to commit the `.git/config` so that everybody have the same CRLF config without forgetting to set it by hand. How do I set this up? I'm a bit concerned by all this negativity against `aut...
I have always found the `autocrlf` config property problematic. (as expressed in my answer [Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination](https://stackoverflow.com/questions/1249932/git-1-6-4-beta-on-windows-msysgit-unix-or-dos-line-termination/1250133#1250133)) - it not only make [some merges tr...
17219102
How to make "git push" include tags within a branch?
55
2013-06-20 16:38:51
<p>When fetching a single branch, <code>git fetch</code> includes any tags that point into the branch:</p> <blockquote> <p>When refspec stores the fetched result in remote-tracking branches, the tags that point at these branches are automatically followed. This is done by first fetching from the remote using the...
32,049
122,150
2024-03-11 20:00:33
17,219,399
95
2013-06-20 16:54:01
6,309
2024-03-11 20:00:33
https://stackoverflow.com/q/17219102
https://stackoverflow.com/a/17219399
<p>You can try, with <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt#L155-L156" rel="noreferrer">git1.8.3+</a> (May 2013):</p> <pre><code>git push --follow-tags </code></pre> <blockquote> <p>The new &quot;<code>--follow-tags</code>&quot; option tells &quot;<code>git push</code>&quot; to...
<p>You can try, with <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt#L155-L156" rel="noreferrer">git1.8.3+</a> (May 2013):</p> <pre><code>git push --follow-tags </code></pre> <blockquote> <p>The new &quot;<code>--follow-tags</code>&quot; option tells &quot;<code>git push</code>&quot; to...
119
git
<h1>How to make "git push" include tags within a branch?</h1> <p>When fetching a single branch, <code>git fetch</code> includes any tags that point into the branch:</p> <blockquote> <p>When refspec stores the fetched result in remote-tracking branches, the tags that point at these branches are automatically follow...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,060
git
# How to make "git push" include tags within a branch? When fetching a single branch, `git fetch` includes any tags that point into the branch: > When refspec stores the fetched result in remote-tracking branches, > the tags that point at these branches are automatically followed. This > is done by first fetching fro...
You can try, with [git1.8.3+](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.3.txt#L155-L156) (May 2013): ``` git push --follow-tags ``` > The new "`--follow-tags`" option tells "`git push`" to push relevant annotated tags when pushing branches out. This won't push *all* the tags, but only the one...
21830810
How to make git log cut long comments?
53
2014-02-17 13:49:00
<p>I have a git log alias that prints each commit as a single line. Since some people write far too long one-liners in the commit log, many commits wrap to a new line. How can I format the git log output to cut the comment after 50 characters?</p> <p>I found this in the git-log man page but it will only pad short comm...
15,984
1,542,411
2023-09-20 15:32:56
21,831,280
95
2014-02-17 14:10:39
291,641
2014-02-17 14:10:39
https://stackoverflow.com/q/21830810
https://stackoverflow.com/a/21831280
<p>It is not that clear in the documentation just which characters are needed but the following example cuts the subject line to 50 characters:</p> <pre><code>git log --oneline --format="%h %&lt;(50,trunc)%s" </code></pre> <p>The format specification is <code>%&lt;</code> and the arguments for that need to be in pare...
<p>It is not that clear in the documentation just which characters are needed but the following example cuts the subject line to 50 characters:</p> <pre><code>git log --oneline --format="%h %&lt;(50,trunc)%s" </code></pre> <p>The format specification is <code>%&lt;</code> and the arguments for that need to be in pare...
119, 158175
git, git-format
<h1>How to make git log cut long comments?</h1> <p>I have a git log alias that prints each commit as a single line. Since some people write far too long one-liners in the commit log, many commits wrap to a new line. How can I format the git log output to cut the comment after 50 characters?</p> <p>I found this in the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,061
git
# How to make git log cut long comments? I have a git log alias that prints each commit as a single line. Since some people write far too long one-liners in the commit log, many commits wrap to a new line. How can I format the git log output to cut the comment after 50 characters? I found this in the git-log man page...
It is not that clear in the documentation just which characters are needed but the following example cuts the subject line to 50 characters: ``` git log --oneline --format="%h %<(50,trunc)%s" ``` The format specification is `%<` and the arguments for that need to be in parentheses. In this case, 50 chars and truncate...
21038045
How to undo git reset --soft to get my changes back?
50
2014-01-10 06:59:38
<p>I had some local changes in my directory that I committed using git commit. Later I realized that by mistake my changes broke my build. So I did a <code>git reset --soft</code> on my repo. But I screwed up, as I did not back up the changes that were all undone, as some of them did contain the new functionality that ...
39,557
3,069,143
2022-10-05 14:16:02
21,038,113
95
2014-01-10 07:04:33
3,089,986
2020-02-10 05:57:32
https://stackoverflow.com/q/21038045
https://stackoverflow.com/a/21038113
<p>In <code>$ git reflog</code> you should find some of your commits. Once you find the latest commit that you want to move to</p> <p>you should reset back to your commit id <code>$ git reset _Your_Hash_</code> , as <code>$ git reset --soft</code> just reset the files and not the index or working tree.</p>
<p>In <code>$ git reflog</code> you should find some of your commits. Once you find the latest commit that you want to move to</p> <p>you should reset back to your commit id <code>$ git reset _Your_Hash_</code> , as <code>$ git reset --soft</code> just reset the files and not the index or working tree.</p>
119, 51381, 53850
git, git-commit, git-reset
<h1>How to undo git reset --soft to get my changes back?</h1> <p>I had some local changes in my directory that I committed using git commit. Later I realized that by mistake my changes broke my build. So I did a <code>git reset --soft</code> on my repo. But I screwed up, as I did not back up the changes that were all u...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,062
git
# How to undo git reset --soft to get my changes back? I had some local changes in my directory that I committed using git commit. Later I realized that by mistake my changes broke my build. So I did a `git reset --soft` on my repo. But I screwed up, as I did not back up the changes that were all undone, as some of th...
In `$ git reflog` you should find some of your commits. Once you find the latest commit that you want to move to you should reset back to your commit id `$ git reset _Your_Hash_` , as `$ git reset --soft` just reset the files and not the index or working tree.
15271435
List all changed files with change status between Git commits (added, modified, deleted)
44
2013-03-07 12:36:44
<p>I regularly use the following command to list files changed between two commits:</p> <pre><code>git diff --name-only SHA1 SHA2 </code></pre> <p>It gives a list of files somewhat like this:</p> <pre> /src/example/file1 /src/example/file2 /src/example/file3 </pre> <p>There is almost no end to how useful this is.</...
18,141
5,343
2014-07-22 04:14:47
15,273,966
95
2013-03-07 14:38:08
13,702
2013-03-07 14:38:08
https://stackoverflow.com/q/15271435
https://stackoverflow.com/a/15273966
<p>Use <code>--name-status</code>, it's the same as <code>--name-only</code> plus the status of changed files:</p> <pre><code>git diff --name-status SHA1 SHA2 </code></pre>
<p>Use <code>--name-status</code>, it's the same as <code>--name-only</code> plus the status of changed files:</p> <pre><code>git diff --name-status SHA1 SHA2 </code></pre>
119, 9033
git, git-diff
<h1>List all changed files with change status between Git commits (added, modified, deleted)</h1> <p>I regularly use the following command to list files changed between two commits:</p> <pre><code>git diff --name-only SHA1 SHA2 </code></pre> <p>It gives a list of files somewhat like this:</p> <pre> /src/example/file...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,063
git
# List all changed files with change status between Git commits (added, modified, deleted) I regularly use the following command to list files changed between two commits: ``` git diff --name-only SHA1 SHA2 ``` It gives a list of files somewhat like this: ``` /src/example/file1 /src/example/file2 /src/example/file3...
Use `--name-status`, it's the same as `--name-only` plus the status of changed files: ``` git diff --name-status SHA1 SHA2 ```
6791889
Git: untrack a file in local repo only and keep it in the remote repo
37
2011-07-22 14:58:28
<p>I have a NetBeans file "nbproject/project.properties" that always shows up in the <strong>"Changes not staged for commit"</strong> section (when I do git status). How could I move this to the Untracked files section (without adding it to .gitignore) ? I tried this command <code>git rm --cached</code> but what happen...
24,075
302,707
2019-04-16 21:59:36
6,793,752
95
2011-07-22 17:25:53
6,309
2019-04-16 21:59:36
https://stackoverflow.com/q/6791889
https://stackoverflow.com/a/6793752
<p>You could <a href="http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html" rel="noreferrer">update your index</a>:</p> <pre><code>cd /root/folder/of/your/repo git update-index --assume-unchanged nbproject/project.properties </code></pre> <p>and make sure it never shows as "updated" in your current r...
<p>You could <a href="http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html" rel="noreferrer">update your index</a>:</p> <pre><code>cd /root/folder/of/your/repo git update-index --assume-unchanged nbproject/project.properties </code></pre> <p>and make sure it never shows as "updated" in your current r...
119
git
<h1>Git: untrack a file in local repo only and keep it in the remote repo</h1> <p>I have a NetBeans file "nbproject/project.properties" that always shows up in the <strong>"Changes not staged for commit"</strong> section (when I do git status). How could I move this to the Untracked files section (without adding it to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,064
git
# Git: untrack a file in local repo only and keep it in the remote repo I have a NetBeans file "nbproject/project.properties" that always shows up in the **"Changes not staged for commit"** section (when I do git status). How could I move this to the Untracked files section (without adding it to .gitignore) ? I tried ...
You could [update your index](http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html): ``` cd /root/folder/of/your/repo git update-index --assume-unchanged nbproject/project.properties ``` and make sure it never shows as "updated" in your current repo. That means it won't ever be pushed, but it is st...
3946538
Git Clone: Just the files, please?
181
2010-10-15 22:16:28
<p>I want to clone a GIT repo and NOT end up with a <code>.git</code> directory. In other words I just want the files. Is there a way to do this? </p> <p><code>git clone --no-checkout</code> did the exact opposite of what I want (gave me just the <code>.git</code> directory).</p> <p>I am trying to do that for a <em>r...
165,881
8,047
2022-12-30 14:17:48
3,946,745
94
2010-10-15 22:58:20
6,309
2017-12-18 16:19:30
https://stackoverflow.com/q/3946538
https://stackoverflow.com/a/3946745
<p>The git command that would be the closest from what you are looking for would by <strong><a href="https://git-scm.com/docs/git-archive" rel="noreferrer"><code>git archive</code></a></strong>.<br> See <a href="https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141">backing up pr...
<p>The git command that would be the closest from what you are looking for would by <strong><a href="https://git-scm.com/docs/git-archive" rel="noreferrer"><code>git archive</code></a></strong>.<br> See <a href="https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141">backing up pr...
119
git
<h1>Git Clone: Just the files, please?</h1> <p>I want to clone a GIT repo and NOT end up with a <code>.git</code> directory. In other words I just want the files. Is there a way to do this? </p> <p><code>git clone --no-checkout</code> did the exact opposite of what I want (gave me just the <code>.git</code> directory)...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,065
git
# Git Clone: Just the files, please? I want to clone a GIT repo and NOT end up with a `.git` directory. In other words I just want the files. Is there a way to do this? `git clone --no-checkout` did the exact opposite of what I want (gave me just the `.git` directory). I am trying to do that for a *remote* repo, not...
The git command that would be the closest from what you are looking for would by **[`git archive`](https://git-scm.com/docs/git-archive)**. See [backing up project which uses git](https://stackoverflow.com/questions/2046918/backing-up-project-which-uses-git/2047141#2047141): it will include in an archive all files (i...
11278497
Update a local branch with the changes from a tracked remote branch
177
2012-06-30 23:38:35
<p>I have a local branch named '<code>my_local_branch</code>', which tracks a remote branch <code>origin/my_remote_branch</code>.</p> <p>Now, the remote branch has been updated, and I am on the '<code>my_local_branch</code>' and want to pull in those changes. Should I just do:</p> <pre><code>git pull origin my_remote...
578,235
548,240
2023-02-18 18:54:19
11,278,576
94
2012-06-30 23:58:03
6,309
2020-06-25 17:03:00
https://stackoverflow.com/q/11278497
https://stackoverflow.com/a/11278576
<p>You have set the upstream of that branch</p> <p>(see:</p> <ul> <li>&quot;<a href="https://stackoverflow.com/questions/520650/how-do-you-make-an-existing-git-branch-track-a-remote-branch">How do you make an existing git branch track a remote branch?</a>&quot; and</li> <li>&quot;<a href="https://stackoverflow.com/ques...
<p>You have set the upstream of that branch</p> <p>(see:</p> <ul> <li>&quot;<a href="https://stackoverflow.com/questions/520650/how-do-you-make-an-existing-git-branch-track-a-remote-branch">How do you make an existing git branch track a remote branch?</a>&quot; and</li> <li>&quot;<a href="https://stackoverflow.com/ques...
119, 1879, 31678, 76220
branch, git, git-branch, remote-branch
<h1>Update a local branch with the changes from a tracked remote branch</h1> <p>I have a local branch named '<code>my_local_branch</code>', which tracks a remote branch <code>origin/my_remote_branch</code>.</p> <p>Now, the remote branch has been updated, and I am on the '<code>my_local_branch</code>' and want to pull ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,066
git
# Update a local branch with the changes from a tracked remote branch I have a local branch named '`my_local_branch`', which tracks a remote branch `origin/my_remote_branch`. Now, the remote branch has been updated, and I am on the '`my_local_branch`' and want to pull in those changes. Should I just do: ``` git pull...
You have set the upstream of that branch (see: - "[How do you make an existing git branch track a remote branch?](https://stackoverflow.com/questions/520650/how-do-you-make-an-existing-git-branch-track-a-remote-branch)" and - "[Git: Why do I need to do `--set-upstream-to` all the time?](https://stackoverflow.com/ques...
2364978
Why do I have to hit 'Q' at the end of 'git log'?
87
2010-03-02 16:56:51
<p>Consider:</p> <pre><code>git log -n 20 --pretty=oneline </code></pre> <p>I am telling Git that I need to see only the last 20 commits. I hate to hit <kbd>Q</kbd> to get rid of END. Is there a way out so that I don't have to hit <kbd>Q</kbd>?</p>
19,340
253,470
2024-02-26 11:08:55
2,365,076
94
2010-03-02 17:08:39
119,963
2010-03-02 17:08:39
https://stackoverflow.com/q/2364978
https://stackoverflow.com/a/2365076
<p>Git is automatically paging the output for you, since logs tend to easily overflow a single terminal window size (you're in one of the rare exceptions - a oneline format and a small commit limit). If you don't want this, use:</p> <pre><code>git --no-pager log -n 20 --pretty=oneline </code></pre> <p>Note that this ...
<p>Git is automatically paging the output for you, since logs tend to easily overflow a single terminal window size (you're in one of the rare exceptions - a oneline format and a small commit limit). If you don't want this, use:</p> <pre><code>git --no-pager log -n 20 --pretty=oneline </code></pre> <p>Note that this ...
119
git
<h1>Why do I have to hit 'Q' at the end of 'git log'?</h1> <p>Consider:</p> <pre><code>git log -n 20 --pretty=oneline </code></pre> <p>I am telling Git that I need to see only the last 20 commits. I hate to hit <kbd>Q</kbd> to get rid of END. Is there a way out so that I don't have to hit <kbd>Q</kbd>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,069
git
# Why do I have to hit 'Q' at the end of 'git log'? Consider: ``` git log -n 20 --pretty=oneline ``` I am telling Git that I need to see only the last 20 commits. I hate to hit `Q` to get rid of END. Is there a way out so that I don't have to hit `Q`?
Git is automatically paging the output for you, since logs tend to easily overflow a single terminal window size (you're in one of the rare exceptions - a oneline format and a small commit limit). If you don't want this, use: ``` git --no-pager log -n 20 --pretty=oneline ``` Note that this does mean you'll get some u...
3231079
How to see all tags in a git repository in command line
73
2010-07-12 18:24:13
<p>Is there something like "git show tags"?</p>
72,251
6,634
2017-06-18 21:29:13
3,231,113
94
2010-07-12 18:27:54
388,847
2014-02-12 19:16:02
https://stackoverflow.com/q/3231079
https://stackoverflow.com/a/3231113
<p><code>git tag</code> to list tags used in the repo.</p> <p><code>git tag -l</code> if you use the <code>-l</code> option you can pass a search pattern to filter out tags.</p>
<p><code>git tag</code> to list tags used in the repo.</p> <p><code>git tag -l</code> if you use the <code>-l</code> option you can pass a search pattern to filter out tags.</p>
119, 456
git, version-control
<h1>How to see all tags in a git repository in command line</h1> <p>Is there something like "git show tags"?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,071
git
# How to see all tags in a git repository in command line Is there something like "git show tags"?
`git tag` to list tags used in the repo. `git tag -l` if you use the `-l` option you can pass a search pattern to filter out tags.
2941567
How do I show just the names and commit titles since a tag in Git?
73
2010-05-31 05:46:20
<p>I'm trying to use tags for release management in Git—I create a tag for each release. I'd like to be able to create release notes by listing the comment titles for every commit since a tag, or between 2 tags. I can't seem to find any way to do this.</p>
37,254
214,350
2018-04-14 09:15:37
2,941,614
94
2010-05-31 05:57:16
878
2014-04-02 15:28:58
https://stackoverflow.com/q/2941567
https://stackoverflow.com/a/2941614
<p>If your tags are named <code>LastRelease</code> and <code>NextRelease</code> then do</p> <p><code>git log --pretty=format:%s LastRelease..NextRelease</code> .</p>
<p>If your tags are named <code>LastRelease</code> and <code>NextRelease</code> then do</p> <p><code>git log --pretty=format:%s LastRelease..NextRelease</code> .</p>
119, 47913
git, git-log
<h1>How do I show just the names and commit titles since a tag in Git?</h1> <p>I'm trying to use tags for release management in Git—I create a tag for each release. I'd like to be able to create release notes by listing the comment titles for every commit since a tag, or between 2 tags. I can't seem to find any way to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,072
git
# How do I show just the names and commit titles since a tag in Git? I'm trying to use tags for release management in Git—I create a tag for each release. I'd like to be able to create release notes by listing the comment titles for every commit since a tag, or between 2 tags. I can't seem to find any way to do this.
If your tags are named `LastRelease` and `NextRelease` then do `git log --pretty=format:%s LastRelease..NextRelease` .
3580802
How to use git (git config --global)?
66
2010-08-27 01:53:08
<p>The <a href="http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git" rel="noreferrer">Pragmatic Guide to GIT</a> has the following "Git uses both to calculate the commit ID—a SHA-111 hash—that identifies each commit." in page 21.</p> <p>And in page 22, I can use the following command to 'Configure Git to know...
168,522
260,127
2018-09-13 11:43:11
3,580,841
94
2010-08-27 02:01:55
372,643
2010-08-27 02:01:55
https://stackoverflow.com/q/3580802
https://stackoverflow.com/a/3580841
<p>Not sure where "smcho" comes from, but the setting to set your name is <code>user.name</code>:</p> <pre><code>git config --global user.name "Your Name" </code></pre> <p>You can set your e-mail address too:</p> <pre><code>git config --global user.email "name@domain.example" </code></pre> <p>I guess the reason it ...
<p>Not sure where "smcho" comes from, but the setting to set your name is <code>user.name</code>:</p> <pre><code>git config --global user.name "Your Name" </code></pre> <p>You can set your e-mail address too:</p> <pre><code>git config --global user.email "name@domain.example" </code></pre> <p>I guess the reason it ...
119, 725
configuration, git
<h1>How to use git (git config --global)?</h1> <p>The <a href="http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git" rel="noreferrer">Pragmatic Guide to GIT</a> has the following "Git uses both to calculate the commit ID—a SHA-111 hash—that identifies each commit." in page 21.</p> <p>And in page 22, I can use ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,073
git
# How to use git (git config --global)? The [Pragmatic Guide to GIT](http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git) has the following "Git uses both to calculate the commit ID—a SHA-111 hash—that identifies each commit." in page 21. And in page 22, I can use the following command to 'Configure Git to k...
Not sure where "smcho" comes from, but the setting to set your name is `user.name`: ``` git config --global user.name "Your Name" ``` You can set your e-mail address too: ``` git config --global user.email "name@domain.example" ``` I guess the reason it complains about the lack of a section is that the name of the ...
14250257
Resolve merge conflicts: Force overwrite all files
57
2013-01-10 03:12:02
<p>I am working on a git repository <em>by myself</em> (so yes, I know the implications and the warnings of doing this) and somehow one of the trees got a commit after being pushed when it shouldn't have.</p> <p>Now I'm trying to pull back and it's complaining about hundreds of merge conflicts.</p> <p>Is there a way ...
117,863
510,036
2017-10-04 06:20:39
14,250,400
94
2013-01-10 03:31:12
1,965,396
2016-06-23 16:12:39
https://stackoverflow.com/q/14250257
https://stackoverflow.com/a/14250400
<p>There are three simple solutions to copy the last version that is in you remote repository, discarding all changes that you have made locally:</p> <ol> <li><p>Discard your repository and clone again. This is the most simple solution, but if your repository is big, it can take a long time, and may require extra effo...
<p>There are three simple solutions to copy the last version that is in you remote repository, discarding all changes that you have made locally:</p> <ol> <li><p>Discard your repository and clone again. This is the most simple solution, but if your repository is big, it can take a long time, and may require extra effo...
119, 28896, 28897
git, git-merge, git-pull
<h1>Resolve merge conflicts: Force overwrite all files</h1> <p>I am working on a git repository <em>by myself</em> (so yes, I know the implications and the warnings of doing this) and somehow one of the trees got a commit after being pushed when it shouldn't have.</p> <p>Now I'm trying to pull back and it's complainin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,078
git
# Resolve merge conflicts: Force overwrite all files I am working on a git repository *by myself* (so yes, I know the implications and the warnings of doing this) and somehow one of the trees got a commit after being pushed when it shouldn't have. Now I'm trying to pull back and it's complaining about hundreds of mer...
There are three simple solutions to copy the last version that is in you remote repository, discarding all changes that you have made locally: 1. Discard your repository and clone again. This is the most simple solution, but if your repository is big, it can take a long time, and may require extra effort like re`confi...
24821431
Git apply patch fails silently (no errors but nothing happens)
50
2014-07-18 09:18:27
<p>I'm trying to apply a patch, and git apply patch doesn't give me any errors:</p> <pre><code>sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ git apply ../../commit-d0d9477 sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ </code></pre> <p>As you can see, no error messages are given. But...
27,750
492,336
2023-10-10 18:52:02
27,283,285
94
2014-12-03 22:59:17
304,742
2018-07-07 13:43:41
https://stackoverflow.com/q/24821431
https://stackoverflow.com/a/27283285
<p>I found this while googling for the issue: <a href="http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository" rel="noreferrer">http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository</a></p> <blockquote> <p><code>git apply</code>...
<p>I found this while googling for the issue: <a href="http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository" rel="noreferrer">http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository</a></p> <blockquote> <p><code>git apply</code>...
119, 2132, 21628
git, msysgit, patch
<h1>Git apply patch fails silently (no errors but nothing happens)</h1> <p>I'm trying to apply a patch, and git apply patch doesn't give me any errors:</p> <pre><code>sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ git apply ../../commit-d0d9477 sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (mast...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,081
git
# Git apply patch fails silently (no errors but nothing happens) I'm trying to apply a patch, and git apply patch doesn't give me any errors: ``` sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ git apply ../../commit-d0d9477 sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ ``` As you ca...
I found this while googling for the issue: <http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository> > `git apply` will fail to do anything when used within a local checkout of a git repository (other than the one for the project the patch is made for), such as if you are pat...
20409853
git stash and apply
44
2013-12-05 20:20:13
<p>I'm new to git and not quite clear on how stashing works.</p> <p>Let's say I'm working on branch master and try to <code>git pull</code> and receive the error that my local changes would be overwritten and need to be stashed or committed. If I haven't staged any of my changes and run <code>git stash</code>, then do...
58,538
772,264
2017-09-19 17:33:20
20,412,685
94
2013-12-05 23:07:18
1,256,452
2017-09-19 17:33:20
https://stackoverflow.com/q/20409853
https://stackoverflow.com/a/20412685
<h3>Quick "TL;DR" take-away version, so one can come back later and study more</h3> <p><code>git stash</code> hangs a stash-bag—this is a peculiar form of a merge commit that is not on any branch—on the current <code>HEAD</code> commit. A later <code>git stash apply</code>, when you're at any commit—probably a <em>di...
<h3>Quick "TL;DR" take-away version, so one can come back later and study more</h3> <p><code>git stash</code> hangs a stash-bag—this is a peculiar form of a merge commit that is not on any branch—on the current <code>HEAD</code> commit. A later <code>git stash apply</code>, when you're at any commit—probably a <em>di...
119, 13091, 28896
git, git-pull, git-stash
<h1>git stash and apply</h1> <p>I'm new to git and not quite clear on how stashing works.</p> <p>Let's say I'm working on branch master and try to <code>git pull</code> and receive the error that my local changes would be overwritten and need to be stashed or committed. If I haven't staged any of my changes and run <c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,082
git
# git stash and apply I'm new to git and not quite clear on how stashing works. Let's say I'm working on branch master and try to `git pull` and receive the error that my local changes would be overwritten and need to be stashed or committed. If I haven't staged any of my changes and run `git stash`, then do a `git p...
### Quick "TL;DR" take-away version, so one can come back later and study more `git stash` hangs a stash-bag—this is a peculiar form of a merge commit that is not on any branch—on the current `HEAD` commit. A later `git stash apply`, when you're at any commit—probably a *different* commit—then tries to restore the *ch...
777949
Can I make git recognize a UTF-16 file as text?
175
2009-04-22 15:51:32
<p>I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16.</p> <p>Can git be taught to recognize that this file is text and handle it appropriately?</p> <p>I'm using git u...
93,124
18,103
2024-10-18 19:09:00
1,300,928
93
2009-08-19 15:55:47
20,131
2009-08-19 15:55:47
https://stackoverflow.com/q/777949
https://stackoverflow.com/a/1300928
<p>I've been struggling with this problem for a while, and just discovered (for me) a perfect solution:</p> <pre><code>$ git config --global diff.tool vimdiff # or merge.tool to get merging too! $ git difftool commit1 commit2 </code></pre> <p><code>git difftool</code> takes the same arguments as <code>git diff</...
<p>I've been struggling with this problem for a while, and just discovered (for me) a perfect solution:</p> <pre><code>$ git config --global diff.tool vimdiff # or merge.tool to get merging too! $ git difftool commit1 commit2 </code></pre> <p><code>git difftool</code> takes the same arguments as <code>git diff</...
119, 279, 606, 10016, 12658
character-encoding, diff, git, unicode, utf-16
<h1>Can I make git recognize a UTF-16 file as text?</h1> <p>I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16.</p> <p>Can git be taught to recognize that this file is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,083
git
# Can I make git recognize a UTF-16 file as text? I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16. Can git be taught to recognize that this file is text and handle i...
I've been struggling with this problem for a while, and just discovered (for me) a perfect solution: ``` $ git config --global diff.tool vimdiff # or merge.tool to get merging too! $ git difftool commit1 commit2 ``` `git difftool` takes the same arguments as `git diff` would, but runs a diff program of your choi...
1109069
git selective revert local changes from a file
160
2009-07-10 11:40:05
<p>In my git repo which is tracking a svn repo I have made a number of edits to a single file.</p> <p>Now I want to revert those changes(like svn revert), but only portions of the file.</p> <p>I want to be able to view the diffs on the file, discard(revert) the changes that I don't want and retain the changes I want....
41,453
131,667
2015-09-07 05:05:38
1,109,191
93
2009-07-10 12:15:05
117,564
2012-07-26 10:02:40
https://stackoverflow.com/q/1109069
https://stackoverflow.com/a/1109191
<p>You can do that directly with <code>git checkout -p</code>. See <a href="https://stackoverflow.com/a/2383361/117564">Daniel Stutzbach's answer</a> below.</p> <hr> <p><em>Old answer (before <code>checkout -p</code> was introduced):</em></p> <p>You can do it like this:</p> <pre><code>git add -i </code></pre> <p>(...
<p>You can do that directly with <code>git checkout -p</code>. See <a href="https://stackoverflow.com/a/2383361/117564">Daniel Stutzbach's answer</a> below.</p> <hr> <p><em>Old answer (before <code>checkout -p</code> was introduced):</em></p> <p>You can do it like this:</p> <pre><code>git add -i </code></pre> <p>(...
119, 456, 6452
git, git-svn, version-control
<h1>git selective revert local changes from a file</h1> <p>In my git repo which is tracking a svn repo I have made a number of edits to a single file.</p> <p>Now I want to revert those changes(like svn revert), but only portions of the file.</p> <p>I want to be able to view the diffs on the file, discard(revert) the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,084
git
# git selective revert local changes from a file In my git repo which is tracking a svn repo I have made a number of edits to a single file. Now I want to revert those changes(like svn revert), but only portions of the file. I want to be able to view the diffs on the file, discard(revert) the changes that I don't wa...
You can do that directly with `git checkout -p`. See [Daniel Stutzbach's answer](https://stackoverflow.com/a/2383361/117564) below. --- *Old answer (before `checkout -p` was introduced):* You can do it like this: ``` git add -i ``` (select the hunks you want to keep) ``` git commit -m "tmp" ``` Now you have a co...
5519244
Are there any downsides to enabling git rerere?
150
2011-04-01 21:50:05
<p>I've read various things about git's <code>rerere</code> feature, and I'm considering enabling it.</p> <blockquote> <p>The <code>git rerere</code> functionality is a bit of a hidden feature. The name stands for <strong>“reuse recorded resolution”</strong> and, as the name implies, it allows you to ask Git to remembe...
19,278
125,921
2023-11-09 13:22:16
5,521,483
93
2011-04-02 05:59:08
65,977
2015-03-30 09:11:44
https://stackoverflow.com/q/5519244
https://stackoverflow.com/a/5521483
<p>If you do a merge incorrectly, then discard it, then do the &quot;same&quot; merge again, it will be incorrect again. You can forget a recorded resolution, though. From <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html" rel="noreferrer">the documentation</a>:</p> <blockquote> <p><code>git rer...
<p>If you do a merge incorrectly, then discard it, then do the &quot;same&quot; merge again, it will be incorrect again. You can forget a recorded resolution, though. From <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html" rel="noreferrer">the documentation</a>:</p> <blockquote> <p><code>git rer...
119, 717, 83367
git, git-rerere, merge
<h1>Are there any downsides to enabling git rerere?</h1> <p>I've read various things about git's <code>rerere</code> feature, and I'm considering enabling it.</p> <blockquote> <p>The <code>git rerere</code> functionality is a bit of a hidden feature. The name stands for <strong>“reuse recorded resolution”</strong> and,...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,085
git
# Are there any downsides to enabling git rerere? I've read various things about git's `rerere` feature, and I'm considering enabling it. > The `git rerere` functionality is a bit of a hidden feature. The name stands for **“reuse recorded resolution”** and, as the name implies, it allows you to ask Git to remember ho...
If you do a merge incorrectly, then discard it, then do the "same" merge again, it will be incorrect again. You can forget a recorded resolution, though. From [the documentation](http://www.kernel.org/pub/software/scm/git/docs/git-rerere.html): > `git rerere forget <pathspec>` > > This resets the conflict resolutions ...