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
29545972
Skip githooks on git push
16
2015-04-09 18:15:33
<p><strong>Intro:</strong> I recently installed some software which fires on the git <code>pre-push</code> hook. Unfortunately there is a mistake in the software, and it crashes on very large commits.</p> <h1>Is it possible to run an <code>git push</code> without triggering the githooks?</h1> <p>That way I don't have t...
11,828
741,850
2015-04-09 18:15:33
29,545,973
38
2015-04-09 18:15:33
741,850
2015-04-09 18:15:33
https://stackoverflow.com/q/29545972
https://stackoverflow.com/a/29545973
<p>After reading through some of the <a href="http://git-scm.com/docs/githooks" rel="noreferrer">githook documentation</a> I found that the <code>pre-commit</code> hook could be omitted with the flag <code>--no-verify</code>.</p> <p>Although it was not mentioned, <code>--no-verify</code> also works on <code>git push</...
<p>After reading through some of the <a href="http://git-scm.com/docs/githooks" rel="noreferrer">githook documentation</a> I found that the <code>pre-commit</code> hook could be omitted with the flag <code>--no-verify</code>.</p> <p>Although it was not mentioned, <code>--no-verify</code> also works on <code>git push</...
119, 4236, 43087
git, githooks, push
<h1>Skip githooks on git push</h1> <p><strong>Intro:</strong> I recently installed some software which fires on the git <code>pre-push</code> hook. Unfortunately there is a mistake in the software, and it crashes on very large commits.</p> <h1>Is it possible to run an <code>git push</code> without triggering the githoo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,240
git
# Skip githooks on git push **Intro:** I recently installed some software which fires on the git `pre-push` hook. Unfortunately there is a mistake in the software, and it crashes on very large commits. # Is it possible to run an `git push` without triggering the githooks? That way I don't have to uninstall the githo...
After reading through some of the [githook documentation](http://git-scm.com/docs/githooks) I found that the `pre-commit` hook could be omitted with the flag `--no-verify`. Although it was not mentioned, `--no-verify` also works on `git push` :)
18277841
find out when a git branch was created (not the first commit to that branch)
16
2013-08-16 16:17:39
<p>how can I know when a git branch was created?</p> <p>i don't want to know when was the first commit to that branch. I want to find out when that branch was created.</p> <p>This is a script to reproduce a working example:</p> <pre><code>#! /bin/bash set -x set -e mkdir test cd test git init echo "hello" &gt;readm...
54,450
280,393
2022-07-11 18:49:08
18,278,195
38
2013-08-16 16:37:42
683,080
2013-08-16 16:37:42
https://stackoverflow.com/q/18277841
https://stackoverflow.com/a/18278195
<p>Sorry, but Git doesn't keep officially tracked information of when branches are created (it's not data that stored and shared among repositories). Branches are simply references to commits and nothing more. This also means that there is no id or object that will point you at this data.</p> <p>The reflog does keep...
<p>Sorry, but Git doesn't keep officially tracked information of when branches are created (it's not data that stored and shared among repositories). Branches are simply references to commits and nothing more. This also means that there is no id or object that will point you at this data.</p> <p>The reflog does keep...
119, 76220
git, git-branch
<h1>find out when a git branch was created (not the first commit to that branch)</h1> <p>how can I know when a git branch was created?</p> <p>i don't want to know when was the first commit to that branch. I want to find out when that branch was created.</p> <p>This is a script to reproduce a working example:</p> <pr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,241
git
# find out when a git branch was created (not the first commit to that branch) how can I know when a git branch was created? i don't want to know when was the first commit to that branch. I want to find out when that branch was created. This is a script to reproduce a working example: ``` #! /bin/bash set -x set -e...
Sorry, but Git doesn't keep officially tracked information of when branches are created (it's not data that stored and shared among repositories). Branches are simply references to commits and nothing more. This also means that there is no id or object that will point you at this data. The reflog does keep track of wh...
11499805
Git http.proxy Setting
16
2012-07-16 07:25:09
<p>I was trying to figure this git thing out and at one moment I messed with the http.proxy variable. Right now it's just nonsense, 'asdf' so pushing doesn't work. I don't know what the proxy setting was before (I don't even know what proxy server is). Any way to set http.proxy to the correct value?</p> <p>Right now t...
34,881
355,023
2012-07-16 08:52:25
11,500,903
38
2012-07-16 08:52:25
421,089
2012-07-16 08:52:25
https://stackoverflow.com/q/11499805
https://stackoverflow.com/a/11500903
<p>You added an entry to your git config file by mistake. You can manipulate the both the global and per-repository config files using <code>git config</code>.</p> <p>To find out if you added the proxy entry to the global or local config files run this from the console:</p> <pre><code>git config -l --global | grep ht...
<p>You added an entry to your git config file by mistake. You can manipulate the both the global and per-repository config files using <code>git config</code>.</p> <p>To find out if you added the proxy entry to the global or local config files run this from the console:</p> <pre><code>git config -l --global | grep ht...
119, 760
git, proxy
<h1>Git http.proxy Setting</h1> <p>I was trying to figure this git thing out and at one moment I messed with the http.proxy variable. Right now it's just nonsense, 'asdf' so pushing doesn't work. I don't know what the proxy setting was before (I don't even know what proxy server is). Any way to set http.proxy to the co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,242
git
# Git http.proxy Setting I was trying to figure this git thing out and at one moment I messed with the http.proxy variable. Right now it's just nonsense, 'asdf' so pushing doesn't work. I don't know what the proxy setting was before (I don't even know what proxy server is). Any way to set http.proxy to the correct val...
You added an entry to your git config file by mistake. You can manipulate the both the global and per-repository config files using `git config`. To find out if you added the proxy entry to the global or local config files run this from the console: ``` git config -l --global | grep http # this will print the line i...
8929071
merging git repositories at different directory levels
11
2012-01-19 15:52:44
<p>I have a repository B whose contents need to reside in the subdirectory of A ... in A/src/B. I want to end up with one repository A that includes history of commits from both A and B.</p> <p>Other solutions on the web seem to show me how to keep the trees intact in separate sub-trees or merge selected parts of repo...
7,012
711,243
2012-01-19 23:07:40
8,929,615
38
2012-01-19 16:27:51
223,092
2012-01-19 23:07:40
https://stackoverflow.com/q/8929071
https://stackoverflow.com/a/8929615
<p>This is pretty simple, in fact, but the commands aren't necessarily obvious. A nice alternative if you're going to need to incorporate more updates from B later is <a href="https://github.com/apenwarr/git-subtree" rel="noreferrer">git-subtree</a> (not to be confused with the subtree merge strategy). You say that y...
<p>This is pretty simple, in fact, but the commands aren't necessarily obvious. A nice alternative if you're going to need to incorporate more updates from B later is <a href="https://github.com/apenwarr/git-subtree" rel="noreferrer">git-subtree</a> (not to be confused with the subtree merge strategy). You say that y...
119
git
<h1>merging git repositories at different directory levels</h1> <p>I have a repository B whose contents need to reside in the subdirectory of A ... in A/src/B. I want to end up with one repository A that includes history of commits from both A and B.</p> <p>Other solutions on the web seem to show me how to keep the tr...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,244
git
# merging git repositories at different directory levels I have a repository B whose contents need to reside in the subdirectory of A ... in A/src/B. I want to end up with one repository A that includes history of commits from both A and B. Other solutions on the web seem to show me how to keep the trees intact in se...
This is pretty simple, in fact, but the commands aren't necessarily obvious. A nice alternative if you're going to need to incorporate more updates from B later is [git-subtree](https://github.com/apenwarr/git-subtree) (not to be confused with the subtree merge strategy). You say that you want to end up with one reposi...
22386030
Cannot checkout, file is unmerged
149
2014-03-13 17:14:15
<p>I am trying to remove the file from my working directory but after using the following command </p> <pre><code>git checkout file_Name.txt </code></pre> <p>I got the following error message</p> <pre><code>error: path 'first_Name.txt' is unmerged </code></pre> <p>What is that and how to resolve it?</p> <p>Followi...
195,939
2,908,528
2024-07-12 08:44:21
22,388,567
37
2014-03-13 19:09:04
1,755,108
2014-03-13 19:09:04
https://stackoverflow.com/q/22386030
https://stackoverflow.com/a/22388567
<p>To remove tracked files (first_file.txt) from git:</p> <pre><code>git rm first_file.txt </code></pre> <p>And to remove untracked files, use:</p> <pre><code>rm -r explore_california </code></pre>
<p>To remove tracked files (first_file.txt) from git:</p> <pre><code>git rm first_file.txt </code></pre> <p>And to remove untracked files, use:</p> <pre><code>rm -r explore_california </code></pre>
119, 456, 62599
git, merge-conflict-resolution, version-control
<h1>Cannot checkout, file is unmerged</h1> <p>I am trying to remove the file from my working directory but after using the following command </p> <pre><code>git checkout file_Name.txt </code></pre> <p>I got the following error message</p> <pre><code>error: path 'first_Name.txt' is unmerged </code></pre> <p>What is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,248
git
# Cannot checkout, file is unmerged I am trying to remove the file from my working directory but after using the following command ``` git checkout file_Name.txt ``` I got the following error message ``` error: path 'first_Name.txt' is unmerged ``` What is that and how to resolve it? Following is my git status `...
To remove tracked files (first_file.txt) from git: ``` git rm first_file.txt ``` And to remove untracked files, use: ``` rm -r explore_california ```
23386318
How can I rebase multiple branches at once?
79
2014-04-30 11:00:17
<p>I currently work on a project in which SVN is used as a repository. Locally, I do several "experiments" with the code that I don't want to commit to the repo. Therefore I use git locally on top of the SVN working directory and use multiple branches for different "experiments". So it looks e.g. like this.</p> <pre><...
26,984
1,254,465
2024-05-06 13:00:53
23,399,436
37
2014-04-30 22:52:33
1,286,639
2014-04-30 22:52:33
https://stackoverflow.com/q/23386318
https://stackoverflow.com/a/23399436
<p>You can't get this in one step. At best you move each branch one by one; this would be the sequence:</p> <pre><code>git rebase --onto master exp1 git rebase --onto c2' c2 exp2 git rebase --onto c1' c1 exp3 git rebase --onto master exp4 </code></pre> <p>The key is to rebase from each branch point in the old tree (...
<p>You can't get this in one step. At best you move each branch one by one; this would be the sequence:</p> <pre><code>git rebase --onto master exp1 git rebase --onto c2' c2 exp2 git rebase --onto c1' c1 exp3 git rebase --onto master exp4 </code></pre> <p>The key is to rebase from each branch point in the old tree (...
119, 90056
atlassian-sourcetree, git
<h1>How can I rebase multiple branches at once?</h1> <p>I currently work on a project in which SVN is used as a repository. Locally, I do several "experiments" with the code that I don't want to commit to the repo. Therefore I use git locally on top of the SVN working directory and use multiple branches for different "...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,252
git
# How can I rebase multiple branches at once? I currently work on a project in which SVN is used as a repository. Locally, I do several "experiments" with the code that I don't want to commit to the repo. Therefore I use git locally on top of the SVN working directory and use multiple branches for different "experimen...
You can't get this in one step. At best you move each branch one by one; this would be the sequence: ``` git rebase --onto master exp1 git rebase --onto c2' c2 exp2 git rebase --onto c1' c1 exp3 git rebase --onto master exp4 ``` The key is to rebase from each branch point in the old tree (e.g. c2 in the above) on to ...
26682744
Is there a way to just commit one file type extension from a folder?
64
2014-10-31 20:16:29
<p>I have a folder with a lot of stuff and I would like just to commit ".c" extension files. Is there a command to do this or do I need to add each file name manually? </p>
54,023
1,573,036
2024-02-17 16:28:59
26,682,823
37
2014-10-31 20:22:38
654,953
2023-10-13 16:25:44
https://stackoverflow.com/q/26682744
https://stackoverflow.com/a/26682823
<p>If you want to add all files with a specific file extension, all you have to do is specify it at the time you go to stage the files using a wildcard.</p> <p><code>git add \*.c</code></p> <p>Here <code>.c</code> can be any extension you want.</p>
<p>If you want to add all files with a specific file extension, all you have to do is specify it at the time you go to stage the files using a wildcard.</p> <p><code>git add \*.c</code></p> <p>Here <code>.c</code> can be any extension you want.</p>
119, 456, 1280, 5597
commit, file-extension, git, version-control
<h1>Is there a way to just commit one file type extension from a folder?</h1> <p>I have a folder with a lot of stuff and I would like just to commit ".c" extension files. Is there a command to do this or do I need to add each file name manually? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,254
git
# Is there a way to just commit one file type extension from a folder? I have a folder with a lot of stuff and I would like just to commit ".c" extension files. Is there a command to do this or do I need to add each file name manually?
If you want to add all files with a specific file extension, all you have to do is specify it at the time you go to stage the files using a wildcard. `git add \*.c` Here `.c` can be any extension you want.
2332349
Best practices for cross platform git config?
57
2010-02-25 07:26:02
<h2>Context</h2> <p>A number of my application user configuration files are kept in a git repository for easy sharing across multiple machines and multiple platforms. Amongst these configuration files is <code>.gitconfig</code> which contains the following settings for handling the carriage return linefeed characters<...
38,938
74,198
2016-11-26 19:06:31
2,361,309
37
2010-03-02 06:32:38
6,309
2012-01-22 19:25:37
https://stackoverflow.com/q/2332349
https://stackoverflow.com/a/2361309
<p>I have reviewed that kind of config setting (<code>crlf</code>) extensively in the question:<br> <strong><a href="https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278">distributing git configuration with the code</a></strong>.</p> <p>The conclusion was:</p> <ul> ...
<p>I have reviewed that kind of config setting (<code>crlf</code>) extensively in the question:<br> <strong><a href="https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278">distributing git configuration with the code</a></strong>.</p> <p>The conclusion was:</p> <ul> ...
119, 32868
git, git-config
<h1>Best practices for cross platform git config?</h1> <h2>Context</h2> <p>A number of my application user configuration files are kept in a git repository for easy sharing across multiple machines and multiple platforms. Amongst these configuration files is <code>.gitconfig</code> which contains the following setting...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,256
git
# Best practices for cross platform git config? ## Context A number of my application user configuration files are kept in a git repository for easy sharing across multiple machines and multiple platforms. Amongst these configuration files is `.gitconfig` which contains the following settings for handling the carriag...
I have reviewed that kind of config setting (`crlf`) extensively in the question: **[distributing git configuration with the code](https://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278)**. The conclusion was: - **[checkout/checking .gitattributes](https://stackover...
6100966
Nested git repositories without remotes (a.k.a. git submodule without remotes)
56
2011-05-23 17:55:46
<p>I have a project of which I am interested in breaking out portions as open-source. I've set up nested git repositories main, one, two and three:</p> <pre><code>main/ ├── one ├── three └── two </code></pre> <p>I thought that by going into &quot;main&quot; and doing</p> <pre><code>git add one git add two git add three...
40,885
185,651
2023-11-03 17:52:28
6,106,503
37
2011-05-24 06:23:18
193,688
2022-11-10 16:55:09
https://stackoverflow.com/q/6100966
https://stackoverflow.com/a/6106503
<p>You can do what you want, but your <code>one</code>, <code>two</code>, and <code>three</code> would need to be accessible to whoever will need to clone them—this is not usually the case for “random” development repositories.</p> <p>If you do set this up, you will need to be very careful not to delete “your” reposito...
<p>You can do what you want, but your <code>one</code>, <code>two</code>, and <code>three</code> would need to be accessible to whoever will need to clone them—this is not usually the case for “random” development repositories.</p> <p>If you do set this up, you will need to be very careful not to delete “your” reposito...
119, 41612
git, git-submodules
<h1>Nested git repositories without remotes (a.k.a. git submodule without remotes)</h1> <p>I have a project of which I am interested in breaking out portions as open-source. I've set up nested git repositories main, one, two and three:</p> <pre><code>main/ ├── one ├── three └── two </code></pre> <p>I thought that by go...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,257
git
# Nested git repositories without remotes (a.k.a. git submodule without remotes) I have a project of which I am interested in breaking out portions as open-source. I've set up nested git repositories main, one, two and three: ``` main/ ├── one ├── three └── two ``` I thought that by going into "main" and doing ``` ...
You can do what you want, but your `one`, `two`, and `three` would need to be accessible to whoever will need to clone them—this is not usually the case for “random” development repositories. If you do set this up, you will need to be very careful not to delete “your” repository (or make it otherwise inaccessible) sin...
16363460
Set up a default directory structure on git init
47
2013-05-03 16:21:44
<p>I would like to optimise my git workflow by automating creation of .gitignore, README, LICENSE and other files on <code>git init</code> command.</p> <p>To do that I RTFM of <code>git init</code> at <a href="http://git-scm.com/docs/git-init" rel="noreferrer">http://git-scm.com/docs/git-init</a> and it tells me to do...
33,753
632,133
2023-06-26 01:25:48
16,363,618
37
2013-05-03 16:31:24
380,757
2013-05-03 16:31:24
https://stackoverflow.com/q/16363460
https://stackoverflow.com/a/16363618
<p>The behavior you're seeing is the expected <code>git</code> behavior:</p> <p>If you read the manual correctly about the template directory:</p> <blockquote> <p><strong>TEMPLATE DIRECTORY</strong></p> <p>The template directory contains files and directories that will be copied to the <strong>$GIT_DIR</stro...
<p>The behavior you're seeing is the expected <code>git</code> behavior:</p> <p>If you read the manual correctly about the template directory:</p> <blockquote> <p><strong>TEMPLATE DIRECTORY</strong></p> <p>The template directory contains files and directories that will be copied to the <strong>$GIT_DIR</stro...
119, 1478
git, templates
<h1>Set up a default directory structure on git init</h1> <p>I would like to optimise my git workflow by automating creation of .gitignore, README, LICENSE and other files on <code>git init</code> command.</p> <p>To do that I RTFM of <code>git init</code> at <a href="http://git-scm.com/docs/git-init" rel="noreferrer">...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,259
git
# Set up a default directory structure on git init I would like to optimise my git workflow by automating creation of .gitignore, README, LICENSE and other files on `git init` command. To do that I RTFM of `git init` at <http://git-scm.com/docs/git-init> and it tells me to do one of the following: 1. Use `git init -...
The behavior you're seeing is the expected `git` behavior: If you read the manual correctly about the template directory: > **TEMPLATE DIRECTORY** > > The template directory contains files and > directories that will be copied to the **$GIT_DIR** after it is created. The files which are copied from the template dire...
10524578
How to move a file from one git repository to another while preserving history
47
2012-05-09 21:49:16
<p>I am trying to move a single file (call it foo.txt) from one repository to another (unrelated) repository, preserving its history. <a href="https://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-another-not-a-clone-preserving-history">ebneter's question</a> shows how to do this for a subd...
21,924
974,063
2023-02-15 17:53:32
10,524,661
37
2012-05-09 21:57:07
873,070
2023-02-15 17:53:32
https://stackoverflow.com/q/10524578
https://stackoverflow.com/a/10524661
<p>This worked for me, but with a whole directory.</p> <p>As shown <a href="https://web.archive.org/web/20130818084317/http://www.mactricks.de/de/Programmieren/VCS/git/repo_split" rel="nofollow noreferrer">here</a></p> <pre><code>~$ cd neu ~/neu$ git filter-branch --subdirectory-filter FooBar HEAD ~/neu$ git reset --ha...
<p>This worked for me, but with a whole directory.</p> <p>As shown <a href="https://web.archive.org/web/20130818084317/http://www.mactricks.de/de/Programmieren/VCS/git/repo_split" rel="nofollow noreferrer">here</a></p> <pre><code>~$ cd neu ~/neu$ git filter-branch --subdirectory-filter FooBar HEAD ~/neu$ git reset --ha...
119, 46509
git, git-filter-branch
<h1>How to move a file from one git repository to another while preserving history</h1> <p>I am trying to move a single file (call it foo.txt) from one repository to another (unrelated) repository, preserving its history. <a href="https://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-anothe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,261
git
# How to move a file from one git repository to another while preserving history I am trying to move a single file (call it foo.txt) from one repository to another (unrelated) repository, preserving its history. [ebneter's question](https://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-ano...
This worked for me, but with a whole directory. As shown [here](https://web.archive.org/web/20130818084317/http://www.mactricks.de/de/Programmieren/VCS/git/repo_split) ``` ~$ cd neu ~/neu$ git filter-branch --subdirectory-filter FooBar HEAD ~/neu$ git reset --hard ~/neu$ git remote rm origin ~/neu$ rm -r .git/refs/or...
13692072
Git blame committed line
46
2012-12-03 21:31:45
<p>Is it possible somehow for GIT to find which commit introduced a specific line of code in a specific file? This is assuming that there have been many commits since that line was added. Or is this something that must be done in a script while looking at the git blame of all the commits for the file in which the line ...
38,175
1,628,786
2022-10-14 16:17:35
13,692,169
37
2012-12-03 21:37:59
1,016,564
2018-08-16 17:42:11
https://stackoverflow.com/q/13692072
https://stackoverflow.com/a/13692169
<p>You can use <code>git blame -l filename</code> to get the SHA1 hash from when the line was changed.</p> <p>You also can use --reverse:</p> <blockquote> <p>--reverse</p> <p>Walk history forward instead of backward. Instead of showing the revision in which a line appeared, this shows the last revision in which a line ...
<p>You can use <code>git blame -l filename</code> to get the SHA1 hash from when the line was changed.</p> <p>You also can use --reverse:</p> <blockquote> <p>--reverse</p> <p>Walk history forward instead of backward. Instead of showing the revision in which a line appeared, this shows the last revision in which a line ...
119
git
<h1>Git blame committed line</h1> <p>Is it possible somehow for GIT to find which commit introduced a specific line of code in a specific file? This is assuming that there have been many commits since that line was added. Or is this something that must be done in a script while looking at the git blame of all the commi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,262
git
# Git blame committed line Is it possible somehow for GIT to find which commit introduced a specific line of code in a specific file? This is assuming that there have been many commits since that line was added. Or is this something that must be done in a script while looking at the git blame of all the commits for th...
You can use `git blame -l filename` to get the SHA1 hash from when the line was changed. You also can use --reverse: > --reverse > > Walk history forward instead of backward. Instead of showing the revision in which a line appeared, this shows the last revision in which a line has existed. This requires a range of re...
11923635
git tries to delete a directory on checkout
46
2012-08-12 16:07:18
<p>Whenever I switch between my branch (Li) to the master branch I get the following message:</p> <blockquote> <p>Deletion of directory 'sys/console/api' failed. Should I try again? (y/n)</p> </blockquote> <p>Anyone knows how do I get rid of this message? I think that in the past I tried to delete this directory by...
33,415
429,400
2025-11-04 19:40:27
11,924,201
37
2012-08-12 17:21:01
6,309
2014-01-05 16:53:28
https://stackoverflow.com/q/11923635
https://stackoverflow.com/a/11924201
<p>This error message comes from <a href="http://www.spinics.net/lists/git/msg150510.html" rel="noreferrer">this patch</a> (in <a href="https://github.com/git/git/blob/44484662d83de2ae98d04738ec43d4dea1f859a8/compat/mingw.c#L228-L250" rel="noreferrer"><code>compat/mingw.c</code></a>), and <a href="http://www.spinics.ne...
<p>This error message comes from <a href="http://www.spinics.net/lists/git/msg150510.html" rel="noreferrer">this patch</a> (in <a href="https://github.com/git/git/blob/44484662d83de2ae98d04738ec43d4dea1f859a8/compat/mingw.c#L228-L250" rel="noreferrer"><code>compat/mingw.c</code></a>), and <a href="http://www.spinics.ne...
119, 37230
git, git-checkout
<h1>git tries to delete a directory on checkout</h1> <p>Whenever I switch between my branch (Li) to the master branch I get the following message:</p> <blockquote> <p>Deletion of directory 'sys/console/api' failed. Should I try again? (y/n)</p> </blockquote> <p>Anyone knows how do I get rid of this message? I think...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,263
git
# git tries to delete a directory on checkout Whenever I switch between my branch (Li) to the master branch I get the following message: > Deletion of directory 'sys/console/api' failed. Should I try again? (y/n) Anyone knows how do I get rid of this message? I think that in the past I tried to delete this directory...
This error message comes from [this patch](http://www.spinics.net/lists/git/msg150510.html) (in [`compat/mingw.c`](https://github.com/git/git/blob/44484662d83de2ae98d04738ec43d4dea1f859a8/compat/mingw.c#L228-L250)), and [this one](http://www.spinics.net/lists/git/msg147934.html) (also in [compat/mingw.c](https://github...
12850030
git - getting ALL previous version of a specific file/folder
41
2012-10-11 23:17:20
<p>I want to retrieve <strong>all</strong> previous version of a specific file in a git repository.</p> <p>I see it is possible to get one specific version with the checkout command, but I want them all. And the git clone command with the depth option doesn't seem to allow me to clone subfolder ("not valid repository ...
18,591
1,739,644
2024-04-07 11:32:50
43,747,334
37
2017-05-02 21:13:33
1,132,502
2022-03-09 14:52:52
https://stackoverflow.com/q/12850030
https://stackoverflow.com/a/43747334
<p>The script provided by Dmitry does actually solve the problem, but it had a few issues that led me to adapt it to be more suitable for my needs. Specifically:</p> <ol start="0"> <li>The use of <code>git show</code> broke because of my default date-format settings.</li> <li>I wanted the results sorted in date order, ...
<p>The script provided by Dmitry does actually solve the problem, but it had a few issues that led me to adapt it to be more suitable for my needs. Specifically:</p> <ol start="0"> <li>The use of <code>git show</code> broke because of my default date-format settings.</li> <li>I wanted the results sorted in date order, ...
119, 34099, 37230
git, git-checkout, git-clone
<h1>git - getting ALL previous version of a specific file/folder</h1> <p>I want to retrieve <strong>all</strong> previous version of a specific file in a git repository.</p> <p>I see it is possible to get one specific version with the checkout command, but I want them all. And the git clone command with the depth opti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,264
git
# git - getting ALL previous version of a specific file/folder I want to retrieve **all** previous version of a specific file in a git repository. I see it is possible to get one specific version with the checkout command, but I want them all. And the git clone command with the depth option doesn't seem to allow me t...
The script provided by Dmitry does actually solve the problem, but it had a few issues that led me to adapt it to be more suitable for my needs. Specifically: 0. The use of `git show` broke because of my default date-format settings. 1. I wanted the results sorted in date order, not reverse-date order. 2. I wanted to ...
2866358
Git: Checkout only files without repository?
41
2010-05-19 14:22:00
<p>i'd like to just checkout the files without the .git files and the whole repository. It's because i'd like to manage a website (php &amp; html) with git and i'm looking for an easy way to update the files in the htdocs folder from the repository, without having the repository public. (now it's in the home-dir and is...
33,813
345,163
2019-07-02 10:01:35
2,867,314
37
2010-05-19 16:08:43
46,058
2010-05-19 16:08:43
https://stackoverflow.com/q/2866358
https://stackoverflow.com/a/2867314
<p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-archive.html" rel="noreferrer">git-archive</a> manpage contains the following example:</p> <blockquote> <p><code>git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ &amp;&amp; tar xf -)</code></p> <blockquote> <p>Create a tar archi...
<p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-archive.html" rel="noreferrer">git-archive</a> manpage contains the following example:</p> <blockquote> <p><code>git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ &amp;&amp; tar xf -)</code></p> <blockquote> <p>Create a tar archi...
119
git
<h1>Git: Checkout only files without repository?</h1> <p>i'd like to just checkout the files without the .git files and the whole repository. It's because i'd like to manage a website (php &amp; html) with git and i'm looking for an easy way to update the files in the htdocs folder from the repository, without having t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,265
git
# Git: Checkout only files without repository? i'd like to just checkout the files without the .git files and the whole repository. It's because i'd like to manage a website (php & html) with git and i'm looking for an easy way to update the files in the htdocs folder from the repository, without having the repository...
The [git-archive](http://www.kernel.org/pub/software/scm/git/docs/git-archive.html) manpage contains the following example: > `git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)` > > > Create a tar archive that contains the contents of the latest commit on the current branch, and extract it in t...
11122913
Jenkins + git: "tell me who you are" error, why does it need to tag?
40
2012-06-20 15:27:21
<p>Just installed Jenkins in Ubuntu 12.04 and I wanted to create a simple build that just clones a project and builds it.</p> <p>It fails because it cannot tag. It cannot tag because it errors out saying "<strong>tell me who you are</strong>" apparently because I didn't set git settings UserName and UserEmail.</p> <p...
36,263
544,947
2019-09-06 19:33:00
11,129,749
37
2012-06-20 23:46:32
6,309
2014-01-09 13:24:25
https://stackoverflow.com/q/11122913
https://stackoverflow.com/a/11129749
<p>The idea of tagging when pulling/cloning a repo is common to most Build Scheduler out there:<br> Hudson-Jenkins, but also <a href="http://cruisecontrol.sourceforge.net/main/" rel="nofollow noreferrer">CruiseControl</a> (The build label determined by the <code>labelincrementer</code>), or <a href="http://pic.dhe.ibm....
<p>The idea of tagging when pulling/cloning a repo is common to most Build Scheduler out there:<br> Hudson-Jenkins, but also <a href="http://cruisecontrol.sourceforge.net/main/" rel="nofollow noreferrer">CruiseControl</a> (The build label determined by the <code>labelincrementer</code>), or <a href="http://pic.dhe.ibm....
119, 64999, 76768
git, jenkins, jenkins-plugins
<h1>Jenkins + git: "tell me who you are" error, why does it need to tag?</h1> <p>Just installed Jenkins in Ubuntu 12.04 and I wanted to create a simple build that just clones a project and builds it.</p> <p>It fails because it cannot tag. It cannot tag because it errors out saying "<strong>tell me who you are</strong>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,266
git
# Jenkins + git: "tell me who you are" error, why does it need to tag? Just installed Jenkins in Ubuntu 12.04 and I wanted to create a simple build that just clones a project and builds it. It fails because it cannot tag. It cannot tag because it errors out saying "**tell me who you are**" apparently because I didn't...
The idea of tagging when pulling/cloning a repo is common to most Build Scheduler out there: Hudson-Jenkins, but also [CruiseControl](http://cruisecontrol.sourceforge.net/main/) (The build label determined by the `labelincrementer`), or [RTC Jazz Build Engine (where they are called "snapshots")](http://pic.dhe.ibm.co...
23939214
Why does git-describe prefix the commit ID with the letter 'g'?
39
2014-05-29 17:22:39
<p>Typical output of <code>git-describe</code> looks like</p> <pre><code>some-tag-32-gf31f980 </code></pre> <p>where <code>some-tag</code> is a tag name, <code>32</code> means that the described commit is 32 commits after the commit with that tag, and <code>gf31f980</code> means that the commit ID is uniquely abbrevi...
5,940
1,277,934
2024-03-21 17:55:08
23,939,308
37
2014-05-29 17:27:39
1,277,934
2014-05-29 19:10:30
https://stackoverflow.com/q/23939214
https://stackoverflow.com/a/23939308
<p><a href="https://twitter.com/doyster/status/472065787944255488">Jesse Luehrs immediately pointed out on Twitter</a> that this question is answered in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-describe.html#_examples"><code>git-describe</code> man page</a>:</p> <blockquote> <p>The "g" prefi...
<p><a href="https://twitter.com/doyster/status/472065787944255488">Jesse Luehrs immediately pointed out on Twitter</a> that this question is answered in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-describe.html#_examples"><code>git-describe</code> man page</a>:</p> <blockquote> <p>The "g" prefi...
119
git
<h1>Why does git-describe prefix the commit ID with the letter 'g'?</h1> <p>Typical output of <code>git-describe</code> looks like</p> <pre><code>some-tag-32-gf31f980 </code></pre> <p>where <code>some-tag</code> is a tag name, <code>32</code> means that the described commit is 32 commits after the commit with that ta...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,267
git
# Why does git-describe prefix the commit ID with the letter 'g'? Typical output of `git-describe` looks like ``` some-tag-32-gf31f980 ``` where `some-tag` is a tag name, `32` means that the described commit is 32 commits after the commit with that tag, and `gf31f980` means that the commit ID is uniquely abbreviated...
[Jesse Luehrs immediately pointed out on Twitter](https://twitter.com/doyster/status/472065787944255488) that this question is answered in the [`git-describe` man page](https://www.kernel.org/pub/software/scm/git/docs/git-describe.html#_examples): > The "g" prefix stands for "git" and is > used to allow describing the...
10077996
Sign git commits with GPG
39
2012-04-09 18:38:52
<p>Is there a way to sign git commits with gpg? It's so easy with tags (using <code>-s</code> instead of <code>-a</code>), it seems there would be a similar function for commits.</p>
16,065
866,271
2020-11-09 20:20:14
10,078,078
37
2012-04-09 18:46:12
113,586
2012-04-09 18:46:12
https://stackoverflow.com/q/10077996
https://stackoverflow.com/a/10078078
<p><code>git commit -S</code> (requires git >= 1.7.9).</p>
<p><code>git commit -S</code> (requires git >= 1.7.9).</p>
119, 6735, 7408, 119594
git, git-sign, gnupg, pgp
<h1>Sign git commits with GPG</h1> <p>Is there a way to sign git commits with gpg? It's so easy with tags (using <code>-s</code> instead of <code>-a</code>), it seems there would be a similar function for commits.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,268
git
# Sign git commits with GPG Is there a way to sign git commits with gpg? It's so easy with tags (using `-s` instead of `-a`), it seems there would be a similar function for commits.
`git commit -S` (requires git >= 1.7.9).
33543372
How to view git log in Emacs?
36
2015-11-05 11:26:05
<p>Emacs shows me conveniently the git log of a single file under git with <kbd>C-x v l</kbd>. But how can I view the entire history? In the shell I do <code>git log</code> in a directory under git. Is there a more emacs-affine way to do this?</p>
3,311
772,868
2018-03-27 09:03:28
33,544,406
37
2015-11-05 12:21:35
324,105
2017-09-19 07:04:09
https://stackoverflow.com/q/33543372
https://stackoverflow.com/a/33544406
<p><kbd>C-x</kbd><kbd>v</kbd><kbd>L</kbd> - <code>vc-print-root-log</code></p> <p>I found this easily by asking Emacs to show me the commands with key bindings using the <code>C-x v</code> prefix:<br> <kbd>C-x</kbd><kbd>v</kbd><kbd>C-h</kbd></p> <p>You can also easily find this information in the manual. The specific...
<p><kbd>C-x</kbd><kbd>v</kbd><kbd>L</kbd> - <code>vc-print-root-log</code></p> <p>I found this easily by asking Emacs to show me the commands with key bindings using the <code>C-x v</code> prefix:<br> <kbd>C-x</kbd><kbd>v</kbd><kbd>C-h</kbd></p> <p>You can also easily find this information in the manual. The specific...
119, 371
emacs, git
<h1>How to view git log in Emacs?</h1> <p>Emacs shows me conveniently the git log of a single file under git with <kbd>C-x v l</kbd>. But how can I view the entire history? In the shell I do <code>git log</code> in a directory under git. Is there a more emacs-affine way to do this?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,269
git
# How to view git log in Emacs? Emacs shows me conveniently the git log of a single file under git with `C-x v l`. But how can I view the entire history? In the shell I do `git log` in a directory under git. Is there a more emacs-affine way to do this?
`C-x``v``L` - `vc-print-root-log` I found this easily by asking Emacs to show me the commands with key bindings using the `C-x v` prefix: `C-x``v``C-h` You can also easily find this information in the manual. The specific node is: `C-h``i``g` `(emacs) VC Change Log` Personally I use [Magit](http://magit.vc/), th...
41412398
how to address Git error "the requested upstream branch 'upstream/master' does not exist"
35
2016-12-31 23:43:58
<p>I am attempting to follow some steps to contribute to a repository on GitHub and one of the steps is not working. The steps are here: <a href="https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request" rel="noreferrer">https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-p...
63,352
1,556,092
2022-06-21 18:07:57
41,413,803
37
2017-01-01 06:36:01
6,309
2019-10-31 16:22:34
https://stackoverflow.com/q/41412398
https://stackoverflow.com/a/41413803
<p><code>git fetch upstream master:master</code>: this work <a href="https://stackoverflow.com/a/32561463/6309">only when you are not on <code>master</code></a>. If you are on <code>master</code>, a simple <code>git fetch upstream</code> is enough.</p> <p>Then you can link your local <code>master</code> to the remote ...
<p><code>git fetch upstream master:master</code>: this work <a href="https://stackoverflow.com/a/32561463/6309">only when you are not on <code>master</code></a>. If you are on <code>master</code>, a simple <code>git fetch upstream</code> is enough.</p> <p>Then you can link your local <code>master</code> to the remote ...
119
git
<h1>how to address Git error "the requested upstream branch 'upstream/master' does not exist"</h1> <p>I am attempting to follow some steps to contribute to a repository on GitHub and one of the steps is not working. The steps are here: <a href="https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,270
git
# how to address Git error "the requested upstream branch 'upstream/master' does not exist" I am attempting to follow some steps to contribute to a repository on GitHub and one of the steps is not working. The steps are here: <https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request>. I for...
`git fetch upstream master:master`: this work [only when you are not on `master`](https://stackoverflow.com/a/32561463/6309). If you are on `master`, a simple `git fetch upstream` is enough. Then you can link your local `master` to the remote tracking branch `upstream/master` (which has just been fetched) ``` git bra...
15321472
How could I force mergetool GUI (KDiff3) to be always shown?
34
2013-03-10 10:59:02
<p>How could I force the mergetool GUI to be always shown and disable any automatic resolving?</p> <p>Sometimes when there is a conflict during a merge and I use the mergetool, it simply immediately returns after I hit <kbd>Enter</kbd> on question <strong>"Hit return to start merge resolution tool (kdiff3)"</strong> a...
17,265
1,185,250
2024-07-21 09:55:06
15,813,064
37
2013-04-04 13:44:19
1,132,850
2018-07-20 23:17:01
https://stackoverflow.com/q/15321472
https://stackoverflow.com/a/15813064
<p>Git has <code>--auto</code> hard coded as a command-line option to KDiff3, which causes the GUI not to show up if all conflicts are auto-resolvable by KDiff3. In the KDiff3 settings you can specify command line options to ignore, but putting <code>--auto</code> there did not work for me.</p> <p>As a workaround I co...
<p>Git has <code>--auto</code> hard coded as a command-line option to KDiff3, which causes the GUI not to show up if all conflicts are auto-resolvable by KDiff3. In the KDiff3 settings you can specify command line options to ignore, but putting <code>--auto</code> there did not work for me.</p> <p>As a workaround I co...
119, 25165, 28897, 39542
git, git-merge, kdiff3, mergetool
<h1>How could I force mergetool GUI (KDiff3) to be always shown?</h1> <p>How could I force the mergetool GUI to be always shown and disable any automatic resolving?</p> <p>Sometimes when there is a conflict during a merge and I use the mergetool, it simply immediately returns after I hit <kbd>Enter</kbd> on question <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,271
git
# How could I force mergetool GUI (KDiff3) to be always shown? How could I force the mergetool GUI to be always shown and disable any automatic resolving? Sometimes when there is a conflict during a merge and I use the mergetool, it simply immediately returns after I hit `Enter` on question **"Hit return to start mer...
Git has `--auto` hard coded as a command-line option to KDiff3, which causes the GUI not to show up if all conflicts are auto-resolvable by KDiff3. In the KDiff3 settings you can specify command line options to ignore, but putting `--auto` there did not work for me. As a workaround I configured my own variant of KDiff...
8391506
Searching for a file in all Git branches
33
2011-12-05 20:35:24
<p>How do I search all Git branches of a project for a file name?</p> <p>I remember part of the filename (just the ending), so I'd like to be able to search for something like <code>*_robot.php</code> across all branches, and see which files match that. I'd preferably like to have it search history, and not just the H...
20,861
378,622
2019-06-20 16:36:56
8,392,232
37
2011-12-05 21:37:41
526,535
2011-12-05 21:37:41
https://stackoverflow.com/q/8391506
https://stackoverflow.com/a/8392232
<p>This is one way:</p> <pre><code>git log --all --name-only --pretty=format: | sort -u | grep _robot.php </code></pre>
<p>This is one way:</p> <pre><code>git log --all --name-only --pretty=format: | sort -u | grep _robot.php </code></pre>
119, 1271
git, grep
<h1>Searching for a file in all Git branches</h1> <p>How do I search all Git branches of a project for a file name?</p> <p>I remember part of the filename (just the ending), so I'd like to be able to search for something like <code>*_robot.php</code> across all branches, and see which files match that. I'd preferably ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,275
git
# Searching for a file in all Git branches How do I search all Git branches of a project for a file name? I remember part of the filename (just the ending), so I'd like to be able to search for something like `*_robot.php` across all branches, and see which files match that. I'd preferably like to have it search hist...
This is one way: ``` git log --all --name-only --pretty=format: | sort -u | grep _robot.php ```
21817248
What's the difference between git rebase and merge --no-ff
32
2014-02-16 21:57:16
<p>Both approach seem to have the same purpose to have clean history:</p> <ul> <li><p><a href="http://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="nofollow noreferrer">Git Rebase</a></p> </li> <li><p><a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="nofollow noreferrer">No fast forward</a> (...
24,127
342,553
2024-10-03 17:04:08
21,817,388
37
2014-02-16 22:09:42
632,339
2018-11-27 06:33:32
https://stackoverflow.com/q/21817248
https://stackoverflow.com/a/21817388
<p>It depends how you want your history to look. </p> <p>A really simple example:</p> <h3>git merge --no-ff</h3> <pre><code>* 33ad16c (HEAD, master) Merge branch 'feature-1' |\ | * e61c6a6 Various bug fixes | * e15a356 Started feature |/ * 38b8ada Initial commit </code></pre> <h3>git rebase</h3> <pre><code>*...
<p>It depends how you want your history to look. </p> <p>A really simple example:</p> <h3>git merge --no-ff</h3> <pre><code>* 33ad16c (HEAD, master) Merge branch 'feature-1' |\ | * e61c6a6 Various bug fixes | * e15a356 Started feature |/ * 38b8ada Initial commit </code></pre> <h3>git rebase</h3> <pre><code>*...
119, 28897, 29934
git, git-merge, git-rebase
<h1>What's the difference between git rebase and merge --no-ff</h1> <p>Both approach seem to have the same purpose to have clean history:</p> <ul> <li><p><a href="http://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="nofollow noreferrer">Git Rebase</a></p> </li> <li><p><a href="http://nvie.com/posts/a-successful-g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,276
git
# What's the difference between git rebase and merge --no-ff Both approach seem to have the same purpose to have clean history: - [Git Rebase](http://git-scm.com/book/en/v2/Git-Branching-Rebasing) - [No fast forward](http://nvie.com/posts/a-successful-git-branching-model/) (`--no-ff`) So, if I have done rebasing on ...
It depends how you want your history to look. A really simple example: ### git merge --no-ff ``` * 33ad16c (HEAD, master) Merge branch 'feature-1' |\ | * e61c6a6 Various bug fixes | * e15a356 Started feature |/ * 38b8ada Initial commit ``` ### git rebase ``` * e61c6a6 (HEAD, master) Various bug fixes * e15a3...
23384196
How to run git hook script on windows, using repository through filesystem?
31
2014-04-30 09:17:45
<p>Because of its simplicity, we use remote repository placed on shared disk, accessing it using file system path (\server\share). Is is possible, in such case, to run hook scripts defined in remote repository? I have defined one but it seems like it is not launched (tested using non valid edit in hook script, witch sh...
80,364
831,219
2020-06-09 03:23:03
23,384,429
37
2014-04-30 09:29:06
201,644
2018-11-05 13:08:11
https://stackoverflow.com/q/23384196
https://stackoverflow.com/a/23384429
<p>Git hook is a script you can run before (pre-commit) or after (post-commit) a commit is made. There can be more than one of such a script.</p> <p>They are placed in a specified folder. Any git repository has a <code>.git/hooks</code> folder with file(s) containing hook scripts. </p> <p>You need to answer Do you h...
<p>Git hook is a script you can run before (pre-commit) or after (post-commit) a commit is made. There can be more than one of such a script.</p> <p>They are placed in a specified folder. Any git repository has a <code>.git/hooks</code> folder with file(s) containing hook scripts. </p> <p>You need to answer Do you h...
64, 119, 43087
git, githooks, windows
<h1>How to run git hook script on windows, using repository through filesystem?</h1> <p>Because of its simplicity, we use remote repository placed on shared disk, accessing it using file system path (\server\share). Is is possible, in such case, to run hook scripts defined in remote repository? I have defined one but i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,277
git
# How to run git hook script on windows, using repository through filesystem? Because of its simplicity, we use remote repository placed on shared disk, accessing it using file system path (\server\share). Is is possible, in such case, to run hook scripts defined in remote repository? I have defined one but it seems l...
Git hook is a script you can run before (pre-commit) or after (post-commit) a commit is made. There can be more than one of such a script. They are placed in a specified folder. Any git repository has a `.git/hooks` folder with file(s) containing hook scripts. You need to answer Do you have the event you are testing ...
19110178
Git log before some commit date
31
2013-10-01 07:15:02
<p>I'm trying to get all commits before some date from AOSP (android open source project).<br> I found that I can do it by git command:<br> <code>git log --before="2011-12-01"</code></p> <p>But it shows me only <code>author date</code> (date when patch or change was uploaded buy not merged/changed)</p> <p>Also I foun...
22,324
1,446,154
2013-10-01 07:40:52
19,110,603
37
2013-10-01 07:40:52
6,309
2013-10-01 07:40:52
https://stackoverflow.com/q/19110178
https://stackoverflow.com/a/19110603
<p>Simply combine the two:</p> <pre><code>git log --before="2011-12-01" --pretty=format:"%cd" </code></pre> <p>As shown in "<a href="https://stackoverflow.com/q/13987273/6309">Git log: filter by commit's author date</a>", <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>git log</code></a> filters by c...
<p>Simply combine the two:</p> <pre><code>git log --before="2011-12-01" --pretty=format:"%cd" </code></pre> <p>As shown in "<a href="https://stackoverflow.com/q/13987273/6309">Git log: filter by commit's author date</a>", <a href="http://git-scm.com/docs/git-log" rel="noreferrer"><code>git log</code></a> filters by c...
119
git
<h1>Git log before some commit date</h1> <p>I'm trying to get all commits before some date from AOSP (android open source project).<br> I found that I can do it by git command:<br> <code>git log --before="2011-12-01"</code></p> <p>But it shows me only <code>author date</code> (date when patch or change was uploaded bu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,278
git
# Git log before some commit date I'm trying to get all commits before some date from AOSP (android open source project). I found that I can do it by git command: `git log --before="2011-12-01"` But it shows me only `author date` (date when patch or change was uploaded buy not merged/changed) Also I found that I...
Simply combine the two: ``` git log --before="2011-12-01" --pretty=format:"%cd" ``` As shown in "[Git log: filter by commit's author date](https://stackoverflow.com/q/13987273/6309)", [`git log`](http://git-scm.com/docs/git-log) filters by commit date, and the `pretty=format` will display just that. From the man pag...
16451669
So changed Git's default editor, now how do i invoke it from Git bash?
30
2013-05-08 23:04:30
<p>I've changed Git's default editor by applying the following to Git's global config:</p> <pre><code>core.editor='C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin </code></pre> <p>Now, how do I simply invoke the "default editor" without initiating a commit ? I'm trying to test the ...
5,664
2,117,037
2013-05-08 23:05:52
16,451,686
37
2013-05-08 23:05:52
34,397
2013-05-08 23:05:52
https://stackoverflow.com/q/16451669
https://stackoverflow.com/a/16451686
<p>Run</p> <pre><code>git config -e </code></pre> <p>To edit the configuration in the default editor.</p>
<p>Run</p> <pre><code>git config -e </code></pre> <p>To edit the configuration in the default editor.</p>
119, 3070, 5025
default, editor, git
<h1>So changed Git's default editor, now how do i invoke it from Git bash?</h1> <p>I've changed Git's default editor by applying the following to Git's global config:</p> <pre><code>core.editor='C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin </code></pre> <p>Now, how do I simply i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,280
git
# So changed Git's default editor, now how do i invoke it from Git bash? I've changed Git's default editor by applying the following to Git's global config: ``` core.editor='C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin ``` Now, how do I simply invoke the "default editor" withou...
Run ``` git config -e ``` To edit the configuration in the default editor.
16539346
Amending the message of Git commit made before a merge
29
2013-05-14 09:18:19
<p>I committed some test code before merging in a remote branch. This merge had a lot of conflicts and took some serious time to put right. So my history looks something like this:</p> <pre><code>7ab562c Merge from remote branch ... whole load of commits brought across from the remote branch... f3e71c2 Temporary TESTI...
11,528
2,244,256
2023-07-13 15:56:19
16,541,107
37
2013-05-14 10:43:28
6,309
2023-07-13 15:56:19
https://stackoverflow.com/q/16539346
https://stackoverflow.com/a/16541107
<p>2013: You can try a <del><a href="http://git-scm.com/docs/git-rebase" rel="nofollow noreferrer"><code>git rebase --preserve-merges --interactive</code></a></del>, with:</p> <pre><code>-p --preserve-merges </code></pre> <blockquote> <p>Instead of ignoring merges, try to recreate them.</p> </blockquote> <p>The BUG sec...
<p>2013: You can try a <del><a href="http://git-scm.com/docs/git-rebase" rel="nofollow noreferrer"><code>git rebase --preserve-merges --interactive</code></a></del>, with:</p> <pre><code>-p --preserve-merges </code></pre> <blockquote> <p>Instead of ignoring merges, try to recreate them.</p> </blockquote> <p>The BUG sec...
119, 91259
git, git-rewrite-history
<h1>Amending the message of Git commit made before a merge</h1> <p>I committed some test code before merging in a remote branch. This merge had a lot of conflicts and took some serious time to put right. So my history looks something like this:</p> <pre><code>7ab562c Merge from remote branch ... whole load of commits ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,283
git
# Amending the message of Git commit made before a merge I committed some test code before merging in a remote branch. This merge had a lot of conflicts and took some serious time to put right. So my history looks something like this: ``` 7ab562c Merge from remote branch ... whole load of commits brought across from ...
2013: You can try a ~~[`git rebase --preserve-merges --interactive`](http://git-scm.com/docs/git-rebase)~~, with: ``` -p --preserve-merges ``` > Instead of ignoring merges, try to recreate them. The BUG section of the man page includes: > The todo list presented by `--preserve-merges --interactive` does not represe...
9329244
How to commit and push all changes, including deletes?
28
2012-02-17 13:38:29
<p>How to commit and push all changes, including additions, editions, and file deletions etc in one command?</p>
71,675
192,247
2020-10-18 02:34:23
9,329,615
37
2012-02-17 14:02:20
275,354
2012-02-17 14:21:28
https://stackoverflow.com/q/9329244
https://stackoverflow.com/a/9329615
<p>You will have to do <a href="https://stackoverflow.com/a/572660/275354"><code>git add -A</code></a> to add all files new files, changes and removed files. Than follow that up with <code>git commit</code> and <code>git push</code></p>
<p>You will have to do <a href="https://stackoverflow.com/a/572660/275354"><code>git add -A</code></a> to add all files new files, changes and removed files. Than follow that up with <code>git commit</code> and <code>git push</code></p>
119
git
<h1>How to commit and push all changes, including deletes?</h1> <p>How to commit and push all changes, including additions, editions, and file deletions etc in one command?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,285
git
# How to commit and push all changes, including deletes? How to commit and push all changes, including additions, editions, and file deletions etc in one command?
You will have to do [`git add -A`](https://stackoverflow.com/a/572660/275354) to add all files new files, changes and removed files. Than follow that up with `git commit` and `git push`
4135049
How do I check if a file exists in a remote?
28
2010-11-09 14:54:15
<p>Is there a way to check if a file under specified, relative path exist in a remote? I'm fine with fetching the info first if it's the only option. In other words I'm looking for git-ls-files with an option to specify remote and branch. I'm only interested if the file exists (a list of files on the branch will do as ...
25,721
209,508
2014-05-11 12:54:11
4,135,126
37
2010-11-09 15:04:09
135,724
2014-05-11 12:54:11
https://stackoverflow.com/q/4135049
https://stackoverflow.com/a/4135126
<p>You can use</p> <pre><code>git cat-file -e &lt;remote&gt;:&lt;filename&gt; </code></pre> <p>which will exit with zero when the file exists. Instead of <code>&lt;remote&gt;</code> above you'd use a remote branch name (but it could in fact be any tree-ish object reference). To use such a remote branch, you'll need t...
<p>You can use</p> <pre><code>git cat-file -e &lt;remote&gt;:&lt;filename&gt; </code></pre> <p>which will exit with zero when the file exists. Instead of <code>&lt;remote&gt;</code> above you'd use a remote branch name (but it could in fact be any tree-ish object reference). To use such a remote branch, you'll need t...
119, 41346
git, git-remote
<h1>How do I check if a file exists in a remote?</h1> <p>Is there a way to check if a file under specified, relative path exist in a remote? I'm fine with fetching the info first if it's the only option. In other words I'm looking for git-ls-files with an option to specify remote and branch. I'm only interested if the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,286
git
# How do I check if a file exists in a remote? Is there a way to check if a file under specified, relative path exist in a remote? I'm fine with fetching the info first if it's the only option. In other words I'm looking for git-ls-files with an option to specify remote and branch. I'm only interested if the file exis...
You can use ``` git cat-file -e <remote>:<filename> ``` which will exit with zero when the file exists. Instead of `<remote>` above you'd use a remote branch name (but it could in fact be any tree-ish object reference). To use such a remote branch, you'll need to have the remote repository configured and fetched (i.e...
34580665
Can't access AWS CodeCommit with SSH
27
2016-01-03 19:26:36
<p>Having an incredibly difficult time figuring out how to get AWS CodeCommit to work with standard SSH authentication. Seen another topic like this but no answer and I'm not allowed to comment yet. This is on Windows using Git Bash.</p> <h3>Repro Steps</h3> <ol> <li>Created IAM user with full permissions (AwsAdminis...
31,543
5,741,228
2023-01-08 04:32:48
34,596,407
37
2016-01-04 17:19:30
645,112
2016-01-04 17:19:30
https://stackoverflow.com/q/34580665
https://stackoverflow.com/a/34596407
<p>It looks like you missed a step in setting up SSH. You need to add this information to your .ssh/config file:</p> <pre><code>Host git-codecommit.us-east-1.amazonaws.com User Your-SSH-Key-ID, such as APKAEIBAERJR2EXAMPLE IdentityFile Your-Private-Key-File, such as ~/.ssh/codecommit_rsa or ~/.ssh/id_rsa </code>...
<p>It looks like you missed a step in setting up SSH. You need to add this information to your .ssh/config file:</p> <pre><code>Host git-codecommit.us-east-1.amazonaws.com User Your-SSH-Key-ID, such as APKAEIBAERJR2EXAMPLE IdentityFile Your-Private-Key-File, such as ~/.ssh/codecommit_rsa or ~/.ssh/id_rsa </code>...
119, 386, 114185
aws-codecommit, git, ssh
<h1>Can't access AWS CodeCommit with SSH</h1> <p>Having an incredibly difficult time figuring out how to get AWS CodeCommit to work with standard SSH authentication. Seen another topic like this but no answer and I'm not allowed to comment yet. This is on Windows using Git Bash.</p> <h3>Repro Steps</h3> <ol> <li>Crea...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,287
git
# Can't access AWS CodeCommit with SSH Having an incredibly difficult time figuring out how to get AWS CodeCommit to work with standard SSH authentication. Seen another topic like this but no answer and I'm not allowed to comment yet. This is on Windows using Git Bash. ### Repro Steps 1. Created IAM user with full p...
It looks like you missed a step in setting up SSH. You need to add this information to your .ssh/config file: ``` Host git-codecommit.us-east-1.amazonaws.com User Your-SSH-Key-ID, such as APKAEIBAERJR2EXAMPLE IdentityFile Your-Private-Key-File, such as ~/.ssh/codecommit_rsa or ~/.ssh/id_rsa ``` You can get Your...
25384842
Case-insensitive Git pickaxe search
27
2014-08-19 13:36:03
<p>I'm trying to find all commits where a particular string or arbitrary capitalisation thereof (e.g., <code>foobar</code> ,<code>FooBar</code>, and <code>fooBar</code>) was introduced/removed in a Git repository.</p> <p>Based on this <a href="https://stackoverflow.com/a/2929502/601626">Stack Overflow answer</a> (which...
8,396
601,626
2025-10-24 09:24:26
25,385,294
37
2014-08-19 13:55:26
6,309
2025-10-24 09:24:26
https://stackoverflow.com/q/25384842
https://stackoverflow.com/a/25385294
<p>The way the <code>-i</code> is used with pickaxe (see <a href="https://github.com/git/git/commit/accccde483c3cfd55ef55037e8802ca0baaee5a1" rel="nofollow noreferrer">commit accccde</a>, git 1.7.10, April 2012) is:</p> <pre class="lang-none prettyprint-override"><code>git log -S foobar -i --oneline </code></pre> <p>or...
<p>The way the <code>-i</code> is used with pickaxe (see <a href="https://github.com/git/git/commit/accccde483c3cfd55ef55037e8802ca0baaee5a1" rel="nofollow noreferrer">commit accccde</a>, git 1.7.10, April 2012) is:</p> <pre class="lang-none prettyprint-override"><code>git log -S foobar -i --oneline </code></pre> <p>or...
119
git
<h1>Case-insensitive Git pickaxe search</h1> <p>I'm trying to find all commits where a particular string or arbitrary capitalisation thereof (e.g., <code>foobar</code> ,<code>FooBar</code>, and <code>fooBar</code>) was introduced/removed in a Git repository.</p> <p>Based on this <a href="https://stackoverflow.com/a/292...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,288
git
# Case-insensitive Git pickaxe search I'm trying to find all commits where a particular string or arbitrary capitalisation thereof (e.g., `foobar` ,`FooBar`, and `fooBar`) was introduced/removed in a Git repository. Based on this [Stack Overflow answer](https://stackoverflow.com/a/2929502/601626) (which covers a diff...
The way the `-i` is used with pickaxe (see [commit accccde](https://github.com/git/git/commit/accccde483c3cfd55ef55037e8802ca0baaee5a1), git 1.7.10, April 2012) is: ``` git log -S foobar -i --oneline ``` or ``` git log --regexp-ignore-case -Sfoobar ``` or ``` git log -i -Sfoobar ``` Note that with 1.x git version...
18805842
Git equivalent of hg purge
27
2013-09-14 19:57:10
<p>Not just the command, but the actual behavior... hg purge will delete all untracked files.</p> <p>I thought it was git clean, but nope...</p> <pre><code>$ git clean fatal: clean.requireForce defaults to true and neither -n nor -f given; refusing to clean $ git clean -n Would not remove src/ $ git clean -f Not re...
8,613
156,257
2016-04-15 07:30:03
18,805,876
37
2013-09-14 20:00:48
2,695,054
2014-10-16 06:10:16
https://stackoverflow.com/q/18805842
https://stackoverflow.com/a/18805876
<p>If you want to also remove directories, run <code>git clean -f -d</code></p> <p>If you just want to remove ignored files, run <code>git clean -f -X</code></p> <p>If you want to remove ignored as well as non-ignored files, run <code>git clean -f -x</code></p> <p>Note the case difference on the X for the two latter...
<p>If you want to also remove directories, run <code>git clean -f -d</code></p> <p>If you just want to remove ignored files, run <code>git clean -f -X</code></p> <p>If you want to remove ignored as well as non-ignored files, run <code>git clean -f -x</code></p> <p>Note the case difference on the X for the two latter...
119, 802
git, mercurial
<h1>Git equivalent of hg purge</h1> <p>Not just the command, but the actual behavior... hg purge will delete all untracked files.</p> <p>I thought it was git clean, but nope...</p> <pre><code>$ git clean fatal: clean.requireForce defaults to true and neither -n nor -f given; refusing to clean $ git clean -n Would no...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,289
git
# Git equivalent of hg purge Not just the command, but the actual behavior... hg purge will delete all untracked files. I thought it was git clean, but nope... ``` $ git clean fatal: clean.requireForce defaults to true and neither -n nor -f given; refusing to clean $ git clean -n Would not remove src/ $ git clean ...
If you want to also remove directories, run `git clean -f -d` If you just want to remove ignored files, run `git clean -f -X` If you want to remove ignored as well as non-ignored files, run `git clean -f -x` Note the case difference on the X for the two latter commands. EDIT: useful [linkie](http://gitready.com/beg...
10006462
Refresh staged files
27
2012-04-04 07:10:38
<p>In git, is there any (simple) way to modify the index so that only changes to files which are already in it are added? It sounds kind of complicated, but what I want to achieve is simple.</p> <p>Lets say my index looks like this (slightly stripped <code>git status</code> output):</p> <pre><code># Changes to be com...
19,082
665,845
2021-12-28 22:58:51
10,015,818
37
2012-04-04 16:56:05
106,205
2012-04-04 16:56:05
https://stackoverflow.com/q/10006462
https://stackoverflow.com/a/10015818
<p>The following command will update the index to contain the other changes in B that has not been staged yet:</p> <pre><code>git update-index --again </code></pre>
<p>The following command will update the index to contain the other changes in B that has not been staged yet:</p> <pre><code>git update-index --again </code></pre>
119, 34792
git, git-add
<h1>Refresh staged files</h1> <p>In git, is there any (simple) way to modify the index so that only changes to files which are already in it are added? It sounds kind of complicated, but what I want to achieve is simple.</p> <p>Lets say my index looks like this (slightly stripped <code>git status</code> output):</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,291
git
# Refresh staged files In git, is there any (simple) way to modify the index so that only changes to files which are already in it are added? It sounds kind of complicated, but what I want to achieve is simple. Lets say my index looks like this (slightly stripped `git status` output): ``` # Changes to be committed: ...
The following command will update the index to contain the other changes in B that has not been staged yet: ``` git update-index --again ```
23762897
git merge -s recursive -X ours vs git merge -s ours?
26
2014-05-20 14:40:40
<p>In man git-merge doc, <code>git merge -s recursive -X ours</code>:</p> <blockquote> <p>This should not be confused with the ours merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree did, declaring our history contains all that happened in it....
6,902
1,276,501
2022-08-08 01:32:20
23,763,455
37
2014-05-20 15:02:35
1,256,452
2022-08-08 01:32:20
https://stackoverflow.com/q/23762897
https://stackoverflow.com/a/23763455
<p>As the man page says, <code>-s ours</code> ignores the <em>contents</em> of the other branch entirely. This should be obvious enough: no matter what's in the other branch, the tree attached to the merge commit is identical to the tree in the <code>HEAD</code> commit before the merge.</p> <p>What <code>-X ours</code...
<p>As the man page says, <code>-s ours</code> ignores the <em>contents</em> of the other branch entirely. This should be obvious enough: no matter what's in the other branch, the tree attached to the merge commit is identical to the tree in the <code>HEAD</code> commit before the merge.</p> <p>What <code>-X ours</code...
119, 717
git, merge
<h1>git merge -s recursive -X ours vs git merge -s ours?</h1> <p>In man git-merge doc, <code>git merge -s recursive -X ours</code>:</p> <blockquote> <p>This should not be confused with the ours merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,292
git
# git merge -s recursive -X ours vs git merge -s ours? In man git-merge doc, `git merge -s recursive -X ours`: > This should not be confused with the ours merge strategy, which does > not even look at what the other tree contains at all. It discards > everything the other tree did, declaring our history contains all ...
As the man page says, `-s ours` ignores the *contents* of the other branch entirely. This should be obvious enough: no matter what's in the other branch, the tree attached to the merge commit is identical to the tree in the `HEAD` commit before the merge. What `-X ours` does is more subtle: it uses "our" version of a ...
6655633
Why would a simple `git mv` fail?
26
2011-07-11 19:47:54
<p>I am trying to rename a file in a local <code>.git directory</code>:</p> <pre><code>git mv MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c </code></pre> <p>Yet, git fails with:</p> <pre><code>fatal: renaming 'MyProj/src/ts0621/foobar.c' failed: No such file or directory </code></pre> <p>I could swear ...
19,447
586,707
2024-11-05 19:31:13
6,655,715
37
2011-07-11 19:54:02
85,371
2011-07-11 19:54:02
https://stackoverflow.com/q/6655633
https://stackoverflow.com/a/6655715
<p>Probably, because NewProjName/src/ts0629 doesn't exist</p> <p>Try </p> <pre><code>mkdir -pv NewProjName/src/ts0629 git add NewProjName/src/ts0629 </code></pre>
<p>Probably, because NewProjName/src/ts0629 doesn't exist</p> <p>Try </p> <pre><code>mkdir -pv NewProjName/src/ts0629 git add NewProjName/src/ts0629 </code></pre>
119
git
<h1>Why would a simple `git mv` fail?</h1> <p>I am trying to rename a file in a local <code>.git directory</code>:</p> <pre><code>git mv MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c </code></pre> <p>Yet, git fails with:</p> <pre><code>fatal: renaming 'MyProj/src/ts0621/foobar.c' failed: No such file or...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,293
git
# Why would a simple `git mv` fail? I am trying to rename a file in a local `.git directory`: ``` git mv MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c ``` Yet, git fails with: ``` fatal: renaming 'MyProj/src/ts0621/foobar.c' failed: No such file or directory ``` I could swear that I had `git mv` worki...
Probably, because NewProjName/src/ts0629 doesn't exist Try ``` mkdir -pv NewProjName/src/ts0629 git add NewProjName/src/ts0629 ```
23550689
GIT Nested repositories: Composer vs. SubModules vs. Subtree vs.?
25
2014-05-08 19:19:54
<p>I've finally incorporated <strong>GitHub</strong> and <strong>Composer</strong> dependency management on my workflow. It's definitely a huge step forward, although I remain very confused about GIT managing the "nested" dependecies.</p> <p>As I'm using an awesome Wordpress Stack ROOTS/BEDROCK, my simplified director...
13,595
1,872,494
2023-03-15 21:18:20
28,385,700
37
2015-02-07 18:20:12
3,124,256
2016-04-20 08:43:16
https://stackoverflow.com/q/23550689
https://stackoverflow.com/a/28385700
<p>I have a couple of questions, and in consideration of that, the answer below is quite generic. If you answer my questions, I will gladly update it. </p> <ol> <li><p>Does composer pull the repos on an update? OR reclone the repo? (Is it even doing updates?)</p> <ul> <li>If it reclones then using it for updates will...
<p>I have a couple of questions, and in consideration of that, the answer below is quite generic. If you answer my questions, I will gladly update it. </p> <ol> <li><p>Does composer pull the repos on an update? OR reclone the repo? (Is it even doing updates?)</p> <ul> <li>If it reclones then using it for updates will...
119, 3610, 41612, 68200, 78546
composer-php, git, git-submodules, git-subtree, nested
<h1>GIT Nested repositories: Composer vs. SubModules vs. Subtree vs.?</h1> <p>I've finally incorporated <strong>GitHub</strong> and <strong>Composer</strong> dependency management on my workflow. It's definitely a huge step forward, although I remain very confused about GIT managing the "nested" dependecies.</p> <p>As...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,296
git
# GIT Nested repositories: Composer vs. SubModules vs. Subtree vs.? I've finally incorporated **GitHub** and **Composer** dependency management on my workflow. It's definitely a huge step forward, although I remain very confused about GIT managing the "nested" dependecies. As I'm using an awesome Wordpress Stack ROOT...
I have a couple of questions, and in consideration of that, the answer below is quite generic. If you answer my questions, I will gladly update it. 1. Does composer pull the repos on an update? OR reclone the repo? (Is it even doing updates?) - If it reclones then using it for updates will risk overwriting your wo...
26080278
Can I save space in a Git repository by squashing commits?
25
2014-09-27 23:53:19
<p>If I have a Git repository with an initial commit followed by 100 small commits that change 100 files, with each one just making one change to one file, can I save space by squashing those 100 commits into one big 100-files-changed commit? For instance:</p> <pre class="lang-none prettyprint-override"><code>git chec...
4,148
1,256,452
2023-11-24 20:02:10
26,080,279
37
2014-09-27 23:53:19
1,256,452
2023-11-24 19:53:44
https://stackoverflow.com/q/26080278
https://stackoverflow.com/a/26080279
<p>Maybe (even &quot;probably&quot;) it will save some space, but not right away. In fact, at first it will make things just a bit bigger.</p> <p>Let's take a look at how Git actually stores things. It gets complicated, but it starts very simple: Git stores every file completely intact (using &quot;zlib deflate&quot;...
<p>Maybe (even &quot;probably&quot;) it will save some space, but not right away. In fact, at first it will make things just a bit bigger.</p> <p>Let's take a look at how Git actually stores things. It gets complicated, but it starts very simple: Git stores every file completely intact (using &quot;zlib deflate&quot;...
119
git
<h1>Can I save space in a Git repository by squashing commits?</h1> <p>If I have a Git repository with an initial commit followed by 100 small commits that change 100 files, with each one just making one change to one file, can I save space by squashing those 100 commits into one big 100-files-changed commit? For inst...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,297
git
# Can I save space in a Git repository by squashing commits? If I have a Git repository with an initial commit followed by 100 small commits that change 100 files, with each one just making one change to one file, can I save space by squashing those 100 commits into one big 100-files-changed commit? For instance: ```...
Maybe (even "probably") it will save some space, but not right away. In fact, at first it will make things just a bit bigger. Let's take a look at how Git actually stores things. It gets complicated, but it starts very simple: Git stores every file completely intact (using "zlib deflate" compression, but otherwise jus...
47089913
Merge commit without squash vs with squash option
24
2017-11-03 06:43:31
<p>On daily routine i use <code>SmartGit</code> as client of choose. My team members however stick to git native, non commercial GUI. We discovered some differences in how our merge commits looks like.</p> <p>Those are options that <code>SmartGit</code> gives when requested to merge branch: <a href="https://i.sstatic....
31,143
2,759,473
2020-02-27 14:32:26
47,091,128
37
2017-11-03 08:12:43
6,936,103
2018-09-18 13:53:23
https://stackoverflow.com/q/47089913
https://stackoverflow.com/a/47091128
<p>The difference between the two kinds of merge are only <strong>different in the commit history</strong> (as you showed the logs in graph). </p> <p>Let's illustrate by graphs. Assume the commit history as below before merging:</p> <pre><code>A---B---C---D master \ E---F---G develop </code></pre> <h3>M...
<p>The difference between the two kinds of merge are only <strong>different in the commit history</strong> (as you showed the logs in graph). </p> <p>Let's illustrate by graphs. Assume the commit history as below before merging:</p> <pre><code>A---B---C---D master \ E---F---G develop </code></pre> <h3>M...
119, 456, 717, 65939
git, merge, smartgit, version-control
<h1>Merge commit without squash vs with squash option</h1> <p>On daily routine i use <code>SmartGit</code> as client of choose. My team members however stick to git native, non commercial GUI. We discovered some differences in how our merge commits looks like.</p> <p>Those are options that <code>SmartGit</code> gives ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,298
git
# Merge commit without squash vs with squash option On daily routine i use `SmartGit` as client of choose. My team members however stick to git native, non commercial GUI. We discovered some differences in how our merge commits looks like. Those are options that `SmartGit` gives when requested to merge branch: [![Sma...
The difference between the two kinds of merge are only **different in the commit history** (as you showed the logs in graph). Let's illustrate by graphs. Assume the commit history as below before merging: ``` A---B---C---D master \ E---F---G develop ``` ### Merge commit (multiple parents): The command ...
31790481
How to do git submodules and why to use git submodules
23
2015-08-03 14:54:23
<p>I have found a GitHub project and it uses git submodules.</p> <p>What is the usage of git submodules?</p> <p>How to create git submodules?</p> <p>How do they differ from subtree?</p> <p><a href="https://i.sstatic.net/R7qr8.png" rel="noreferrer"><img src="https://i.sstatic.net/R7qr8.png" alt="GitSubModule" /></a></p>...
14,034
5,132,539
2023-03-29 08:36:47
31,803,199
37
2015-08-04 07:30:34
3,077,366
2015-08-04 19:19:11
https://stackoverflow.com/q/31790481
https://stackoverflow.com/a/31803199
<p><em>Git Submodule:</em></p> <p>A submodule in a git repository is like a sub-directory which is really a separate git repository in its own right. This is a useful feature when you have a project in git which depends on a particular versions of other projects</p> <p><em>Git Subtree:</em></p> <p>Git subtree allow...
<p><em>Git Submodule:</em></p> <p>A submodule in a git repository is like a sub-directory which is really a separate git repository in its own right. This is a useful feature when you have a project in git which depends on a particular versions of other projects</p> <p><em>Git Subtree:</em></p> <p>Git subtree allow...
119, 41612
git, git-submodules
<h1>How to do git submodules and why to use git submodules</h1> <p>I have found a GitHub project and it uses git submodules.</p> <p>What is the usage of git submodules?</p> <p>How to create git submodules?</p> <p>How do they differ from subtree?</p> <p><a href="https://i.sstatic.net/R7qr8.png" rel="noreferrer"><img src...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,300
git
# How to do git submodules and why to use git submodules I have found a GitHub project and it uses git submodules. What is the usage of git submodules? How to create git submodules? How do they differ from subtree? [![GitSubModule](https://i.sstatic.net/R7qr8.png)](https://i.sstatic.net/R7qr8.png)
*Git Submodule:* A submodule in a git repository is like a sub-directory which is really a separate git repository in its own right. This is a useful feature when you have a project in git which depends on a particular versions of other projects *Git Subtree:* Git subtree allows you to insert any repository as a sub...
29160821
Git diff for added file
23
2015-03-20 06:38:51
<p>Normally I use <code>git diff</code> to check the changes of uncommited files (not yet <code>git add</code>ed) with the last commited one.</p> <p>But after doing <code>git add somefile</code> (but not yet <code>git commit</code>ed), how to check the diff of that file?</p>
7,276
1,620,210
2015-03-20 06:40:39
29,160,840
37
2015-03-20 06:40:39
6,309
2015-03-20 06:40:39
https://stackoverflow.com/q/29160821
https://stackoverflow.com/a/29160840
<p>You can check</p> <pre><code>git diff --cached -- yourFile </code></pre> <p>That will diff between HEAd and the index.</p> <p><img src="https://i.sstatic.net/t5KME.png" alt="http://images.abizern.org.s3.amazonaws.com/365git/Feb11/Git%20Diff%202.png"></p> <p><sup>(from <a href="http://365git.tumblr.com/post/34649...
<p>You can check</p> <pre><code>git diff --cached -- yourFile </code></pre> <p>That will diff between HEAd and the index.</p> <p><img src="https://i.sstatic.net/t5KME.png" alt="http://images.abizern.org.s3.amazonaws.com/365git/Feb11/Git%20Diff%202.png"></p> <p><sup>(from <a href="http://365git.tumblr.com/post/34649...
119, 606
diff, git
<h1>Git diff for added file</h1> <p>Normally I use <code>git diff</code> to check the changes of uncommited files (not yet <code>git add</code>ed) with the last commited one.</p> <p>But after doing <code>git add somefile</code> (but not yet <code>git commit</code>ed), how to check the diff of that file?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,301
git
# Git diff for added file Normally I use `git diff` to check the changes of uncommited files (not yet `git add`ed) with the last commited one. But after doing `git add somefile` (but not yet `git commit`ed), how to check the diff of that file?
You can check ``` git diff --cached -- yourFile ``` That will diff between HEAd and the index. ![http://images.abizern.org.s3.amazonaws.com/365git/Feb11/Git%20Diff%202.png](https://i.sstatic.net/t5KME.png) (from [365git.tumblr.com](http://365git.tumblr.com/post/3464927214/getting-a-diff-between-the-working-tree-and...
27776588
Modifying a file after "git add"
23
2015-01-05 09:27:49
<p><strong>Scenario</strong></p> <p>Due to PHPMD and PHPCS checks that run during a commit, I often need to modify files that have already been affected by "git add".</p> <p>If I modify a file that is added, and retry the commit, the changes aren't recognized, so the commit will fail again.</p> <p>I then need to "gi...
18,594
2,560,666
2019-07-17 16:49:41
27,776,714
37
2015-01-05 09:35:57
4,402,721
2019-07-17 16:49:41
https://stackoverflow.com/q/27776588
https://stackoverflow.com/a/27776714
<p>In git, files (per se) aren't staged, changes are. So when you do <code>git add &lt;filename&gt;</code>, it is the <em>current state</em> of that file that is staged. If you change the file and want to add those changes as well, you just do another <code>git add</code>.</p>
<p>In git, files (per se) aren't staged, changes are. So when you do <code>git add &lt;filename&gt;</code>, it is the <em>current state</em> of that file that is staged. If you change the file and want to add those changes as well, you just do another <code>git add</code>.</p>
119
git
<h1>Modifying a file after "git add"</h1> <p><strong>Scenario</strong></p> <p>Due to PHPMD and PHPCS checks that run during a commit, I often need to modify files that have already been affected by "git add".</p> <p>If I modify a file that is added, and retry the commit, the changes aren't recognized, so the commit w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,302
git
# Modifying a file after "git add" **Scenario** Due to PHPMD and PHPCS checks that run during a commit, I often need to modify files that have already been affected by "git add". If I modify a file that is added, and retry the commit, the changes aren't recognized, so the commit will fail again. I then need to "git...
In git, files (per se) aren't staged, changes are. So when you do `git add <filename>`, it is the *current state* of that file that is staged. If you change the file and want to add those changes as well, you just do another `git add`.
2872587
git can I speed up committing?
23
2010-05-20 09:50:09
<p>I have a big repository in a shared folder. I use git from within a VM on that folder. Everything works nice, but the repository is big and git's searching through all directories and files when committing is slow. I cannot move this repository out of the shared folder.</p> <p>I tried to <code>git add</code> specif...
7,405
82,673
2010-05-20 11:00:03
2,873,039
37
2010-05-20 11:00:03
825
2010-05-20 11:00:03
https://stackoverflow.com/q/2872587
https://stackoverflow.com/a/2873039
<p>You can try enabling the preloadindex option, described in the <a href="http://git-scm.com/docs/git-config" rel="noreferrer">git-config man page</a>:</p> <blockquote> <p>core.preloadindex</p> <blockquote> <p>Enable parallel index preload for operations like git diff</p> <p>This can speed up oper...
<p>You can try enabling the preloadindex option, described in the <a href="http://git-scm.com/docs/git-config" rel="noreferrer">git-config man page</a>:</p> <blockquote> <p>core.preloadindex</p> <blockquote> <p>Enable parallel index preload for operations like git diff</p> <p>This can speed up oper...
119, 456, 9952
git, version-control, virtual-machine
<h1>git can I speed up committing?</h1> <p>I have a big repository in a shared folder. I use git from within a VM on that folder. Everything works nice, but the repository is big and git's searching through all directories and files when committing is slow. I cannot move this repository out of the shared folder.</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,304
git
# git can I speed up committing? I have a big repository in a shared folder. I use git from within a VM on that folder. Everything works nice, but the repository is big and git's searching through all directories and files when committing is slow. I cannot move this repository out of the shared folder. I tried to `gi...
You can try enabling the preloadindex option, described in the [git-config man page](http://git-scm.com/docs/git-config): > core.preloadindex > > > Enable parallel index preload for operations like git diff > > > > This can speed up operations like git diff and git status especially on filesystems like NFS that have w...
3169787
Remove all deleted files from "changed but not updated" in Git
22
2010-07-03 00:14:58
<p>When I run <code>git status</code>, I have a bunch of lines of the form</p> <pre><code>deleted: dir/file.js </code></pre> <p>I can remove each of these individually with <code>git checkout -- dir/file.js</code>, but there must be a less painstaking way to do so. (And yes, I know I should've used <code>git rm</c...
11,055
66,226
2011-01-03 22:19:39
3,171,818
37
2010-07-03 14:38:40
223,092
2010-07-03 14:38:40
https://stackoverflow.com/q/3169787
https://stackoverflow.com/a/3171818
<p>As rampion points out, you can still use <code>git rm</code> to stage the deletion of files that have already been deleted in your working copy (e.g. just <code>git rm dir/file.js</code> in your case.) If you have a lot of these files listed as "deleted:" under "Changed but not updated", I would first check that <c...
<p>As rampion points out, you can still use <code>git rm</code> to stage the deletion of files that have already been deleted in your working copy (e.g. just <code>git rm dir/file.js</code> in your case.) If you have a lot of these files listed as "deleted:" under "Changed but not updated", I would first check that <c...
119
git
<h1>Remove all deleted files from "changed but not updated" in Git</h1> <p>When I run <code>git status</code>, I have a bunch of lines of the form</p> <pre><code>deleted: dir/file.js </code></pre> <p>I can remove each of these individually with <code>git checkout -- dir/file.js</code>, but there must be a less pai...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,305
git
# Remove all deleted files from "changed but not updated" in Git When I run `git status`, I have a bunch of lines of the form ``` deleted: dir/file.js ``` I can remove each of these individually with `git checkout -- dir/file.js`, but there must be a less painstaking way to do so. (And yes, I know I should've use...
As rampion points out, you can still use `git rm` to stage the deletion of files that have already been deleted in your working copy (e.g. just `git rm dir/file.js` in your case.) If you have a lot of these files listed as "deleted:" under "Changed but not updated", I would first check that `git ls-files --deleted` pro...
21082342
How does git handle moving files in the file system?
21
2014-01-13 00:50:27
<p>If I move files within a repository, such as from one folder to another, will git be smart enough to know that these are the same files and merely updates its reference to these files in the repository, or does the new commit actually create copies of these files?</p> <p>I ask because I wonder how useful git is for...
7,166
3,758,484
2014-01-13 06:19:02
21,082,870
37
2014-01-13 02:10:10
1,256,452
2014-01-13 06:19:02
https://stackoverflow.com/q/21082342
https://stackoverflow.com/a/21082870
<p>To understand how git handles these, you need to know two things to start with:</p> <ul> <li>Each individual file (in any directory, in any commit) is stored individually, always.</li> <li>But it's stored by its object-ID, which is unique for whatever data is in the file.</li> </ul> <h3>How things are stored</h3> ...
<p>To understand how git handles these, you need to know two things to start with:</p> <ul> <li>Each individual file (in any directory, in any commit) is stored individually, always.</li> <li>But it's stored by its object-ID, which is unique for whatever data is in the file.</li> </ul> <h3>How things are stored</h3> ...
119
git
<h1>How does git handle moving files in the file system?</h1> <p>If I move files within a repository, such as from one folder to another, will git be smart enough to know that these are the same files and merely updates its reference to these files in the repository, or does the new commit actually create copies of the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,306
git
# How does git handle moving files in the file system? If I move files within a repository, such as from one folder to another, will git be smart enough to know that these are the same files and merely updates its reference to these files in the repository, or does the new commit actually create copies of these files?...
To understand how git handles these, you need to know two things to start with: - Each individual file (in any directory, in any commit) is stored individually, always. - But it's stored by its object-ID, which is unique for whatever data is in the file. ### How things are stored Let's say you have a new repo with o...
18786881
How do I run Git bisect only on commits that changed a certain file?
21
2013-09-13 12:55:39
<p>I have a bug that have been introduced a long time ago, and testing for it is painful. However, I strongly suspect that changes which introduced the bug happened in one particular source code file.</p> <p>Can I run Git bisect on a subset of commits that changed that one file?</p>
6,092
312,725
2025-05-13 13:01:27
18,788,829
37
2013-09-13 14:29:46
271,129
2025-05-13 13:01:27
https://stackoverflow.com/q/18786881
https://stackoverflow.com/a/18788829
<p>Yes, you can. In <a href="https://git-scm.com/docs/git-bisect" rel="nofollow noreferrer">the man page</a>, you find this line:</p> <pre class="lang-none prettyprint-override"><code>git bisect start [--term-{old,good}=&lt;term&gt; --term-{new,bad}=&lt;term&gt;] [--no-checkout] [&lt;bad&gt; [&lt;good&gt;...]] [-...
<p>Yes, you can. In <a href="https://git-scm.com/docs/git-bisect" rel="nofollow noreferrer">the man page</a>, you find this line:</p> <pre class="lang-none prettyprint-override"><code>git bisect start [--term-{old,good}=&lt;term&gt; --term-{new,bad}=&lt;term&gt;] [--no-checkout] [&lt;bad&gt; [&lt;good&gt;...]] [-...
119, 47326
git, git-bisect
<h1>How do I run Git bisect only on commits that changed a certain file?</h1> <p>I have a bug that have been introduced a long time ago, and testing for it is painful. However, I strongly suspect that changes which introduced the bug happened in one particular source code file.</p> <p>Can I run Git bisect on a subset o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,307
git
# How do I run Git bisect only on commits that changed a certain file? I have a bug that have been introduced a long time ago, and testing for it is painful. However, I strongly suspect that changes which introduced the bug happened in one particular source code file. Can I run Git bisect on a subset of commits that ...
Yes, you can. In [the man page](https://git-scm.com/docs/git-bisect), you find this line: ``` git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>] [--no-checkout] [<bad> [<good>...]] [--] [<paths>...] ``` So after `--`, you put the paths of the files or directories. For example: ``` git bisect ...
6265209
django-taggit - how do I display the tags related to each record
21
2011-06-07 12:35:03
<p>I'm using <a href="https://github.com/alex/django-taggit/">django-taggit</a> on one of my projects and I'm able to save and tie the tags with specific records. Now the question is how do I display the tags related to each record?</p> <p>For example on my page I want to display a record which contains a title and co...
11,561
509,807
2014-10-12 06:21:58
6,265,636
37
2011-06-07 13:07:30
396,300
2012-10-09 11:59:11
https://stackoverflow.com/q/6265209
https://stackoverflow.com/a/6265636
<p><strong>models.py</strong></p> <pre><code>from django.db import models from taggit.managers import TaggableManager class MyObject(models.Model): title = models.CharField(max_length=100) content = models.TextField() tags = TaggableManager() </code></pre> <p><strong>views.py</strong></p> <pre><code>fr...
<p><strong>models.py</strong></p> <pre><code>from django.db import models from taggit.managers import TaggableManager class MyObject(models.Model): title = models.CharField(max_length=100) content = models.TextField() tags = TaggableManager() </code></pre> <p><strong>views.py</strong></p> <pre><code>fr...
243, 10491, 23506, 67475
django, django-taggit, django-templates, django-views
<h1>django-taggit - how do I display the tags related to each record</h1> <p>I'm using <a href="https://github.com/alex/django-taggit/">django-taggit</a> on one of my projects and I'm able to save and tie the tags with specific records. Now the question is how do I display the tags related to each record?</p> <p>For e...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,309
git
# django-taggit - how do I display the tags related to each record I'm using [django-taggit](https://github.com/alex/django-taggit/) on one of my projects and I'm able to save and tie the tags with specific records. Now the question is how do I display the tags related to each record? For example on my page I want to...
**models.py** ``` from django.db import models from taggit.managers import TaggableManager class MyObject(models.Model): title = models.CharField(max_length=100) content = models.TextField() tags = TaggableManager() ``` **views.py** ``` from django.views.generic import simple def show_object(request):...
70951055
How can I rename a git worktree
20
2022-02-02 05:53:45
<p>Given I have run</p> <pre><code>$ git worktree add ~/worktrees/a $ cd ~/worktrees/a $ git status On branch a </code></pre> <p>I would like to instead change the name of the worktree and branch from <code>a</code> to <code>b</code>.</p>
12,281
1,371,489
2025-09-16 02:28:18
70,951,062
37
2022-02-02 05:55:03
1,371,489
2022-02-02 05:55:03
https://stackoverflow.com/q/70951055
https://stackoverflow.com/a/70951062
<p>One option for achieving this (that I ended up doing) is:</p> <pre><code>$ git worktree move ~/worktrees/a ~/worktrees/b $ cd ~/worktrees/b $ git branch -m b </code></pre>
<p>One option for achieving this (that I ended up doing) is:</p> <pre><code>$ git worktree move ~/worktrees/a ~/worktrees/b $ cd ~/worktrees/b $ git branch -m b </code></pre>
119, 117020
git, git-worktree
<h1>How can I rename a git worktree</h1> <p>Given I have run</p> <pre><code>$ git worktree add ~/worktrees/a $ cd ~/worktrees/a $ git status On branch a </code></pre> <p>I would like to instead change the name of the worktree and branch from <code>a</code> to <code>b</code>.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,310
git
# How can I rename a git worktree Given I have run ``` $ git worktree add ~/worktrees/a $ cd ~/worktrees/a $ git status On branch a ``` I would like to instead change the name of the worktree and branch from `a` to `b`.
One option for achieving this (that I ended up doing) is: ``` $ git worktree move ~/worktrees/a ~/worktrees/b $ cd ~/worktrees/b $ git branch -m b ```
34943429
How to stage all files in if a subfolder on git
19
2016-01-22 09:40:19
<p>May I know how to stage all the files in a folder like a folder called subfolder on git? </p> <p>Have tried</p> <pre><code>git add subfolder/\\* </code></pre> <p>but doesn't work.</p>
23,635
324,850
2024-11-22 10:38:10
34,944,843
37
2016-01-22 10:48:14
1,432,545
2016-01-22 10:53:46
https://stackoverflow.com/q/34943429
https://stackoverflow.com/a/34944843
<p>Just use <code>git add subfolder</code>.</p> <p>I usually use <code>git add .</code> in the root of the repository to stage all files in the repo.</p> <p>If you want to use the asterisk, you should use <code>git add subfolder/*</code> because the shell will expand this into <code>git add subfolder/foo subfolder/ba...
<p>Just use <code>git add subfolder</code>.</p> <p>I usually use <code>git add .</code> in the root of the repository to stage all files in the repo.</p> <p>If you want to use the asterisk, you should use <code>git add subfolder/*</code> because the shell will expand this into <code>git add subfolder/foo subfolder/ba...
119
git
<h1>How to stage all files in if a subfolder on git</h1> <p>May I know how to stage all the files in a folder like a folder called subfolder on git? </p> <p>Have tried</p> <pre><code>git add subfolder/\\* </code></pre> <p>but doesn't work.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,312
git
# How to stage all files in if a subfolder on git May I know how to stage all the files in a folder like a folder called subfolder on git? Have tried ``` git add subfolder/\\* ``` but doesn't work.
Just use `git add subfolder`. I usually use `git add .` in the root of the repository to stage all files in the repo. If you want to use the asterisk, you should use `git add subfolder/*` because the shell will expand this into `git add subfolder/foo subfolder/bar subfolder/...` with all the files in the directory. ...
17289745
How to move the HEAD to the latest date in git?
19
2013-06-25 05:25:14
<p>What I wish to do is to get the version of the file that has a specific comment, get it and use it, then change it to the latest code.</p> <pre><code>git log -g --grep="code submitted version 0.1.2.3" </code></pre> <p>This returns a hash <code>123456</code>, then I do:</p> <pre><code>git checkout 123456 </code></...
46,770
1,896,222
2018-07-19 06:20:12
17,289,779
37
2013-06-25 05:27:39
1,671,066
2018-07-19 06:20:12
https://stackoverflow.com/q/17289745
https://stackoverflow.com/a/17289779
<p>When you called <code>git checkout 123456</code> you moved your <code>HEAD</code> from the commit you were currently on (most likely the head of the <code>master</code> branch) to the commit <code>123456</code>. Therefor you are looking for a way to move <code>HEAD</code> back to the branch you were previously on, w...
<p>When you called <code>git checkout 123456</code> you moved your <code>HEAD</code> from the commit you were currently on (most likely the head of the <code>master</code> branch) to the commit <code>123456</code>. Therefor you are looking for a way to move <code>HEAD</code> back to the branch you were previously on, w...
119, 17492
git, head
<h1>How to move the HEAD to the latest date in git?</h1> <p>What I wish to do is to get the version of the file that has a specific comment, get it and use it, then change it to the latest code.</p> <pre><code>git log -g --grep="code submitted version 0.1.2.3" </code></pre> <p>This returns a hash <code>123456</code>,...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,313
git
# How to move the HEAD to the latest date in git? What I wish to do is to get the version of the file that has a specific comment, get it and use it, then change it to the latest code. ``` git log -g --grep="code submitted version 0.1.2.3" ``` This returns a hash `123456`, then I do: ``` git checkout 123456 ``` an...
When you called `git checkout 123456` you moved your `HEAD` from the commit you were currently on (most likely the head of the `master` branch) to the commit `123456`. Therefor you are looking for a way to move `HEAD` back to the branch you were previously on, which you can do with: ``` git checkout master ``` If you...
4232171
Can git commit "empty versions" of new, non-empty files?
19
2010-11-20 10:02:56
<p>Can git commit empty versions of some files? The case in point is that I need new (untracked), non-empty files to first be added and committed as <em>empty</em> files, so as to mark their contents as being new and to be reviewed (the full, untracked file should <em>not</em> be added to the index; <code>git diff</co...
11,940
42,973
2020-04-22 09:35:05
4,232,334
37
2010-11-20 10:48:08
279,627
2019-10-17 13:40:04
https://stackoverflow.com/q/4232171
https://stackoverflow.com/a/4232334
<p>To be honest, I do not really understand what this is useful for. I would try to fix the review process instead of messing up the history. But if you really want to do this, here are several ways how:</p> <ol> <li><p>The pragmatic approach:</p> <pre><code>mv file out-of-way touch file git add file mv out-of-way ...
<p>To be honest, I do not really understand what this is useful for. I would try to fix the review process instead of messing up the history. But if you really want to do this, here are several ways how:</p> <ol> <li><p>The pragmatic approach:</p> <pre><code>mv file out-of-way touch file git add file mv out-of-way ...
119, 5597, 14215
addition, commit, git
<h1>Can git commit "empty versions" of new, non-empty files?</h1> <p>Can git commit empty versions of some files? The case in point is that I need new (untracked), non-empty files to first be added and committed as <em>empty</em> files, so as to mark their contents as being new and to be reviewed (the full, untracked ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,314
git
# Can git commit "empty versions" of new, non-empty files? Can git commit empty versions of some files? The case in point is that I need new (untracked), non-empty files to first be added and committed as *empty* files, so as to mark their contents as being new and to be reviewed (the full, untracked file should *not*...
To be honest, I do not really understand what this is useful for. I would try to fix the review process instead of messing up the history. But if you really want to do this, here are several ways how: 1. The pragmatic approach: ``` mv file out-of-way touch file git add file mv out-of-way file ``` 2....
19691395
Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead?
18
2013-10-30 18:49:48
<p>I am trying to add a commit message to my changes using </p> <pre><code>git commit -a </code></pre> <p>OR just plain </p> <pre><code>git commit </code></pre> <p>this somehow opens GNU Nano 2.2.6 editor and I am not at all comfortable with it. So the question is : </p> <blockquote> <p>How can I modify my set...
14,208
1,639,162
2020-05-26 05:29:49
19,691,438
37
2013-10-30 18:52:00
2,332,745
2020-05-26 05:29:49
https://stackoverflow.com/q/19691395
https://stackoverflow.com/a/19691438
<p>You can set it from the command line or in your <code>.gitconfig</code></p> <pre><code>git config --global core.editor vim </code></pre>
<p>You can set it from the command line or in your <code>.gitconfig</code></p> <pre><code>git config --global core.editor vim </code></pre>
119, 370, 4072, 5025, 18209
editor, git, gnu, nano, vim
<h1>Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead?</h1> <p>I am trying to add a commit message to my changes using </p> <pre><code>git commit -a </code></pre> <p>OR just plain </p> <pre><code>git commit </code></pre> <p>this somehow opens GNU Nano 2.2.6 editor and I am not at all c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,317
git
# Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead? I am trying to add a commit message to my changes using ``` git commit -a ``` OR just plain ``` git commit ``` this somehow opens GNU Nano 2.2.6 editor and I am not at all comfortable with it. So the question is : > How can I modify ...
You can set it from the command line or in your `.gitconfig` ``` git config --global core.editor vim ```
26411075
PhpStorm default git author
17
2014-10-16 18:07:25
<p>In PhpStorm I am having difficulty setting the default git author in the project settings:</p> <p>I used the "Action finder" and searched through the settings, but I have not found this option.</p> <p>Does anyone know where I can change this value, so I don't have to change it on every commit?</p>
23,295
1,292,336
2024-05-30 14:17:54
26,525,799
37
2014-10-23 10:09:22
1,292,336
2018-01-31 09:28:18
https://stackoverflow.com/q/26411075
https://stackoverflow.com/a/26525799
<p>Thanks to the information given by Andrew I was able to find a solution:</p> <p>Go to your project folder \ .git \ config and add the lines below:</p> <pre><code>[user] name = Your Name email = name@domain.de </code></pre> <p>I hope this was helpful for other PhpStorm and git users.</p>
<p>Thanks to the information given by Andrew I was able to find a solution:</p> <p>Go to your project folder \ .git \ config and add the lines below:</p> <pre><code>[user] name = Your Name email = name@domain.de </code></pre> <p>I hope this was helpful for other PhpStorm and git users.</p>
119, 66821
git, phpstorm
<h1>PhpStorm default git author</h1> <p>In PhpStorm I am having difficulty setting the default git author in the project settings:</p> <p>I used the "Action finder" and searched through the settings, but I have not found this option.</p> <p>Does anyone know where I can change this value, so I don't have to change it ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,318
git
# PhpStorm default git author In PhpStorm I am having difficulty setting the default git author in the project settings: I used the "Action finder" and searched through the settings, but I have not found this option. Does anyone know where I can change this value, so I don't have to change it on every commit?
Thanks to the information given by Andrew I was able to find a solution: Go to your project folder \ .git \ config and add the lines below: ``` [user] name = Your Name email = name@domain.de ``` I hope this was helpful for other PhpStorm and git users.
19770873
How does .NET digital signing work?
15
2013-11-04 15:17:00
<p>I'm rather confused at how strong key signing for a .NET assembly works.. I signed with a strong name my .NET assembly by inserting a password and having a .pfx file generated... </p> <p>how is this supposed to protect my dll? Can someone explain this to me in simple terms? I'm a newbie with digital signing and you...
9,069
1,938,163
2013-11-04 17:24:09
19,772,095
37
2013-11-04 16:18:54
88,656
2013-11-04 17:24:09
https://stackoverflow.com/q/19770873
https://stackoverflow.com/a/19772095
<blockquote> <p>I'm a newbie with digital signing and you'll have to take a BIG step back to have me understand this</p> </blockquote> <p>Ok, let's take a big step back and ask some more basic questions then. I'll boldface every word that has a precise meaning.</p> <blockquote> <p>What is the purpose of a securit...
<blockquote> <p>I'm a newbie with digital signing and you'll have to take a BIG step back to have me understand this</p> </blockquote> <p>Ok, let's take a big step back and ask some more basic questions then. I'll boldface every word that has a precise meaning.</p> <blockquote> <p>What is the purpose of a securit...
9, 17782
c#, digital-signature
<h1>How does .NET digital signing work?</h1> <p>I'm rather confused at how strong key signing for a .NET assembly works.. I signed with a strong name my .NET assembly by inserting a password and having a .pfx file generated... </p> <p>how is this supposed to protect my dll? Can someone explain this to me in simple ter...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,320
git
# How does .NET digital signing work? I'm rather confused at how strong key signing for a .NET assembly works.. I signed with a strong name my .NET assembly by inserting a password and having a .pfx file generated... how is this supposed to protect my dll? Can someone explain this to me in simple terms? I'm a newbie ...
> I'm a newbie with digital signing and you'll have to take a BIG step back to have me understand this Ok, let's take a big step back and ask some more basic questions then. I'll boldface every word that has a precise meaning. > What is the purpose of a security system? To protect a **resource** (a pile of gold doub...
4249974
Personal GIT repository
15
2010-11-22 20:32:39
<p>I use BitKeeper at work, and I would like to have a basic code backup for myself at home (considering I back up very rarely)</p> <p>// I have never used git before so I need lots of help</p> <p>I thought it might be a good idea to have a git repository on my home server, and then as I write code for school, work o...
14,899
414,453
2010-11-22 20:50:34
4,250,079
37
2010-11-22 20:43:38
339,701
2010-11-22 20:50:34
https://stackoverflow.com/q/4249974
https://stackoverflow.com/a/4250079
<p>Git is great for version control and "backup" uses. If you want to access files from more than one computer, as you describe, the most pain-free way of getting a Git repository "up and running" is to use Github.com.</p> <p>Github.com provides free space to host public Git repositories (it's geared towards open sour...
<p>Git is great for version control and "backup" uses. If you want to access files from more than one computer, as you describe, the most pain-free way of getting a Git repository "up and running" is to use Github.com.</p> <p>Github.com provides free space to host public Git repositories (it's geared towards open sour...
119, 9608
git, organization
<h1>Personal GIT repository</h1> <p>I use BitKeeper at work, and I would like to have a basic code backup for myself at home (considering I back up very rarely)</p> <p>// I have never used git before so I need lots of help</p> <p>I thought it might be a good idea to have a git repository on my home server, and then a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,321
git
# Personal GIT repository I use BitKeeper at work, and I would like to have a basic code backup for myself at home (considering I back up very rarely) // I have never used git before so I need lots of help I thought it might be a good idea to have a git repository on my home server, and then as I write code for scho...
Git is great for version control and "backup" uses. If you want to access files from more than one computer, as you describe, the most pain-free way of getting a Git repository "up and running" is to use Github.com. Github.com provides free space to host public Git repositories (it's geared towards open source softwar...
6315459
Git command to save a stash without modifying working tree?
85
2011-06-11 10:51:26
<p>I have been wanting to use a git command that saves a stash without modifying my working tree, as a lightweight backup that's safe from any git resets or whatever I might do to screw up my index. Basically the functional equivalent of "git stash save &amp;&amp; git stash apply" except that the working copy is never ...
22,015
350,761
2025-09-24 05:52:53
6,318,570
36
2011-06-11 21:13:13
350,761
2025-01-15 07:40:54
https://stackoverflow.com/q/6315459
https://stackoverflow.com/a/6318570
<p>Thanks to Charles' tip, I whipped up a bash script to do exactly what I wanted (I was running into issues implementing this as only an alias). It takes an optional stash message just like git stash save. If none is supplied it will use the default message generated by git stash.</p> <h1>New Version</h1> <p>Inspired ...
<p>Thanks to Charles' tip, I whipped up a bash script to do exactly what I wanted (I was running into issues implementing this as only an alias). It takes an optional stash message just like git stash save. If none is supplied it will use the default message generated by git stash.</p> <h1>New Version</h1> <p>Inspired ...
119, 13091, 55168
git, git-stash, refs
<h1>Git command to save a stash without modifying working tree?</h1> <p>I have been wanting to use a git command that saves a stash without modifying my working tree, as a lightweight backup that's safe from any git resets or whatever I might do to screw up my index. Basically the functional equivalent of "git stash sa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,323
git
# Git command to save a stash without modifying working tree? I have been wanting to use a git command that saves a stash without modifying my working tree, as a lightweight backup that's safe from any git resets or whatever I might do to screw up my index. Basically the functional equivalent of "git stash save && git...
Thanks to Charles' tip, I whipped up a bash script to do exactly what I wanted (I was running into issues implementing this as only an alias). It takes an optional stash message just like git stash save. If none is supplied it will use the default message generated by git stash. # New Version Inspired by Mariusz's an...
2835775
Msysgit bash is horrendously slow in Windows 7
82
2010-05-14 16:21:37
<p>I love git and use it on OS X pretty much constantly at home. At work, we use svn on Windows, but want to migrate to git as soon as the tools have fully matured (not just <a href="http://code.google.com/p/tortoisegit/" rel="noreferrer">TortoiseGit</a>, but also something akin the really nice Visual Studio integrati...
46,510
103,058
2018-10-29 16:08:23
2,967,519
36
2010-06-03 15:42:02
103,058
2010-06-03 15:42:02
https://stackoverflow.com/q/2835775
https://stackoverflow.com/a/2967519
<p>The solution for slowness on Vista or 7 appears to be running Git Bash using <code>Run as administrator</code> (or disabling UAC for the Git Bash <a href="http://www.howtogeek.com/howto/windows-vista/always-start-an-application-in-administrator-mode-on-windows-vista/" rel="noreferrer">shortcut</a>...or disabling UAC...
<p>The solution for slowness on Vista or 7 appears to be running Git Bash using <code>Run as administrator</code> (or disabling UAC for the Git Bash <a href="http://www.howtogeek.com/howto/windows-vista/always-start-an-application-in-administrator-mode-on-windows-vista/" rel="noreferrer">shortcut</a>...or disabling UAC...
119, 21628, 34595
git, msysgit, windows-7
<h1>Msysgit bash is horrendously slow in Windows 7</h1> <p>I love git and use it on OS X pretty much constantly at home. At work, we use svn on Windows, but want to migrate to git as soon as the tools have fully matured (not just <a href="http://code.google.com/p/tortoisegit/" rel="noreferrer">TortoiseGit</a>, but als...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,325
git
# Msysgit bash is horrendously slow in Windows 7 I love git and use it on OS X pretty much constantly at home. At work, we use svn on Windows, but want to migrate to git as soon as the tools have fully matured (not just [TortoiseGit](http://code.google.com/p/tortoisegit/), but also something akin the really nice Visua...
The solution for slowness on Vista or 7 appears to be running Git Bash using `Run as administrator` (or disabling UAC for the Git Bash [shortcut](http://www.howtogeek.com/howto/windows-vista/always-start-an-application-in-administrator-mode-on-windows-vista/)...or disabling UAC *[entirely](http://www.howtogeek.com/howt...
13057457
Show both staged & working tree in git diff?
77
2012-10-24 20:46:24
<p>If I run <code>git diff</code> I see the changes in my working tree, and if I run <code>git diff --staged</code> (alternatively <code>--cached</code>) then I see the changes that are staged (w/ <code>git add</code>) but is there a way with <code>git diff</code> to see all in one go? </p>
39,245
337,446
2017-02-15 20:35:00
29,116,346
36
2015-03-18 07:30:06
6,309
2017-02-15 20:35:00
https://stackoverflow.com/q/13057457
https://stackoverflow.com/a/29116346
<blockquote> <p>Is there a way with git diff to see all in one go?</p> </blockquote> <p>There is, with Git 2.4.0+ (April 2015).</p> <p>See <a href="https://github.com/git/git/commit/40555000935147f56896e75b919b25f1f2d23aca" rel="noreferrer">commit 4055500</a> from <a href="https://github.com/mjg" rel="noreferrer">M...
<blockquote> <p>Is there a way with git diff to see all in one go?</p> </blockquote> <p>There is, with Git 2.4.0+ (April 2015).</p> <p>See <a href="https://github.com/git/git/commit/40555000935147f56896e75b919b25f1f2d23aca" rel="noreferrer">commit 4055500</a> from <a href="https://github.com/mjg" rel="noreferrer">M...
119, 606
diff, git
<h1>Show both staged & working tree in git diff?</h1> <p>If I run <code>git diff</code> I see the changes in my working tree, and if I run <code>git diff --staged</code> (alternatively <code>--cached</code>) then I see the changes that are staged (w/ <code>git add</code>) but is there a way with <code>git diff</code> t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,326
git
# Show both staged & working tree in git diff? If I run `git diff` I see the changes in my working tree, and if I run `git diff --staged` (alternatively `--cached`) then I see the changes that are staged (w/ `git add`) but is there a way with `git diff` to see all in one go?
> Is there a way with git diff to see all in one go? There is, with Git 2.4.0+ (April 2015). See [commit 4055500](https://github.com/git/git/commit/40555000935147f56896e75b919b25f1f2d23aca) from [Michael J Gruber `mjg`](https://github.com/mjg): > ### `commit`/`status`: show the index-worktree diff with `-v -v` (or `...
2119942
How to wrap git commit comments?
76
2010-01-22 19:39:26
<p>Is there a way to wrap git commit comments (when viewed via <code>git log</code>), so they are not cut off at the end of the line? It seems like there should be a pretty simple solution, but I haven't been able to find one.</p> <p>Thanks.</p>
38,032
152,650
2024-12-23 13:33:11
2,120,040
36
2010-01-22 19:51:53
6,309
2011-10-07 04:08:46
https://stackoverflow.com/q/2119942
https://stackoverflow.com/a/2120040
<p>Edit 2011: the <a href="https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/4345265#4345265">other</a> <a href="https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/6697519#6697519">answers</a> (upvoted) highlight the possibility to modify the options <a href="http://en...
<p>Edit 2011: the <a href="https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/4345265#4345265">other</a> <a href="https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/6697519#6697519">answers</a> (upvoted) highlight the possibility to modify the options <a href="http://en...
119
git
<h1>How to wrap git commit comments?</h1> <p>Is there a way to wrap git commit comments (when viewed via <code>git log</code>), so they are not cut off at the end of the line? It seems like there should be a pretty simple solution, but I haven't been able to find one.</p> <p>Thanks.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,327
git
# How to wrap git commit comments? Is there a way to wrap git commit comments (when viewed via `git log`), so they are not cut off at the end of the line? It seems like there should be a pretty simple solution, but I haven't been able to find one. Thanks.
Edit 2011: the [other](https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/4345265#4345265) [answers](https://stackoverflow.com/questions/2119942/how-to-wrap-git-commit-comments/6697519#6697519) (upvoted) highlight the possibility to modify the options [less](http://en.wikipedia.org/wiki/Less_%2...
6084483
What should I do when git revert aborts with an error message?
65
2011-05-21 21:13:43
<p>OK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is</p> <p><code>git revert &lt;commit hash&gt;</code></p> <p>and it gives me this message:</p> <pre><code>error: could not revert &lt;commit hash&gt; &lt;commit message&gt; hint: after resolving the conflicts, mark the c...
59,939
743,534
2018-08-01 06:32:10
6,084,535
36
2011-05-21 21:24:05
526,535
2011-05-21 21:29:06
https://stackoverflow.com/q/6084483
https://stackoverflow.com/a/6084535
<p>Yes you will have to resolve the conflicts, mark them as so with <code>git add</code> or <code>git rm</code> and <code>git commit</code></p> <p>The commit is not done yet, after the <code>git revert</code> - if you see .git/MERGE_MSG, you will see something like:</p> <blockquote> <p>Revert "adding revert"</p> ...
<p>Yes you will have to resolve the conflicts, mark them as so with <code>git add</code> or <code>git rm</code> and <code>git commit</code></p> <p>The commit is not done yet, after the <code>git revert</code> - if you see .git/MERGE_MSG, you will see something like:</p> <blockquote> <p>Revert "adding revert"</p> ...
119, 5597, 25165, 34403
commit, git, git-revert, mergetool
<h1>What should I do when git revert aborts with an error message?</h1> <p>OK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is</p> <p><code>git revert &lt;commit hash&gt;</code></p> <p>and it gives me this message:</p> <pre><code>error: could not revert &lt;commit hash&gt...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,328
git
# What should I do when git revert aborts with an error message? OK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is `git revert <commit hash>` and it gives me this message: ``` error: could not revert <commit hash> <commit message> hint: after resolving the conflicts, m...
Yes you will have to resolve the conflicts, mark them as so with `git add` or `git rm` and `git commit` The commit is not done yet, after the `git revert` - if you see .git/MERGE_MSG, you will see something like: > Revert "adding revert" > > This reverts commit > c1366607f15a8384434948cb0bcbf8ece48bb460. > > Conflict...
18222634
Given a git refname, can I detect whether it's a hash, tag, or branch?
54
2013-08-14 03:12:20
<p>I'm writing a script that will take in a specification used as the base for creating a branch. Thus, it will have something like this:</p> <pre><code>git checkout -b $newbranch $startingpoint </code></pre> <p>Now, <code>startingpoint</code> can be specified either as a branch name, a tag, or a SHA1.</p> <p>Later ...
9,584
150,447
2021-06-17 15:57:16
18,222,877
36
2013-08-14 03:49:18
147,356
2013-08-14 03:49:18
https://stackoverflow.com/q/18222634
https://stackoverflow.com/a/18222877
<p>You can probably use the <code>show-ref</code> command to do (mostly) what you want. Given some string, if it refers to a tag then...</p> <pre><code>git show-ref --verify refs/tags/$thestring </code></pre> <p>...will be true. If it's a branch name, then...</p> <pre><code>git show-ref --verify refs/heads/$thestr...
<p>You can probably use the <code>show-ref</code> command to do (mostly) what you want. Given some string, if it refers to a tag then...</p> <pre><code>git show-ref --verify refs/tags/$thestring </code></pre> <p>...will be true. If it's a branch name, then...</p> <pre><code>git show-ref --verify refs/heads/$thestr...
119
git
<h1>Given a git refname, can I detect whether it's a hash, tag, or branch?</h1> <p>I'm writing a script that will take in a specification used as the base for creating a branch. Thus, it will have something like this:</p> <pre><code>git checkout -b $newbranch $startingpoint </code></pre> <p>Now, <code>startingpoint</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,329
git
# Given a git refname, can I detect whether it's a hash, tag, or branch? I'm writing a script that will take in a specification used as the base for creating a branch. Thus, it will have something like this: ``` git checkout -b $newbranch $startingpoint ``` Now, `startingpoint` can be specified either as a branch na...
You can probably use the `show-ref` command to do (mostly) what you want. Given some string, if it refers to a tag then... ``` git show-ref --verify refs/tags/$thestring ``` ...will be true. If it's a branch name, then... ``` git show-ref --verify refs/heads/$thestring ``` ...will be true. If the string fails both ...
3532740
Do I ever need to run git gc on a bare repo?
47
2010-08-20 16:13:29
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer"><code>man git-gc</code></a> doesn't have an obvious answer in it, and I haven't had any luck with Google either (although I might have just been using the wrong search terms).</p> <p>I understand that you should occasionally run ...
21,073
126,042
2015-10-16 05:06:51
4,588,410
36
2011-01-03 21:11:29
126,042
2011-01-03 21:11:29
https://stackoverflow.com/q/3532740
https://stackoverflow.com/a/4588410
<p>As <a href="https://stackoverflow.com/users/119963/jefromi">Jefromi</a> commented on <a href="https://stackoverflow.com/questions/3532740/do-i-ever-need-to-run-git-gc-on-a-bare-repo/3533073#3533073">Dan's answer</a>, <code>git gc</code> <em>should</em> be called automatically called during "normal" use of a bare rep...
<p>As <a href="https://stackoverflow.com/users/119963/jefromi">Jefromi</a> commented on <a href="https://stackoverflow.com/questions/3532740/do-i-ever-need-to-run-git-gc-on-a-bare-repo/3533073#3533073">Dan's answer</a>, <code>git gc</code> <em>should</em> be called automatically called during "normal" use of a bare rep...
119, 44929
git, git-gc
<h1>Do I ever need to run git gc on a bare repo?</h1> <p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer"><code>man git-gc</code></a> doesn't have an obvious answer in it, and I haven't had any luck with Google either (although I might have just been using the wrong search terms).<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,331
git
# Do I ever need to run git gc on a bare repo? [`man git-gc`](http://www.kernel.org/pub/software/scm/git/docs/git-gc.html) doesn't have an obvious answer in it, and I haven't had any luck with Google either (although I might have just been using the wrong search terms). I understand that you should occasionally run `...
As [Jefromi](https://stackoverflow.com/users/119963/jefromi) commented on [Dan's answer](https://stackoverflow.com/questions/3532740/do-i-ever-need-to-run-git-gc-on-a-bare-repo/3533073#3533073), `git gc` *should* be called automatically called during "normal" use of a bare repository. I just ran `git gc --aggressive` ...
7805603
Is it possible for Jenkins to automatically detect and build newly created tags in a git repo?
46
2011-10-18 10:11:47
<p>It would be nice for our Jenkins CI server to automatically detect, deploy and build tags as they are created in our Github repository.</p> <p>Is this possible?</p>
31,093
48,611
2019-02-25 15:34:32
18,354,050
36
2013-08-21 09:43:42
1,523,648
2013-08-21 09:43:42
https://stackoverflow.com/q/7805603
https://stackoverflow.com/a/18354050
<p>With the following configuration, you can make a job build all tags:</p> <ol> <li>Make the job fetch tags as if they were branches: Click on the Advanced button below the repository URL and enter the Refspec <code>+refs/tags/*:refs/remotes/origin/tags/*</code></li> <li>Have it build all tag "branches" with the Bran...
<p>With the following configuration, you can make a job build all tags:</p> <ol> <li>Make the job fetch tags as if they were branches: Click on the Advanced button below the repository URL and enter the Refspec <code>+refs/tags/*:refs/remotes/origin/tags/*</code></li> <li>Have it build all tag "branches" with the Bran...
119, 64999
git, jenkins
<h1>Is it possible for Jenkins to automatically detect and build newly created tags in a git repo?</h1> <p>It would be nice for our Jenkins CI server to automatically detect, deploy and build tags as they are created in our Github repository.</p> <p>Is this possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,332
git
# Is it possible for Jenkins to automatically detect and build newly created tags in a git repo? It would be nice for our Jenkins CI server to automatically detect, deploy and build tags as they are created in our Github repository. Is this possible?
With the following configuration, you can make a job build all tags: 1. Make the job fetch tags as if they were branches: Click on the Advanced button below the repository URL and enter the Refspec `+refs/tags/*:refs/remotes/origin/tags/*` 2. Have it build all tag "branches" with the Branch Specifier `*/tags/*` 3. Ena...
42290133
Jenkins pipeline git command submodule update
42
2017-02-17 05:32:15
<p>I want to update submodule on git clone.</p> <p>Is there a way to do this with Jenkins pipeline Git command?</p> <p>Currently I'm doing this...</p> <pre><code>git branch: 'master', credentialsId: 'bitbucket', url: 'ssh://bitbucket.org/hello.git' </code></pre> <p>It doesn't however update submodule once c...
87,251
841,090
2022-03-07 19:19:02
42,290,216
36
2017-02-17 05:39:07
6,309
2022-03-07 19:19:02
https://stackoverflow.com/q/42290133
https://stackoverflow.com/a/42290216
<p>With the current <a href="https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin" rel="nofollow noreferrer">Git plugin</a>, you don't even need that.</p> <blockquote> <p>The Git plugin supports repositories with submodules which in turn have submodules themselves.<br /> This must be turned on though:</p> <p>in Job C...
<p>With the current <a href="https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin" rel="nofollow noreferrer">Git plugin</a>, you don't even need that.</p> <blockquote> <p>The Git plugin supports repositories with submodules which in turn have submodules themselves.<br /> This must be turned on though:</p> <p>in Job C...
119, 64999, 118285
git, jenkins, jenkins-pipeline
<h1>Jenkins pipeline git command submodule update</h1> <p>I want to update submodule on git clone.</p> <p>Is there a way to do this with Jenkins pipeline Git command?</p> <p>Currently I'm doing this...</p> <pre><code>git branch: 'master', credentialsId: 'bitbucket', url: 'ssh://bitbucket.org/hello.git' </cod...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,335
git
# Jenkins pipeline git command submodule update I want to update submodule on git clone. Is there a way to do this with Jenkins pipeline Git command? Currently I'm doing this... ``` git branch: 'master', credentialsId: 'bitbucket', url: 'ssh://bitbucket.org/hello.git' ``` It doesn't however update submodul...
With the current [Git plugin](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin), you don't even need that. > The Git plugin supports repositories with submodules which in turn have submodules themselves. > This must be turned on though: > > in Job Configuration -> Section Source Code Management, Git -> Advance...
4179842
Predict how much data will be pushed in a git push
41
2010-11-14 21:40:43
<p>I am occasionally on an expensive Internet connection and I would like to know (at least approximately) how much data will be pushed to the remote in a <code>git push</code>.</p>
15,314
11,125
2011-11-07 05:43:12
4,181,602
36
2010-11-15 05:18:20
119,963
2010-11-15 05:26:15
https://stackoverflow.com/q/4179842
https://stackoverflow.com/a/4181602
<p>Actually, I think I like my comment enough to post it as an answer!</p> <p>When you push, git creates a pack of all the necessary objects and uploads that to the remote. This means we're looking for a way to predict that pack size. Since the packs are compressed, that makes it very difficult to do anything based on...
<p>Actually, I think I like my comment enough to post it as an answer!</p> <p>When you push, git creates a pack of all the necessary objects and uploads that to the remote. This means we're looking for a way to predict that pack size. Since the packs are compressed, that makes it very difficult to do anything based on...
119, 5758, 28898
bandwidth, git, git-push
<h1>Predict how much data will be pushed in a git push</h1> <p>I am occasionally on an expensive Internet connection and I would like to know (at least approximately) how much data will be pushed to the remote in a <code>git push</code>.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,337
git
# Predict how much data will be pushed in a git push I am occasionally on an expensive Internet connection and I would like to know (at least approximately) how much data will be pushed to the remote in a `git push`.
Actually, I think I like my comment enough to post it as an answer! When you push, git creates a pack of all the necessary objects and uploads that to the remote. This means we're looking for a way to predict that pack size. Since the packs are compressed, that makes it very difficult to do anything based on diffs or ...
19928808
Deleted remote branches still listed in TortoiseGit
39
2013-11-12 12:09:59
<p>I have noticed TortoiseGit seems to contain every feature branch I ever created, both in drop-downs for local branches AND remote, even though many of the remote branches were deleted after being merged into master.</p> <p>Is there a way in TortoiseGit to synhronise which branches are listed to those actually exist...
16,974
197,229
2022-05-13 19:06:49
19,929,277
36
2013-11-12 12:32:29
6,309
2016-04-26 14:51:25
https://stackoverflow.com/q/19928808
https://stackoverflow.com/a/19929277
<p>You can do, as mentioned in <a href="https://gitlab.com/tortoisegit/tortoisegit/issues/1139" rel="noreferrer">issue 1139</a>, a <strong>Fetch with prune</strong>.<br> Or remove Remote Branch from list in Pull <a href="https://gitlab.com/tortoisegit/tortoisegit/issues/2765" rel="noreferrer">issue 2765</a>.</p> <p>Th...
<p>You can do, as mentioned in <a href="https://gitlab.com/tortoisegit/tortoisegit/issues/1139" rel="noreferrer">issue 1139</a>, a <strong>Fetch with prune</strong>.<br> Or remove Remote Branch from list in Pull <a href="https://gitlab.com/tortoisegit/tortoisegit/issues/2765" rel="noreferrer">issue 2765</a>.</p> <p>Th...
119, 31409
git, tortoisegit
<h1>Deleted remote branches still listed in TortoiseGit</h1> <p>I have noticed TortoiseGit seems to contain every feature branch I ever created, both in drop-downs for local branches AND remote, even though many of the remote branches were deleted after being merged into master.</p> <p>Is there a way in TortoiseGit to...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,339
git
# Deleted remote branches still listed in TortoiseGit I have noticed TortoiseGit seems to contain every feature branch I ever created, both in drop-downs for local branches AND remote, even though many of the remote branches were deleted after being merged into master. Is there a way in TortoiseGit to synhronise whic...
You can do, as mentioned in [issue 1139](https://gitlab.com/tortoisegit/tortoisegit/issues/1139), a **Fetch with prune**. Or remove Remote Branch from list in Pull [issue 2765](https://gitlab.com/tortoisegit/tortoisegit/issues/2765). That will clean-up any remote branches still locally referenced, while they are alr...
34295943
How to use Git correctly in Android Studio?
34
2015-12-15 17:43:02
<p>I know this is a much-discussed topic on stackoverflow, but I just can't figure out how to make this work. I would like to:</p> <ol> <li>create an Android Studio project</li> <li>check the project in with git</li> <li>push the project to bitbucket</li> <li>pull the project on a different computer</li> </ol> <p>Thi...
53,313
5,199,833
2019-01-02 08:32:59
34,296,225
36
2015-12-15 17:57:22
4,070,469
2019-01-02 08:32:59
https://stackoverflow.com/q/34295943
https://stackoverflow.com/a/34296225
<p>On the other computer you could try to import the project, instead of opening it. </p> <p>Actually, you <strong>don't</strong> have to commit project specific files to your git repo. Android Studio is smart enough to import a project from many different sources.</p> <blockquote> <p>With IntelliJ IDEA you can not...
<p>On the other computer you could try to import the project, instead of opening it. </p> <p>Actually, you <strong>don't</strong> have to commit project specific files to your git repo. Android Studio is smart enough to import a project from many different sources.</p> <blockquote> <p>With IntelliJ IDEA you can not...
119, 456, 1386, 91905
android, android-studio, git, version-control
<h1>How to use Git correctly in Android Studio?</h1> <p>I know this is a much-discussed topic on stackoverflow, but I just can't figure out how to make this work. I would like to:</p> <ol> <li>create an Android Studio project</li> <li>check the project in with git</li> <li>push the project to bitbucket</li> <li>pull t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,343
git
# How to use Git correctly in Android Studio? I know this is a much-discussed topic on stackoverflow, but I just can't figure out how to make this work. I would like to: 1. create an Android Studio project 2. check the project in with git 3. push the project to bitbucket 4. pull the project on a different computer T...
On the other computer you could try to import the project, instead of opening it. Actually, you **don't** have to commit project specific files to your git repo. Android Studio is smart enough to import a project from many different sources. > With IntelliJ IDEA you can not only create an Android project from > scrat...
20929689
Git commands not working in Mac terminal: "dyld: Symbol not found: ___strlcpy_chk" error
34
2014-01-05 03:27:36
<p>I am using the command git clone ssh://.... and getting the following error on the terminal:</p> <pre><code>dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk Referenced from: /usr/local/git/bin/git Expected in: /usr/lib/libSystem.B.dylib dyld: Symbol not found: ___strlcpy_chk Referenced from...
51,188
1,461,332
2017-09-12 17:44:53
20,930,186
36
2014-01-05 04:48:16
1,461,332
2014-10-07 13:48:13
https://stackoverflow.com/q/20929689
https://stackoverflow.com/a/20930186
<p>I needed to install command line tools from Xcode. To do so- </p> <ol> <li>Open Xcode and hit <code>Cmd</code>+<code>,</code> </li> <li>Click Downloads</li> <li>Install command line tools. </li> </ol> <p><a href="http://www.hongkiat.com/blog/mountain-lion-git-fix/">http://www.hongkiat.com/blog/mountain-lion-git-...
<p>I needed to install command line tools from Xcode. To do so- </p> <ol> <li>Open Xcode and hit <code>Cmd</code>+<code>,</code> </li> <li>Click Downloads</li> <li>Install command line tools. </li> </ol> <p><a href="http://www.hongkiat.com/blog/mountain-lion-git-fix/">http://www.hongkiat.com/blog/mountain-lion-git-...
119, 369, 391, 456, 3050
clone, git, macos, terminal, version-control
<h1>Git commands not working in Mac terminal: "dyld: Symbol not found: ___strlcpy_chk" error</h1> <p>I am using the command git clone ssh://.... and getting the following error on the terminal:</p> <pre><code>dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk Referenced from: /usr/local/git/bin/git ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,344
git
# Git commands not working in Mac terminal: "dyld: Symbol not found: ___strlcpy_chk" error I am using the command git clone ssh://.... and getting the following error on the terminal: ``` dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk Referenced from: /usr/local/git/bin/git Expected in: /usr/l...
I needed to install command line tools from Xcode. To do so- 1. Open Xcode and hit `Cmd`+`,` 2. Click Downloads 3. Install command line tools. <http://www.hongkiat.com/blog/mountain-lion-git-fix/>
527833
How to configure git to avoid accidental git push
34
2009-02-09 11:44:40
<p>After git clone, the config in the new repo looks like:</p> <pre><code>remote.origin.url=&lt;some url&gt; remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master </code></pre> <p>Then, I can execute "git pull" and "git push". But I'm interested in o...
12,435
16,135
2013-04-21 01:59:10
817,345
36
2009-05-03 15:46:18
27,067
2009-05-03 15:46:18
https://stackoverflow.com/q/527833
https://stackoverflow.com/a/817345
<p>Looks like</p> <pre><code>git config remote.origin.receivepack /bin/false </code></pre> <p>Makes push to remote origin fail.</p>
<p>Looks like</p> <pre><code>git config remote.origin.receivepack /bin/false </code></pre> <p>Makes push to remote origin fail.</p>
119
git
<h1>How to configure git to avoid accidental git push</h1> <p>After git clone, the config in the new repo looks like:</p> <pre><code>remote.origin.url=&lt;some url&gt; remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master </code></pre> <p>Then, I can...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,345
git
# How to configure git to avoid accidental git push After git clone, the config in the new repo looks like: ``` remote.origin.url=<some url> remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master ``` Then, I can execute "git pull" and "git push". But...
Looks like ``` git config remote.origin.receivepack /bin/false ``` Makes push to remote origin fail.
4423827
git says "fatal: confused by unstable object source data"
33
2010-12-12 20:24:10
<p>Just for fun, I am trying to put around 85GB of mostly-around-6MB binary files into git. Git chugs along for a while but invariably fails about halfway through with the message "fatal: confused by unstable object source data" followed by a SHA1. Do you know why? Is there any way to fix it?</p>
16,763
380,282
2020-10-08 15:51:03
4,424,525
36
2010-12-12 22:40:13
193,688
2010-12-12 22:47:43
https://stackoverflow.com/q/4423827
https://stackoverflow.com/a/4424525
<p>Either </p> <ul> <li>one or more files are being modified during your operation, or</li> <li>something is causing inconsistent reads (e.g. failing hardware).</li> </ul> <p>Short version: Git’s developers did not intend for it to be used on volatile files.</p> <p>Due to the layout<sup>*</sup> that Git uses for “l...
<p>Either </p> <ul> <li>one or more files are being modified during your operation, or</li> <li>something is causing inconsistent reads (e.g. failing hardware).</li> </ul> <p>Short version: Git’s developers did not intend for it to be used on volatile files.</p> <p>Due to the layout<sup>*</sup> that Git uses for “l...
119
git
<h1>git says "fatal: confused by unstable object source data"</h1> <p>Just for fun, I am trying to put around 85GB of mostly-around-6MB binary files into git. Git chugs along for a while but invariably fails about halfway through with the message "fatal: confused by unstable object source data" followed by a SHA1. Do y...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,348
git
# git says "fatal: confused by unstable object source data" Just for fun, I am trying to put around 85GB of mostly-around-6MB binary files into git. Git chugs along for a while but invariably fails about halfway through with the message "fatal: confused by unstable object source data" followed by a SHA1. Do you know w...
Either - one or more files are being modified during your operation, or - something is causing inconsistent reads (e.g. failing hardware). Short version: Git’s developers did not intend for it to be used on volatile files. Due to the layout* that Git uses for “loose objects” and the limited filesystem semantics that...
42026669
How to push to git subtree?
32
2017-02-03 14:36:53
<p>I added a subtree on git which seems to be working. I went into the directory and made some changes and then pushed. </p> <p>I noticed these changes show up in the parent project but the repository which I used as the source hasn't been updated.</p> <p>I tried <code>git subtree push</code> which returns:</p> <blo...
32,471
773,263
2022-04-05 03:59:34
42,027,940
36
2017-02-03 15:43:30
5,822,464
2017-02-03 15:43:30
https://stackoverflow.com/q/42026669
https://stackoverflow.com/a/42027940
<p>So, with some joint effort with @PhilipKirkbride, here's what we managed to figure out:</p> <p>You need to put all the details in the command:</p> <pre><code>git subtree push --prefix=my/folder subtree_origin master </code></pre> <p>Where <code>master</code> is the branch in the subtree, and <code>subtree_origin<...
<p>So, with some joint effort with @PhilipKirkbride, here's what we managed to figure out:</p> <p>You need to put all the details in the command:</p> <pre><code>git subtree push --prefix=my/folder subtree_origin master </code></pre> <p>Where <code>master</code> is the branch in the subtree, and <code>subtree_origin<...
119, 9844, 68200
git, git-subtree, subtree
<h1>How to push to git subtree?</h1> <p>I added a subtree on git which seems to be working. I went into the directory and made some changes and then pushed. </p> <p>I noticed these changes show up in the parent project but the repository which I used as the source hasn't been updated.</p> <p>I tried <code>git subtree...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,349
git
# How to push to git subtree? I added a subtree on git which seems to be working. I went into the directory and made some changes and then pushed. I noticed these changes show up in the parent project but the repository which I used as the source hasn't been updated. I tried `git subtree push` which returns: > You ...
So, with some joint effort with @PhilipKirkbride, here's what we managed to figure out: You need to put all the details in the command: ``` git subtree push --prefix=my/folder subtree_origin master ``` Where `master` is the branch in the subtree, and `subtree_origin` is just another remote, which happens to point to...
26107798
How to remove previously added git subtree and its history
32
2014-09-29 19:54:46
<p>Many moons ago I added a subtree to my <code>git</code> repository. This subtree included several folders and files. I added the subtree instead of creating a submodule (as recommended). Now I realize I only want one of the files in the subtree and none of the rest. Even worse, when others <code>clone</code> my repo...
45,752
633,318
2014-10-07 21:57:16
26,245,982
36
2014-10-07 21:57:16
4,021,077
2014-10-07 21:57:16
https://stackoverflow.com/q/26107798
https://stackoverflow.com/a/26245982
<p>You need to use a filter-branch along with the --prune-empty option to remove any commits that no longer introduce new changes.</p> <pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch -rf dir1 dir2 dirN file1 file2 fileN' --prune-empty -f HEAD </code></pre> <p>After that, if you want to r...
<p>You need to use a filter-branch along with the --prune-empty option to remove any commits that no longer introduce new changes.</p> <pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch -rf dir1 dir2 dirN file1 file2 fileN' --prune-empty -f HEAD </code></pre> <p>After that, if you want to r...
119, 68200
git, git-subtree
<h1>How to remove previously added git subtree and its history</h1> <p>Many moons ago I added a subtree to my <code>git</code> repository. This subtree included several folders and files. I added the subtree instead of creating a submodule (as recommended). Now I realize I only want one of the files in the subtree and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,350
git
# How to remove previously added git subtree and its history Many moons ago I added a subtree to my `git` repository. This subtree included several folders and files. I added the subtree instead of creating a submodule (as recommended). Now I realize I only want one of the files in the subtree and none of the rest. Ev...
You need to use a filter-branch along with the --prune-empty option to remove any commits that no longer introduce new changes. ``` git filter-branch --index-filter 'git rm --cached --ignore-unmatch -rf dir1 dir2 dirN file1 file2 fileN' --prune-empty -f HEAD ``` After that, if you want to recover disk space you will ...
29050251
How can I get git log to print the full hash and short stats of each commit on one line?
31
2015-03-14 14:51:11
<p>I would like to get this kind of output with git command line:</p> <pre><code>bcfd649de8850e3bfc9584eb12be8fe136ca6985 3 files changed, 8 insertions(+), 1 deletion(-) </code></pre> <p>I'm currently using <code>git log --shortstat --reverse --pretty=oneline</code>, but it's actually not a single line and the commen...
21,878
1,514,990
2024-06-10 08:50:13
71,905,303
36
2022-04-17 20:41:25
1,265,294
2024-06-10 08:50:13
https://stackoverflow.com/q/29050251
https://stackoverflow.com/a/71905303
<p>For anyone landing here for an answer to &quot;how to get git log one line full commit hash&quot;, as I did, there is a flag for the <code>git log</code> which prints the non-abbreviated commit hash.</p> <p>It's called <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---no-abbrev-commit" rel="noref...
<p>For anyone landing here for an answer to &quot;how to get git log one line full commit hash&quot;, as I did, there is a flag for the <code>git log</code> which prints the non-abbreviated commit hash.</p> <p>It's called <a href="https://git-scm.com/docs/git-log#Documentation/git-log.txt---no-abbrev-commit" rel="noref...
119, 245
format, git
<h1>How can I get git log to print the full hash and short stats of each commit on one line?</h1> <p>I would like to get this kind of output with git command line:</p> <pre><code>bcfd649de8850e3bfc9584eb12be8fe136ca6985 3 files changed, 8 insertions(+), 1 deletion(-) </code></pre> <p>I'm currently using <code>git log...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,351
git
# How can I get git log to print the full hash and short stats of each commit on one line? I would like to get this kind of output with git command line: ``` bcfd649de8850e3bfc9584eb12be8fe136ca6985 3 files changed, 8 insertions(+), 1 deletion(-) ``` I'm currently using `git log --shortstat --reverse --pretty=onelin...
For anyone landing here for an answer to "how to get git log one line full commit hash", as I did, there is a flag for the `git log` which prints the non-abbreviated commit hash. It's called [--no-abbrev-commit](https://git-scm.com/docs/git-log#Documentation/git-log.txt---no-abbrev-commit). Documentation reads as: > ...
22582605
git merge branches with different directory structures
31
2014-03-22 19:42:14
<p>I am somewhat new to git, I've been using it for a number of months, and Im comfortable doing most of the basic tasks. So... I think its time to take on some more complicated tasks. At my work, we have a few people working on older code to update it, this involves actual code work and updating the directory structu...
16,155
2,774,483
2014-09-26 22:27:30
22,583,112
36
2014-03-22 20:24:38
1,256,452
2014-09-26 22:27:30
https://stackoverflow.com/q/22582605
https://stackoverflow.com/a/22583112
<p>First, a short note: you can always <em>try</em> a merge, then back it out, to see what it does:</p> <pre><code>$ git checkout master Switched to branch 'master' $ git status </code></pre> <p>(make sure it's clean—backing out of a failed merge when there's changes is not fun)</p> <pre><code>$ git merge feature </...
<p>First, a short note: you can always <em>try</em> a merge, then back it out, to see what it does:</p> <pre><code>$ git checkout master Switched to branch 'master' $ git status </code></pre> <p>(make sure it's clean—backing out of a failed merge when there's changes is not fun)</p> <pre><code>$ git merge feature </...
119, 717
git, merge
<h1>git merge branches with different directory structures</h1> <p>I am somewhat new to git, I've been using it for a number of months, and Im comfortable doing most of the basic tasks. So... I think its time to take on some more complicated tasks. At my work, we have a few people working on older code to update it, t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,353
git
# git merge branches with different directory structures I am somewhat new to git, I've been using it for a number of months, and Im comfortable doing most of the basic tasks. So... I think its time to take on some more complicated tasks. At my work, we have a few people working on older code to update it, this involv...
First, a short note: you can always *try* a merge, then back it out, to see what it does: ``` $ git checkout master Switched to branch 'master' $ git status ``` (make sure it's clean—backing out of a failed merge when there's changes is not fun) ``` $ git merge feature ``` If the merge fails: ``` $ git merge --abo...
45119932
Why does git sign with GPG keys rather than using SSH keys?
29
2017-07-15 15:38:35
<p>What are the differences between SSH and GPG asymmetric keys and why does git support signing with GPG rather than using the SSH agent?</p>
14,867
2,203,727
2023-11-25 20:04:07
45,120,525
36
2017-07-15 16:39:51
6,309
2023-11-25 20:04:07
https://stackoverflow.com/q/45119932
https://stackoverflow.com/a/45120525
<p><a href="https://stackoverflow.com/a/73652125/6309">Update Sept. 2022</a>: 1Password supports generating and storing an SSH key for Git commit signature, recognized by GitHub.</p> <hr /> <p>Update 2021:</p> <p>OpenSSH 8.2+ is available (packaged for instance in <a href="https://github.com/git-for-windows/git/release...
<p><a href="https://stackoverflow.com/a/73652125/6309">Update Sept. 2022</a>: 1Password supports generating and storing an SSH key for Git commit signature, recognized by GitHub.</p> <hr /> <p>Update 2021:</p> <p>OpenSSH 8.2+ is available (packaged for instance in <a href="https://github.com/git-for-windows/git/release...
119, 17782, 25308, 57931, 122019
digital-signature, git, gpg-signature, public-key, ssh-keys
<h1>Why does git sign with GPG keys rather than using SSH keys?</h1> <p>What are the differences between SSH and GPG asymmetric keys and why does git support signing with GPG rather than using the SSH agent?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,355
git
# Why does git sign with GPG keys rather than using SSH keys? What are the differences between SSH and GPG asymmetric keys and why does git support signing with GPG rather than using the SSH agent?
[Update Sept. 2022](https://stackoverflow.com/a/73652125/6309): 1Password supports generating and storing an SSH key for Git commit signature, recognized by GitHub. --- Update 2021: OpenSSH 8.2+ is available (packaged for instance in [Git For Windows 2.33.1](https://github.com/git-for-windows/git/releases/tag/v2.33....
9951939
Git: Is there an equivalent to hg strip?
29
2012-03-31 00:27:26
<p>I have a repo where I made a change that is causing merge hell and I'd like to pretend it never existed. Long, complicated story involving splicing a pre-existing repo on top of one that is updated via git-p4, but the upshot is I really, really want git to pretend a certain change never existed.</p> <p>If it were M...
9,307
243,676
2017-07-26 14:58:48
10,374,024
36
2012-04-29 16:59:33
59,961
2012-04-29 16:59:33
https://stackoverflow.com/q/9951939
https://stackoverflow.com/a/10374024
<p>There is more than one command that you need to do. The first, as other people have mentioned, is <code>git reset</code>. You'll want to find the changeset just <em>before</em> the one you want to get rid of, and use</p> <pre><code>git reset --hard &lt;changeset&gt; </code></pre> <p>This will change the current ...
<p>There is more than one command that you need to do. The first, as other people have mentioned, is <code>git reset</code>. You'll want to find the changeset just <em>before</em> the one you want to get rid of, and use</p> <pre><code>git reset --hard &lt;changeset&gt; </code></pre> <p>This will change the current ...
119, 802, 55021
git, git-p4, mercurial
<h1>Git: Is there an equivalent to hg strip?</h1> <p>I have a repo where I made a change that is causing merge hell and I'd like to pretend it never existed. Long, complicated story involving splicing a pre-existing repo on top of one that is updated via git-p4, but the upshot is I really, really want git to pretend a ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,356
git
# Git: Is there an equivalent to hg strip? I have a repo where I made a change that is causing merge hell and I'd like to pretend it never existed. Long, complicated story involving splicing a pre-existing repo on top of one that is updated via git-p4, but the upshot is I really, really want git to pretend a certain c...
There is more than one command that you need to do. The first, as other people have mentioned, is `git reset`. You'll want to find the changeset just *before* the one you want to get rid of, and use ``` git reset --hard <changeset> ``` This will change the current branch head (and the index) to point at that changese...
5953767
Git: want to iterate through all commits on branch, and list files in each commit
29
2011-05-10 17:11:21
<p>I need to write a script that will</p> <ol> <li>iterate through all of the commits on a branch, starting from the most recent</li> <li>for each commit, iterate through all of the files in the commit</li> <li>if it finds a file of type hbm.xml, store the commit to file and exit.</li> </ol> <p>I have a script for st...
18,316
244,005
2023-09-18 11:36:20
5,953,868
36
2011-05-10 17:20:32
19,563
2023-09-18 11:36:20
https://stackoverflow.com/q/5953767
https://stackoverflow.com/a/5953868
<p>Something like:</p> <pre><code>branch=master for commit in $(git rev-list $branch) do if git ls-tree --name-only -r $commit | grep -q '\.hbm\.xml$'; then echo $commit exit 0 fi done </code></pre> <p>Note that <code>git show</code> will only list files which have changed in that commit, if you...
<p>Something like:</p> <pre><code>branch=master for commit in $(git rev-list $branch) do if git ls-tree --name-only -r $commit | grep -q '\.hbm\.xml$'; then echo $commit exit 0 fi done </code></pre> <p>Note that <code>git show</code> will only list files which have changed in that commit, if you...
119
git
<h1>Git: want to iterate through all commits on branch, and list files in each commit</h1> <p>I need to write a script that will</p> <ol> <li>iterate through all of the commits on a branch, starting from the most recent</li> <li>for each commit, iterate through all of the files in the commit</li> <li>if it finds a fil...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,357
git
# Git: want to iterate through all commits on branch, and list files in each commit I need to write a script that will 1. iterate through all of the commits on a branch, starting from the most recent 2. for each commit, iterate through all of the files in the commit 3. if it finds a file of type hbm.xml, store the co...
Something like: ``` branch=master for commit in $(git rev-list $branch) do if git ls-tree --name-only -r $commit | grep -q '\.hbm\.xml$'; then echo $commit exit 0 fi done ``` Note that `git show` will only list files which have changed in that commit, if you want to know whether there is a pat...
40677476
git cherry-pick --continue, '--no-edit' option?
28
2016-11-18 12:43:58
<p>I'm writing a script for migrating git repos. On cherry-pick conflicts I run</p> <pre><code>git add . git cherry-pick --continue </code></pre> <p>This brings up vim, prompting me to save the commit message and freezes the script. I am looking for a command-line option like <code>--no-edit</code> or <code>--porcela...
14,062
4,237,316
2024-01-13 09:45:41
40,687,125
36
2016-11-18 22:50:17
1,256,452
2016-11-18 22:50:17
https://stackoverflow.com/q/40677476
https://stackoverflow.com/a/40687125
<p>As <a href="https://stackoverflow.com/a/40679209/1256452">Zildyan said in his answer</a>, you will need to <em>resolve</em> all the conflicts before doing <code>git add</code>. Therefore, you <em>should not</em> make this fully automated.</p> <p>That said, to skip editing the commit <em>message</em>, you can simpl...
<p>As <a href="https://stackoverflow.com/a/40679209/1256452">Zildyan said in his answer</a>, you will need to <em>resolve</em> all the conflicts before doing <code>git add</code>. Therefore, you <em>should not</em> make this fully automated.</p> <p>That said, to skip editing the commit <em>message</em>, you can simpl...
119, 78810
git, git-cherry-pick
<h1>git cherry-pick --continue, '--no-edit' option?</h1> <p>I'm writing a script for migrating git repos. On cherry-pick conflicts I run</p> <pre><code>git add . git cherry-pick --continue </code></pre> <p>This brings up vim, prompting me to save the commit message and freezes the script. I am looking for a command-l...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,358
git
# git cherry-pick --continue, '--no-edit' option? I'm writing a script for migrating git repos. On cherry-pick conflicts I run ``` git add . git cherry-pick --continue ``` This brings up vim, prompting me to save the commit message and freezes the script. I am looking for a command-line option like `--no-edit` or `-...
As [Zildyan said in his answer](https://stackoverflow.com/a/40679209/1256452), you will need to *resolve* all the conflicts before doing `git add`. Therefore, you *should not* make this fully automated. That said, to skip editing the commit *message*, you can simply set your editor to a command that does nothing and r...
39517456
Right way to merge master into dev branch
28
2016-09-15 17:55:51
<p>When I have ongoing changes at <code>dev</code> branch, and something breaks in production environment, then I switch to <code>master</code>, fix the problem and synchronize the production environment with the <code>master</code> branch.</p> <p>Now I return to <code>dev</code> branch. This branch is synchronized wi...
52,469
2,094,178
2016-09-15 18:06:47
39,517,516
36
2016-09-15 18:00:04
1,079,354
2016-09-15 18:06:47
https://stackoverflow.com/q/39517456
https://stackoverflow.com/a/39517516
<p>Provided that your staging environment is clean (as in, you don't have any uncommitted or unstashed changes on your development branch)...</p> <pre><code>git merge master </code></pre> <p>...is the idiomatic* way to merge changes from your master branch in.</p> <p>When you merge, you bring in all of the changes w...
<p>Provided that your staging environment is clean (as in, you don't have any uncommitted or unstashed changes on your development branch)...</p> <pre><code>git merge master </code></pre> <p>...is the idiomatic* way to merge changes from your master branch in.</p> <p>When you merge, you bring in all of the changes w...
119
git
<h1>Right way to merge master into dev branch</h1> <p>When I have ongoing changes at <code>dev</code> branch, and something breaks in production environment, then I switch to <code>master</code>, fix the problem and synchronize the production environment with the <code>master</code> branch.</p> <p>Now I return to <cod...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,359
git
# Right way to merge master into dev branch When I have ongoing changes at `dev` branch, and something breaks in production environment, then I switch to `master`, fix the problem and synchronize the production environment with the `master` branch. Now I return to `dev` branch. This branch is synchronized with `test`...
Provided that your staging environment is clean (as in, you don't have any uncommitted or unstashed changes on your development branch)... ``` git merge master ``` ...is the idiomatic* way to merge changes from your master branch in. When you merge, you bring in all of the changes which are at the tip of that branch...
23848845
How can I download a new remote branch without merging?
28
2014-05-24 19:26:42
<p>I've been working on the master branch in my Git repository for a while. It's hosted on GitHub and cloned on two of my computers. Now I started a new branch on one computer and pushed it to GitHub. Now they know both branches, but the other computer still only knows about the master branch, not the feature branch.</...
33,368
143,684
2014-05-24 19:28:48
23,848,860
36
2014-05-24 19:28:48
2,083,544
2014-05-24 19:28:48
https://stackoverflow.com/q/23848845
https://stackoverflow.com/a/23848860
<p>You can do <code>git fetch origin</code> on the command line. This will update your local copy so that it knows about the new branch. Then, if you want to checkout the new branch, simply <code>git checkout BRANCHNAME</code> should track the remote.</p>
<p>You can do <code>git fetch origin</code> on the command line. This will update your local copy so that it knows about the new branch. Then, if you want to checkout the new branch, simply <code>git checkout BRANCHNAME</code> should track the remote.</p>
119
git
<h1>How can I download a new remote branch without merging?</h1> <p>I've been working on the master branch in my Git repository for a while. It's hosted on GitHub and cloned on two of my computers. Now I started a new branch on one computer and pushed it to GitHub. Now they know both branches, but the other computer st...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,360
git
# How can I download a new remote branch without merging? I've been working on the master branch in my Git repository for a while. It's hosted on GitHub and cloned on two of my computers. Now I started a new branch on one computer and pushed it to GitHub. Now they know both branches, but the other computer still only ...
You can do `git fetch origin` on the command line. This will update your local copy so that it knows about the new branch. Then, if you want to checkout the new branch, simply `git checkout BRANCHNAME` should track the remote.
3557014
What is the opposite of `git diff HEAD^`?
28
2010-08-24 13:37:38
<p>In git, I can specify the previous revision by saying <code>HEAD^</code> or <code>HEAD~1</code>. What about going the other way? Suppose I'm on revision X, and I do <code>git checkout X^</code>. How do I go back?</p> <p>Something like <code>git checkout X+</code>?</p>
10,907
104,021
2022-07-21 13:12:51
3,557,291
36
2010-08-24 14:06:09
119,963
2020-01-23 07:09:32
https://stackoverflow.com/q/3557014
https://stackoverflow.com/a/3557291
<p>You can't really do precisely that. History in git is a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="nofollow noreferrer">directed acyclic graph</a> - each commit contains references to its parents, but parents don't have references to their children.</p> <p>The problem here should become obv...
<p>You can't really do precisely that. History in git is a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="nofollow noreferrer">directed acyclic graph</a> - each commit contains references to its parents, but parents don't have references to their children.</p> <p>The problem here should become obv...
119
git
<h1>What is the opposite of `git diff HEAD^`?</h1> <p>In git, I can specify the previous revision by saying <code>HEAD^</code> or <code>HEAD~1</code>. What about going the other way? Suppose I'm on revision X, and I do <code>git checkout X^</code>. How do I go back?</p> <p>Something like <code>git checkout X+</code>?<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,361
git
# What is the opposite of `git diff HEAD^`? In git, I can specify the previous revision by saying `HEAD^` or `HEAD~1`. What about going the other way? Suppose I'm on revision X, and I do `git checkout X^`. How do I go back? Something like `git checkout X+`?
You can't really do precisely that. History in git is a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) - each commit contains references to its parents, but parents don't have references to their children. The problem here should become obvious when you think about a commit you created ...
16113240
Git allowing me to switch branches without committing changes
27
2013-04-19 20:47:32
<p>I am just learning Git, going through a tutorial. I am in branch seo_title and I have uncommitted changes to file mission.html. I did <code>git checkout master</code> expecting to get the warning about Changes not staged for commit, no changes added, etc, however instead it went ahead and switched branches with the ...
27,118
1,380,555
2013-10-18 18:36:17
16,113,523
36
2013-04-19 21:09:05
2,102,283
2013-04-20 10:50:15
https://stackoverflow.com/q/16113240
https://stackoverflow.com/a/16113523
<p>The different behaviour you saw from the last time you tried to switch branches with local changes and now is due to different file changes.</p> <p>So, let's say we have a branch called 'readme' where you have committed some changes to a file, let's say README.md. </p> <p>Now, you have switched back to master. You...
<p>The different behaviour you saw from the last time you tried to switch branches with local changes and now is due to different file changes.</p> <p>So, let's say we have a branch called 'readme' where you have committed some changes to a file, let's say README.md. </p> <p>Now, you have switched back to master. You...
119
git
<h1>Git allowing me to switch branches without committing changes</h1> <p>I am just learning Git, going through a tutorial. I am in branch seo_title and I have uncommitted changes to file mission.html. I did <code>git checkout master</code> expecting to get the warning about Changes not staged for commit, no changes ad...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,363
git
# Git allowing me to switch branches without committing changes I am just learning Git, going through a tutorial. I am in branch seo_title and I have uncommitted changes to file mission.html. I did `git checkout master` expecting to get the warning about Changes not staged for commit, no changes added, etc, however in...
The different behaviour you saw from the last time you tried to switch branches with local changes and now is due to different file changes. So, let's say we have a branch called 'readme' where you have committed some changes to a file, let's say README.md. Now, you have switched back to master. You do some work on o...
15954631
git - changes to branch since created?
27
2013-04-11 16:59:08
<p>I'm always asking myself a set of questions about branches I've created that I've yet to determine how to accomplish:</p> <ol> <li>What files did I change in a branch?</li> <li>What are the actual changes (diff) I made to the branch?</li> <li>What is the log of commits I made to the branch?</li> </ol> <p>Now I think...
16,969
127,954
2026-01-16 03:59:32
15,955,008
36
2013-04-11 17:20:31
1,290,731
2013-04-11 17:20:31
https://stackoverflow.com/q/15954631
https://stackoverflow.com/a/15955008
<p>To find where your current checkout diverged from the master branch,</p> <pre><code>base=`git merge-base master HEAD` echo $base </code></pre> <p>to find out what files have been changed since then,</p> <pre><code>git diff --name-only $base HEAD </code></pre> <p>to show the accumulated difference</p> <pre><code...
<p>To find where your current checkout diverged from the master branch,</p> <pre><code>base=`git merge-base master HEAD` echo $base </code></pre> <p>to find out what files have been changed since then,</p> <pre><code>git diff --name-only $base HEAD </code></pre> <p>to show the accumulated difference</p> <pre><code...
119, 1879, 21628
branch, git, msysgit
<h1>git - changes to branch since created?</h1> <p>I'm always asking myself a set of questions about branches I've created that I've yet to determine how to accomplish:</p> <ol> <li>What files did I change in a branch?</li> <li>What are the actual changes (diff) I made to the branch?</li> <li>What is the log of commits...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,364
git
# git - changes to branch since created? I'm always asking myself a set of questions about branches I've created that I've yet to determine how to accomplish: 1. What files did I change in a branch? 2. What are the actual changes (diff) I made to the branch? 3. What is the log of commits I made to the branch? Now I ...
To find where your current checkout diverged from the master branch, ``` base=`git merge-base master HEAD` echo $base ``` to find out what files have been changed since then, ``` git diff --name-only $base HEAD ``` to show the accumulated difference ``` git diff $base HEAD ``` When you want to describe an entire ...
17226117
git show <commit> --oneline not showing oneline
26
2013-06-21 00:52:02
<p>I am using version 1.8.3 of mysysgit and it seems that the --oneline command does not give me just one line per commit, I get all of the diff lines as well.</p> <pre><code>git show HEAD --oneline </code></pre> <p>and even <code>git show HEAD --pretty="%h %s"</code></p> <p>do not give just one line.</p> <p>(note:...
10,615
10,387
2019-07-07 03:19:57
56,919,110
36
2019-07-07 03:19:57
11,749,349
2019-07-07 03:19:57
https://stackoverflow.com/q/17226117
https://stackoverflow.com/a/56919110
<p>I think this'll do what you want <code>git show --no-patch --oneline</code></p>
<p>I think this'll do what you want <code>git show --no-patch --oneline</code></p>
119, 21628
git, msysgit
<h1>git show <commit> --oneline not showing oneline</h1> <p>I am using version 1.8.3 of mysysgit and it seems that the --oneline command does not give me just one line per commit, I get all of the diff lines as well.</p> <pre><code>git show HEAD --oneline </code></pre> <p>and even <code>git show HEAD --pretty="%h %s"...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,365
git
# git show --oneline not showing oneline I am using version 1.8.3 of mysysgit and it seems that the --oneline command does not give me just one line per commit, I get all of the diff lines as well. ``` git show HEAD --oneline ``` and even `git show HEAD --pretty="%h %s"` do not give just one line. (note: same resu...
I think this'll do what you want `git show --no-patch --oneline`
33402589
Does a git pull update all tracked branches?
26
2015-10-28 22:20:33
<p>Say I'm locally tracking 3 remote branches, <code>master</code>, <code>branch1</code>, <code>branch2</code>.</p> <p>If I'm currently on the <code>master</code> branch, will a <code>git pull</code> <code>fetch</code> and <code>merge</code> changes on each of the branches?</p> <p>I guess I could build out an experim...
21,474
476,410
2022-12-22 04:33:55
33,403,086
36
2015-10-28 23:02:02
1,256,452
2020-11-11 07:08:16
https://stackoverflow.com/q/33402589
https://stackoverflow.com/a/33403086
<p>The short answer is &quot;no&quot;—or maybe even &quot;no and yes&quot;, if one reads only the title of your question—but this is somewhat misleading.</p> <p>The pull command allows options, and many of these have interesting (and confusing and potentially very un-nice) effects.</p> <blockquote> <p><strong>Sidebar:<...
<p>The short answer is &quot;no&quot;—or maybe even &quot;no and yes&quot;, if one reads only the title of your question—but this is somewhat misleading.</p> <p>The pull command allows options, and many of these have interesting (and confusing and potentially very un-nice) effects.</p> <blockquote> <p><strong>Sidebar:<...
119
git
<h1>Does a git pull update all tracked branches?</h1> <p>Say I'm locally tracking 3 remote branches, <code>master</code>, <code>branch1</code>, <code>branch2</code>.</p> <p>If I'm currently on the <code>master</code> branch, will a <code>git pull</code> <code>fetch</code> and <code>merge</code> changes on each of the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,366
git
# Does a git pull update all tracked branches? Say I'm locally tracking 3 remote branches, `master`, `branch1`, `branch2`. If I'm currently on the `master` branch, will a `git pull` `fetch` and `merge` changes on each of the branches? I guess I could build out an experiment, too...
The short answer is "no"—or maybe even "no and yes", if one reads only the title of your question—but this is somewhat misleading. The pull command allows options, and many of these have interesting (and confusing and potentially very un-nice) effects. > **Sidebar:** Make sure you correctly understand the [difference...
14380053
Renaming git tags results in inconsistency
26
2013-01-17 13:20:30
<p>After renaming a git tag "1.0" to "1.5" with</p> <pre><code>git tag 1.5 1.0 git tag -d 1.0 git push origin :refs/tags/1.0 </code></pre> <p>my git repository seems to be in an inconsistent state. Here is the <code>git describe</code> output:</p> <pre><code>warning: tag '1.0' is really '1.5' here 1.0-97-g88085b2 </...
6,053
321,106
2019-03-11 22:20:34
25,672,982
36
2014-09-04 18:49:39
1,906,307
2014-09-04 18:49:39
https://stackoverflow.com/q/14380053
https://stackoverflow.com/a/25672982
<p>I've run into the same issue a few minutes ago. None of the answers already presented dealt with the <strong>real issue</strong> which is getting rid of the message <code>warning: tag 'foo' is really 'bar' here</code> and getting <code>git describe</code> to just list the new name of the tag. This was especially imp...
<p>I've run into the same issue a few minutes ago. None of the answers already presented dealt with the <strong>real issue</strong> which is getting rid of the message <code>warning: tag 'foo' is really 'bar' here</code> and getting <code>git describe</code> to just list the new name of the tag. This was especially imp...
119, 60718
git, git-tag
<h1>Renaming git tags results in inconsistency</h1> <p>After renaming a git tag "1.0" to "1.5" with</p> <pre><code>git tag 1.5 1.0 git tag -d 1.0 git push origin :refs/tags/1.0 </code></pre> <p>my git repository seems to be in an inconsistent state. Here is the <code>git describe</code> output:</p> <pre><code>warnin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,367
git
# Renaming git tags results in inconsistency After renaming a git tag "1.0" to "1.5" with ``` git tag 1.5 1.0 git tag -d 1.0 git push origin :refs/tags/1.0 ``` my git repository seems to be in an inconsistent state. Here is the `git describe` output: ``` warning: tag '1.0' is really '1.5' here 1.0-97-g88085b2 ``` ...
I've run into the same issue a few minutes ago. None of the answers already presented dealt with the **real issue** which is getting rid of the message `warning: tag 'foo' is really 'bar' here` and getting `git describe` to just list the new name of the tag. This was especially important in my case, as my build system ...
8901973
Why "git push" is rejected? ("git pull" doesn't help)
26
2012-01-17 21:28:43
<p>My current branch is <code>my_branch</code>. Trying to push the changes to the remote repo I get:</p> <pre><code>$ git push Counting objects: 544, done. Delta compression using up to 4 threads. Compressing objects: 100% (465/465), done. Writing objects: 100% (533/533), 2.04 MiB | 1.16 MiB/s, done. Total 533 (delta ...
106,771
247,243
2024-03-03 21:08:19
8,901,994
36
2012-01-17 21:30:37
229,044
2012-01-17 21:36:37
https://stackoverflow.com/q/8901973
https://stackoverflow.com/a/8901994
<blockquote> <p>My current branch is my_branch.</p> </blockquote> <p>That is your problem. When you pull, Git is telling you that your branch <code>my_branch</code> is up to date, <em>not</em> <code>master</code>, which is behind <code>origin/master</code> making a fast-forward merge impossible. </p> <p>In order to...
<blockquote> <p>My current branch is my_branch.</p> </blockquote> <p>That is your problem. When you pull, Git is telling you that your branch <code>my_branch</code> is up to date, <em>not</em> <code>master</code>, which is behind <code>origin/master</code> making a fast-forward merge impossible. </p> <p>In order to...
119, 28898
git, git-push
<h1>Why "git push" is rejected? ("git pull" doesn't help)</h1> <p>My current branch is <code>my_branch</code>. Trying to push the changes to the remote repo I get:</p> <pre><code>$ git push Counting objects: 544, done. Delta compression using up to 4 threads. Compressing objects: 100% (465/465), done. Writing objects:...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,369
git
# Why "git push" is rejected? ("git pull" doesn't help) My current branch is `my_branch`. Trying to push the changes to the remote repo I get: ``` $ git push Counting objects: 544, done. Delta compression using up to 4 threads. Compressing objects: 100% (465/465), done. Writing objects: 100% (533/533), 2.04 MiB | 1.1...
> My current branch is my_branch. That is your problem. When you pull, Git is telling you that your branch `my_branch` is up to date, *not* `master`, which is behind `origin/master` making a fast-forward merge impossible. In order to push master, you need to check out `master` and pull. This will merge in the changes...
24903259
How to control SimpleDateFormat parse to 19xx or 20xx?
25
2014-07-23 06:24:27
<p>Is there a way to parse the following date string as <code>July 23 1916</code> rather than <code>July 23 2016</code>?</p> <pre><code>System.out.println(new SimpleDateFormat("yy/MM/dd", Locale.US).parse("16/07/23")); </code></pre>
5,000
3,867,309
2024-12-13 21:49:02
24,903,317
36
2014-07-23 06:28:59
133,645
2014-07-23 06:28:59
https://stackoverflow.com/q/24903259
https://stackoverflow.com/a/24903317
<p>The Java Doc (<a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html</a>) says:</p> <blockquote> <p>For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year...
<p>The Java Doc (<a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html</a>) says:</p> <blockquote> <p>For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year...
17, 5002, 8016, 9562, 35201
2-digit-year, date, java, java-dateformat, simpledateformat
<h1>How to control SimpleDateFormat parse to 19xx or 20xx?</h1> <p>Is there a way to parse the following date string as <code>July 23 1916</code> rather than <code>July 23 2016</code>?</p> <pre><code>System.out.println(new SimpleDateFormat("yy/MM/dd", Locale.US).parse("16/07/23")); </code></pre>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,370
git
# How to control SimpleDateFormat parse to 19xx or 20xx? Is there a way to parse the following date string as `July 23 1916` rather than `July 23 2016`? ``` System.out.println(new SimpleDateFormat("yy/MM/dd", Locale.US).parse("16/07/23")); ```
The Java Doc (<http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html>) says: > For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by *adjusting dates to be within 80 years before and 20 years after ...
47792846
What is "ours" and "their" while doing git rebase
24
2017-12-13 12:17:04
<p>I have applied the following commands, but have little confusion in doing rebase - what is ours and theirs in the following commands</p> <pre><code>git checkout app/dashboard-sprint-5 git rebase app/demandware </code></pre> <p>I know the current branch is <code>app/dashboard-sprint-5</code> and when i apply the re...
12,590
1,931,605
2020-04-21 08:26:07
47,793,025
36
2017-12-13 12:27:25
1,872,842
2020-01-06 08:41:16
https://stackoverflow.com/q/47792846
https://stackoverflow.com/a/47793025
<p>Briefly, when we are talking about rebase, <code>ours</code> means the base branch.</p> <p>So in your case <code>ours</code> will be <code>app/demandware</code>, since firstly git moves us there, and then applies changes from the <code>app/dashboard-sprint-5</code>, which will be <code>theirs</code>.</p> <p>For ex...
<p>Briefly, when we are talking about rebase, <code>ours</code> means the base branch.</p> <p>So in your case <code>ours</code> will be <code>app/demandware</code>, since firstly git moves us there, and then applies changes from the <code>app/dashboard-sprint-5</code>, which will be <code>theirs</code>.</p> <p>For ex...
119, 456, 8974
git, rebase, version-control
<h1>What is "ours" and "their" while doing git rebase</h1> <p>I have applied the following commands, but have little confusion in doing rebase - what is ours and theirs in the following commands</p> <pre><code>git checkout app/dashboard-sprint-5 git rebase app/demandware </code></pre> <p>I know the current branch is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,372
git
# What is "ours" and "their" while doing git rebase I have applied the following commands, but have little confusion in doing rebase - what is ours and theirs in the following commands ``` git checkout app/dashboard-sprint-5 git rebase app/demandware ``` I know the current branch is `app/dashboard-sprint-5` and when...
Briefly, when we are talking about rebase, `ours` means the base branch. So in your case `ours` will be `app/demandware`, since firstly git moves us there, and then applies changes from the `app/dashboard-sprint-5`, which will be `theirs`. For example, here the note from [documentation](https://git-scm.com/docs/git-r...
22275538
Setting up Laravel project with Git
24
2014-03-08 21:54:37
<p>I'm pretty new to using git, and I wanted to figure out the "best practice" way of setting up a laravel project in my own repo and still be able to fetch updates from the main project (<a href="https://github.com/laravel/laravel.git">https://github.com/laravel/laravel.git</a>) and merge them with my project?</p> <p...
62,353
1,314,164
2021-10-15 09:57:35
22,275,673
36
2014-03-08 22:07:02
1,959,747
2014-03-08 22:07:02
https://stackoverflow.com/q/22275538
https://stackoverflow.com/a/22275673
<p>Laravel default app (<a href="https://github.com/laravel/laravel.git" rel="noreferrer">https://github.com/laravel/laravel.git</a>) doesn't change much and when it changes, Taylor gives the steps to migrate it. What you really want to do is to keep your project in sync with <a href="https://github.com/laravel/framewo...
<p>Laravel default app (<a href="https://github.com/laravel/laravel.git" rel="noreferrer">https://github.com/laravel/laravel.git</a>) doesn't change much and when it changes, Taylor gives the steps to migrate it. What you really want to do is to keep your project in sync with <a href="https://github.com/laravel/framewo...
5, 119, 75151
git, laravel, php
<h1>Setting up Laravel project with Git</h1> <p>I'm pretty new to using git, and I wanted to figure out the "best practice" way of setting up a laravel project in my own repo and still be able to fetch updates from the main project (<a href="https://github.com/laravel/laravel.git">https://github.com/laravel/laravel.git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,373
git
# Setting up Laravel project with Git I'm pretty new to using git, and I wanted to figure out the "best practice" way of setting up a laravel project in my own repo and still be able to fetch updates from the main project (<https://github.com/laravel/laravel.git>) and merge them with my project? Could anybody walk me...
Laravel default app (<https://github.com/laravel/laravel.git>) doesn't change much and when it changes, Taylor gives the steps to migrate it. What you really want to do is to keep your project in sync with <https://github.com/laravel/framework.git>, for that you just have to ``` composer update ``` Every day. But if...
37589103
Undo tag that's not pushed in Git
23
2016-06-02 10:21:01
<p>I've made a commit and a tag (using git tag -a -m ). I found out before I pushed that I needed to revert the commit so I used <code>git revert --soft HEAD~</code>. How do I also remove the tag? I've checked with <code>git push --tags --dry-run</code> that it hasn't been pushed yet, so I hope it's possible to remove...
10,517
3,984,006
2016-06-02 10:26:49
37,589,227
36
2016-06-02 10:26:49
1,863,229
2016-06-02 10:26:49
https://stackoverflow.com/q/37589103
https://stackoverflow.com/a/37589227
<p>Just run the following command from the branch where you created the tag:</p> <pre><code>git tag -d &lt;tag name&gt; </code></pre> <p>Even if you pushed the tag already it is still possible to remove it. Check out this useful <a href="https://matoski.com/article/git-delete-remote-branch-tag/" rel="noreferrer">blo...
<p>Just run the following command from the branch where you created the tag:</p> <pre><code>git tag -d &lt;tag name&gt; </code></pre> <p>Even if you pushed the tag already it is still possible to remove it. Check out this useful <a href="https://matoski.com/article/git-delete-remote-branch-tag/" rel="noreferrer">blo...
115, 119, 5766, 12309
git, revert, tags, undo
<h1>Undo tag that's not pushed in Git</h1> <p>I've made a commit and a tag (using git tag -a -m ). I found out before I pushed that I needed to revert the commit so I used <code>git revert --soft HEAD~</code>. How do I also remove the tag? I've checked with <code>git push --tags --dry-run</code> that it hasn't been pu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,374
git
# Undo tag that's not pushed in Git I've made a commit and a tag (using git tag -a -m ). I found out before I pushed that I needed to revert the commit so I used `git revert --soft HEAD~`. How do I also remove the tag? I've checked with `git push --tags --dry-run` that it hasn't been pushed yet, so I hope it's possibl...
Just run the following command from the branch where you created the tag: ``` git tag -d <tag name> ``` Even if you pushed the tag already it is still possible to remove it. Check out this useful [blog post](https://matoski.com/article/git-delete-remote-branch-tag/).
28146646
What is the difference between "git add -A" and "git add --update :/"?
23
2015-01-26 08:21:54
<p>I was in the past using this Git command for my files:</p> <pre><code>add --update :/ </code></pre> <p>as someone told me this was the best way to pick up all the files that had been added, deleted and updated. </p> <p>However after reading: <a href="https://stackoverflow.com/questions/572549/difference-between-...
37,875
1,422,604
2020-05-08 18:12:55
28,146,832
36
2015-01-26 08:37:33
504,685
2015-01-26 08:37:33
https://stackoverflow.com/q/28146646
https://stackoverflow.com/a/28146832
<p><code>git add --update :/</code> will update or remove previously tracked files from the entire working tree. It will not add new files.</p> <p><code>git add -A</code> will also update, remove previously tracked files, but it will also add new files. As this command doesn't have the explicit <a href="https://www.ke...
<p><code>git add --update :/</code> will update or remove previously tracked files from the entire working tree. It will not add new files.</p> <p><code>git add -A</code> will also update, remove previously tracked files, but it will also add new files. As this command doesn't have the explicit <a href="https://www.ke...
119
git
<h1>What is the difference between "git add -A" and "git add --update :/"?</h1> <p>I was in the past using this Git command for my files:</p> <pre><code>add --update :/ </code></pre> <p>as someone told me this was the best way to pick up all the files that had been added, deleted and updated. </p> <p>However after ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,375
git
# What is the difference between "git add -A" and "git add --update :/"? I was in the past using this Git command for my files: ``` add --update :/ ``` as someone told me this was the best way to pick up all the files that had been added, deleted and updated. However after reading: [Difference between "git add -A" ...
`git add --update :/` will update or remove previously tracked files from the entire working tree. It will not add new files. `git add -A` will also update, remove previously tracked files, but it will also add new files. As this command doesn't have the explicit [pathspec](https://www.kernel.org/pub/software/scm/git/...
4381814
git-svn rename tracking branch
23
2010-12-07 21:32:53
<p>My current svn cloned branches (using the -s 'standard layout') option are called:</p> <pre><code>$ git branch -r branch1 branch2 </code></pre> <p>I would like to rename those, such that they are:</p> <pre><code>$ git branch -r svn/branch1 svn/branch2 </code></pre> <p>As though I had called $ git-svn clone --p...
5,802
15,842
2010-12-13 17:34:59
4,404,249
36
2010-12-09 23:36:21
196,844
2010-12-13 17:34:59
https://stackoverflow.com/q/4381814
https://stackoverflow.com/a/4404249
<p>Assuming that you do not have another remote that was added with <code>git remote add ...</code>, try this procedure:</p> <ol> <li><code>git gc</code> to package all refs into <code>.git/packed-refs</code>.</li> <li>Open <code>.git/packed-refs</code> for editing. Replace "refs/remotes/" with "refs/remotes/svn/".</l...
<p>Assuming that you do not have another remote that was added with <code>git remote add ...</code>, try this procedure:</p> <ol> <li><code>git gc</code> to package all refs into <code>.git/packed-refs</code>.</li> <li>Open <code>.git/packed-refs</code> for editing. Replace "refs/remotes/" with "refs/remotes/svn/".</l...
119, 6452
git, git-svn
<h1>git-svn rename tracking branch</h1> <p>My current svn cloned branches (using the -s 'standard layout') option are called:</p> <pre><code>$ git branch -r branch1 branch2 </code></pre> <p>I would like to rename those, such that they are:</p> <pre><code>$ git branch -r svn/branch1 svn/branch2 </code></pre> <p>As...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,376
git
# git-svn rename tracking branch My current svn cloned branches (using the -s 'standard layout') option are called: ``` $ git branch -r branch1 branch2 ``` I would like to rename those, such that they are: ``` $ git branch -r svn/branch1 svn/branch2 ``` As though I had called $ git-svn clone --prefix svn originall...
Assuming that you do not have another remote that was added with `git remote add ...`, try this procedure: 1. `git gc` to package all refs into `.git/packed-refs`. 2. Open `.git/packed-refs` for editing. Replace "refs/remotes/" with "refs/remotes/svn/". 3. Open `.git/config` for editing. You should see something like:...
32324483
How to get second last commit hash in git
22
2015-09-01 05:57:27
<p>I am using below git command to get last 2 commit hash</p> <pre><code>git log -n 2 --pretty=format:"%H" #To get only hash value of commit </code></pre> <p>But I needs only second last commit hash.</p> <p>Any help would be great</p> <p>Thanks</p>
14,869
null
2019-06-13 18:32:42
32,324,539
36
2015-09-01 06:01:04
625,403
2019-06-13 18:32:42
https://stackoverflow.com/q/32324483
https://stackoverflow.com/a/32324539
<pre><code>git rev-parse @~ </code></pre> <p>rev-parse turns various notations into hashes, <code>@</code> is current head, and <code>~</code> is the previous commit.</p> <p>This generalizes to commits arbitrarily far back: for example, you can write <code>@~3</code> (or <code>@~~~</code>) to specify "three commits b...
<pre><code>git rev-parse @~ </code></pre> <p>rev-parse turns various notations into hashes, <code>@</code> is current head, and <code>~</code> is the previous commit.</p> <p>This generalizes to commits arbitrarily far back: for example, you can write <code>@~3</code> (or <code>@~~~</code>) to specify "three commits b...
119
git
<h1>How to get second last commit hash in git</h1> <p>I am using below git command to get last 2 commit hash</p> <pre><code>git log -n 2 --pretty=format:"%H" #To get only hash value of commit </code></pre> <p>But I needs only second last commit hash.</p> <p>Any help would be great</p> <p>Thanks</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,378
git
# How to get second last commit hash in git I am using below git command to get last 2 commit hash ``` git log -n 2 --pretty=format:"%H" #To get only hash value of commit ``` But I needs only second last commit hash. Any help would be great Thanks
``` git rev-parse @~ ``` rev-parse turns various notations into hashes, `@` is current head, and `~` is the previous commit. This generalizes to commits arbitrarily far back: for example, you can write `@~3` (or `@~~~`) to specify "three commits before the current head".
11687899
Remove / cut off Git's revision / commit history
22
2012-07-27 12:36:44
<p>I have a project that contains traces to another project of myself that I've used as a kind of a template project. Now I want to remove these traces entirely from the repository. Basically I want to cut off the old junk commits. So I have </p> <pre><code>A -- B -- C -- D -- E -- F </code></pre> <p>and want to get ...
9,446
159,679
2021-01-21 09:18:15
11,688,066
36
2012-07-27 12:46:42
718,180
2017-10-06 21:45:31
https://stackoverflow.com/q/11687899
https://stackoverflow.com/a/11688066
<p>Assuming <code>master</code> is at commit <code>F</code>:</p> <pre><code> # create a new branch with D's content $ git checkout --orphan temp &lt;d-sha1&gt; $ git commit # rebase everything else onto the temp branch $ git rebase --onto temp &lt;d-sha1&gt; master # clean up $ git checkout master $ git branch -d ...
<p>Assuming <code>master</code> is at commit <code>F</code>:</p> <pre><code> # create a new branch with D's content $ git checkout --orphan temp &lt;d-sha1&gt; $ git commit # rebase everything else onto the temp branch $ git rebase --onto temp &lt;d-sha1&gt; master # clean up $ git checkout master $ git branch -d ...
119
git
<h1>Remove / cut off Git's revision / commit history</h1> <p>I have a project that contains traces to another project of myself that I've used as a kind of a template project. Now I want to remove these traces entirely from the repository. Basically I want to cut off the old junk commits. So I have </p> <pre><code>A -...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,379
git
# Remove / cut off Git's revision / commit history I have a project that contains traces to another project of myself that I've used as a kind of a template project. Now I want to remove these traces entirely from the repository. Basically I want to cut off the old junk commits. So I have ``` A -- B -- C -- D -- E --...
Assuming `master` is at commit `F`: ``` # create a new branch with D's content $ git checkout --orphan temp <d-sha1> $ git commit # rebase everything else onto the temp branch $ git rebase --onto temp <d-sha1> master # clean up $ git checkout master $ git branch -d temp ``` --- *If* you want to completely remov...
65524512
how to disable git message about git initial branch name
21
2020-12-31 18:35:21
<p>I understand Microsoft recently changed the initial branch name in the github repositories, but now when I run &quot;git init&quot; on my computer I get a yellow alert message explaining that I can change the initial branch name to &quot;master &quot;. . some other name. And that makes me uncomfortable and does not ...
18,419
14,597,864
2023-01-27 07:26:00
65,524,758
36
2020-12-31 19:08:20
3,691,891
2020-12-31 19:08:20
https://stackoverflow.com/q/65524512
https://stackoverflow.com/a/65524758
<p>Newer versions of Git indeed produce a warning when initting a new repository:</p> <pre><code>$ git init warning: templates not found in /home/ja/share/git-core/templates hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name...
<p>Newer versions of Git indeed produce a warning when initting a new repository:</p> <pre><code>$ git init warning: templates not found in /home/ja/share/git-core/templates hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name...
119
git
<h1>how to disable git message about git initial branch name</h1> <p>I understand Microsoft recently changed the initial branch name in the github repositories, but now when I run &quot;git init&quot; on my computer I get a yellow alert message explaining that I can change the initial branch name to &quot;master &quot;...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,381
git
# how to disable git message about git initial branch name I understand Microsoft recently changed the initial branch name in the github repositories, but now when I run "git init" on my computer I get a yellow alert message explaining that I can change the initial branch name to "master ". . some other name. And that...
Newer versions of Git indeed produce a warning when initting a new repository: ``` $ git init warning: templates not found in /home/ja/share/git-core/templates hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in al...
39768124
Git rebase onto a tag when master and a branch is ahead of the current commits
21
2016-09-29 10:43:28
<p>I am having difficulties with Git. I am following a remote repo on my local machine. The master branch is being updated from the remote and I always sync with it to get the updates. And then my local branch ("feature" branch) is rebased onto the master branch to apply my local changes. The issue is I forgot to rebas...
54,171
1,503,890
2022-12-23 10:42:17
39,768,253
36
2016-09-29 10:49:44
6,881,516
2022-12-23 10:42:17
https://stackoverflow.com/q/39768124
https://stackoverflow.com/a/39768253
<p>Checkout the git rebase manpage <a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">https://git-scm.com/docs/git-rebase</a>.</p> <p>The remote branch <code>origin/master</code> (assuming your remote is called origin) is the upstream master. Rebase works by selecting a common ancestor between two branches ...
<p>Checkout the git rebase manpage <a href="https://git-scm.com/docs/git-rebase" rel="noreferrer">https://git-scm.com/docs/git-rebase</a>.</p> <p>The remote branch <code>origin/master</code> (assuming your remote is called origin) is the upstream master. Rebase works by selecting a common ancestor between two branches ...
119, 8974
git, rebase
<h1>Git rebase onto a tag when master and a branch is ahead of the current commits</h1> <p>I am having difficulties with Git. I am following a remote repo on my local machine. The master branch is being updated from the remote and I always sync with it to get the updates. And then my local branch ("feature" branch) is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,382
git
# Git rebase onto a tag when master and a branch is ahead of the current commits I am having difficulties with Git. I am following a remote repo on my local machine. The master branch is being updated from the remote and I always sync with it to get the updates. And then my local branch ("feature" branch) is rebased o...
Checkout the git rebase manpage <https://git-scm.com/docs/git-rebase>. The remote branch `origin/master` (assuming your remote is called origin) is the upstream master. Rebase works by selecting a common ancestor between two branches and then cut off one part: ``` o -- o ...
21142986
remove filenames from specific path?
21
2014-01-15 16:33:29
<p>I've been playing around with the BFG Repo-Cleaner tool in order to clean up the history of a git repo by removing (temporary / large) files from several places in the directory hierarcy...</p> <p>i.e. /root/test/a.txt /root/test2/a.txt</p> <p>Now i'd like to remove <em>all</em> references of the 'test/a.txt' but ...
8,837
237,750
2018-10-16 19:32:05
21,172,871
36
2014-01-16 21:06:07
438,886
2014-01-16 21:06:07
https://stackoverflow.com/q/21142986
https://stackoverflow.com/a/21172871
<p>I'm the developer of <a href="http://rtyley.github.io/bfg-repo-cleaner/">The BFG</a>, and I'm glad you've been finding it useful and fast. Part of the special-sauce that makes the BFG so fast is that it's path-independent - so you can't say directly say something like <code>--delete /root/test/a.txt</code>. Adding s...
<p>I'm the developer of <a href="http://rtyley.github.io/bfg-repo-cleaner/">The BFG</a>, and I'm glad you've been finding it useful and fast. Part of the special-sauce that makes the BFG so fast is that it's path-independent - so you can't say directly say something like <code>--delete /root/test/a.txt</code>. Adding s...
91259
git-rewrite-history
<h1>remove filenames from specific path?</h1> <p>I've been playing around with the BFG Repo-Cleaner tool in order to clean up the history of a git repo by removing (temporary / large) files from several places in the directory hierarcy...</p> <p>i.e. /root/test/a.txt /root/test2/a.txt</p> <p>Now i'd like to remove <e...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,383
git
# remove filenames from specific path? I've been playing around with the BFG Repo-Cleaner tool in order to clean up the history of a git repo by removing (temporary / large) files from several places in the directory hierarcy... i.e. /root/test/a.txt /root/test2/a.txt Now i'd like to remove *all* references of the '...
I'm the developer of [The BFG](http://rtyley.github.io/bfg-repo-cleaner/), and I'm glad you've been finding it useful and fast. Part of the special-sauce that makes the BFG so fast is that it's path-independent - so you can't say directly say something like `--delete /root/test/a.txt`. Adding some support for path-depe...
20455980
How do I git checkout one commit prior to a specific commit
21
2013-12-08 16:47:32
<p>After going through github issues, I've found a commit that <em>might</em> be responsible for breaking code and I want to confirm this suspicion by doing something like:</p> <p><code>git checkout --one-prior f1962b3cc771184a471e1350fa280d80d5fdd09d</code></p>
14,299
296,155
2022-03-07 19:25:15
20,455,988
36
2013-12-08 16:48:26
641,955
2013-12-08 16:48:26
https://stackoverflow.com/q/20455980
https://stackoverflow.com/a/20455988
<p>Here you go:</p> <pre><code>git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^ </code></pre> <p>Notice the <code>^</code> at the end. That means one revision behind.</p> <p>For example this would be 5 revisions behind:</p> <pre><code>git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^^^^^ </code></pre> <...
<p>Here you go:</p> <pre><code>git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^ </code></pre> <p>Notice the <code>^</code> at the end. That means one revision behind.</p> <p>For example this would be 5 revisions behind:</p> <pre><code>git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^^^^^ </code></pre> <...
119
git
<h1>How do I git checkout one commit prior to a specific commit</h1> <p>After going through github issues, I've found a commit that <em>might</em> be responsible for breaking code and I want to confirm this suspicion by doing something like:</p> <p><code>git checkout --one-prior f1962b3cc771184a471e1350fa280d80d5fdd09...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,384
git
# How do I git checkout one commit prior to a specific commit After going through github issues, I've found a commit that *might* be responsible for breaking code and I want to confirm this suspicion by doing something like: `git checkout --one-prior f1962b3cc771184a471e1350fa280d80d5fdd09d`
Here you go: ``` git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^ ``` Notice the `^` at the end. That means one revision behind. For example this would be 5 revisions behind: ``` git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^^^^^ ``` ... equivalent to: ``` git checkout f1962b3cc771184a471e1350fa280d...
3648766
What file permissions should the contents of $GIT_DIR have?
21
2010-09-06 02:49:38
<p>I have restored a git repo from backup and it does not have the correct file permissions. Is it enough to set owner +rw on all files and directories in .git, or is it more subtle?</p> <p>Is there a utility to check or reset .git file permissions?</p>
7,537
120,371
2022-11-11 03:27:42
3,648,777
36
2010-09-06 02:54:52
15,168
2010-09-06 03:12:11
https://stackoverflow.com/q/3648766
https://stackoverflow.com/a/3648777
<p>Directories should have 755 permission; files should have 644 permission.</p> <p>That's a pretty good rule of thumb unless you expect members of your group to make changes to your repository.</p> <p>Having said that, in one of my repositories, the files under <code>.git/objects/*</code> have 444 (readonly) permiss...
<p>Directories should have 755 permission; files should have 644 permission.</p> <p>That's a pretty good rule of thumb unless you expect members of your group to make changes to your repository.</p> <p>Having said that, in one of my repositories, the files under <code>.git/objects/*</code> have 444 (readonly) permiss...
119
git
<h1>What file permissions should the contents of $GIT_DIR have?</h1> <p>I have restored a git repo from backup and it does not have the correct file permissions. Is it enough to set owner +rw on all files and directories in .git, or is it more subtle?</p> <p>Is there a utility to check or reset .git file permissions?<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,385
git
# What file permissions should the contents of $GIT_DIR have? I have restored a git repo from backup and it does not have the correct file permissions. Is it enough to set owner +rw on all files and directories in .git, or is it more subtle? Is there a utility to check or reset .git file permissions?
Directories should have 755 permission; files should have 644 permission. That's a pretty good rule of thumb unless you expect members of your group to make changes to your repository. Having said that, in one of my repositories, the files under `.git/objects/*` have 444 (readonly) permission for everyone. Other file...
33609742
How to make branch B exactly like branch A?
20
2015-11-09 13:03:35
<p>Say I have an existing branch B (if it makes a difference, it's remote).</p> <p>I also have a branch A (either local or remote). I would like branch B to be exactly like A. If I understand correctly, merge doesn't make the branches identical, there still can be something in branch B that wasn't on branch A and it w...
10,698
998,318
2015-11-09 13:41:41
33,609,829
36
2015-11-09 13:08:36
5,449,925
2015-11-09 13:16:43
https://stackoverflow.com/q/33609742
https://stackoverflow.com/a/33609829
<p>git keeps track of the <strong><em>history</em></strong> of development. Thus, to make a branch exactly like another branch, you just need to:</p> <pre><code>git checkout &lt;branch B&gt; git reset --hard &lt;branch A&gt; git push --force origin &lt;branch B&gt; </code></pre> <p>Of course, doing this you will lose...
<p>git keeps track of the <strong><em>history</em></strong> of development. Thus, to make a branch exactly like another branch, you just need to:</p> <pre><code>git checkout &lt;branch B&gt; git reset --hard &lt;branch A&gt; git push --force origin &lt;branch B&gt; </code></pre> <p>Of course, doing this you will lose...
119
git
<h1>How to make branch B exactly like branch A?</h1> <p>Say I have an existing branch B (if it makes a difference, it's remote).</p> <p>I also have a branch A (either local or remote). I would like branch B to be exactly like A. If I understand correctly, merge doesn't make the branches identical, there still can be s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
18,386
git
# How to make branch B exactly like branch A? Say I have an existing branch B (if it makes a difference, it's remote). I also have a branch A (either local or remote). I would like branch B to be exactly like A. If I understand correctly, merge doesn't make the branches identical, there still can be something in bran...
git keeps track of the ***history*** of development. Thus, to make a branch exactly like another branch, you just need to: ``` git checkout <branch B> git reset --hard <branch A> git push --force origin <branch B> ``` Of course, doing this you will lose the development history that was on branch B.