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
50296242
Git merge feature branch WITHOUT any commit history
12
2018-05-11 16:07:07
<p>say I create a new feature branch and make bunch of commits to the feature branch. My colleague also makes some commit so the master branch. How do I merge my change onto the master branch but master branch show one single commit? I have tried merging, all commits show up and it shows that I branch out. I've tried r...
10,097
507,528
2018-05-11 18:44:48
50,296,786
18
2018-05-11 16:44:20
1,256,452
2018-05-11 16:44:20
https://stackoverflow.com/q/50296242
https://stackoverflow.com/a/50296786
<p>Use <code>git merge --squash</code> (which forces you to also use <code>git commit</code> afterward).</p> <h3>Description</h3> <p>In Git, the commits <em>are</em> the history. You can't add commits without adding history, because these are the same thing. What you want, then, is to make a <em>single</em> commit ...
<p>Use <code>git merge --squash</code> (which forces you to also use <code>git commit</code> afterward).</p> <h3>Description</h3> <p>In Git, the commits <em>are</em> the history. You can't add commits without adding history, because these are the same thing. What you want, then, is to make a <em>single</em> commit ...
119, 456, 717, 8974
git, merge, rebase, version-control
<h1>Git merge feature branch WITHOUT any commit history</h1> <p>say I create a new feature branch and make bunch of commits to the feature branch. My colleague also makes some commit so the master branch. How do I merge my change onto the master branch but master branch show one single commit? I have tried merging, all...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,089
git
# Git merge feature branch WITHOUT any commit history say I create a new feature branch and make bunch of commits to the feature branch. My colleague also makes some commit so the master branch. How do I merge my change onto the master branch but master branch show one single commit? I have tried merging, all commits ...
Use `git merge --squash` (which forces you to also use `git commit` afterward). ### Description In Git, the commits *are* the history. You can't add commits without adding history, because these are the same thing. What you want, then, is to make a *single* commit that is *not* a merge commit that *produces the same ...
48849984
Git management technique when multiple customers need multiple customization
12
2018-02-18 09:02:35
<p>I'm working on a application project which will be used by many customers, and they may need customization seperately. That is, assume that we sell our application to 1000 clients, we may need 1000 customizations (e.g. difference on handling connection, requests, etc.) on a single program. I think that we can create...
7,588
1,025,629
2020-08-19 10:01:23
48,850,633
18
2018-02-18 10:28:06
717,732
2018-02-18 10:34:56
https://stackoverflow.com/q/48849984
https://stackoverflow.com/a/48850633
<p>First of all, with 1k customizations, it sounds to me like something's wrong. With 1k different versions of the code, how many <em>development teams</em> would you need to <strong>really</strong> support them all <strong>in timely fashion</strong>?</p> <p>I would first consider if those 'customizations':</p> <ul> ...
<p>First of all, with 1k customizations, it sounds to me like something's wrong. With 1k different versions of the code, how many <em>development teams</em> would you need to <strong>really</strong> support them all <strong>in timely fashion</strong>?</p> <p>I would first consider if those 'customizations':</p> <ul> ...
119, 456, 1363, 111433
devops, git, project-management, version-control
<h1>Git management technique when multiple customers need multiple customization</h1> <p>I'm working on a application project which will be used by many customers, and they may need customization seperately. That is, assume that we sell our application to 1000 clients, we may need 1000 customizations (e.g. difference o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,090
git
# Git management technique when multiple customers need multiple customization I'm working on a application project which will be used by many customers, and they may need customization seperately. That is, assume that we sell our application to 1000 clients, we may need 1000 customizations (e.g. difference on handlin...
First of all, with 1k customizations, it sounds to me like something's wrong. With 1k different versions of the code, how many *development teams* would you need to **really** support them all **in timely fashion**? I would first consider if those 'customizations': - really have to be done in-code? - really have to b...
47088506
Git update branch to master
12
2017-11-03 04:30:16
<p>I have a <code>feature</code> branch that I work on. Yesterday I did a commit and also merged my <code>feature</code> branch into the remote <code>master</code> branch. </p> <p>Now I wish to continue working on my branch and add more functionality. However, since yesterday other people have added some additional ...
21,492
5,493,420
2020-05-19 20:29:31
47,088,981
18
2017-11-03 05:23:24
6,936,103
2017-11-03 05:23:24
https://stackoverflow.com/q/47088506
https://stackoverflow.com/a/47088981
<p>Yes, there has the way to update <code>feature</code> branch based on the latest <code>master</code> branch. You just need to execute the command on <code>feature</code> branch:</p> <pre><code># On feature branch git pull origin master --rebase </code></pre> <p>Now the <code>feature</code> branch contains the late...
<p>Yes, there has the way to update <code>feature</code> branch based on the latest <code>master</code> branch. You just need to execute the command on <code>feature</code> branch:</p> <pre><code># On feature branch git pull origin master --rebase </code></pre> <p>Now the <code>feature</code> branch contains the late...
119, 456, 1879, 53847
branch, branching-and-merging, git, version-control
<h1>Git update branch to master</h1> <p>I have a <code>feature</code> branch that I work on. Yesterday I did a commit and also merged my <code>feature</code> branch into the remote <code>master</code> branch. </p> <p>Now I wish to continue working on my branch and add more functionality. However, since yesterday oth...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,091
git
# Git update branch to master I have a `feature` branch that I work on. Yesterday I did a commit and also merged my `feature` branch into the remote `master` branch. Now I wish to continue working on my branch and add more functionality. However, since yesterday other people have added some additional code to the `ma...
Yes, there has the way to update `feature` branch based on the latest `master` branch. You just need to execute the command on `feature` branch: ``` # On feature branch git pull origin master --rebase ``` Now the `feature` branch contains the latest changes of `master` branch.
28663227
Difference between checkout remote branch and pull remote branch in git?
12
2015-02-22 21:04:28
<p>What is the difference between:</p> <pre><code>git checkout -b &lt;branch&gt; origin/&lt;branch&gt; </code></pre> <p>and </p> <pre><code>git pull origin &lt;branch&gt; </code></pre> <p>They seem to have the same functionality to me. thanks.</p>
15,070
2,605,112
2015-02-22 21:26:29
28,663,286
18
2015-02-22 21:10:43
147,356
2015-02-22 21:10:43
https://stackoverflow.com/q/28663227
https://stackoverflow.com/a/28663286
<p><code>git pull</code> contacts the remote repository identified by <code>origin</code> and looks for updates. It fetches any updates and then merges the changes into the target branch. It <em>does not</em> create a new branch.</p> <p><code>git checkout -b &lt;branch&gt; origin/&lt;branch&gt;</code> <em>creates a n...
<p><code>git pull</code> contacts the remote repository identified by <code>origin</code> and looks for updates. It fetches any updates and then merges the changes into the target branch. It <em>does not</em> create a new branch.</p> <p><code>git checkout -b &lt;branch&gt; origin/&lt;branch&gt;</code> <em>creates a n...
119, 717, 28896, 37230
git, git-checkout, git-pull, merge
<h1>Difference between checkout remote branch and pull remote branch in git?</h1> <p>What is the difference between:</p> <pre><code>git checkout -b &lt;branch&gt; origin/&lt;branch&gt; </code></pre> <p>and </p> <pre><code>git pull origin &lt;branch&gt; </code></pre> <p>They seem to have the same functionality to me...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,092
git
# Difference between checkout remote branch and pull remote branch in git? What is the difference between: ``` git checkout -b <branch> origin/<branch> ``` and ``` git pull origin <branch> ``` They seem to have the same functionality to me. thanks.
`git pull` contacts the remote repository identified by `origin` and looks for updates. It fetches any updates and then merges the changes into the target branch. It *does not* create a new branch. `git checkout -b <branch> origin/<branch>` *creates a new branch* based on `origin/<branch>`, and does not contact the re...
27588396
How can I do a get latest on a remote branch?
12
2014-12-21 10:07:25
<p>I am trying to catchup with the latest code from a remote github branch. Suppose this branch is called myDevBranch how can I get this locally? I tried:</p> <pre><code>git fetch myDevBranch </code></pre> <p>This returns :</p> <pre><code>fatal: 'myDevBranch' does not appear to be a git repository fatal: Could not ...
65,703
1,029,283
2024-08-16 19:58:03
27,588,408
18
2014-12-21 10:10:26
2,149,092
2018-06-04 09:20:01
https://stackoverflow.com/q/27588396
https://stackoverflow.com/a/27588408
<p>You don't fetch a branch, you <a href="https://git-scm.com/docs/git-fetch" rel="noreferrer"><code>fetch</code></a> a remote, so the correct line would be</p> <pre><code>git fetch origin # or whatever your remote is called </code></pre> <p>Then the all tracking branches are updated, your updated code will be it a b...
<p>You don't fetch a branch, you <a href="https://git-scm.com/docs/git-fetch" rel="noreferrer"><code>fetch</code></a> a remote, so the correct line would be</p> <pre><code>git fetch origin # or whatever your remote is called </code></pre> <p>Then the all tracking branches are updated, your updated code will be it a b...
119, 76220
git, git-branch
<h1>How can I do a get latest on a remote branch?</h1> <p>I am trying to catchup with the latest code from a remote github branch. Suppose this branch is called myDevBranch how can I get this locally? I tried:</p> <pre><code>git fetch myDevBranch </code></pre> <p>This returns :</p> <pre><code>fatal: 'myDevBranch' d...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,093
git
# How can I do a get latest on a remote branch? I am trying to catchup with the latest code from a remote github branch. Suppose this branch is called myDevBranch how can I get this locally? I tried: ``` git fetch myDevBranch ``` This returns : ``` fatal: 'myDevBranch' does not appear to be a git repository fatal: ...
You don't fetch a branch, you [`fetch`](https://git-scm.com/docs/git-fetch) a remote, so the correct line would be ``` git fetch origin # or whatever your remote is called ``` Then the all tracking branches are updated, your updated code will be it a branch called `origin/myDevBranch`, again origin is replaced with y...
20508136
Updated Git but still showing old version
12
2013-12-11 00:20:10
<p>I downloaded and installed Git 1.8.4.2 from this link: <a href="http://git-scm.com/downloads" rel="noreferrer">http://git-scm.com/downloads</a>. However, when I run <code>git --version</code> from the Terminal I get:</p> <pre><code>[~/workspace/ruby]: git --version git version 1.7.4.4 </code></pre> <p>I've trie...
9,284
1,066,615
2013-12-11 00:38:30
20,508,353
18
2013-12-11 00:38:30
1,080,717
2013-12-11 00:38:30
https://stackoverflow.com/q/20508136
https://stackoverflow.com/a/20508353
<p>Run the command:</p> <pre><code>which git </code></pre> <p>You'll probably see <code>/usr/bin/git</code> -- the Apple supplied version. This will be because <code>/usr/bin</code> appears in your <code>PATH</code> environment variable <em>before</em> <code>/usr/local/git/bin</code>. You can verify this by running t...
<p>Run the command:</p> <pre><code>which git </code></pre> <p>You'll probably see <code>/usr/bin/git</code> -- the Apple supplied version. This will be because <code>/usr/bin</code> appears in your <code>PATH</code> environment variable <em>before</em> <code>/usr/local/git/bin</code>. You can verify this by running t...
119, 369, 391, 10481
git, macos, terminal, updates
<h1>Updated Git but still showing old version</h1> <p>I downloaded and installed Git 1.8.4.2 from this link: <a href="http://git-scm.com/downloads" rel="noreferrer">http://git-scm.com/downloads</a>. However, when I run <code>git --version</code> from the Terminal I get:</p> <pre><code>[~/workspace/ruby]: git --versi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,094
git
# Updated Git but still showing old version I downloaded and installed Git 1.8.4.2 from this link: <http://git-scm.com/downloads>. However, when I run `git --version` from the Terminal I get: ``` [~/workspace/ruby]: git --version git version 1.7.4.4 ``` I've tried restarting the terminal and my computer. I then tr...
Run the command: ``` which git ``` You'll probably see `/usr/bin/git` -- the Apple supplied version. This will be because `/usr/bin` appears in your `PATH` environment variable *before* `/usr/local/git/bin`. You can verify this by running the command: ``` echo $PATH ``` If that is the case then run this command: `...
15157523
git log summary
12
2013-03-01 12:07:28
<p>I am new to git and I am trying to accomplish the following: I want to print a short summary listing commits title, author, timestamp(optional), and just number of addition/deletion/update. </p> <p>What I have done is I use <code>git log --shortstat --oneline</code> and it <em>almost</em> achieves my requirements e...
9,802
null
2013-03-01 12:24:38
15,157,601
18
2013-03-01 12:17:46
1,489,997
2013-03-01 12:24:38
https://stackoverflow.com/q/15157523
https://stackoverflow.com/a/15157601
<p>Have a look at <code>git log --pretty=format:&lt;format string&gt;</code>, <a href="http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History" rel="noreferrer">Here is a good explanation</a>.</p> <p>For exmaple</p> <pre><code>git log --pretty=format:"%h - %an (%ae): %s" --shortstat </code></pre> <p>will g...
<p>Have a look at <code>git log --pretty=format:&lt;format string&gt;</code>, <a href="http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History" rel="noreferrer">Here is a good explanation</a>.</p> <p>For exmaple</p> <pre><code>git log --pretty=format:"%h - %an (%ae): %s" --shortstat </code></pre> <p>will g...
119, 942
git, logging
<h1>git log summary</h1> <p>I am new to git and I am trying to accomplish the following: I want to print a short summary listing commits title, author, timestamp(optional), and just number of addition/deletion/update. </p> <p>What I have done is I use <code>git log --shortstat --oneline</code> and it <em>almost</em> a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,095
git
# git log summary I am new to git and I am trying to accomplish the following: I want to print a short summary listing commits title, author, timestamp(optional), and just number of addition/deletion/update. What I have done is I use `git log --shortstat --oneline` and it *almost* achieves my requirements except it l...
Have a look at `git log --pretty=format:<format string>`, [Here is a good explanation](http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History). For exmaple ``` git log --pretty=format:"%h - %an (%ae): %s" --shortstat ``` will give you the hash (`%h`), the author name and email (`%an`, `%ae`) and the subjec...
7588293
svn command line equivalent of 'git log -p'?
12
2011-09-28 19:09:24
<p>Is there an equivalent of <code>git log -p</code> using the svn command line tool? <code>svn log -v</code> shows file names but not changes.</p> <p>I would like to see the patches introduced by prior commits. If not possible, is there a way to get the patch (not compared to head, just the changeset) introduced by a...
5,999
743,464
2013-02-17 11:16:27
14,920,498
18
2013-02-17 11:16:27
970,766
2013-02-17 11:16:27
https://stackoverflow.com/q/7588293
https://stackoverflow.com/a/14920498
<p><code>svn log --diff</code> is the equivalent of <code>git log -p</code>.</p> <p>For a single revision you can use <code>svn diff -c &lt;revision&gt;</code> which in git would be <code>git show &lt;revision&gt;</code>.</p>
<p><code>svn log --diff</code> is the equivalent of <code>git log -p</code>.</p> <p>For a single revision you can use <code>svn diff -c &lt;revision&gt;</code> which in git would be <code>git show &lt;revision&gt;</code>.</p>
63, 119, 942, 1231
command-line, git, logging, svn
<h1>svn command line equivalent of 'git log -p'?</h1> <p>Is there an equivalent of <code>git log -p</code> using the svn command line tool? <code>svn log -v</code> shows file names but not changes.</p> <p>I would like to see the patches introduced by prior commits. If not possible, is there a way to get the patch (not...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,096
git
# svn command line equivalent of 'git log -p'? Is there an equivalent of `git log -p` using the svn command line tool? `svn log -v` shows file names but not changes. I would like to see the patches introduced by prior commits. If not possible, is there a way to get the patch (not compared to head, just the changeset)...
`svn log --diff` is the equivalent of `git log -p`. For a single revision you can use `svn diff -c <revision>` which in git would be `git show <revision>`.
10219138
TortoiseGit 1.7.8: "Couldn't load this key" on "sync" or "pull"?
12
2012-04-18 22:42:25
<p>When I try to use "Git Sync" and then "Pull" I get the error: </p> <blockquote> <p>Couldn't load this key (unable to open file)</p> </blockquote> <p>It then tries to proceed with the pull and I get this error:</p> <blockquote> <p>Disconnected: No supported authentication methods available (server sent: public...
17,421
1,161,703
2016-03-23 03:38:42
10,225,066
18
2012-04-19 09:17:15
1,268,570
2012-04-19 09:23:19
https://stackoverflow.com/q/10219138
https://stackoverflow.com/a/10225066
<p>That happens when you can not authenticate to the remote server, for some reason your keys are not found. You installed a new version of tortoiseGit. Were your keys inside that folder? maybe they were removed when you installed the new version. </p> <p>Check the remotes are configured in your Git repository</p> <p...
<p>That happens when you can not authenticate to the remote server, for some reason your keys are not found. You installed a new version of tortoiseGit. Were your keys inside that folder? maybe they were removed when you installed the new version. </p> <p>Check the remotes are configured in your Git repository</p> <p...
119, 31409
git, tortoisegit
<h1>TortoiseGit 1.7.8: "Couldn't load this key" on "sync" or "pull"?</h1> <p>When I try to use "Git Sync" and then "Pull" I get the error: </p> <blockquote> <p>Couldn't load this key (unable to open file)</p> </blockquote> <p>It then tries to proceed with the pull and I get this error:</p> <blockquote> <p>Discon...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,098
git
# TortoiseGit 1.7.8: "Couldn't load this key" on "sync" or "pull"? When I try to use "Git Sync" and then "Pull" I get the error: > Couldn't load this key (unable to open file) It then tries to proceed with the pull and I get this error: > Disconnected: No supported authentication methods available (server sent: pub...
That happens when you can not authenticate to the remote server, for some reason your keys are not found. You installed a new version of tortoiseGit. Were your keys inside that folder? maybe they were removed when you installed the new version. Check the remotes are configured in your Git repository ``` git remote -v...
9905882
git post-receive not working correctly
12
2012-03-28 10:45:52
<p>I have the following problem. I have updated the 'post-receive' to cd into a certain directory and then pull the repo in to deploy it like so:</p> <pre><code>#!/bin/bash cd /var/www/site git pull origin master </code></pre> <p>However whenever I do 'git push origin master' on my local machine I get the following:<...
3,992
1,150,863
2013-08-24 11:16:46
9,905,975
18
2012-03-28 10:51:42
1,292,235
2013-08-24 11:16:46
https://stackoverflow.com/q/9905882
https://stackoverflow.com/a/9905975
<p>Use unset GIT_DIR as following</p> <pre><code>#!/bin/bash cd /var/www/site || exit unset GIT_DIR git pull origin master exec git-update-server-info </code></pre> <p>You can see more information about <strong>GIT_DIR</strong> here. <a href="http://git-scm.com/blog/2010/04/11/environment.html" rel="noreferrer">Git L...
<p>Use unset GIT_DIR as following</p> <pre><code>#!/bin/bash cd /var/www/site || exit unset GIT_DIR git pull origin master exec git-update-server-info </code></pre> <p>You can see more information about <strong>GIT_DIR</strong> here. <a href="http://git-scm.com/blog/2010/04/11/environment.html" rel="noreferrer">Git L...
119, 46734
git, git-post-receive
<h1>git post-receive not working correctly</h1> <p>I have the following problem. I have updated the 'post-receive' to cd into a certain directory and then pull the repo in to deploy it like so:</p> <pre><code>#!/bin/bash cd /var/www/site git pull origin master </code></pre> <p>However whenever I do 'git push origin m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,099
git
# git post-receive not working correctly I have the following problem. I have updated the 'post-receive' to cd into a certain directory and then pull the repo in to deploy it like so: ``` #!/bin/bash cd /var/www/site git pull origin master ``` However whenever I do 'git push origin master' on my local machine I get ...
Use unset GIT_DIR as following ``` #!/bin/bash cd /var/www/site || exit unset GIT_DIR git pull origin master exec git-update-server-info ``` You can see more information about **GIT_DIR** here. [Git Loves the Environment](http://git-scm.com/blog/2010/04/11/environment.html)
9527097
Git branch switching does not change code folder files
12
2012-03-02 02:17:23
<p>This is a follow up to <a href="https://stackoverflow.com/questions/9406651/code-base-for-git-master-feature-branch">this</a> question.</p> <p>I cloned the remote master project folder using <code>git clone git@git.mytest.com:TEST</code> command. from the Git root, I did a <code>cd Test</code> command to move into ...
6,939
910,120
2012-08-03 09:43:31
9,527,123
18
2012-03-02 02:21:06
211,563
2012-08-03 09:43:31
https://stackoverflow.com/q/9527097
https://stackoverflow.com/a/9527123
<p>No it's not part of your <code>master</code> branch, but it's not part of <code>myBranch</code> either. It is <em>untracked</em>, because you never committed the file. Running <code>git status</code> you'll see it listed as untracked. Since it was never staged or committed, Git doesn't (and can't) manage its existen...
<p>No it's not part of your <code>master</code> branch, but it's not part of <code>myBranch</code> either. It is <em>untracked</em>, because you never committed the file. Running <code>git status</code> you'll see it listed as untracked. Since it was never staged or committed, Git doesn't (and can't) manage its existen...
119
git
<h1>Git branch switching does not change code folder files</h1> <p>This is a follow up to <a href="https://stackoverflow.com/questions/9406651/code-base-for-git-master-feature-branch">this</a> question.</p> <p>I cloned the remote master project folder using <code>git clone git@git.mytest.com:TEST</code> command. from ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,100
git
# Git branch switching does not change code folder files This is a follow up to [this](https://stackoverflow.com/questions/9406651/code-base-for-git-master-feature-branch) question. I cloned the remote master project folder using `git clone git@git.mytest.com:TEST` command. from the Git root, I did a `cd Test` comman...
No it's not part of your `master` branch, but it's not part of `myBranch` either. It is *untracked*, because you never committed the file. Running `git status` you'll see it listed as untracked. Since it was never staged or committed, Git doesn't (and can't) manage its existence, so it stays there regardless. Further,...
9522852
How can I search a word in Git repo over the whole history?
12
2012-03-01 19:43:24
<p>Suppose I remember that I saved a word <code>"XYZword"</code> to some file in a repo but it got killed and I can only remember the initial part <code>"XYZ"</code> but nothing about the time or file. How can I grep this <code>"XYZ"</code> over the whole history?</p>
5,649
164,148
2012-03-01 19:56:06
9,522,988
18
2012-03-01 19:52:22
252,022
2012-03-01 19:52:22
https://stackoverflow.com/q/9522852
https://stackoverflow.com/a/9522988
<p>To search the full history of the current branch and get the line numbers:</p> <pre><code>git grep -n "XYZ" $(git rev-list --all) </code></pre>
<p>To search the full history of the current branch and get the line numbers:</p> <pre><code>git grep -n "XYZ" $(git rev-list --all) </code></pre>
119
git
<h1>How can I search a word in Git repo over the whole history?</h1> <p>Suppose I remember that I saved a word <code>"XYZword"</code> to some file in a repo but it got killed and I can only remember the initial part <code>"XYZ"</code> but nothing about the time or file. How can I grep this <code>"XYZ"</code> over the w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,101
git
# How can I search a word in Git repo over the whole history? Suppose I remember that I saved a word `"XYZword"` to some file in a repo but it got killed and I can only remember the initial part `"XYZ"` but nothing about the time or file. How can I grep this `"XYZ"` over the whole history?
To search the full history of the current branch and get the line numbers: ``` git grep -n "XYZ" $(git rev-list --all) ```
9307791
Create commit to overwrite current branch contents with another's
12
2012-02-16 08:25:11
<p>I would like to create a single commit that will make the current branch identical in contents (and implicitly in sync) with another branch.</p> <p>This is practically the equivalent of copy pasting the checkout contents of another branch on top of the current branch and committing everything in one go.</p>
1,592
731,262
2012-02-16 08:46:37
9,307,851
18
2012-02-16 08:30:16
148,870
2012-02-16 08:46:37
https://stackoverflow.com/q/9307791
https://stackoverflow.com/a/9307851
<pre><code>$ git reset --hard &lt;another branch&gt; $ git reset --soft HEAD@{1} $ git commit </code></pre> <p>The first (hard) reset grabs the contents of the other branch into your working directory. The second (soft) reset puts your commit pointer back at the tip of your original branch, but doesn't change the file...
<pre><code>$ git reset --hard &lt;another branch&gt; $ git reset --soft HEAD@{1} $ git commit </code></pre> <p>The first (hard) reset grabs the contents of the other branch into your working directory. The second (soft) reset puts your commit pointer back at the tip of your original branch, but doesn't change the file...
119
git
<h1>Create commit to overwrite current branch contents with another's</h1> <p>I would like to create a single commit that will make the current branch identical in contents (and implicitly in sync) with another branch.</p> <p>This is practically the equivalent of copy pasting the checkout contents of another branch on...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,102
git
# Create commit to overwrite current branch contents with another's I would like to create a single commit that will make the current branch identical in contents (and implicitly in sync) with another branch. This is practically the equivalent of copy pasting the checkout contents of another branch on top of the curr...
``` $ git reset --hard <another branch> $ git reset --soft HEAD@{1} $ git commit ``` The first (hard) reset grabs the contents of the other branch into your working directory. The second (soft) reset puts your commit pointer back at the tip of your original branch, but doesn't change the files in your index at all, th...
7842719
Git: Any way to set default login credentials?
12
2011-10-20 21:50:31
<p>I'm using terminal for mac and running the line</p> <pre><code>git push origin master </code></pre> <p>It asks me for my github.com username and password every time,<br> is there any way to have it automatically use my credentials?</p> <hr> <p>I keep getting the error</p> <pre><code>error: The requested URL ret...
32,895
537,998
2020-02-21 22:59:28
8,013,604
18
2011-11-04 17:44:35
1,017,768
2012-07-29 22:18:54
https://stackoverflow.com/q/7842719
https://stackoverflow.com/a/8013604
<p>From your description of things, it sounds like your [Project Dir]/.git/config file is setup with the line <code>url = https...</code>, and not <code>url = git@github.com...</code>. Can you check that file to see what it says? It'd be great if you could post your entire "remote origin" section. It probably looks som...
<p>From your description of things, it sounds like your [Project Dir]/.git/config file is setup with the line <code>url = https...</code>, and not <code>url = git@github.com...</code>. Can you check that file to see what it says? It'd be great if you could post your entire "remote origin" section. It probably looks som...
119
git
<h1>Git: Any way to set default login credentials?</h1> <p>I'm using terminal for mac and running the line</p> <pre><code>git push origin master </code></pre> <p>It asks me for my github.com username and password every time,<br> is there any way to have it automatically use my credentials?</p> <hr> <p>I keep gettin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,103
git
# Git: Any way to set default login credentials? I'm using terminal for mac and running the line ``` git push origin master ``` It asks me for my github.com username and password every time, is there any way to have it automatically use my credentials? --- I keep getting the error ``` error: The requested URL r...
From your description of things, it sounds like your [Project Dir]/.git/config file is setup with the line `url = https...`, and not `url = git@github.com...`. Can you check that file to see what it says? It'd be great if you could post your entire "remote origin" section. It probably looks something like this: ``` [r...
5024288
Git + Rails: How to restore files deleted with "git rm -r"?
12
2011-02-17 01:50:32
<p>I deleted my db folder in a rails application in with git rm -r</p> <p>I've tried </p> <pre><code>git reset HEAD </code></pre> <p>and</p> <pre><code>git reset --hard HEAD </code></pre> <p>but the migration files arent coming back. I tried commiting, then running the reset and still nothing.</p> <p>What should...
8,839
251,234
2015-06-24 06:52:24
5,024,472
18
2011-02-17 02:32:29
4,353
2011-02-17 02:32:29
https://stackoverflow.com/q/5024288
https://stackoverflow.com/a/5024472
<p>You can checkout the file from the commit where it still exists. Here's how to do it.</p> <pre><code>git checkout &lt;commit where the file still exists&gt; -- db # Example: git checkout 6936142 -- db # This also works, but if you have a branch named the same as the file or path, # it will throw an error. git chec...
<p>You can checkout the file from the commit where it still exists. Here's how to do it.</p> <pre><code>git checkout &lt;commit where the file still exists&gt; -- db # Example: git checkout 6936142 -- db # This also works, but if you have a branch named the same as the file or path, # it will throw an error. git chec...
119, 112901
git, git-rm
<h1>Git + Rails: How to restore files deleted with "git rm -r"?</h1> <p>I deleted my db folder in a rails application in with git rm -r</p> <p>I've tried </p> <pre><code>git reset HEAD </code></pre> <p>and</p> <pre><code>git reset --hard HEAD </code></pre> <p>but the migration files arent coming back. I tried com...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,104
git
# Git + Rails: How to restore files deleted with "git rm -r"? I deleted my db folder in a rails application in with git rm -r I've tried ``` git reset HEAD ``` and ``` git reset --hard HEAD ``` but the migration files arent coming back. I tried commiting, then running the reset and still nothing. What should I d...
You can checkout the file from the commit where it still exists. Here's how to do it. ``` git checkout <commit where the file still exists> -- db # Example: git checkout 6936142 -- db # This also works, but if you have a branch named the same as the file or path, # it will throw an error. git checkout 6936142 db ```
3021649
Git: how to create different unmerged states?
12
2010-06-11 09:24:27
<p>When do different <code>git status</code> unmerged states occur, like <code>added by us</code>, <code>added by them</code> or <code>both deleted</code>?</p> <p>I've tried to reproduce the latter by performing a merge where a file has been deleted in the current and merged-from branch, but I was not able to create t...
2,197
342,896
2011-11-21 16:37:01
3,305,914
18
2010-07-22 05:07:04
303,425
2010-07-22 05:07:04
https://stackoverflow.com/q/3021649
https://stackoverflow.com/a/3305914
<p>You can get all three by renaming a file differently in each branch.</p> <pre><code>git init touch foo git add foo git commit -m 'initial commit' git checkout -b tmp git mv foo X git commit -m 'rename to X' git checkout - git mv foo Y git commit -m 'rename to Y' git merge tmp </code></pre> <p>Now you have all thre...
<p>You can get all three by renaming a file differently in each branch.</p> <pre><code>git init touch foo git add foo git commit -m 'initial commit' git checkout -b tmp git mv foo X git commit -m 'rename to X' git checkout - git mv foo Y git commit -m 'rename to Y' git merge tmp </code></pre> <p>Now you have all thre...
119, 54839
git, git-status
<h1>Git: how to create different unmerged states?</h1> <p>When do different <code>git status</code> unmerged states occur, like <code>added by us</code>, <code>added by them</code> or <code>both deleted</code>?</p> <p>I've tried to reproduce the latter by performing a merge where a file has been deleted in the current...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,105
git
# Git: how to create different unmerged states? When do different `git status` unmerged states occur, like `added by us`, `added by them` or `both deleted`? I've tried to reproduce the latter by performing a merge where a file has been deleted in the current and merged-from branch, but I was not able to create this s...
You can get all three by renaming a file differently in each branch. ``` git init touch foo git add foo git commit -m 'initial commit' git checkout -b tmp git mv foo X git commit -m 'rename to X' git checkout - git mv foo Y git commit -m 'rename to Y' git merge tmp ``` Now you have all three states. ``` $ git status...
55715129
Work on multiple branches with Flask-Migrate
11
2019-04-16 19:11:55
<p>I'm using Flask-Migrate (Alembic) to manage SQLAlchemy database migrations. I'm working on two different branches with different migrations. </p> <ol> <li>If I switch branches, I get an error that the migration is not found.</li> <li>If i merge this branches into the parent branch, I need downgrade migration's on b...
4,097
11,362,461
2023-07-26 18:58:55
55,715,541
18
2019-04-16 19:41:26
400,617
2019-04-17 14:51:55
https://stackoverflow.com/q/55715129
https://stackoverflow.com/a/55715541
<p>Alembic requires the chain of migrations to match the database marker for the current migration. If you create and run some migrations on a branch, then switch to another branch, the database is marked as being on a migration that no longer exists.</p> <p>To work on multiple branches while using migrations, you'll ...
<p>Alembic requires the chain of migrations to match the database marker for the current migration. If you create and run some migrations on a branch, then switch to another branch, the database is marked as being on a migration that no longer exists.</p> <p>To work on multiple branches while using migrations, you'll ...
16, 119, 4075, 81893, 96829
alembic, flask-migrate, git, python, sqlalchemy
<h1>Work on multiple branches with Flask-Migrate</h1> <p>I'm using Flask-Migrate (Alembic) to manage SQLAlchemy database migrations. I'm working on two different branches with different migrations. </p> <ol> <li>If I switch branches, I get an error that the migration is not found.</li> <li>If i merge this branches int...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,109
git
# Work on multiple branches with Flask-Migrate I'm using Flask-Migrate (Alembic) to manage SQLAlchemy database migrations. I'm working on two different branches with different migrations. 1. If I switch branches, I get an error that the migration is not found. 2. If i merge this branches into the parent branch, I nee...
Alembic requires the chain of migrations to match the database marker for the current migration. If you create and run some migrations on a branch, then switch to another branch, the database is marked as being on a migration that no longer exists. To work on multiple branches while using migrations, you'll need to fi...
53682298
Export list of all commit details in VSTS / Azure DevOps into file?
11
2018-12-08 11:58:24
<p>I want to export a list of all commits in a repository (date-time, author, comment) into a file (of any format: CSV, XML, JSON, XLS etc.) which I will then analyse in a spreadsheet.</p> <p>I want to compute stats such as:</p> <ul> <li>number of commits per author per month</li> <li>size of each commit (number of l...
16,371
8,986,802
2021-02-18 03:57:49
53,693,078
18
2018-12-09 13:57:05
8,986,802
2018-12-10 14:29:34
https://stackoverflow.com/q/53682298
https://stackoverflow.com/a/53693078
<p>Thanks to @Philippe for guiding to the answer:</p> <ul> <li>launch MS-DOS command line in the .git subdirectory for the solution</li> <li>issue command: <code>git log --pretty=format:%h,%an,%aD,%s &gt; ./GitLog.csv</code></li> <li>wait for <code>GitLog.csv</code> file to appear and open in spreadsheet program</li> ...
<p>Thanks to @Philippe for guiding to the answer:</p> <ul> <li>launch MS-DOS command line in the .git subdirectory for the solution</li> <li>issue command: <code>git log --pretty=format:%h,%an,%aD,%s &gt; ./GitLog.csv</code></li> <li>wait for <code>GitLog.csv</code> file to appear and open in spreadsheet program</li> ...
119, 1929, 116537
azure-devops, git, reporting
<h1>Export list of all commit details in VSTS / Azure DevOps into file?</h1> <p>I want to export a list of all commits in a repository (date-time, author, comment) into a file (of any format: CSV, XML, JSON, XLS etc.) which I will then analyse in a spreadsheet.</p> <p>I want to compute stats such as:</p> <ul> <li>num...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,110
git
# Export list of all commit details in VSTS / Azure DevOps into file? I want to export a list of all commits in a repository (date-time, author, comment) into a file (of any format: CSV, XML, JSON, XLS etc.) which I will then analyse in a spreadsheet. I want to compute stats such as: - number of commits per author p...
Thanks to @Philippe for guiding to the answer: - launch MS-DOS command line in the .git subdirectory for the solution - issue command: `git log --pretty=format:%h,%an,%aD,%s > ./GitLog.csv` - wait for `GitLog.csv` file to appear and open in spreadsheet program Format option meanings: - `%h` = commit hash - `%an` = A...
41013941
Finding the most frequent committer to a specific file
11
2016-12-07 09:37:32
<p>Given a specific file in a git repository, how would I go about finding who are the most frequent committers in that file?</p>
2,113
983,912
2016-12-07 09:55:25
41,014,063
18
2016-12-07 09:43:28
216,074
2016-12-07 09:46:50
https://stackoverflow.com/q/41013941
https://stackoverflow.com/a/41014063
<p>You can use <a href="https://git-scm.com/docs/git-shortlog" rel="noreferrer">git shortlog</a> for this:</p> <pre><code>git shortlog -sn -- path/to/file </code></pre> <p>This will print out a list of authors for the path, ordered and prefixed by the commit count.</p> <p>Usually, this command is used to get a quick...
<p>You can use <a href="https://git-scm.com/docs/git-shortlog" rel="noreferrer">git shortlog</a> for this:</p> <pre><code>git shortlog -sn -- path/to/file </code></pre> <p>This will print out a list of authors for the path, ordered and prefixed by the commit count.</p> <p>Usually, this command is used to get a quick...
119
git
<h1>Finding the most frequent committer to a specific file</h1> <p>Given a specific file in a git repository, how would I go about finding who are the most frequent committers in that file?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,112
git
# Finding the most frequent committer to a specific file Given a specific file in a git repository, how would I go about finding who are the most frequent committers in that file?
You can use [git shortlog](https://git-scm.com/docs/git-shortlog) for this: ``` git shortlog -sn -- path/to/file ``` This will print out a list of authors for the path, ordered and prefixed by the commit count. Usually, this command is used to get a quick summary of changes, e.g. to generate a changelog. With `-s`, ...
39328064
In which branch should a beta release be tagged?
11
2016-09-05 09:56:41
<p>In which branch should a beta release be tagged according to git-flow?</p> <p>We have a release branch for preparing Version <code>x.0.0</code>, but before releasing <code>x.0.0</code> we want to release a beta (<code>x.0.0-beta</code>). Should the release branch be merged into <code>master</code> in this case and ...
8,739
414,075
2022-04-06 13:49:33
39,328,508
18
2016-09-05 10:21:54
671,491
2022-04-06 13:49:33
https://stackoverflow.com/q/39328064
https://stackoverflow.com/a/39328508
<p>I would suggest that you would place the <code>x.0.0-beta</code> tag on the release branch, once you are ready to ship the beta version, somewhere. You might actually want to go further and tag it with <code>x.0.0-beta0001</code> so that you can have multiple beta version, as required.</p> <p>Once you move closer t...
<p>I would suggest that you would place the <code>x.0.0-beta</code> tag on the release branch, once you are ready to ship the beta version, somewhere. You might actually want to go further and tag it with <code>x.0.0-beta0001</code> so that you can have multiple beta version, as required.</p> <p>Once you move closer t...
119, 4243, 15488, 64339
git, git-flow, release, release-management
<h1>In which branch should a beta release be tagged?</h1> <p>In which branch should a beta release be tagged according to git-flow?</p> <p>We have a release branch for preparing Version <code>x.0.0</code>, but before releasing <code>x.0.0</code> we want to release a beta (<code>x.0.0-beta</code>). Should the release b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,113
git
# In which branch should a beta release be tagged? In which branch should a beta release be tagged according to git-flow? We have a release branch for preparing Version `x.0.0`, but before releasing `x.0.0` we want to release a beta (`x.0.0-beta`). Should the release branch be merged into `master` in this case and th...
I would suggest that you would place the `x.0.0-beta` tag on the release branch, once you are ready to ship the beta version, somewhere. You might actually want to go further and tag it with `x.0.0-beta0001` so that you can have multiple beta version, as required. Once you move closer to the release, you would tag the...
32105130
How can I make git add -p accept keystrokes without waiting for me to press Enter?
11
2015-08-19 20:32:12
<p><code>git add -p</code> is very convenient for staging changes in an interactive fashion. At each change, it prompts the user to press a key to determine what Git should do with the change in question:</p> <pre><code>Stage this hunk [y,n,q,a,d,/,K,j,J,g,s,e,?]? </code></pre> <p>Is there anyway to make git move ont...
408
998,248
2024-04-25 18:43:02
32,105,388
18
2015-08-19 20:47:01
28,804
2024-04-25 18:43:02
https://stackoverflow.com/q/32105130
https://stackoverflow.com/a/32105388
<p>Yes. Set the config option <code>interactive.singlekey</code> to <code>true</code>:</p> <pre><code>git config --global interactive.singlekey true </code></pre> <p>Additionally, make sure, that <code>libterm-readkey-perl</code> is installed.</p>
<p>Yes. Set the config option <code>interactive.singlekey</code> to <code>true</code>:</p> <pre><code>git config --global interactive.singlekey true </code></pre> <p>Additionally, make sure, that <code>libterm-readkey-perl</code> is installed.</p>
119, 4063, 34792
git, git-add, interactive
<h1>How can I make git add -p accept keystrokes without waiting for me to press Enter?</h1> <p><code>git add -p</code> is very convenient for staging changes in an interactive fashion. At each change, it prompts the user to press a key to determine what Git should do with the change in question:</p> <pre><code>Stage t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,115
git
# How can I make git add -p accept keystrokes without waiting for me to press Enter? `git add -p` is very convenient for staging changes in an interactive fashion. At each change, it prompts the user to press a key to determine what Git should do with the change in question: ``` Stage this hunk [y,n,q,a,d,/,K,j,J,g,s...
Yes. Set the config option `interactive.singlekey` to `true`: ``` git config --global interactive.singlekey true ``` Additionally, make sure, that `libterm-readkey-perl` is installed.
31459243
HEAD detached at the HEAD commit id, what's the meaning?
11
2015-07-16 16:02:04
<p><code>git status</code> says:</p> <pre><code>HEAD detached at e1997bd </code></pre> <p>and <code>git rev-parse HEAD</code> says:</p> <pre><code>e1997bd </code></pre> <p>What's the meaning of this?</p> <p>I was thinking HEAD detached means HEAD is not pointing to to branch tip.</p>
8,912
5,082,463
2015-07-16 22:54:31
31,459,412
18
2015-07-16 16:11:02
4,629,810
2015-07-16 22:26:10
https://stackoverflow.com/q/31459243
https://stackoverflow.com/a/31459412
<p>Read through: <a href="http://gitolite.com/detached-head.html" rel="noreferrer">http://gitolite.com/detached-head.html</a></p> <p>You can also look at: <a href="http://gitolite.com/gcs.html#(48)" rel="noreferrer">http://gitolite.com/gcs.html#(48)</a></p> <p>The head points to the commit, that's not the problem. T...
<p>Read through: <a href="http://gitolite.com/detached-head.html" rel="noreferrer">http://gitolite.com/detached-head.html</a></p> <p>You can also look at: <a href="http://gitolite.com/gcs.html#(48)" rel="noreferrer">http://gitolite.com/gcs.html#(48)</a></p> <p>The head points to the commit, that's not the problem. T...
119, 98582
git, git-detached-head
<h1>HEAD detached at the HEAD commit id, what's the meaning?</h1> <p><code>git status</code> says:</p> <pre><code>HEAD detached at e1997bd </code></pre> <p>and <code>git rev-parse HEAD</code> says:</p> <pre><code>e1997bd </code></pre> <p>What's the meaning of this?</p> <p>I was thinking HEAD detached means HEAD is...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,116
git
# HEAD detached at the HEAD commit id, what's the meaning? `git status` says: ``` HEAD detached at e1997bd ``` and `git rev-parse HEAD` says: ``` e1997bd ``` What's the meaning of this? I was thinking HEAD detached means HEAD is not pointing to to branch tip.
Read through: <http://gitolite.com/detached-head.html> You can also look at: <http://gitolite.com/gcs.html#(48)> The head points to the commit, that's not the problem. The problem is that it's no longer a reference to a local branch name. It's the actual SHA1 hash of the commit. This may have happened if you did: `...
25561485
git rebase -i with squash cannot detach HEAD
11
2014-08-29 03:56:22
<p>Using the latest git (<code>2.1.0.24</code>), whenever I try to <code>git rebase -i</code> to <code>squash</code> some commits, the squash cannot <code>detach HEAD</code> state. I expect it to squash the commits and put me back on my branch as I expected. There are no unstaged files, changes in my working tree, or a...
26,387
100,208
2020-09-21 15:43:49
25,562,688
18
2014-08-29 06:21:00
1,256,452
2014-08-29 06:21:00
https://stackoverflow.com/q/25561485
https://stackoverflow.com/a/25562688
<p>The message <code>could not detach HEAD</code> comes from the interactive rebase script, specifically right here:</p> <pre><code>GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" output git checkout $onto || die_abort "could not detach HEAD" git update-ref ORIG_HEAD $orig_head do_rest </code></pre> <p>Th...
<p>The message <code>could not detach HEAD</code> comes from the interactive rebase script, specifically right here:</p> <pre><code>GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" output git checkout $onto || die_abort "could not detach HEAD" git update-ref ORIG_HEAD $orig_head do_rest </code></pre> <p>Th...
119, 29934
git, git-rebase
<h1>git rebase -i with squash cannot detach HEAD</h1> <p>Using the latest git (<code>2.1.0.24</code>), whenever I try to <code>git rebase -i</code> to <code>squash</code> some commits, the squash cannot <code>detach HEAD</code> state. I expect it to squash the commits and put me back on my branch as I expected. There a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,117
git
# git rebase -i with squash cannot detach HEAD Using the latest git (`2.1.0.24`), whenever I try to `git rebase -i` to `squash` some commits, the squash cannot `detach HEAD` state. I expect it to squash the commits and put me back on my branch as I expected. There are no unstaged files, changes in my working tree, or ...
The message `could not detach HEAD` comes from the interactive rebase script, specifically right here: ``` GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" output git checkout $onto || die_abort "could not detach HEAD" git update-ref ORIG_HEAD $orig_head do_rest ``` The curious part here is that the `git c...
9939697
bundle install leads to git clone error. Not sure what this response means
11
2012-03-30 08:46:31
<p>Getting a strange error on bundle install..</p> <pre><code>bundle install Fetching gem metadata from http://rubygems.org/..... Fetching gem metadata from http://rubygems.org/.. Fetching git://github.com/maccman/gdata.git fatal: The remote end hung up unexpectedly Git error: command `git clone 'git://github.com/macc...
10,522
93,311
2024-04-23 07:29:59
9,939,834
18
2012-03-30 08:55:37
140,264
2012-03-30 09:51:33
https://stackoverflow.com/q/9939697
https://stackoverflow.com/a/9939834
<p>The problem is not on your end. Trying: </p> <pre><code>git clone 'git://github.com/maccman/gdata.git' "foobar" --bare --no-hardlinks </code></pre> <p>Fails on my machine with the same error. </p> <p>Interestingly a non-bare clone seems to work as expected. </p> <p><strong>resolution:</strong> Clone from the htt...
<p>The problem is not on your end. Trying: </p> <pre><code>git clone 'git://github.com/maccman/gdata.git' "foobar" --bare --no-hardlinks </code></pre> <p>Fails on my machine with the same error. </p> <p>Interestingly a non-bare clone seems to work as expected. </p> <p><strong>resolution:</strong> Clone from the htt...
119, 3050, 4984
clone, git, ruby-on-rails
<h1>bundle install leads to git clone error. Not sure what this response means</h1> <p>Getting a strange error on bundle install..</p> <pre><code>bundle install Fetching gem metadata from http://rubygems.org/..... Fetching gem metadata from http://rubygems.org/.. Fetching git://github.com/maccman/gdata.git fatal: The ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,119
git
# bundle install leads to git clone error. Not sure what this response means Getting a strange error on bundle install.. ``` bundle install Fetching gem metadata from http://rubygems.org/..... Fetching gem metadata from http://rubygems.org/.. Fetching git://github.com/maccman/gdata.git fatal: The remote end hung up u...
The problem is not on your end. Trying: ``` git clone 'git://github.com/maccman/gdata.git' "foobar" --bare --no-hardlinks ``` Fails on my machine with the same error. Interestingly a non-bare clone seems to work as expected. **resolution:** Clone from the https interface: `https://github.com/maccman/gdata.git` inst...
9592908
Error in sideband demultiplexer with a git post-receive hook
11
2012-03-06 22:26:25
<p>I have set up one of my EC2 instances with git and using a post-receive hook I have it deploying to my server with <a href="http://caiustheory.com/automatically-deploying-website-from-remote-git-repository">this tutorial</a>. This is the output from my console:</p> <pre><code>$ git push production master git@examp...
7,202
528,396
2012-03-06 23:29:21
9,593,585
18
2012-03-06 23:29:21
528,396
2012-03-06 23:29:21
https://stackoverflow.com/q/9592908
https://stackoverflow.com/a/9593585
<p>I have figured out the problem that I was having. Apparently, you have to make sure you read everything from STDIN before completing the script.</p> <p>This was my post-receive hook before:</p> <pre><code>#!/bin/sh git checkout -f </code></pre> <p>This is what I added that solved the problem:</p> <pre><code>#!/...
<p>I have figured out the problem that I was having. Apparently, you have to make sure you read everything from STDIN before completing the script.</p> <p>This was my post-receive hook before:</p> <pre><code>#!/bin/sh git checkout -f </code></pre> <p>This is what I added that solved the problem:</p> <pre><code>#!/...
80, 119, 853, 43087
apache, git, githooks, hook
<h1>Error in sideband demultiplexer with a git post-receive hook</h1> <p>I have set up one of my EC2 instances with git and using a post-receive hook I have it deploying to my server with <a href="http://caiustheory.com/automatically-deploying-website-from-remote-git-repository">this tutorial</a>. This is the output f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,120
git
# Error in sideband demultiplexer with a git post-receive hook I have set up one of my EC2 instances with git and using a post-receive hook I have it deploying to my server with [this tutorial](http://caiustheory.com/automatically-deploying-website-from-remote-git-repository). This is the output from my console: ``` ...
I have figured out the problem that I was having. Apparently, you have to make sure you read everything from STDIN before completing the script. This was my post-receive hook before: ``` #!/bin/sh git checkout -f ``` This is what I added that solved the problem: ``` #!/bin/sh while read oldrev newrev refname do : d...
8746739
Possibly lost some changes via git
11
2012-01-05 17:19:55
<p>The other day I was trying to push some changes to the remote server. </p> <p>I kept getting an error so I looked to see what branch I was on. </p> <p>I saw that I was un an undefined branch locally, which was really freaking weird so I checked out master and then was able to push. </p> <p>Just checked out the me...
467
4,140
2016-11-25 20:24:34
8,746,781
18
2012-01-05 17:22:38
477,399
2016-11-25 20:24:34
https://stackoverflow.com/q/8746739
https://stackoverflow.com/a/8746781
<p>Check</p> <pre><code>git reflog </code></pre> <p>That will give you a history of operations, and if your changes were checked in, they'll be in a revision somewhere in that log.</p> <p>You might also look at the output from:</p> <pre><code>git rev-list --all --header HEAD </code></pre> <p>This will show a large...
<p>Check</p> <pre><code>git reflog </code></pre> <p>That will give you a history of operations, and if your changes were checked in, they'll be in a revision somewhere in that log.</p> <p>You might also look at the output from:</p> <pre><code>git rev-list --all --header HEAD </code></pre> <p>This will show a large...
119
git
<h1>Possibly lost some changes via git</h1> <p>The other day I was trying to push some changes to the remote server. </p> <p>I kept getting an error so I looked to see what branch I was on. </p> <p>I saw that I was un an undefined branch locally, which was really freaking weird so I checked out master and then was ab...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,121
git
# Possibly lost some changes via git The other day I was trying to push some changes to the remote server. I kept getting an error so I looked to see what branch I was on. I saw that I was un an undefined branch locally, which was really freaking weird so I checked out master and then was able to push. Just checked...
Check ``` git reflog ``` That will give you a history of operations, and if your changes were checked in, they'll be in a revision somewhere in that log. You might also look at the output from: ``` git rev-list --all --header HEAD ``` This will show a large chunk of what's in the repository. You may need to work w...
4764304
Git: Export MySQL database on commit?
11
2011-01-21 22:06:31
<p>Is there a way I can utilize git to export/download my MySQL development database that is utilized in my code on a commit or some other way through git so that whenever I clone my project, I always have a current copy of the database?</p> <p>If not, I can always export the database, and add it to the source, I was ...
5,815
259,717
2012-04-05 08:24:29
4,766,435
18
2011-01-22 06:01:42
259,717
2011-01-22 06:01:42
https://stackoverflow.com/q/4764304
https://stackoverflow.com/a/4766435
<p>I ended up using the git hooks as I anticipated. I created the <code>pre-commit</code> hook and added the following to it:</p> <pre>#!/bin/bash DBUSER="sysbackup" DBPASS="password" DB="database-name" SCHEMAPATH="DBSchema" mysqldump -u $DBUSER -p$DBPASS $DB > $SCHEMAPATH/$DB.sql git add $SCHEMAPATH/$DB.sql exit 0<...
<p>I ended up using the git hooks as I anticipated. I created the <code>pre-commit</code> hook and added the following to it:</p> <pre>#!/bin/bash DBUSER="sysbackup" DBPASS="password" DB="database-name" SCHEMAPATH="DBSchema" mysqldump -u $DBUSER -p$DBPASS $DB > $SCHEMAPATH/$DB.sql git add $SCHEMAPATH/$DB.sql exit 0<...
21, 119, 4167
export, git, mysql
<h1>Git: Export MySQL database on commit?</h1> <p>Is there a way I can utilize git to export/download my MySQL development database that is utilized in my code on a commit or some other way through git so that whenever I clone my project, I always have a current copy of the database?</p> <p>If not, I can always export...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,123
git
# Git: Export MySQL database on commit? Is there a way I can utilize git to export/download my MySQL development database that is utilized in my code on a commit or some other way through git so that whenever I clone my project, I always have a current copy of the database? If not, I can always export the database, a...
I ended up using the git hooks as I anticipated. I created the `pre-commit` hook and added the following to it: ``` #!/bin/bash DBUSER="sysbackup" DBPASS="password" DB="database-name" SCHEMAPATH="DBSchema" mysqldump -u $DBUSER -p$DBPASS $DB > $SCHEMAPATH/$DB.sql git add $SCHEMAPATH/$DB.sql exit 0 ```
4195723
How do I download from gitorious?
11
2010-11-16 15:25:07
<p>How to clone projects from <a href="http://gitorious.org" rel="noreferrer">gitorious.org</a>?</p> <p>I'd like to clone <a href="http://gitorious.org/lightopenid" rel="noreferrer">http://gitorious.org/lightopenid</a></p> <p>UPDATE: this project is moved away, example of existing project: <a href="https://gitorious....
10,617
197,606
2017-05-09 02:32:21
4,195,751
18
2010-11-16 15:27:44
119,963
2010-11-16 15:27:44
https://stackoverflow.com/q/4195723
https://stackoverflow.com/a/4195751
<p>That page conveniently has a URL on it for you! All you need to do is install git on your system and clone that repository:</p> <pre><code>git clone git://gitorious.org/lightopenid/lightopenid.git </code></pre> <p>Or, if you're not actually planning on working with the repository, it looks like you can click on so...
<p>That page conveniently has a URL on it for you! All you need to do is install git on your system and clone that repository:</p> <pre><code>git clone git://gitorious.org/lightopenid/lightopenid.git </code></pre> <p>Or, if you're not actually planning on working with the repository, it looks like you can click on so...
119, 5963
git, gitorious
<h1>How do I download from gitorious?</h1> <p>How to clone projects from <a href="http://gitorious.org" rel="noreferrer">gitorious.org</a>?</p> <p>I'd like to clone <a href="http://gitorious.org/lightopenid" rel="noreferrer">http://gitorious.org/lightopenid</a></p> <p>UPDATE: this project is moved away, example of ex...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,124
git
# How do I download from gitorious? How to clone projects from [gitorious.org](http://gitorious.org)? I'd like to clone <http://gitorious.org/lightopenid> UPDATE: this project is moved away, example of existing project: <https://gitorious.org/dbus-cplusplus/mainline>
That page conveniently has a URL on it for you! All you need to do is install git on your system and clone that repository: ``` git clone git://gitorious.org/lightopenid/lightopenid.git ``` Or, if you're not actually planning on working with the repository, it looks like you can click on source tree, then there's an ...
68092423
"Sharing Git credentials with your container" doesn't work
10
2021-06-23 01:22:14
<h1>What I did</h1> <ol> <li>set the git config globally.</li> </ol> <pre><code>(local) $ git config --global user.email &quot;you@example.com&quot; (local) $ git config --global user.name &quot;Your Name&quot; </code></pre> <ol start="2"> <li><p>Remote-Container: rebuild Container</p> </li> <li><p>Git commit</p> </li>...
9,325
16,164,828
2023-06-07 12:58:31
73,097,009
18
2022-07-24 09:00:53
2,957,291
2022-08-03 17:26:07
https://stackoverflow.com/q/68092423
https://stackoverflow.com/a/73097009
<p>I had a similar issue because I was running <code>git config --global</code> in <code>postCreateCommand</code>. I wanted to change the diff and merge tools in the container. However, my username and password disappeared from my <code>.gitconfig</code>. I did not understand the cause yet, but I solved the issue by ad...
<p>I had a similar issue because I was running <code>git config --global</code> in <code>postCreateCommand</code>. I wanted to change the diff and merge tools in the container. However, my username and password disappeared from my <code>.gitconfig</code>. I did not understand the cause yet, but I solved the issue by ad...
119, 111608
git, visual-studio-code
<h1>"Sharing Git credentials with your container" doesn't work</h1> <h1>What I did</h1> <ol> <li>set the git config globally.</li> </ol> <pre><code>(local) $ git config --global user.email &quot;you@example.com&quot; (local) $ git config --global user.name &quot;Your Name&quot; </code></pre> <ol start="2"> <li><p>Remot...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,125
git
# "Sharing Git credentials with your container" doesn't work # What I did 1. set the git config globally. ``` (local) $ git config --global user.email "you@example.com" (local) $ git config --global user.name "Your Name" ``` 2. Remote-Container: rebuild Container 3. Git commit ``` (Remote-Container) $ git commit -...
I had a similar issue because I was running `git config --global` in `postCreateCommand`. I wanted to change the diff and merge tools in the container. However, my username and password disappeared from my `.gitconfig`. I did not understand the cause yet, but I solved the issue by adding my commands to the `postAttachC...
53805732
How to undo a git commit without losing my files?
10
2018-12-16 19:29:16
<p>Here's something that regularly happens to me at work:</p> <pre><code>[user@macmini ~/code/project $] git add . [user@macmini ~/code/project $] git commit -m "Fixed whatever bug" [master 93a3c47] Fixed whatever bug 3 files changed, 290 insertions(+) create mode 100644 .DS_Store create mode 100755 some-code.js c...
10,890
10,795,189
2018-12-16 19:38:32
53,805,751
18
2018-12-16 19:31:32
626,853
2018-12-16 19:38:32
https://stackoverflow.com/q/53805732
https://stackoverflow.com/a/53805751
<pre><code>git reset HEAD~1 </code></pre> <p>This will "undo" your last commit without touching your working directory (any our files). It is the same as <code>git reset --mixed HEAD~1</code>. You can also do <code>git reset --soft HEAD~1</code>, which will leave all the files as marked for commit.</p> <p>If you most...
<pre><code>git reset HEAD~1 </code></pre> <p>This will "undo" your last commit without touching your working directory (any our files). It is the same as <code>git reset --mixed HEAD~1</code>. You can also do <code>git reset --soft HEAD~1</code>, which will leave all the files as marked for commit.</p> <p>If you most...
119, 456
git, version-control
<h1>How to undo a git commit without losing my files?</h1> <p>Here's something that regularly happens to me at work:</p> <pre><code>[user@macmini ~/code/project $] git add . [user@macmini ~/code/project $] git commit -m "Fixed whatever bug" [master 93a3c47] Fixed whatever bug 3 files changed, 290 insertions(+) creat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,126
git
# How to undo a git commit without losing my files? Here's something that regularly happens to me at work: ``` [user@macmini ~/code/project $] git add . [user@macmini ~/code/project $] git commit -m "Fixed whatever bug" [master 93a3c47] Fixed whatever bug 3 files changed, 290 insertions(+) create mode 100644 .DS_St...
``` git reset HEAD~1 ``` This will "undo" your last commit without touching your working directory (any our files). It is the same as `git reset --mixed HEAD~1`. You can also do `git reset --soft HEAD~1`, which will leave all the files as marked for commit. If you mostly like your commit, but just want to make a smal...
52688981
Issues with the format of .cpanel.yml file when trying to deploy cpanel git repository to directory.
10
2018-10-07 13:31:03
<ul> <li>I am using a cpanel web administration system. </li> <li>With it i create a git repository.</li> <li>I am able to push my local code to that git repository.</li> </ul> <p>The problem arises when i attempt to deploy the code in the repository to a production directory on my server.</p> <p>According to <a href...
15,292
10,428,030
2022-02-10 18:49:10
53,441,127
18
2018-11-23 05:35:36
10,693,910
2019-09-21 05:50:36
https://stackoverflow.com/q/52688981
https://stackoverflow.com/a/53441127
<p>So this is basically a bash script that CPanel runs when you update your repo stored on the server. the layout in your case should be:</p> <p><strong>Please remove all "# comments" if you are copying the example or it might not work</strong></p> <pre><code>--- deployment: tasks: - export DEPLOYPATH=/...
<p>So this is basically a bash script that CPanel runs when you update your repo stored on the server. the layout in your case should be:</p> <p><strong>Please remove all "# comments" if you are copying the example or it might not work</strong></p> <pre><code>--- deployment: tasks: - export DEPLOYPATH=/...
58, 119, 12409
cpanel, git, linux
<h1>Issues with the format of .cpanel.yml file when trying to deploy cpanel git repository to directory.</h1> <ul> <li>I am using a cpanel web administration system. </li> <li>With it i create a git repository.</li> <li>I am able to push my local code to that git repository.</li> </ul> <p>The problem arises when i att...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,127
git
# Issues with the format of .cpanel.yml file when trying to deploy cpanel git repository to directory. - I am using a cpanel web administration system. - With it i create a git repository. - I am able to push my local code to that git repository. The problem arises when i attempt to deploy the code in the repository ...
So this is basically a bash script that CPanel runs when you update your repo stored on the server. the layout in your case should be: **Please remove all "# comments" if you are copying the example or it might not work** ``` --- deployment: tasks: - export DEPLOYPATH=/home/<username>/public_html/<app_f...
50438607
HEAD~4^2 meaning
10
2018-05-20 19:24:16
<p>In a Udacity lesson covering relative commit references, it says:</p> <blockquote> <p>^ indicates the parent commit, ~ indicates the first parent commit</p> <p>The main difference between the ^ and the ~ is when a commit is created from a merge. A merge commit has two parents. With a merge commit, the ^ ...
5,803
8,888,320
2020-11-25 13:49:38
50,438,784
18
2018-05-20 19:46:19
4,621,513
2018-05-21 20:50:37
https://stackoverflow.com/q/50438607
https://stackoverflow.com/a/50438784
<p><code>X~n</code> means: The <code>n</code>th ancestor of <code>X</code>.</p> <p><code>X^</code> means: The parent of <code>X</code>. This is equivalent to <code>X~1</code>.</p> <p>If <code>X</code> has more than one parent, one needs to distinguish between them when using the <code>^</code> notation. So <code>X^1<...
<p><code>X~n</code> means: The <code>n</code>th ancestor of <code>X</code>.</p> <p><code>X^</code> means: The parent of <code>X</code>. This is equivalent to <code>X~1</code>.</p> <p>If <code>X</code> has more than one parent, one needs to distinguish between them when using the <code>^</code> notation. So <code>X^1<...
119, 47913
git, git-log
<h1>HEAD~4^2 meaning</h1> <p>In a Udacity lesson covering relative commit references, it says:</p> <blockquote> <p>^ indicates the parent commit, ~ indicates the first parent commit</p> <p>The main difference between the ^ and the ~ is when a commit is created from a merge. A merge commit has two parents. Wit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,128
git
# HEAD~4^2 meaning In a Udacity lesson covering relative commit references, it says: > ^ indicates the parent commit, ~ indicates the first parent commit > > The main difference between the ^ and the ~ is when a commit is > created from a merge. A merge commit has two parents. With a merge > commit, the ^ reference i...
`X~n` means: The `n`th ancestor of `X`. `X^` means: The parent of `X`. This is equivalent to `X~1`. If `X` has more than one parent, one needs to distinguish between them when using the `^` notation. So `X^1` would be the first parent, `X^2` would be the second parent, and so on. `X^` is equivalent to `X^1` (and also...
45958737
git clean does not clean unwanted folder
10
2017-08-30 11:04:22
<p>I have a .NET solution which, after switching back to master branch, leaves a project folder behind. I want to clean this folder up (there is nothing but bin and obj folders inside, with some old dll's) so I tried <code>git clean -f -d</code>. This did not work.</p> <p>I checked which files are being tracked by git ...
5,238
71,376
2022-08-09 19:04:57
45,959,772
18
2017-08-30 11:55:28
267
2018-12-20 11:26:25
https://stackoverflow.com/q/45958737
https://stackoverflow.com/a/45959772
<p>If there are ignored files in that folder, <code>git clean</code> won't remove the folder.</p> <p>The options you want to look into, possibly using all three of them are:</p> <ul> <li><code>-f</code>: force git clean to delete the files</li> <li><code>-d</code>: delete untracked directories in addition to untracke...
<p>If there are ignored files in that folder, <code>git clean</code> won't remove the folder.</p> <p>The options you want to look into, possibly using all three of them are:</p> <ul> <li><code>-f</code>: force git clean to delete the files</li> <li><code>-d</code>: delete untracked directories in addition to untracke...
119
git
<h1>git clean does not clean unwanted folder</h1> <p>I have a .NET solution which, after switching back to master branch, leaves a project folder behind. I want to clean this folder up (there is nothing but bin and obj folders inside, with some old dll's) so I tried <code>git clean -f -d</code>. This did not work.</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,129
git
# git clean does not clean unwanted folder I have a .NET solution which, after switching back to master branch, leaves a project folder behind. I want to clean this folder up (there is nothing but bin and obj folders inside, with some old dll's) so I tried `git clean -f -d`. This did not work. I checked which files a...
If there are ignored files in that folder, `git clean` won't remove the folder. The options you want to look into, possibly using all three of them are: - `-f`: force git clean to delete the files - `-d`: delete untracked directories in addition to untracked files - `-x`: delete files that are ignored by git This co...
40328561
How to prepare and apply multiple patches for the last N commits in git
10
2016-10-30 11:27:43
<p>I need to create a patch file for the last N commits and apply them as separate commits to another branch. For N=3 I assume I have to do this:</p> <blockquote> <p>git diff HEAD~3 HEAD~2 >> diff1<br> git diff HEAD~2 HEAD~1 >> diff2<br> git diff HEAD~1 HEAD >> diff3</p> </blockquote> <p>and then apply them on ...
10,227
69,537
2018-05-25 14:53:04
43,815,587
18
2017-05-06 00:52:01
3,194,828
2017-05-06 00:52:01
https://stackoverflow.com/q/40328561
https://stackoverflow.com/a/43815587
<p>This can be done with <a href="https://git-scm.com/docs/git-format-patch" rel="noreferrer">git format-patch</a> and <a href="https://git-scm.com/docs/git-am" rel="noreferrer">git am</a>, respectively. From your example, try:</p> <pre><code>git format-patch HEAD~3 </code></pre> <p>This will generate files <code>00...
<p>This can be done with <a href="https://git-scm.com/docs/git-format-patch" rel="noreferrer">git format-patch</a> and <a href="https://git-scm.com/docs/git-am" rel="noreferrer">git am</a>, respectively. From your example, try:</p> <pre><code>git format-patch HEAD~3 </code></pre> <p>This will generate files <code>00...
119, 606, 9033, 94361
diff, git, git-apply, git-diff
<h1>How to prepare and apply multiple patches for the last N commits in git</h1> <p>I need to create a patch file for the last N commits and apply them as separate commits to another branch. For N=3 I assume I have to do this:</p> <blockquote> <p>git diff HEAD~3 HEAD~2 >> diff1<br> git diff HEAD~2 HEAD~1 >> diff2<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,130
git
# How to prepare and apply multiple patches for the last N commits in git I need to create a patch file for the last N commits and apply them as separate commits to another branch. For N=3 I assume I have to do this: > git diff HEAD~3 HEAD~2 >> diff1 > git diff HEAD~2 HEAD~1 >> diff2 > git diff HEAD~1 HEAD >> dif...
This can be done with [git format-patch](https://git-scm.com/docs/git-format-patch) and [git am](https://git-scm.com/docs/git-am), respectively. From your example, try: ``` git format-patch HEAD~3 ``` This will generate files `0001-commit-foo.patch`, `0002-commit-bar.patch`, `0003-commit-baz.patch`. Then you can copy...
42840041
How to unbundle a git bundle?
10
2017-03-16 16:43:59
<p>I just received a Git bundle via email. How do I unbundle it in order to read it? I am having trouble using the unbundle command. I have tried</p> <pre><code>git unbundle *bundle name* </code></pre> <p>but that gives me just a weird code</p> <pre><code>eae0b00697e53cd87c871143051673f3ee413148 </code></pre> <p>an...
13,308
5,921,058
2020-09-08 23:51:57
42,842,995
18
2017-03-16 19:16:08
1,256,452
2017-03-16 19:16:08
https://stackoverflow.com/q/42840041
https://stackoverflow.com/a/42842995
<blockquote> <p>I am having trouble using the unbundle command.</p> </blockquote> <p>You are not supposed to run this command at all.</p> <blockquote> <p>I just received a Git bundle via email. How do I unbundle it in order to read it?</p> </blockquote> <p>This is described in <a href="https://www.kernel.org/pub...
<blockquote> <p>I am having trouble using the unbundle command.</p> </blockquote> <p>You are not supposed to run this command at all.</p> <blockquote> <p>I just received a Git bundle via email. How do I unbundle it in order to read it?</p> </blockquote> <p>This is described in <a href="https://www.kernel.org/pub...
119, 2669, 82677
bundle, git, git-bundle
<h1>How to unbundle a git bundle?</h1> <p>I just received a Git bundle via email. How do I unbundle it in order to read it? I am having trouble using the unbundle command. I have tried</p> <pre><code>git unbundle *bundle name* </code></pre> <p>but that gives me just a weird code</p> <pre><code>eae0b00697e53cd87c87114...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,131
git
# How to unbundle a git bundle? I just received a Git bundle via email. How do I unbundle it in order to read it? I am having trouble using the unbundle command. I have tried ``` git unbundle *bundle name* ``` but that gives me just a weird code ``` eae0b00697e53cd87c871143051673f3ee413148 ``` and refs/heads/maste...
> I am having trouble using the unbundle command. You are not supposed to run this command at all. > I just received a Git bundle via email. How do I unbundle it in order to read it? This is described in [the `git bundle` documentation](https://www.kernel.org/pub/software/scm/git/docs/git-bundle.html): > ### EXAMPL...
41339160
Can Git merge --squash preserve commit comments?
10
2016-12-27 04:50:20
<p>Is there a way of automatically adding all the commit comments from the squashed <code>mybranch</code> commits when doing a</p> <pre><code>git merge --squash mybranch </code></pre> <p>so that the single commit contains a concatenation of all the commit comments from <code>mybranch</code></p>
8,371
673,593
2016-12-27 06:35:29
41,340,089
18
2016-12-27 06:26:51
5,819,286
2016-12-27 06:35:29
https://stackoverflow.com/q/41339160
https://stackoverflow.com/a/41340089
<p>I think that's what "git merge --squash" does automatically! Just do the commit with "git commit --no-edit" and I think that's what you'll get. I see all the commit messages inside .git/SQUASH_MSG immediately after I run the "git merge --squash" command. Do you?</p> <p>Personally, I squash into master, but then ...
<p>I think that's what "git merge --squash" does automatically! Just do the commit with "git commit --no-edit" and I think that's what you'll get. I see all the commit messages inside .git/SQUASH_MSG immediately after I run the "git merge --squash" command. Do you?</p> <p>Personally, I squash into master, but then ...
119, 28897
git, git-merge
<h1>Can Git merge --squash preserve commit comments?</h1> <p>Is there a way of automatically adding all the commit comments from the squashed <code>mybranch</code> commits when doing a</p> <pre><code>git merge --squash mybranch </code></pre> <p>so that the single commit contains a concatenation of all the commit comm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,132
git
# Can Git merge --squash preserve commit comments? Is there a way of automatically adding all the commit comments from the squashed `mybranch` commits when doing a ``` git merge --squash mybranch ``` so that the single commit contains a concatenation of all the commit comments from `mybranch`
I think that's what "git merge --squash" does automatically! Just do the commit with "git commit --no-edit" and I think that's what you'll get. I see all the commit messages inside .git/SQUASH_MSG immediately after I run the "git merge --squash" command. Do you? Personally, I squash into master, but then force-push th...
40347431
Why does Git have a Workspace, Staging Area, and Local Repository?
10
2016-10-31 17:34:12
<p>I am trying to understand why Git has so many places to store changes. Imagine a simpler Git model that has only a local repository (and not a separate staging area or workspace). In this model:</p> <ol> <li>We could pick files in the local repository we want Git to track </li> <li>We could track changes by taking ...
8,983
6,889,933
2016-10-31 19:00:05
40,347,678
18
2016-10-31 17:50:00
3,684,641
2016-10-31 19:00:05
https://stackoverflow.com/q/40347431
https://stackoverflow.com/a/40347678
<p>There have been <strong>tomes</strong> written on git. Maybe what's missing for you are concrete examples of when a workspace and staging area would be useful.</p> <h2>Working tree / Work tree</h2> <p>1) You're working on this nifty idea for a few minutes, but it's not quite ready for your local repository. After ...
<p>There have been <strong>tomes</strong> written on git. Maybe what's missing for you are concrete examples of when a workspace and staging area would be useful.</p> <h2>Working tree / Work tree</h2> <p>1) You're working on this nifty idea for a few minutes, but it's not quite ready for your local repository. After ...
119
git
<h1>Why does Git have a Workspace, Staging Area, and Local Repository?</h1> <p>I am trying to understand why Git has so many places to store changes. Imagine a simpler Git model that has only a local repository (and not a separate staging area or workspace). In this model:</p> <ol> <li>We could pick files in the local...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,133
git
# Why does Git have a Workspace, Staging Area, and Local Repository? I am trying to understand why Git has so many places to store changes. Imagine a simpler Git model that has only a local repository (and not a separate staging area or workspace). In this model: 1. We could pick files in the local repository we want...
There have been **tomes** written on git. Maybe what's missing for you are concrete examples of when a workspace and staging area would be useful. ## Working tree / Work tree 1) You're working on this nifty idea for a few minutes, but it's not quite ready for your local repository. After a few min of tinkering, you r...
33815424
after git rebase my local branch and remote branch have diverged
10
2015-11-19 22:19:39
<p>I have a <code>my-feature</code> branch that is pushed up to origin for code review. It is <strong>not shared</strong>. Eventually it will get merged into my <code>develop</code> branch which <strong>is shared</strong> amongst my team. I'd like to rebase my <code>develop</code> branch into <code>my-feature</code> to...
8,388
2,005,291
2015-12-02 10:03:16
34,024,583
18
2015-12-01 15:58:09
6,309
2015-12-02 10:03:16
https://stackoverflow.com/q/33815424
https://stackoverflow.com/a/34024583
<p>First, you can do a <code>git push --force</code> at this stage without any worries: you have said your branch is not shared.<br> So changing its history on the server side won't affect any other user.</p> <p>Second, when you rebase a branch, you change its common ancestor from with its remote tracking branch (<cod...
<p>First, you can do a <code>git push --force</code> at this stage without any worries: you have said your branch is not shared.<br> So changing its history on the server side won't affect any other user.</p> <p>Second, when you rebase a branch, you change its common ancestor from with its remote tracking branch (<cod...
119, 28896, 29934
git, git-pull, git-rebase
<h1>after git rebase my local branch and remote branch have diverged</h1> <p>I have a <code>my-feature</code> branch that is pushed up to origin for code review. It is <strong>not shared</strong>. Eventually it will get merged into my <code>develop</code> branch which <strong>is shared</strong> amongst my team. I'd lik...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,134
git
# after git rebase my local branch and remote branch have diverged I have a `my-feature` branch that is pushed up to origin for code review. It is **not shared**. Eventually it will get merged into my `develop` branch which **is shared** amongst my team. I'd like to rebase my `develop` branch into `my-feature` to keep...
First, you can do a `git push --force` at this stage without any worries: you have said your branch is not shared. So changing its history on the server side won't affect any other user. Second, when you rebase a branch, you change its common ancestor from with its remote tracking branch (`origin/xxx`) Before `git ...
29294910
Unable to add files with name containing tilde, '~' followed by a number
10
2015-03-27 06:52:08
<p>The folder consists of files with filenames like <code>abc~1</code>, <code>123~1</code>, <code>a1d2~3</code>.</p> <p>When I do <code>git add --all</code> it says,</p> <pre><code>$ git add --all error: Invalid path 'abc~1.png' error: unable to add abc~1.png to index fatal: adding files failed </code></pre> <p>I di...
4,684
3,616,444
2015-07-01 15:08:20
29,300,360
18
2015-03-27 12:10:36
1,640,661
2015-07-01 15:08:20
https://stackoverflow.com/q/29294910
https://stackoverflow.com/a/29300360
<p>This is the result of a change that was made to msys Git <a href="https://github.com/msysgit/git/commit/2e2a2d12" rel="noreferrer">in December 2014</a>.</p> <blockquote> <p>On Windows' default filesystems, FAT and NTFS, DOS-style 8.3 file names are supported for backwards compatibility. That means that there are mul...
<p>This is the result of a change that was made to msys Git <a href="https://github.com/msysgit/git/commit/2e2a2d12" rel="noreferrer">in December 2014</a>.</p> <blockquote> <p>On Windows' default filesystems, FAT and NTFS, DOS-style 8.3 file names are supported for backwards compatibility. That means that there are mul...
119, 317, 21628, 24271
git, indexing, msysgit, tilde
<h1>Unable to add files with name containing tilde, '~' followed by a number</h1> <p>The folder consists of files with filenames like <code>abc~1</code>, <code>123~1</code>, <code>a1d2~3</code>.</p> <p>When I do <code>git add --all</code> it says,</p> <pre><code>$ git add --all error: Invalid path 'abc~1.png' error: ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,135
git
# Unable to add files with name containing tilde, '~' followed by a number The folder consists of files with filenames like `abc~1`, `123~1`, `a1d2~3`. When I do `git add --all` it says, ``` $ git add --all error: Invalid path 'abc~1.png' error: unable to add abc~1.png to index fatal: adding files failed ``` I did ...
This is the result of a change that was made to msys Git [in December 2014](https://github.com/msysgit/git/commit/2e2a2d12). > On Windows' default filesystems, FAT and NTFS, DOS-style 8.3 file names are > supported for backwards compatibility. That means that there are multiple > ways to reference the same file. For e...
26526252
Run git pull over all subdirectories windows command promt
10
2014-10-23 10:36:10
<p>How can I update multiple git repositories from their shared parent's directory without cd'ing into each repo's root directory on windows 7 ? </p> <p>I have the following which are all separate git repositories (not submodules):</p> <pre><code>c:\projects\repos\repo1 c:\projects\repos\repo2 c:\projects\repos\repo3...
7,238
4,173,501
2016-08-08 13:53:23
26,527,278
18
2014-10-23 11:43:21
4,164,893
2014-12-09 23:59:34
https://stackoverflow.com/q/26526252
https://stackoverflow.com/a/26527278
<p>Windows Batch solution:</p> <p>if you want to use this in .bat script use this:</p> <pre><code>for /D %%G in ("*") do (echo %%G) &amp;&amp; (cd %%G) &amp;&amp; (git pull origin) &amp;&amp; (cd ..) </code></pre> <p>if it's just in the console:</p> <pre><code>for /D %G in ("*") do (echo %G) &amp;&amp; (cd %G) &amp...
<p>Windows Batch solution:</p> <p>if you want to use this in .bat script use this:</p> <pre><code>for /D %%G in ("*") do (echo %%G) &amp;&amp; (cd %%G) &amp;&amp; (git pull origin) &amp;&amp; (cd ..) </code></pre> <p>if it's just in the console:</p> <pre><code>for /D %G in ("*") do (echo %G) &amp;&amp; (cd %G) &amp...
64, 119, 9938
command-prompt, git, windows
<h1>Run git pull over all subdirectories windows command promt</h1> <p>How can I update multiple git repositories from their shared parent's directory without cd'ing into each repo's root directory on windows 7 ? </p> <p>I have the following which are all separate git repositories (not submodules):</p> <pre><code>c:\...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,136
git
# Run git pull over all subdirectories windows command promt How can I update multiple git repositories from their shared parent's directory without cd'ing into each repo's root directory on windows 7 ? I have the following which are all separate git repositories (not submodules): ``` c:\projects\repos\repo1 c:\proj...
Windows Batch solution: if you want to use this in .bat script use this: ``` for /D %%G in ("*") do (echo %%G) && (cd %%G) && (git pull origin) && (cd ..) ``` if it's just in the console: ``` for /D %G in ("*") do (echo %G) && (cd %G) && (git pull origin) && (cd ..) ```
26178420
GIT Rebase operation was interrupted by a PC crash. Now repository is unavailable
10
2014-10-03 11:49:45
<p>I have 2 branches in my repository. There were no uncommitted changes in any of them.</p> <p>I pulled the branch1, checked out branch2, and started a branch2 rebase on branch1.<br> In the middle of the work my PC crashed. </p> <p>After it finally booted up, i open GitExtensions to find that my repository is total...
1,826
1,651,105
2014-10-03 12:54:21
26,179,324
18
2014-10-03 12:54:21
1,651,105
2014-10-03 12:54:21
https://stackoverflow.com/q/26178420
https://stackoverflow.com/a/26179324
<p>After checking <code>.git</code> directory files, i have noticed that ORIG_HEAD and HEAD files contained only NULLS. It seems i have finally figured out how to fix this.</p> <ol> <li>Deleted <code>index</code> file. </li> <li>Deleted <code>ORIG_HEAD</code> file. </li> <li>Deleted <code>HEAD</code> file.</li> <li>...
<p>After checking <code>.git</code> directory files, i have noticed that ORIG_HEAD and HEAD files contained only NULLS. It seems i have finally figured out how to fix this.</p> <ol> <li>Deleted <code>index</code> file. </li> <li>Deleted <code>ORIG_HEAD</code> file. </li> <li>Deleted <code>HEAD</code> file.</li> <li>...
119, 34595, 39597
git, git-extensions, windows-7
<h1>GIT Rebase operation was interrupted by a PC crash. Now repository is unavailable</h1> <p>I have 2 branches in my repository. There were no uncommitted changes in any of them.</p> <p>I pulled the branch1, checked out branch2, and started a branch2 rebase on branch1.<br> In the middle of the work my PC crashed. </...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,137
git
# GIT Rebase operation was interrupted by a PC crash. Now repository is unavailable I have 2 branches in my repository. There were no uncommitted changes in any of them. I pulled the branch1, checked out branch2, and started a branch2 rebase on branch1. In the middle of the work my PC crashed. After it finally boo...
After checking `.git` directory files, i have noticed that ORIG_HEAD and HEAD files contained only NULLS. It seems i have finally figured out how to fix this. 1. Deleted `index` file. 2. Deleted `ORIG_HEAD` file. 3. Deleted `HEAD` file. 4. Made a copy of `FETCH_HEAD` (it was pointing to a Branch1) 5. Renamed the copy ...
15863269
How to change a past git commit+push message in RubyMine?
10
2013-04-07 14:05:36
<p>I accidentally gave a wrong message and pushed a commit with it using RubyMine. Is there any way I can correct it? RubyMine way would be preferred not to mess up git, but other trusted ways are also welcome.</p>
25,098
1,769,011
2013-04-07 19:21:07
15,866,733
18
2013-04-07 19:21:07
1,517,659
2013-04-07 19:21:07
https://stackoverflow.com/q/15863269
https://stackoverflow.com/a/15866733
<p>As you said, you already pushed, so it's wise not to change the commit message. The reason for that is that the commit will get another hash which makes git think that the commit you already pushed and the commit whose commit message you changed are different. That is bad! You can force push with <code>git push -f</...
<p>As you said, you already pushed, so it's wise not to change the commit message. The reason for that is that the commit will get another hash which makes git think that the commit you already pushed and the commit whose commit message you changed are different. That is bad! You can force push with <code>git push -f</...
119, 8337, 15175
bitbucket, git, rubymine
<h1>How to change a past git commit+push message in RubyMine?</h1> <p>I accidentally gave a wrong message and pushed a commit with it using RubyMine. Is there any way I can correct it? RubyMine way would be preferred not to mess up git, but other trusted ways are also welcome.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,139
git
# How to change a past git commit+push message in RubyMine? I accidentally gave a wrong message and pushed a commit with it using RubyMine. Is there any way I can correct it? RubyMine way would be preferred not to mess up git, but other trusted ways are also welcome.
As you said, you already pushed, so it's wise not to change the commit message. The reason for that is that the commit will get another hash which makes git think that the commit you already pushed and the commit whose commit message you changed are different. That is bad! You can force push with `git push -f` and that...
13728053
Can I ignore the global .gitignore?
10
2012-12-05 16:40:13
<p>My global .gitignore is generally great but for this one off project I don't want the global rules applied. </p> <p>How can I remove the global .gitignore rules for this one freak repository?</p>
3,810
932,833
2012-12-05 16:47:39
13,728,202
18
2012-12-05 16:47:39
758,345
2012-12-05 16:47:39
https://stackoverflow.com/q/13728053
https://stackoverflow.com/a/13728202
<p>Run this command in your repo:</p> <pre><code>git config --local core.excludesfile false </code></pre>
<p>Run this command in your repo:</p> <pre><code>git config --local core.excludesfile false </code></pre>
119, 25056
git, gitignore
<h1>Can I ignore the global .gitignore?</h1> <p>My global .gitignore is generally great but for this one off project I don't want the global rules applied. </p> <p>How can I remove the global .gitignore rules for this one freak repository?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,140
git
# Can I ignore the global .gitignore? My global .gitignore is generally great but for this one off project I don't want the global rules applied. How can I remove the global .gitignore rules for this one freak repository?
Run this command in your repo: ``` git config --local core.excludesfile false ```
9606675
Migrate from Subversion to git, clone all branches and push through gitolite?
10
2012-03-07 17:57:08
<p>I've been working on moving our 9 projects in one SVN repo over to 9 separate git repos, managed on a server by gitolite then shutting down SVN. Seven of them were easy as they had no branches or tags so on my workstation I was able to do a simple:</p> <pre><code>git svn clone --stdlayout --no-metadata -A svnauthor...
10,289
1,107,232
2025-02-02 21:05:17
11,616,718
18
2012-07-23 16:37:30
1,107,232
2025-02-02 21:05:17
https://stackoverflow.com/q/9606675
https://stackoverflow.com/a/11616718
<p>A helpful person in #git on freenode irc wrote me a little command to get my tags and branches copied over to Git from SVN:</p> <p>Push branches:</p> <pre><code>printf &quot;git push origin &quot;; git show-ref | grep refs/remotes | grep -v '@' | grep -v remotes/tags | perl -ne 'print &quot;refs/remotes/$1:refs/head...
<p>A helpful person in #git on freenode irc wrote me a little command to get my tags and branches copied over to Git from SVN:</p> <p>Push branches:</p> <pre><code>printf &quot;git push origin &quot;; git show-ref | grep refs/remotes | grep -v '@' | grep -v remotes/tags | perl -ne 'print &quot;refs/remotes/$1:refs/head...
63, 97, 119
git, migration, svn
<h1>Migrate from Subversion to git, clone all branches and push through gitolite?</h1> <p>I've been working on moving our 9 projects in one SVN repo over to 9 separate git repos, managed on a server by gitolite then shutting down SVN. Seven of them were easy as they had no branches or tags so on my workstation I was ab...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,141
git
# Migrate from Subversion to git, clone all branches and push through gitolite? I've been working on moving our 9 projects in one SVN repo over to 9 separate git repos, managed on a server by gitolite then shutting down SVN. Seven of them were easy as they had no branches or tags so on my workstation I was able to do ...
A helpful person in #git on freenode irc wrote me a little command to get my tags and branches copied over to Git from SVN: Push branches: ``` printf "git push origin "; git show-ref | grep refs/remotes | grep -v '@' | grep -v remotes/tags | perl -ne 'print "refs/remotes/$1:refs/heads/$1 " if m!refs/remotes/(.*)!'; e...
11173261
Xcode says "Uncommitted Changes" Whenever I try to git pull or push
10
2012-06-23 21:50:13
<p>I am using git in my projects, whenever I try to pull from Xcode I get "Uncommitted Changes" and it prevents me from pulling/pushing. I try to commit and find one file with extension *.xcuserstate, this file is modified whenever I open/scroll into any project file in Xcode. That leaves me no option but to do a singl...
12,109
1,166,845
2012-06-23 21:56:03
11,173,294
18
2012-06-23 21:56:03
893
2012-06-23 21:56:03
https://stackoverflow.com/q/11173261
https://stackoverflow.com/a/11173294
<p>Normally you don't want to put the <code>*.xcuserstate</code> and <code>*.xcuserdata</code> files into your Git repository. These files aren't really part of your project, but are just a place where Xcode stores its local information that is helpful when reloading your project.</p> <p>You can fix this by using:</p>...
<p>Normally you don't want to put the <code>*.xcuserstate</code> and <code>*.xcuserdata</code> files into your Git repository. These files aren't really part of your project, but are just a place where Xcode stores its local information that is helpful when reloading your project.</p> <p>You can fix this by using:</p>...
119, 908, 4860, 25056
git, gitignore, pull, xcode
<h1>Xcode says "Uncommitted Changes" Whenever I try to git pull or push</h1> <p>I am using git in my projects, whenever I try to pull from Xcode I get "Uncommitted Changes" and it prevents me from pulling/pushing. I try to commit and find one file with extension *.xcuserstate, this file is modified whenever I open/scro...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,142
git
# Xcode says "Uncommitted Changes" Whenever I try to git pull or push I am using git in my projects, whenever I try to pull from Xcode I get "Uncommitted Changes" and it prevents me from pulling/pushing. I try to commit and find one file with extension *.xcuserstate, this file is modified whenever I open/scroll into a...
Normally you don't want to put the `*.xcuserstate` and `*.xcuserdata` files into your Git repository. These files aren't really part of your project, but are just a place where Xcode stores its local information that is helpful when reloading your project. You can fix this by using: ``` git rm --cached *.xcuserstate ...
7079975
Check in single file in Git?
10
2011-08-16 14:38:01
<p>My apologies if this is a silly question but I'm a VSS/VSTS guy trying to convert to Git :)</p> <p>I cloned a repository and pulled down a load of Visual Studio projects. While working on those projects I noticed that another developer had submitted an invalid .sql file. I fixed that .sql file for them, but am now ...
36,989
896,890
2015-06-14 08:06:46
7,080,018
18
2011-08-16 14:40:30
112,968
2011-08-16 14:40:30
https://stackoverflow.com/q/7079975
https://stackoverflow.com/a/7080018
<p>you only need to add the changes in the sql file to the index and run git commit.</p> <pre><code>git add path/to/file.sql git commit -m 'fixed broken sql file' </code></pre> <p>don't worry about your other changes, as long as you haven't <code>add</code>ed them, they won't be committed (to make sure there are no c...
<p>you only need to add the changes in the sql file to the index and run git commit.</p> <pre><code>git add path/to/file.sql git commit -m 'fixed broken sql file' </code></pre> <p>don't worry about your other changes, as long as you haven't <code>add</code>ed them, they won't be committed (to make sure there are no c...
119, 456, 39597
git, git-extensions, version-control
<h1>Check in single file in Git?</h1> <p>My apologies if this is a silly question but I'm a VSS/VSTS guy trying to convert to Git :)</p> <p>I cloned a repository and pulled down a load of Visual Studio projects. While working on those projects I noticed that another developer had submitted an invalid .sql file. I fixe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,143
git
# Check in single file in Git? My apologies if this is a silly question but I'm a VSS/VSTS guy trying to convert to Git :) I cloned a repository and pulled down a load of Visual Studio projects. While working on those projects I noticed that another developer had submitted an invalid .sql file. I fixed that .sql file...
you only need to add the changes in the sql file to the index and run git commit. ``` git add path/to/file.sql git commit -m 'fixed broken sql file' ``` don't worry about your other changes, as long as you haven't `add`ed them, they won't be committed (to make sure there are no changes in the index, run `git reset` b...
4965856
Git create full file patches to download/distribute?
10
2011-02-11 05:15:48
<p>Either i'm going nuts or nobody likes/liked this feature, but a long time ago i used to use subversion with sourceforge system. I had the ability to create full file patches for commits done.</p> <p>I cannot figure out anyway to create these in git, all i want is the files that were changed from XX commit and only ...
5,604
586,162
2011-02-11 15:13:45
4,970,654
18
2011-02-11 15:13:45
223,092
2011-02-11 15:13:45
https://stackoverflow.com/q/4965856
https://stackoverflow.com/a/4970654
<p>It seems that I misunderstood what you wanted in my other answer. <code>git archive</code> can take a list of paths to include in the archive, so you could do:</p> <pre><code>git archive -o /tmp/foo.zip HEAD $(git diff --name-only oldcommit HEAD) </code></pre> <p>If your filenames contain surprising characters, t...
<p>It seems that I misunderstood what you wanted in my other answer. <code>git archive</code> can take a list of paths to include in the archive, so you could do:</p> <pre><code>git archive -o /tmp/foo.zip HEAD $(git diff --name-only oldcommit HEAD) </code></pre> <p>If your filenames contain surprising characters, t...
119
git
<h1>Git create full file patches to download/distribute?</h1> <p>Either i'm going nuts or nobody likes/liked this feature, but a long time ago i used to use subversion with sourceforge system. I had the ability to create full file patches for commits done.</p> <p>I cannot figure out anyway to create these in git, all ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,144
git
# Git create full file patches to download/distribute? Either i'm going nuts or nobody likes/liked this feature, but a long time ago i used to use subversion with sourceforge system. I had the ability to create full file patches for commits done. I cannot figure out anyway to create these in git, all i want is the fi...
It seems that I misunderstood what you wanted in my other answer. `git archive` can take a list of paths to include in the archive, so you could do: ``` git archive -o /tmp/foo.zip HEAD $(git diff --name-only oldcommit HEAD) ``` If your filenames contain surprising characters, though, it would be safer to do: ``` gi...
2851918
How to get change history for a specific file in git repository
10
2010-05-17 19:00:46
<p>I would like to do something like:</p> <pre><code>git history my_file </code></pre> <h2>possible output</h2> <pre><code>2010-05-16 + add this line + more code here 2010-05-15 + delete code below - bad code - more bad codd 2010-05-12 + changes made here </code></pre>
8,987
184,600
2010-05-17 19:18:47
2,851,931
18
2010-05-17 19:02:21
19,563
2010-05-17 19:02:21
https://stackoverflow.com/q/2851918
https://stackoverflow.com/a/2851931
<p>Try:</p> <pre><code>git log -p -- filename </code></pre>
<p>Try:</p> <pre><code>git log -p -- filename </code></pre>
119, 606, 1318
diff, git, history
<h1>How to get change history for a specific file in git repository</h1> <p>I would like to do something like:</p> <pre><code>git history my_file </code></pre> <h2>possible output</h2> <pre><code>2010-05-16 + add this line + more code here 2010-05-15 + delete code below - bad code - more bad codd 2010-05-12 + chan...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,145
git
# How to get change history for a specific file in git repository I would like to do something like: ``` git history my_file ``` ## possible output ``` 2010-05-16 + add this line + more code here 2010-05-15 + delete code below - bad code - more bad codd 2010-05-12 + changes made here ```
Try: ``` git log -p -- filename ```
60448542
Which files to upload to version control from a Flutter project?
9
2020-02-28 09:16:14
<p>I want to upload my Flutter projects to Github.</p> <p>But, I don't know which files or folders should I upload and which I should add to the <strong>.gitignore</strong> file!</p> <p><strong>Here are the Folders:</strong></p> <ul> <li>.dart_tool</li> <li>.idea</li> <li>android</li> <li>build</li> <li>images</li> ...
8,042
12,290,240
2022-01-17 07:14:51
60,448,980
18
2020-02-28 09:41:40
10,928,236
2020-02-28 09:41:40
https://stackoverflow.com/q/60448542
https://stackoverflow.com/a/60448980
<p>Looking folder by folder</p> <p>1) <code>.dart_tool</code> is generated, you don't need to push it</p> <p>2) <code>.idea</code>, never push this folder, it's generated by your IDE</p> <p>3) <code>.package</code>, it'll be generated when you install dependencies, no need to push it</p> <p>4) <code>i_am_ruch.iml</...
<p>Looking folder by folder</p> <p>1) <code>.dart_tool</code> is generated, you don't need to push it</p> <p>2) <code>.idea</code>, never push this folder, it's generated by your IDE</p> <p>3) <code>.package</code>, it'll be generated when you install dependencies, no need to push it</p> <p>4) <code>i_am_ruch.iml</...
119, 456, 25056, 91905, 115695
android-studio, flutter, git, gitignore, version-control
<h1>Which files to upload to version control from a Flutter project?</h1> <p>I want to upload my Flutter projects to Github.</p> <p>But, I don't know which files or folders should I upload and which I should add to the <strong>.gitignore</strong> file!</p> <p><strong>Here are the Folders:</strong></p> <ul> <li>.dart...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,148
git
# Which files to upload to version control from a Flutter project? I want to upload my Flutter projects to Github. But, I don't know which files or folders should I upload and which I should add to the **.gitignore** file! **Here are the Folders:** - .dart_tool - .idea - android - build - images - ios - lib **Here...
Looking folder by folder 1) `.dart_tool` is generated, you don't need to push it 2) `.idea`, never push this folder, it's generated by your IDE 3) `.package`, it'll be generated when you install dependencies, no need to push it 4) `i_am_ruch.iml`, IML is a module file created by IntelliJ IDEA, no need to push it 5...
52357450
how to view untracked files that were "git stash -u"
9
2018-09-16 19:00:27
<p>Stashing content in git is very useful. when stashing untrack files and going through your stash like this</p> <pre><code>echo test &gt; foo git stash -u # foo is stashed git stash show -p stash@{0} </code></pre> <p>untracked files are not shown. how can we see them?</p> <p>thanks</p>
1,371
683,982
2021-12-02 16:11:33
52,357,762
18
2018-09-16 19:38:30
1,256,452
2021-12-02 16:11:33
https://stackoverflow.com/q/52357450
https://stackoverflow.com/a/52357762
<p>You just need to look at the third stash commit. But &quot;just need to&quot; understates things a little bit, and this makes no sense until you know what the three stash commits <em>are</em>. To see what I mean, read on.</p> <h3>Setup: what to know about stashes</h3> <p>When you run <code>git stash save</code> or...
<p>You just need to look at the third stash commit. But &quot;just need to&quot; understates things a little bit, and this makes no sense until you know what the three stash commits <em>are</em>. To see what I mean, read on.</p> <h3>Setup: what to know about stashes</h3> <p>When you run <code>git stash save</code> or...
119, 13091
git, git-stash
<h1>how to view untracked files that were "git stash -u"</h1> <p>Stashing content in git is very useful. when stashing untrack files and going through your stash like this</p> <pre><code>echo test &gt; foo git stash -u # foo is stashed git stash show -p stash@{0} </code></pre> <p>untracked files are not shown. how ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,149
git
# how to view untracked files that were "git stash -u" Stashing content in git is very useful. when stashing untrack files and going through your stash like this ``` echo test > foo git stash -u # foo is stashed git stash show -p stash@{0} ``` untracked files are not shown. how can we see them? thanks
You just need to look at the third stash commit. But "just need to" understates things a little bit, and this makes no sense until you know what the three stash commits *are*. To see what I mean, read on. ### Setup: what to know about stashes When you run `git stash save` or `git stash push`, Git's normal action is t...
47949173
Deploy a Python (Dash) app to Heroku using Conda environments (instead of virtualenv)
9
2017-12-23 02:05:58
<p>When I run <code>git push heroku master</code> to deploy my app to Heroku I keep getting errors</p> <blockquote> <p>Heroku Push rejected, failed to compile Python app. Could not find a version that satisfies the requirement</p> </blockquote> <p>The problem was that the <code>requirements.txt</code> file I made w...
8,456
3,491,991
2021-01-01 21:14:39
47,949,174
18
2017-12-23 02:05:58
3,491,991
2019-06-05 18:29:48
https://stackoverflow.com/q/47949173
https://stackoverflow.com/a/47949174
<p>Heroku doesn't care if you're using <code>virtualenv</code> or <code>conda</code> to manage environments. Using one or the other is mostly irrelevant to the deployment process.</p> <p>Don't bother with the <a href="https://elements.heroku.com/buildpacks/conda/conda-buildpack" rel="noreferrer">Conda Environment Buil...
<p>Heroku doesn't care if you're using <code>virtualenv</code> or <code>conda</code> to manage environments. Using one or the other is mostly irrelevant to the deployment process.</p> <p>Don't bother with the <a href="https://elements.heroku.com/buildpacks/conda/conda-buildpack" rel="noreferrer">Conda Environment Buil...
16, 119, 8279
git, heroku, python
<h1>Deploy a Python (Dash) app to Heroku using Conda environments (instead of virtualenv)</h1> <p>When I run <code>git push heroku master</code> to deploy my app to Heroku I keep getting errors</p> <blockquote> <p>Heroku Push rejected, failed to compile Python app. Could not find a version that satisfies the require...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,150
git
# Deploy a Python (Dash) app to Heroku using Conda environments (instead of virtualenv) When I run `git push heroku master` to deploy my app to Heroku I keep getting errors > Heroku Push rejected, failed to compile Python app. Could not find a version that satisfies the requirement The problem was that the `requirem...
Heroku doesn't care if you're using `virtualenv` or `conda` to manage environments. Using one or the other is mostly irrelevant to the deployment process. Don't bother with the [Conda Environment Buildpack](https://elements.heroku.com/buildpacks/conda/conda-buildpack) instructions since those are for deploying a remot...
26457050
How do I make commit diff appear in commit message while I'm editing it (with Vim)?
9
2014-10-20 00:45:44
<p>My biggest bottleneck in vim is the moment when I need to write a commit. Often, i do not remember the diff. First I write "git diff". Then I write "git commit" but, ... "Hey! I do not remember ...". Thus, I need to stop to write commit message, then I come back and run diff message. Sometimes I work with two window...
563
1,420,625
2014-10-20 14:01:37
26,457,364
18
2014-10-20 01:31:31
1,890,567
2014-10-20 01:31:31
https://stackoverflow.com/q/26457050
https://stackoverflow.com/a/26457364
<p>Use <code>git commit -v</code> to see the diff in vim while committing.</p> <pre><code>-v, --verbose Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its lines prefixed with #. </code></pre>
<p>Use <code>git commit -v</code> to see the diff in vim while committing.</p> <pre><code>-v, --verbose Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its lines prefixed with #. </code></pre>
119, 370
git, vim
<h1>How do I make commit diff appear in commit message while I'm editing it (with Vim)?</h1> <p>My biggest bottleneck in vim is the moment when I need to write a commit. Often, i do not remember the diff. First I write "git diff". Then I write "git commit" but, ... "Hey! I do not remember ...". Thus, I need to stop to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,151
git
# How do I make commit diff appear in commit message while I'm editing it (with Vim)? My biggest bottleneck in vim is the moment when I need to write a commit. Often, i do not remember the diff. First I write "git diff". Then I write "git commit" but, ... "Hey! I do not remember ...". Thus, I need to stop to write com...
Use `git commit -v` to see the diff in vim while committing. ``` -v, --verbose Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its lines prefixed with #. ```
22057331
Git -- add all files that are smaller than X megabytes
9
2014-02-27 01:37:06
<p>I'm using git to manage a non-coding-project folder that has some large files scattered all over the place.</p> <p>I'm not interesting in moving the files around as they are not mine, but I know git has issues with very large files (in Linus's words, "we suck at it") and I'd like to avoid those performance issues ...
3,522
1,276,506
2014-03-01 00:59:49
22,057,427
18
2014-02-27 01:45:23
147,356
2014-02-27 01:52:44
https://stackoverflow.com/q/22057331
https://stackoverflow.com/a/22057427
<p>There are no flags to <code>git</code> that will do what you want. However, there are a lot of other utilities available that would work just fine...such as the <code>find</code> command. To add all files smaller than 4 MB:</p> <pre><code>find * -size -4M -type f -print | xargs git add </code></pre> <p>This assu...
<p>There are no flags to <code>git</code> that will do what you want. However, there are a lot of other utilities available that would work just fine...such as the <code>find</code> command. To add all files smaller than 4 MB:</p> <pre><code>find * -size -4M -type f -print | xargs git add </code></pre> <p>This assu...
119
git
<h1>Git -- add all files that are smaller than X megabytes</h1> <p>I'm using git to manage a non-coding-project folder that has some large files scattered all over the place.</p> <p>I'm not interesting in moving the files around as they are not mine, but I know git has issues with very large files (in Linus's words, ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,152
git
# Git -- add all files that are smaller than X megabytes I'm using git to manage a non-coding-project folder that has some large files scattered all over the place. I'm not interesting in moving the files around as they are not mine, but I know git has issues with very large files (in Linus's words, "we suck at it") ...
There are no flags to `git` that will do what you want. However, there are a lot of other utilities available that would work just fine...such as the `find` command. To add all files smaller than 4 MB: ``` find * -size -4M -type f -print | xargs git add ``` This assumes that you have no filenames containing spaces (e...
16011184
git - only fetch the files, not the history
9
2013-04-15 08:53:42
<p>when I am running <code>git pull</code> or <code>git fetch</code>, I obviously retrieve both history and files. For huge projects, that takes very much time. I wonder how this process could be sped up, as for some projects I am only interested in the source code and not in the history. Is there a way to tell git tha...
3,820
1,517,659
2013-04-30 13:28:29
16,011,487
18
2013-04-15 09:11:11
683,080
2013-04-15 09:25:19
https://stackoverflow.com/q/16011184
https://stackoverflow.com/a/16011487
<p>You probably want to look at the <code>--depth</code> option in <code>git clone</code>--called a "shallow clone". In particular, you probably want:</p> <pre><code>git clone --depth=1 &lt;url&gt; </code></pre> <p>If the project is on GitHub, you can always use the download links from there. Note, there are some c...
<p>You probably want to look at the <code>--depth</code> option in <code>git clone</code>--called a "shallow clone". In particular, you probably want:</p> <pre><code>git clone --depth=1 &lt;url&gt; </code></pre> <p>If the project is on GitHub, you can always use the download links from there. Note, there are some c...
119, 598, 7330
git, performance, repository
<h1>git - only fetch the files, not the history</h1> <p>when I am running <code>git pull</code> or <code>git fetch</code>, I obviously retrieve both history and files. For huge projects, that takes very much time. I wonder how this process could be sped up, as for some projects I am only interested in the source code a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,153
git
# git - only fetch the files, not the history when I am running `git pull` or `git fetch`, I obviously retrieve both history and files. For huge projects, that takes very much time. I wonder how this process could be sped up, as for some projects I am only interested in the source code and not in the history. Is there...
You probably want to look at the `--depth` option in `git clone`--called a "shallow clone". In particular, you probably want: ``` git clone --depth=1 <url> ``` If the project is on GitHub, you can always use the download links from there. Note, there are some catches to using a shallow clone: > Create a shallow clon...
10117548
Fatal error on "git add submodule"
9
2012-04-12 04:52:54
<p>I get the following error when I try adding a submodule to my repository:</p> <blockquote> <p>fatal: pathspec 'submodule' did not match any files</p> </blockquote> <p>I had some issues with my submodules so I had to remove them all (removed them from <code>.gitmodules</code>, <code>.git/config</code>, cleaned th...
8,576
87,158
2012-04-12 04:54:42
10,117,560
18
2012-04-12 04:54:42
69,755
2012-04-12 04:54:42
https://stackoverflow.com/q/10117548
https://stackoverflow.com/a/10117560
<p>I think you mean to use <code>git submodule add &lt;repository&gt; &lt;path&gt;</code>, not <code>git add submodule</code>, which would just add a file named <code>submodule</code> to your index.</p>
<p>I think you mean to use <code>git submodule add &lt;repository&gt; &lt;path&gt;</code>, not <code>git add submodule</code>, which would just add a file named <code>submodule</code> to your index.</p>
119
git
<h1>Fatal error on "git add submodule"</h1> <p>I get the following error when I try adding a submodule to my repository:</p> <blockquote> <p>fatal: pathspec 'submodule' did not match any files</p> </blockquote> <p>I had some issues with my submodules so I had to remove them all (removed them from <code>.gitmodules<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,154
git
# Fatal error on "git add submodule" I get the following error when I try adding a submodule to my repository: > fatal: pathspec 'submodule' did not match any files I had some issues with my submodules so I had to remove them all (removed them from `.gitmodules`, `.git/config`, cleaned the index using `rm --cached s...
I think you mean to use `git submodule add <repository> <path>`, not `git add submodule`, which would just add a file named `submodule` to your index.
9713625
Why is gitk not showing my local branch?
9
2012-03-15 03:36:31
<p>I'm learning about <code>git</code> and is using <code>gitk</code> to visualize my history and branches.</p> <p>I tried <code>gitk</code> on a locally initialized repo, and it is able to show both branches that I made properly.</p> <p>However, when I tried to launch <code>gitk</code> to visualize a repo obtained usi...
3,882
75,579
2012-03-15 03:43:33
9,713,689
18
2012-03-15 03:43:33
13,760
2012-03-15 03:43:33
https://stackoverflow.com/q/9713625
https://stackoverflow.com/a/9713689
<p>Gitk by default only shows you the branch you are on.</p> <p>It seems that when you launched gitk, your current branch was experiment. Therefore, gitk only showed you commits that lie on the experiment branch. This is the way gitk behaves by default because once you have a lot of branches, the branch names can actu...
<p>Gitk by default only shows you the branch you are on.</p> <p>It seems that when you launched gitk, your current branch was experiment. Therefore, gitk only showed you commits that lie on the experiment branch. This is the way gitk behaves by default because once you have a lot of branches, the branch names can actu...
119, 30785
git, gitk
<h1>Why is gitk not showing my local branch?</h1> <p>I'm learning about <code>git</code> and is using <code>gitk</code> to visualize my history and branches.</p> <p>I tried <code>gitk</code> on a locally initialized repo, and it is able to show both branches that I made properly.</p> <p>However, when I tried to launch ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,155
git
# Why is gitk not showing my local branch? I'm learning about `git` and is using `gitk` to visualize my history and branches. I tried `gitk` on a locally initialized repo, and it is able to show both branches that I made properly. However, when I tried to launch `gitk` to visualize a repo obtained using `git clone`,...
Gitk by default only shows you the branch you are on. It seems that when you launched gitk, your current branch was experiment. Therefore, gitk only showed you commits that lie on the experiment branch. This is the way gitk behaves by default because once you have a lot of branches, the branch names can actually be qu...
9661059
git pull --rebase upstream & git push origin rejects non-fast-forward?
9
2012-03-12 02:30:56
<p>I've implemented classic OSS maintainer/contributor git workflow for a company project on github, however one edge case produces some weird results that I'm not sure how to get around.</p> <p>Lets say there is a typical project that I forked and added upstream remote to keep it up to date.</p> <pre><code>git clone...
9,266
384,478
2014-08-01 21:02:43
9,664,919
18
2012-03-12 09:57:01
106,205
2012-03-12 09:57:01
https://stackoverflow.com/q/9661059
https://stackoverflow.com/a/9664919
<p>When you </p> <pre><code>git pull --rebase upstream master </code></pre> <p>you are rewriting your own history, since you are rebasing your master branch on the updated upstream repository. When you push your rebased repo to your fork git complains. You need to push with --force</p> <pre><code>git push --force or...
<p>When you </p> <pre><code>git pull --rebase upstream master </code></pre> <p>you are rewriting your own history, since you are rebasing your master branch on the updated upstream repository. When you push your rebased repo to your fork git complains. You need to push with --force</p> <pre><code>git push --force or...
119, 8974
git, rebase
<h1>git pull --rebase upstream & git push origin rejects non-fast-forward?</h1> <p>I've implemented classic OSS maintainer/contributor git workflow for a company project on github, however one edge case produces some weird results that I'm not sure how to get around.</p> <p>Lets say there is a typical project that I f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,156
git
# git pull --rebase upstream & git push origin rejects non-fast-forward? I've implemented classic OSS maintainer/contributor git workflow for a company project on github, however one edge case produces some weird results that I'm not sure how to get around. Lets say there is a typical project that I forked and added ...
When you ``` git pull --rebase upstream master ``` you are rewriting your own history, since you are rebasing your master branch on the updated upstream repository. When you push your rebased repo to your fork git complains. You need to push with --force ``` git push --force origin master ```
6160214
Always use version from merged branch on conflicts
9
2011-05-28 07:09:10
<p>Currently I am working in a feature branch that will soon be merged back into master. I recently tried just that and had some merge conflicts, which I had to fix manually. </p> <p>So, is it possible to tell git to always use the version from the merged branch in order to avoid merge conflicts beforehand? In this ca...
3,995
132,728
2011-08-22 16:05:46
6,160,701
18
2011-05-28 09:12:32
223,092
2011-08-22 16:05:46
https://stackoverflow.com/q/6160214
https://stackoverflow.com/a/6160701
<p>You can do exactly this in git with the following command, assuming that <code>feature</code> is the name of your feature branch:</p> <pre><code>git merge -s recursive -X theirs feature </code></pre> <p>This says to use the "recursive" merge strategy, but with the "theirs" option. This means that when there is a ...
<p>You can do exactly this in git with the following command, assuming that <code>feature</code> is the name of your feature branch:</p> <pre><code>git merge -s recursive -X theirs feature </code></pre> <p>This says to use the "recursive" merge strategy, but with the "theirs" option. This means that when there is a ...
119, 62599
git, merge-conflict-resolution
<h1>Always use version from merged branch on conflicts</h1> <p>Currently I am working in a feature branch that will soon be merged back into master. I recently tried just that and had some merge conflicts, which I had to fix manually. </p> <p>So, is it possible to tell git to always use the version from the merged bra...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,157
git
# Always use version from merged branch on conflicts Currently I am working in a feature branch that will soon be merged back into master. I recently tried just that and had some merge conflicts, which I had to fix manually. So, is it possible to tell git to always use the version from the merged branch in order to a...
You can do exactly this in git with the following command, assuming that `feature` is the name of your feature branch: ``` git merge -s recursive -X theirs feature ``` This says to use the "recursive" merge strategy, but with the "theirs" option. This means that when there is a conflict, it will be automatically reso...
4698649
How do I get a remote tracking branch to stay up to date with remote origin in a bare Git repository?
9
2011-01-15 08:22:17
<p>I am trying to maintain a bare copy of a Git repository and having some issues keeping the remote tracking branches up to date. I create the remote tracking branches like this:</p> <pre><code>git branch -t 0.1 origin/0.1 </code></pre> <p>This seems to do what I need to do for that point in time. However, if I make...
7,140
50,453
2011-01-15 19:38:18
4,699,283
18
2011-01-15 11:23:14
223,092
2011-01-15 14:50:44
https://stackoverflow.com/q/4698649
https://stackoverflow.com/a/4699283
<p>Normally one would push into a bare repository, rather than run <code>git fetch</code> from within it. If you can arrange to do that, life will be much easier.</p> <p>If you <em>have</em> to fetch rather than push, and you just want to create a mirror of origin in your bare repository, you could avoid having remot...
<p>Normally one would push into a bare repository, rather than run <code>git fetch</code> from within it. If you can arrange to do that, life will be much easier.</p> <p>If you <em>have</em> to fetch rather than push, and you just want to create a mirror of origin in your bare repository, you could avoid having remot...
119, 1879, 2892
branch, git, tracking
<h1>How do I get a remote tracking branch to stay up to date with remote origin in a bare Git repository?</h1> <p>I am trying to maintain a bare copy of a Git repository and having some issues keeping the remote tracking branches up to date. I create the remote tracking branches like this:</p> <pre><code>git branch -t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,158
git
# How do I get a remote tracking branch to stay up to date with remote origin in a bare Git repository? I am trying to maintain a bare copy of a Git repository and having some issues keeping the remote tracking branches up to date. I create the remote tracking branches like this: ``` git branch -t 0.1 origin/0.1 ``` ...
Normally one would push into a bare repository, rather than run `git fetch` from within it. If you can arrange to do that, life will be much easier. If you *have* to fetch rather than push, and you just want to create a mirror of origin in your bare repository, you could avoid having remote-tracking branches entirely....
3995848
git-gui reports it has 256 loose objects each time is run and suggests compression which goes fine. How to fix it?
9
2010-10-22 10:14:04
<p>After an unexpected shutdown, now git seemingly works fine but each time is run is asking for compression since it finds 256 loose objects. Is it possible to be cleaned?</p>
2,820
277,716
2016-11-15 14:02:47
3,999,058
18
2010-10-22 16:47:12
90,322
2010-10-22 16:47:12
https://stackoverflow.com/q/3995848
https://stackoverflow.com/a/3999058
<p>Run <code>git gc</code>. If that doesn't work, please copy the error message.</p>
<p>Run <code>git gc</code>. If that doesn't work, please copy the error message.</p>
119
git
<h1>git-gui reports it has 256 loose objects each time is run and suggests compression which goes fine. How to fix it?</h1> <p>After an unexpected shutdown, now git seemingly works fine but each time is run is asking for compression since it finds 256 loose objects. Is it possible to be cleaned?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,159
git
# git-gui reports it has 256 loose objects each time is run and suggests compression which goes fine. How to fix it? After an unexpected shutdown, now git seemingly works fine but each time is run is asking for compression since it finds 256 loose objects. Is it possible to be cleaned?
Run `git gc`. If that doesn't work, please copy the error message.
1821267
How can I apply a patch file in git
9
2009-11-30 17:42:42
<p>How can I apply a patch in my location repository in git?</p> <p>I tried $ git am &lt; 0001-Add-Voicemail-tab-to-Contacts.patch Patch does not have a valid e-mail address.</p> <p>I tried $git apply 0001-my.patch</p> <p>but I get fatal: git diff header lacks filename information (line 27) where line 27 is "GIT bin...
11,375
125,440
2009-11-30 18:17:23
1,821,361
18
2009-11-30 18:00:24
123,109
2009-11-30 18:17:23
https://stackoverflow.com/q/1821267
https://stackoverflow.com/a/1821361
<p>I was able to reproduce your problem by faking an end-of-line problem.</p> <pre><code>$ cp /bin/ls . $ git add ls; git commit -m second [master 8668716] second 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100755 ls $ git format-patch HEAD^..HEAD 0001-second.patch $ git reset --hard HEAD^ HEAD is n...
<p>I was able to reproduce your problem by faking an end-of-line problem.</p> <pre><code>$ cp /bin/ls . $ git add ls; git commit -m second [master 8668716] second 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100755 ls $ git format-patch HEAD^..HEAD 0001-second.patch $ git reset --hard HEAD^ HEAD is n...
119
git
<h1>How can I apply a patch file in git</h1> <p>How can I apply a patch in my location repository in git?</p> <p>I tried $ git am &lt; 0001-Add-Voicemail-tab-to-Contacts.patch Patch does not have a valid e-mail address.</p> <p>I tried $git apply 0001-my.patch</p> <p>but I get fatal: git diff header lacks filename in...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,160
git
# How can I apply a patch file in git How can I apply a patch in my location repository in git? I tried $ git am < 0001-Add-Voicemail-tab-to-Contacts.patch Patch does not have a valid e-mail address. I tried $git apply 0001-my.patch but I get fatal: git diff header lacks filename information (line 27) where line 27...
I was able to reproduce your problem by faking an end-of-line problem. ``` $ cp /bin/ls . $ git add ls; git commit -m second [master 8668716] second 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100755 ls $ git format-patch HEAD^..HEAD 0001-second.patch $ git reset --hard HEAD^ HEAD is now at 686ace7 ...
64549425
How do I see git added files?
8
2020-10-27 06:48:06
<p>Sometimes I run <code>git add .</code> and big files that weren't supposed to get added are added. How can I see which files were added without commiting? And how to 'un-add' those files or all files at once so I can fix the <code>.gitignore</code>?</p>
24,768
13,684,332
2024-02-21 10:14:53
64,549,436
18
2020-10-27 06:49:00
1,057,485
2024-02-21 10:14:53
https://stackoverflow.com/q/64549425
https://stackoverflow.com/a/64549436
<p><em>(Disclaimer : none of the commands below modifies <strong>your changes in files</strong>, all this is about what's staged or not)</em><br> <strong>How to...</strong></p> <p>...display the full list of what's staged at this point. (<a href="https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-emgitdiffeml...
<p><em>(Disclaimer : none of the commands below modifies <strong>your changes in files</strong>, all this is about what's staged or not)</em><br> <strong>How to...</strong></p> <p>...display the full list of what's staged at this point. (<a href="https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-emgitdiffeml...
119, 34792, 74978
git, git-add, git-stage
<h1>How do I see git added files?</h1> <p>Sometimes I run <code>git add .</code> and big files that weren't supposed to get added are added. How can I see which files were added without commiting? And how to 'un-add' those files or all files at once so I can fix the <code>.gitignore</code>?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,164
git
# How do I see git added files? Sometimes I run `git add .` and big files that weren't supposed to get added are added. How can I see which files were added without commiting? And how to 'un-add' those files or all files at once so I can fix the `.gitignore`?
*(Disclaimer : none of the commands below modifies **your changes in files**, all this is about what's staged or not)* **How to...** ...display the full list of what's staged at this point. ([doc for diff --staged](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-emgitdiffemltoptionsgt--cachedltcommitgt-...
48331653
Cherry pick a range of commits with merge commits
8
2018-01-18 22:56:08
<p>I need to cherry pick a range of commits, but it fails because in this range I have merge of some branches. Is it possible to do it without conflicts?</p>
8,007
1,159,507
2018-01-18 23:28:33
48,331,957
18
2018-01-18 23:28:33
1,256,452
2018-01-18 23:28:33
https://stackoverflow.com/q/48331653
https://stackoverflow.com/a/48331957
<blockquote> <p>Is it possible to do it without conflicts?</p> </blockquote> <p>That depends on what's in the commits-as-converted-to-changesets, vs what's in your own current commit. It's also not the real issue that I would be concerned about.</p> <blockquote> <p>... it fails because in this range I have merge...
<blockquote> <p>Is it possible to do it without conflicts?</p> </blockquote> <p>That depends on what's in the commits-as-converted-to-changesets, vs what's in your own current commit. It's also not the real issue that I would be concerned about.</p> <blockquote> <p>... it fails because in this range I have merge...
119, 36489, 78810
cherry-pick, git, git-cherry-pick
<h1>Cherry pick a range of commits with merge commits</h1> <p>I need to cherry pick a range of commits, but it fails because in this range I have merge of some branches. Is it possible to do it without conflicts?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,165
git
# Cherry pick a range of commits with merge commits I need to cherry pick a range of commits, but it fails because in this range I have merge of some branches. Is it possible to do it without conflicts?
> Is it possible to do it without conflicts? That depends on what's in the commits-as-converted-to-changesets, vs what's in your own current commit. It's also not the real issue that I would be concerned about. > ... it fails because in this range I have merge [commits] Presumably you mean that `git cherry-pick` com...
47777272
git terminal show "rebase" next to branch name
8
2017-12-12 16:27:51
<p>I'm very new to git and I don't know how I did it, or why it's showing this on my terminal, but when I open git terminal (from sourcetree) I see the branch name like this:</p> <pre><code>c:/my/project/folder (develop|REBASE-i 1/13) </code></pre> <p>What is causing this? And how can I remove this? I remember that b...
7,166
3,106,828
2025-12-18 12:33:10
47,777,319
18
2017-12-12 16:30:35
3,407,418
2017-12-12 16:30:35
https://stackoverflow.com/q/47777272
https://stackoverflow.com/a/47777319
<p>You are in a middle of rebasing so either do</p> <pre><code>git rebase --continue </code></pre> <p>or:</p> <pre><code>git rebase --abort </code></pre>
<p>You are in a middle of rebasing so either do</p> <pre><code>git rebase --continue </code></pre> <p>or:</p> <pre><code>git rebase --abort </code></pre>
119
git
<h1>git terminal show "rebase" next to branch name</h1> <p>I'm very new to git and I don't know how I did it, or why it's showing this on my terminal, but when I open git terminal (from sourcetree) I see the branch name like this:</p> <pre><code>c:/my/project/folder (develop|REBASE-i 1/13) </code></pre> <p>What is ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,166
git
# git terminal show "rebase" next to branch name I'm very new to git and I don't know how I did it, or why it's showing this on my terminal, but when I open git terminal (from sourcetree) I see the branch name like this: ``` c:/my/project/folder (develop|REBASE-i 1/13) ``` What is causing this? And how can I remove ...
You are in a middle of rebasing so either do ``` git rebase --continue ``` or: ``` git rebase --abort ```
47768267
Git can't commit Angular folder on my project with IntelliJ or SourceTree
8
2017-12-12 08:37:19
<p>I have a web app project with a folder with a PHP API REST and another folder containing Angular files. When I want to commit my files to BitBucket, I can commit all except the files under the Angular folder. </p> <p>Same thing on SourceTree, I can't see any changes under this folder. Is there a thing Angular is do...
5,762
4,950,717
2018-07-05 11:01:01
47,769,182
18
2017-12-12 09:28:55
4,950,717
2018-07-05 11:01:01
https://stackoverflow.com/q/47768267
https://stackoverflow.com/a/47769182
<p>With the help of Matt, I found how to solve my issue : As I couldn't see hidden files, I didn't see that Angular CLI created a .git folder in the angular app folder. I removed it, and now It's working.</p> <p>For future apps, if we don't want Angular to initialize a git repo, we can specify it on the creation comma...
<p>With the help of Matt, I found how to solve my issue : As I couldn't see hidden files, I didn't see that Angular CLI created a .git folder in the angular app folder. I removed it, and now It's working.</p> <p>For future apps, if we don't want Angular to initialize a git repo, we can specify it on the creation comma...
119, 8337, 8945, 90056, 125866
angular, atlassian-sourcetree, bitbucket, git, intellij-idea
<h1>Git can't commit Angular folder on my project with IntelliJ or SourceTree</h1> <p>I have a web app project with a folder with a PHP API REST and another folder containing Angular files. When I want to commit my files to BitBucket, I can commit all except the files under the Angular folder. </p> <p>Same thing on So...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,167
git
# Git can't commit Angular folder on my project with IntelliJ or SourceTree I have a web app project with a folder with a PHP API REST and another folder containing Angular files. When I want to commit my files to BitBucket, I can commit all except the files under the Angular folder. Same thing on SourceTree, I can't...
With the help of Matt, I found how to solve my issue : As I couldn't see hidden files, I didn't see that Angular CLI created a .git folder in the angular app folder. I removed it, and now It's working. For future apps, if we don't want Angular to initialize a git repo, we can specify it on the creation command like th...
42163194
Squashing commits after they are pushed
8
2017-02-10 15:37:58
<p>Imagine a git repository with the following commits:</p> <pre><code>Fixed issue 3 123eabc Fixed issue 2 (part 2) fa23b79 Fixed issue 2 (part 1) 7bea5cc Fixed issue 1 0d229f4 </code></pre> <p>These are all pushed to remote master already. Is there a way now to rewrite history a...
12,734
1,527,248
2023-07-26 13:22:15
42,163,340
18
2017-02-10 15:45:57
1,863,229
2017-02-10 15:52:26
https://stackoverflow.com/q/42163194
https://stackoverflow.com/a/42163340
<p>One option is to do an interactive rebase in which you squash the two issue 2 commits together.</p> <pre><code>git rebase -i HEAD~4 </code></pre> <p>This tells Git that you want to do an interactive rebase involving the four commits including and counting backwards from the HEAD of your branch. This should show y...
<p>One option is to do an interactive rebase in which you squash the two issue 2 commits together.</p> <pre><code>git rebase -i HEAD~4 </code></pre> <p>This tells Git that you want to do an interactive rebase involving the four commits including and counting backwards from the HEAD of your branch. This should show y...
119, 51381, 98455
git, git-reset, git-squash
<h1>Squashing commits after they are pushed</h1> <p>Imagine a git repository with the following commits:</p> <pre><code>Fixed issue 3 123eabc Fixed issue 2 (part 2) fa23b79 Fixed issue 2 (part 1) 7bea5cc Fixed issue 1 0d229f4 </code></pre> <p>These are all pushed to remote master...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,168
git
# Squashing commits after they are pushed Imagine a git repository with the following commits: ``` Fixed issue 3 123eabc Fixed issue 2 (part 2) fa23b79 Fixed issue 2 (part 1) 7bea5cc Fixed issue 1 0d229f4 ``` These are all pushed to remote master already. Is there a way now to r...
One option is to do an interactive rebase in which you squash the two issue 2 commits together. ``` git rebase -i HEAD~4 ``` This tells Git that you want to do an interactive rebase involving the four commits including and counting backwards from the HEAD of your branch. This should show you a list looking something ...
28148061
move one commit to the top of all commits
8
2015-01-26 10:09:16
<p>I've made a commit, <code>CM</code>, and then applied several patches, <code>P1</code> and <code>P2</code>. So my history looks like</p> <pre><code>C1-C2-CM-P1-P2 </code></pre> <p>where <code>C1</code> and <code>C2</code> are two previous commits.</p> <p>The problem is that I forgot to create patch for my commit....
9,074
1,432,980
2017-10-02 10:21:40
28,148,094
18
2015-01-26 10:11:31
6,309
2015-01-26 10:11:31
https://stackoverflow.com/q/28148061
https://stackoverflow.com/a/28148094
<p>If you haven't push your branch yet, you can do an interactive rebase:</p> <pre><code>git rebase -i C2 </code></pre> <p>You can then reorder your commits as <code>P1-P2-CM</code>, and re-apply them on top of <code>C2</code>.</p>
<p>If you haven't push your branch yet, you can do an interactive rebase:</p> <pre><code>git rebase -i C2 </code></pre> <p>You can then reorder your commits as <code>P1-P2-CM</code>, and re-apply them on top of <code>C2</code>.</p>
119
git
<h1>move one commit to the top of all commits</h1> <p>I've made a commit, <code>CM</code>, and then applied several patches, <code>P1</code> and <code>P2</code>. So my history looks like</p> <pre><code>C1-C2-CM-P1-P2 </code></pre> <p>where <code>C1</code> and <code>C2</code> are two previous commits.</p> <p>The prob...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,170
git
# move one commit to the top of all commits I've made a commit, `CM`, and then applied several patches, `P1` and `P2`. So my history looks like ``` C1-C2-CM-P1-P2 ``` where `C1` and `C2` are two previous commits. The problem is that I forgot to create patch for my commit. How to move my commit `CM` to the top of th...
If you haven't push your branch yet, you can do an interactive rebase: ``` git rebase -i C2 ``` You can then reorder your commits as `P1-P2-CM`, and re-apply them on top of `C2`.
4481803
how to get code of specified tag version of Chromium from git?
8
2010-12-19 05:49:06
<p>i just need code of specified version of Chromium like r69297 which is the latest dev version of Chrome. i use git so i follow the instruction here: <a href="http://code.google.com/p/chromium/wiki/UsingGit" rel="nofollow noreferrer">http://code.google.com/p/chromium/wiki/UsingGit</a> however, after i sync all the co...
13,903
522,024
2014-12-10 23:34:31
26,462,483
18
2014-10-20 09:35:17
938,089
2014-12-10 23:34:31
https://stackoverflow.com/q/4481803
https://stackoverflow.com/a/26462483
<p><sup><em>When the question was asked, Chromium used SVN. Nowadays, git is the primary VC system, so I will use git tags/hashes instead of r#### revisions.</em></sup></p> <p>In this answer, I assume that you have already set up the pre-requisites for building Chromium (including an initial checkout). If you don't ha...
<p><sup><em>When the question was asked, Chromium used SVN. Nowadays, git is the primary VC system, so I will use git tags/hashes instead of r#### revisions.</em></sup></p> <p>In this answer, I assume that you have already set up the pre-requisites for building Chromium (including an initial checkout). If you don't ha...
119, 29693
chromium, git
<h1>how to get code of specified tag version of Chromium from git?</h1> <p>i just need code of specified version of Chromium like r69297 which is the latest dev version of Chrome. i use git so i follow the instruction here: <a href="http://code.google.com/p/chromium/wiki/UsingGit" rel="nofollow noreferrer">http://code....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,171
git
# how to get code of specified tag version of Chromium from git? i just need code of specified version of Chromium like r69297 which is the latest dev version of Chrome. i use git so i follow the instruction here: <http://code.google.com/p/chromium/wiki/UsingGit> however, after i sync all the code, and review the comm...
*When the question was asked, Chromium used SVN. Nowadays, git is the primary VC system, so I will use git tags/hashes instead of r#### revisions.* In this answer, I assume that you have already set up the pre-requisites for building Chromium (including an initial checkout). If you don't have that one, follow the tuto...
17245941
creating local branch from remote develop branch
8
2013-06-21 23:57:22
<p>I want to create a local and a remote branch named test from the develop branch on origin. However, even though my current local branch is tracking origin/develop when I checkout the new branch it takes origin/master. Therefore, I have to follow the steps below to get a test branch on both remote and local.</p> <pr...
7,599
1,576,804
2020-03-05 11:39:02
17,245,964
18
2013-06-22 00:00:51
846,273
2013-06-22 00:07:50
https://stackoverflow.com/q/17245941
https://stackoverflow.com/a/17245964
<p>According to the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html">documentation</a></p> <pre><code>git checkout -b test --track origin/develop </code></pre> <p>should do the trick.</p> <hr> <p>As extra goodies, if you want to create a local branch to track a remote branch with the sam...
<p>According to the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html">documentation</a></p> <pre><code>git checkout -b test --track origin/develop </code></pre> <p>should do the trick.</p> <hr> <p>As extra goodies, if you want to create a local branch to track a remote branch with the sam...
119
git
<h1>creating local branch from remote develop branch</h1> <p>I want to create a local and a remote branch named test from the develop branch on origin. However, even though my current local branch is tracking origin/develop when I checkout the new branch it takes origin/master. Therefore, I have to follow the steps bel...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,172
git
# creating local branch from remote develop branch I want to create a local and a remote branch named test from the develop branch on origin. However, even though my current local branch is tracking origin/develop when I checkout the new branch it takes origin/master. Therefore, I have to follow the steps below to get...
According to the [documentation](https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html) ``` git checkout -b test --track origin/develop ``` should do the trick. --- As extra goodies, if you want to create a local branch to track a remote branch with the same name, you can be lazy an omit the `-b` optio...
14145783
Git pull permission denied linux?
8
2013-01-03 19:28:41
<p>When I run <code>git pull origin test</code>, I get</p> <pre><code>fatal: unable to connect to cache daemon: Permission denied </code></pre> <p>followed by the prompt for the github username and password. The directory is located under my homefolder (<code>~/www/software</code>). Any ideas? If I use <code>sudo<...
10,193
1,707,160
2020-03-05 07:16:54
14,160,580
18
2013-01-04 16:06:44
599,922
2013-01-04 16:06:44
https://stackoverflow.com/q/14145783
https://stackoverflow.com/a/14160580
<p>The problem is that git is unable to connect to its credential cache (Read <a href="http://git-scm.com/docs/git-credential-cache">http://git-scm.com/docs/git-credential-cache</a> for more information).</p> <p>From documentation:</p> <blockquote> <p>The cache is accessible over a Unix domain socket, restricted to...
<p>The problem is that git is unable to connect to its credential cache (Read <a href="http://git-scm.com/docs/git-credential-cache">http://git-scm.com/docs/git-credential-cache</a> for more information).</p> <p>From documentation:</p> <blockquote> <p>The cache is accessible over a Unix domain socket, restricted to...
58, 119, 549
git, linux, ubuntu
<h1>Git pull permission denied linux?</h1> <p>When I run <code>git pull origin test</code>, I get</p> <pre><code>fatal: unable to connect to cache daemon: Permission denied </code></pre> <p>followed by the prompt for the github username and password. The directory is located under my homefolder (<code>~/www/software...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,173
git
# Git pull permission denied linux? When I run `git pull origin test`, I get ``` fatal: unable to connect to cache daemon: Permission denied ``` followed by the prompt for the github username and password. The directory is located under my homefolder (`~/www/software`). Any ideas? If I use `sudo`, it works, but I do...
The problem is that git is unable to connect to its credential cache (Read <http://git-scm.com/docs/git-credential-cache> for more information). From documentation: > The cache is accessible over a Unix domain socket, restricted to the current user by filesystem permissions. So all you need is to check a file permis...
12822727
git checkout automatically merges local modifications
8
2012-10-10 15:13:10
<p>I tried following commands on the shell </p> <pre><code>git init echo "test1" &gt; test1.txt git add test1.txt git commit -a -m "test1" echo "test2" &gt;&gt; test1.txt git branch test git checkout test </code></pre> <p><code>text.txt</code> now contains:</p> <pre><code>test1 test2 </code></pre> <p>After che...
12,974
967,164
2017-11-10 15:17:33
12,823,897
18
2012-10-10 16:15:24
1,253,222
2012-10-10 16:15:24
https://stackoverflow.com/q/12822727
https://stackoverflow.com/a/12823897
<p><code>git</code> tries hard to not lose possibly valuable data. In this case, it's not actually merging branches, as the changes in question have not been committed. Rather, when you do a <code>git checkout</code>, it attempts to preserve newly made but not committed yet modifications, so it checks out the commit yo...
<p><code>git</code> tries hard to not lose possibly valuable data. In this case, it's not actually merging branches, as the changes in question have not been committed. Rather, when you do a <code>git checkout</code>, it attempts to preserve newly made but not committed yet modifications, so it checks out the commit yo...
119, 717, 37230
git, git-checkout, merge
<h1>git checkout automatically merges local modifications</h1> <p>I tried following commands on the shell </p> <pre><code>git init echo "test1" &gt; test1.txt git add test1.txt git commit -a -m "test1" echo "test2" &gt;&gt; test1.txt git branch test git checkout test </code></pre> <p><code>text.txt</code> now co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,174
git
# git checkout automatically merges local modifications I tried following commands on the shell ``` git init echo "test1" > test1.txt git add test1.txt git commit -a -m "test1" echo "test2" >> test1.txt git branch test git checkout test ``` `text.txt` now contains: ``` test1 test2 ``` After checkout to branch `...
`git` tries hard to not lose possibly valuable data. In this case, it's not actually merging branches, as the changes in question have not been committed. Rather, when you do a `git checkout`, it attempts to preserve newly made but not committed yet modifications, so it checks out the commit you are requesting, and add...
112613
git instaweb gives 403 Forbidden - No projects found
8
2008-09-22 00:06:38
<p>running <code>git instaweb</code> in my repository opens a page that says "403 Forbidden - No projects found". What am I missing?</p>
6,412
13,195
2013-03-05 11:21:04
112,753
18
2008-09-22 01:15:37
13,195
2008-09-22 01:15:37
https://stackoverflow.com/q/112613
https://stackoverflow.com/a/112753
<p>looks like the debian install of git sets <code>$projectroot</code> globally in a way that confuses <code>instaweb</code>. I removed the <code>$projectroot</code> line from <code>/etc/gitweb.conf</code> and the error went away.</p>
<p>looks like the debian install of git sets <code>$projectroot</code> globally in a way that confuses <code>instaweb</code>. I removed the <code>$projectroot</code> line from <code>/etc/gitweb.conf</code> and the error went away.</p>
119, 7859, 54104
git, http-status-code-403, instaweb
<h1>git instaweb gives 403 Forbidden - No projects found</h1> <p>running <code>git instaweb</code> in my repository opens a page that says "403 Forbidden - No projects found". What am I missing?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,175
git
# git instaweb gives 403 Forbidden - No projects found running `git instaweb` in my repository opens a page that says "403 Forbidden - No projects found". What am I missing?
looks like the debian install of git sets `$projectroot` globally in a way that confuses `instaweb`. I removed the `$projectroot` line from `/etc/gitweb.conf` and the error went away.
51127471
interactive rebase with --preserve-merges of all commits in the current branch
7
2018-07-01 22:36:08
<p>There seem to be some similar questions already, but none of them are exactly what I want.</p> <p>Let's say I have commit history like this</p> <pre><code>* xxxxxxxH (HEAD -&gt; B) Latest commit * (more commits) * xxxxxxxG (B) More commits * xxxxxxxF Merge branch 'master' into B |\ | * xxxxxxxE (master) Anothe...
7,015
2,399,236
2018-07-01 22:53:43
51,127,544
18
2018-07-01 22:53:43
2,399,236
2018-07-01 22:53:43
https://stackoverflow.com/q/51127471
https://stackoverflow.com/a/51127544
<p>After longer than I considered reasonable, I was able to get a solution on irc:</p> <p><code>git rebase -i -m -r firstCommitInBranch^</code> does exactly what I need.</p> <p>From git documentation:</p> <pre><code> -r, --rebase-merges[=(rebase-cousins|no-rebase-cousins)] By default, a rebase will simply d...
<p>After longer than I considered reasonable, I was able to get a solution on irc:</p> <p><code>git rebase -i -m -r firstCommitInBranch^</code> does exactly what I need.</p> <p>From git documentation:</p> <pre><code> -r, --rebase-merges[=(rebase-cousins|no-rebase-cousins)] By default, a rebase will simply d...
119, 8974, 91259
git, git-rewrite-history, rebase
<h1>interactive rebase with --preserve-merges of all commits in the current branch</h1> <p>There seem to be some similar questions already, but none of them are exactly what I want.</p> <p>Let's say I have commit history like this</p> <pre><code>* xxxxxxxH (HEAD -&gt; B) Latest commit * (more commits) * xxxxxxxG (B) ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,178
git
# interactive rebase with --preserve-merges of all commits in the current branch There seem to be some similar questions already, but none of them are exactly what I want. Let's say I have commit history like this ``` * xxxxxxxH (HEAD -> B) Latest commit * (more commits) * xxxxxxxG (B) More commits * xxxxxxxF Merg...
After longer than I considered reasonable, I was able to get a solution on irc: `git rebase -i -m -r firstCommitInBranch^` does exactly what I need. From git documentation: ``` -r, --rebase-merges[=(rebase-cousins|no-rebase-cousins)] By default, a rebase will simply drop merge commits from the todo list, a...
47146064
Number of modified files in git index
7
2017-11-06 21:25:16
<p>How can I find out the number of modified files in the index? That is to say, files that show as "modified" when running <code>git status</code>.</p> <p>I know lots of visual git tools that do this, as well as shell add-ons that show the count next to the prompt, but I just don't see how to do it on the command lin...
7,361
2,855,742
2022-01-02 14:14:45
47,146,726
18
2017-11-06 22:13:43
3,102,264
2017-11-06 22:13:43
https://stackoverflow.com/q/47146064
https://stackoverflow.com/a/47146726
<p>You can get the number of modified file using :</p> <pre><code>git status -s -uno | wc -l </code></pre> <p>From the <a href="https://git-scm.com/docs/git-status" rel="noreferrer">git status documentation</a>, <code>-s</code> give output in short format, and <code>-uno</code> does not show untrack files.</p>
<p>You can get the number of modified file using :</p> <pre><code>git status -s -uno | wc -l </code></pre> <p>From the <a href="https://git-scm.com/docs/git-status" rel="noreferrer">git status documentation</a>, <code>-s</code> give output in short format, and <code>-uno</code> does not show untrack files.</p>
119
git
<h1>Number of modified files in git index</h1> <p>How can I find out the number of modified files in the index? That is to say, files that show as "modified" when running <code>git status</code>.</p> <p>I know lots of visual git tools that do this, as well as shell add-ons that show the count next to the prompt, but I...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,179
git
# Number of modified files in git index How can I find out the number of modified files in the index? That is to say, files that show as "modified" when running `git status`. I know lots of visual git tools that do this, as well as shell add-ons that show the count next to the prompt, but I just don't see how to do i...
You can get the number of modified file using : ``` git status -s -uno | wc -l ``` From the [git status documentation](https://git-scm.com/docs/git-status), `-s` give output in short format, and `-uno` does not show untrack files.
46229291
In git, how can I efficiently delete all refs matching a pattern?
7
2017-09-14 22:48:51
<p>I have over time archived a bunch of build tags in <code>refs/builds/archived/*</code> and I now want to delete them to recover some space and reduce total object count (over 50k annotated git tags are stored there).</p> <p>It would appear that the only way to do this is like so:</p> <pre><code>git show-ref\ | aw...
1,790
2,092,842
2025-04-25 08:44:22
46,229,416
18
2017-09-14 23:04:02
582
2017-09-14 23:04:02
https://stackoverflow.com/q/46229291
https://stackoverflow.com/a/46229416
<p>You should be able to say something like</p> <pre><code>git for-each-ref --format='delete %(refname)' refs/builds/archived | git update-ref --stdin </code></pre> <p>This should do the whole thing in one bulk operation. Note that I haven't actually tried this myself.</p>
<p>You should be able to say something like</p> <pre><code>git for-each-ref --format='delete %(refname)' refs/builds/archived | git update-ref --stdin </code></pre> <p>This should do the whole thing in one bulk operation. Note that I haven't actually tried this myself.</p>
119, 106016
git, git-plumbing
<h1>In git, how can I efficiently delete all refs matching a pattern?</h1> <p>I have over time archived a bunch of build tags in <code>refs/builds/archived/*</code> and I now want to delete them to recover some space and reduce total object count (over 50k annotated git tags are stored there).</p> <p>It would appear t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,180
git
# In git, how can I efficiently delete all refs matching a pattern? I have over time archived a bunch of build tags in `refs/builds/archived/*` and I now want to delete them to recover some space and reduce total object count (over 50k annotated git tags are stored there). It would appear that the only way to do this...
You should be able to say something like ``` git for-each-ref --format='delete %(refname)' refs/builds/archived | git update-ref --stdin ``` This should do the whole thing in one bulk operation. Note that I haven't actually tried this myself.
43041659
Git shortlog does not show output in Jenkins shell
7
2017-03-27 08:41:48
<p>Facing some wired issue while working with Jenkins,</p> <pre><code>#!/bin/sh set -x #initialize environment export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH" export PATH="$HOME/.fastlane/bin:$PATH" export LC_CTYPE=en_US.UTF-8 cd ~/autobuild/projects/MyAPP git checkout dev git reset head --hard git pull git shortlog...
1,721
1,084,174
2017-03-27 09:14:53
43,042,363
18
2017-03-27 09:14:53
1,084,174
2017-03-27 09:14:53
https://stackoverflow.com/q/43041659
https://stackoverflow.com/a/43042363
<p>Finally I was able to find the reason, <code>git shortlog</code> works fine when you directly use from terminal because,</p> <pre><code>git help shortlog </code></pre> <p>Shows,</p> <blockquote> <p>If no revisions are passed on the command line and either standard input is not a terminal or there is no ...
<p>Finally I was able to find the reason, <code>git shortlog</code> works fine when you directly use from terminal because,</p> <pre><code>git help shortlog </code></pre> <p>Shows,</p> <blockquote> <p>If no revisions are passed on the command line and either standard input is not a terminal or there is no ...
119, 391, 11225, 47913, 64999
command-line-interface, git, git-log, jenkins, terminal
<h1>Git shortlog does not show output in Jenkins shell</h1> <p>Facing some wired issue while working with Jenkins,</p> <pre><code>#!/bin/sh set -x #initialize environment export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH" export PATH="$HOME/.fastlane/bin:$PATH" export LC_CTYPE=en_US.UTF-8 cd ~/autobuild/projects/MyAPP g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,181
git
# Git shortlog does not show output in Jenkins shell Facing some wired issue while working with Jenkins, ``` #!/bin/sh set -x #initialize environment export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH" export PATH="$HOME/.fastlane/bin:$PATH" export LC_CTYPE=en_US.UTF-8 cd ~/autobuild/projects/MyAPP git checkout dev git ...
Finally I was able to find the reason, `git shortlog` works fine when you directly use from terminal because, ``` git help shortlog ``` Shows, > If no revisions are passed on the command line and either standard > input is not a terminal or there is no > current branch, git shortlog will output a summary of the log ...
32080865
What is git checkout -b <branchname> for?
7
2015-08-18 19:16:15
<p>What is <code>git checkout -b &lt;branchname&gt;</code> for ?</p> <p>I mean, you can create a branch by doing <code>git branch &lt;branchname&gt;</code></p> <p>but, what it does <code>git checkout -b &lt;branchname&gt;</code> specifically ?</p>
17,420
4,371,033
2015-08-18 19:22:17
32,080,880
18
2015-08-18 19:16:55
1,733,477
2015-08-18 19:22:17
https://stackoverflow.com/q/32080865
https://stackoverflow.com/a/32080880
<p>That means you do two things:</p> <ol> <li>Create a new branch <code>&lt;branchname&gt;</code></li> <li>Checkout the new branch <code>&lt;branchname&gt;</code></li> </ol> <p>It's simply shorthand for creating a new branch and then directly checking it out.</p> <pre><code>$ git checkout -b new-feature </code></pre...
<p>That means you do two things:</p> <ol> <li>Create a new branch <code>&lt;branchname&gt;</code></li> <li>Checkout the new branch <code>&lt;branchname&gt;</code></li> </ol> <p>It's simply shorthand for creating a new branch and then directly checking it out.</p> <pre><code>$ git checkout -b new-feature </code></pre...
119
git
<h1>What is git checkout -b <branchname> for?</h1> <p>What is <code>git checkout -b &lt;branchname&gt;</code> for ?</p> <p>I mean, you can create a branch by doing <code>git branch &lt;branchname&gt;</code></p> <p>but, what it does <code>git checkout -b &lt;branchname&gt;</code> specifically ?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,183
git
# What is git checkout -b for? What is `git checkout -b <branchname>` for ? I mean, you can create a branch by doing `git branch <branchname>` but, what it does `git checkout -b <branchname>` specifically ?
That means you do two things: 1. Create a new branch `<branchname>` 2. Checkout the new branch `<branchname>` It's simply shorthand for creating a new branch and then directly checking it out. ``` $ git checkout -b new-feature ``` Is shorthand for and the equivalent of: ``` $ git branch new-feature $ git checkout ...
27141788
How to get the rightmost digit from an Integer - Ruby
7
2014-11-26 05:10:04
<p>I am working on a program that requires me to read in and validate a number, but in doing so I need to take a two digit integer (for example we'll say 18) and add it 1 + 8. Now I have it working where I do a conditional check if it is greater than 10 and subtract, but that's kind of an ugly solution in my opinion an...
11,794
2,990,161
2024-03-19 17:58:04
27,141,835
18
2014-11-26 05:14:56
2,564,200
2019-07-18 13:35:45
https://stackoverflow.com/q/27141788
https://stackoverflow.com/a/27141835
<p>You can use the <a href="http://en.wikipedia.org/wiki/Modulo_operation" rel="noreferrer">modulo operator</a> <code>n % 10</code>, to get the rightmost digit. For example: </p> <pre><code>18 % 10 # =&gt; 8 9 % 10 # =&gt; 9 0 % 10 # =&gt; 0 (-123).abs % 10 # =&gt; 3 </code></pre> <p>To handle negative numbers, us...
<p>You can use the <a href="http://en.wikipedia.org/wiki/Modulo_operation" rel="noreferrer">modulo operator</a> <code>n % 10</code>, to get the rightmost digit. For example: </p> <pre><code>18 % 10 # =&gt; 8 9 % 10 # =&gt; 9 0 % 10 # =&gt; 0 (-123).abs % 10 # =&gt; 3 </code></pre> <p>To handle negative numbers, us...
12, 2054, 48894
digit, integer, ruby
<h1>How to get the rightmost digit from an Integer - Ruby</h1> <p>I am working on a program that requires me to read in and validate a number, but in doing so I need to take a two digit integer (for example we'll say 18) and add it 1 + 8. Now I have it working where I do a conditional check if it is greater than 10 and...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,186
git
# How to get the rightmost digit from an Integer - Ruby I am working on a program that requires me to read in and validate a number, but in doing so I need to take a two digit integer (for example we'll say 18) and add it 1 + 8. Now I have it working where I do a conditional check if it is greater than 10 and subtract...
You can use the [modulo operator](http://en.wikipedia.org/wiki/Modulo_operation) `n % 10`, to get the rightmost digit. For example: ``` 18 % 10 # => 8 9 % 10 # => 9 0 % 10 # => 0 (-123).abs % 10 # => 3 ``` To handle negative numbers, use [Integer#abs](https://ruby-doc.org/core-2.4.0/Integer.html#method-i-abs). **E...
25068310
Jenkins guide needed for build, deploy, provision and rollback, keeping 5 releases
7
2014-07-31 20:28:19
<p>I am pretty new to Jenkins, and have some sort of understanding but need guidance further.</p> <p>I have a PHP application on a Git repo, that uses Composer, has Assets, has user uploaded Media files, uses Memcache/Redis, has some Agents/Workers, and has Migration files.</p> <p>So far I understood I need to create...
6,148
243,782
2014-08-07 18:21:41
25,189,340
18
2014-08-07 18:14:55
1,163,786
2014-08-07 18:21:41
https://stackoverflow.com/q/25068310
https://stackoverflow.com/a/25189340
<p><strong>warning tl;tr</strong></p> <p>Ok - you want it all. Lot's of questions - long story.</p> <hr> <p>Jenkis is "just" a continous integration server.</p> <p>Continous integration, basically means that you don't have to run a compilation and unit-testing step on the developer machine, but pull this over to a ...
<p><strong>warning tl;tr</strong></p> <p>Ok - you want it all. Lot's of questions - long story.</p> <hr> <p>Jenkis is "just" a continous integration server.</p> <p>Continous integration, basically means that you don't have to run a compilation and unit-testing step on the developer machine, but pull this over to a ...
5, 119, 190, 1066, 64999
continuous-integration, deployment, git, jenkins, php
<h1>Jenkins guide needed for build, deploy, provision and rollback, keeping 5 releases</h1> <p>I am pretty new to Jenkins, and have some sort of understanding but need guidance further.</p> <p>I have a PHP application on a Git repo, that uses Composer, has Assets, has user uploaded Media files, uses Memcache/Redis, ha...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,187
git
# Jenkins guide needed for build, deploy, provision and rollback, keeping 5 releases I am pretty new to Jenkins, and have some sort of understanding but need guidance further. I have a PHP application on a Git repo, that uses Composer, has Assets, has user uploaded Media files, uses Memcache/Redis, has some Agents/Wo...
**warning tl;tr** Ok - you want it all. Lot's of questions - long story. --- Jenkis is "just" a continous integration server. Continous integration, basically means that you don't have to run a compilation and unit-testing step on the developer machine, but pull this over to a central server, right? Because compila...
17582016
How to access my bitbucket repository if I rename it
7
2013-07-10 22:25:23
<p>I have a git project on bit bucket which I access via:</p> <pre><code>git@bitbucket.org:amm/witmachine.git </code></pre> <p>I would like to access as:</p> <pre><code>git@bitbucket.org:amm/masterwit.git </code></pre> <p>Do I need to create a new repository? </p> <p>I have an existing checkout - if I rename the r...
3,770
2,068,386
2013-07-11 08:18:08
17,582,036
18
2013-07-10 22:27:16
707,111
2013-07-10 22:27:16
https://stackoverflow.com/q/17582016
https://stackoverflow.com/a/17582036
<p>So you want to change the URL of a remote?</p> <pre><code>git remote set-url origin git@bitbucket.org:amm/masterwit.git </code></pre>
<p>So you want to change the URL of a remote?</p> <pre><code>git remote set-url origin git@bitbucket.org:amm/masterwit.git </code></pre>
119
git
<h1>How to access my bitbucket repository if I rename it</h1> <p>I have a git project on bit bucket which I access via:</p> <pre><code>git@bitbucket.org:amm/witmachine.git </code></pre> <p>I would like to access as:</p> <pre><code>git@bitbucket.org:amm/masterwit.git </code></pre> <p>Do I need to create a new reposi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,188
git
# How to access my bitbucket repository if I rename it I have a git project on bit bucket which I access via: ``` git@bitbucket.org:amm/witmachine.git ``` I would like to access as: ``` git@bitbucket.org:amm/masterwit.git ``` Do I need to create a new repository? I have an existing checkout - if I rename the repo...
So you want to change the URL of a remote? ``` git remote set-url origin git@bitbucket.org:amm/masterwit.git ```
12609415
Find out which remote a local branch is tracking
7
2012-09-26 19:57:19
<p>This is <em>not</em> <a href="https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking">Find out which remote branch a local branch is tracking</a>, If I have mulitple remotes, I might have "master" in all of them. <code>git branch</code> returns master but I don't know if ...
12,945
7,685
2022-03-21 07:58:41
12,613,467
18
2012-09-27 03:02:25
1,439,955
2012-09-27 05:22:15
https://stackoverflow.com/q/12609415
https://stackoverflow.com/a/12613467
<p>You may want to try these below to view in detail the information.</p> <pre><code>git remote -v git remote -v show origin </code></pre> <p>Example output below:</p> <pre><code>dmasi@:/var/www/pirate_booty$ git remote -v origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (fetch) origin git@bitbucket.org:...
<p>You may want to try these below to view in detail the information.</p> <pre><code>git remote -v git remote -v show origin </code></pre> <p>Example output below:</p> <pre><code>dmasi@:/var/www/pirate_booty$ git remote -v origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (fetch) origin git@bitbucket.org:...
119
git
<h1>Find out which remote a local branch is tracking</h1> <p>This is <em>not</em> <a href="https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking">Find out which remote branch a local branch is tracking</a>, If I have mulitple remotes, I might have "master" in all of them. <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,190
git
# Find out which remote a local branch is tracking This is *not* [Find out which remote branch a local branch is tracking](https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking), If I have mulitple remotes, I might have "master" in all of them. `git branch` returns master b...
You may want to try these below to view in detail the information. ``` git remote -v git remote -v show origin ``` Example output below: ``` dmasi@:/var/www/pirate_booty$ git remote -v origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (fetch) origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (pus...
5425088
Git diff reports local changes 'old mode' / 'new mode'
7
2011-03-24 20:26:33
<p>There are two machines, A and B. And there are two branches, p16 and c2.</p> <p>A has an <a href="https://en.wikipedia.org/wiki/Ext3" rel="nofollow noreferrer">ext3</a> filesystem, but on B, the archive lives on a <a href="https://en.wikipedia.org/wiki/TrueCrypt" rel="nofollow noreferrer">TrueCrypt</a> drive with <a...
7,961
362,951
2025-03-31 00:43:08
5,425,916
18
2011-03-24 21:40:47
362,951
2025-03-30 23:03:10
https://stackoverflow.com/q/5425088
https://stackoverflow.com/a/5425916
<p>Such problems using Git can occur, if the file permissions of the operating system are not functioning as they should in that location. For example, when foreign filesystems are mounted.</p> <p>The solution was pointed out by meagar in his comment on the question above:</p> <p>Just make sure you have (within the <co...
<p>Such problems using Git can occur, if the file permissions of the operating system are not functioning as they should in that location. For example, when foreign filesystems are mounted.</p> <p>The solution was pointed out by meagar in his comment on the question above:</p> <p>Just make sure you have (within the <co...
99, 119, 2120
file-permissions, filesystems, git
<h1>Git diff reports local changes 'old mode' / 'new mode'</h1> <p>There are two machines, A and B. And there are two branches, p16 and c2.</p> <p>A has an <a href="https://en.wikipedia.org/wiki/Ext3" rel="nofollow noreferrer">ext3</a> filesystem, but on B, the archive lives on a <a href="https://en.wikipedia.org/wiki/...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,191
git
# Git diff reports local changes 'old mode' / 'new mode' There are two machines, A and B. And there are two branches, p16 and c2. A has an [ext3](https://en.wikipedia.org/wiki/Ext3) filesystem, but on B, the archive lives on a [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) drive with [VFAT](https://en.wikipedia...
Such problems using Git can occur, if the file permissions of the operating system are not functioning as they should in that location. For example, when foreign filesystems are mounted. The solution was pointed out by meagar in his comment on the question above: Just make sure you have (within the `[core]` section) ...
2783166
Git: Add part of (changed) file to index *by line numbers*
7
2010-05-06 17:36:07
<p>Is there a git command to add differences <em>within a range of line-numbers</em> to the index?</p> <p>I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index.</p>
3,305
83,100
2016-03-18 01:47:32
2,785,039
18
2010-05-06 22:48:26
85,134
2010-05-06 23:09:17
https://stackoverflow.com/q/2783166
https://stackoverflow.com/a/2785039
<p>If you can persuade your editor to write a version of the file that you want to be staged, you can use the plumbing-level git commands to add it to the index under the right name. You need to bypass "git add" which will always associate path X in the working tree with path X in the index (as far as I know).</p> <p>...
<p>If you can persuade your editor to write a version of the file that you want to be staged, you can use the plumbing-level git commands to add it to the index under the right name. You need to bypass "git add" which will always associate path X in the working tree with path X in the index (as far as I know).</p> <p>...
119
git
<h1>Git: Add part of (changed) file to index *by line numbers*</h1> <p>Is there a git command to add differences <em>within a range of line-numbers</em> to the index?</p> <p>I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,192
git
# Git: Add part of (changed) file to index *by line numbers* Is there a git command to add differences *within a range of line-numbers* to the index? I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index.
If you can persuade your editor to write a version of the file that you want to be staged, you can use the plumbing-level git commands to add it to the index under the right name. You need to bypass "git add" which will always associate path X in the working tree with path X in the index (as far as I know). Once you h...
20237346
git commit error: invalid commit message
6
2013-11-27 08:34:11
<p>I've been searching Google and cannot find anything on this error. </p> <p>Here is the full error:</p> <pre><code>git commit -m "update ui" INVALID COMMIT MSG: does not match "type scope: subject" ! was: "update ui" Note: scope must be only letters. </code></pre>
12,983
2,877,229
2013-11-27 08:37:23
20,237,380
18
2013-11-27 08:36:20
102,441
2013-11-27 08:36:20
https://stackoverflow.com/q/20237346
https://stackoverflow.com/a/20237380
<p>You have a <code>commit-msg</code> <a href="http://git-scm.com/book/en/Customizing-Git-Git-Hooks">hook</a> on your system that is enforcing a format on your commit message. This is presumably company policy of some kind.</p>
<p>You have a <code>commit-msg</code> <a href="http://git-scm.com/book/en/Customizing-Git-Git-Hooks">hook</a> on your system that is enforcing a format on your commit message. This is presumably company policy of some kind.</p>
119
git
<h1>git commit error: invalid commit message</h1> <p>I've been searching Google and cannot find anything on this error. </p> <p>Here is the full error:</p> <pre><code>git commit -m "update ui" INVALID COMMIT MSG: does not match "type scope: subject" ! was: "update ui" Note: sco...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,194
git
# git commit error: invalid commit message I've been searching Google and cannot find anything on this error. Here is the full error: ``` git commit -m "update ui" INVALID COMMIT MSG: does not match "type scope: subject" ! was: "update ui" Note: scope must be only letters. ```
You have a `commit-msg` [hook](http://git-scm.com/book/en/Customizing-Git-Git-Hooks) on your system that is enforcing a format on your commit message. This is presumably company policy of some kind.
19666479
gitignore settings included in commit
6
2013-10-29 18:35:30
<p>I'm trying to commit the right files in git, but having problems configuring my gitignore properly. I followed the instructions <a href="http://www.gyford.com/phil/writing/2010/09/29/django-environment.php" rel="noreferrer">here</a> to create the gitignore file (django project):</p> <pre><code># File types # ######...
11,365
903,143
2013-10-29 22:04:22
19,666,677
18
2013-10-29 18:45:51
460,542
2013-10-29 22:04:22
https://stackoverflow.com/q/19666479
https://stackoverflow.com/a/19666677
<p>It looks like you already have <code>settings.py</code> under version control by git. In this case git will continue to track the file - no matter what you write in <code>.gitignore</code>.</p> <p>You have to explicitly tell git to forget about <code>settings.py</code>:</p> <ol> <li>Add it to <code>.gitignore</cod...
<p>It looks like you already have <code>settings.py</code> under version control by git. In this case git will continue to track the file - no matter what you write in <code>.gitignore</code>.</p> <p>You have to explicitly tell git to forget about <code>settings.py</code>:</p> <ol> <li>Add it to <code>.gitignore</cod...
119, 5597, 25056
commit, git, gitignore
<h1>gitignore settings included in commit</h1> <p>I'm trying to commit the right files in git, but having problems configuring my gitignore properly. I followed the instructions <a href="http://www.gyford.com/phil/writing/2010/09/29/django-environment.php" rel="noreferrer">here</a> to create the gitignore file (django ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,195
git
# gitignore settings included in commit I'm trying to commit the right files in git, but having problems configuring my gitignore properly. I followed the instructions [here](http://www.gyford.com/phil/writing/2010/09/29/django-environment.php) to create the gitignore file (django project): ``` # File types # #######...
It looks like you already have `settings.py` under version control by git. In this case git will continue to track the file - no matter what you write in `.gitignore`. You have to explicitly tell git to forget about `settings.py`: 1. Add it to `.gitignore` (As you did) 2. Remove the file from git without deleting the...
11395398
Git Push failing: refusing to update checked out branch
6
2012-07-09 12:51:58
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked">git push error &#39;[remote rejected] master -&gt; master (branch is currently checked out)&#39;</a> </p> </blockquote> <p>Im tr...
5,809
392,684
2014-03-12 12:59:40
11,395,956
18
2012-07-09 13:23:01
499,609
2014-03-12 12:59:40
https://stackoverflow.com/q/11395398
https://stackoverflow.com/a/11395956
<p>You're trying to push to a non-bare repo (i.e. a repo <em>with</em> a working tree, just like your local clone), but there's nothing done at the other end to account for this specially.</p> <p>You look like you're trying to let a <code>git push</code> deploy your site. Here's how to do that:</p> <ol> <li><p>Ignore...
<p>You're trying to push to a non-bare repo (i.e. a repo <em>with</em> a working tree, just like your local clone), but there's nothing done at the other end to account for this specially.</p> <p>You look like you're trying to let a <code>git push</code> deploy your site. Here's how to do that:</p> <ol> <li><p>Ignore...
119
git
<h1>Git Push failing: refusing to update checked out branch</h1> <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked">git push error &#39;[remote rejected] master -&gt; master (branch i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,196
git
# Git Push failing: refusing to update checked out branch > **Possible Duplicate:** > [git push error '[remote rejected] master -> master (branch is currently checked out)'](https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked) Im trying to push my rep...
You're trying to push to a non-bare repo (i.e. a repo *with* a working tree, just like your local clone), but there's nothing done at the other end to account for this specially. You look like you're trying to let a `git push` deploy your site. Here's how to do that: 1. Ignore the error message git is giving you now ...
3872980
Git: Best way to add only some parts of a file from another branch?
6
2010-10-06 13:31:49
<p>Let's say you have a branch <code>master</code> and another branch <code>production</code>, both containing a version of the file <code>prog.py</code>, as well as many other files. Imagine that you modify many files in the production branch, including <code>prog.py</code>. Now, what is the best way of having only ...
2,455
42,973
2017-11-10 15:45:07
8,549,729
18
2011-12-18 04:02:45
625,403
2013-12-14 13:39:02
https://stackoverflow.com/q/3872980
https://stackoverflow.com/a/8549729
<p>I'm not sure if this was true when this question was asked, but with a current version of git you can do the following:</p> <pre><code>git checkout -p production -- prog.py </code></pre> <p>and you'll get the same interactive hunk-picker you do for most <code>-p</code> commands.</p>
<p>I'm not sure if this was true when this question was asked, but with a current version of git you can do the following:</p> <pre><code>git checkout -p production -- prog.py </code></pre> <p>and you'll get the same interactive hunk-picker you do for most <code>-p</code> commands.</p>
119, 1879, 5597, 37230
branch, commit, git, git-checkout
<h1>Git: Best way to add only some parts of a file from another branch?</h1> <p>Let's say you have a branch <code>master</code> and another branch <code>production</code>, both containing a version of the file <code>prog.py</code>, as well as many other files. Imagine that you modify many files in the production branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,197
git
# Git: Best way to add only some parts of a file from another branch? Let's say you have a branch `master` and another branch `production`, both containing a version of the file `prog.py`, as well as many other files. Imagine that you modify many files in the production branch, including `prog.py`. Now, what is the be...
I'm not sure if this was true when this question was asked, but with a current version of git you can do the following: ``` git checkout -p production -- prog.py ``` and you'll get the same interactive hunk-picker you do for most `-p` commands.
5711356
Delete a branch starting with a hyphen
6
2011-04-19 03:41:38
<p>I managed to create a branch in git called '-f'</p> <p>e.g.</p> <pre><code>$ git branch * (no branch) -f </code></pre> <p>How do I delete the dang thing? git branch -d -f won't work, nor will git branch -d '-f' or even git branch -d -f -f</p>
2,369
182,284
2022-10-03 20:32:57
5,711,366
18
2011-04-19 03:43:51
19,750
2011-04-19 03:43:51
https://stackoverflow.com/q/5711356
https://stackoverflow.com/a/5711366
<pre><code>git branch -d -- -f </code></pre> <p>The <code>--</code> symbol in general will stop parsing of command line options with many Linux tools.</p> <p>Another way is</p> <pre><code>git update-ref -d refs/heads/-f </code></pre> <p>but <code>git-update-ref</code> is rather dangerous.</p>
<pre><code>git branch -d -- -f </code></pre> <p>The <code>--</code> symbol in general will stop parsing of command line options with many Linux tools.</p> <p>Another way is</p> <pre><code>git update-ref -d refs/heads/-f </code></pre> <p>but <code>git-update-ref</code> is rather dangerous.</p>
119
git
<h1>Delete a branch starting with a hyphen</h1> <p>I managed to create a branch in git called '-f'</p> <p>e.g.</p> <pre><code>$ git branch * (no branch) -f </code></pre> <p>How do I delete the dang thing? git branch -d -f won't work, nor will git branch -d '-f' or even git branch -d -f -f</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,198
git
# Delete a branch starting with a hyphen I managed to create a branch in git called '-f' e.g. ``` $ git branch * (no branch) -f ``` How do I delete the dang thing? git branch -d -f won't work, nor will git branch -d '-f' or even git branch -d -f -f
``` git branch -d -- -f ``` The `--` symbol in general will stop parsing of command line options with many Linux tools. Another way is ``` git update-ref -d refs/heads/-f ``` but `git-update-ref` is rather dangerous.
4211604
show all tags in git log
146
2010-11-18 04:07:49
<p><strong>Why does <code>git log --decorate</code> not display more than one tag per commit?</strong></p> <p><strong>EDIT</strong>: Charles Bailey has come up with the answer (at least in my case)<br /> Essentially, I had one tag that pointed to another tag that pointed to the commit. Because of this extra layer of i...
177,009
511,612
2024-07-12 17:44:40
4,223,292
17
2010-11-19 08:37:16
6,309
2010-11-19 08:37:16
https://stackoverflow.com/q/4211604
https://stackoverflow.com/a/4223292
<p>Note about tag of tag (tagging a tag), which is at the origin of your issue, as <a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> correctly pointed out in the comment:</p> <p>Make sure you study <a href="http://lists.zerezo.com/git/msg691655.html" rel="noreferrer">this thread</a>, as...
<p>Note about tag of tag (tagging a tag), which is at the origin of your issue, as <a href="https://stackoverflow.com/users/19563/charles-bailey">Charles Bailey</a> correctly pointed out in the comment:</p> <p>Make sure you study <a href="http://lists.zerezo.com/git/msg691655.html" rel="noreferrer">this thread</a>, as...
119
git
<h1>show all tags in git log</h1> <p><strong>Why does <code>git log --decorate</code> not display more than one tag per commit?</strong></p> <p><strong>EDIT</strong>: Charles Bailey has come up with the answer (at least in my case)<br /> Essentially, I had one tag that pointed to another tag that pointed to the commit....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,199
git
# show all tags in git log **Why does `git log --decorate` not display more than one tag per commit?** **EDIT**: Charles Bailey has come up with the answer (at least in my case) Essentially, I had one tag that pointed to another tag that pointed to the commit. Because of this extra layer of indirection, the tag was...
Note about tag of tag (tagging a tag), which is at the origin of your issue, as [Charles Bailey](https://stackoverflow.com/users/19563/charles-bailey) correctly pointed out in the comment: Make sure you study [this thread](http://lists.zerezo.com/git/msg691655.html), as overriding a signed tag is not as easy: - if yo...
18462765
rebase reverted merged branch
54
2013-08-27 10:18:20
<p><strong>Background:</strong> I recently merged a rather large topic branch into <code>master</code>. A couple of days later I discovered this topic branch contained bugs. So I <code>git revert -m 1 &lt;merge-commit&gt;</code>ed it.</p> <p><strong>Problem:</strong> Now I'd like to check out the topic branch and reba...
16,406
260,805
2023-02-21 11:51:24
18,466,023
17
2013-08-27 12:53:05
2,527,338
2013-08-28 07:53:37
https://stackoverflow.com/q/18462765
https://stackoverflow.com/a/18466023
<p>One way to achieve this is to interactively rebase the topic branch and reword the first commit after branching out of master (e.g. <code>git rebase -i HEAD~10</code> if you have 10 commits in the branch). This will rewrite sha's of all the commits inside the topic branch. Therefore you will be able to rebase the us...
<p>One way to achieve this is to interactively rebase the topic branch and reword the first commit after branching out of master (e.g. <code>git rebase -i HEAD~10</code> if you have 10 commits in the branch). This will rewrite sha's of all the commits inside the topic branch. Therefore you will be able to rebase the us...
119, 717
git, merge
<h1>rebase reverted merged branch</h1> <p><strong>Background:</strong> I recently merged a rather large topic branch into <code>master</code>. A couple of days later I discovered this topic branch contained bugs. So I <code>git revert -m 1 &lt;merge-commit&gt;</code>ed it.</p> <p><strong>Problem:</strong> Now I'd like...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,204
git
# rebase reverted merged branch **Background:** I recently merged a rather large topic branch into `master`. A couple of days later I discovered this topic branch contained bugs. So I `git revert -m 1 <merge-commit>`ed it. **Problem:** Now I'd like to check out the topic branch and rebase it against current `master` ...
One way to achieve this is to interactively rebase the topic branch and reword the first commit after branching out of master (e.g. `git rebase -i HEAD~10` if you have 10 commits in the branch). This will rewrite sha's of all the commits inside the topic branch. Therefore you will be able to rebase the usual way with `...
7854611
git mergetool reports "No files need merging"
51
2011-10-21 19:56:05
<p>For some reason lately, every time I pull and get a merge conflict, running <code>git mergetool</code> reports "No files need merging":</p> <pre><code>$ git pull First, rewinding head to replay your work on top of it... Applying: replaced home button with Cancel Using index info to reconstruct a base tree... Fallin...
24,421
214,350
2019-06-13 19:06:18
7,935,387
17
2011-10-28 22:06:25
214,350
2011-10-28 22:06:25
https://stackoverflow.com/q/7854611
https://stackoverflow.com/a/7935387
<p>It looks like my problem had to do with file timestamps. Thanks to <a href="https://stackoverflow.com/questions/5074136/git-rebase-fails-your-local-changes-to-the-following-files-would-be-overwritte/5255710#5255710">this SO answer</a> suggested by Mark Longair, the following setting fixed it for me:</p> <pre><code>...
<p>It looks like my problem had to do with file timestamps. Thanks to <a href="https://stackoverflow.com/questions/5074136/git-rebase-fails-your-local-changes-to-the-following-files-would-be-overwritte/5255710#5255710">this SO answer</a> suggested by Mark Longair, the following setting fixed it for me:</p> <pre><code>...
119, 28897
git, git-merge
<h1>git mergetool reports "No files need merging"</h1> <p>For some reason lately, every time I pull and get a merge conflict, running <code>git mergetool</code> reports "No files need merging":</p> <pre><code>$ git pull First, rewinding head to replay your work on top of it... Applying: replaced home button with Cance...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,206
git
# git mergetool reports "No files need merging" For some reason lately, every time I pull and get a merge conflict, running `git mergetool` reports "No files need merging": ``` $ git pull First, rewinding head to replay your work on top of it... Applying: replaced home button with Cancel Using index info to reconstru...
It looks like my problem had to do with file timestamps. Thanks to [this SO answer](https://stackoverflow.com/questions/5074136/git-rebase-fails-your-local-changes-to-the-following-files-would-be-overwritte/5255710#5255710) suggested by Mark Longair, the following setting fixed it for me: ``` git config --global core....
3573410
What is the shortest way to swap staged and unstaged changes in git?
43
2010-08-26 08:37:00
<p>If some changes are added to the index and there are some changes that are not added to the index, how do I swap this two sets of changes?</p>
6,614
416,127
2023-11-25 18:14:32
3,574,533
17
2010-08-26 11:14:23
19,563
2010-08-26 11:14:23
https://stackoverflow.com/q/3573410
https://stackoverflow.com/a/3574533
<p>It think that this is easiest to do with temporary commits. When you have staged and unstaged commits, you have the possibility of conflicts when trying to reorder the changes.</p> <p>Make a commit with the staged changes, create a branch for later use:</p> <pre><code>git commit -m "Saved staged" git branch save-s...
<p>It think that this is easiest to do with temporary commits. When you have staged and unstaged commits, you have the possibility of conflicts when trying to reorder the changes.</p> <p>Make a commit with the staged changes, create a branch for later use:</p> <pre><code>git commit -m "Saved staged" git branch save-s...
119
git
<h1>What is the shortest way to swap staged and unstaged changes in git?</h1> <p>If some changes are added to the index and there are some changes that are not added to the index, how do I swap this two sets of changes?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,208
git
# What is the shortest way to swap staged and unstaged changes in git? If some changes are added to the index and there are some changes that are not added to the index, how do I swap this two sets of changes?
It think that this is easiest to do with temporary commits. When you have staged and unstaged commits, you have the possibility of conflicts when trying to reorder the changes. Make a commit with the staged changes, create a branch for later use: ``` git commit -m "Saved staged" git branch save-staged ``` Make a com...
6628539
How to tell Git that it's the same directory, just a different name
36
2011-07-08 18:08:07
<p>After getting past a few hurdles learning Git, I came across a new challenge: Renaming a directory (locally, in the working directory).</p> <p>When I type <code>git status</code>, it lists all the files in the old directory name (that exist with the same exact filenames in the new directory) as <strong>deleted</str...
20,239
586,707
2023-11-13 20:30:40
6,629,505
17
2011-07-08 19:33:13
586,707
2011-07-10 18:44:54
https://stackoverflow.com/q/6628539
https://stackoverflow.com/a/6629505
<p>All answers here were very helpful on the way to the actual solution for the particular scenario I was facing. I am providing what worked for me in the form of actual steps, hopefully helping others encountering the same challenge:</p> <ol> <li><code>git mv &lt;old-dir-name&gt; &lt;new-dir-name&gt;</code></li> <li>...
<p>All answers here were very helpful on the way to the actual solution for the particular scenario I was facing. I am providing what worked for me in the form of actual steps, hopefully helping others encountering the same challenge:</p> <ol> <li><code>git mv &lt;old-dir-name&gt; &lt;new-dir-name&gt;</code></li> <li>...
119
git
<h1>How to tell Git that it's the same directory, just a different name</h1> <p>After getting past a few hurdles learning Git, I came across a new challenge: Renaming a directory (locally, in the working directory).</p> <p>When I type <code>git status</code>, it lists all the files in the old directory name (that exis...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,210
git
# How to tell Git that it's the same directory, just a different name After getting past a few hurdles learning Git, I came across a new challenge: Renaming a directory (locally, in the working directory). When I type `git status`, it lists all the files in the old directory name (that exist with the same exact filen...
All answers here were very helpful on the way to the actual solution for the particular scenario I was facing. I am providing what worked for me in the form of actual steps, hopefully helping others encountering the same challenge: 1. `git mv <old-dir-name> <new-dir-name>` 2. `git status` (verify that all files ...
18411200
Unable to create symlink (File name too long)
35
2013-08-23 20:20:43
<p>I had pushed a project from Linux to Bitbucket and then cloned it on Windows. Turns out there were two symlinks, which appeared as textfiles on Windows. Since I knew where they should point to, I replaced them by copies of their destination files, committed and pushed.</p> <p>Now the Bitbucket repository looks okay...
33,354
2,277,395
2024-09-04 23:37:19
18,419,800
17
2013-08-24 14:48:38
null
2013-08-24 14:48:38
https://stackoverflow.com/q/18411200
https://stackoverflow.com/a/18419800
<p>As soon as you changed the content of a fake-symlink-file without also changing its mode from symlink to regular file and committed the result, you made a blob that can't be extracted on an OS with real symlinks, because you have an object that is supposed to be a symlink but its content is too long to be a pathname...
<p>As soon as you changed the content of a fake-symlink-file without also changing its mode from symlink to regular file and committed the result, you made a blob that can't be extracted on an OS with real symlinks, because you have an object that is supposed to be a symlink but its content is too long to be a pathname...
119, 1122, 8337
bitbucket, git, symlink
<h1>Unable to create symlink (File name too long)</h1> <p>I had pushed a project from Linux to Bitbucket and then cloned it on Windows. Turns out there were two symlinks, which appeared as textfiles on Windows. Since I knew where they should point to, I replaced them by copies of their destination files, committed and ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,211
git
# Unable to create symlink (File name too long) I had pushed a project from Linux to Bitbucket and then cloned it on Windows. Turns out there were two symlinks, which appeared as textfiles on Windows. Since I knew where they should point to, I replaced them by copies of their destination files, committed and pushed. ...
As soon as you changed the content of a fake-symlink-file without also changing its mode from symlink to regular file and committed the result, you made a blob that can't be extracted on an OS with real symlinks, because you have an object that is supposed to be a symlink but its content is too long to be a pathname. T...
37736232
Why TFS with GIT is not working from command line?
34
2016-06-09 21:09:56
<p>I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.</p> <p>But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management works perfectly from Visual Studio. (even pu...
28,555
477,969
2021-08-11 11:33:25
38,132,380
17
2016-06-30 20:10:08
477,969
2016-07-11 17:41:36
https://stackoverflow.com/q/37736232
https://stackoverflow.com/a/38132380
<p>Finally a collegue hit the solution and I will post it here:</p> <p>Use the command:</p> <pre><code>git config --global credential.http://[tfs_server].integrated true </code></pre> <p>Of course, replace <code>[tfs_server]</code> with your own TFS server host name.</p> <p>When Credential Manager asks for credenti...
<p>Finally a collegue hit the solution and I will post it here:</p> <p>Use the command:</p> <pre><code>git config --global credential.http://[tfs_server].integrated true </code></pre> <p>Of course, replace <code>[tfs_server]</code> with your own TFS server host name.</p> <p>When Credential Manager asks for credenti...
119, 733, 10401, 33953
active-directory, git, tfs, visual-studio
<h1>Why TFS with GIT is not working from command line?</h1> <p>I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.</p> <p>But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,212
git
# Why TFS with GIT is not working from command line? I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories. But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management ...
Finally a collegue hit the solution and I will post it here: Use the command: ``` git config --global credential.http://[tfs_server].integrated true ``` Of course, replace `[tfs_server]` with your own TFS server host name. When Credential Manager asks for credentials just leave blanks and press OK. (I this way auth...
38616937
git: Solve merge conflicts without performing a merge
33
2016-07-27 15:10:51
<p>I just want to know, if there is any way, to resolve merge commits, of two git branches, without actually merging them.</p> <p>Assuming, I have a branch "featureMy"; my colleague created another branch "featureHis". Both branches are created on "master" branch.</p> <p>My colleague then created a merge request for...
38,745
4,562,958
2023-07-17 01:19:59
38,617,140
17
2016-07-27 15:19:18
1,863,229
2023-07-17 01:19:59
https://stackoverflow.com/q/38616937
https://stackoverflow.com/a/38617140
<p>One standard way to avoid having merge commits is to use rebasing in place of merging. Consider the following scenario:</p> <pre><code>master: A featureMy: A -- B featureHis: A -- C </code></pre> <p>Assuming that only these two branches are extant from <code>master</code>, then one of you will merge with <code...
<p>One standard way to avoid having merge commits is to use rebasing in place of merging. Consider the following scenario:</p> <pre><code>master: A featureMy: A -- B featureHis: A -- C </code></pre> <p>Assuming that only these two branches are extant from <code>master</code>, then one of you will merge with <code...
119
git
<h1>git: Solve merge conflicts without performing a merge</h1> <p>I just want to know, if there is any way, to resolve merge commits, of two git branches, without actually merging them.</p> <p>Assuming, I have a branch "featureMy"; my colleague created another branch "featureHis". Both branches are created on "master...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,213
git
# git: Solve merge conflicts without performing a merge I just want to know, if there is any way, to resolve merge commits, of two git branches, without actually merging them. Assuming, I have a branch "featureMy"; my colleague created another branch "featureHis". Both branches are created on "master" branch. My col...
One standard way to avoid having merge commits is to use rebasing in place of merging. Consider the following scenario: ``` master: A featureMy: A -- B featureHis: A -- C ``` Assuming that only these two branches are extant from `master`, then one of you will merge with `master` first. Let's say it is your colle...
17599999
Git clone verbose mode – show each incoming object
33
2013-07-11 17:42:14
<p>I’m wondering that <code>git clone --verbose</code> is not very verbose. The output of executing the command is the following:</p> <pre><code>$ git clone --verbose &lt;repo&gt; remote: Counting objects: 184, done remote: Finding sources: 100% (184/184) remote: Total 184 (delta 66), reused 183 (delta 66) Receiving o...
58,801
843,704
2023-11-18 19:58:42
17,600,074
17
2013-07-11 17:47:16
427,545
2013-07-11 17:47:16
https://stackoverflow.com/q/17599999
https://stackoverflow.com/a/17600074
<p>It is not possible to list objects (files, commits, blobs, whatever) one-by-one, simply because git packs them in a single file for efficiency reasons. For the same reason, you will only see a hidden <code>.git</code> folder while cloning, files will be created only if the full pack file has been downloaded.</p> <p...
<p>It is not possible to list objects (files, commits, blobs, whatever) one-by-one, simply because git packs them in a single file for efficiency reasons. For the same reason, you will only see a hidden <code>.git</code> folder while cloning, files will be created only if the full pack file has been downloaded.</p> <p...
119, 35061
git, verbose
<h1>Git clone verbose mode – show each incoming object</h1> <p>I’m wondering that <code>git clone --verbose</code> is not very verbose. The output of executing the command is the following:</p> <pre><code>$ git clone --verbose &lt;repo&gt; remote: Counting objects: 184, done remote: Finding sources: 100% (184/184) rem...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,214
git
# Git clone verbose mode – show each incoming object I’m wondering that `git clone --verbose` is not very verbose. The output of executing the command is the following: ``` $ git clone --verbose <repo> remote: Counting objects: 184, done remote: Finding sources: 100% (184/184) remote: Total 184 (delta 66), reused 183...
It is not possible to list objects (files, commits, blobs, whatever) one-by-one, simply because git packs them in a single file for efficiency reasons. For the same reason, you will only see a hidden `.git` folder while cloning, files will be created only if the full pack file has been downloaded. If you are wondering...
16118797
git push to remote repository "Could not read from remote repository"
33
2013-04-20 09:36:56
<p>I searched for a while but I can't find a solution to my Problem.</p> <p>I have a Server I can connect to via ssh with the username <code>git</code> and a local git repository.<br> Now I want to push my local repository to a newly created one on the Server.</p> <p>Here is what I did:</p> <ul> <li>created a git re...
88,574
1,090,755
2015-11-04 20:31:52
16,119,444
17
2013-04-20 10:47:13
6,309
2013-04-21 10:39:37
https://stackoverflow.com/q/16118797
https://stackoverflow.com/a/16119444
<p>In this case, using openssh over putty was key.</p> <hr> <p>Original answer (tips for debugging)</p> <blockquote> <p>I can log in via ssh with the <code>git</code> user.</p> </blockquote> <p>That means this works:</p> <pre><code>ssh git@serverIp </code></pre> <p>You do have a <code>HOME</code> variable defin...
<p>In this case, using openssh over putty was key.</p> <hr> <p>Original answer (tips for debugging)</p> <blockquote> <p>I can log in via ssh with the <code>git</code> user.</p> </blockquote> <p>That means this works:</p> <pre><code>ssh git@serverIp </code></pre> <p>You do have a <code>HOME</code> variable defin...
119, 386, 7330, 41346
git, git-remote, repository, ssh
<h1>git push to remote repository "Could not read from remote repository"</h1> <p>I searched for a while but I can't find a solution to my Problem.</p> <p>I have a Server I can connect to via ssh with the username <code>git</code> and a local git repository.<br> Now I want to push my local repository to a newly create...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,215
git
# git push to remote repository "Could not read from remote repository" I searched for a while but I can't find a solution to my Problem. I have a Server I can connect to via ssh with the username `git` and a local git repository. Now I want to push my local repository to a newly created one on the Server. Here is...
In this case, using openssh over putty was key. --- Original answer (tips for debugging) > I can log in via ssh with the `git` user. That means this works: ``` ssh git@serverIp ``` You do have a `HOME` variable defined, and ssh public/private keys (`id_rsa` / `id_rsa.pub`) in `%HOME%/.ssh/`. [This question](http...
53514521
What are the drawbacks to setting git's submodule.recurse config option to true?
32
2018-11-28 07:49:14
<p>This question <a href="https://stackoverflow.com/q/4611512/12711">Is there a way to make git pull automatically update submodules?</a> has an accepted answer of configuring git like so:</p> <pre><code>git config --global submodule.recurse true </code></pre> <p>Like one of the comments to that answer, I'm wondering...
12,987
12,711
2025-01-01 15:24:15
53,622,660
17
2018-12-04 22:53:34
6,309
2025-01-01 15:24:15
https://stackoverflow.com/q/53514521
https://stackoverflow.com/a/53622660
<p>This option was introduced in <a href="https://github.com/git/git/commit/046b48239eca34425909330e59da57f5fd421bdc" rel="nofollow noreferrer">commit 046b482</a>, initially for working tree manipulating commands (<code>read-tree</code>/<code>checkout</code>/<code>reset</code>)</p> <p><code>git grep</code>/<code>fetch<...
<p>This option was introduced in <a href="https://github.com/git/git/commit/046b48239eca34425909330e59da57f5fd421bdc" rel="nofollow noreferrer">commit 046b482</a>, initially for working tree manipulating commands (<code>read-tree</code>/<code>checkout</code>/<code>reset</code>)</p> <p><code>git grep</code>/<code>fetch<...
119, 41612
git, git-submodules
<h1>What are the drawbacks to setting git's submodule.recurse config option to true?</h1> <p>This question <a href="https://stackoverflow.com/q/4611512/12711">Is there a way to make git pull automatically update submodules?</a> has an accepted answer of configuring git like so:</p> <pre><code>git config --global submo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,216
git
# What are the drawbacks to setting git's submodule.recurse config option to true? This question [Is there a way to make git pull automatically update submodules?](https://stackoverflow.com/q/4611512/12711) has an accepted answer of configuring git like so: ``` git config --global submodule.recurse true ``` Like one...
This option was introduced in [commit 046b482](https://github.com/git/git/commit/046b48239eca34425909330e59da57f5fd421bdc), initially for working tree manipulating commands (`read-tree`/`checkout`/`reset`) `git grep`/`fetch`/`pull`/`push` soon followed. However, as [the documentation mentions](https://github.com/git...
11841127
strategy for git and append-mostly files
31
2012-08-07 07:23:42
<p>I have some files in my repository that are bottom-growing: most of the changes involve adding new lines at the bottom of the file. This is mostly language and other property files.</p> <p>As an annoying side effect, whenever two people make additions at the same time I get merge conflicts, and the resolution alway...
4,847
7,581
2015-12-29 18:48:38
11,841,436
17
2012-08-07 07:49:19
6,309
2012-08-07 11:29:59
https://stackoverflow.com/q/11841127
https://stackoverflow.com/a/11841436
<p>You could use the <a href="http://git-scm.com/docs/gitattributes" rel="nofollow noreferrer">gitattributes</a> mechanism to define a <strong>custom merge driver</strong> (like <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-s/930495#93...
<p>You could use the <a href="http://git-scm.com/docs/gitattributes" rel="nofollow noreferrer">gitattributes</a> mechanism to define a <strong>custom merge driver</strong> (like <a href="https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-s/930495#93...
119, 28897
git, git-merge
<h1>strategy for git and append-mostly files</h1> <p>I have some files in my repository that are bottom-growing: most of the changes involve adding new lines at the bottom of the file. This is mostly language and other property files.</p> <p>As an annoying side effect, whenever two people make additions at the same ti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
21,218
git
# strategy for git and append-mostly files I have some files in my repository that are bottom-growing: most of the changes involve adding new lines at the bottom of the file. This is mostly language and other property files. As an annoying side effect, whenever two people make additions at the same time I get merge c...
You could use the [gitattributes](http://git-scm.com/docs/gitattributes) mechanism to define a **custom merge driver** (like [this one for instance](https://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-s/930495#930495)) in order to copy automatically ...