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
16171813
How can I overwrite, not merge, one remote branch into another branch?
34
2013-04-23 14:20:47
<p>I have two branches. Staging and Beta. Staging has code in it ( including files ), that I do not want at all. How can I make Beta completely overwrite Staging, so that none of those files or code are merged from Staging into Beta.</p> <p>I see some people recommend doing this :</p> <pre><code>git checkout staging ...
37,672
93,311
2017-05-17 06:16:00
16,171,880
31
2013-04-23 14:24:33
572,644
2013-04-23 14:24:33
https://stackoverflow.com/q/16171813
https://stackoverflow.com/a/16171880
<p>You can simple delete <code>staging</code> and re-create it based on <code>beta</code>:</p> <pre><code>git branch -D staging git checkout beta git branch staging </code></pre>
<p>You can simple delete <code>staging</code> and re-create it based on <code>beta</code>:</p> <pre><code>git branch -D staging git checkout beta git branch staging </code></pre>
119, 53847
branching-and-merging, git
<h1>How can I overwrite, not merge, one remote branch into another branch?</h1> <p>I have two branches. Staging and Beta. Staging has code in it ( including files ), that I do not want at all. How can I make Beta completely overwrite Staging, so that none of those files or code are merged from Staging into Beta.</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,817
git
# How can I overwrite, not merge, one remote branch into another branch? I have two branches. Staging and Beta. Staging has code in it ( including files ), that I do not want at all. How can I make Beta completely overwrite Staging, so that none of those files or code are merged from Staging into Beta. I see some peo...
You can simple delete `staging` and re-create it based on `beta`: ``` git branch -D staging git checkout beta git branch staging ```
2574266
Is it possible in git to create a new, empty remote branch without pushing?
33
2010-04-04 11:39:42
<p>Most examples of creating remote branches involve pushing from a local branch</p> <p>Is there a way of creating an empty remote branch without pushing?</p> <p>Is it also possible to create a local empty branch,check it out then link it to the new also empty remote branch without pushing? </p>
35,868
172,406
2021-01-08 21:59:40
2,574,521
31
2010-04-04 13:34:07
6,309
2010-04-04 13:34:07
https://stackoverflow.com/q/2574266
https://stackoverflow.com/a/2574521
<p>As mentioned in the blog post "<a href="http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/" rel="noreferrer">Start a New Branch on your Remote Git Repository</a>":</p> <blockquote> <ul> <li>Creating a Remote Branch </li> </ul> </blockquote> <pre><code>git push origin origin:...
<p>As mentioned in the blog post "<a href="http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/" rel="noreferrer">Start a New Branch on your Remote Git Repository</a>":</p> <blockquote> <ul> <li>Creating a Remote Branch </li> </ul> </blockquote> <pre><code>git push origin origin:...
119, 1879
branch, git
<h1>Is it possible in git to create a new, empty remote branch without pushing?</h1> <p>Most examples of creating remote branches involve pushing from a local branch</p> <p>Is there a way of creating an empty remote branch without pushing?</p> <p>Is it also possible to create a local empty branch,check it out then li...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,819
git
# Is it possible in git to create a new, empty remote branch without pushing? Most examples of creating remote branches involve pushing from a local branch Is there a way of creating an empty remote branch without pushing? Is it also possible to create a local empty branch,check it out then link it to the new also e...
As mentioned in the blog post "[Start a New Branch on your Remote Git Repository](http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/)": > - Creating a Remote Branch ``` git push origin origin:refs/heads/new_feature_name ``` > - Make sure everything is up-to-date ``` git fetch origin...
9439702
How to open magit-status in full window
32
2012-02-24 23:49:43
<p>I am using Magit to work with git in emacs. I have bound magit-status to a key, but every time I hit the key it opens in a split in lower half of the window and i have to hit C-x 1 to get it into a full window. How can I make it open in a full window by default?</p>
5,252
302,268
2021-05-08 19:44:15
9,440,613
31
2012-02-25 02:25:10
324,105
2012-02-25 13:15:09
https://stackoverflow.com/q/9439702
https://stackoverflow.com/a/9440613
<pre class="lang-lisp prettyprint-override"><code>(setq magit-status-buffer-switch-function 'switch-to-buffer) </code></pre> <p>or via customize:</p> <p><kbd>M-x</kbd> <code>customize-variable</code> <kbd>RET</kbd> <code>magit-status-buffer-switch-function</code> <kbd>RET</kbd></p>
<pre class="lang-lisp prettyprint-override"><code>(setq magit-status-buffer-switch-function 'switch-to-buffer) </code></pre> <p>or via customize:</p> <p><kbd>M-x</kbd> <code>customize-variable</code> <kbd>RET</kbd> <code>magit-status-buffer-switch-function</code> <kbd>RET</kbd></p>
371, 41829
emacs, magit
<h1>How to open magit-status in full window</h1> <p>I am using Magit to work with git in emacs. I have bound magit-status to a key, but every time I hit the key it opens in a split in lower half of the window and i have to hit C-x 1 to get it into a full window. How can I make it open in a full window by default?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,820
git
# How to open magit-status in full window I am using Magit to work with git in emacs. I have bound magit-status to a key, but every time I hit the key it opens in a split in lower half of the window and i have to hit C-x 1 to get it into a full window. How can I make it open in a full window by default?
``` (setq magit-status-buffer-switch-function 'switch-to-buffer) ``` or via customize: `M-x` `customize-variable` `RET` `magit-status-buffer-switch-function` `RET`
6574116
Meaning of leading slash in `.gitignore` file
32
2011-07-04 16:45:44
<p>If I put a pattern in a <code>.gitignore</code> file with a leading slash, does the slash refer to the directory in which the <code>.gitignore</code> file is located, or does it refer to the root of the whole repository?</p> <p>(The man pages I have found have hidden this information carefully.)</p>
6,782
41,661
2011-07-04 20:55:01
6,574,203
31
2011-07-04 16:56:28
600,500
2011-07-04 20:55:01
https://stackoverflow.com/q/6574116
https://stackoverflow.com/a/6574203
<p>This is the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">documentation text</a>:</p> <blockquote> <ul> <li>A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".</li> </ul> </blockquote> <p>These are my guesses:</p> <u...
<p>This is the <a href="http://git-scm.com/docs/gitignore" rel="noreferrer">documentation text</a>:</p> <blockquote> <ul> <li>A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".</li> </ul> </blockquote> <p>These are my guesses:</p> <u...
119, 25056
git, gitignore
<h1>Meaning of leading slash in `.gitignore` file</h1> <p>If I put a pattern in a <code>.gitignore</code> file with a leading slash, does the slash refer to the directory in which the <code>.gitignore</code> file is located, or does it refer to the root of the whole repository?</p> <p>(The man pages I have found have ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,821
git
# Meaning of leading slash in `.gitignore` file If I put a pattern in a `.gitignore` file with a leading slash, does the slash refer to the directory in which the `.gitignore` file is located, or does it refer to the root of the whole repository? (The man pages I have found have hidden this information carefully.)
This is the [documentation text](http://git-scm.com/docs/gitignore): > - A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" > but not "mozilla-sha1/sha1.c". These are my guesses: - If you use an in-repository-`.gitignore`, the directory in which the `.gitignore` is lo...
30329490
Git ignore for Ionic project
31
2015-05-19 15:10:30
<p>I'm somewhat new applications with Ionic and very new to the subject of Git repositories. When I commit, endless files are uploaded - I find it very difficult to identify what changes are in the project.</p> <p>So I wanted to ask for help here, is there a guide to ignore files if a file exists by default, and where,...
20,594
4,287,850
2021-08-22 11:16:01
30,330,276
31
2015-05-19 15:45:23
4,371,033
2015-05-19 15:56:47
https://stackoverflow.com/q/30329490
https://stackoverflow.com/a/30330276
<p>The problem here is that if you already add all those files, once you put the <code>.gitignore</code> it will not work as you want. You need to put the <code>.gitignore</code> at the very beginning of your project.</p> <p>So, my advise: make another project in Git, just upload your project again and create the <cod...
<p>The problem here is that if you already add all those files, once you put the <code>.gitignore</code> it will not work as you want. You need to put the <code>.gitignore</code> at the very beginning of your project.</p> <p>So, my advise: make another project in Git, just upload your project again and create the <cod...
119, 100064
git, ionic-framework
<h1>Git ignore for Ionic project</h1> <p>I'm somewhat new applications with Ionic and very new to the subject of Git repositories. When I commit, endless files are uploaded - I find it very difficult to identify what changes are in the project.</p> <p>So I wanted to ask for help here, is there a guide to ignore files i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,823
git
# Git ignore for Ionic project I'm somewhat new applications with Ionic and very new to the subject of Git repositories. When I commit, endless files are uploaded - I find it very difficult to identify what changes are in the project. So I wanted to ask for help here, is there a guide to ignore files if a file exists...
The problem here is that if you already add all those files, once you put the `.gitignore` it will not work as you want. You need to put the `.gitignore` at the very beginning of your project. So, my advise: make another project in Git, just upload your project again and create the `.gitignore` file. I am telling you ...
26738572
Finding out the version of git on remote server
31
2014-11-04 15:12:20
<p>I am looking for the git command on my local machine which i can run to find out the version of git running on the remote server? If this is even possible.</p>
16,735
41,674
2022-05-02 15:16:33
26,741,657
31
2014-11-04 17:48:23
729,881
2022-05-02 15:16:33
https://stackoverflow.com/q/26738572
https://stackoverflow.com/a/26741657
<p>Modern git servers (beginning in <a href="https://github.com/git/git/commit/ff5effdf455bd6e694ff0bb3e0793515a2214adb" rel="nofollow noreferrer">git 1.7.12.1</a>) will return their version information in the <em>capabilities</em> negotiation in the protocol. While it's accurate that there's no git command that you c...
<p>Modern git servers (beginning in <a href="https://github.com/git/git/commit/ff5effdf455bd6e694ff0bb3e0793515a2214adb" rel="nofollow noreferrer">git 1.7.12.1</a>) will return their version information in the <em>capabilities</em> negotiation in the protocol. While it's accurate that there's no git command that you c...
119
git
<h1>Finding out the version of git on remote server</h1> <p>I am looking for the git command on my local machine which i can run to find out the version of git running on the remote server? If this is even possible.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,824
git
# Finding out the version of git on remote server I am looking for the git command on my local machine which i can run to find out the version of git running on the remote server? If this is even possible.
Modern git servers (beginning in [git 1.7.12.1](https://github.com/git/git/commit/ff5effdf455bd6e694ff0bb3e0793515a2214adb)) will return their version information in the *capabilities* negotiation in the protocol. While it's accurate that there's no git command that you can run locally, you can simply query the git ser...
42077734
git blame on windows reports "fatal: no such path <path> in HEAD"
30
2017-02-06 21:40:55
<p>When I run git blame on a file in a folder e,g,:</p> <p><code>git blame Foo/FileA.txt</code></p> <p>it returns</p> <p><code>fatal: no such path 'Foo/FileA.txt' in HEAD</code></p> <p>I can clearly see that this file exists on the file system, and other files in the same folder can be successfully blamed - so what...
19,931
87,427
2025-02-01 13:56:14
42,077,735
31
2017-02-06 21:40:55
87,427
2017-05-19 15:29:09
https://stackoverflow.com/q/42077734
https://stackoverflow.com/a/42077735
<p>This is due to renaming a parent folder on the file system with a new name that varies only by case - and some files were added in a commit occurring before the rename of the folder. Here is a repro, from a Powershell prompt:</p> <pre><code>mkdir C:\RenameProblem cd C:\RenameProblem git init mkdir foo "FileA" &gt; ...
<p>This is due to renaming a parent folder on the file system with a new name that varies only by case - and some files were added in a commit occurring before the rename of the folder. Here is a repro, from a Powershell prompt:</p> <pre><code>mkdir C:\RenameProblem cd C:\RenameProblem git init mkdir foo "FileA" &gt; ...
119, 105902, 123373
git, git-blame, git-for-windows
<h1>git blame on windows reports "fatal: no such path <path> in HEAD"</h1> <p>When I run git blame on a file in a folder e,g,:</p> <p><code>git blame Foo/FileA.txt</code></p> <p>it returns</p> <p><code>fatal: no such path 'Foo/FileA.txt' in HEAD</code></p> <p>I can clearly see that this file exists on the file syst...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,826
git
# git blame on windows reports "fatal: no such path in HEAD" When I run git blame on a file in a folder e,g,: `git blame Foo/FileA.txt` it returns `fatal: no such path 'Foo/FileA.txt' in HEAD` I can clearly see that this file exists on the file system, and other files in the same folder can be successfully blamed ...
This is due to renaming a parent folder on the file system with a new name that varies only by case - and some files were added in a commit occurring before the rename of the folder. Here is a repro, from a Powershell prompt: ``` mkdir C:\RenameProblem cd C:\RenameProblem git init mkdir foo "FileA" > foo/FileA.txt git...
21925808
automate usage of SSH local key for git deployment with ansible
30
2014-02-21 05:14:24
<p>I am working with vagrant and ansible. I want to automate the <strong>deployment</strong> role of ansible (<a href="https://github.com/oskargicast/django-provision">You can check my repo here</a>). For this purpose, I am trying to deploy my local ssh key into my VPS and my vagrant guest machine (I am trying SSH agen...
25,199
2,045,826
2016-03-19 10:18:01
21,926,671
31
2014-02-21 06:14:53
467,722
2014-03-12 21:38:06
https://stackoverflow.com/q/21925808
https://stackoverflow.com/a/21926671
<p>If you choose the <code>key_file</code> way, my guess is that the key must be on the VPS/vagrant machine. So you might want to copy it first. Note that you need a private key here, not a public one.</p> <p>For your second option, you could push your key to specific users depending on the instance type. Suppose the ...
<p>If you choose the <code>key_file</code> way, my guess is that the key must be on the VPS/vagrant machine. So you might want to copy it first. Note that you need a private key here, not a public one.</p> <p>For your second option, you could push your key to specific users depending on the instance type. Suppose the ...
119, 190, 25308, 66981, 86394
ansible, deployment, git, ssh-keys, vagrant
<h1>automate usage of SSH local key for git deployment with ansible</h1> <p>I am working with vagrant and ansible. I want to automate the <strong>deployment</strong> role of ansible (<a href="https://github.com/oskargicast/django-provision">You can check my repo here</a>). For this purpose, I am trying to deploy my loc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,827
git
# automate usage of SSH local key for git deployment with ansible I am working with vagrant and ansible. I want to automate the **deployment** role of ansible ([You can check my repo here](https://github.com/oskargicast/django-provision)). For this purpose, I am trying to deploy my local ssh key into my VPS and my vag...
If you choose the `key_file` way, my guess is that the key must be on the VPS/vagrant machine. So you might want to copy it first. Note that you need a private key here, not a public one. For your second option, you could push your key to specific users depending on the instance type. Suppose the user in VPS is vpsuse...
12342152
JGit and finding the Head
30
2012-09-09 19:18:18
<p>I'm trying to get my hands on the HEAD commit with JGit:</p> <pre><code>val builder = new FileRepositoryBuilder() val repo = builder.setGitDir(new File("/www/test-repo")) .readEnvironment() .findGitDir() .build() val walk: RevWalk = new RevWalk(repo, 100) val head: ObjectId = repo.resolve(Constants.HEAD) va...
15,835
283,055
2022-05-27 13:17:17
12,343,345
31
2012-09-09 21:57:54
334,519
2012-09-09 21:57:54
https://stackoverflow.com/q/12342152
https://stackoverflow.com/a/12343345
<p>You need to point to the Git metadata directory (probably <code>/www/test-repo/.git</code>) when you call <code>setGitDir</code>, not to the working directory (<code>/www/test-repo</code>).</p> <p>I have to admit I'm not sure what <code>findGitDir</code> is supposed to do, but I've run into this problem before and ...
<p>You need to point to the Git metadata directory (probably <code>/www/test-repo/.git</code>) when you call <code>setGitDir</code>, not to the working directory (<code>/www/test-repo</code>).</p> <p>I have to admit I'm not sure what <code>findGitDir</code> is supposed to do, but I've run into this problem before and ...
17, 119, 3143, 61058
git, java, jgit, scala
<h1>JGit and finding the Head</h1> <p>I'm trying to get my hands on the HEAD commit with JGit:</p> <pre><code>val builder = new FileRepositoryBuilder() val repo = builder.setGitDir(new File("/www/test-repo")) .readEnvironment() .findGitDir() .build() val walk: RevWalk = new RevWalk(repo, 100) val head: ObjectI...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,828
git
# JGit and finding the Head I'm trying to get my hands on the HEAD commit with JGit: ``` val builder = new FileRepositoryBuilder() val repo = builder.setGitDir(new File("/www/test-repo")) .readEnvironment() .findGitDir() .build() val walk: RevWalk = new RevWalk(repo, 100) val head: ObjectId = repo.resolve(Con...
You need to point to the Git metadata directory (probably `/www/test-repo/.git`) when you call `setGitDir`, not to the working directory (`/www/test-repo`). I have to admit I'm not sure what `findGitDir` is supposed to do, but I've run into this problem before and specifying the `.git` directory worked.
61252680
git rebase getting invalid upstream
29
2020-04-16 14:26:07
<p>I did the following:</p> <p><strong>git fetch --all</strong></p> <p><strong>git checkout -b my-feature-branch master</strong> </p> <p>// did some edits</p> <p><strong>git commit -m "some commit comments"</strong></p> <p><strong>git rebase another-branch</strong></p> <p>I get git error: "invalid upstream 'anoth...
66,584
8,491,316
2024-04-15 06:52:37
61,252,870
31
2020-04-16 14:33:53
515,034
2020-04-16 14:35:21
https://stackoverflow.com/q/61252680
https://stackoverflow.com/a/61252870
<p>You need to checkout 'another-branch' locally before rebasing it.</p> <pre><code>git checkout -b another-branch origin/another-branch </code></pre> <p>Or, you need to pull all the branch after fetching</p> <pre><code>git pull --all </code></pre>
<p>You need to checkout 'another-branch' locally before rebasing it.</p> <pre><code>git checkout -b another-branch origin/another-branch </code></pre> <p>Or, you need to pull all the branch after fetching</p> <pre><code>git pull --all </code></pre>
119
git
<h1>git rebase getting invalid upstream</h1> <p>I did the following:</p> <p><strong>git fetch --all</strong></p> <p><strong>git checkout -b my-feature-branch master</strong> </p> <p>// did some edits</p> <p><strong>git commit -m "some commit comments"</strong></p> <p><strong>git rebase another-branch</strong></p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,830
git
# git rebase getting invalid upstream I did the following: **git fetch --all** **git checkout -b my-feature-branch master** // did some edits **git commit -m "some commit comments"** **git rebase another-branch** I get git error: "invalid upstream 'another-branch' I can see the 'another-branch' on the remote so...
You need to checkout 'another-branch' locally before rebasing it. ``` git checkout -b another-branch origin/another-branch ``` Or, you need to pull all the branch after fetching ``` git pull --all ```
39861912
Is there any reason to not set 'git fetch' to always use the --prune option?
29
2016-10-04 21:17:52
<p>Using git fetch --prune deletes local remote tracking branches when the branch on the remote machine has been deleted. Setting remote.origin.prune to true using the following...</p> <pre><code>git config --global fetch.prune true </code></pre> <p>...makes using the fetch command always implicitly use the --prune ...
4,693
2,977,570
2016-10-04 22:33:16
39,862,779
31
2016-10-04 22:33:16
1,256,452
2016-10-04 22:33:16
https://stackoverflow.com/q/39861912
https://stackoverflow.com/a/39862779
<p>It's not fundamentally dangerous, and I have been tempted to set it in my own <code>--global</code> settings, but I never have: primarily because it also has relatively little value to me.<sup>1</sup></p> <p>As you note, the intent is, in essence, to remove <code>origin/zorg</code> once branch <code>zorg</code> is ...
<p>It's not fundamentally dangerous, and I have been tempted to set it in my own <code>--global</code> settings, but I never have: primarily because it also has relatively little value to me.<sup>1</sup></p> <p>As you note, the intent is, in essence, to remove <code>origin/zorg</code> once branch <code>zorg</code> is ...
119, 33720, 41346
git, git-fetch, git-remote
<h1>Is there any reason to not set 'git fetch' to always use the --prune option?</h1> <p>Using git fetch --prune deletes local remote tracking branches when the branch on the remote machine has been deleted. Setting remote.origin.prune to true using the following...</p> <pre><code>git config --global fetch.prune true...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,831
git
# Is there any reason to not set 'git fetch' to always use the --prune option? Using git fetch --prune deletes local remote tracking branches when the branch on the remote machine has been deleted. Setting remote.origin.prune to true using the following... ``` git config --global fetch.prune true ``` ...makes using ...
It's not fundamentally dangerous, and I have been tempted to set it in my own `--global` settings, but I never have: primarily because it also has relatively little value to me.1 As you note, the intent is, in essence, to remove `origin/zorg` once branch `zorg` is no longer present on `origin`. Since this has no direc...
11197812
How to use git format-patch on initial commit
29
2012-06-25 21:44:15
<p>I need to get patch file for inital commit (which is not empty) for our review process, but I'm confused as <code>git format-patch</code> command only makes it from branch that is on initial commit not including it.</p> <p>Seems it must be some obvious move but I'm completely missing it.</p>
8,023
749,067
2021-03-31 10:05:45
11,197,908
31
2012-06-25 21:53:50
582
2012-06-25 21:53:50
https://stackoverflow.com/q/11197812
https://stackoverflow.com/a/11197908
<p>Try <code>git format-patch --root $SHA</code> (where <code>$SHA</code> is that first commit)</p>
<p>Try <code>git format-patch --root $SHA</code> (where <code>$SHA</code> is that first commit)</p>
119, 27597
format-patch, git
<h1>How to use git format-patch on initial commit</h1> <p>I need to get patch file for inital commit (which is not empty) for our review process, but I'm confused as <code>git format-patch</code> command only makes it from branch that is on initial commit not including it.</p> <p>Seems it must be some obvious move but...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,832
git
# How to use git format-patch on initial commit I need to get patch file for inital commit (which is not empty) for our review process, but I'm confused as `git format-patch` command only makes it from branch that is on initial commit not including it. Seems it must be some obvious move but I'm completely missing it.
Try `git format-patch --root $SHA` (where `$SHA` is that first commit)
2813292
When to delete a branch from Git?
29
2010-05-11 18:14:11
<p>I'm relatively new to Git, and want to get advice on best practices for deleting branches. </p> <p>After I've created and merged a branch back into master, should I leave it hanging around for historical purposes, or should I delete it as soon as it's no longer needed for housekeeping purposes?</p>
6,818
5,675
2020-03-08 21:27:50
2,813,374
31
2010-05-11 18:27:14
262,667
2020-03-08 21:27:50
https://stackoverflow.com/q/2813292
https://stackoverflow.com/a/2813374
<p>Typically, you delete a branch after a merge. </p> <p>For example, after the following merge, you would delete the branch <code>iss53</code>, as you don't need to develop from that branch anymore. You can later recreate it at any moment using the sha1 value of the commit by <code>git checkout -b &lt;name&gt; &lt;sh...
<p>Typically, you delete a branch after a merge. </p> <p>For example, after the following merge, you would delete the branch <code>iss53</code>, as you don't need to develop from that branch anymore. You can later recreate it at any moment using the sha1 value of the commit by <code>git checkout -b &lt;name&gt; &lt;sh...
119
git
<h1>When to delete a branch from Git?</h1> <p>I'm relatively new to Git, and want to get advice on best practices for deleting branches. </p> <p>After I've created and merged a branch back into master, should I leave it hanging around for historical purposes, or should I delete it as soon as it's no longer needed for...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,834
git
# When to delete a branch from Git? I'm relatively new to Git, and want to get advice on best practices for deleting branches. After I've created and merged a branch back into master, should I leave it hanging around for historical purposes, or should I delete it as soon as it's no longer needed for housekeeping purp...
Typically, you delete a branch after a merge. For example, after the following merge, you would delete the branch `iss53`, as you don't need to develop from that branch anymore. You can later recreate it at any moment using the sha1 value of the commit by `git checkout -b <name> <sha1>`. (Branches are only necessary ...
45399894
Is it impossible to checkout a different branch in Jenkinsfile?
28
2017-07-30 12:36:50
<p>I have two branches on BitBucket: <code>master</code> and <code>develop</code>. I've also got a BitBucket Team Folder job configured on my Jenkins server to build that repository. On the <code>develop</code> branch there's the following Jenkinsfile:</p> <pre><code>node { stage('Checkout') { checkout scm...
95,279
6,737,860
2020-03-17 19:42:40
45,405,121
31
2017-07-30 22:01:01
6,737,860
2017-07-30 22:01:01
https://stackoverflow.com/q/45399894
https://stackoverflow.com/a/45405121
<p>After some hours of trial and error, I came up with a possible solution. It builds partly on Matt's answer, but I had to alter it to make it work.</p> <p>Matt was correct in the essentials: <code>checkout scm</code> simply wasn't flexible enough to allow me to do what I needed, so I had to use <code>GitSCM</code> t...
<p>After some hours of trial and error, I came up with a possible solution. It builds partly on Matt's answer, but I had to alter it to make it work.</p> <p>Matt was correct in the essentials: <code>checkout scm</code> simply wasn't flexible enough to allow me to do what I needed, so I had to use <code>GitSCM</code> t...
119, 8337, 64999, 118285
bitbucket, git, jenkins, jenkins-pipeline
<h1>Is it impossible to checkout a different branch in Jenkinsfile?</h1> <p>I have two branches on BitBucket: <code>master</code> and <code>develop</code>. I've also got a BitBucket Team Folder job configured on my Jenkins server to build that repository. On the <code>develop</code> branch there's the following Jenkins...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,835
git
# Is it impossible to checkout a different branch in Jenkinsfile? I have two branches on BitBucket: `master` and `develop`. I've also got a BitBucket Team Folder job configured on my Jenkins server to build that repository. On the `develop` branch there's the following Jenkinsfile: ``` node { stage('Checkout') { ...
After some hours of trial and error, I came up with a possible solution. It builds partly on Matt's answer, but I had to alter it to make it work. Matt was correct in the essentials: `checkout scm` simply wasn't flexible enough to allow me to do what I needed, so I had to use `GitSCM` to customize it. The major points...
14073053
Find path to git hooks directory on the shell
28
2012-12-28 17:05:52
<p>How do I find the full path to the <code>.git/hooks</code> directory of the current Git repository?</p> <hr> <p>I see the following issues:</p> <h2>Deep in the directory structure</h2> <p>I may be anywhere deep in the git repository directory structure, e.g.</p> <pre><code>/home/user/project/.git/hooks </code><...
36,101
282,601
2020-12-28 08:22:09
37,293,090
31
2016-05-18 07:37:28
6,309
2018-07-29 06:41:39
https://stackoverflow.com/q/14073053
https://stackoverflow.com/a/37293090
<p>Starting git 2.9 (June 2016), you will need to look at the new config <code>core.hooksPath</code> to really be sure of the hooks folder. </p> <p><code>git rev-parse --git-dir</code>/hooks won't be enough anymore.</p> <p>See <a href="https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643" rel="...
<p>Starting git 2.9 (June 2016), you will need to look at the new config <code>core.hooksPath</code> to really be sure of the hooks folder. </p> <p><code>git rev-parse --git-dir</code>/hooks won't be enough anymore.</p> <p>See <a href="https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643" rel="...
119
git
<h1>Find path to git hooks directory on the shell</h1> <p>How do I find the full path to the <code>.git/hooks</code> directory of the current Git repository?</p> <hr> <p>I see the following issues:</p> <h2>Deep in the directory structure</h2> <p>I may be anywhere deep in the git repository directory structure, e.g....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,837
git
# Find path to git hooks directory on the shell How do I find the full path to the `.git/hooks` directory of the current Git repository? --- I see the following issues: ## Deep in the directory structure I may be anywhere deep in the git repository directory structure, e.g. ``` /home/user/project/.git/hooks ``` ...
Starting git 2.9 (June 2016), you will need to look at the new config `core.hooksPath` to really be sure of the hooks folder. `git rev-parse --git-dir`/hooks won't be enough anymore. See [commit 867ad08](https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643), [commit de0824e](https://github.com/g...
21031201
How can I list all lightweight tags?
28
2014-01-09 21:10:29
<p>I want to list all of the lightweight tags in my repository; the best I can think of involves combining <code>git for-each-ref</code>, <code>grep</code>, and <code>cut</code>, but it seems like it'll be kind of fiddly...</p> <p>(While we're at it, we might as well talk about the same thing for annotated tags: someo...
7,718
294,313
2023-09-29 07:48:48
21,032,332
31
2014-01-09 22:12:55
1,256,452
2014-01-10 02:14:08
https://stackoverflow.com/q/21031201
https://stackoverflow.com/a/21032332
<p>All the lightweight tags are in the <code>refs/tags/</code> namespace and can be enumerated with, e.g.:</p> <pre><code>git for-each-ref --format '%(refname:short)' refs/tags/ </code></pre> <p>or:</p> <pre><code>git show-ref --tags </code></pre> <p>As for annotated tags, well, the trick here—it affects the "light...
<p>All the lightweight tags are in the <code>refs/tags/</code> namespace and can be enumerated with, e.g.:</p> <pre><code>git for-each-ref --format '%(refname:short)' refs/tags/ </code></pre> <p>or:</p> <pre><code>git show-ref --tags </code></pre> <p>As for annotated tags, well, the trick here—it affects the "light...
119, 60718
git, git-tag
<h1>How can I list all lightweight tags?</h1> <p>I want to list all of the lightweight tags in my repository; the best I can think of involves combining <code>git for-each-ref</code>, <code>grep</code>, and <code>cut</code>, but it seems like it'll be kind of fiddly...</p> <p>(While we're at it, we might as well talk ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,838
git
# How can I list all lightweight tags? I want to list all of the lightweight tags in my repository; the best I can think of involves combining `git for-each-ref`, `grep`, and `cut`, but it seems like it'll be kind of fiddly... (While we're at it, we might as well talk about the same thing for annotated tags: someone ...
All the lightweight tags are in the `refs/tags/` namespace and can be enumerated with, e.g.: ``` git for-each-ref --format '%(refname:short)' refs/tags/ ``` or: ``` git show-ref --tags ``` As for annotated tags, well, the trick here—it affects the "lightweight" tags part too—is that an annotated tag is actually an ...
13896246
Reset Git to commit without changing HEAD to detached state
28
2012-12-15 21:10:54
<p>I'd like to restore the files of the git working copy to a given commit, without setting that commit as the HEAD commit.</p> <p>If I git checkout to a given commit I obtain a detached HEAD, and after commiting changes, the commit tree would look something like:</p> <pre><code>A | B | C | \ D E </code></pre> <p...
6,881
981,009
2016-12-22 15:35:12
13,897,806
31
2012-12-16 01:31:15
6,309
2012-12-16 01:41:03
https://stackoverflow.com/q/13896246
https://stackoverflow.com/a/13897806
<p>This should do it:</p> <pre><code>git reset --hard C git reset --soft D </code></pre> <p>First you reset the <code>HEAD</code>, index and worktree to <code>C</code>.<br> Then you reset <code>HEAD</code> (and only <code>HEAD</code>, as explained in "<a href="https://stackoverflow.com/questions/5203535/practical-use...
<p>This should do it:</p> <pre><code>git reset --hard C git reset --soft D </code></pre> <p>First you reset the <code>HEAD</code>, index and worktree to <code>C</code>.<br> Then you reset <code>HEAD</code> (and only <code>HEAD</code>, as explained in "<a href="https://stackoverflow.com/questions/5203535/practical-use...
119
git
<h1>Reset Git to commit without changing HEAD to detached state</h1> <p>I'd like to restore the files of the git working copy to a given commit, without setting that commit as the HEAD commit.</p> <p>If I git checkout to a given commit I obtain a detached HEAD, and after commiting changes, the commit tree would look s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,839
git
# Reset Git to commit without changing HEAD to detached state I'd like to restore the files of the git working copy to a given commit, without setting that commit as the HEAD commit. If I git checkout to a given commit I obtain a detached HEAD, and after commiting changes, the commit tree would look something like: ...
This should do it: ``` git reset --hard C git reset --soft D ``` First you reset the `HEAD`, index and worktree to `C`. Then you reset `HEAD` (and only `HEAD`, as explained in "[Practical uses of `git reset --soft`?](https://stackoverflow.com/questions/5203535/practical-uses-of-git-reset-soft/5203843#5203843)") to ...
13310995
git difftool --dir-diff is not creating temp files for Beyond Compare 3 to use
28
2012-11-09 15:32:13
<p>I'm trying to use git's new (as of git 1.7.11) directory diff command with Beyond Compare 3 as the difftool, but the temporary files are not being created.</p> <p>For example:</p> <p><code>git difftool --dir-diff &lt;branch1&gt; &lt;branch2&gt;</code></p> <p>Beyond Compare opens a directory comparison with the co...
10,071
16,548
2018-09-04 18:15:02
13,637,243
31
2012-11-30 00:31:05
33,791
2016-05-31 17:25:46
https://stackoverflow.com/q/13310995
https://stackoverflow.com/a/13637243
<p>There is a solution described <a href="http://theo.im/blog/2012/10/27/directory-comparison-for-git-difftool/" rel="noreferrer">here</a>. Basically, if you modify your .gitconfig to use <code>BCompare.exe</code> instead of <code>BComp.exe</code>, the console session will remain open until the Beyond Compare window i...
<p>There is a solution described <a href="http://theo.im/blog/2012/10/27/directory-comparison-for-git-difftool/" rel="noreferrer">here</a>. Basically, if you modify your .gitconfig to use <code>BCompare.exe</code> instead of <code>BComp.exe</code>, the console session will remain open until the Beyond Compare window i...
119, 21628, 33007
beyondcompare3, git, msysgit
<h1>git difftool --dir-diff is not creating temp files for Beyond Compare 3 to use</h1> <p>I'm trying to use git's new (as of git 1.7.11) directory diff command with Beyond Compare 3 as the difftool, but the temporary files are not being created.</p> <p>For example:</p> <p><code>git difftool --dir-diff &lt;branch1&gt...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,840
git
# git difftool --dir-diff is not creating temp files for Beyond Compare 3 to use I'm trying to use git's new (as of git 1.7.11) directory diff command with Beyond Compare 3 as the difftool, but the temporary files are not being created. For example: `git difftool --dir-diff <branch1> <branch2>` Beyond Compare opens...
There is a solution described [here](http://theo.im/blog/2012/10/27/directory-comparison-for-git-difftool/). Basically, if you modify your .gitconfig to use `BCompare.exe` instead of `BComp.exe`, the console session will remain open until the Beyond Compare window is closed. Modify your .gitconfig settings to read: `...
27012878
Why is a stash represented as 2 commits?
27
2014-11-19 09:12:31
<p>When stashing some changes, Git creates two separate commits, 'WIP on branch' and 'index on branch':</p> <pre><code>$ git log --graph --all * commit 98aac13303ca086580c1ec9ccba5fe26c2a8ef3c |\ Merge: 7d99786 82c5c76 | | Author: Tieme &lt;my@email.com&gt; | | Date: Wed Nov 19 09:58:35 2014 +0100 | | | | WI...
1,397
672,989
2015-04-16 08:30:15
27,013,296
31
2014-11-19 09:32:58
2,274,224
2014-11-21 11:50:10
https://stackoverflow.com/q/27012878
https://stackoverflow.com/a/27013296
<h2>Short answer</h2> <p><code>git stash</code> differentiates between the changes you have on your index and the one you have in the working tree and creates commits for both of them.</p> <h2>Long answer</h2> <p><strong>Some background</strong></p> <p>Using git it's possible that the changes you have in your worki...
<h2>Short answer</h2> <p><code>git stash</code> differentiates between the changes you have on your index and the one you have in the working tree and creates commits for both of them.</p> <h2>Long answer</h2> <p><strong>Some background</strong></p> <p>Using git it's possible that the changes you have in your worki...
119, 13091, 47913
git, git-log, git-stash
<h1>Why is a stash represented as 2 commits?</h1> <p>When stashing some changes, Git creates two separate commits, 'WIP on branch' and 'index on branch':</p> <pre><code>$ git log --graph --all * commit 98aac13303ca086580c1ec9ccba5fe26c2a8ef3c |\ Merge: 7d99786 82c5c76 | | Author: Tieme &lt;my@email.com&gt; | | Dat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,841
git
# Why is a stash represented as 2 commits? When stashing some changes, Git creates two separate commits, 'WIP on branch' and 'index on branch': ``` $ git log --graph --all * commit 98aac13303ca086580c1ec9ccba5fe26c2a8ef3c |\ Merge: 7d99786 82c5c76 | | Author: Tieme <my@email.com> | | Date: Wed Nov 19 09:58:35 ...
## Short answer `git stash` differentiates between the changes you have on your index and the one you have in the working tree and creates commits for both of them. ## Long answer **Some background** Using git it's possible that the changes you have in your working tree (the files your directly work with) are diffe...
25039242
How to list all my current TODO messages in a git repository?
27
2014-07-30 14:19:15
<p>I want to see all TODO comments that <em><strong>only I</strong></em> wrote and that exist in the current code base that is git managed.</p> <p><a href="https://stackoverflow.com/questions/25034705/how-to-print-all-todo-comments-i-ever-added-or-edited-during-any-git-commit">What I've got so far</a> is printing all ...
12,402
543,875
2024-11-30 21:22:24
25,040,397
31
2014-07-30 15:08:22
390,363
2014-07-30 15:08:22
https://stackoverflow.com/q/25039242
https://stackoverflow.com/a/25040397
<p>You can combine <code>git blame</code> with grep. </p> <p>Like this (not the best one, but should work)</p> <pre><code>git grep -l TODO | xargs -n1 git blame | grep 'Your name' | grep TODO </code></pre> <p>Improved versions might combine line numbers found by first grep with <code>git blame</code>'s ability to sh...
<p>You can combine <code>git blame</code> with grep. </p> <p>Like this (not the best one, but should work)</p> <pre><code>git grep -l TODO | xargs -n1 git blame | grep 'Your name' | grep TODO </code></pre> <p>Improved versions might combine line numbers found by first grep with <code>git blame</code>'s ability to sh...
119, 17156, 49036, 53850
git, git-commit, text-search, todo
<h1>How to list all my current TODO messages in a git repository?</h1> <p>I want to see all TODO comments that <em><strong>only I</strong></em> wrote and that exist in the current code base that is git managed.</p> <p><a href="https://stackoverflow.com/questions/25034705/how-to-print-all-todo-comments-i-ever-added-or-...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,842
git
# How to list all my current TODO messages in a git repository? I want to see all TODO comments that ***only I*** wrote and that exist in the current code base that is git managed. [What I've got so far](https://stackoverflow.com/questions/25034705/how-to-print-all-todo-comments-i-ever-added-or-edited-during-any-git-...
You can combine `git blame` with grep. Like this (not the best one, but should work) ``` git grep -l TODO | xargs -n1 git blame | grep 'Your name' | grep TODO ``` Improved versions might combine line numbers found by first grep with `git blame`'s ability to show only given lines.
16818025
Get the commit hash for a tag
27
2013-05-29 15:27:32
<p>It is related to <a href="https://stackoverflow.com/questions/16795512/making-git-show-to-show-information-in-a-machine-parseable-format">Making git show to show information in a machine parseable format</a> but I am getting tired of the fact that I now have to do a lot of parsing to get the commit hash. </p> <p>Ca...
31,094
44,124
2021-03-22 12:18:16
16,818,124
31
2013-05-29 15:31:57
422,597
2021-03-22 12:18:16
https://stackoverflow.com/q/16818025
https://stackoverflow.com/a/16818124
<p>What about <code>git log -1 --format=format:&quot;%H&quot; mylabel</code></p> <p>EDIT:</p> <p>Actually a better solution would be :</p> <pre><code>git show-ref -s mylabel </code></pre> <p><strong>WARNING This only works for Unannotated tags</strong> For a more general and safer command see <a href="https://stackover...
<p>What about <code>git log -1 --format=format:&quot;%H&quot; mylabel</code></p> <p>EDIT:</p> <p>Actually a better solution would be :</p> <pre><code>git show-ref -s mylabel </code></pre> <p><strong>WARNING This only works for Unannotated tags</strong> For a more general and safer command see <a href="https://stackover...
119
git
<h1>Get the commit hash for a tag</h1> <p>It is related to <a href="https://stackoverflow.com/questions/16795512/making-git-show-to-show-information-in-a-machine-parseable-format">Making git show to show information in a machine parseable format</a> but I am getting tired of the fact that I now have to do a lot of pars...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,843
git
# Get the commit hash for a tag It is related to [Making git show to show information in a machine parseable format](https://stackoverflow.com/questions/16795512/making-git-show-to-show-information-in-a-machine-parseable-format) but I am getting tired of the fact that I now have to do a lot of parsing to get the commi...
What about `git log -1 --format=format:"%H" mylabel` EDIT: Actually a better solution would be : ``` git show-ref -s mylabel ``` **WARNING This only works for Unannotated tags** For a more general and safer command see <https://stackoverflow.com/a/1862542/1586965> EDIT bis: As mentioned in the comments, be careful...
37737096
Signing an existing commit with GPG
25
2016-06-09 22:17:23
<p>I'm looking for a way to replicate what <code>git commit -S</code> does but on a specific commit, by giving its SHA for instance.</p> <p>Is it possible?</p>
22,305
4,363,634
2024-07-31 11:04:43
37,742,030
31
2016-06-10 07:09:53
1,174,076
2016-06-10 14:02:32
https://stackoverflow.com/q/37737096
https://stackoverflow.com/a/37742030
<p>Signing a commit will change the commit metadata, and thus change the underlying SHA1 commit ID. As you probably know, for Git, this has the same consequence of trying to change the contents of your history.</p> <p>If you want to just re-sign your last commit you could run:</p> <p><code>git commit -S --amend</code...
<p>Signing a commit will change the commit metadata, and thus change the underlying SHA1 commit ID. As you probably know, for Git, this has the same consequence of trying to change the contents of your history.</p> <p>If you want to just re-sign your last commit you could run:</p> <p><code>git commit -S --amend</code...
119
git
<h1>Signing an existing commit with GPG</h1> <p>I'm looking for a way to replicate what <code>git commit -S</code> does but on a specific commit, by giving its SHA for instance.</p> <p>Is it possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,846
git
# Signing an existing commit with GPG I'm looking for a way to replicate what `git commit -S` does but on a specific commit, by giving its SHA for instance. Is it possible?
Signing a commit will change the commit metadata, and thus change the underlying SHA1 commit ID. As you probably know, for Git, this has the same consequence of trying to change the contents of your history. If you want to just re-sign your last commit you could run: `git commit -S --amend` If you want to re-sign a ...
20765030
git remove a commit from pull request
24
2013-12-24 18:01:52
<p>I'm newbie to open source contribution, so it one of my first tries.</p> <p>I developed a library (gem) called <code>validates</code>: <a href="https://github.com/kaize/validates/">https://github.com/kaize/validates/</a></p> <p>I made 2 branches through <code>git checkout -b branch_name</code>:</p> <p>https://git...
32,956
2,926,641
2015-11-28 09:53:49
20,765,137
31
2013-12-24 18:12:48
1,174,001
2013-12-24 18:12:48
https://stackoverflow.com/q/20765030
https://stackoverflow.com/a/20765137
<p>On the <code>ip-validator</code> branch, you'd do <code>git rebase -i HEAD~2</code> - this will start an interactive rebase back two commits on that branch. </p> <p>At this point, you'll get an editor open with options seen here: <a href="https://help.github.com/articles/interactive-rebase">https://help.github.com...
<p>On the <code>ip-validator</code> branch, you'd do <code>git rebase -i HEAD~2</code> - this will start an interactive rebase back two commits on that branch. </p> <p>At this point, you'll get an editor open with options seen here: <a href="https://help.github.com/articles/interactive-rebase">https://help.github.com...
119, 29934, 78810
git, git-cherry-pick, git-rebase
<h1>git remove a commit from pull request</h1> <p>I'm newbie to open source contribution, so it one of my first tries.</p> <p>I developed a library (gem) called <code>validates</code>: <a href="https://github.com/kaize/validates/">https://github.com/kaize/validates/</a></p> <p>I made 2 branches through <code>git chec...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,847
git
# git remove a commit from pull request I'm newbie to open source contribution, so it one of my first tries. I developed a library (gem) called `validates`: <https://github.com/kaize/validates/> I made 2 branches through `git checkout -b branch_name`: https://github.com/kaize/validates/pull/20 & https://github.com/...
On the `ip-validator` branch, you'd do `git rebase -i HEAD~2` - this will start an interactive rebase back two commits on that branch. At this point, you'll get an editor open with options seen here: <https://help.github.com/articles/interactive-rebase> Simply put, to remove that commit, just delete the commit line i...
16921787
How to enable wildcard file paths for git diff?
24
2013-06-04 15:31:28
<p>I would expect <code>git diff</code> to work like <code>git add</code> and others, in being able to do something like</p> <pre><code>git diff **/models.py </code></pre> <p>rather than having to do</p> <pre><code>git diff /full/path/to/my/python/file/called/models.py </code></pre> <p>It's strange though because</...
8,271
541,208
2015-10-26 12:04:10
16,930,019
31
2013-06-05 01:13:15
1,002,260
2015-10-26 12:04:10
https://stackoverflow.com/q/16921787
https://stackoverflow.com/a/16930019
<pre><code>git diff [options] [&lt;commit&gt;] [--] [&lt;path&gt;...] </code></pre> <p>Example</p> <pre><code>git diff -- */models.py </code></pre> <p><a href="http://kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer">http://kernel.org/pub/software/scm/git/docs/git-diff.html</a></p>
<pre><code>git diff [options] [&lt;commit&gt;] [--] [&lt;path&gt;...] </code></pre> <p>Example</p> <pre><code>git diff -- */models.py </code></pre> <p><a href="http://kernel.org/pub/software/scm/git/docs/git-diff.html" rel="noreferrer">http://kernel.org/pub/software/scm/git/docs/git-diff.html</a></p>
119, 9033
git, git-diff
<h1>How to enable wildcard file paths for git diff?</h1> <p>I would expect <code>git diff</code> to work like <code>git add</code> and others, in being able to do something like</p> <pre><code>git diff **/models.py </code></pre> <p>rather than having to do</p> <pre><code>git diff /full/path/to/my/python/file/called/...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,848
git
# How to enable wildcard file paths for git diff? I would expect `git diff` to work like `git add` and others, in being able to do something like ``` git diff **/models.py ``` rather than having to do ``` git diff /full/path/to/my/python/file/called/models.py ``` It's strange though because ``` git commit **/mode...
``` git diff [options] [<commit>] [--] [<path>...] ``` Example ``` git diff -- */models.py ``` <http://kernel.org/pub/software/scm/git/docs/git-diff.html>
41930608
Jenkins Git integration - How to disable SSL certificate validation
23
2017-01-30 07:12:32
<p>I am getting the below error while creating a job from Jenkins. How do I disable certificate validation in Jenkins?</p> <p>From Git Bash I can use <code>git config --global http.sslVerify false</code> command to disable it, but not sure how to use it from Jenkins.</p> <p>Error:</p> <pre><code>Failed to connect to...
110,552
4,385,285
2023-10-16 06:28:46
41,932,902
31
2017-01-30 09:50:01
4,627,880
2023-03-20 08:43:01
https://stackoverflow.com/q/41930608
https://stackoverflow.com/a/41932902
<p>Best option is to add the self-signed certificate to your certificate store</p> <p>Obtain the server certificate tree This can be done using chrome.</p> <ol> <li><p>Navigate to be server address. Click on the padlock icon and view the certificates. Export all of the certificate chain as base64 encoded files (PEM) fo...
<p>Best option is to add the self-signed certificate to your certificate store</p> <p>Obtain the server certificate tree This can be done using chrome.</p> <ol> <li><p>Navigate to be server address. Click on the padlock icon and view the certificates. Export all of the certificate chain as base64 encoded files (PEM) fo...
119, 64999, 76768
git, jenkins, jenkins-plugins
<h1>Jenkins Git integration - How to disable SSL certificate validation</h1> <p>I am getting the below error while creating a job from Jenkins. How do I disable certificate validation in Jenkins?</p> <p>From Git Bash I can use <code>git config --global http.sslVerify false</code> command to disable it, but not sure ho...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,849
git
# Jenkins Git integration - How to disable SSL certificate validation I am getting the below error while creating a job from Jenkins. How do I disable certificate validation in Jenkins? From Git Bash I can use `git config --global http.sslVerify false` command to disable it, but not sure how to use it from Jenkins. ...
Best option is to add the self-signed certificate to your certificate store Obtain the server certificate tree This can be done using chrome. 1. Navigate to be server address. Click on the padlock icon and view the certificates. Export all of the certificate chain as base64 encoded files (PEM) format. 2. Add the cert...
38864884
Why does this cherry-pick have a conflict?
23
2016-08-10 05:25:19
<p>I know <code>git cherry-pick</code> is a command that use to apply the changes of specified commit, but I think I just don't really understand the way it works.</p> <p>Let's say a repo act like that:</p> <pre><code>git init echo a&gt;a git add .; git commit -am 'master add line a' git checkout -b dev echo b&gt;&...
13,012
4,340,261
2016-08-24 02:59:51
38,989,749
31
2016-08-17 06:41:53
6,309
2016-08-17 07:00:29
https://stackoverflow.com/q/38864884
https://stackoverflow.com/a/38989749
<p>Try again your cherry-pick <em>after</em>:</p> <pre><code>git config merge.conflictstyle diff3 </code></pre> <p>You will get a more detailed diff:</p> <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD ||||||| parent of 5b2a14c... dev add line c b ======= b c &gt;&gt;&gt;&gt;&gt;&gt;&gt; 5b2a14c... dev add line c </cod...
<p>Try again your cherry-pick <em>after</em>:</p> <pre><code>git config merge.conflictstyle diff3 </code></pre> <p>You will get a more detailed diff:</p> <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD ||||||| parent of 5b2a14c... dev add line c b ======= b c &gt;&gt;&gt;&gt;&gt;&gt;&gt; 5b2a14c... dev add line c </cod...
119, 36489, 78810
cherry-pick, git, git-cherry-pick
<h1>Why does this cherry-pick have a conflict?</h1> <p>I know <code>git cherry-pick</code> is a command that use to apply the changes of specified commit, but I think I just don't really understand the way it works.</p> <p>Let's say a repo act like that:</p> <pre><code>git init echo a&gt;a git add .; git commit -am ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,850
git
# Why does this cherry-pick have a conflict? I know `git cherry-pick` is a command that use to apply the changes of specified commit, but I think I just don't really understand the way it works. Let's say a repo act like that: ``` git init echo a>a git add .; git commit -am 'master add line a' git checkout -b dev ...
Try again your cherry-pick *after*: ``` git config merge.conflictstyle diff3 ``` You will get a more detailed diff: ``` <<<<<<< HEAD ||||||| parent of 5b2a14c... dev add line c b ======= b c >>>>>>> 5b2a14c... dev add line c ``` It shows that, when applying the patch represented by `dev`'s HEAD (`b` and `c`), Git d...
8566272
During a git rebase, how can I keep the original and discard changes?
23
2011-12-19 19:17:34
<p>I am doing a rebase and have come to a file with conflicts, but these conflicts are basically impossible to resolve. The best way to deal with the situation would be to tell git to ignore the changes and keep the original. I can then go back and re-edit the file to make the changes.</p> <p>How can I do this?</p>
8,647
198,301
2024-05-18 06:51:35
8,566,376
31
2011-12-19 19:26:00
492,969
2024-05-18 06:51:35
https://stackoverflow.com/q/8566272
https://stackoverflow.com/a/8566376
<p>If you have encountered a merge conflict you can do this</p> <pre><code>git checkout --ours file </code></pre> <p>or the other way round</p> <pre><code>git checkout --theirs file </code></pre>
<p>If you have encountered a merge conflict you can do this</p> <pre><code>git checkout --ours file </code></pre> <p>or the other way round</p> <pre><code>git checkout --theirs file </code></pre>
119, 8974
git, rebase
<h1>During a git rebase, how can I keep the original and discard changes?</h1> <p>I am doing a rebase and have come to a file with conflicts, but these conflicts are basically impossible to resolve. The best way to deal with the situation would be to tell git to ignore the changes and keep the original. I can then go b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,852
git
# During a git rebase, how can I keep the original and discard changes? I am doing a rebase and have come to a file with conflicts, but these conflicts are basically impossible to resolve. The best way to deal with the situation would be to tell git to ignore the changes and keep the original. I can then go back and r...
If you have encountered a merge conflict you can do this ``` git checkout --ours file ``` or the other way round ``` git checkout --theirs file ```
7555800
Pull, rebase, push, in one command (or just a few)
23
2011-09-26 13:27:37
<p>When using Git, I often find myself doing the following when working in <code>master</code>:</p> <pre><code># work work work... $ git checkout -b temp $ git commit -a -m 'more work done' $ git checkout master $ git pull origin master # turns out master was updated since my previous pull $ git checkout temp # I don'...
16,311
166,749
2023-02-08 19:45:14
7,555,850
31
2011-09-26 13:31:28
223,092
2011-09-26 13:59:43
https://stackoverflow.com/q/7555800
https://stackoverflow.com/a/7555850
<p>If you don't mind not creating a branch called <code>temp</code>, you could just do the following all on <code>master</code>:</p> <pre><code>git commit -a -m 'more work done' git fetch origin git rebase origin/master </code></pre> <p>... or equivalently:</p> <pre><code>git commit -a -m 'more work done' git pull -...
<p>If you don't mind not creating a branch called <code>temp</code>, you could just do the following all on <code>master</code>:</p> <pre><code>git commit -a -m 'more work done' git fetch origin git rebase origin/master </code></pre> <p>... or equivalently:</p> <pre><code>git commit -a -m 'more work done' git pull -...
119, 717, 8974, 29934
git, git-rebase, merge, rebase
<h1>Pull, rebase, push, in one command (or just a few)</h1> <p>When using Git, I often find myself doing the following when working in <code>master</code>:</p> <pre><code># work work work... $ git checkout -b temp $ git commit -a -m 'more work done' $ git checkout master $ git pull origin master # turns out master was...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,853
git
# Pull, rebase, push, in one command (or just a few) When using Git, I often find myself doing the following when working in `master`: ``` # work work work... $ git checkout -b temp $ git commit -a -m 'more work done' $ git checkout master $ git pull origin master # turns out master was updated since my previous pull...
If you don't mind not creating a branch called `temp`, you could just do the following all on `master`: ``` git commit -a -m 'more work done' git fetch origin git rebase origin/master ``` ... or equivalently: ``` git commit -a -m 'more work done' git pull --rebase origin master ``` If you do want to keep the `temp`...
31445129
How to fetch all remote branch, "git fetch --all" doesn't work
22
2015-07-16 03:56:37
<p>I have looked through other questions on similar question.</p> <p>But they seem to say the answer is <code>git fetch --all</code>.</p> <p>But in my case, it doesn't work.</p> <p>This is what I have done for it.</p> <pre><code>&gt; git branch * master &gt; git branch -r origin/master origin/A &gt; git fetch --...
51,161
3,523,935
2020-03-28 15:32:09
31,445,390
31
2015-07-16 04:30:44
1,336,653
2020-03-28 15:32:09
https://stackoverflow.com/q/31445129
https://stackoverflow.com/a/31445390
<p><code>git branch</code> only displays local branches. <code>git branch -r</code> will display remote branches, as you've seen for yourself.</p> <pre><code>git branch *master git branch -r origin/master origin/A </code></pre> <p><code>git fetch --all</code> will update the list you see when you type <code>git bran...
<p><code>git branch</code> only displays local branches. <code>git branch -r</code> will display remote branches, as you've seen for yourself.</p> <pre><code>git branch *master git branch -r origin/master origin/A </code></pre> <p><code>git fetch --all</code> will update the list you see when you type <code>git bran...
119, 456, 18283
fetch, git, version-control
<h1>How to fetch all remote branch, "git fetch --all" doesn't work</h1> <p>I have looked through other questions on similar question.</p> <p>But they seem to say the answer is <code>git fetch --all</code>.</p> <p>But in my case, it doesn't work.</p> <p>This is what I have done for it.</p> <pre><code>&gt; git branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,856
git
# How to fetch all remote branch, "git fetch --all" doesn't work I have looked through other questions on similar question. But they seem to say the answer is `git fetch --all`. But in my case, it doesn't work. This is what I have done for it. ``` > git branch * master > git branch -r origin/master origin/A > gi...
`git branch` only displays local branches. `git branch -r` will display remote branches, as you've seen for yourself. ``` git branch *master git branch -r origin/master origin/A ``` `git fetch --all` will update the list you see when you type `git branch -r` but it will not create the corresponding local branches. ...
13988511
Remove a directory from all previous commits
22
2012-12-21 10:38:59
<p>Git Repo, there is a folder <code>ABC</code> with three files, all having spaces in the name <code>file - 1.ext</code>, <code>file - 2.ext</code>, and <code>file - 3.ext</code>. I want to remove the folder and the files. I am only aware of how to remove the files via this command</p> <pre><code>git filter-branc...
9,439
1,234,721
2019-03-21 15:04:14
13,992,233
31
2012-12-21 14:49:26
123,109
2012-12-21 14:55:33
https://stackoverflow.com/q/13988511
https://stackoverflow.com/a/13992233
<p>Say you begin with a history of</p> <pre>$ git lola --name-status * e709131 (HEAD, master) bar | A bar * 61493ac ABC/file - 3.ext | A ABC/file - 3.ext * 34cce9e ABC/file - 2.ext | A ABC/file - 2.ext * 115e6d5 ABC/file - 1.ext | A ABC/file - 1.ext * 5ea5b42 foo A foo</pre> <p>Note: <a href="ht...
<p>Say you begin with a history of</p> <pre>$ git lola --name-status * e709131 (HEAD, master) bar | A bar * 61493ac ABC/file - 3.ext | A ABC/file - 3.ext * 34cce9e ABC/file - 2.ext | A ABC/file - 2.ext * 115e6d5 ABC/file - 1.ext | A ABC/file - 1.ext * 5ea5b42 foo A foo</pre> <p>Note: <a href="ht...
119, 456
git, version-control
<h1>Remove a directory from all previous commits</h1> <p>Git Repo, there is a folder <code>ABC</code> with three files, all having spaces in the name <code>file - 1.ext</code>, <code>file - 2.ext</code>, and <code>file - 3.ext</code>. I want to remove the folder and the files. I am only aware of how to remove the f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,857
git
# Remove a directory from all previous commits Git Repo, there is a folder `ABC` with three files, all having spaces in the name `file - 1.ext`, `file - 2.ext`, and `file - 3.ext`. I want to remove the folder and the files. I am only aware of how to remove the files via this command ``` git filter-branch \ --index-...
Say you begin with a history of ``` $ git lola --name-status * e709131 (HEAD, master) bar | A bar * 61493ac ABC/file - 3.ext | A ABC/file - 3.ext * 34cce9e ABC/file - 2.ext | A ABC/file - 2.ext * 115e6d5 ABC/file - 1.ext | A ABC/file - 1.ext * 5ea5b42 foo A foo ``` Note: [git lola](http://blog.k...
7274938
Git branches & commits history after merge
22
2011-09-01 18:43:52
<p>I'm working on a project (alone) and for every feature I develop I create a new branch, work on this feature, then merge it to master. So normally I never work on two different branches at one time and never touch master while working on a branch.</p> <p>When I merge a branch I see that (using <code>gitx</code> and...
17,849
746,041
2017-05-21 01:38:15
7,274,980
31
2011-09-01 18:48:26
474,283
2011-09-01 18:48:26
https://stackoverflow.com/q/7274938
https://stackoverflow.com/a/7274980
<p>That is normal Git behaviour. You are doing what is called a "fast-forward" merge, because your branch is strictly ahead of the <code>master</code> branch.</p> <p>If you really want to preserve branch history (although I'd recommend you don't bother) then you can use <code>git merge --no-ff</code> to force it to cr...
<p>That is normal Git behaviour. You are doing what is called a "fast-forward" merge, because your branch is strictly ahead of the <code>master</code> branch.</p> <p>If you really want to preserve branch history (although I'd recommend you don't bother) then you can use <code>git merge --no-ff</code> to force it to cr...
119, 717, 1879
branch, git, merge
<h1>Git branches & commits history after merge</h1> <p>I'm working on a project (alone) and for every feature I develop I create a new branch, work on this feature, then merge it to master. So normally I never work on two different branches at one time and never touch master while working on a branch.</p> <p>When I me...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,859
git
# Git branches & commits history after merge I'm working on a project (alone) and for every feature I develop I create a new branch, work on this feature, then merge it to master. So normally I never work on two different branches at one time and never touch master while working on a branch. When I merge a branch I s...
That is normal Git behaviour. You are doing what is called a "fast-forward" merge, because your branch is strictly ahead of the `master` branch. If you really want to preserve branch history (although I'd recommend you don't bother) then you can use `git merge --no-ff` to force it to create a merge commit even when it...
22067750
In Git is it possible to refer an alias from another alias
21
2014-02-27 11:54:15
<p>Let say I have an alias like this in my .gitconfig:</p> <pre><code>alias.showlog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&lt;%an&gt;%Creset' </code></pre> <p>and now I want a similar alias like this:</p> <pre><code>alias.sl = showlog --abbrev-commit...
4,170
628,006
2020-11-27 23:03:09
22,078,514
31
2014-02-27 19:32:14
1,256,452
2019-11-05 18:48:31
https://stackoverflow.com/q/22067750
https://stackoverflow.com/a/22078514
<p>In versions of Git before 2.20:</p> <p>Not that way, but you can make an alias run a command through the shell, hence running another instance of <code>git</code> which resolves the second alias:</p> <pre><code>alias.sl = !git showlog --abbrev-commit </code></pre> <p>In 2.20 or later, see <a href="https://stackov...
<p>In versions of Git before 2.20:</p> <p>Not that way, but you can make an alias run a command through the shell, hence running another instance of <code>git</code> which resolves the second alias:</p> <pre><code>alias.sl = !git showlog --abbrev-commit </code></pre> <p>In 2.20 or later, see <a href="https://stackov...
119, 1448, 32868
alias, git, git-config
<h1>In Git is it possible to refer an alias from another alias</h1> <p>Let say I have an alias like this in my .gitconfig:</p> <pre><code>alias.showlog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&lt;%an&gt;%Creset' </code></pre> <p>and now I want a similar...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,861
git
# In Git is it possible to refer an alias from another alias Let say I have an alias like this in my .gitconfig: ``` alias.showlog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' ``` and now I want a similar alias like this: ``` alias.sl = showlo...
In versions of Git before 2.20: Not that way, but you can make an alias run a command through the shell, hence running another instance of `git` which resolves the second alias: ``` alias.sl = !git showlog --abbrev-commit ``` In 2.20 or later, see [VonC's answer](https://stackoverflow.com/a/52863852/1256452).
16829401
Adding git subtree from a branch
21
2013-05-30 06:30:46
<p>I'm trying to add a repo (called cow) to my project using <code>git subtree add</code>. In particular, I'd like to add the branch <code>stable</code> (which is not the <code>master</code> branch). I tried:</p> <pre><code>git subtree add -P cow https://github.com/geoffryan/cow.git stable </code></pre> <p>But this...
12,414
2,418,959
2016-07-20 19:43:50
16,830,005
31
2013-05-30 07:09:55
1,935,366
2016-07-20 19:43:50
https://stackoverflow.com/q/16829401
https://stackoverflow.com/a/16830005
<p>This seems to work</p> <pre><code>$ git remote add cow https://github.com/geoffryan/cow.git $ git fetch cow $ git subtree add -P cow cow/stable Added dir 'cow' </code></pre> <p>I don't understand how to use directly the command with the repository part.</p>
<p>This seems to work</p> <pre><code>$ git remote add cow https://github.com/geoffryan/cow.git $ git fetch cow $ git subtree add -P cow cow/stable Added dir 'cow' </code></pre> <p>I don't understand how to use directly the command with the repository part.</p>
119, 68200
git, git-subtree
<h1>Adding git subtree from a branch</h1> <p>I'm trying to add a repo (called cow) to my project using <code>git subtree add</code>. In particular, I'd like to add the branch <code>stable</code> (which is not the <code>master</code> branch). I tried:</p> <pre><code>git subtree add -P cow https://github.com/geoffryan...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,862
git
# Adding git subtree from a branch I'm trying to add a repo (called cow) to my project using `git subtree add`. In particular, I'd like to add the branch `stable` (which is not the `master` branch). I tried: ``` git subtree add -P cow https://github.com/geoffryan/cow.git stable ``` But this returned the error ``` '...
This seems to work ``` $ git remote add cow https://github.com/geoffryan/cow.git $ git fetch cow $ git subtree add -P cow cow/stable Added dir 'cow' ``` I don't understand how to use directly the command with the repository part.
71236993
git lfs cannot discard file changes (encountered files that should have been pointers)
20
2022-02-23 12:32:15
<p>I have a file using git lfs, but even without me doing anything, it just shows up on git as having changes. I am unable to discard these changes, whether through the VS Code UI, through git reset, or git restore.</p> <p>Git keeps telling me &quot;Encountered 1 file(s) that should have been pointers, but weren't:&quo...
15,919
8,622,814
2024-02-26 14:30:44
71,245,239
31
2022-02-23 23:28:07
8,705,432
2023-12-20 23:13:47
https://stackoverflow.com/q/71236993
https://stackoverflow.com/a/71245239
<p>This is a limitation of Git caused by the fact that someone committed a file that's tracked by Git LFS without using Git LFS. The Git FAQ <a href="https://git-scm.com/docs/gitfaq#always-modified-files-case" rel="noreferrer">mentions this briefly</a>.</p> <p>This occurs because when a file is marked modified in the ...
<p>This is a limitation of Git caused by the fact that someone committed a file that's tracked by Git LFS without using Git LFS. The Git FAQ <a href="https://git-scm.com/docs/gitfaq#always-modified-files-case" rel="noreferrer">mentions this briefly</a>.</p> <p>This occurs because when a file is marked modified in the ...
119, 115244
git, git-lfs
<h1>git lfs cannot discard file changes (encountered files that should have been pointers)</h1> <p>I have a file using git lfs, but even without me doing anything, it just shows up on git as having changes. I am unable to discard these changes, whether through the VS Code UI, through git reset, or git restore.</p> <p>G...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,865
git
# git lfs cannot discard file changes (encountered files that should have been pointers) I have a file using git lfs, but even without me doing anything, it just shows up on git as having changes. I am unable to discard these changes, whether through the VS Code UI, through git reset, or git restore. Git keeps tellin...
This is a limitation of Git caused by the fact that someone committed a file that's tracked by Git LFS without using Git LFS. The Git FAQ [mentions this briefly](https://git-scm.com/docs/gitfaq#always-modified-files-case). This occurs because when a file is marked modified in the working tree, Git runs it through the ...
40272879
Git config with directory scope, containing multiple repositories
20
2016-10-26 22:06:55
<p>The situation is as follows:</p> <ul> <li>I have multiple <em>domains</em> in which I write code, e.g. professional and free time. Those are represented by different directories on my computer.</li> <li>Each of those domains contains multiple Git repositories, in a hierarchical directory structure inside one of the...
6,632
5,427,663
2023-01-07 15:34:32
49,154,229
31
2018-03-07 14:25:04
2,377,961
2023-01-07 15:34:32
https://stackoverflow.com/q/40272879
https://stackoverflow.com/a/49154229
<p>Based on <a href="https://stackoverflow.com/a/44036640/2377961">https://stackoverflow.com/a/44036640/2377961</a> I think I found a way how it could work.</p> <p>First, you create different config files for your &quot;custom-scopes&quot; (e.g. professional, freetime, ect.) and add your desired user-config for each sc...
<p>Based on <a href="https://stackoverflow.com/a/44036640/2377961">https://stackoverflow.com/a/44036640/2377961</a> I think I found a way how it could work.</p> <p>First, you create different config files for your &quot;custom-scopes&quot; (e.g. professional, freetime, ect.) and add your desired user-config for each sc...
119, 218, 7330, 32868
directory, git, git-config, repository
<h1>Git config with directory scope, containing multiple repositories</h1> <p>The situation is as follows:</p> <ul> <li>I have multiple <em>domains</em> in which I write code, e.g. professional and free time. Those are represented by different directories on my computer.</li> <li>Each of those domains contains multipl...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,867
git
# Git config with directory scope, containing multiple repositories The situation is as follows: - I have multiple *domains* in which I write code, e.g. professional and free time. Those are represented by different directories on my computer. - Each of those domains contains multiple Git repositories, in a hierarchi...
Based on <https://stackoverflow.com/a/44036640/2377961> I think I found a way how it could work. First, you create different config files for your "custom-scopes" (e.g. professional, freetime, ect.) and add your desired user-config for each scope ``` # ~/all-projects.gitconfig [user] name = TheOperator ``` ``` #...
45153926
Git rebase and children branches
20
2017-07-17 21:26:42
<p>I have the following situation, on my project</p> <pre><code>Master M1----M2----M3----M4----M5 \ Beta B1----B2----B3---B4 \ Feature F1---F2---F3 </code></pre> <p>I am developing in <code>Feature</code>, but a reall...
8,960
2,405,914
2022-01-20 17:39:02
45,154,432
31
2017-07-17 22:09:22
1,256,452
2022-01-20 17:39:02
https://stackoverflow.com/q/45153926
https://stackoverflow.com/a/45154432
<p>You are correct: running <code>git rebase Master</code> while on <code>Beta</code> will not affect <code>Feature</code>. (Aside: why the uppercase letters?)</p> <p>The fundamental issue here is that <code>git rebase</code> &quot;means&quot; <em>copy some commits</em>. The trick is seeing which commits get copied, ...
<p>You are correct: running <code>git rebase Master</code> while on <code>Beta</code> will not affect <code>Feature</code>. (Aside: why the uppercase letters?)</p> <p>The fundamental issue here is that <code>git rebase</code> &quot;means&quot; <em>copy some commits</em>. The trick is seeing which commits get copied, ...
119, 1879, 8974
branch, git, rebase
<h1>Git rebase and children branches</h1> <p>I have the following situation, on my project</p> <pre><code>Master M1----M2----M3----M4----M5 \ Beta B1----B2----B3---B4 \ Feature F1---F2---F3 </code></pre> <p>I am devel...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,868
git
# Git rebase and children branches I have the following situation, on my project ``` Master M1----M2----M3----M4----M5 \ Beta B1----B2----B3---B4 \ Feature F1---F2---F3 ``` I am developing in `Feature`, but a really ...
You are correct: running `git rebase Master` while on `Beta` will not affect `Feature`. (Aside: why the uppercase letters?) The fundamental issue here is that `git rebase` "means" *copy some commits*. The trick is seeing which commits get copied, to where, and what happens to the branch names afterward. If the commits...
38494546
Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?
20
2016-07-21 03:48:58
<p>What does command 1 do that command 2 doesn't?</p> <pre><code>1. git push &lt;projectpath&gt; HEAD:refs/heads/&lt;branch&gt; 2. git push &lt;projectpath&gt; &lt;branch&gt; </code></pre> <p>What is the meaning of "HEAD:refs/heads/"?</p>
26,274
6,616,857
2025-09-07 15:07:27
38,498,137
31
2016-07-21 07:49:22
1,256,452
2016-07-23 08:05:03
https://stackoverflow.com/q/38494546
https://stackoverflow.com/a/38498137
<p><a href="https://stackoverflow.com/a/38496360/1256452">VonC's answer</a> is correct (and upvoted), but I think another way of looking at this might make more sense.</p> <p>Note that all of this is assuming that you're using the four-word form of <code>git push</code>, i.e., <code>git push <em>remote</em> <em>refspe...
<p><a href="https://stackoverflow.com/a/38496360/1256452">VonC's answer</a> is correct (and upvoted), but I think another way of looking at this might make more sense.</p> <p>Note that all of this is assuming that you're using the four-word form of <code>git push</code>, i.e., <code>git push <em>remote</em> <em>refspe...
119, 4236
git, push
<h1>Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?</h1> <p>What does command 1 do that command 2 doesn't?</p> <pre><code>1. git push &lt;projectpath&gt; HEAD:refs/heads/&lt;branch&gt; 2. git push &lt;projectpath&gt; &lt;branch&gt; </code></pre> <p>What is the meaning of "HEAD:refs/hea...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,869
git
# Git Push: What is the difference between HEAD:refs/heads/ and ? What does command 1 do that command 2 doesn't? ``` 1. git push <projectpath> HEAD:refs/heads/<branch> 2. git push <projectpath> <branch> ``` What is the meaning of "HEAD:refs/heads/"?
[VonC's answer](https://stackoverflow.com/a/38496360/1256452) is correct (and upvoted), but I think another way of looking at this might make more sense. Note that all of this is assuming that you're using the four-word form of `git push`, i.e., `git push remote refspec`. The *`remote`* part here is usually just the n...
3372822
How do I get rid of existing whitespace in my initial commit?
20
2010-07-30 15:14:03
<p>I've accidentally put some whitespace in my initial commit. It shows up red in <code>git diff --color</code>. How do I get rid of the existing whitespace and how can I avoid this from happening again?</p>
17,212
405,550
2024-06-20 01:52:40
3,374,483
31
2010-07-30 18:48:29
405,550
2016-10-21 09:29:30
https://stackoverflow.com/q/3372822
https://stackoverflow.com/a/3374483
<p>To trim trailing whitespace on all files in the current directory, use: </p> <pre><code>sed -i 's/[[:space:]]*$//' * </code></pre> <p>To warn about future whitespace errors (both <strong>trailing spaces</strong> and <strong>spaces before tabs</strong>), and to fix whitespace errors in patches, add the following co...
<p>To trim trailing whitespace on all files in the current directory, use: </p> <pre><code>sed -i 's/[[:space:]]*$//' * </code></pre> <p>To warn about future whitespace errors (both <strong>trailing spaces</strong> and <strong>spaces before tabs</strong>), and to fix whitespace errors in patches, add the following co...
119, 1084, 12234, 57198
code-cleanup, git, removing-whitespace, whitespace
<h1>How do I get rid of existing whitespace in my initial commit?</h1> <p>I've accidentally put some whitespace in my initial commit. It shows up red in <code>git diff --color</code>. How do I get rid of the existing whitespace and how can I avoid this from happening again?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,870
git
# How do I get rid of existing whitespace in my initial commit? I've accidentally put some whitespace in my initial commit. It shows up red in `git diff --color`. How do I get rid of the existing whitespace and how can I avoid this from happening again?
To trim trailing whitespace on all files in the current directory, use: ``` sed -i 's/[[:space:]]*$//' * ``` To warn about future whitespace errors (both **trailing spaces** and **spaces before tabs**), and to fix whitespace errors in patches, add the following code to your `gitconfig` file: ``` [core] whitespac...
1887364
GIT clone to external drive for backup
20
2009-12-11 11:10:24
<p>We have GIT set up within our windows network (using msysgit &amp; GitExtensions). We each have our own repositories and we push to a remote 'bare' repository on one of our servers. All good.</p> <p>I'm trying to set up a scheduled job on the server, which will clone a repository from the C drive to an external d...
14,667
117,215
2019-02-08 14:36:39
1,887,474
31
2009-12-11 11:32:48
52,573
2010-08-12 07:12:13
https://stackoverflow.com/q/1887364
https://stackoverflow.com/a/1887474
<p>Please note that git itself is excellent at copying only the needed changes to a cloned repository.</p> <p>If you want a copy of your repo to be regularly updated, do this: You create a bare repository as a backup repository, and then repeatedly push all new changes there (no need to delete the old backup).</p> <p...
<p>Please note that git itself is excellent at copying only the needed changes to a cloned repository.</p> <p>If you want a copy of your repo to be regularly updated, do this: You create a bare repository as a backup repository, and then repeatedly push all new changes there (no need to delete the old backup).</p> <p...
64, 119, 493
backup, git, windows
<h1>GIT clone to external drive for backup</h1> <p>We have GIT set up within our windows network (using msysgit &amp; GitExtensions). We each have our own repositories and we push to a remote 'bare' repository on one of our servers. All good.</p> <p>I'm trying to set up a scheduled job on the server, which will clon...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,871
git
# GIT clone to external drive for backup We have GIT set up within our windows network (using msysgit & GitExtensions). We each have our own repositories and we push to a remote 'bare' repository on one of our servers. All good. I'm trying to set up a scheduled job on the server, which will clone a repository from th...
Please note that git itself is excellent at copying only the needed changes to a cloned repository. If you want a copy of your repo to be regularly updated, do this: You create a bare repository as a backup repository, and then repeatedly push all new changes there (no need to delete the old backup). Ok, let's start ...
47081606
Can 'git log' ignore certain commits based on commit message?
19
2017-11-02 17:47:40
<p>I'm using <code>git log</code> in order to generate a diff between two branches. The exact command I'm using is:</p> <pre><code>git log --left-right --graph --cherry-pick --oneline sourceBranch...targetBranch </code></pre> <p>What I'm wondering is if I can exclude some of the log entries based on the commit messag...
8,078
591,182
2017-11-02 17:53:55
47,081,708
31
2017-11-02 17:53:55
803,194
2017-11-02 17:53:55
https://stackoverflow.com/q/47081606
https://stackoverflow.com/a/47081708
<p><code>git log --invert-grep --grep=TEST_AUTO</code></p> <p>from <code>man git log</code>:</p> <pre><code> --invert-grep Limit the commits output to ones with log message that do not match the pattern specified with --grep=&lt;pattern&gt;. </code></pre>
<p><code>git log --invert-grep --grep=TEST_AUTO</code></p> <p>from <code>man git log</code>:</p> <pre><code> --invert-grep Limit the commits output to ones with log message that do not match the pattern specified with --grep=&lt;pattern&gt;. </code></pre>
119, 47913, 78810
git, git-cherry-pick, git-log
<h1>Can 'git log' ignore certain commits based on commit message?</h1> <p>I'm using <code>git log</code> in order to generate a diff between two branches. The exact command I'm using is:</p> <pre><code>git log --left-right --graph --cherry-pick --oneline sourceBranch...targetBranch </code></pre> <p>What I'm wondering...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,872
git
# Can 'git log' ignore certain commits based on commit message? I'm using `git log` in order to generate a diff between two branches. The exact command I'm using is: ``` git log --left-right --graph --cherry-pick --oneline sourceBranch...targetBranch ``` What I'm wondering is if I can exclude some of the log entries...
`git log --invert-grep --grep=TEST_AUTO` from `man git log`: ``` --invert-grep Limit the commits output to ones with log message that do not match the pattern specified with --grep=<pattern>. ```
32546358
Is there any way to make `git add --patch` respond to a single `y` or `n` keystroke?
19
2015-09-13 04:39:43
<p><code>git add --patch</code> is an integral part of my Git workflow. The only thing which irritates me about it is constantly having to press the Enter key after each <code>y</code> or <code>n</code>. Is there any way to make Git accept the answer to a question with just a single <code>y</code> or <code>n</code> key...
1,662
960,828
2024-08-03 18:38:08
32,546,377
31
2015-09-13 04:43:40
707,111
2015-09-13 04:43:40
https://stackoverflow.com/q/32546358
https://stackoverflow.com/a/32546377
<p>That would be the Git configuration option <code>interactive.singleKey</code>.</p> <blockquote> <h3>interactive.singleKey</h3> <p>In interactive commands, allow the user to provide one-letter input with a single key (i.e., without hitting enter). Currently this is used by the <code>--patch</code> mode...
<p>That would be the Git configuration option <code>interactive.singleKey</code>.</p> <blockquote> <h3>interactive.singleKey</h3> <p>In interactive commands, allow the user to provide one-letter input with a single key (i.e., without hitting enter). Currently this is used by the <code>--patch</code> mode...
119
git
<h1>Is there any way to make `git add --patch` respond to a single `y` or `n` keystroke?</h1> <p><code>git add --patch</code> is an integral part of my Git workflow. The only thing which irritates me about it is constantly having to press the Enter key after each <code>y</code> or <code>n</code>. Is there any way to ma...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,873
git
# Is there any way to make `git add --patch` respond to a single `y` or `n` keystroke? `git add --patch` is an integral part of my Git workflow. The only thing which irritates me about it is constantly having to press the Enter key after each `y` or `n`. Is there any way to make Git accept the answer to a question wit...
That would be the Git configuration option `interactive.singleKey`. > ### interactive.singleKey > > In interactive commands, allow the user to > provide one-letter input with a single key (i.e., without hitting > enter). Currently this is used by the `--patch` mode of `git-add(1)`, > `git-checkout(1)`, `git-commit(1)`...
30247603
Making vim show a git diff with colors like a git diff command (red-delete, green-add)
19
2015-05-14 21:24:03
<p>I ran <code>git config --global alias.ci commit --verbose</code></p> <p>This makes it so running <code>git ci</code> is like running <code>git commit --verbose</code></p> <p>The <code>--verbose</code> flag shows a diff in the commit message template, which is not commented so syntax highlighting works on it, but i...
9,587
1,902,689
2017-05-12 12:36:46
30,252,926
31
2015-05-15 06:29:04
1,658,042
2015-05-15 06:29:04
https://stackoverflow.com/q/30247603
https://stackoverflow.com/a/30252926
<p>The short version: edit a file <code>~/.vim/after/syntax/gitcommit.vim</code>, and add to it something like this:</p> <pre class="lang-viml prettyprint-override"><code>hi diffAdded ctermfg=green hi diffRemoved ctermfg=red </code></pre> <p>The longer version, explaining how I got there:</p> <p>When you edit a ...
<p>The short version: edit a file <code>~/.vim/after/syntax/gitcommit.vim</code>, and add to it something like this:</p> <pre class="lang-viml prettyprint-override"><code>hi diffAdded ctermfg=green hi diffRemoved ctermfg=red </code></pre> <p>The longer version, explaining how I got there:</p> <p>When you edit a ...
119, 370, 82950
git, vim, vim-syntax-highlighting
<h1>Making vim show a git diff with colors like a git diff command (red-delete, green-add)</h1> <p>I ran <code>git config --global alias.ci commit --verbose</code></p> <p>This makes it so running <code>git ci</code> is like running <code>git commit --verbose</code></p> <p>The <code>--verbose</code> flag shows a diff ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,875
git
# Making vim show a git diff with colors like a git diff command (red-delete, green-add) I ran `git config --global alias.ci commit --verbose` This makes it so running `git ci` is like running `git commit --verbose` The `--verbose` flag shows a diff in the commit message template, which is not commented so syntax hi...
The short version: edit a file `~/.vim/after/syntax/gitcommit.vim`, and add to it something like this: ``` hi diffAdded ctermfg=green hi diffRemoved ctermfg=red ``` The longer version, explaining how I got there: When you edit a commit message, run `:set ft`. This will show you that Git commit files have filetype ...
28550602
git: Merge Branches but Keep Commit History
19
2015-02-16 21:23:31
<p>In my git workflow we have one main repository and one branch, master. Everyone pulls from remote master and everyone pushes to remote master. I want to work in my own branch while I prepare a feature. So far my history is something like this:</p> <pre><code>git pull --rebase git checkout -b new_feature &lt;make so...
15,773
1,045,004
2015-02-17 00:26:07
28,552,324
31
2015-02-16 23:44:19
1,108,891
2015-02-17 00:26:07
https://stackoverflow.com/q/28550602
https://stackoverflow.com/a/28552324
<h2>Answer</h2> <p>Here is a workflow that you can use that does just what you need it to do.</p> <pre><code>git checkout master git pull --rebase (1) git checkout new_feature &lt;do a bunch of commits&gt; git rebase master (2) git checkout...
<h2>Answer</h2> <p>Here is a workflow that you can use that does just what you need it to do.</p> <pre><code>git checkout master git pull --rebase (1) git checkout new_feature &lt;do a bunch of commits&gt; git rebase master (2) git checkout...
119, 456, 1318, 1879, 8974
branch, git, history, rebase, version-control
<h1>git: Merge Branches but Keep Commit History</h1> <p>In my git workflow we have one main repository and one branch, master. Everyone pulls from remote master and everyone pushes to remote master. I want to work in my own branch while I prepare a feature. So far my history is something like this:</p> <pre><code>git ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,876
git
# git: Merge Branches but Keep Commit History In my git workflow we have one main repository and one branch, master. Everyone pulls from remote master and everyone pushes to remote master. I want to work in my own branch while I prepare a feature. So far my history is something like this: ``` git pull --rebase git ch...
## Answer Here is a workflow that you can use that does just what you need it to do. ``` git checkout master git pull --rebase (1) git checkout new_feature <do a bunch of commits> git rebase master (2) git checkout master git merge new_feat...
26472543
iOS - git merge conflicts after adding cocoapods to project
19
2014-10-20 18:33:32
<p>I'm working on an app with another partner. He's been working on master, and I started a new branch. On my branch I installed <code>cocoapods</code>. I just tried pulling from master and I'm getting merge conflicts.</p> <p>When I open up Xcode, the workspace file has an error and it says:</p> <pre><code>"Workspace...
22,160
3,344,977
2019-08-29 07:58:56
27,412,393
31
2014-12-10 22:54:58
962,009
2014-12-10 22:54:58
https://stackoverflow.com/q/26472543
https://stackoverflow.com/a/27412393
<p>When git encounters merge conflicts, it adds lines of text to the conflicting files. They're comments like: </p> <pre><code>&lt;&lt;&lt;&lt;&lt; HEAD ... your code from HEAD... ========= ... your code from the merge branch... &gt;&gt;&gt;&gt;&gt;&gt; my_merged_branch_name </code></pre> <p>These lines mark wher...
<p>When git encounters merge conflicts, it adds lines of text to the conflicting files. They're comments like: </p> <pre><code>&lt;&lt;&lt;&lt;&lt; HEAD ... your code from HEAD... ========= ... your code from the merge branch... &gt;&gt;&gt;&gt;&gt;&gt; my_merged_branch_name </code></pre> <p>These lines mark wher...
119, 58338, 77741, 93092, 101983
cocoapods, git, ios, xcode-project, xcode-workspace
<h1>iOS - git merge conflicts after adding cocoapods to project</h1> <p>I'm working on an app with another partner. He's been working on master, and I started a new branch. On my branch I installed <code>cocoapods</code>. I just tried pulling from master and I'm getting merge conflicts.</p> <p>When I open up Xcode, th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,877
git
# iOS - git merge conflicts after adding cocoapods to project I'm working on an app with another partner. He's been working on master, and I started a new branch. On my branch I installed `cocoapods`. I just tried pulling from master and I'm getting merge conflicts. When I open up Xcode, the workspace file has an err...
When git encounters merge conflicts, it adds lines of text to the conflicting files. They're comments like: ``` <<<<< HEAD ... your code from HEAD... ========= ... your code from the merge branch... >>>>>> my_merged_branch_name ``` These lines mark where Git needs help. When Xcode runs into one of these lines in ...
22537528
Git ignore all files of a certain type except in all subdirectories of a certain directory?
19
2014-03-20 15:22:35
<p>I'm trying to make a gitignore file that will ignore all .jar files unless they're in a folder called libs. Here's my basic file structure:</p> <pre><code>-.gitignore -libs/ -goodFile.jar -someFolder/ -subFolder/ -alsoGood.jar -otherCode/ -fileToExclude.jar -otherOtherCode/ -oth...
18,134
1,144,012
2014-03-20 15:34:53
22,537,704
31
2014-03-20 15:29:32
808,019
2014-03-20 15:34:53
https://stackoverflow.com/q/22537528
https://stackoverflow.com/a/22537704
<p>How about:</p> <pre><code>*.jar !libs/**/*.jar </code></pre> <p>The order is important.</p> <p><strong>Edit</strong> I used your project structure and have the following output after I did a <code>git add</code> and <code>git status</code></p> <pre><code>$ git stat On branch master Initial commit Changes to be...
<p>How about:</p> <pre><code>*.jar !libs/**/*.jar </code></pre> <p>The order is important.</p> <p><strong>Edit</strong> I used your project structure and have the following output after I did a <code>git add</code> and <code>git status</code></p> <pre><code>$ git stat On branch master Initial commit Changes to be...
119, 25056
git, gitignore
<h1>Git ignore all files of a certain type except in all subdirectories of a certain directory?</h1> <p>I'm trying to make a gitignore file that will ignore all .jar files unless they're in a folder called libs. Here's my basic file structure:</p> <pre><code>-.gitignore -libs/ -goodFile.jar -someFolder/ ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,878
git
# Git ignore all files of a certain type except in all subdirectories of a certain directory? I'm trying to make a gitignore file that will ignore all .jar files unless they're in a folder called libs. Here's my basic file structure: ``` -.gitignore -libs/ -goodFile.jar -someFolder/ -subFolder/ ...
How about: ``` *.jar !libs/**/*.jar ``` The order is important. **Edit** I used your project structure and have the following output after I did a `git add` and `git status` ``` $ git stat On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: .git...
10507942
Git checkout in post-receive hook: "Not a git repository '.'"
19
2012-05-08 23:29:50
<p>I have a non-bare repository at my server (dirs /home/andrew/web and /home/andrew/web/.git), set receive.denyCurrentBranch to ignore and created post-receive hook:</p> <pre><code>#!/bin/sh GIT_WORK_TREE=/home/andrew/web git checkout -f </code></pre> <p>When I run sh .git/hooks/post-receive, everything works fine. ...
7,005
247,532
2017-02-19 00:02:32
10,513,684
31
2012-05-09 09:49:36
1,256,452
2017-02-19 00:02:32
https://stackoverflow.com/q/10507942
https://stackoverflow.com/a/10513684
<p>[Edit, Feb 2017: this old answer still gets hit a bit, so let's add a few notes. (1) This kind of live update is often a bad idea: be sure you know why you're doing it, and that you won't clobber your own work. (2) In Git since 2.3, you can now configure <code>receive.denyCurrentBranch</code> to <code>updateInstead<...
<p>[Edit, Feb 2017: this old answer still gets hit a bit, so let's add a few notes. (1) This kind of live update is often a bad idea: be sure you know why you're doing it, and that you won't clobber your own work. (2) In Git since 2.3, you can now configure <code>receive.denyCurrentBranch</code> to <code>updateInstead<...
119
git
<h1>Git checkout in post-receive hook: "Not a git repository '.'"</h1> <p>I have a non-bare repository at my server (dirs /home/andrew/web and /home/andrew/web/.git), set receive.denyCurrentBranch to ignore and created post-receive hook:</p> <pre><code>#!/bin/sh GIT_WORK_TREE=/home/andrew/web git checkout -f </code></...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,879
git
# Git checkout in post-receive hook: "Not a git repository '.'" I have a non-bare repository at my server (dirs /home/andrew/web and /home/andrew/web/.git), set receive.denyCurrentBranch to ignore and created post-receive hook: ``` #!/bin/sh GIT_WORK_TREE=/home/andrew/web git checkout -f ``` When I run sh .git/hooks...
[Edit, Feb 2017: this old answer still gets hit a bit, so let's add a few notes. (1) This kind of live update is often a bad idea: be sure you know why you're doing it, and that you won't clobber your own work. (2) In Git since 2.3, you can now configure `receive.denyCurrentBranch` to `updateInstead`, plus a hook tweak...
61051073
npm install from git use https instead ssh
18
2020-04-05 23:58:57
<p>I have an application with the following package.json file</p> <pre><code>"dependencies": { "package_name": "git+ssh://git@git.scm.domain.com:Domain/package_name.git", } </code></pre> <p>I can't change it and I can't use ssh. I tried </p> <pre><code>git config --global url.https://.insteadOf git:// git config...
20,350
1,850,255
2024-06-09 10:10:57
61,350,264
31
2020-04-21 18:13:24
1,850,255
2020-04-21 18:13:24
https://stackoverflow.com/q/61051073
https://stackoverflow.com/a/61350264
<pre><code>git config --global url."https://github.com/".insteadOf git@github.com: git config --global url."https://".insteadOf git:// </code></pre> <p>This works perfectly. Also pay attention to the <strong>colon</strong> <strong>at the end</strong> of the first line.</p>
<pre><code>git config --global url."https://github.com/".insteadOf git@github.com: git config --global url."https://".insteadOf git:// </code></pre> <p>This works perfectly. Also pay attention to the <strong>colon</strong> <strong>at the end</strong> of the first line.</p>
119, 61387
git, npm
<h1>npm install from git use https instead ssh</h1> <p>I have an application with the following package.json file</p> <pre><code>"dependencies": { "package_name": "git+ssh://git@git.scm.domain.com:Domain/package_name.git", } </code></pre> <p>I can't change it and I can't use ssh. I tried </p> <pre><code>git conf...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,880
git
# npm install from git use https instead ssh I have an application with the following package.json file ``` "dependencies": { "package_name": "git+ssh://git@git.scm.domain.com:Domain/package_name.git", } ``` I can't change it and I can't use ssh. I tried ``` git config --global url.https://.insteadOf git:// git...
``` git config --global url."https://github.com/".insteadOf git@github.com: git config --global url."https://".insteadOf git:// ``` This works perfectly. Also pay attention to the **colon** **at the end** of the first line.
51009808
What's the difference between git log and git log --decorate?
18
2018-06-24 12:08:07
<p>I have test the two commands and I didn't see any difference between the output of them.</p> <p><a href="https://i.sstatic.net/YujRo.png" rel="noreferrer"><img src="https://i.sstatic.net/YujRo.png" alt="git log output with and without --decorate"></a></p> <p>The below question from front-end developer course</p> ...
8,307
9,984,938
2021-07-09 20:44:22
51,010,033
31
2018-06-24 12:38:16
147,356
2018-06-24 12:55:13
https://stackoverflow.com/q/51009808
https://stackoverflow.com/a/51010033
<p>There seems to be a change in behavior depending on what version of <code>git</code> you're using.</p> <p>Older versions of <code>git</code> (say, 1.8.x) default to <em>not</em> decorating the output of <code>git log</code>. More recent versions of <code>git</code> (since 2.12.2) default to <code>--decorate=auto</...
<p>There seems to be a change in behavior depending on what version of <code>git</code> you're using.</p> <p>Older versions of <code>git</code> (say, 1.8.x) default to <em>not</em> decorating the output of <code>git log</code>. More recent versions of <code>git</code> (since 2.12.2) default to <code>--decorate=auto</...
119
git
<h1>What's the difference between git log and git log --decorate?</h1> <p>I have test the two commands and I didn't see any difference between the output of them.</p> <p><a href="https://i.sstatic.net/YujRo.png" rel="noreferrer"><img src="https://i.sstatic.net/YujRo.png" alt="git log output with and without --decorate...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,881
git
# What's the difference between git log and git log --decorate? I have test the two commands and I didn't see any difference between the output of them. [![git log output with and without --decorate](https://i.sstatic.net/YujRo.png)](https://i.sstatic.net/YujRo.png) The below question from front-end developer course...
There seems to be a change in behavior depending on what version of `git` you're using. Older versions of `git` (say, 1.8.x) default to *not* decorating the output of `git log`. More recent versions of `git` (since 2.12.2) default to `--decorate=auto` (which is just like `--decorate=short` when output is to a terminal...
34610705
Git - Windows AND linux line-endings
18
2016-01-05 11:32:08
<p>My main OS is windows 10.</p> <p>I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server.</p> <p>On the Ubuntu server I have my application files in a GIT repo with a gitlab server as the origin.</p> <p>I run Sour...
14,165
1,523,671
2016-01-05 12:22:03
34,610,871
31
2016-01-05 11:40:28
1,327,005
2016-01-05 11:40:28
https://stackoverflow.com/q/34610705
https://stackoverflow.com/a/34610871
<p>On Windows:</p> <pre><code>$ git config --global core.autocrlf true </code></pre> <p>On Linux:</p> <pre><code>$ git config --global core.autocrlf input </code></pre> <p>Read more about <a href="https://help.github.com/articles/dealing-with-line-endings/#platform-all" rel="noreferrer">Dealing with line endings</a...
<p>On Windows:</p> <pre><code>$ git config --global core.autocrlf true </code></pre> <p>On Linux:</p> <pre><code>$ git config --global core.autocrlf input </code></pre> <p>Read more about <a href="https://help.github.com/articles/dealing-with-line-endings/#platform-all" rel="noreferrer">Dealing with line endings</a...
58, 64, 119, 549, 8329
git, line-endings, linux, ubuntu, windows
<h1>Git - Windows AND linux line-endings</h1> <p>My main OS is windows 10.</p> <p>I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server.</p> <p>On the Ubuntu server I have my application files in a GIT repo with a g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,882
git
# Git - Windows AND linux line-endings My main OS is windows 10. I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server. On the Ubuntu server I have my application files in a GIT repo with a gitlab server as the ori...
On Windows: ``` $ git config --global core.autocrlf true ``` On Linux: ``` $ git config --global core.autocrlf input ``` Read more about [Dealing with line endings](https://help.github.com/articles/dealing-with-line-endings/#platform-all)
21850642
Can I move a local Git repository to elsewhere within my hard drive safely?
18
2014-02-18 10:19:27
<p>I started using Git/SourceTree/Bitbucket lately. Can I move a local Git repository to elsewhere within my hard drive safely?</p> <p>Because some of the large files are ignored by Git, I cannot really pull the repository from a remote repository to get the exact copy of all the files.</p> <p>If I simply move or cop...
13,594
3,188,444
2014-02-18 11:00:17
21,851,581
31
2014-02-18 10:54:31
955,926
2014-02-18 11:00:17
https://stackoverflow.com/q/21850642
https://stackoverflow.com/a/21851581
<p>No, moving or copying the <code>.git/</code> folder will not cause problems for git; git is not connected to your repo in any way, and git doesn't care about absolute paths, only relative paths inside the project folder.</p> <p>Git is just an executable on your machine. It can run anywhere, as long as it's in your ...
<p>No, moving or copying the <code>.git/</code> folder will not cause problems for git; git is not connected to your repo in any way, and git doesn't care about absolute paths, only relative paths inside the project folder.</p> <p>Git is just an executable on your machine. It can run anywhere, as long as it's in your ...
119, 456, 90056
atlassian-sourcetree, git, version-control
<h1>Can I move a local Git repository to elsewhere within my hard drive safely?</h1> <p>I started using Git/SourceTree/Bitbucket lately. Can I move a local Git repository to elsewhere within my hard drive safely?</p> <p>Because some of the large files are ignored by Git, I cannot really pull the repository from a remo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,883
git
# Can I move a local Git repository to elsewhere within my hard drive safely? I started using Git/SourceTree/Bitbucket lately. Can I move a local Git repository to elsewhere within my hard drive safely? Because some of the large files are ignored by Git, I cannot really pull the repository from a remote repository to...
No, moving or copying the `.git/` folder will not cause problems for git; git is not connected to your repo in any way, and git doesn't care about absolute paths, only relative paths inside the project folder. Git is just an executable on your machine. It can run anywhere, as long as it's in your path. I often drag my...
17925471
Why does git run auto-packing on every push to our repo?
18
2013-07-29 13:32:52
<p>The last few days, each and every push to our git repository has caused auto-packing on the server. </p> <p>The output on the client when this happens:</p> <pre><code>~pdr git:master ❯❯❯ git push origin master Counting objects: 44, done. Delta compression using up to 8 threads. Compressing objects: 100% (26/26), d...
8,301
228,693
2013-07-30 14:03:33
17,930,609
31
2013-07-29 17:40:21
55,284
2013-07-30 14:03:33
https://stackoverflow.com/q/17925471
https://stackoverflow.com/a/17930609
<p>Git decides whether to auto gc <a href="https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L157" rel="noreferrer">based on two criteria</a>:</p> <ol> <li>Are there too many packs? (Literally, are there <a href="https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L124" rel="noreferrer">more than 50 files</a> wi...
<p>Git decides whether to auto gc <a href="https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L157" rel="noreferrer">based on two criteria</a>:</p> <ol> <li>Are there too many packs? (Literally, are there <a href="https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L124" rel="noreferrer">more than 50 files</a> wi...
119
git
<h1>Why does git run auto-packing on every push to our repo?</h1> <p>The last few days, each and every push to our git repository has caused auto-packing on the server. </p> <p>The output on the client when this happens:</p> <pre><code>~pdr git:master ❯❯❯ git push origin master Counting objects: 44, done. Delta compr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,884
git
# Why does git run auto-packing on every push to our repo? The last few days, each and every push to our git repository has caused auto-packing on the server. The output on the client when this happens: ``` ~pdr git:master ❯❯❯ git push origin master Counting objects: 44, done. Delta compression using up to 8 threads...
Git decides whether to auto gc [based on two criteria](https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L157): 1. Are there too many packs? (Literally, are there [more than 50 files](https://github.com/git/git/blob/v1.7.0.4/builtin-gc.c#L124) with `.idx` in `.git/objects/pack`?) 2. Are there too many loose object...
27605956
What's the use case for "git branch -d"
17
2014-12-22 15:49:28
<p>I was helping out a co-worker today, and discovered that <code>git branch -D</code> and <code>git branch -d</code> do slightly different things. From the git help documentation: </p> <pre><code>-d --delete delete fully merged branch -D delete branch (even if not merged) </code></pre> <p>I can appreciate...
15,891
1,134,864
2017-08-11 13:18:00
27,606,039
31
2014-12-22 15:55:03
1,261,399
2017-08-11 13:18:00
https://stackoverflow.com/q/27605956
https://stackoverflow.com/a/27606039
<p>Think of <code>-D</code> as a forced branch delete. It will delete the branch even if it has not been merged into the branch you're currently in.</p> <p><code>-d</code> however, will warn you and won't delete the branch until its been merged.</p> <p>For example</p> <p>You've branched off <code>master</code> branc...
<p>Think of <code>-D</code> as a forced branch delete. It will delete the branch even if it has not been merged into the branch you're currently in.</p> <p><code>-d</code> however, will warn you and won't delete the branch until its been merged.</p> <p>For example</p> <p>You've branched off <code>master</code> branc...
119
git
<h1>What's the use case for "git branch -d"</h1> <p>I was helping out a co-worker today, and discovered that <code>git branch -D</code> and <code>git branch -d</code> do slightly different things. From the git help documentation: </p> <pre><code>-d --delete delete fully merged branch -D delete branch (even ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,886
git
# What's the use case for "git branch -d" I was helping out a co-worker today, and discovered that `git branch -D` and `git branch -d` do slightly different things. From the git help documentation: ``` -d --delete delete fully merged branch -D delete branch (even if not merged) ``` I can appreciate avoidi...
Think of `-D` as a forced branch delete. It will delete the branch even if it has not been merged into the branch you're currently in. `-d` however, will warn you and won't delete the branch until its been merged. For example You've branched off `master` branch into branch `A`. Made commits into `A`. If you then swi...
17210624
Can't track remote branch - doesn't recognize origin/develop
17
2013-06-20 09:53:18
<p>I have git 1.8.3 and a repo with 'master' and 'develop' branches.</p> <p>From my local 'develop' branch, I'm trying to do the following command - </p> <p><code>git branch -u origin/develop</code></p> <p>and I get an error of</p> <p><code>error: the requested upstream branch 'origin/develop' does not exist</code>...
16,951
1,029,612
2013-06-26 11:33:06
17,217,797
31
2013-06-20 15:31:35
12,471
2013-06-26 11:33:06
https://stackoverflow.com/q/17210624
https://stackoverflow.com/a/17217797
<ul> <li>If the branch <code>develop</code> already exists in the remote repository, use <code>git fetch</code> to update your "remote-tracking branches" (local mirrors). <ul> <li>This requires that the fetch refspec is set correctly (in <code>.git/config</code> in the section for your remote); the default is <code>fet...
<ul> <li>If the branch <code>develop</code> already exists in the remote repository, use <code>git fetch</code> to update your "remote-tracking branches" (local mirrors). <ul> <li>This requires that the fetch refspec is set correctly (in <code>.git/config</code> in the section for your remote); the default is <code>fet...
119
git
<h1>Can't track remote branch - doesn't recognize origin/develop</h1> <p>I have git 1.8.3 and a repo with 'master' and 'develop' branches.</p> <p>From my local 'develop' branch, I'm trying to do the following command - </p> <p><code>git branch -u origin/develop</code></p> <p>and I get an error of</p> <p><code>error...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,888
git
# Can't track remote branch - doesn't recognize origin/develop I have git 1.8.3 and a repo with 'master' and 'develop' branches. From my local 'develop' branch, I'm trying to do the following command - `git branch -u origin/develop` and I get an error of `error: the requested upstream branch 'origin/develop' does ...
- If the branch `develop` already exists in the remote repository, use `git fetch` to update your "remote-tracking branches" (local mirrors). - This requires that the fetch refspec is set correctly (in `.git/config` in the section for your remote); the default is `fetch = +refs/heads/*:refs/remotes/<name of remote>/*...
4234207
git creates files ending in ~?
17
2010-11-20 18:13:04
<p>Just started using git on my mac. I have one file in my repository called <code>README</code>. When I change it, git puts another file in the directory called <code>README~</code> containing the previous version.</p> <ol> <li>Is it git doing this?</li> <li>Why is git doing this?</li> <li>How can I stop git doing th...
7,494
499,030
2016-04-16 00:06:17
4,234,221
31
2010-11-20 18:15:45
15,168
2010-11-20 18:15:45
https://stackoverflow.com/q/4234207
https://stackoverflow.com/a/4234221
<p>The tilde suffix on file names is usually used by editors (Emacs, Vim in some modes/versions) on backup copies of files you edit. At one time on Mac, Vim seemed to create backups for me; it doesn't any more, but I'm not sure now whether that's because I tweaked a setting somewhere or whether vim changed its behavio...
<p>The tilde suffix on file names is usually used by editors (Emacs, Vim in some modes/versions) on backup copies of files you edit. At one time on Mac, Vim seemed to create backups for me; it doesn't any more, but I'm not sure now whether that's because I tweaked a setting somewhere or whether vim changed its behavio...
119, 370, 17512, 25056
git, gitignore, temporary-files, vim
<h1>git creates files ending in ~?</h1> <p>Just started using git on my mac. I have one file in my repository called <code>README</code>. When I change it, git puts another file in the directory called <code>README~</code> containing the previous version.</p> <ol> <li>Is it git doing this?</li> <li>Why is git doing th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,889
git
# git creates files ending in ~? Just started using git on my mac. I have one file in my repository called `README`. When I change it, git puts another file in the directory called `README~` containing the previous version. 1. Is it git doing this? 2. Why is git doing this? 3. How can I stop git doing this? (don't ju...
The tilde suffix on file names is usually used by editors (Emacs, Vim in some modes/versions) on backup copies of files you edit. At one time on Mac, Vim seemed to create backups for me; it doesn't any more, but I'm not sure now whether that's because I tweaked a setting somewhere or whether vim changed its behaviour. ...
4169556
How can I 'git blame' on the remote-side repository?
17
2010-11-12 22:16:10
<p>On my server, I host my personal Git remote-side projects (with <a href="https://en.wikibooks.org/wiki/Git/Gitosis" rel="nofollow noreferrer">Gitosis</a>), and I have built a web interface to browse the repositories (something like GitHub).</p> <p>On the remote-side, you are not allowed to do a lot of stuff, because...
10,157
220,239
2025-02-14 19:18:13
4,169,958
31
2010-11-12 23:29:49
135,724
2010-11-12 23:29:49
https://stackoverflow.com/q/4169556
https://stackoverflow.com/a/4169958
<p>The following should work even in bare repositories:</p> <pre><code>git blame &lt;rev&gt; -- &lt;path&gt; </code></pre> <p>E.g.</p> <pre><code>git blame master -- README.txt </code></pre>
<p>The following should work even in bare repositories:</p> <pre><code>git blame &lt;rev&gt; -- &lt;path&gt; </code></pre> <p>E.g.</p> <pre><code>git blame master -- README.txt </code></pre>
119, 21455
blame, git
<h1>How can I 'git blame' on the remote-side repository?</h1> <p>On my server, I host my personal Git remote-side projects (with <a href="https://en.wikibooks.org/wiki/Git/Gitosis" rel="nofollow noreferrer">Gitosis</a>), and I have built a web interface to browse the repositories (something like GitHub).</p> <p>On the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,890
git
# How can I 'git blame' on the remote-side repository? On my server, I host my personal Git remote-side projects (with [Gitosis](https://en.wikibooks.org/wiki/Git/Gitosis)), and I have built a web interface to browse the repositories (something like GitHub). On the remote-side, you are not allowed to do a lot of stuf...
The following should work even in bare repositories: ``` git blame <rev> -- <path> ``` E.g. ``` git blame master -- README.txt ```
68868084
git-credential-osxkeychain wants to access key "github.com" in your keychain
16
2021-08-20 21:09:11
<p>In line with the github recently removing support for password authentication - I have created a PAT following <a href="https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-access-to">this guide</a></p> <p>However, everytime I <code>git push</code> I see ...
29,175
6,119,487
2024-05-24 14:58:04
71,936,715
31
2022-04-20 08:49:38
471,341
2022-04-20 08:49:38
https://stackoverflow.com/q/68868084
https://stackoverflow.com/a/71936715
<p>OSX prompts for a password every time you use <code>git</code> after <code>brew</code> upgrades <code>git</code>. To make Keychain Access trust <code>git</code> with the password again, you have to open Keychain Access, search for github under Keychain: login, kind: Internet password, and add the new path to <code>g...
<p>OSX prompts for a password every time you use <code>git</code> after <code>brew</code> upgrades <code>git</code>. To make Keychain Access trust <code>git</code> with the password again, you have to open Keychain Access, search for github under Keychain: login, kind: Internet password, and add the new path to <code>g...
119
git
<h1>git-credential-osxkeychain wants to access key "github.com" in your keychain</h1> <p>In line with the github recently removing support for password authentication - I have created a PAT following <a href="https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-perso...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,891
git
# git-credential-osxkeychain wants to access key "github.com" in your keychain In line with the github recently removing support for password authentication - I have created a PAT following [this guide](https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-a...
OSX prompts for a password every time you use `git` after `brew` upgrades `git`. To make Keychain Access trust `git` with the password again, you have to open Keychain Access, search for github under Keychain: login, kind: Internet password, and add the new path to `git-credential-osxkeychain`. Or, just delete the gith...
41603638
Git keeps adding bin and obj files even though there is an ignorefile
16
2017-01-12 01:23:57
<p>I have been working on a POC and now have been asked to upload it to our GitHub. I have done that, but today I notice the <code>bin</code> and <code>obj</code> folder being included. </p> <p>So I opened up my <code>.gitignore</code> file to check I've added the Visual Studio profile. Which it was.. I could see <cod...
13,902
2,457,398
2020-11-20 21:39:13
41,603,935
31
2017-01-12 01:59:50
2,245,329
2017-01-12 01:59:50
https://stackoverflow.com/q/41603638
https://stackoverflow.com/a/41603935
<p>git ignore ignore the file that hadn't been tracked yet, so if a file was committed it will reappear again.</p> <p>you can try:</p> <pre><code>git rm -r --cached . git add . </code></pre> <p>then</p> <pre><code>git commit -am "Remove ignored files" </code></pre> <p>as suggested <a href="https://stackoverflow.c...
<p>git ignore ignore the file that hadn't been tracked yet, so if a file was committed it will reappear again.</p> <p>you can try:</p> <pre><code>git rm -r --cached . git add . </code></pre> <p>then</p> <pre><code>git commit -am "Remove ignored files" </code></pre> <p>as suggested <a href="https://stackoverflow.c...
119, 25056
git, gitignore
<h1>Git keeps adding bin and obj files even though there is an ignorefile</h1> <p>I have been working on a POC and now have been asked to upload it to our GitHub. I have done that, but today I notice the <code>bin</code> and <code>obj</code> folder being included. </p> <p>So I opened up my <code>.gitignore</code> file...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,893
git
# Git keeps adding bin and obj files even though there is an ignorefile I have been working on a POC and now have been asked to upload it to our GitHub. I have done that, but today I notice the `bin` and `obj` folder being included. So I opened up my `.gitignore` file to check I've added the Visual Studio profile. Wh...
git ignore ignore the file that hadn't been tracked yet, so if a file was committed it will reappear again. you can try: ``` git rm -r --cached . git add . ``` then ``` git commit -am "Remove ignored files" ``` as suggested [here](https://stackoverflow.com/a/19095988/2245329) or go for a more radical approach: ...
18549407
How to untrack all deleted files in Git
16
2013-08-31 14:51:53
<p>What's the command to untrack all deleted files in Git?</p> <p>I know there's a command to untrack a file by name (<code>git rm myfile</code>)</p> <p>But I'd like to untrack all the deleted files, without caring about how they're named.</p>
15,467
1,126,971
2019-07-04 06:34:38
18,549,443
31
2013-08-31 14:56:32
2,684,319
2016-01-15 09:24:38
https://stackoverflow.com/q/18549407
https://stackoverflow.com/a/18549443
<p>In the newer versions of git, those files are automatically untracked with <code>git add --update</code>.</p>
<p>In the newer versions of git, those files are automatically untracked with <code>git add --update</code>.</p>
119, 456
git, version-control
<h1>How to untrack all deleted files in Git</h1> <p>What's the command to untrack all deleted files in Git?</p> <p>I know there's a command to untrack a file by name (<code>git rm myfile</code>)</p> <p>But I'd like to untrack all the deleted files, without caring about how they're named.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,894
git
# How to untrack all deleted files in Git What's the command to untrack all deleted files in Git? I know there's a command to untrack a file by name (`git rm myfile`) But I'd like to untrack all the deleted files, without caring about how they're named.
In the newer versions of git, those files are automatically untracked with `git add --update`.
16678936
gitignore directory exception not working
16
2013-05-21 20:28:34
<p>I have the following folder structure:</p> <pre><code>public media catalog product category private tmp var test </code></pre> <p>I want to gitignore everything in the <code>media</code> directory except for <code>catalog/category</code> and <code...
19,942
1,189,880
2020-04-30 16:14:57
16,679,292
31
2013-05-21 20:52:00
19,563
2013-05-21 21:08:12
https://stackoverflow.com/q/16678936
https://stackoverflow.com/a/16679292
<p>It's usually simplest to put just a <code>.gitignore</code> at the level where it starts to matter. (This also helps if you ever split a repository or move directories around.) In this case you need to ignore everything except <code>catalog</code> and <code>private</code> in the <code>public/media</code> folder so i...
<p>It's usually simplest to put just a <code>.gitignore</code> at the level where it starts to matter. (This also helps if you ever split a repository or move directories around.) In this case you need to ignore everything except <code>catalog</code> and <code>private</code> in the <code>public/media</code> folder so i...
119, 25056
git, gitignore
<h1>gitignore directory exception not working</h1> <p>I have the following folder structure:</p> <pre><code>public media catalog product category private tmp var test </code></pre> <p>I want to gitignore everything in the <code>media</code> directory...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,895
git
# gitignore directory exception not working I have the following folder structure: ``` public media catalog product category private tmp var test ``` I want to gitignore everything in the `media` directory except for `catalog/category` and `private`...
It's usually simplest to put just a `.gitignore` at the level where it starts to matter. (This also helps if you ever split a repository or move directories around.) In this case you need to ignore everything except `catalog` and `private` in the `public/media` folder so in `public/media/.gitignore` put: ``` /* !/cata...
7506832
git push origin master:refs/heads/master what does this do
15
2011-09-21 21:22:45
<p>When I create a new repo on my gitolite repository I always have to enter the following command before I can start pushing code to the server.</p> <p><code>git push origin master:refs/heads/master</code></p> <p>What does it do ?</p> <p>My guess is that is has to do with the head reference not sure. Could someone ...
22,249
957,884
2016-05-03 03:50:26
7,506,906
31
2011-09-21 21:30:07
582
2011-09-21 21:30:07
https://stackoverflow.com/q/7506832
https://stackoverflow.com/a/7506906
<p>There's three parts to this command:</p> <pre><code>git push </code></pre> <p>This invokes the push command</p> <pre><code>origin </code></pre> <p>This names the remote to which you are pushing. This is either one of the named remotes stored in .git/config (you can list these with <code>git remote</code>), a URL...
<p>There's three parts to this command:</p> <pre><code>git push </code></pre> <p>This invokes the push command</p> <pre><code>origin </code></pre> <p>This names the remote to which you are pushing. This is either one of the named remotes stored in .git/config (you can list these with <code>git remote</code>), a URL...
119, 39151
git, gitolite
<h1>git push origin master:refs/heads/master what does this do</h1> <p>When I create a new repo on my gitolite repository I always have to enter the following command before I can start pushing code to the server.</p> <p><code>git push origin master:refs/heads/master</code></p> <p>What does it do ?</p> <p>My guess i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,898
git
# git push origin master:refs/heads/master what does this do When I create a new repo on my gitolite repository I always have to enter the following command before I can start pushing code to the server. `git push origin master:refs/heads/master` What does it do ? My guess is that is has to do with the head referen...
There's three parts to this command: ``` git push ``` This invokes the push command ``` origin ``` This names the remote to which you are pushing. This is either one of the named remotes stored in .git/config (you can list these with `git remote`), a URL, or the token `.` which means the current repository. ``` ma...
72446262
git pull: Not possible to fast-forward,
14
2022-05-31 10:36:44
<p>could you please help me to solve my issue? Error occurs when I try to pull from &quot;dev&quot; branch. I browsed the solution and it says that I need to &quot;rebase&quot; but it didnt work out foe me.</p> <pre><code>CT+aohc@MP1GYWQA MINGW64 /c/TCO/source/RAPMD.Web.Frontend (web_feature/TCORAPD-122389-1) $ git pul...
69,594
12,454,470
2023-02-21 08:59:42
72,460,052
31
2022-06-01 10:10:24
15,352,279
2022-06-01 10:10:24
https://stackoverflow.com/q/72446262
https://stackoverflow.com/a/72460052
<p>You can follow the following steps:</p> <ul> <li>Run <code>git pull --rebase origin dev</code></li> <li>if you face conflicts then you need to solve those conflicts and run <ul> <li><code>git add &lt;file_name&gt;/ git add .</code></li> <li><code>git rebase --continue</code></li> </ul> </li> <li>continue second step...
<p>You can follow the following steps:</p> <ul> <li>Run <code>git pull --rebase origin dev</code></li> <li>if you face conflicts then you need to solve those conflicts and run <ul> <li><code>git add &lt;file_name&gt;/ git add .</code></li> <li><code>git rebase --continue</code></li> </ul> </li> <li>continue second step...
119, 4860, 8974, 90056
atlassian-sourcetree, git, pull, rebase
<h1>git pull: Not possible to fast-forward,</h1> <p>could you please help me to solve my issue? Error occurs when I try to pull from &quot;dev&quot; branch. I browsed the solution and it says that I need to &quot;rebase&quot; but it didnt work out foe me.</p> <pre><code>CT+aohc@MP1GYWQA MINGW64 /c/TCO/source/RAPMD.Web....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,899
git
# git pull: Not possible to fast-forward, could you please help me to solve my issue? Error occurs when I try to pull from "dev" branch. I browsed the solution and it says that I need to "rebase" but it didnt work out foe me. ``` CT+aohc@MP1GYWQA MINGW64 /c/TCO/source/RAPMD.Web.Frontend (web_feature/TCORAPD-122389-1)...
You can follow the following steps: - Run `git pull --rebase origin dev` - if you face conflicts then you need to solve those conflicts and run - `git add <file_name>/ git add .` - `git rebase --continue` - continue second step until you solve conflicts(remeber rebase compare changes commit wise) - Then run `git...
12608610
How do you get the author date and commit date from a JGit RevCommit?
14
2012-09-26 19:01:26
<p><code>RevCommit</code> has a <code>getCommitTime()</code> method but it returns an <code>int</code> and it does not have an author time. How can I get the author and commit date from a <code>RevCommit</code>?</p>
7,501
329,737
2022-02-28 16:57:37
12,609,892
31
2012-09-26 20:30:53
305,973
2012-09-26 20:38:11
https://stackoverflow.com/q/12608610
https://stackoverflow.com/a/12609892
<p>Like so:</p> <pre><code>RevCommit commit = ...; PersonIdent authorIdent = commit.getAuthorIdent(); Date authorDate = authorIdent.getWhen(); TimeZone authorTimeZone = authorIdent.getTimeZone(); PersonIdent committerIdent = commit.getCommitterIdent(); ... </code></pre> <p>Also see <a href="http://download.eclipse....
<p>Like so:</p> <pre><code>RevCommit commit = ...; PersonIdent authorIdent = commit.getAuthorIdent(); Date authorDate = authorIdent.getWhen(); TimeZone authorTimeZone = authorIdent.getTimeZone(); PersonIdent committerIdent = commit.getCommitterIdent(); ... </code></pre> <p>Also see <a href="http://download.eclipse....
119, 61058
git, jgit
<h1>How do you get the author date and commit date from a JGit RevCommit?</h1> <p><code>RevCommit</code> has a <code>getCommitTime()</code> method but it returns an <code>int</code> and it does not have an author time. How can I get the author and commit date from a <code>RevCommit</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,903
git
# How do you get the author date and commit date from a JGit RevCommit? `RevCommit` has a `getCommitTime()` method but it returns an `int` and it does not have an author time. How can I get the author and commit date from a `RevCommit`?
Like so: ``` RevCommit commit = ...; PersonIdent authorIdent = commit.getAuthorIdent(); Date authorDate = authorIdent.getWhen(); TimeZone authorTimeZone = authorIdent.getTimeZone(); PersonIdent committerIdent = commit.getCommitterIdent(); ... ``` Also see [API documentation](http://download.eclipse.org/jgit/docs/jg...
9917645
Push to gerrit using SourceTree
14
2012-03-29 00:35:39
<p>I can't figure out how to make SourceTree push to Gerrit.</p> <p>I saw this link but I still don't understand how it can be done: <a href="https://answers.atlassian.com/questions/29361/configuring-sourcetree-push-for-gerrit">https://answers.atlassian.com/questions/29361/configuring-sourcetree-push-for-gerrit</a></p...
20,477
238,427
2014-02-18 08:58:03
10,357,378
31
2012-04-27 20:26:14
786,481
2012-04-27 21:54:52
https://stackoverflow.com/q/9917645
https://stackoverflow.com/a/10357378
<p>I believe the answer provided by atlassian says to change the name of the remote branch when you see the Push dialog. </p> <ol> <li>Open the push dialog</li> <li>Click on the remote branch name under the "Remote Branch" column (mine is presently 'master')</li> <li>Type in the new remo branch name - which would be ...
<p>I believe the answer provided by atlassian says to change the name of the remote branch when you see the Push dialog. </p> <ol> <li>Open the push dialog</li> <li>Click on the remote branch name under the "Remote Branch" column (mine is presently 'master')</li> <li>Type in the new remo branch name - which would be ...
119, 52272, 90056
atlassian-sourcetree, gerrit, git
<h1>Push to gerrit using SourceTree</h1> <p>I can't figure out how to make SourceTree push to Gerrit.</p> <p>I saw this link but I still don't understand how it can be done: <a href="https://answers.atlassian.com/questions/29361/configuring-sourcetree-push-for-gerrit">https://answers.atlassian.com/questions/29361/conf...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,904
git
# Push to gerrit using SourceTree I can't figure out how to make SourceTree push to Gerrit. I saw this link but I still don't understand how it can be done: <https://answers.atlassian.com/questions/29361/configuring-sourcetree-push-for-gerrit> Apparently according to the release notes for 1.3.3 there is a way to do ...
I believe the answer provided by atlassian says to change the name of the remote branch when you see the Push dialog. 1. Open the push dialog 2. Click on the remote branch name under the "Remote Branch" column (mine is presently 'master') 3. Type in the new remo branch name - which would be 'refs/for/master' for me 4....
52162264
How do I configure git to PGP sign my tags by default (not my commits)
13
2018-09-04 08:43:30
<p>I currently have the following <code>~/.gitconfig</code>:</p> <pre><code>[gpg] program = /usr/local/bin/krgpg [commit] gpgSign = true [tag] forceSignAnnotated = true </code></pre> <p>A commit requires me to sign using PGP:</p> <pre><code>git commit -m "Add package.json" Krypton ▶ Requesting git commit...
4,315
3,970,701
2024-03-03 12:56:02
56,979,390
31
2019-07-10 22:23:16
6,309
2024-03-03 12:56:02
https://stackoverflow.com/q/52162264
https://stackoverflow.com/a/56979390
<p>With Git 2.23 (Q3 2019), you now have a new <code>tag.gpgSign</code> configuration variable, which turns &quot;<code>git tag -a</code>&quot; into &quot;<code>git tag -s</code>&quot;! You can enable it by default with:</p> <pre class="lang-bash prettyprint-override"><code>git config --global tag.gpgSign true </code><...
<p>With Git 2.23 (Q3 2019), you now have a new <code>tag.gpgSign</code> configuration variable, which turns &quot;<code>git tag -a</code>&quot; into &quot;<code>git tag -s</code>&quot;! You can enable it by default with:</p> <pre class="lang-bash prettyprint-override"><code>git config --global tag.gpgSign true </code><...
119
git
<h1>How do I configure git to PGP sign my tags by default (not my commits)</h1> <p>I currently have the following <code>~/.gitconfig</code>:</p> <pre><code>[gpg] program = /usr/local/bin/krgpg [commit] gpgSign = true [tag] forceSignAnnotated = true </code></pre> <p>A commit requires me to sign using PGP:<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,905
git
# How do I configure git to PGP sign my tags by default (not my commits) I currently have the following `~/.gitconfig`: ``` [gpg] program = /usr/local/bin/krgpg [commit] gpgSign = true [tag] forceSignAnnotated = true ``` A commit requires me to sign using PGP: ``` git commit -m "Add package.json" Krypto...
With Git 2.23 (Q3 2019), you now have a new `tag.gpgSign` configuration variable, which turns "`git tag -a`" into "`git tag -s`"! You can enable it by default with: ``` git config --global tag.gpgSign true ``` See [commit 1c6b565](https://github.com/git/git/commit/1c6b565f896c27dc7c52aa3af9c7dcfc7934e8fe) (05 Jun 201...
39670247
Can't Find Global .gitconfig FIle
13
2016-09-23 22:09:22
<p>I was trying to make some updates to my global .gitconfig file on my Windows 7 machine. I have Git installed via the <a href="https://git-scm.com/" rel="noreferrer">https://git-scm.com/</a> for Windows. The file was located at <code>C:\Users\MyName\.gitconfig</code>, but when I ran some commands, the file wasn't u...
25,845
332,893
2016-09-24 01:00:39
39,671,485
31
2016-09-24 01:00:39
3,728,901
2016-09-24 01:00:39
https://stackoverflow.com/q/39670247
https://stackoverflow.com/a/39671485
<p>type:</p> <pre><code>git config --list --show-origin </code></pre> <p>then you will see the location of file <code>.gitconfig</code>. (The command works on Windows, Mac OS X, Linux)</p>
<p>type:</p> <pre><code>git config --list --show-origin </code></pre> <p>then you will see the location of file <code>.gitconfig</code>. (The command works on Windows, Mac OS X, Linux)</p>
119, 3574
config, git
<h1>Can't Find Global .gitconfig FIle</h1> <p>I was trying to make some updates to my global .gitconfig file on my Windows 7 machine. I have Git installed via the <a href="https://git-scm.com/" rel="noreferrer">https://git-scm.com/</a> for Windows. The file was located at <code>C:\Users\MyName\.gitconfig</code>, but ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,906
git
# Can't Find Global .gitconfig FIle I was trying to make some updates to my global .gitconfig file on my Windows 7 machine. I have Git installed via the <https://git-scm.com/> for Windows. The file was located at `C:\Users\MyName\.gitconfig`, but when I ran some commands, the file wasn't updated. I unistalled Git (an...
type: ``` git config --list --show-origin ``` then you will see the location of file `.gitconfig`. (The command works on Windows, Mac OS X, Linux)
22565184
Git: how to revert after a merge conflict corruption
13
2014-03-21 17:11:10
<p>OK, as a SVN and CVS expert of 20 years, I am finding git very challenging. I have read lots of guides, not found one which is comprehensible. Many apologies for my stupidity with git. </p> <p>We only use master, no branches. Git was forced on us.</p> <p>I have a js file which I "own" noone else should be tou...
30,905
1,072,187
2014-03-21 22:09:07
22,565,959
31
2014-03-21 17:48:14
3,033,893
2014-03-21 17:55:41
https://stackoverflow.com/q/22565184
https://stackoverflow.com/a/22565959
<p>Your two problems can be solved in the same way:</p> <pre><code>git checkout HEAD my/filename.js </code></pre> <p>Where HEAD is literal (git shorthand for current branch name) and my/filename.js should be replaced by the actual filename of your file. This will restore your file to how it was before the update, eff...
<p>Your two problems can be solved in the same way:</p> <pre><code>git checkout HEAD my/filename.js </code></pre> <p>Where HEAD is literal (git shorthand for current branch name) and my/filename.js should be replaced by the actual filename of your file. This will restore your file to how it was before the update, eff...
119, 717
git, merge
<h1>Git: how to revert after a merge conflict corruption</h1> <p>OK, as a SVN and CVS expert of 20 years, I am finding git very challenging. I have read lots of guides, not found one which is comprehensible. Many apologies for my stupidity with git. </p> <p>We only use master, no branches. Git was forced on us.</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,907
git
# Git: how to revert after a merge conflict corruption OK, as a SVN and CVS expert of 20 years, I am finding git very challenging. I have read lots of guides, not found one which is comprehensible. Many apologies for my stupidity with git. We only use master, no branches. Git was forced on us. I have a js file which...
Your two problems can be solved in the same way: ``` git checkout HEAD my/filename.js ``` Where HEAD is literal (git shorthand for current branch name) and my/filename.js should be replaced by the actual filename of your file. This will restore your file to how it was before the update, effectively "undoing" the chan...
21230090
Remove a deleted folder from git history
13
2014-01-20 09:16:22
<p>How can I remove a folder that is already deleted from the git history?</p> <p>In my git repository I have a folder called <code>/foo</code> (1.2GB of size). I have deleted the folder <code>foo</code> with <code>rm -rf /foo</code> beause I do not need it any more. After many other commits I thought. Why is my remot...
16,074
236,835
2021-04-19 19:01:46
21,234,556
31
2014-01-20 12:46:36
1,600,898
2014-01-20 12:56:31
https://stackoverflow.com/q/21230090
https://stackoverflow.com/a/21234556
<p>The <a href="https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html#_examples" rel="noreferrer">documentation</a> covers the similar case of purging a file from history:</p> <pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD </code></pre> <p>Since you are ...
<p>The <a href="https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html#_examples" rel="noreferrer">documentation</a> covers the similar case of purging a file from history:</p> <pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD </code></pre> <p>Since you are ...
119
git
<h1>Remove a deleted folder from git history</h1> <p>How can I remove a folder that is already deleted from the git history?</p> <p>In my git repository I have a folder called <code>/foo</code> (1.2GB of size). I have deleted the folder <code>foo</code> with <code>rm -rf /foo</code> beause I do not need it any more. A...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,908
git
# Remove a deleted folder from git history How can I remove a folder that is already deleted from the git history? In my git repository I have a folder called `/foo` (1.2GB of size). I have deleted the folder `foo` with `rm -rf /foo` beause I do not need it any more. After many other commits I thought. Why is my remo...
The [documentation](https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html#_examples) covers the similar case of purging a file from history: ``` git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD ``` Since you are deleting a whole directory, add the `-r` flag to `git r...
19063961
Git - restore a deleted folder from previous commit
13
2013-09-28 06:13:21
<p>I have a git repo on my local and I push it to BitBucket.</p> <p>I have a deleted folder in my previous commit, which I now want to bring it back.</p> <p>On my local machine, I do</p> <pre><code>git checkout COMMIT_ID path/to/deleted/folder </code></pre> <p>and I got</p> <pre><code>error: pathspec path/to/delet...
9,407
181,557
2023-04-06 16:01:58
19,063,966
31
2013-09-28 06:14:31
846,273
2013-09-28 06:23:42
https://stackoverflow.com/q/19063961
https://stackoverflow.com/a/19063966
<p>A cause of the error is likely to be that you're trying to checkout the directory from a revision it didn't exist in. Are you absolutely positive that in <code>COMMIT_ID</code> the directory existed?</p> <p>By the way, the command should be</p> <pre><code>git checkout COMMIT_ID -- path/to/deleted/folder </code></p...
<p>A cause of the error is likely to be that you're trying to checkout the directory from a revision it didn't exist in. Are you absolutely positive that in <code>COMMIT_ID</code> the directory existed?</p> <p>By the way, the command should be</p> <pre><code>git checkout COMMIT_ID -- path/to/deleted/folder </code></p...
119
git
<h1>Git - restore a deleted folder from previous commit</h1> <p>I have a git repo on my local and I push it to BitBucket.</p> <p>I have a deleted folder in my previous commit, which I now want to bring it back.</p> <p>On my local machine, I do</p> <pre><code>git checkout COMMIT_ID path/to/deleted/folder </code></pre...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,909
git
# Git - restore a deleted folder from previous commit I have a git repo on my local and I push it to BitBucket. I have a deleted folder in my previous commit, which I now want to bring it back. On my local machine, I do ``` git checkout COMMIT_ID path/to/deleted/folder ``` and I got ``` error: pathspec path/to/de...
A cause of the error is likely to be that you're trying to checkout the directory from a revision it didn't exist in. Are you absolutely positive that in `COMMIT_ID` the directory existed? By the way, the command should be ``` git checkout COMMIT_ID -- path/to/deleted/folder ```
60212005
git cherry pick but recive fatal: Unknown commit pick
12
2020-02-13 16:02:06
<p>on my local git have develop branch and feature branch. in feature branch has three commit with hash code a1,a2,a3. I want to pick a2 to develop branch so i did</p> <pre><code>- git checkout develop - git cherry pick a2 =&gt; fatal: Unknown commit pick - I wrong something ? </code></pre>
10,790
11,992,213
2020-02-13 20:01:22
60,215,596
31
2020-02-13 20:01:22
10,374,042
2020-02-13 20:01:22
https://stackoverflow.com/q/60212005
https://stackoverflow.com/a/60215596
<p>The command you're looking for is <code>git cherry-pick a2</code>.</p> <p>Note there's a dash between <code>cherry</code> and <code>pick</code></p>
<p>The command you're looking for is <code>git cherry-pick a2</code>.</p> <p>Note there's a dash between <code>cherry</code> and <code>pick</code></p>
119
git
<h1>git cherry pick but recive fatal: Unknown commit pick</h1> <p>on my local git have develop branch and feature branch. in feature branch has three commit with hash code a1,a2,a3. I want to pick a2 to develop branch so i did</p> <pre><code>- git checkout develop - git cherry pick a2 =&gt; fatal: Unknown commit pick...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,910
git
# git cherry pick but recive fatal: Unknown commit pick on my local git have develop branch and feature branch. in feature branch has three commit with hash code a1,a2,a3. I want to pick a2 to develop branch so i did ``` - git checkout develop - git cherry pick a2 => fatal: Unknown commit pick - I wrong something ? `...
The command you're looking for is `git cherry-pick a2`. Note there's a dash between `cherry` and `pick`
41398489
What is the difference between repository and branch in git?
12
2016-12-30 15:17:13
<p>Someone who is well versed in git could help me to understand the difference between repo and branch. I am recently introduced to git and having a bit hard time to understand them. I was told to clone a remote repo (e.g. foo) to my local box. Then create a local branch out of it. Work (update/create/delete files) on...
43,096
1,056,958
2018-07-04 15:26:46
41,398,581
31
2016-12-30 15:23:57
6,290,463
2018-07-04 15:26:46
https://stackoverflow.com/q/41398489
https://stackoverflow.com/a/41398581
<p>A <em>repository</em> is your whole project (directories and files) that you clone on your computer. A <em>branch</em> is a version of your repository, or in other words, an independent line of development.</p> <p>A repository can contain multiple <em>branches</em>, which means there are multiple versions of the re...
<p>A <em>repository</em> is your whole project (directories and files) that you clone on your computer. A <em>branch</em> is a version of your repository, or in other words, an independent line of development.</p> <p>A repository can contain multiple <em>branches</em>, which means there are multiple versions of the re...
119
git
<h1>What is the difference between repository and branch in git?</h1> <p>Someone who is well versed in git could help me to understand the difference between repo and branch. I am recently introduced to git and having a bit hard time to understand them. I was told to clone a remote repo (e.g. foo) to my local box. Then...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,911
git
# What is the difference between repository and branch in git? Someone who is well versed in git could help me to understand the difference between repo and branch. I am recently introduced to git and having a bit hard time to understand them. I was told to clone a remote repo (e.g. foo) to my local box. Then create a...
A *repository* is your whole project (directories and files) that you clone on your computer. A *branch* is a version of your repository, or in other words, an independent line of development. A repository can contain multiple *branches*, which means there are multiple versions of the repository. The purpose of versio...
76950626
Some of my workspace Git repositories no longer show up in my VS Code Source Control View. Why? How can I restore them to that view?
11
2023-08-22 06:33:24
<p>I have a bunch of repositories that I'm working in by using a workspace. I discovered last week that (as far as i know) 2 aren't automatically opening anymore in source control. <a href="https://i.sstatic.net/4PTEj.png" rel="noreferrer"><img src="https://i.sstatic.net/4PTEj.png" alt="enter image description here" />...
9,138
2,028,481
2024-01-14 11:28:48
76,951,439
31
2023-08-22 08:29:12
11,107,541
2024-01-14 11:28:48
https://stackoverflow.com/q/76950626
https://stackoverflow.com/a/76951439
<p>I'd suggest that you check if you closed the repositories (see also my answer post in <a href="https://stackoverflow.com/q/49325617/11107541">How can I ignore a whole git repository in Visual Studio Code?</a> for info about that feature). You can reopen closed repositories by using the <code>Git: Reopen Closed Repos...
<p>I'd suggest that you check if you closed the repositories (see also my answer post in <a href="https://stackoverflow.com/q/49325617/11107541">How can I ignore a whole git repository in Visual Studio Code?</a> for info about that feature). You can reopen closed repositories by using the <code>Git: Reopen Closed Repos...
119, 30957, 111608
git, source-control-explorer, visual-studio-code
<h1>Some of my workspace Git repositories no longer show up in my VS Code Source Control View. Why? How can I restore them to that view?</h1> <p>I have a bunch of repositories that I'm working in by using a workspace. I discovered last week that (as far as i know) 2 aren't automatically opening anymore in source contro...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,912
git
# Some of my workspace Git repositories no longer show up in my VS Code Source Control View. Why? How can I restore them to that view? I have a bunch of repositories that I'm working in by using a workspace. I discovered last week that (as far as i know) 2 aren't automatically opening anymore in source control. [![ent...
I'd suggest that you check if you closed the repositories (see also my answer post in [How can I ignore a whole git repository in Visual Studio Code?](https://stackoverflow.com/q/49325617/11107541) for info about that feature). You can reopen closed repositories by using the `Git: Reopen Closed Repositories...` command...
10755791
Is there a way to delete a branch on heroku
11
2012-05-25 14:03:32
<p>I am using heroku to host my application. With merges and rebases i got 2 different stages of my app.</p> <p>Local master is different from master on heroku.</p> <p>pushing to heroku master failed with:</p> <pre><code> ! [rejected] master -&gt; master (non-fast-forward) error: failed to push some refs to...
12,381
933,573
2023-01-09 19:11:34
10,755,830
31
2012-05-25 14:05:20
125,816
2012-05-25 14:13:00
https://stackoverflow.com/q/10755791
https://stackoverflow.com/a/10755830
<p>You can force push</p> <pre><code>git push --force origin master </code></pre> <p>That will overwrite remote master.</p> <p>You can also delete remote branch by doing this</p> <pre><code>git push origin :master </code></pre> <p>Note the colon before branch name. This command says "take void from local machine a...
<p>You can force push</p> <pre><code>git push --force origin master </code></pre> <p>That will overwrite remote master.</p> <p>You can also delete remote branch by doing this</p> <pre><code>git push origin :master </code></pre> <p>Note the colon before branch name. This command says "take void from local machine a...
119, 190, 8279, 64108
deployment, git, heroku, ruby-on-rails-3
<h1>Is there a way to delete a branch on heroku</h1> <p>I am using heroku to host my application. With merges and rebases i got 2 different stages of my app.</p> <p>Local master is different from master on heroku.</p> <p>pushing to heroku master failed with:</p> <pre><code> ! [rejected] master -&gt; master (n...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,913
git
# Is there a way to delete a branch on heroku I am using heroku to host my application. With merges and rebases i got 2 different stages of my app. Local master is different from master on heroku. pushing to heroku master failed with: ``` ! [rejected] master -> master (non-fast-forward) error: failed to p...
You can force push ``` git push --force origin master ``` That will overwrite remote master. You can also delete remote branch by doing this ``` git push origin :master ``` Note the colon before branch name. This command says "take void from local machine and put this instead of remote branch 'master'"
23337677
LibGitSharp: Checkout Remote Branch
8
2014-04-28 09:44:13
<p>i try to Checkout a Remotebranch via LibGitSharp. In git itself you use this comands:</p> <pre><code>git fetch origin git checkout -b test origin/test </code></pre> <p>in newer Versions it is just:</p> <pre><code>git fetch git checkout test </code></pre> <p>So i tried this Code:</p> <pre><code>repo.Fetch("origi...
5,275
3,541,236
2021-05-03 17:49:20
23,344,700
31
2014-04-28 15:11:00
335,418
2020-03-25 18:50:49
https://stackoverflow.com/q/23337677
https://stackoverflow.com/a/23344700
<p>If I correctly understand your question, you're willing to create a local branch which would be configured to track the fetched remote tracking branch.</p> <p>In other words, once you fetch a repository, your references contains remote tracking branches (eg. <code>origin/theBranch</code>) and you'd like to create a...
<p>If I correctly understand your question, you're willing to create a local branch which would be configured to track the fetched remote tracking branch.</p> <p>In other words, once you fetch a repository, your references contains remote tracking branches (eg. <code>origin/theBranch</code>) and you'd like to create a...
119, 64139, 74777
c#-4.0, git, libgit2sharp
<h1>LibGitSharp: Checkout Remote Branch</h1> <p>i try to Checkout a Remotebranch via LibGitSharp. In git itself you use this comands:</p> <pre><code>git fetch origin git checkout -b test origin/test </code></pre> <p>in newer Versions it is just:</p> <pre><code>git fetch git checkout test </code></pre> <p>So i tried...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,914
git
# LibGitSharp: Checkout Remote Branch i try to Checkout a Remotebranch via LibGitSharp. In git itself you use this comands: ``` git fetch origin git checkout -b test origin/test ``` in newer Versions it is just: ``` git fetch git checkout test ``` So i tried this Code: ``` repo.Fetch("origin"); repo.Checkout("ori...
If I correctly understand your question, you're willing to create a local branch which would be configured to track the fetched remote tracking branch. In other words, once you fetch a repository, your references contains remote tracking branches (eg. `origin/theBranch`) and you'd like to create a local branch bearing...
11834108
fatal: bad object xxx
121
2012-08-06 18:52:32
<p>I tried reverting to a previous git commit with:</p> <pre><code>git revert xxx </code></pre> <p>I'm now receiving this error as a response:</p> <pre><code>fatal: bad object xxx </code></pre> <p>What am I doing wrong? How do I fix this?</p>
245,979
1,431,587
2025-12-02 08:19:57
11,834,472
30
2012-08-06 19:17:51
1,256,452
2020-05-06 16:26:03
https://stackoverflow.com/q/11834108
https://stackoverflow.com/a/11834472
<p>[<strong>Edit 1, 19 Nov 2016</strong>] While this would sometimes indicate repository corruption, it turns out to occur on Windows when some command—usually, another Git in another task—is holding internal files open and locked. In this case, terminating the other task should fix it. Original answer is below.</p> ...
<p>[<strong>Edit 1, 19 Nov 2016</strong>] While this would sometimes indicate repository corruption, it turns out to occur on Windows when some command—usually, another Git in another task—is holding internal files open and locked. In this case, terminating the other task should fix it. Original answer is below.</p> ...
119
git
<h1>fatal: bad object xxx</h1> <p>I tried reverting to a previous git commit with:</p> <pre><code>git revert xxx </code></pre> <p>I'm now receiving this error as a response:</p> <pre><code>fatal: bad object xxx </code></pre> <p>What am I doing wrong? How do I fix this?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,915
git
# fatal: bad object xxx I tried reverting to a previous git commit with: ``` git revert xxx ``` I'm now receiving this error as a response: ``` fatal: bad object xxx ``` What am I doing wrong? How do I fix this?
[**Edit 1, 19 Nov 2016**] While this would sometimes indicate repository corruption, it turns out to occur on Windows when some command—usually, another Git in another task—is holding internal files open and locked. In this case, terminating the other task should fix it. Original answer is below. [**Edit 2, 6 May 2020...
8001663
Can Git treat ZIP files as directories and files inside the ZIP as blobs?
100
2011-11-03 20:48:31
<p><strong>The scenario</strong></p> <p>Imagine I am forced to work with some of my files always stored inside <code>.zip</code> files. Some of the files inside the ZIP file are small text files and change often, while others are larger but luckily rather static (e.g. images).</p> <p>If I want to place these ZIP files ...
35,560
669,202
2025-09-21 01:20:27
8,001,900
30
2011-11-03 21:10:49
90,322
2021-11-06 20:36:56
https://stackoverflow.com/q/8001663
https://stackoverflow.com/a/8001900
<p>This doesn't exist, but it could easily exist in the current framework. Just as Git acts differently with displaying binary or ASCII files when performing a diff, it could be told to offer special treatment to certain file types through the configuration interface.</p> <p>If you don't want to change the code base (a...
<p>This doesn't exist, but it could easily exist in the current framework. Just as Git acts differently with displaying binary or ASCII files when performing a diff, it could be told to offer special treatment to certain file types through the configuration interface.</p> <p>If you don't want to change the code base (a...
119, 881, 21628
git, msysgit, zip
<h1>Can Git treat ZIP files as directories and files inside the ZIP as blobs?</h1> <p><strong>The scenario</strong></p> <p>Imagine I am forced to work with some of my files always stored inside <code>.zip</code> files. Some of the files inside the ZIP file are small text files and change often, while others are larger ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,916
git
# Can Git treat ZIP files as directories and files inside the ZIP as blobs? **The scenario** Imagine I am forced to work with some of my files always stored inside `.zip` files. Some of the files inside the ZIP file are small text files and change often, while others are larger but luckily rather static (e.g. images)...
This doesn't exist, but it could easily exist in the current framework. Just as Git acts differently with displaying binary or ASCII files when performing a diff, it could be told to offer special treatment to certain file types through the configuration interface. If you don't want to change the code base (although t...
6644329
Block a git branch from being pushed
64
2011-07-10 23:06:08
<p>Here's the situation:</p> <p>I have a public repository for my open-source app on github.com. However, now I'd like to write some specific code that will not be public (I might use it in a commercial version of my application).</p> <p>I figured I could use the same repository, and I'd create a "private" branch in ...
42,003
363,078
2025-04-22 10:43:22
6,644,577
30
2011-07-11 00:02:12
98,117
2025-04-22 10:42:02
https://stackoverflow.com/q/6644329
https://stackoverflow.com/a/6644577
<p>A slightly hackish solution: Make a dummy branch on GitHub with the same name as your real branch, and make sure it would not be a fast forward merge. That way, the push operation will fail.</p> <p>Here's an example.</p> <pre class="lang-bash prettyprint-override"><code> $ git clone git@github.com:user/repo.git ...
<p>A slightly hackish solution: Make a dummy branch on GitHub with the same name as your real branch, and make sure it would not be a fast forward merge. That way, the push operation will fail.</p> <p>Here's an example.</p> <pre class="lang-bash prettyprint-override"><code> $ git clone git@github.com:user/repo.git ...
119, 1879, 4943
branch, git, private
<h1>Block a git branch from being pushed</h1> <p>Here's the situation:</p> <p>I have a public repository for my open-source app on github.com. However, now I'd like to write some specific code that will not be public (I might use it in a commercial version of my application).</p> <p>I figured I could use the same rep...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,921
git
# Block a git branch from being pushed Here's the situation: I have a public repository for my open-source app on github.com. However, now I'd like to write some specific code that will not be public (I might use it in a commercial version of my application). I figured I could use the same repository, and I'd create...
A slightly hackish solution: Make a dummy branch on GitHub with the same name as your real branch, and make sure it would not be a fast forward merge. That way, the push operation will fail. Here's an example. ``` $ git clone git@github.com:user/repo.git $ cd repo $ git checkout -b secret $ echo "This...
11966525
git svn clone results in empty directory
47
2012-08-15 08:58:15
<p>I have an svn repository with project structure:</p> <pre><code>/root/projectA/trunk /root/projectA/branches /root/projectA/tags /root/projectB/trunk /root/projectB/branches /root/projectB/tags </code></pre> <p>I want to clone projectA. When I run:</p> <pre><code>git svn clone -r &lt;revision number&gt;:HEAD &...
21,575
166,172
2017-03-26 12:58:52
11,990,122
30
2012-08-16 15:03:06
166,172
2012-08-16 15:03:06
https://stackoverflow.com/q/11966525
https://stackoverflow.com/a/11990122
<p>Below command did the job:</p> <pre><code> git svn clone -r HEAD &lt;url&gt;/root/projectA </code></pre>
<p>Below command did the job:</p> <pre><code> git svn clone -r HEAD &lt;url&gt;/root/projectA </code></pre>
63, 119
git, svn
<h1>git svn clone results in empty directory</h1> <p>I have an svn repository with project structure:</p> <pre><code>/root/projectA/trunk /root/projectA/branches /root/projectA/tags /root/projectB/trunk /root/projectB/branches /root/projectB/tags </code></pre> <p>I want to clone projectA. When I run:</p> <pre><co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,923
git
# git svn clone results in empty directory I have an svn repository with project structure: ``` /root/projectA/trunk /root/projectA/branches /root/projectA/tags /root/projectB/trunk /root/projectB/branches /root/projectB/tags ``` I want to clone projectA. When I run: ``` git svn clone -r <revision number>:HEAD <ur...
Below command did the job: ``` git svn clone -r HEAD <url>/root/projectA ```
11935043
git error when trying to push to remote branch
42
2012-08-13 13:17:49
<p>I've cloned repository A's master branch from git and created my own branch called Li. I've made some changes a while ago and pushed the contents of local Li to remote Li.</p> <p>Now I've pulled some updates from remote master to my local master branch and from the local master branch to the local Li, and I'm tryin...
71,662
429,400
2017-08-23 09:36:34
11,935,408
30
2012-08-13 13:36:55
877,115
2012-08-13 13:36:55
https://stackoverflow.com/q/11935043
https://stackoverflow.com/a/11935408
<p>Find the diff with <code>git fetch &amp;&amp; git log Li..origin/Li</code>. I would guess you've rebased or otherwise recut <code>Li</code> since last time you pushed, but that command should tell you exactly what's in the remote that isn't in the local. You can find what's in either (but not both) with the triple-d...
<p>Find the diff with <code>git fetch &amp;&amp; git log Li..origin/Li</code>. I would guess you've rebased or otherwise recut <code>Li</code> since last time you pushed, but that command should tell you exactly what's in the remote that isn't in the local. You can find what's in either (but not both) with the triple-d...
119, 4236
git, push
<h1>git error when trying to push to remote branch</h1> <p>I've cloned repository A's master branch from git and created my own branch called Li. I've made some changes a while ago and pushed the contents of local Li to remote Li.</p> <p>Now I've pulled some updates from remote master to my local master branch and fro...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,925
git
# git error when trying to push to remote branch I've cloned repository A's master branch from git and created my own branch called Li. I've made some changes a while ago and pushed the contents of local Li to remote Li. Now I've pulled some updates from remote master to my local master branch and from the local mast...
Find the diff with `git fetch && git log Li..origin/Li`. I would guess you've rebased or otherwise recut `Li` since last time you pushed, but that command should tell you exactly what's in the remote that isn't in the local. You can find what's in either (but not both) with the triple-dot syntax: `git log Li...origin/L...
6796997
gitk equivalent of git log --follow <full path to file>
41
2011-07-22 23:00:42
<p>So I have a file called <code>one.txt</code> that I have been modifying over the years on master branch. <code>gitk one.txt</code> will show the entire history of that one particular file. However after I changed <code>one.txt</code> => <code>two.txt</code>, <code>gitk two.txt</code> doesn't show any change before...
8,651
1,024,089
2023-06-22 22:38:13
6,797,099
30
2011-07-22 23:18:56
6,309
2023-06-22 22:38:13
https://stackoverflow.com/q/6796997
https://stackoverflow.com/a/6797099
<p>The problem is <a href="http://66.135.57.166/lists/git/msg142677.html" rel="nofollow noreferrer"><code>gitk --follow</code> will for now differ from <code>git log --follow</code></a>, considering, according to Linux Torvalds, <code>--follow</code> is mainly a hack:</p> <blockquote> <p>I'm pretty sure I mentioned abo...
<p>The problem is <a href="http://66.135.57.166/lists/git/msg142677.html" rel="nofollow noreferrer"><code>gitk --follow</code> will for now differ from <code>git log --follow</code></a>, considering, according to Linux Torvalds, <code>--follow</code> is mainly a hack:</p> <blockquote> <p>I'm pretty sure I mentioned abo...
119, 30785, 30957
git, gitk, source-control-explorer
<h1>gitk equivalent of git log --follow <full path to file></h1> <p>So I have a file called <code>one.txt</code> that I have been modifying over the years on master branch. <code>gitk one.txt</code> will show the entire history of that one particular file. However after I changed <code>one.txt</code> => <code>two.txt...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,926
git
# gitk equivalent of git log --follow So I have a file called `one.txt` that I have been modifying over the years on master branch. `gitk one.txt` will show the entire history of that one particular file. However after I changed `one.txt` => `two.txt`, `gitk two.txt` doesn't show any change before the rename. I tried...
The problem is [`gitk --follow` will for now differ from `git log --follow`](http://66.135.57.166/lists/git/msg142677.html), considering, according to Linux Torvalds, `--follow` is mainly a hack: > I'm pretty sure I mentioned about this exact issue when I posted the original follow patches, and it basically boils down...
30537330
Is floating point precision mutable or invariant?
40
2015-05-29 19:11:03
<p>I keep getting mixed answers of whether floating point numbers (i.e. <code>float</code>, <code>double</code>, or <code>long double</code>) have one and only one value of precision, or have a precision value which can vary.</p> <p>One topic called <a href="https://stackoverflow.com/questions/5098558/float-vs-double-...
3,447
4,750,730
2015-08-28 03:00:52
30,537,382
30
2015-05-29 19:14:04
13
2015-05-31 22:14:01
https://stackoverflow.com/q/30537330
https://stackoverflow.com/a/30537382
<p>The precision is fixed, which is <strong>exactly 53 binary digits</strong> for double-precision (or 52 if we exclude the implicit leading 1). This comes out to <strong>about 15 decimal digits</strong>.</p> <hr> <p>The OP asked me to elaborate on why having exactly 53 binary digits means "about" 15 decimal digits.<...
<p>The precision is fixed, which is <strong>exactly 53 binary digits</strong> for double-precision (or 52 if we exclude the implicit leading 1). This comes out to <strong>about 15 decimal digits</strong>.</p> <hr> <p>The OP asked me to elaborate on why having exactly 53 binary digits means "about" 15 decimal digits.<...
305, 368, 6250, 12414, 67245
binary, decimal, floating-point, floating-point-precision, significant-digits
<h1>Is floating point precision mutable or invariant?</h1> <p>I keep getting mixed answers of whether floating point numbers (i.e. <code>float</code>, <code>double</code>, or <code>long double</code>) have one and only one value of precision, or have a precision value which can vary.</p> <p>One topic called <a href="h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,927
git
# Is floating point precision mutable or invariant? I keep getting mixed answers of whether floating point numbers (i.e. `float`, `double`, or `long double`) have one and only one value of precision, or have a precision value which can vary. One topic called [float vs. double precision](https://stackoverflow.com/ques...
The precision is fixed, which is **exactly 53 binary digits** for double-precision (or 52 if we exclude the implicit leading 1). This comes out to **about 15 decimal digits**. --- The OP asked me to elaborate on why having exactly 53 binary digits means "about" 15 decimal digits. To understand this intuitively, let'...
37422221
Git remove a file from a branch, keep it in the master
39
2016-05-24 19:26:16
<p>I create a new branch</p> <pre><code>git checkout -b mybranch </code></pre> <p>then I delete a file from it</p> <pre><code>git rm --cached myfile.txt </code></pre> <p>but I want to keep it in the master; why when I checkout to the master</p> <pre><code>git checkout master </code></pre> <p>I get an "error: The ...
75,578
858,981
2024-06-04 12:24:19
37,449,671
30
2016-05-26 00:25:43
4,233,593
2021-11-26 04:31:34
https://stackoverflow.com/q/37422221
https://stackoverflow.com/a/37449671
<p>If you want to keep tracking <code>myfile.txt</code> on <code>master</code> but deleted from <code>mybranch</code>, then you simply need to delete it and commit the delete.</p> <pre><code>git checkout -b mybranch rm myfile.txt git commit -am &quot;delete myfile.txt&quot; </code></pre> <p>Now when you checkout <code>...
<p>If you want to keep tracking <code>myfile.txt</code> on <code>master</code> but deleted from <code>mybranch</code>, then you simply need to delete it and commit the delete.</p> <pre><code>git checkout -b mybranch rm myfile.txt git commit -am &quot;delete myfile.txt&quot; </code></pre> <p>Now when you checkout <code>...
119
git
<h1>Git remove a file from a branch, keep it in the master</h1> <p>I create a new branch</p> <pre><code>git checkout -b mybranch </code></pre> <p>then I delete a file from it</p> <pre><code>git rm --cached myfile.txt </code></pre> <p>but I want to keep it in the master; why when I checkout to the master</p> <pre><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,928
git
# Git remove a file from a branch, keep it in the master I create a new branch ``` git checkout -b mybranch ``` then I delete a file from it ``` git rm --cached myfile.txt ``` but I want to keep it in the master; why when I checkout to the master ``` git checkout master ``` I get an "error: The following untrack...
If you want to keep tracking `myfile.txt` on `master` but deleted from `mybranch`, then you simply need to delete it and commit the delete. ``` git checkout -b mybranch rm myfile.txt git commit -am "delete myfile.txt" ``` Now when you checkout `master`, you'll see your file returned and when you checkout `mybranch` i...
4312059
git pull says up-to-date but git push rejects non-fast forward
37
2010-11-30 09:10:52
<p>I've just pulled a new branch, made some local changes, committed and tried to push. I was given this error: <code>! [rejected] groups -&gt; groups (non-fast forward)</code> So I tried a to pull but was told <code>Already up-to-date.</code></p> <p>Here's what I get pulling then pushing.</p> <pre><code>~/dev$ git p...
23,675
246,265
2016-05-02 06:24:12
4,312,238
30
2010-11-30 09:35:10
136,248
2010-11-30 09:35:10
https://stackoverflow.com/q/4312059
https://stackoverflow.com/a/4312238
<p>When you pulled the branch, did you use the "--track" option (in order to keep you local branch tracking the remote branch). If you did not, it can explain that the "merge" command that does not work.</p> <p>You can do the merge manually:</p> <pre><code>git fetch git merge origin/groups </code></pre> <p>To compar...
<p>When you pulled the branch, did you use the "--track" option (in order to keep you local branch tracking the remote branch). If you did not, it can explain that the "merge" command that does not work.</p> <p>You can do the merge manually:</p> <pre><code>git fetch git merge origin/groups </code></pre> <p>To compar...
119, 28896, 28898
git, git-pull, git-push
<h1>git pull says up-to-date but git push rejects non-fast forward</h1> <p>I've just pulled a new branch, made some local changes, committed and tried to push. I was given this error: <code>! [rejected] groups -&gt; groups (non-fast forward)</code> So I tried a to pull but was told <code>Already up-to-date.</code></p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,930
git
# git pull says up-to-date but git push rejects non-fast forward I've just pulled a new branch, made some local changes, committed and tried to push. I was given this error: `! [rejected] groups -> groups (non-fast forward)` So I tried a to pull but was told `Already up-to-date.` Here's what I get pulling then pushin...
When you pulled the branch, did you use the "--track" option (in order to keep you local branch tracking the remote branch). If you did not, it can explain that the "merge" command that does not work. You can do the merge manually: ``` git fetch git merge origin/groups ``` To compare local and remote repos, I sugges...
10461870
What can/should I do about this git gc error? (rm: cannot unlink pack Permission denied)
34
2012-05-05 12:32:34
<p>When running git gc, I keep seeing this error:</p> <pre><code>rm: cannot unlink 'pack-30b1ff2[reset of hash].pack': Permission denied </code></pre> <p>What can/should I do about this error?</p> <p><strong>Update</strong></p> <p>Sorry, I should have provided more info. Yes, I have tried a reboot. In fact,reboots ...
15,716
304,832
2019-07-14 16:52:06
10,464,571
30
2012-05-05 18:06:40
681,815
2012-05-05 18:06:40
https://stackoverflow.com/q/10461870
https://stackoverflow.com/a/10464571
<p>"Permission denied" on Windows is often caused by a lock from a running process. It's probable that there is a stalled Git EXT thread opened the pack file.</p> <p>Try to do the <code>git gc</code> in safe mode.</p> <p>Another option is to clone the repository in a new place and delete the old one.</p>
<p>"Permission denied" on Windows is often caused by a lock from a running process. It's probable that there is a stalled Git EXT thread opened the pack file.</p> <p>Try to do the <code>git gc</code> in safe mode.</p> <p>Another option is to clone the repository in a new place and delete the old one.</p>
119, 1850, 26154
garbage-collection, git, permission-denied
<h1>What can/should I do about this git gc error? (rm: cannot unlink pack Permission denied)</h1> <p>When running git gc, I keep seeing this error:</p> <pre><code>rm: cannot unlink 'pack-30b1ff2[reset of hash].pack': Permission denied </code></pre> <p>What can/should I do about this error?</p> <p><strong>Update</str...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,933
git
# What can/should I do about this git gc error? (rm: cannot unlink pack Permission denied) When running git gc, I keep seeing this error: ``` rm: cannot unlink 'pack-30b1ff2[reset of hash].pack': Permission denied ``` What can/should I do about this error? **Update** Sorry, I should have provided more info. Yes, I...
"Permission denied" on Windows is often caused by a lock from a running process. It's probable that there is a stalled Git EXT thread opened the pack file. Try to do the `git gc` in safe mode. Another option is to clone the repository in a new place and delete the old one.
35690736
Handling changes to files with --skip-worktree from another branch
33
2016-02-29 01:51:12
<p>On my machine, I've set <code>--skip-worktree</code> to <code>config/database.yml</code>.</p> <pre><code>git update-index --skip-worktree config/database.yml </code></pre> <p>Another developer has committed and merged into the develop branch changes to <code>config/database.yml</code> while working on the project....
5,539
38,765
2017-09-01 16:26:40
46,004,452
30
2017-09-01 16:26:40
8,533,154
2017-09-01 16:26:40
https://stackoverflow.com/q/35690736
https://stackoverflow.com/a/46004452
<p>That isn't a hacky approach at all. It's actually exactly what you need to do in this situation. Let's go through the scenario step by step. (Making a few assumptions along the way because it's a YML file.)</p> <p>You're ignoring the file because you have changes that only affect your local build process and don't ...
<p>That isn't a hacky approach at all. It's actually exactly what you need to do in this situation. Let's go through the scenario step by step. (Making a few assumptions along the way because it's a YML file.)</p> <p>You're ignoring the file because you have changes that only affect your local build process and don't ...
119, 53847, 111134
branching-and-merging, git, git-skip-worktree
<h1>Handling changes to files with --skip-worktree from another branch</h1> <p>On my machine, I've set <code>--skip-worktree</code> to <code>config/database.yml</code>.</p> <pre><code>git update-index --skip-worktree config/database.yml </code></pre> <p>Another developer has committed and merged into the develop bran...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,934
git
# Handling changes to files with --skip-worktree from another branch On my machine, I've set `--skip-worktree` to `config/database.yml`. ``` git update-index --skip-worktree config/database.yml ``` Another developer has committed and merged into the develop branch changes to `config/database.yml` while working on th...
That isn't a hacky approach at all. It's actually exactly what you need to do in this situation. Let's go through the scenario step by step. (Making a few assumptions along the way because it's a YML file.) You're ignoring the file because you have changes that only affect your local build process and don't want to ac...
70401702
How to perform git move in Visual Studio, instead of git delete and git add, when renaming, moving files in Solution Explorer?
31
2021-12-18 07:30:06
<p><strong>Context</strong></p> <p>I often move, rename files in Visual Studio 2022. Rename is a standard refactoring practice. However when I rename a file in Solution Explorer, not <code>git mv</code> operation is performed, instead git delete and git add.</p> <p>This causes loosing the history of that particular fil...
10,693
1,157,814
2024-09-05 21:01:24
70,444,785
30
2021-12-22 05:54:56
159,145
2021-12-22 06:18:25
https://stackoverflow.com/q/70401702
https://stackoverflow.com/a/70444785
<h2>First, let's clear-up some misconceptions...</h2> <ul> <li>A <code>git</code> commit is a snapshot of your entire repo at a given point-in-time.</li> <li>A <code>git</code> commit is not a diff or changeset.</li> <li>A <code>git</code> commit does not contain any file &quot;rename&quot; information.</li> <li>And <c...
<h2>First, let's clear-up some misconceptions...</h2> <ul> <li>A <code>git</code> commit is a snapshot of your entire repo at a given point-in-time.</li> <li>A <code>git</code> commit is not a diff or changeset.</li> <li>A <code>git</code> commit does not contain any file &quot;rename&quot; information.</li> <li>And <c...
119, 33953
git, visual-studio
<h1>How to perform git move in Visual Studio, instead of git delete and git add, when renaming, moving files in Solution Explorer?</h1> <p><strong>Context</strong></p> <p>I often move, rename files in Visual Studio 2022. Rename is a standard refactoring practice. However when I rename a file in Solution Explorer, not <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,938
git
# How to perform git move in Visual Studio, instead of git delete and git add, when renaming, moving files in Solution Explorer? **Context** I often move, rename files in Visual Studio 2022. Rename is a standard refactoring practice. However when I rename a file in Solution Explorer, not `git mv` operation is perform...
## First, let's clear-up some misconceptions... - A `git` commit is a snapshot of your entire repo at a given point-in-time. - A `git` commit is not a diff or changeset. - A `git` commit does not contain any file "rename" information. - And `git` itself does not log, monitor, record, or otherwise concern itself with f...
21991065
difference between git ignore and untrack
31
2014-02-24 14:48:45
<p>What's the difference between ignore a folder and untrack in git? I need to remove some folders from my git repository and I am working in Netbeans with the git plugins and put by mistake the build, dist, and nbproject folders in my repository and now I need to remove those folders.</p>
16,122
3,338,446
2016-01-29 19:15:21
21,991,379
30
2014-02-24 15:03:31
2,380,689
2016-01-29 19:15:21
https://stackoverflow.com/q/21991065
https://stackoverflow.com/a/21991379
<p>If you create a file in your repository named .gitignore, git will use its rules when looking at files to commit. git will not ignore a file that was already tracked (i.e. was in the repo) before a rule was added to this file to ignore it. File must be un-tracked (removed from the repo) using</p> <pre><code>git rm ...
<p>If you create a file in your repository named .gitignore, git will use its rules when looking at files to commit. git will not ignore a file that was already tracked (i.e. was in the repo) before a rule was added to this file to ignore it. File must be un-tracked (removed from the repo) using</p> <pre><code>git rm ...
119, 25056
git, gitignore
<h1>difference between git ignore and untrack</h1> <p>What's the difference between ignore a folder and untrack in git? I need to remove some folders from my git repository and I am working in Netbeans with the git plugins and put by mistake the build, dist, and nbproject folders in my repository and now I need to remo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,941
git
# difference between git ignore and untrack What's the difference between ignore a folder and untrack in git? I need to remove some folders from my git repository and I am working in Netbeans with the git plugins and put by mistake the build, dist, and nbproject folders in my repository and now I need to remove those ...
If you create a file in your repository named .gitignore, git will use its rules when looking at files to commit. git will not ignore a file that was already tracked (i.e. was in the repo) before a rule was added to this file to ignore it. File must be un-tracked (removed from the repo) using ``` git rm --cached filen...
3583061
Automatically mirror a git repository
31
2010-08-27 09:56:10
<p>One of the side-effects of using an external Subversion repository was getting automatic offsite backups on every commit.</p> <p>I'd like to achieve the same using Git. </p> <p>i.e. every commit to my local repository automatically commits to an external one so the two repositories are always in sync.</p> <p>I im...
20,349
45,955
2022-08-02 13:27:21
3,583,114
30
2010-08-27 10:02:59
140,185
2012-03-09 02:41:20
https://stackoverflow.com/q/3583061
https://stackoverflow.com/a/3583114
<p>I wrote a post-commit hook for just this purpose. The hook itself is simple; just add a file named <code>post-commit</code> to your <code>.git/hooks/</code> directory with the following contents:</p> <pre><code>git push my_remote </code></pre> <p>The <code>post-commit</code> file should be executable. Also make su...
<p>I wrote a post-commit hook for just this purpose. The hook itself is simple; just add a file named <code>post-commit</code> to your <code>.git/hooks/</code> directory with the following contents:</p> <pre><code>git push my_remote </code></pre> <p>The <code>post-commit</code> file should be executable. Also make su...
119, 456, 3346
dvcs, git, version-control
<h1>Automatically mirror a git repository</h1> <p>One of the side-effects of using an external Subversion repository was getting automatic offsite backups on every commit.</p> <p>I'd like to achieve the same using Git. </p> <p>i.e. every commit to my local repository automatically commits to an external one so the tw...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,942
git
# Automatically mirror a git repository One of the side-effects of using an external Subversion repository was getting automatic offsite backups on every commit. I'd like to achieve the same using Git. i.e. every commit to my local repository automatically commits to an external one so the two repositories are alway...
I wrote a post-commit hook for just this purpose. The hook itself is simple; just add a file named `post-commit` to your `.git/hooks/` directory with the following contents: ``` git push my_remote ``` The `post-commit` file should be executable. Also make sure that you add a suitable [remote](http://www.kernel.org/pu...
25886147
Git rebase, skip merge-commits
30
2014-09-17 08:52:35
<p>Starting with</p> <pre><code> hack---F1----M1----F2 (feature) / / C1-----C2----C3 (master) </code></pre> <p>I would like to end up with</p> <pre><code> hack---F1----M1----F2 (feature) / / C1-----C2----C3---F1'---F2' (master) </code></pre> <p>So far the best I have is</p>...
13,086
470,022
2020-05-05 16:15:53
25,894,618
30
2014-09-17 15:27:55
2,541,573
2019-07-23 11:26:10
https://stackoverflow.com/q/25886147
https://stackoverflow.com/a/25894618
<h2>Simple case</h2> <p>If the state of your repo is</p> <pre><code> hack---F1----M1----F2 [feature] / / C1-----C2----C3 [master] </code></pre> <p>and you want to arrive at</p> <pre><code> hack---F1----M1----F2 [feature] / / C1-----C2----C3----F1'----F2' [HEAD=master] </code></pre> <p>you...
<h2>Simple case</h2> <p>If the state of your repo is</p> <pre><code> hack---F1----M1----F2 [feature] / / C1-----C2----C3 [master] </code></pre> <p>and you want to arrive at</p> <pre><code> hack---F1----M1----F2 [feature] / / C1-----C2----C3----F1'----F2' [HEAD=master] </code></pre> <p>you...
119, 8974
git, rebase
<h1>Git rebase, skip merge-commits</h1> <p>Starting with</p> <pre><code> hack---F1----M1----F2 (feature) / / C1-----C2----C3 (master) </code></pre> <p>I would like to end up with</p> <pre><code> hack---F1----M1----F2 (feature) / / C1-----C2----C3---F1'---F2' (master) </code>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,945
git
# Git rebase, skip merge-commits Starting with ``` hack---F1----M1----F2 (feature) / / C1-----C2----C3 (master) ``` I would like to end up with ``` hack---F1----M1----F2 (feature) / / C1-----C2----C3---F1'---F2' (master) ``` So far the best I have is ``` git checkout fe...
## Simple case If the state of your repo is ``` hack---F1----M1----F2 [feature] / / C1-----C2----C3 [master] ``` and you want to arrive at ``` hack---F1----M1----F2 [feature] / / C1-----C2----C3----F1'----F2' [HEAD=master] ``` you should use `git cherry-pick`, not `git rebase -i` (no ne...
5925372
How to use git from emacs
29
2011-05-08 03:15:36
<p>The previous answers on this topic seem out of date so I am asking again in search of more timely info.</p> <p>I use emacs development sources (24.0.50.1) to build my own emacs. Yes, I drank the Kool-Aid.</p> <p>I recently started using git to clone development repositories and for my own projects. I want to use o...
17,207
743,594
2014-07-06 20:04:52
5,927,784
30
2011-05-08 13:44:33
247,020
2011-05-10 19:59:21
https://stackoverflow.com/q/5925372
https://stackoverflow.com/a/5927784
<p>Magit is a wonderful choice because it gives you a good project-level view of your repo and its history, and lets you do neat things like stage/unstage individual diff hunks in the files you've edited. Plus, it's very actively used and maintained.</p> <p>I personally use vc-git in addition to magit; it's handier th...
<p>Magit is a wonderful choice because it gives you a good project-level view of your repo and its history, and lets you do neat things like stage/unstage individual diff hunks in the files you've edited. Plus, it's very actively used and maintained.</p> <p>I personally use vc-git in addition to magit; it's handier th...
119, 371
emacs, git
<h1>How to use git from emacs</h1> <p>The previous answers on this topic seem out of date so I am asking again in search of more timely info.</p> <p>I use emacs development sources (24.0.50.1) to build my own emacs. Yes, I drank the Kool-Aid.</p> <p>I recently started using git to clone development repositories and f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,946
git
# How to use git from emacs The previous answers on this topic seem out of date so I am asking again in search of more timely info. I use emacs development sources (24.0.50.1) to build my own emacs. Yes, I drank the Kool-Aid. I recently started using git to clone development repositories and for my own projects. I w...
Magit is a wonderful choice because it gives you a good project-level view of your repo and its history, and lets you do neat things like stage/unstage individual diff hunks in the files you've edited. Plus, it's very actively used and maintained. I personally use vc-git in addition to magit; it's handier than magit f...
65870508
Does Git use SHA-256 to calculate commit hashes?
28
2021-01-24 12:26:26
<p>Does the current version of git (2.30.0) already use SHA256 to calculate commit hashes by default?</p> <p>If not, how can SHA-256 be enabled for a new git repository and how can be checked whether a certain git repository uses SHA-256 or SHA-1 for its commit hashes?</p>
13,313
1,282,931
2024-12-13 03:23:28
65,874,596
30
2021-01-24 18:48:48
8,705,432
2024-12-13 03:23:28
https://stackoverflow.com/q/65870508
https://stackoverflow.com/a/65874596
<p>Whether to use SHA-1 or SHA-256 is a per-repository setting in recent versions of Git. The plan is eventually to make it possible to store data in a repository in SHA-256 and access the objects with either the SHA-1 name or the SHA-256 name. As of 2024, SHA-1 remains the default.</p> <p>SHA-256 mode used to be con...
<p>Whether to use SHA-1 or SHA-256 is a per-repository setting in recent versions of Git. The plan is eventually to make it possible to store data in a repository in SHA-256 and access the objects with either the SHA-1 name or the SHA-256 name. As of 2024, SHA-1 remains the default.</p> <p>SHA-256 mode used to be con...
119, 13892
git, sha256
<h1>Does Git use SHA-256 to calculate commit hashes?</h1> <p>Does the current version of git (2.30.0) already use SHA256 to calculate commit hashes by default?</p> <p>If not, how can SHA-256 be enabled for a new git repository and how can be checked whether a certain git repository uses SHA-256 or SHA-1 for its commit ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,947
git
# Does Git use SHA-256 to calculate commit hashes? Does the current version of git (2.30.0) already use SHA256 to calculate commit hashes by default? If not, how can SHA-256 be enabled for a new git repository and how can be checked whether a certain git repository uses SHA-256 or SHA-1 for its commit hashes?
Whether to use SHA-1 or SHA-256 is a per-repository setting in recent versions of Git. The plan is eventually to make it possible to store data in a repository in SHA-256 and access the objects with either the SHA-1 name or the SHA-256 name. As of 2024, SHA-1 remains the default. SHA-256 mode used to be considered exp...
12220588
Git - Add all new files in the repo
28
2012-08-31 18:14:02
<p>I'm trying to automate an update process. The process is basically:</p> <ol> <li>Check out repo A</li> <li>Check out repo B</li> <li>Run a process in repo B that updates/creates a bunch of files</li> <li>Copy files into repo A</li> <li>Compile repo A and make sure it doesn't fail</li> <li>Commit changes into repo A...
72,791
308,079
2019-10-28 20:58:12
12,220,686
30
2012-08-31 18:21:31
901,553
2012-08-31 18:21:31
https://stackoverflow.com/q/12220588
https://stackoverflow.com/a/12220686
<p>Take a look <a href="http://www.kernel.org/pub/software/scm/git/docs/git-add.html" rel="noreferrer">here</a>. Perhaps you're interested in <code>git add -u</code> or <code>git add -A</code>.</p>
<p>Take a look <a href="http://www.kernel.org/pub/software/scm/git/docs/git-add.html" rel="noreferrer">here</a>. Perhaps you're interested in <code>git add -u</code> or <code>git add -A</code>.</p>
119
git
<h1>Git - Add all new files in the repo</h1> <p>I'm trying to automate an update process. The process is basically:</p> <ol> <li>Check out repo A</li> <li>Check out repo B</li> <li>Run a process in repo B that updates/creates a bunch of files</li> <li>Copy files into repo A</li> <li>Compile repo A and make sure it doe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,949
git
# Git - Add all new files in the repo I'm trying to automate an update process. The process is basically: 1. Check out repo A 2. Check out repo B 3. Run a process in repo B that updates/creates a bunch of files 4. Copy files into repo A 5. Compile repo A and make sure it doesn't fail 6. Commit changes into repo A and...
Take a look [here](http://www.kernel.org/pub/software/scm/git/docs/git-add.html). Perhaps you're interested in `git add -u` or `git add -A`.
7803689
gitignore: Ignore all files in folder hierarchy except one specific filetype
28
2011-10-18 07:16:09
<p>I'd like to ignore all files below and in a folder except a specific filetype that could be somewhere in the folders hierarchy:</p> <p>Example </p> <pre><code>/Test /Test/unknown/folder/structure/below </code></pre> <p>Now I'd like to ignore all files in and below the <code>Test</code> folder except a certain css...
21,385
1,000,544
2022-07-04 18:46:54
7,804,131
30
2011-10-18 08:01:33
937,870
2011-10-18 08:07:05
https://stackoverflow.com/q/7803689
https://stackoverflow.com/a/7804131
<p>I was able to get your example to work by putting a <code>.gitignore</code> file in the <code>Test/</code> directory with the following contents.</p> <pre><code>* !*/ !.gitignore !layout.css </code></pre>
<p>I was able to get your example to work by putting a <code>.gitignore</code> file in the <code>Test/</code> directory with the following contents.</p> <pre><code>* !*/ !.gitignore !layout.css </code></pre>
119, 25056
git, gitignore
<h1>gitignore: Ignore all files in folder hierarchy except one specific filetype</h1> <p>I'd like to ignore all files below and in a folder except a specific filetype that could be somewhere in the folders hierarchy:</p> <p>Example </p> <pre><code>/Test /Test/unknown/folder/structure/below </code></pre> <p>Now I'd l...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,950
git
# gitignore: Ignore all files in folder hierarchy except one specific filetype I'd like to ignore all files below and in a folder except a specific filetype that could be somewhere in the folders hierarchy: Example ``` /Test /Test/unknown/folder/structure/below ``` Now I'd like to ignore all files in and below the ...
I was able to get your example to work by putting a `.gitignore` file in the `Test/` directory with the following contents. ``` * !*/ !.gitignore !layout.css ```
33722301
How to setup kdiff3 in Mac OS?
27
2015-11-15 16:59:40
<p>In<code>.gitconfig</code> file I setup up the git diff as follows:</p> <pre><code>[diff] tool = kdiff3 [difftool "kdiff3"] path = path_directory/kdiff3.app </code></pre> <p>In this setting kdiff is not accessible and I get the following <strong>error</strong> when I run in terminal </p> <pre><code>&gt;&g...
40,371
1,933,675
2022-11-10 12:33:59
33,722,631
30
2015-11-15 17:27:34
1,190,388
2015-11-15 17:54:56
https://stackoverflow.com/q/33722301
https://stackoverflow.com/a/33722631
<p><code>kdiff3</code> is generally located at the following location:</p> <pre><code>/Applications/kdiff3.app/Contents/MacOS/kdiff3 </code></pre> <p>so, try</p> <pre><code>[difftool "kdiff3"] path = /Applications/kdiff3.app/Contents/MacOS/kdiff3 </code></pre> <p>If you installed <code>kdiff</code> using <code>...
<p><code>kdiff3</code> is generally located at the following location:</p> <pre><code>/Applications/kdiff3.app/Contents/MacOS/kdiff3 </code></pre> <p>so, try</p> <pre><code>[difftool "kdiff3"] path = /Applications/kdiff3.app/Contents/MacOS/kdiff3 </code></pre> <p>If you installed <code>kdiff</code> using <code>...
119, 3504, 9033, 39542, 105625
git, git-diff, git-difftool, kdiff3, osx-leopard
<h1>How to setup kdiff3 in Mac OS?</h1> <p>In<code>.gitconfig</code> file I setup up the git diff as follows:</p> <pre><code>[diff] tool = kdiff3 [difftool "kdiff3"] path = path_directory/kdiff3.app </code></pre> <p>In this setting kdiff is not accessible and I get the following <strong>error</strong> when I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,951
git
# How to setup kdiff3 in Mac OS? In`.gitconfig` file I setup up the git diff as follows: ``` [diff] tool = kdiff3 [difftool "kdiff3"] path = path_directory/kdiff3.app ``` In this setting kdiff is not accessible and I get the following **error** when I run in terminal ``` >> git difftool The diff tool kdiff...
`kdiff3` is generally located at the following location: ``` /Applications/kdiff3.app/Contents/MacOS/kdiff3 ``` so, try ``` [difftool "kdiff3"] path = /Applications/kdiff3.app/Contents/MacOS/kdiff3 ``` If you installed `kdiff` using `brew`, then you'd not need the `difftool` parameter in config for git 1.8 onwa...
21868857
Removing .xcuserstate and DS_Store files from git
27
2014-02-19 01:01:51
<p>In Xcode I noticed that .DS_Store and *.xcuserstate always change and don't need to be commited. So, I wrote a .gitignore file that contains this:</p> <pre><code>.DS_Store *.xcuserstate </code></pre> <p>among other entries. Then I used:</p> <pre><code>git rm --cached *xcuserstate git rm ---cached .DS_Store </code...
16,062
2,238,023
2014-02-19 10:55:05
21,878,392
30
2014-02-19 10:55:05
683,080
2014-02-19 10:55:05
https://stackoverflow.com/q/21868857
https://stackoverflow.com/a/21878392
<p>You need to commit your change after removing them from the staging area.</p> <p>As you did already, run:</p> <pre><code>$ git rm --cached path/to/.DS_Store $ git rm --cached *.xcuserstate </code></pre> <p>Note, you may have some in other directories, so you may need several invocations to get them all. At this ...
<p>You need to commit your change after removing them from the staging area.</p> <p>As you did already, run:</p> <pre><code>$ git rm --cached path/to/.DS_Store $ git rm --cached *.xcuserstate </code></pre> <p>Note, you may have some in other directories, so you may need several invocations to get them all. At this ...
119, 908, 25056, 28636, 58338
git, gitignore, ios, tree-conflict, xcode
<h1>Removing .xcuserstate and DS_Store files from git</h1> <p>In Xcode I noticed that .DS_Store and *.xcuserstate always change and don't need to be commited. So, I wrote a .gitignore file that contains this:</p> <pre><code>.DS_Store *.xcuserstate </code></pre> <p>among other entries. Then I used:</p> <pre><code>git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,953
git
# Removing .xcuserstate and DS_Store files from git In Xcode I noticed that .DS_Store and *.xcuserstate always change and don't need to be commited. So, I wrote a .gitignore file that contains this: ``` .DS_Store *.xcuserstate ``` among other entries. Then I used: ``` git rm --cached *xcuserstate git rm ---cached ....
You need to commit your change after removing them from the staging area. As you did already, run: ``` $ git rm --cached path/to/.DS_Store $ git rm --cached *.xcuserstate ``` Note, you may have some in other directories, so you may need several invocations to get them all. At this point, your removals are staged in ...
13398648
Git: inverse ignoring (.gitignore)
27
2012-11-15 13:39:45
<p>I created a repository for my home folder. This is my <code>.gitignore</code> file:</p> <pre><code>!.vim/plugin/* !.vim/doc/* .* * .viminfo .vim/.netrwhist .vim-fuf-data/file/stats bin/dwm/dwm </code></pre> <p>So when I create a new file inside <code>.vim/plugin</code> I expected that after <code>git status</code>...
23,847
248,959
2014-03-14 14:12:21
13,398,868
30
2012-11-15 13:51:52
585,869
2012-11-16 09:17:19
https://stackoverflow.com/q/13398648
https://stackoverflow.com/a/13398868
<p>In line 4 you're ignoring everything with <code>*</code>. This overrides the previous negating pattern. From the <a href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html" rel="noreferrer">man page</a>:</p> <blockquote> <p>within one level of precedence, the last matching pattern decides the outco...
<p>In line 4 you're ignoring everything with <code>*</code>. This overrides the previous negating pattern. From the <a href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html" rel="noreferrer">man page</a>:</p> <blockquote> <p>within one level of precedence, the last matching pattern decides the outco...
119
git
<h1>Git: inverse ignoring (.gitignore)</h1> <p>I created a repository for my home folder. This is my <code>.gitignore</code> file:</p> <pre><code>!.vim/plugin/* !.vim/doc/* .* * .viminfo .vim/.netrwhist .vim-fuf-data/file/stats bin/dwm/dwm </code></pre> <p>So when I create a new file inside <code>.vim/plugin</code> I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,954
git
# Git: inverse ignoring (.gitignore) I created a repository for my home folder. This is my `.gitignore` file: ``` !.vim/plugin/* !.vim/doc/* .* * .viminfo .vim/.netrwhist .vim-fuf-data/file/stats bin/dwm/dwm ``` So when I create a new file inside `.vim/plugin` I expected that after `git status` this file was shown, ...
In line 4 you're ignoring everything with `*`. This overrides the previous negating pattern. From the [man page](http://www.kernel.org/pub/software/scm/git/docs/gitignore.html): > within one level of precedence, the last matching pattern decides the > outcome Where "level of precedence" means different sources for ig...
35885822
Revert commit on remote branch without force pushing
26
2016-03-09 07:48:48
<p>How can I revert some remote repository to an old commit without force pushing and losing history? I know I could do</p> <pre><code>git reset --hard &lt;commit-hash&gt; git push -f origin master </code></pre> <p>but I don't have permissions to force push and I also don't want to lose the history. </p> <p>I want t...
18,643
2,039,482
2018-01-09 19:34:12
35,885,864
30
2016-03-09 07:51:08
3,580,811
2016-03-09 07:51:08
https://stackoverflow.com/q/35885822
https://stackoverflow.com/a/35885864
<p>You can use <code>git revert &lt;commit&gt;…</code> for all the n commits, and then push as usual, keeping history unchanged.</p> <p><a href="https://git-scm.com/docs/git-revert" rel="noreferrer">https://git-scm.com/docs/git-revert</a></p>
<p>You can use <code>git revert &lt;commit&gt;…</code> for all the n commits, and then push as usual, keeping history unchanged.</p> <p><a href="https://git-scm.com/docs/git-revert" rel="noreferrer">https://git-scm.com/docs/git-revert</a></p>
119, 456, 1066, 48063
continuous-deployment, continuous-integration, git, version-control
<h1>Revert commit on remote branch without force pushing</h1> <p>How can I revert some remote repository to an old commit without force pushing and losing history? I know I could do</p> <pre><code>git reset --hard &lt;commit-hash&gt; git push -f origin master </code></pre> <p>but I don't have permissions to force pus...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,955
git
# Revert commit on remote branch without force pushing How can I revert some remote repository to an old commit without force pushing and losing history? I know I could do ``` git reset --hard <commit-hash> git push -f origin master ``` but I don't have permissions to force push and I also don't want to lose the his...
You can use `git revert <commit>…` for all the n commits, and then push as usual, keeping history unchanged. <https://git-scm.com/docs/git-revert>
3626642
git: rewrite history: reorder and merge commits
25
2010-09-02 11:27:56
<p>Current situation:</p> <pre><code>origin/mybranch --- A1 --- B1 --- A2 --- B2 --- A3 --- B3 mybranch </code></pre> <p>I want to clean that history up (A1 to B3), esp. since I have not pushed it anywhere yet and because I want to prepare a patch which just those B*.</p> <p>What I want is:</p> <pre><code>origin/...
6,741
133,374
2017-12-15 08:47:42
3,626,894
30
2010-09-02 12:05:54
619
2013-08-03 10:33:33
https://stackoverflow.com/q/3626642
https://stackoverflow.com/a/3626894
<p>You want to do an <a href="http://git-scm.com/docs/git-rebase#_interactive_mode" rel="noreferrer">interactive rebase</a>.</p> <p>The first thing I like to do when trying out git commands is to make a backup copy of my branch:</p> <pre><code>$ git branch my-backup-branch </code></pre> <p>Let's say that your A1 com...
<p>You want to do an <a href="http://git-scm.com/docs/git-rebase#_interactive_mode" rel="noreferrer">interactive rebase</a>.</p> <p>The first thing I like to do when trying out git commands is to make a backup copy of my branch:</p> <pre><code>$ git branch my-backup-branch </code></pre> <p>Let's say that your A1 com...
119, 8974
git, rebase
<h1>git: rewrite history: reorder and merge commits</h1> <p>Current situation:</p> <pre><code>origin/mybranch --- A1 --- B1 --- A2 --- B2 --- A3 --- B3 mybranch </code></pre> <p>I want to clean that history up (A1 to B3), esp. since I have not pushed it anywhere yet and because I want to prepare a patch which just ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,956
git
# git: rewrite history: reorder and merge commits Current situation: ``` origin/mybranch --- A1 --- B1 --- A2 --- B2 --- A3 --- B3 mybranch ``` I want to clean that history up (A1 to B3), esp. since I have not pushed it anywhere yet and because I want to prepare a patch which just those B*. What I want is: ``` o...
You want to do an [interactive rebase](http://git-scm.com/docs/git-rebase#_interactive_mode). The first thing I like to do when trying out git commands is to make a backup copy of my branch: ``` $ git branch my-backup-branch ``` Let's say that your A1 commit has a hash of `152274b`. Try this: ``` $ git rebase -i 15...
30443906
git log --follow, show all commits including merges
24
2015-05-25 18:14:54
<p>I would like to <code>git log --follow file.ext</code> but showing all commits, including merges.</p> <p>Tried <code>no-max-parents</code>, but not helping.</p>
17,472
931,156
2015-05-25 19:12:28
30,444,549
30
2015-05-25 19:04:22
1,755,598
2015-05-25 19:12:28
https://stackoverflow.com/q/30443906
https://stackoverflow.com/a/30444549
<blockquote> <p>The <code>-m</code> will do the trick for you, <code>log -m</code> is for get into the merges.</p> </blockquote> <p><code>git log -m --oneline --full-history --follow file.ext</code></p> <p>This should follow the file in the Merges [<code>-m</code>].</p> <p>And i assume you was aiming to use <code...
<blockquote> <p>The <code>-m</code> will do the trick for you, <code>log -m</code> is for get into the merges.</p> </blockquote> <p><code>git log -m --oneline --full-history --follow file.ext</code></p> <p>This should follow the file in the Merges [<code>-m</code>].</p> <p>And i assume you was aiming to use <code...
119, 47913
git, git-log
<h1>git log --follow, show all commits including merges</h1> <p>I would like to <code>git log --follow file.ext</code> but showing all commits, including merges.</p> <p>Tried <code>no-max-parents</code>, but not helping.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,957
git
# git log --follow, show all commits including merges I would like to `git log --follow file.ext` but showing all commits, including merges. Tried `no-max-parents`, but not helping.
> The `-m` will do the trick for you, `log -m` is for get into the merges. `git log -m --oneline --full-history --follow file.ext` This should follow the file in the Merges [`-m`]. And i assume you was aiming to use `--min-parents=2` instead of `no-max-parents`. The `--min-parents=2` is the same as `--merged` since ...
10420575
See exact divergence/commits between local and remote Git repo
24
2012-05-02 19:44:08
<p><strong>Setup:</strong> 3 git repos - on github, local and on staging server.</p> <p>I develop locally, push it to github and staging server pulls.</p> <p>I don't work nor commit changes on staging server, but I must have done so long time ago. Because now I get the following message when I do <code>git status</co...
23,545
52,317
2024-02-26 17:47:21
10,421,678
30
2012-05-02 21:01:59
11,343
2012-05-02 21:01:59
https://stackoverflow.com/q/10420575
https://stackoverflow.com/a/10421678
<pre><code>git rev-list origin..HEAD </code></pre> <p>This lists the commits in your branch (HEAD) that are not in origin.</p>
<pre><code>git rev-list origin..HEAD </code></pre> <p>This lists the commits in your branch (HEAD) that are not in origin.</p>
119, 606, 2936, 3146, 6951
compare, conflict, diff, git, status
<h1>See exact divergence/commits between local and remote Git repo</h1> <p><strong>Setup:</strong> 3 git repos - on github, local and on staging server.</p> <p>I develop locally, push it to github and staging server pulls.</p> <p>I don't work nor commit changes on staging server, but I must have done so long time ago...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,958
git
# See exact divergence/commits between local and remote Git repo **Setup:** 3 git repos - on github, local and on staging server. I develop locally, push it to github and staging server pulls. I don't work nor commit changes on staging server, but I must have done so long time ago. Because now I get the following me...
``` git rev-list origin..HEAD ``` This lists the commits in your branch (HEAD) that are not in origin.
43214887
Git - View Remote branches by creation date
23
2017-04-04 18:26:05
<p>Is it possible to see the list of remote branches by creation date instead of alphabetical order?</p> <p>Right now i use </p> <pre><code>git branch -r </code></pre> <p>Which outputs the below list of remote branches:</p> <pre><code> origin/HEAD -&gt; origin/develop origin/calendar-view-impl origin/containers-r...
15,527
4,912,604
2023-02-07 15:32:34
43,220,629
30
2017-04-05 02:07:48
2,584,700
2017-04-05 02:07:48
https://stackoverflow.com/q/43214887
https://stackoverflow.com/a/43220629
<p>There is a field in git called authordate which can help to achieve similar result, please try following:</p> <pre><code>git for-each-ref --sort='-authordate' </code></pre> <p>Hoping this helps.</p> <p>Cheers !</p>
<p>There is a field in git called authordate which can help to achieve similar result, please try following:</p> <pre><code>git for-each-ref --sort='-authordate' </code></pre> <p>Hoping this helps.</p> <p>Cheers !</p>
119
git
<h1>Git - View Remote branches by creation date</h1> <p>Is it possible to see the list of remote branches by creation date instead of alphabetical order?</p> <p>Right now i use </p> <pre><code>git branch -r </code></pre> <p>Which outputs the below list of remote branches:</p> <pre><code> origin/HEAD -&gt; origin/de...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,959
git
# Git - View Remote branches by creation date Is it possible to see the list of remote branches by creation date instead of alphabetical order? Right now i use ``` git branch -r ``` Which outputs the below list of remote branches: ``` origin/HEAD -> origin/develop origin/calendar-view-impl origin/containers-red...
There is a field in git called authordate which can help to achieve similar result, please try following: ``` git for-each-ref --sort='-authordate' ``` Hoping this helps. Cheers !