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
9361798
Git log: log of future revisions
20
2012-02-20 13:18:07
<p>When I check out a previous commit of a git repository, 'git log' no longer shows commits that were committed after the currently checked out commit.</p> <p>So, the question is: how do get a log of commits after the currently checked out one?</p>
7,062
346,977
2024-06-06 15:07:12
9,361,863
29
2012-02-20 13:23:18
35,070
2012-02-20 19:01:37
https://stackoverflow.com/q/9361798
https://stackoverflow.com/a/9361863
<p>You can use the <code>--all</code> flag to see all revisions, as in</p> <pre><code>git log --all </code></pre> <p>If you are just interested in the future revisions, you can also use</p> <pre><code>git log ..@{1} # assuming you just switched from the future master git log ..abcdef # assuming abcdef is the...
<p>You can use the <code>--all</code> flag to see all revisions, as in</p> <pre><code>git log --all </code></pre> <p>If you are just interested in the future revisions, you can also use</p> <pre><code>git log ..@{1} # assuming you just switched from the future master git log ..abcdef # assuming abcdef is the...
119, 47913, 130797
git, git-history, git-log
<h1>Git log: log of future revisions</h1> <p>When I check out a previous commit of a git repository, 'git log' no longer shows commits that were committed after the currently checked out commit.</p> <p>So, the question is: how do get a log of commits after the currently checked out one?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,107
git
# Git log: log of future revisions When I check out a previous commit of a git repository, 'git log' no longer shows commits that were committed after the currently checked out commit. So, the question is: how do get a log of commits after the currently checked out one?
You can use the `--all` flag to see all revisions, as in ``` git log --all ``` If you are just interested in the future revisions, you can also use ``` git log ..@{1} # assuming you just switched from the future master git log ..abcdef # assuming abcdef is the newest future commit ```
3220629
Make git ignore files
20
2010-07-10 19:53:30
<p>I'm trying to make git ignore some of my files and I found one description about how you could do this</p> <blockquote> <p>From: <a href="http://github.com/guides/git-cheat-sheet" rel="noreferrer">http://github.com/guides/git-cheat-sheet</a> TO IGNORE SOME FILES</p> <p>Add a file in the root directory ca...
39,096
360,186
2016-11-23 14:24:49
3,220,653
29
2010-07-10 20:00:34
355,610
2010-07-11 01:56:11
https://stackoverflow.com/q/3220629
https://stackoverflow.com/a/3220653
<p>According to <a href="http://git-scm.com/docs/gitignore" rel="noreferrer"><strong>man gitignore</strong></a>:</p> <blockquote> <h3>DESCRIPTION</h3> <p>A <code>gitignore</code> file specifies intentionally untracked files that git should ignore. Note that all the <code>gitignore</code> files really concern ...
<p>According to <a href="http://git-scm.com/docs/gitignore" rel="noreferrer"><strong>man gitignore</strong></a>:</p> <blockquote> <h3>DESCRIPTION</h3> <p>A <code>gitignore</code> file specifies intentionally untracked files that git should ignore. Note that all the <code>gitignore</code> files really concern ...
119
git
<h1>Make git ignore files</h1> <p>I'm trying to make git ignore some of my files and I found one description about how you could do this</p> <blockquote> <p>From: <a href="http://github.com/guides/git-cheat-sheet" rel="noreferrer">http://github.com/guides/git-cheat-sheet</a> TO IGNORE SOME FILES</p> <p>Add a ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,108
git
# Make git ignore files I'm trying to make git ignore some of my files and I found one description about how you could do this > From: <http://github.com/guides/git-cheat-sheet> > TO IGNORE SOME FILES > > Add a file in the root directory > called .gitignore and add some files > to it: (comments begin with hash) > *.l...
According to [**man gitignore**](http://git-scm.com/docs/gitignore): > ### DESCRIPTION > > A `gitignore` file specifies intentionally untracked files that git should ignore. Note > that all the `gitignore` files really concern only files that are not already > tracked by git; in order to ignore uncommitted changes in ...
25200231
Cloning a git repo with all submodules
19
2014-08-08 09:31:58
<p>I have a working git repository containing several submodules (obtained by cloning different repositories). </p> <p>Now, I want to <strong>copy the whole repository (with all the submodules)</strong> to a bare git repo on a different machine by either using pushing or cloning. I'm fine loosing the history of the su...
18,049
2,214,693
2014-08-08 10:36:43
25,201,558
29
2014-08-08 10:36:43
null
2014-08-08 10:36:43
https://stackoverflow.com/q/25200231
https://stackoverflow.com/a/25201558
<p>You can clone the git repo with all submodule using <code>recursive</code> as follow:</p> <pre><code>git clone --recursive your-repo-url </code></pre> <p>on the other hand if you have already cloned, you can use:</p> <pre><code>git submodule init git submodule update </code></pre> <p>You won't lose any history i...
<p>You can clone the git repo with all submodule using <code>recursive</code> as follow:</p> <pre><code>git clone --recursive your-repo-url </code></pre> <p>on the other hand if you have already cloned, you can use:</p> <pre><code>git submodule init git submodule update </code></pre> <p>You won't lose any history i...
119, 28898, 34099, 41612
git, git-clone, git-push, git-submodules
<h1>Cloning a git repo with all submodules</h1> <p>I have a working git repository containing several submodules (obtained by cloning different repositories). </p> <p>Now, I want to <strong>copy the whole repository (with all the submodules)</strong> to a bare git repo on a different machine by either using pushing or...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,112
git
# Cloning a git repo with all submodules I have a working git repository containing several submodules (obtained by cloning different repositories). Now, I want to **copy the whole repository (with all the submodules)** to a bare git repo on a different machine by either using pushing or cloning. I'm fine loosing the...
You can clone the git repo with all submodule using `recursive` as follow: ``` git clone --recursive your-repo-url ``` on the other hand if you have already cloned, you can use: ``` git submodule init git submodule update ``` You won't lose any history in your submodule
17451865
`git branch --list` returns files?
19
2013-07-03 15:17:53
<p>This is strange. I'm trying to make a script that will checkout every local branch and rebase origin/master onto it. </p> <p>So this is my script:</p> <pre><code>for br in `git branch -l`; do git checkout $br git rebase origin/master done </code></pre> <p>Simple. But before I made the script, I wanted to ...
2,064
958,083
2013-07-03 23:14:52
17,452,027
29
2013-07-03 15:26:11
183,203
2013-07-03 20:38:03
https://stackoverflow.com/q/17451865
https://stackoverflow.com/a/17452027
<p>This is kind of a silly thing.</p> <p>git branch --list is putting an asterisk in front of the currently selected branch; your shell script is interpreting that as the wildcard and adding the files in the current directory to the list of items to traverse with your for loop.</p> <p>You can try</p> <pre><code>for ...
<p>This is kind of a silly thing.</p> <p>git branch --list is putting an asterisk in front of the currently selected branch; your shell script is interpreting that as the wildcard and adding the files in the current directory to the list of items to traverse with your for loop.</p> <p>You can try</p> <pre><code>for ...
119, 531, 1879, 8974
branch, git, rebase, scripting
<h1>`git branch --list` returns files?</h1> <p>This is strange. I'm trying to make a script that will checkout every local branch and rebase origin/master onto it. </p> <p>So this is my script:</p> <pre><code>for br in `git branch -l`; do git checkout $br git rebase origin/master done </code></pre> <p>Simple...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,113
git
# `git branch --list` returns files? This is strange. I'm trying to make a script that will checkout every local branch and rebase origin/master onto it. So this is my script: ``` for br in `git branch -l`; do git checkout $br git rebase origin/master done ``` Simple. But before I made the script, I wanted ...
This is kind of a silly thing. git branch --list is putting an asterisk in front of the currently selected branch; your shell script is interpreting that as the wildcard and adding the files in the current directory to the list of items to traverse with your for loop. You can try ``` for br in `git branch -l | tr '*...
10082514
git ls-tree output of working directory?
19
2012-04-10 02:47:11
<p>I am looking for a way to have output in the same manner as <code>ls-tree</code>, but of my working directory. Whenever I run <code>git ls-tree .</code> it says <code>fatal: Not a valid object name .</code></p>
41,091
10,608
2024-08-08 19:06:21
10,083,169
29
2012-04-10 04:39:47
102,182
2022-01-29 12:18:28
https://stackoverflow.com/q/10082514
https://stackoverflow.com/a/10083169
<p><code>git ls-tree</code> only works with git refs, e.g. <code>ls-tree HEAD</code> or <code>ls-tree 1.9.1</code></p> <p>Try <code>git ls-files</code>. You probably want the <code>-s</code> and/or <code>-m</code> flags.</p> <hr /> <p>As you point out, <code>git ls-files -s</code> will list the files in the index (i.e...
<p><code>git ls-tree</code> only works with git refs, e.g. <code>ls-tree HEAD</code> or <code>ls-tree 1.9.1</code></p> <p>Try <code>git ls-files</code>. You probably want the <code>-s</code> and/or <code>-m</code> flags.</p> <hr /> <p>As you point out, <code>git ls-files -s</code> will list the files in the index (i.e...
119, 114517
git, git-ls-tree
<h1>git ls-tree output of working directory?</h1> <p>I am looking for a way to have output in the same manner as <code>ls-tree</code>, but of my working directory. Whenever I run <code>git ls-tree .</code> it says <code>fatal: Not a valid object name .</code></p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,114
git
# git ls-tree output of working directory? I am looking for a way to have output in the same manner as `ls-tree`, but of my working directory. Whenever I run `git ls-tree .` it says `fatal: Not a valid object name .`
`git ls-tree` only works with git refs, e.g. `ls-tree HEAD` or `ls-tree 1.9.1` Try `git ls-files`. You probably want the `-s` and/or `-m` flags. --- As you point out, `git ls-files -s` will list the files in the index (i.e. files that have been staged). In theory, you could mess with the index, run `git ls-files -s...
7262959
Who deleted my change in git?
19
2011-08-31 20:27:53
<p>Here was my problem for the last 30 minutes: I had a couple of changes that disappeared in one of my files, and I don't know when that happened. And I want to know who did that!</p> <p>I started looking for the revisions having my files:</p> <pre><code>git grep &lt;searched_string&gt; $(git rev-list --all) -- &lt;...
5,432
433,333
2017-03-10 00:19:22
7,265,218
29
2011-09-01 01:18:36
389,146
2011-09-01 01:18:36
https://stackoverflow.com/q/7262959
https://stackoverflow.com/a/7265218
<p><code>git blame</code> has a <code>--reverse</code> option that takes a range of commits and shows you the last commit where a line existed before it was deleted. So, you find a commit you know the lines were there, let's say <code>abcdef01</code> for example, and to show the last commit before the delete, do:</p> ...
<p><code>git blame</code> has a <code>--reverse</code> option that takes a range of commits and shows you the last commit where a line existed before it was deleted. So, you find a commit you know the lines were there, let's say <code>abcdef01</code> for example, and to show the last commit before the delete, do:</p> ...
119, 1555
git, revision
<h1>Who deleted my change in git?</h1> <p>Here was my problem for the last 30 minutes: I had a couple of changes that disappeared in one of my files, and I don't know when that happened. And I want to know who did that!</p> <p>I started looking for the revisions having my files:</p> <pre><code>git grep &lt;searched_s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,115
git
# Who deleted my change in git? Here was my problem for the last 30 minutes: I had a couple of changes that disappeared in one of my files, and I don't know when that happened. And I want to know who did that! I started looking for the revisions having my files: ``` git grep <searched_string> $(git rev-list --all) -...
`git blame` has a `--reverse` option that takes a range of commits and shows you the last commit where a line existed before it was deleted. So, you find a commit you know the lines were there, let's say `abcdef01` for example, and to show the last commit before the delete, do: ``` git blame --reverse abcdef01..HEAD -...
35773936
Git log - How to filter (exclude) files from appearing in `git log`? (git pathspec magic)
18
2016-03-03 13:46:11
<p>I need to use the <code>git-log</code> command to create a report of the number of added and removed lines by commit, on average between two dates. </p> <p>Currently the command I use is:</p> <pre><code>git log --since="2015-12-01" --until="2015-12-31" --shortstat </code></pre> <p>But I need to filter some files ...
6,556
128,662
2016-03-03 15:51:47
35,775,022
29
2016-03-03 14:33:37
1,755,598
2016-03-03 15:51:47
https://stackoverflow.com/q/35773936
https://stackoverflow.com/a/35775022
<p>The &quot;secret&quot; on how to do it is called:</p> <hr /> <h2><em><strong><code>pathspec magic</code></strong></em></h2> <hr /> <p>You Can simply use this format (introduced in git version &gt;1.9):</p> <pre><code># Use this syntax, pay attention to all the parameters and the syntax # Unix: git log &lt;any requ...
<p>The &quot;secret&quot; on how to do it is called:</p> <hr /> <h2><em><strong><code>pathspec magic</code></strong></em></h2> <hr /> <p>You Can simply use this format (introduced in git version &gt;1.9):</p> <pre><code># Use this syntax, pay attention to all the parameters and the syntax # Unix: git log &lt;any requ...
119, 47913, 53850
git, git-commit, git-log
<h1>Git log - How to filter (exclude) files from appearing in `git log`? (git pathspec magic)</h1> <p>I need to use the <code>git-log</code> command to create a report of the number of added and removed lines by commit, on average between two dates. </p> <p>Currently the command I use is:</p> <pre><code>git log --sin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,117
git
# Git log - How to filter (exclude) files from appearing in `git log`? (git pathspec magic) I need to use the `git-log` command to create a report of the number of added and removed lines by commit, on average between two dates. Currently the command I use is: ``` git log --since="2015-12-01" --until="2015-12-31" --...
The "secret" on how to do it is called: --- ## ***`pathspec magic`*** --- You Can simply use this format (introduced in git version >1.9): ``` # Use this syntax, pay attention to all the parameters and the syntax # Unix: git log <any required flags> -p -- . ':(exclude)*.generated.*' # Windows (double quote) [ ...
24162512
github with Visual Studio 2013 - cannot pull because of uncommitted changes
18
2014-06-11 12:04:42
<p>I am a single developer right now, but I do have a workplace, and I also do work at home. Github is pretty ideal for me because the goal is to track my code, but also just keep it in a good repository so I don't lose it. So here is my work process...</p> <ul> <li>Do work at home (<code>site a</code>)</li> <li>commi...
22,685
2,796,614
2014-06-11 12:18:46
24,162,757
29
2014-06-11 12:18:46
384,478
2014-06-11 12:18:46
https://stackoverflow.com/q/24162512
https://stackoverflow.com/a/24162757
<p>Before <code>pull</code>-ing you need to <code>stash</code> your uncommitted changes first. Visual Studio does not support full range of Git functionality yet, including <code>git stash</code>, so you have to do it through <a href="http://chocolatey.org/packages/git">command line</a> or use something like <a href="h...
<p>Before <code>pull</code>-ing you need to <code>stash</code> your uncommitted changes first. Visual Studio does not support full range of Git functionality yet, including <code>git stash</code>, so you have to do it through <a href="http://chocolatey.org/packages/git">command line</a> or use something like <a href="h...
119, 93364
git, visual-studio-2013
<h1>github with Visual Studio 2013 - cannot pull because of uncommitted changes</h1> <p>I am a single developer right now, but I do have a workplace, and I also do work at home. Github is pretty ideal for me because the goal is to track my code, but also just keep it in a good repository so I don't lose it. So here is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,118
git
# github with Visual Studio 2013 - cannot pull because of uncommitted changes I am a single developer right now, but I do have a workplace, and I also do work at home. Github is pretty ideal for me because the goal is to track my code, but also just keep it in a good repository so I don't lose it. So here is my work p...
Before `pull`-ing you need to `stash` your uncommitted changes first. Visual Studio does not support full range of Git functionality yet, including `git stash`, so you have to do it through [command line](http://chocolatey.org/packages/git) or use something like [Source Tree](http://www.sourcetreeapp.com/) in addition ...
11856141
How to git commit --amend a commit that's the base of a branch
18
2012-08-08 00:44:13
<p>I have branch foo off of master/head. I wanted to ammend the master/head and have these changes picked up on branch foo. I did the following:</p> <pre><code>git checkout master git add ... git commit --amend git checkout foo git rebase master </code></pre> <p>The problem was the old non-amended commit shows up a...
5,519
105,878
2017-07-26 02:45:57
11,857,478
29
2012-08-08 03:57:42
221,955
2017-07-26 02:45:57
https://stackoverflow.com/q/11856141
https://stackoverflow.com/a/11857478
<p>All you needed to do was to tell git where to start the rebase from: You can do this</p> <pre><code>git rebase --onto master SOMESHA foo </code></pre> <p>Where SOMESHA is the old master SHA. That is if your tree now looks like this</p> <pre><code>* aaaaaa - (master) | * bbbbbb - (foo) | * cccccc - (old master) |/...
<p>All you needed to do was to tell git where to start the rebase from: You can do this</p> <pre><code>git rebase --onto master SOMESHA foo </code></pre> <p>Where SOMESHA is the old master SHA. That is if your tree now looks like this</p> <pre><code>* aaaaaa - (master) | * bbbbbb - (foo) | * cccccc - (old master) |/...
119, 8974, 30968
git, git-amend, rebase
<h1>How to git commit --amend a commit that's the base of a branch</h1> <p>I have branch foo off of master/head. I wanted to ammend the master/head and have these changes picked up on branch foo. I did the following:</p> <pre><code>git checkout master git add ... git commit --amend git checkout foo git rebase master...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,120
git
# How to git commit --amend a commit that's the base of a branch I have branch foo off of master/head. I wanted to ammend the master/head and have these changes picked up on branch foo. I did the following: ``` git checkout master git add ... git commit --amend git checkout foo git rebase master ``` The problem was ...
All you needed to do was to tell git where to start the rebase from: You can do this ``` git rebase --onto master SOMESHA foo ``` Where SOMESHA is the old master SHA. That is if your tree now looks like this ``` * aaaaaa - (master) | * bbbbbb - (foo) | * cccccc - (old master) |/ * ffffff ``` And you do ``` git r...
1816985
Simulating a global revision number with git
18
2009-11-29 22:22:11
<p>How would I go about simulating a global increasing revision number for every commit in the git main line? </p> <p>So, after I commit I would like a script to run increases a number somewhere. </p> <p>This will allow me to tell my customers easily that X feature was fixed in git revision XYZ. </p> <p>I am looking...
5,720
17,174
2009-11-30 00:14:31
1,817,099
29
2009-11-29 23:09:15
137,317
2009-11-30 00:14:31
https://stackoverflow.com/q/1816985
https://stackoverflow.com/a/1817099
<p><code>git describe</code> gives you a version description like the following: <code>v2.0-64-g835c907</code>. The <code>v2.0</code> part is the name of the latest annotated tag preceding the commit, <code>64</code> is the number of commits after that, and <code>835c907</code> is the abbreviated commit id. It is basi...
<p><code>git describe</code> gives you a version description like the following: <code>v2.0-64-g835c907</code>. The <code>v2.0</code> part is the name of the latest annotated tag preceding the commit, <code>64</code> is the number of commits after that, and <code>835c907</code> is the abbreviated commit id. It is basi...
119, 456
git, version-control
<h1>Simulating a global revision number with git</h1> <p>How would I go about simulating a global increasing revision number for every commit in the git main line? </p> <p>So, after I commit I would like a script to run increases a number somewhere. </p> <p>This will allow me to tell my customers easily that X featur...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,121
git
# Simulating a global revision number with git How would I go about simulating a global increasing revision number for every commit in the git main line? So, after I commit I would like a script to run increases a number somewhere. This will allow me to tell my customers easily that X feature was fixed in git revisi...
`git describe` gives you a version description like the following: `v2.0-64-g835c907`. The `v2.0` part is the name of the latest annotated tag preceding the commit, `64` is the number of commits after that, and `835c907` is the abbreviated commit id. It is basically there to identify any revision in an exact and conven...
1475665
Why "git push helloworld +master:master" instead of just "git push helloworld"?
18
2009-09-25 06:05:32
<p>I tried to push my (first ever!) git repo like this initially:</p> <pre><code>$ git push helloworld </code></pre> <p>But I got this back:</p> <pre><code>To git-smichaels@free5.projectlocker.com:helloworld.git ! [rejected] HEAD -&gt; master (non-fast forward) error: failed to push some refs to 'git-smicha...
42,327
178,665
2009-09-25 06:39:17
1,475,699
29
2009-09-25 06:19:08
6,309
2009-09-25 06:39:17
https://stackoverflow.com/q/1475665
https://stackoverflow.com/a/1475699
<p>It appears you have rewritten your history (SHA-1 associated with your commit) in your master branch.</p> <p>That means, you can no longer push in a fast-forward mode.</p> <p>the +master forces the push to take place:<br> By having the optional leading +, you can tell git to update the <code>&lt;dst&gt;</code> ref...
<p>It appears you have rewritten your history (SHA-1 associated with your commit) in your master branch.</p> <p>That means, you can no longer push in a fast-forward mode.</p> <p>the +master forces the push to take place:<br> By having the optional leading +, you can tell git to update the <code>&lt;dst&gt;</code> ref...
119, 28898
git, git-push
<h1>Why "git push helloworld +master:master" instead of just "git push helloworld"?</h1> <p>I tried to push my (first ever!) git repo like this initially:</p> <pre><code>$ git push helloworld </code></pre> <p>But I got this back:</p> <pre><code>To git-smichaels@free5.projectlocker.com:helloworld.git ! [rejected] ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,122
git
# Why "git push helloworld +master:master" instead of just "git push helloworld"? I tried to push my (first ever!) git repo like this initially: ``` $ git push helloworld ``` But I got this back: ``` To git-smichaels@free5.projectlocker.com:helloworld.git ! [rejected] HEAD -> master (non-fast forward) error...
It appears you have rewritten your history (SHA-1 associated with your commit) in your master branch. That means, you can no longer push in a fast-forward mode. the +master forces the push to take place: By having the optional leading +, you can tell git to update the `<dst>` ref even when the update is not a fast ...
43094680
How do you fetch a remote branch without "checking it out"
17
2017-03-29 13:17:50
<p>I am working on a branch "branch-A" and using the command <code>git branch</code> I can see that its the only branch locally.</p> <p>If I use <code>git branch -a</code> I can see the remote copy of "remotes/origin/branch-B"</p> <p>What I want to do is bring branch-B locally, but I don't want to actually check it o...
11,487
2,298,137
2022-06-28 14:51:03
43,096,252
29
2017-03-29 14:21:24
7,640,269
2017-03-29 14:21:24
https://stackoverflow.com/q/43094680
https://stackoverflow.com/a/43096252
<p>You can do this, one liner very simple.</p> <pre><code>git fetch &lt;remote&gt; &lt;srcBranch&gt;:&lt;destBranch&gt; </code></pre> <p>this will avoid to checkout the remote branch.</p> <p>See this question for more information:</p> <p><a href="https://stackoverflow.com/questions/3216360/merge-update-and-pull-git...
<p>You can do this, one liner very simple.</p> <pre><code>git fetch &lt;remote&gt; &lt;srcBranch&gt;:&lt;destBranch&gt; </code></pre> <p>this will avoid to checkout the remote branch.</p> <p>See this question for more information:</p> <p><a href="https://stackoverflow.com/questions/3216360/merge-update-and-pull-git...
119, 1879, 18283
branch, fetch, git
<h1>How do you fetch a remote branch without "checking it out"</h1> <p>I am working on a branch "branch-A" and using the command <code>git branch</code> I can see that its the only branch locally.</p> <p>If I use <code>git branch -a</code> I can see the remote copy of "remotes/origin/branch-B"</p> <p>What I want to d...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,123
git
# How do you fetch a remote branch without "checking it out" I am working on a branch "branch-A" and using the command `git branch` I can see that its the only branch locally. If I use `git branch -a` I can see the remote copy of "remotes/origin/branch-B" What I want to do is bring branch-B locally, but I don't want...
You can do this, one liner very simple. ``` git fetch <remote> <srcBranch>:<destBranch> ``` this will avoid to checkout the remote branch. See this question for more information: [Merge, update, and pull Git branches without using checkouts](https://stackoverflow.com/questions/3216360/merge-update-and-pull-git-bran...
41964523
How do I open GitKraken after installation on Windows 10?
17
2017-01-31 18:07:00
<p>It seems that this is a real issue. In <a href="https://support.gitkraken.com/how-to-install" rel="noreferrer">How to Install GitKraken</a>, they point to a <code>%APPDATA%/.gitkraken</code> folder. Once there, you have "profiles" and "service" folders and "config", "log" and "secFile" files. Inside those folders, t...
10,063
1,795,924
2023-12-12 07:59:25
41,967,877
29
2017-01-31 21:33:45
162,671
2017-01-31 21:33:45
https://stackoverflow.com/q/41964523
https://stackoverflow.com/a/41967877
<p>By default GitKraken is installed to your local app data folder. You can find the executable file inside <code>%LOCALAPPDATA%\gitkraken\app-&lt;app-version&gt;</code></p> <p>As of this writing, the latest version is 2.0.1 so the exe will be <code>%LOCALAPPDATA%\gitkraken\app-2.0.1\gitkraken.exe</code></p> <p>And e...
<p>By default GitKraken is installed to your local app data folder. You can find the executable file inside <code>%LOCALAPPDATA%\gitkraken\app-&lt;app-version&gt;</code></p> <p>As of this writing, the latest version is 2.0.1 so the exe will be <code>%LOCALAPPDATA%\gitkraken\app-2.0.1\gitkraken.exe</code></p> <p>And e...
107329, 119628
gitkraken, windows-10
<h1>How do I open GitKraken after installation on Windows 10?</h1> <p>It seems that this is a real issue. In <a href="https://support.gitkraken.com/how-to-install" rel="noreferrer">How to Install GitKraken</a>, they point to a <code>%APPDATA%/.gitkraken</code> folder. Once there, you have "profiles" and "service" folde...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,124
git
# How do I open GitKraken after installation on Windows 10? It seems that this is a real issue. In [How to Install GitKraken](https://support.gitkraken.com/how-to-install), they point to a `%APPDATA%/.gitkraken` folder. Once there, you have "profiles" and "service" folders and "config", "log" and "secFile" files. Insi...
By default GitKraken is installed to your local app data folder. You can find the executable file inside `%LOCALAPPDATA%\gitkraken\app-<app-version>` As of this writing, the latest version is 2.0.1 so the exe will be `%LOCALAPPDATA%\gitkraken\app-2.0.1\gitkraken.exe` And easier way to open the software would be using...
31396192
Team Explorer + Visual Studio Online + Git out of sync
17
2015-07-14 01:31:59
<p>After we move from TFS VC to Git as the repository on our VSO subscription, we got the following cenario.</p> <p>From a given remote repository on VSO named "<strong>RepoA</strong>", after the initial clone, it presents on team explorer to me the "<strong>main</strong>" branch for this repo. </p> <p>Then I created...
4,736
1,127,363
2016-03-28 18:46:38
31,399,328
29
2015-07-14 06:33:51
278,049
2015-07-14 06:33:51
https://stackoverflow.com/q/31396192
https://stackoverflow.com/a/31399328
<p>What you are looking for is for the <code>fetch</code> command to also <a href="http://git-scm.com/docs/git-fetch" rel="noreferrer"><code>prune</code></a>, but this is not supported at present in VSO. As a workaround, you can configure git to always <code>prune</code> by default whenever you do a <code>git fetch</co...
<p>What you are looking for is for the <code>fetch</code> command to also <a href="http://git-scm.com/docs/git-fetch" rel="noreferrer"><code>prune</code></a>, but this is not supported at present in VSO. As a workaround, you can configure git to always <code>prune</code> by default whenever you do a <code>git fetch</co...
119, 733, 33953, 116537
azure-devops, git, tfs, visual-studio
<h1>Team Explorer + Visual Studio Online + Git out of sync</h1> <p>After we move from TFS VC to Git as the repository on our VSO subscription, we got the following cenario.</p> <p>From a given remote repository on VSO named "<strong>RepoA</strong>", after the initial clone, it presents on team explorer to me the "<str...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,125
git
# Team Explorer + Visual Studio Online + Git out of sync After we move from TFS VC to Git as the repository on our VSO subscription, we got the following cenario. From a given remote repository on VSO named "**RepoA**", after the initial clone, it presents on team explorer to me the "**main**" branch for this repo. ...
What you are looking for is for the `fetch` command to also [`prune`](http://git-scm.com/docs/git-fetch), but this is not supported at present in VSO. As a workaround, you can configure git to always `prune` by default whenever you do a `git fetch`. You can do this using `git config remote.origin.prune true` See this ...
20648235
Error linking git to homebrew
17
2013-12-18 01:45:06
<p>I'm following <a href="http://lukejones.me/archives/set-up-a-local-server-on-osx" rel="noreferrer">Luke Jones' article on setting up a local server</a>, and I'm currently trying to set up homebrew with git on Mavericks. I already had git installed before installing homebrew. I'm having an issue that seemed similar t...
9,725
2,658,996
2016-04-11 09:27:46
20,648,399
29
2013-12-18 02:04:00
2,658,996
2013-12-18 02:04:00
https://stackoverflow.com/q/20648235
https://stackoverflow.com/a/20648399
<p>For others having an issue in the future:</p> <p>I have git linked with homebrew now. I had the <a href="http://mac.github.com/" rel="noreferrer">Mac Github client</a> installed which may have been making some files unwriteable (<a href="https://stackoverflow.com/questions/18676241/installing-git-with-homebrew-not-...
<p>For others having an issue in the future:</p> <p>I have git linked with homebrew now. I had the <a href="http://mac.github.com/" rel="noreferrer">Mac Github client</a> installed which may have been making some files unwriteable (<a href="https://stackoverflow.com/questions/18676241/installing-git-with-homebrew-not-...
119, 391, 1067, 92978
git, homebrew, osx-mavericks, terminal
<h1>Error linking git to homebrew</h1> <p>I'm following <a href="http://lukejones.me/archives/set-up-a-local-server-on-osx" rel="noreferrer">Luke Jones' article on setting up a local server</a>, and I'm currently trying to set up homebrew with git on Mavericks. I already had git installed before installing homebrew. I'...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,126
git
# Error linking git to homebrew I'm following [Luke Jones' article on setting up a local server](http://lukejones.me/archives/set-up-a-local-server-on-osx), and I'm currently trying to set up homebrew with git on Mavericks. I already had git installed before installing homebrew. I'm having an issue that seemed similar...
For others having an issue in the future: I have git linked with homebrew now. I had the [Mac Github client](http://mac.github.com/) installed which may have been making some files unwriteable ([this post](https://stackoverflow.com/questions/18676241/installing-git-with-homebrew-not-working) tipped me off), so I unins...
20586009
How to recover from "git stash save --all"?
17
2013-12-14 17:16:52
<p>I wanted to stash untracked files, but I keep passing the wrong option. To me this sounds right:</p> <pre><code>git stash save [-a|--all] </code></pre> <p>but this in fact stashes ignored files as well. The correct one is:</p> <pre><code>git stash save [-u|--include-untracked] </code></pre> <p>When I run <code>g...
6,229
1,247,274
2017-11-08 16:13:16
20,589,663
29
2013-12-14 23:57:35
1,256,452
2017-11-08 16:13:16
https://stackoverflow.com/q/20586009
https://stackoverflow.com/a/20589663
<h3>TL;DR version:</h3> <p>You need the directory to be clean (in <code>git clean</code> terms) for the stash to apply properly. This means running <code>git clean -f</code>, or even <code>git clean -fdx</code>, which is kind of an ugly thing to have to do, since some of the untracked or untracked-and-ignored files/d...
<h3>TL;DR version:</h3> <p>You need the directory to be clean (in <code>git clean</code> terms) for the stash to apply properly. This means running <code>git clean -f</code>, or even <code>git clean -fdx</code>, which is kind of an ugly thing to have to do, since some of the untracked or untracked-and-ignored files/d...
119, 13091
git, git-stash
<h1>How to recover from "git stash save --all"?</h1> <p>I wanted to stash untracked files, but I keep passing the wrong option. To me this sounds right:</p> <pre><code>git stash save [-a|--all] </code></pre> <p>but this in fact stashes ignored files as well. The correct one is:</p> <pre><code>git stash save [-u|--in...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,127
git
# How to recover from "git stash save --all"? I wanted to stash untracked files, but I keep passing the wrong option. To me this sounds right: ``` git stash save [-a|--all] ``` but this in fact stashes ignored files as well. The correct one is: ``` git stash save [-u|--include-untracked] ``` When I run `git stash ...
### TL;DR version: You need the directory to be clean (in `git clean` terms) for the stash to apply properly. This means running `git clean -f`, or even `git clean -fdx`, which is kind of an ugly thing to have to do, since some of the untracked or untracked-and-ignored files/directories may be items you want to keep, ...
18518923
Git: How to keep local feature branch updated with changes made in dev?
17
2013-08-29 18:53:40
<p>I've been following this guide for working with distributed git projects: <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">http://nvie.com/posts/a-successful-git-branching-model/</a>. It has worked well but now I have run into a snag. I have created a local feature branch. I would l...
21,384
731,052
2019-01-02 19:52:44
18,518,954
29
2013-08-29 18:55:41
139,010
2013-08-29 18:55:41
https://stackoverflow.com/q/18518923
https://stackoverflow.com/a/18518954
<p>Periodically:</p> <pre><code>λ git checkout dev λ git pull origin dev λ git checkout myfeaturebranch λ git merge dev </code></pre>
<p>Periodically:</p> <pre><code>λ git checkout dev λ git pull origin dev λ git checkout myfeaturebranch λ git merge dev </code></pre>
119, 1879
branch, git
<h1>Git: How to keep local feature branch updated with changes made in dev?</h1> <p>I've been following this guide for working with distributed git projects: <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">http://nvie.com/posts/a-successful-git-branching-model/</a>. It has worked well...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,128
git
# Git: How to keep local feature branch updated with changes made in dev? I've been following this guide for working with distributed git projects: <http://nvie.com/posts/a-successful-git-branching-model/>. It has worked well but now I have run into a snag. I have created a local feature branch. I would like to keep t...
Periodically: ``` λ git checkout dev λ git pull origin dev λ git checkout myfeaturebranch λ git merge dev ```
15233935
How do I release with BitBucket+Git+Maven
17
2013-03-05 20:55:17
<p>I have specified the following SCM tags in my pom. However when I do a maven <code>release:prepare</code> the tag created has a version 1.0-SNAPSHOT instead of 1.0</p> <p>Any ideas?</p> <pre class="lang-xml prettyprint-override"><code> &lt;scm&gt; &lt;connection&gt;scm:git:https://&lt;username&gt;@bitbucket.or...
19,364
1,086,117
2015-09-02 14:49:11
15,329,136
29
2013-03-10 23:44:41
1,487,256
2015-09-02 14:49:11
https://stackoverflow.com/q/15233935
https://stackoverflow.com/a/15329136
<p>Ideally you would use SSH to authenticate when doing the release. In that case you would use the following configuration:</p> <pre class="lang-xml prettyprint-override"><code>&lt;scm&gt; &lt;connection&gt;scm:git:ssh://git@bitbucket.org/&lt;username&gt;/&lt;repo&gt;.git&lt;/connection&gt; &lt;developerConne...
<p>Ideally you would use SSH to authenticate when doing the release. In that case you would use the following configuration:</p> <pre class="lang-xml prettyprint-override"><code>&lt;scm&gt; &lt;connection&gt;scm:git:ssh://git@bitbucket.org/&lt;username&gt;/&lt;repo&gt;.git&lt;/connection&gt; &lt;developerConne...
119, 8337, 41127, 47850
bitbucket, git, maven, maven-release-plugin
<h1>How do I release with BitBucket+Git+Maven</h1> <p>I have specified the following SCM tags in my pom. However when I do a maven <code>release:prepare</code> the tag created has a version 1.0-SNAPSHOT instead of 1.0</p> <p>Any ideas?</p> <pre class="lang-xml prettyprint-override"><code> &lt;scm&gt; &lt;connecti...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,129
git
# How do I release with BitBucket+Git+Maven I have specified the following SCM tags in my pom. However when I do a maven `release:prepare` the tag created has a version 1.0-SNAPSHOT instead of 1.0 Any ideas? ``` <scm> <connection>scm:git:https://<username>@bitbucket.org/<username>/<repo>.git</connection> <d...
Ideally you would use SSH to authenticate when doing the release. In that case you would use the following configuration: ``` <scm> <connection>scm:git:ssh://git@bitbucket.org/<username>/<repo>.git</connection> <developerConnection>scm:git:ssh://git@bitbucket.org/<username>/<repo>.git</developerConnection> ...
10955801
Git Errors when Pushing on Heroku
17
2012-06-08 20:43:11
<p>I'm using Heroku and have a Rails app that is stable (production env), so I wanted to create something new where I can have quality assurance env where I can see how the changes will work on Heroku (as well as aggregating enhancements for releases) without always pushing to my production app.</p> <p>So what I did w...
12,164
994,581
2019-04-15 20:00:06
10,956,226
29
2012-06-08 21:26:17
632,688
2012-06-08 21:26:17
https://stackoverflow.com/q/10955801
https://stackoverflow.com/a/10956226
<p>Heroku apps only run off of the master branch of the app repository (local to Heroku). If you want to deploy a branch to Heroku which isn't the master branch of your local repo, then you need to specify it. In your case it would be something like <code>git push qa-remote dev:master</code> (replace qa-remote with t...
<p>Heroku apps only run off of the master branch of the app repository (local to Heroku). If you want to deploy a branch to Heroku which isn't the master branch of your local repo, then you need to specify it. In your case it would be something like <code>git push qa-remote dev:master</code> (replace qa-remote with t...
119, 4984, 8279, 64108
git, heroku, ruby-on-rails, ruby-on-rails-3
<h1>Git Errors when Pushing on Heroku</h1> <p>I'm using Heroku and have a Rails app that is stable (production env), so I wanted to create something new where I can have quality assurance env where I can see how the changes will work on Heroku (as well as aggregating enhancements for releases) without always pushing to...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,130
git
# Git Errors when Pushing on Heroku I'm using Heroku and have a Rails app that is stable (production env), so I wanted to create something new where I can have quality assurance env where I can see how the changes will work on Heroku (as well as aggregating enhancements for releases) without always pushing to my produ...
Heroku apps only run off of the master branch of the app repository (local to Heroku). If you want to deploy a branch to Heroku which isn't the master branch of your local repo, then you need to specify it. In your case it would be something like `git push qa-remote dev:master` (replace qa-remote with the actual name o...
1314950
Git - get all commits and blobs they created
17
2009-08-22 02:29:31
<p>Is there a git command that can output for every commit:</p> <ol> <li>id</li> <li>subject</li> <li>blobs it created with they path and size (like <code>git ls-tree -l -r &lt;commit&gt;</code> but only for created blobs)</li> </ol>
21,448
96,823
2024-03-07 13:26:22
1,318,854
29
2009-08-23 15:50:58
96,823
2009-08-23 15:50:58
https://stackoverflow.com/q/1314950
https://stackoverflow.com/a/1318854
<p>To get commits (all and output one line per commit):</p> <pre><code>git rev-list --all --pretty=oneline </code></pre> <p>Then split commits by space with limit of 2 and get every commit id and message</p> <p>To get blobs created by commit (recurse to subdirs, show merge commits, detect renames and copies, don't s...
<p>To get commits (all and output one line per commit):</p> <pre><code>git rev-list --all --pretty=oneline </code></pre> <p>Then split commits by space with limit of 2 and get every commit id and message</p> <p>To get blobs created by commit (recurse to subdirs, show merge commits, detect renames and copies, don't s...
119, 3883, 5597
blob, commit, git
<h1>Git - get all commits and blobs they created</h1> <p>Is there a git command that can output for every commit:</p> <ol> <li>id</li> <li>subject</li> <li>blobs it created with they path and size (like <code>git ls-tree -l -r &lt;commit&gt;</code> but only for created blobs)</li> </ol>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,131
git
# Git - get all commits and blobs they created Is there a git command that can output for every commit: 1. id 2. subject 3. blobs it created with they path and size (like `git ls-tree -l -r <commit>` but only for created blobs)
To get commits (all and output one line per commit): ``` git rev-list --all --pretty=oneline ``` Then split commits by space with limit of 2 and get every commit id and message To get blobs created by commit (recurse to subdirs, show merge commits, detect renames and copies, don't show commit id on first line): ```...
23464138
Downloading and accessing data from github python
16
2014-05-05 03:03:18
<p>Hi I'm going through Python for Data analysis and I'd like to analyze the data he goes through in the book. In chapter 9, he uses the data below. However, I'm having a difficult time understanding how to utilize the data in my ipython notebook once I download it to my github application on mac. </p> <p>The stock da...
58,565
3,314,418
2025-11-04 03:57:56
23,464,217
29
2014-05-05 03:13:05
3,435,183
2017-05-13 16:33:59
https://stackoverflow.com/q/23464138
https://stackoverflow.com/a/23464217
<p>You should be able to just use the <code>url</code> of the raw version (a link to the raw version is a button on the link you provided) and then read it into a dataframe directly using <code>read_csv</code>:</p> <pre><code>import pandas as pd url = 'https://raw.githubusercontent.com/pydata/pydata-book/master/ch09/s...
<p>You should be able to just use the <code>url</code> of the raw version (a link to the raw version is a button on the link you provided) and then read it into a dataframe directly using <code>read_csv</code>:</p> <pre><code>import pandas as pd url = 'https://raw.githubusercontent.com/pydata/pydata-book/master/ch09/s...
16, 119, 67719
git, pandas, python
<h1>Downloading and accessing data from github python</h1> <p>Hi I'm going through Python for Data analysis and I'd like to analyze the data he goes through in the book. In chapter 9, he uses the data below. However, I'm having a difficult time understanding how to utilize the data in my ipython notebook once I downloa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,133
git
# Downloading and accessing data from github python Hi I'm going through Python for Data analysis and I'd like to analyze the data he goes through in the book. In chapter 9, he uses the data below. However, I'm having a difficult time understanding how to utilize the data in my ipython notebook once I download it to m...
You should be able to just use the `url` of the raw version (a link to the raw version is a button on the link you provided) and then read it into a dataframe directly using `read_csv`: ``` import pandas as pd url = 'https://raw.githubusercontent.com/pydata/pydata-book/master/ch09/stock_px.csv' df = pd.read_csv(url,in...
10319110
How to detect a forced update
16
2012-04-25 15:47:15
<p>When a branch history is changed on the remote, you typically get</p> <pre><code>o git@git.server.com:XXXXX/Project.git + efe2e8b...cda0ee7 HEAD -&gt; Ant_Config_processing (forced update) </code></pre> <p>Is there any way to get this (forced update) status using scripting ?</p> <p>The idea is to write an alias ...
15,927
258,689
2013-01-19 22:45:39
12,258,773
29
2012-09-04 07:36:01
374,851
2012-09-04 07:36:01
https://stackoverflow.com/q/10319110
https://stackoverflow.com/a/12258773
<p>I have a similar problem and I figured out it.</p> <p>I want to detect forced update within hook script in remote (bare) repository, So my answer might not be suitable for original question, but I hope to be useful my answer for future visitors.</p> <hr> <h1>How to detect forced update or not from in Git hooks sc...
<p>I have a similar problem and I figured out it.</p> <p>I want to detect forced update within hook script in remote (bare) repository, So my answer might not be suitable for original question, but I hope to be useful my answer for future visitors.</p> <hr> <h1>How to detect forced update or not from in Git hooks sc...
119
git
<h1>How to detect a forced update</h1> <p>When a branch history is changed on the remote, you typically get</p> <pre><code>o git@git.server.com:XXXXX/Project.git + efe2e8b...cda0ee7 HEAD -&gt; Ant_Config_processing (forced update) </code></pre> <p>Is there any way to get this (forced update) status using scripting ?...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,134
git
# How to detect a forced update When a branch history is changed on the remote, you typically get ``` o git@git.server.com:XXXXX/Project.git + efe2e8b...cda0ee7 HEAD -> Ant_Config_processing (forced update) ``` Is there any way to get this (forced update) status using scripting ? The idea is to write an alias that...
I have a similar problem and I figured out it. I want to detect forced update within hook script in remote (bare) repository, So my answer might not be suitable for original question, but I hope to be useful my answer for future visitors. --- # How to detect forced update or not from in Git hooks script <https://gi...
3894719
Git: move existing repository from PC to server, clone from server
16
2010-10-08 22:20:26
<p>I have an existing Git repository on my local machine. I would like to move that repository to my web server, then <code>git clone</code> on my local machine to check out my repository from the server. I'm planning on then developing on my local machine and pushing updates back to the server. I can ssh from my lo...
9,547
38,743
2016-09-14 13:31:20
3,894,788
29
2010-10-08 22:39:24
893
2015-06-25 14:43:33
https://stackoverflow.com/q/3894719
https://stackoverflow.com/a/3894788
<p>On the Linux server, in a new directory do:</p> <pre><code>git init --shared --bare </code></pre> <p>Then on your local machine:</p> <pre><code>git remote add origin server:path/to/repo git push --all origin </code></pre> <p>After that, the server will have a full copy of the repository, and you will be able to ...
<p>On the Linux server, in a new directory do:</p> <pre><code>git init --shared --bare </code></pre> <p>Then on your local machine:</p> <pre><code>git remote add origin server:path/to/repo git push --all origin </code></pre> <p>After that, the server will have a full copy of the repository, and you will be able to ...
119, 456, 1231, 7330
command-line, git, repository, version-control
<h1>Git: move existing repository from PC to server, clone from server</h1> <p>I have an existing Git repository on my local machine. I would like to move that repository to my web server, then <code>git clone</code> on my local machine to check out my repository from the server. I'm planning on then developing on my...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,135
git
# Git: move existing repository from PC to server, clone from server I have an existing Git repository on my local machine. I would like to move that repository to my web server, then `git clone` on my local machine to check out my repository from the server. I'm planning on then developing on my local machine and pus...
On the Linux server, in a new directory do: ``` git init --shared --bare ``` Then on your local machine: ``` git remote add origin server:path/to/repo git push --all origin ``` After that, the server will have a full copy of the repository, and you will be able to push and pull to and from it. There's no need to ch...
43395504
git revert a merge: determine which parent is which (-m 1 vs -m 2)
15
2017-04-13 14:52:41
<p>I am trying to revert a merge, but I don't know whether to use <code>git revert -m 1 &lt;merge commit's sha&gt;</code> or <code>git revert -m 2 &lt;merge commit's sha&gt;</code>. How do I find out which parent is <code>-m 1</code> and which parent is <code>-m 2</code>?</p>
4,314
5,369,466
2017-04-13 19:35:29
43,400,387
29
2017-04-13 19:35:29
1,256,452
2017-04-13 19:35:29
https://stackoverflow.com/q/43395504
https://stackoverflow.com/a/43400387
<p>Well, the super-short answer is that it's always <code>-m 1</code>. :-) But this deserves some explanation:</p> <ul> <li><p>The parents are ordered, and commands like <code>git log</code> and <code>git show</code> show the order:</p> <blockquote> <pre><code>commit c13c783c9d3d7d3eff937b7bf3642d2a7fe32644 Merge: 3f...
<p>Well, the super-short answer is that it's always <code>-m 1</code>. :-) But this deserves some explanation:</p> <ul> <li><p>The parents are ordered, and commands like <code>git log</code> and <code>git show</code> show the order:</p> <blockquote> <pre><code>commit c13c783c9d3d7d3eff937b7bf3642d2a7fe32644 Merge: 3f...
119, 28897, 34403, 47913
git, git-log, git-merge, git-revert
<h1>git revert a merge: determine which parent is which (-m 1 vs -m 2)</h1> <p>I am trying to revert a merge, but I don't know whether to use <code>git revert -m 1 &lt;merge commit's sha&gt;</code> or <code>git revert -m 2 &lt;merge commit's sha&gt;</code>. How do I find out which parent is <code>-m 1</code> and which ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,136
git
# git revert a merge: determine which parent is which (-m 1 vs -m 2) I am trying to revert a merge, but I don't know whether to use `git revert -m 1 <merge commit's sha>` or `git revert -m 2 <merge commit's sha>`. How do I find out which parent is `-m 1` and which parent is `-m 2`?
Well, the super-short answer is that it's always `-m 1`. :-) But this deserves some explanation: - The parents are ordered, and commands like `git log` and `git show` show the order: > ``` > commit c13c783c9d3d7d3eff937b7bf3642d2a7fe32644 > Merge: 3f7ebc6ec 39ee4c6c2 > ``` so here `3f7ebc6ec` is parent #1 ...
7599494
How to edit the commit message of a git merge
15
2011-09-29 15:14:45
<p>I have merged with other branch, and there are few commits after merge, before pushing i want to change the message of the merge. git rebase -i is not displaying the merge commit.</p>
16,395
579,689
2011-09-29 15:16:31
7,599,522
29
2011-09-29 15:16:31
112,968
2011-09-29 15:16:31
https://stackoverflow.com/q/7599494
https://stackoverflow.com/a/7599522
<p>Not sure if there is a more elegant version, but what you can do is the following:</p> <pre><code>git checkout &lt;sha of merge&gt; git commit --amend # edit message git rebase HEAD previous_branch </code></pre>
<p>Not sure if there is a more elegant version, but what you can do is the following:</p> <pre><code>git checkout &lt;sha of merge&gt; git commit --amend # edit message git rebase HEAD previous_branch </code></pre>
119
git
<h1>How to edit the commit message of a git merge</h1> <p>I have merged with other branch, and there are few commits after merge, before pushing i want to change the message of the merge. git rebase -i is not displaying the merge commit.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,140
git
# How to edit the commit message of a git merge I have merged with other branch, and there are few commits after merge, before pushing i want to change the message of the merge. git rebase -i is not displaying the merge commit.
Not sure if there is a more elegant version, but what you can do is the following: ``` git checkout <sha of merge> git commit --amend # edit message git rebase HEAD previous_branch ```
3277792
How can I use Git with multiple remote repositories?
15
2010-07-19 00:26:36
<p>I use currently use Heroku for rails hosting which uses a Git repository for deployment. I also have a hosted Git repository that I use as my main source control for history/backup purposes. I would like to have 1 local folder that has my working copy of my application, then be able to commit my changes to either ...
9,094
3,291
2010-07-19 02:34:06
3,277,800
29
2010-07-19 00:30:00
67,022
2010-07-19 02:34:06
https://stackoverflow.com/q/3277792
https://stackoverflow.com/a/3277800
<p>Add them both as remotes:</p> <pre><code>git remote add origin ssh://myserver.example.com/var/git/myapp.git git remote add hosted ssh://myotherserver.example.com/var/git/myapp.git </code></pre> <p>[1] <a href="http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository" rel="noreferrer">http://toolmantim...
<p>Add them both as remotes:</p> <pre><code>git remote add origin ssh://myserver.example.com/var/git/myapp.git git remote add hosted ssh://myotherserver.example.com/var/git/myapp.git </code></pre> <p>[1] <a href="http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository" rel="noreferrer">http://toolmantim...
119, 8279
git, heroku
<h1>How can I use Git with multiple remote repositories?</h1> <p>I use currently use Heroku for rails hosting which uses a Git repository for deployment. I also have a hosted Git repository that I use as my main source control for history/backup purposes. I would like to have 1 local folder that has my working copy o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,141
git
# How can I use Git with multiple remote repositories? I use currently use Heroku for rails hosting which uses a Git repository for deployment. I also have a hosted Git repository that I use as my main source control for history/backup purposes. I would like to have 1 local folder that has my working copy of my applic...
Add them both as remotes: ``` git remote add origin ssh://myserver.example.com/var/git/myapp.git git remote add hosted ssh://myotherserver.example.com/var/git/myapp.git ``` [1] <http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository> [2] <http://www.kernel.org/pub/software/scm/git/docs/git-remote.html...
34987957
How did I end up with a detached HEAD?
14
2016-01-25 08:22:41
<p>I checked out a commit/branch from master, and then checked out back to master and wrote something. After that, I committed it, but I ended up with a detached HEAD. Why?</p> <p>Here is what I did:</p> <ol> <li>Create a new project and create git repository. </li> <li>git add</li> <li>git commit</li> <li>type some ...
18,097
5,835,947
2021-04-26 09:42:09
34,994,175
29
2016-01-25 13:46:30
2,541,573
2019-05-30 09:13:41
https://stackoverflow.com/q/34987957
https://stackoverflow.com/a/34994175
<h1>Problem and solution</h1> <p>Close inspection of the IntelliJ-IDEA log reveals the nature of the problem. After creating your first two commits, you were in the following situation:</p> <p><a href="https://i.sstatic.net/6sLt1.png" rel="noreferrer"><img src="https://i.sstatic.net/6sLt1.png" alt="enter image descri...
<h1>Problem and solution</h1> <p>Close inspection of the IntelliJ-IDEA log reveals the nature of the problem. After creating your first two commits, you were in the following situation:</p> <p><a href="https://i.sstatic.net/6sLt1.png" rel="noreferrer"><img src="https://i.sstatic.net/6sLt1.png" alt="enter image descri...
119, 8945, 98582
git, git-detached-head, intellij-idea
<h1>How did I end up with a detached HEAD?</h1> <p>I checked out a commit/branch from master, and then checked out back to master and wrote something. After that, I committed it, but I ended up with a detached HEAD. Why?</p> <p>Here is what I did:</p> <ol> <li>Create a new project and create git repository. </li> <li...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,142
git
# How did I end up with a detached HEAD? I checked out a commit/branch from master, and then checked out back to master and wrote something. After that, I committed it, but I ended up with a detached HEAD. Why? Here is what I did: 1. Create a new project and create git repository. 2. git add 3. git commit 4. type so...
# Problem and solution Close inspection of the IntelliJ-IDEA log reveals the nature of the problem. After creating your first two commits, you were in the following situation: [![enter image description here](https://i.sstatic.net/6sLt1.png)](https://i.sstatic.net/6sLt1.png) Somehow, you checked out your first commi...
26385447
Git says "not under version control" for just-checked-out file
14
2014-10-15 14:45:24
<p>I have the distinct impression my Git repo is somehow mangled.</p> <p>Here's the sequence I'm doing:</p> <ol> <li><p>git clone [remote's clone string]</p> <p>This creates, among many others, a file &quot;App/android/AndroidManifest.xml&quot;</p> </li> <li><p>git mv App/android/AndroidManifest.xml App/android/Android...
29,847
3,512,600
2022-06-10 07:20:27
26,385,646
29
2014-10-15 14:55:00
6,309
2014-10-15 17:35:30
https://stackoverflow.com/q/26385447
https://stackoverflow.com/a/26385646
<p>Maybe <code>App/android/AndroidManifest.xml</code> does exist, but with a diferent case (like <code>App/android/androidmanifest.xml</code>, which would mean that <code>App/android/AndroidManifest.xml</code> isn't versioned (hence the error message):</p> <p>Doing the <code>git mv</code> with the right case should th...
<p>Maybe <code>App/android/AndroidManifest.xml</code> does exist, but with a diferent case (like <code>App/android/androidmanifest.xml</code>, which would mean that <code>App/android/AndroidManifest.xml</code> isn't versioned (hence the error message):</p> <p>Doing the <code>git mv</code> with the right case should th...
119
git
<h1>Git says "not under version control" for just-checked-out file</h1> <p>I have the distinct impression my Git repo is somehow mangled.</p> <p>Here's the sequence I'm doing:</p> <ol> <li><p>git clone [remote's clone string]</p> <p>This creates, among many others, a file &quot;App/android/AndroidManifest.xml&quot;</p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,143
git
# Git says "not under version control" for just-checked-out file I have the distinct impression my Git repo is somehow mangled. Here's the sequence I'm doing: 1. git clone [remote's clone string] This creates, among many others, a file "App/android/AndroidManifest.xml" 2. git mv App/android/AndroidManifest.xml A...
Maybe `App/android/AndroidManifest.xml` does exist, but with a diferent case (like `App/android/androidmanifest.xml`, which would mean that `App/android/AndroidManifest.xml` isn't versioned (hence the error message): Doing the `git mv` with the right case should then be enough. The [OP](https://stackoverflow.com/user...
19363795
git rm * doesn't remove all files in one go
14
2013-10-14 15:31:20
<p>I was trying out some sample instructions of git and came across this peculiar case that when we do a <code>git rm *</code>, it doesn't delete the <code>.*</code> files in the first attempt. Why is it so?</p> <pre><code>mkdir -p test_repo1/folder &amp;&amp; cd test_repo1 touch .testfile1 .testfile2 testfile3 folder...
40,194
1,860,929
2022-06-08 20:38:47
19,363,922
29
2013-10-14 15:37:55
874,188
2017-01-21 12:38:56
https://stackoverflow.com/q/19363795
https://stackoverflow.com/a/19363922
<p>The wildcard gets expanded by your shell, and the expansion does not include dot files, by default, in most shells.</p> <p>So by the time <code>git</code> executes, the first command has become</p> <pre><code>git rm -r folder testfile3 </code></pre> <p>and the second probably a literal</p> <pre><code>git rm -r *...
<p>The wildcard gets expanded by your shell, and the expansion does not include dot files, by default, in most shells.</p> <p>So by the time <code>git</code> executes, the first command has become</p> <pre><code>git rm -r folder testfile3 </code></pre> <p>and the second probably a literal</p> <pre><code>git rm -r *...
119
git
<h1>git rm * doesn't remove all files in one go</h1> <p>I was trying out some sample instructions of git and came across this peculiar case that when we do a <code>git rm *</code>, it doesn't delete the <code>.*</code> files in the first attempt. Why is it so?</p> <pre><code>mkdir -p test_repo1/folder &amp;&amp; cd te...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,144
git
# git rm * doesn't remove all files in one go I was trying out some sample instructions of git and came across this peculiar case that when we do a `git rm *`, it doesn't delete the `.*` files in the first attempt. Why is it so? ``` mkdir -p test_repo1/folder && cd test_repo1 touch .testfile1 .testfile2 testfile3 fol...
The wildcard gets expanded by your shell, and the expansion does not include dot files, by default, in most shells. So by the time `git` executes, the first command has become ``` git rm -r folder testfile3 ``` and the second probably a literal ``` git rm -r * ``` which `git` then expands by itself. As [remarked ...
11405619
Can I update a single source file on Heroku without recompiling the slug?
14
2012-07-10 01:55:20
<p>I'm working on a rails project that's being hosted on Heroku. I'm wondering if it's possible to update one file, without restarting the app.</p> <p>Why. I have a bug, but I can't track it down. It works perfectly on my local system, but it seems to stop mid way through processing on heroku. </p> <p>As there are...
14,272
31,325
2012-07-10 08:31:53
11,408,848
29
2012-07-10 07:51:08
93,252
2012-07-10 07:51:08
https://stackoverflow.com/q/11405619
https://stackoverflow.com/a/11408848
<p>There's a good reason as to why it's not possible. When you push to Heroku, they produce a 'slug' of your application (<a href="https://devcenter.heroku.com/articles/slug-compiler">https://devcenter.heroku.com/articles/slug-compiler</a>). To provide the massive scalability that Heroku provides this slug is read only...
<p>There's a good reason as to why it's not possible. When you push to Heroku, they produce a 'slug' of your application (<a href="https://devcenter.heroku.com/articles/slug-compiler">https://devcenter.heroku.com/articles/slug-compiler</a>). To provide the massive scalability that Heroku provides this slug is read only...
119, 4984, 8279
git, heroku, ruby-on-rails
<h1>Can I update a single source file on Heroku without recompiling the slug?</h1> <p>I'm working on a rails project that's being hosted on Heroku. I'm wondering if it's possible to update one file, without restarting the app.</p> <p>Why. I have a bug, but I can't track it down. It works perfectly on my local syste...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,145
git
# Can I update a single source file on Heroku without recompiling the slug? I'm working on a rails project that's being hosted on Heroku. I'm wondering if it's possible to update one file, without restarting the app. Why. I have a bug, but I can't track it down. It works perfectly on my local system, but it seems to ...
There's a good reason as to why it's not possible. When you push to Heroku, they produce a 'slug' of your application (<https://devcenter.heroku.com/articles/slug-compiler>). To provide the massive scalability that Heroku provides this slug is read only so that it can be spun up on multiple dynos which are likely to be...
3919812
gitignore and how to ignore a common directory name and its contents
14
2010-10-12 23:24:37
<p>I've been pulling out my hair researching the net and various docs about .gitignore files. I'm a bit of a n00b with Unix/Terminal (using Mac OS X) and I can't for the life of me figure out how to ignore a folder's contents (any kind of content, be it a file or another folder, no matter how deep it is).</p> <p>I'm w...
15,824
1,421,162
2011-11-18 00:44:18
3,920,643
29
2010-10-13 03:50:10
1,421,162
2010-10-13 03:50:10
https://stackoverflow.com/q/3919812
https://stackoverflow.com/a/3920643
<p>Thanks to the previous posters for their help. After some further delving in, I discovered how to properly implement the new <code>.gitignore</code> rules. The problem was that previously the images were being tracked so I had to remove the reference to the files within the <code>.git/index</code> file, like so...</...
<p>Thanks to the previous posters for their help. After some further delving in, I discovered how to properly implement the new <code>.gitignore</code> rules. The problem was that previously the images were being tracked so I had to remove the reference to the files within the <code>.git/index</code> file, like so...</...
119, 25056
git, gitignore
<h1>gitignore and how to ignore a common directory name and its contents</h1> <p>I've been pulling out my hair researching the net and various docs about .gitignore files. I'm a bit of a n00b with Unix/Terminal (using Mac OS X) and I can't for the life of me figure out how to ignore a folder's contents (any kind of con...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,146
git
# gitignore and how to ignore a common directory name and its contents I've been pulling out my hair researching the net and various docs about .gitignore files. I'm a bit of a n00b with Unix/Terminal (using Mac OS X) and I can't for the life of me figure out how to ignore a folder's contents (any kind of content, be ...
Thanks to the previous posters for their help. After some further delving in, I discovered how to properly implement the new `.gitignore` rules. The problem was that previously the images were being tracked so I had to remove the reference to the files within the `.git/index` file, like so... ``` // Remove all tracked...
64397278
Understanding git rev-list
13
2020-10-16 22:37:55
<p>While looking for git hook examples, I came across following post: <a href="https://github.com/Movidone/git-hooks/blob/master/pre-receive" rel="noreferrer">https://github.com/Movidone/git-hooks/blob/master/pre-receive</a> and I wanted to understand the following command:</p> <pre><code>git rev-list $new_list --not -...
31,558
1,030,542
2023-10-05 09:39:27
64,402,911
29
2020-10-17 13:18:35
1,256,452
2020-10-17 13:18:35
https://stackoverflow.com/q/64397278
https://stackoverflow.com/a/64402911
<p>The <code>git rev-list</code> command is a <em>very</em> complicated, <em>very central</em> command in Git, as what it does is <em>walk the graph</em>. The word <em>graph</em> here refers to both the commit graph itself, and in some cases, the next level down (Git objects <em>reachable from</em> commits).</p> <bloc...
<p>The <code>git rev-list</code> command is a <em>very</em> complicated, <em>very central</em> command in Git, as what it does is <em>walk the graph</em>. The word <em>graph</em> here refers to both the commit graph itself, and in some cases, the next level down (Git objects <em>reachable from</em> commits).</p> <bloc...
119, 85577
git, git-rev-list
<h1>Understanding git rev-list</h1> <p>While looking for git hook examples, I came across following post: <a href="https://github.com/Movidone/git-hooks/blob/master/pre-receive" rel="noreferrer">https://github.com/Movidone/git-hooks/blob/master/pre-receive</a> and I wanted to understand the following command:</p> <pre>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,147
git
# Understanding git rev-list While looking for git hook examples, I came across following post: <https://github.com/Movidone/git-hooks/blob/master/pre-receive> and I wanted to understand the following command: ``` git rev-list $new_list --not --all ``` where new_list is obtained from: ``` NULL_SHA1="000000000000000...
The `git rev-list` command is a *very* complicated, *very central* command in Git, as what it does is *walk the graph*. The word *graph* here refers to both the commit graph itself, and in some cases, the next level down (Git objects *reachable from* commits). > I figured that rev-list shows commits in reverse chronol...
49665976
Why can't a branch name contain the 'hash' (#) char at the begining?
13
2018-04-05 06:58:17
<p>This one </p> <pre><code>git checkout -b #1-my-awesome-feature </code></pre> <p>creates error</p> <pre><code>error: switch `b' requires a value </code></pre> <p>escaping it with backslash or wrapping it in quotes will work</p> <pre><code>git checkout -b \#1-my-awesome-feature </code></pre> <p>but strange enoug...
8,152
3,048,999
2019-01-20 12:43:04
49,666,528
29
2018-04-05 07:27:30
3,276,830
2019-01-20 12:43:04
https://stackoverflow.com/q/49665976
https://stackoverflow.com/a/49666528
<p><code>#</code> means a comment is starting (atleast in a linux shell). So</p> <pre><code>git checkout -b #1-my-awesome-feature </code></pre> <p>becomes:</p> <pre><code>git checkout -b </code></pre> <p>and throws error that <code>b</code> option requires a value.</p> <p>As shown <a href="https://unix.stackexchan...
<p><code>#</code> means a comment is starting (atleast in a linux shell). So</p> <pre><code>git checkout -b #1-my-awesome-feature </code></pre> <p>becomes:</p> <pre><code>git checkout -b </code></pre> <p>and throws error that <code>b</code> option requires a value.</p> <p>As shown <a href="https://unix.stackexchan...
119, 758, 7028, 37230, 76220
git, git-branch, git-checkout, naming-conventions, workflow
<h1>Why can't a branch name contain the 'hash' (#) char at the begining?</h1> <p>This one </p> <pre><code>git checkout -b #1-my-awesome-feature </code></pre> <p>creates error</p> <pre><code>error: switch `b' requires a value </code></pre> <p>escaping it with backslash or wrapping it in quotes will work</p> <pre><c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,148
git
# Why can't a branch name contain the 'hash' (#) char at the begining? This one ``` git checkout -b #1-my-awesome-feature ``` creates error ``` error: switch `b' requires a value ``` escaping it with backslash or wrapping it in quotes will work ``` git checkout -b \#1-my-awesome-feature ``` but strange enough th...
`#` means a comment is starting (atleast in a linux shell). So ``` git checkout -b #1-my-awesome-feature ``` becomes: ``` git checkout -b ``` and throws error that `b` option requires a value. As shown [here](https://unix.stackexchange.com/a/190139/232167), you can solve this by escaping the `#` with a `\` or by p...
53419660
how to add credentials from the command line using 'git credential-osxkeychain store'?
12
2018-11-21 20:00:01
<p>When executing 'git credential-osxkeychain' in MacOS, it shows the option 'store' and I guess it can be used to add the credentials.</p> <p>I didn't find any documentation about the syntax required to add credentials using the command 'git credential-osxkeychain store', anyone knows how to do it?</p> <p>Please not...
10,258
2,364,438
2018-11-21 21:33:43
53,420,770
29
2018-11-21 21:33:43
7,976,758
2018-11-21 21:33:43
https://stackoverflow.com/q/53419660
https://stackoverflow.com/a/53420770
<p><code>git credential-osxkeychain store</code> <a href="https://github.com/git/git/blob/7f4e64169352e03476b0ea64e7e2973669e491a2/contrib/credential/osxkeychain/git-credential-osxkeychain.c#L113" rel="noreferrer">reads protocol/host/username/password</a> from stdin separated by newlines, so feed them something like th...
<p><code>git credential-osxkeychain store</code> <a href="https://github.com/git/git/blob/7f4e64169352e03476b0ea64e7e2973669e491a2/contrib/credential/osxkeychain/git-credential-osxkeychain.c#L113" rel="noreferrer">reads protocol/host/username/password</a> from stdin separated by newlines, so feed them something like th...
119, 369
git, macos
<h1>how to add credentials from the command line using 'git credential-osxkeychain store'?</h1> <p>When executing 'git credential-osxkeychain' in MacOS, it shows the option 'store' and I guess it can be used to add the credentials.</p> <p>I didn't find any documentation about the syntax required to add credentials usi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,151
git
# how to add credentials from the command line using 'git credential-osxkeychain store'? When executing 'git credential-osxkeychain' in MacOS, it shows the option 'store' and I guess it can be used to add the credentials. I didn't find any documentation about the syntax required to add credentials using the command '...
`git credential-osxkeychain store` [reads protocol/host/username/password](https://github.com/git/git/blob/7f4e64169352e03476b0ea64e7e2973669e491a2/contrib/credential/osxkeychain/git-credential-osxkeychain.c#L113) from stdin separated by newlines, so feed them something like this: ``` echo "\ protocol=https host=githu...
48421697
Get name of branch into code
12
2018-01-24 11:43:10
<p>I have a question about passing the branch name to my code as a string.</p> <p>So we are using a git repository and the branch number also refers to the staging environment where the build is placed. Meaning, if my branch is 001, my url is 001.test.myapplication.com.</p> <p>I am writing automated tests which are e...
9,491
6,060,224
2022-10-27 10:56:38
48,458,952
29
2018-01-26 09:49:59
6,060,224
2022-10-27 10:56:38
https://stackoverflow.com/q/48421697
https://stackoverflow.com/a/48458952
<p>I actually found a great solution which perfectly works. Sharing so in the future, others can use it too if they need to.</p> <pre class="lang-cs prettyprint-override"><code>ProcessStartInfo startInfo = new ProcessStartInfo(&quot;git.exe&quot;); startInfo.UseShellExecute = false; startInfo.WorkingDirectory = &quot;...
<p>I actually found a great solution which perfectly works. Sharing so in the future, others can use it too if they need to.</p> <pre class="lang-cs prettyprint-override"><code>ProcessStartInfo startInfo = new ProcessStartInfo(&quot;git.exe&quot;); startInfo.UseShellExecute = false; startInfo.WorkingDirectory = &quot;...
9, 119, 33953
c#, git, visual-studio
<h1>Get name of branch into code</h1> <p>I have a question about passing the branch name to my code as a string.</p> <p>So we are using a git repository and the branch number also refers to the staging environment where the build is placed. Meaning, if my branch is 001, my url is 001.test.myapplication.com.</p> <p>I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,152
git
# Get name of branch into code I have a question about passing the branch name to my code as a string. So we are using a git repository and the branch number also refers to the staging environment where the build is placed. Meaning, if my branch is 001, my url is 001.test.myapplication.com. I am writing automated te...
I actually found a great solution which perfectly works. Sharing so in the future, others can use it too if they need to. ``` ProcessStartInfo startInfo = new ProcessStartInfo("git.exe"); startInfo.UseShellExecute = false; startInfo.WorkingDirectory = "dir Here"; startInfo.RedirectStandardInput = true; startInfo.Redi...
25205845
EGit: cannot push, cannot pull
12
2014-08-08 14:30:02
<p>I'am using EGit and I commited a change to my local git repository.</p> <p>I'd like to push this change to a remote. When doing that, a dialog screen pops up which shows <a href="https://stackoverflow.com/questions/11696295/rejected-master-master-non-fast-forward">"rejected-master-master-non-fast-forward"</a>. The ...
16,204
324,152
2017-02-02 09:50:23
25,264,682
29
2014-08-12 12:46:27
305,973
2014-08-19 11:36:31
https://stackoverflow.com/q/25205845
https://stackoverflow.com/a/25264682
<p>The configuration of the repository seems to miss this line in the <code>[remote "origin"]</code> section:</p> <p><code>fetch = +refs/heads/*:refs/remotes/origin/*</code></p> <p>It tells git to fetch all refs starting with <code>refs/heads/</code> (all branches) and store them under <code>refs/remotes/origin/</cod...
<p>The configuration of the repository seems to miss this line in the <code>[remote "origin"]</code> section:</p> <p><code>fetch = +refs/heads/*:refs/remotes/origin/*</code></p> <p>It tells git to fetch all refs starting with <code>refs/heads/</code> (all branches) and store them under <code>refs/remotes/origin/</cod...
53, 119, 43702
eclipse, egit, git
<h1>EGit: cannot push, cannot pull</h1> <p>I'am using EGit and I commited a change to my local git repository.</p> <p>I'd like to push this change to a remote. When doing that, a dialog screen pops up which shows <a href="https://stackoverflow.com/questions/11696295/rejected-master-master-non-fast-forward">"rejected-m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,153
git
# EGit: cannot push, cannot pull I'am using EGit and I commited a change to my local git repository. I'd like to push this change to a remote. When doing that, a dialog screen pops up which shows ["rejected-master-master-non-fast-forward"](https://stackoverflow.com/questions/11696295/rejected-master-master-non-fast-f...
The configuration of the repository seems to miss this line in the `[remote "origin"]` section: `fetch = +refs/heads/*:refs/remotes/origin/*` It tells git to fetch all refs starting with `refs/heads/` (all branches) and store them under `refs/remotes/origin/` locally. E.g. the `refs/heads/master` in the remote reposi...
26297701
How can I let Git push/pull through Windows 7 Firewall?
11
2014-10-10 10:49:43
<p>My firewall is configured to deny all inbound and outbound traffic unless a rule says otherwise.</p> <p><img src="https://i.sstatic.net/AvCav.png" alt="Firewall Profile Screenshot"></p> <p><a href="https://stackoverflow.com/questions/23965340/windows-firewall-tinywall-and-git">This answer</a> suggests making rules...
8,529
1,609,607
2023-06-02 07:01:27
26,297,702
29
2014-10-10 10:49:43
1,609,607
2017-03-05 07:12:53
https://stackoverflow.com/q/26297701
https://stackoverflow.com/a/26297702
<p>I needed to add a rule for <code>git-remote-https.exe</code> because I'm authenticating via HTTPS, not SSH.</p> <p>On new versions of git, this is located at: <code>C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe</code>.</p> <p>Edit: In fact I disabled the rules for <code>git.exe</code>, <code>s...
<p>I needed to add a rule for <code>git-remote-https.exe</code> because I'm authenticating via HTTPS, not SSH.</p> <p>On new versions of git, this is located at: <code>C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe</code>.</p> <p>Edit: In fact I disabled the rules for <code>git.exe</code>, <code>s...
119, 2045, 8204, 34595
firewall, git, windows-7, windows-firewall
<h1>How can I let Git push/pull through Windows 7 Firewall?</h1> <p>My firewall is configured to deny all inbound and outbound traffic unless a rule says otherwise.</p> <p><img src="https://i.sstatic.net/AvCav.png" alt="Firewall Profile Screenshot"></p> <p><a href="https://stackoverflow.com/questions/23965340/windows...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,155
git
# How can I let Git push/pull through Windows 7 Firewall? My firewall is configured to deny all inbound and outbound traffic unless a rule says otherwise. ![Firewall Profile Screenshot](https://i.sstatic.net/AvCav.png) [This answer](https://stackoverflow.com/questions/23965340/windows-firewall-tinywall-and-git) sugg...
I needed to add a rule for `git-remote-https.exe` because I'm authenticating via HTTPS, not SSH. On new versions of git, this is located at: `C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe`. Edit: In fact I disabled the rules for `git.exe`, `sh.exe`, `ssh.exe`, and `bash.exe`, and still everything...
8916795
Git: new branch not getting pushed
11
2012-01-18 20:15:57
<p>I created a branch, say "dev" which was based off say branch "Base" and then merged it with Upstream content (I want to keep Base clean till I am done with my testing). After resolving conflicts, I ran the command git commit -a -m "comment" and it went through. Next, I ran git push, hoping the new branch would be cr...
14,434
927,370
2012-01-18 20:34:13
8,916,997
29
2012-01-18 20:34:13
619,527
2012-01-18 20:34:13
https://stackoverflow.com/q/8916795
https://stackoverflow.com/a/8916997
<p>See if you have created the branch on the remote repo:</p> <pre><code>$ git branch -av </code></pre> <p>You probably haven't. You can create the branch by explicitly stating you want to push it:</p> <pre><code>$ git push origin dev </code></pre> <p>By default git pushes all branches that have a respective branch...
<p>See if you have created the branch on the remote repo:</p> <pre><code>$ git branch -av </code></pre> <p>You probably haven't. You can create the branch by explicitly stating you want to push it:</p> <pre><code>$ git push origin dev </code></pre> <p>By default git pushes all branches that have a respective branch...
119
git
<h1>Git: new branch not getting pushed</h1> <p>I created a branch, say "dev" which was based off say branch "Base" and then merged it with Upstream content (I want to keep Base clean till I am done with my testing). After resolving conflicts, I ran the command git commit -a -m "comment" and it went through. Next, I ran...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,156
git
# Git: new branch not getting pushed I created a branch, say "dev" which was based off say branch "Base" and then merged it with Upstream content (I want to keep Base clean till I am done with my testing). After resolving conflicts, I ran the command git commit -a -m "comment" and it went through. Next, I ran git push...
See if you have created the branch on the remote repo: ``` $ git branch -av ``` You probably haven't. You can create the branch by explicitly stating you want to push it: ``` $ git push origin dev ``` By default git pushes all branches that have a respective branch on the remote (new branches don't).
55731891
Effects of git remote update origin --prune on local changes
10
2019-04-17 16:08:29
<p><strong>Please note</strong>: I first took a look at <a href="https://stackoverflow.com/questions/20106712/what-are-the-differences-between-git-remote-prune-git-prune-git-fetch-prune">this question</a> hoping it would answer my question, but I think mine is <em>slightly</em> different!</p> <hr> <p>I was told that ...
20,123
5,235,665
2019-04-17 19:08:57
55,734,447
29
2019-04-17 19:08:57
1,256,452
2019-04-17 19:08:57
https://stackoverflow.com/q/55731891
https://stackoverflow.com/a/55734447
<h3>TL;DR</h3> <p>The <code>git remote update <em>remote</em></code> command is <em>the same</em> as the <code>git fetch <em>remote</em></code> command. (There were some bugs in some versions of Git that made them different, but they are supposed to do the same thing.) With <code>--prune</code>, the update process s...
<h3>TL;DR</h3> <p>The <code>git remote update <em>remote</em></code> command is <em>the same</em> as the <code>git fetch <em>remote</em></code> command. (There were some bugs in some versions of Git that made them different, but they are supposed to do the same thing.) With <code>--prune</code>, the update process s...
119
git
<h1>Effects of git remote update origin --prune on local changes</h1> <p><strong>Please note</strong>: I first took a look at <a href="https://stackoverflow.com/questions/20106712/what-are-the-differences-between-git-remote-prune-git-prune-git-fetch-prune">this question</a> hoping it would answer my question, but I thi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,157
git
# Effects of git remote update origin --prune on local changes **Please note**: I first took a look at [this question](https://stackoverflow.com/questions/20106712/what-are-the-differences-between-git-remote-prune-git-prune-git-fetch-prune) hoping it would answer my question, but I think mine is *slightly* different! ...
### TL;DR The `git remote update remote` command is *the same* as the `git fetch remote` command. (There were some bugs in some versions of Git that made them different, but they are supposed to do the same thing.) With `--prune`, the update process simply *removes* any remote-tracking names that exist in your reposit...
23301107
How can i include only specific folders in git using .gitignore?
9
2014-04-25 19:06:32
<p>So i would like ignore everything except a file and a specific folder:</p> <pre><code>rben@ubuntu:~/sites$ ls development-box puppet sites Vagrantfile www-cms www-common www-mmfa rben@ubuntu:~/sites$ cat .gitignore * !Vagrantfile !puppet/ rben@ubuntu:~/sites$ git status # On branch master # # Initial commit #...
9,346
97,893
2014-04-25 19:46:09
23,301,552
29
2014-04-25 19:36:01
1,171,460
2014-04-25 19:46:09
https://stackoverflow.com/q/23301107
https://stackoverflow.com/a/23301552
<p>ok nice, try the following gitignore file:</p> <pre><code># Ignore everything in repository root /* # Files to not ignore !/.gitignore !/some_other_files # Folder to not ignore !/puppet/ </code></pre> <p>The key point is the slash before the <code>*</code>. </p> <p>In your case the <code>*</code> affected also...
<p>ok nice, try the following gitignore file:</p> <pre><code># Ignore everything in repository root /* # Files to not ignore !/.gitignore !/some_other_files # Folder to not ignore !/puppet/ </code></pre> <p>The key point is the slash before the <code>*</code>. </p> <p>In your case the <code>*</code> affected also...
119, 25056, 76220
git, git-branch, gitignore
<h1>How can i include only specific folders in git using .gitignore?</h1> <p>So i would like ignore everything except a file and a specific folder:</p> <pre><code>rben@ubuntu:~/sites$ ls development-box puppet sites Vagrantfile www-cms www-common www-mmfa rben@ubuntu:~/sites$ cat .gitignore * !Vagrantfile !puppe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,162
git
# How can i include only specific folders in git using .gitignore? So i would like ignore everything except a file and a specific folder: ``` rben@ubuntu:~/sites$ ls development-box puppet sites Vagrantfile www-cms www-common www-mmfa rben@ubuntu:~/sites$ cat .gitignore * !Vagrantfile !puppet/ rben@ubuntu:~/sit...
ok nice, try the following gitignore file: ``` # Ignore everything in repository root /* # Files to not ignore !/.gitignore !/some_other_files # Folder to not ignore !/puppet/ ``` The key point is the slash before the `*`. In your case the `*` affected also to the files in `puppet`. So to be on the safe side use...
15794378
Git - Missing tags after pull
9
2013-04-03 17:46:15
<p>It is NOT a duplicate of (almost;because stackoverflow wouldn't allow that)exact title<br> <a href="https://stackoverflow.com/questions/8350567/git-pull-everything-up-to-date-but-its-not">Git Pull - Everything up to date, but it&#39;s not</a> </p> <p>I'm missing two tags (Linux kernel v3.9-rc4 and v3.9-rc5 specifi...
10,703
179,795
2017-10-13 11:50:35
15,794,719
29
2013-04-03 18:05:28
77,939
2013-04-03 18:05:28
https://stackoverflow.com/q/15794378
https://stackoverflow.com/a/15794719
<p>I think you want <code>git fetch --tags</code>. From the <code>git-fetch</code> manual page:</p> <pre><code> -t, --tags Most of the tags are fetched automatically as branch heads are downloaded, but tags that do not point at objects reachable from the branch heads that are being tracked will ...
<p>I think you want <code>git fetch --tags</code>. From the <code>git-fetch</code> manual page:</p> <pre><code> -t, --tags Most of the tags are fetched automatically as branch heads are downloaded, but tags that do not point at objects reachable from the branch heads that are being tracked will ...
119
git
<h1>Git - Missing tags after pull</h1> <p>It is NOT a duplicate of (almost;because stackoverflow wouldn't allow that)exact title<br> <a href="https://stackoverflow.com/questions/8350567/git-pull-everything-up-to-date-but-its-not">Git Pull - Everything up to date, but it&#39;s not</a> </p> <p>I'm missing two tags (Lin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,163
git
# Git - Missing tags after pull It is NOT a duplicate of (almost;because stackoverflow wouldn't allow that)exact title [Git Pull - Everything up to date, but it's not](https://stackoverflow.com/questions/8350567/git-pull-everything-up-to-date-but-its-not) I'm missing two tags (Linux kernel v3.9-rc4 and v3.9-rc5 spe...
I think you want `git fetch --tags`. From the `git-fetch` manual page: ``` -t, --tags Most of the tags are fetched automatically as branch heads are downloaded, but tags that do not point at objects reachable from the branch heads that are being tracked will not be fetched by this mechan...
49283734
Why isn't my tag listed when I checkout with Git GUI?
7
2018-03-14 17:05:13
<p>I have a local Git repository with three annotated tags: <code>v0.1.0</code>, <code>v0.1.1</code>, and <code>v0.1.2</code>.</p> <p>When I view my project's history with <code>gitk</code> (<em>Repository → Visualize master's history</em>), I can see each tag assigned to the proper commit.</p> <p><a href="https://i.ss...
5,168
3,357,935
2022-09-03 17:11:38
49,286,861
29
2018-03-14 20:11:18
211,627
2022-09-03 17:11:38
https://stackoverflow.com/q/49283734
https://stackoverflow.com/a/49286861
<p>Tags can <a href="https://git-scm.com/docs/git-tag#git-tag-ltobjectgt" rel="nofollow noreferrer">point to any object</a> in the git repository. If your tag type is &quot;tag&quot;, then you have a tag pointing to another tag.</p> <p><strong>Lightweight tags <em>are not</em> objects</strong>; thus, they have no hash ...
<p>Tags can <a href="https://git-scm.com/docs/git-tag#git-tag-ltobjectgt" rel="nofollow noreferrer">point to any object</a> in the git repository. If your tag type is &quot;tag&quot;, then you have a tag pointing to another tag.</p> <p><strong>Lightweight tags <em>are not</em> objects</strong>; thus, they have no hash ...
119, 33729, 60718
git, git-gui, git-tag
<h1>Why isn't my tag listed when I checkout with Git GUI?</h1> <p>I have a local Git repository with three annotated tags: <code>v0.1.0</code>, <code>v0.1.1</code>, and <code>v0.1.2</code>.</p> <p>When I view my project's history with <code>gitk</code> (<em>Repository → Visualize master's history</em>), I can see each ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,165
git
# Why isn't my tag listed when I checkout with Git GUI? I have a local Git repository with three annotated tags: `v0.1.0`, `v0.1.1`, and `v0.1.2`. When I view my project's history with `gitk` (*Repository → Visualize master's history*), I can see each tag assigned to the proper commit. [![Project history in gitk](ht...
Tags can [point to any object](https://git-scm.com/docs/git-tag#git-tag-ltobjectgt) in the git repository. If your tag type is "tag", then you have a tag pointing to another tag. **Lightweight tags *are not* objects**; thus, they have no hash ID of their own and nothing else (like another tag) can point to them. They ...
8943693
Can git operate in "silent mode"?
160
2012-01-20 15:23:39
<p>Is it possible to execute any git command in "silent" mode? For instance, can i say "<code>git push origin</code>" and see nothing displayed on the screen?</p> <p>I suppose i can redirect IO to <code>/dev/null</code> (works fine), but .. does git allow something like this naturally?</p> <p>Below is a quick script ...
117,834
359,862
2016-05-23 22:05:04
8,944,284
28
2012-01-20 16:05:00
85,134
2012-01-20 16:05:00
https://stackoverflow.com/q/8943693
https://stackoverflow.com/a/8944284
<p>Redirecting output to /dev/null seems like a natural way of doing it to me. Although I have in the past defined a quiet_git shell function like this for use in cron jobs:</p> <pre><code>quiet_git() { stdout=$(tempfile) stderr=$(tempfile) if ! git "$@" &lt;/dev/null &gt;$stdout 2&gt;$stderr; then ...
<p>Redirecting output to /dev/null seems like a natural way of doing it to me. Although I have in the past defined a quiet_git shell function like this for use in cron jobs:</p> <pre><code>quiet_git() { stdout=$(tempfile) stderr=$(tempfile) if ! git "$@" &lt;/dev/null &gt;$stdout 2&gt;$stderr; then ...
119
git
<h1>Can git operate in "silent mode"?</h1> <p>Is it possible to execute any git command in "silent" mode? For instance, can i say "<code>git push origin</code>" and see nothing displayed on the screen?</p> <p>I suppose i can redirect IO to <code>/dev/null</code> (works fine), but .. does git allow something like this ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,166
git
# Can git operate in "silent mode"? Is it possible to execute any git command in "silent" mode? For instance, can i say "`git push origin`" and see nothing displayed on the screen? I suppose i can redirect IO to `/dev/null` (works fine), but .. does git allow something like this naturally? Below is a quick script th...
Redirecting output to /dev/null seems like a natural way of doing it to me. Although I have in the past defined a quiet_git shell function like this for use in cron jobs: ``` quiet_git() { stdout=$(tempfile) stderr=$(tempfile) if ! git "$@" </dev/null >$stdout 2>$stderr; then cat $stderr >&2 ...
8981472
Ignore all files with the same name in git
83
2012-01-24 02:52:39
<p>Is there a way to have a <code>git ignore file</code> to ignore all files with the name test in them?</p> <p>I have files like this:</p> <pre><code> - css/test.css - js/subfolder/test.js - lib/main/sub/test.html </code></pre> <p>and so on.</p> <p>I want <code>git</code> to avoid adding or committing any file...
82,538
603,840
2017-12-20 21:24:42
8,981,522
28
2012-01-24 03:03:34
359,862
2012-01-24 03:03:34
https://stackoverflow.com/q/8981472
https://stackoverflow.com/a/8981522
<p>Update <code>.gitignore</code> with <code>test*</code></p> <p>Also, read <a href="http://gitready.com/beginner/2009/01/19/ignoring-files.html" rel="noreferrer">this</a> for more information.</p>
<p>Update <code>.gitignore</code> with <code>test*</code></p> <p>Also, read <a href="http://gitready.com/beginner/2009/01/19/ignoring-files.html" rel="noreferrer">this</a> for more information.</p>
119, 25056
git, gitignore
<h1>Ignore all files with the same name in git</h1> <p>Is there a way to have a <code>git ignore file</code> to ignore all files with the name test in them?</p> <p>I have files like this:</p> <pre><code> - css/test.css - js/subfolder/test.js - lib/main/sub/test.html </code></pre> <p>and so on.</p> <p>I want <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,167
git
# Ignore all files with the same name in git Is there a way to have a `git ignore file` to ignore all files with the name test in them? I have files like this: ``` - css/test.css - js/subfolder/test.js - lib/main/sub/test.html ``` and so on. I want `git` to avoid adding or committing any files with the name t...
Update `.gitignore` with `test*` Also, read [this](http://gitready.com/beginner/2009/01/19/ignoring-files.html) for more information.
19102714
How would I write a pre-merge hook in Git?
64
2013-09-30 19:59:01
<p>The question says it all. Is there a way to perform an action before a merge? I'm guessing there's a way to make use of a <code>pre-commit</code> hook, but I'm not quite sure.</p>
51,359
1,134,864
2024-01-27 11:50:48
19,460,322
28
2013-10-18 23:01:46
277,613
2018-02-19 08:37:01
https://stackoverflow.com/q/19102714
https://stackoverflow.com/a/19460322
<p>You can try using the <code>prepare-commit-msg</code> hook. The second argument will be <code>merge</code> "if the commit is a merge or a <code>.git/MERGE_MSG</code> file exists". A non-zero exit status will abort the commit.</p> <p>I don't think this will work with a fast-forward merge, since there won't be a comm...
<p>You can try using the <code>prepare-commit-msg</code> hook. The second argument will be <code>merge</code> "if the commit is a merge or a <code>.git/MERGE_MSG</code> file exists". A non-zero exit status will abort the commit.</p> <p>I don't think this will work with a fast-forward merge, since there won't be a comm...
119, 717, 43087
git, githooks, merge
<h1>How would I write a pre-merge hook in Git?</h1> <p>The question says it all. Is there a way to perform an action before a merge? I'm guessing there's a way to make use of a <code>pre-commit</code> hook, but I'm not quite sure.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,168
git
# How would I write a pre-merge hook in Git? The question says it all. Is there a way to perform an action before a merge? I'm guessing there's a way to make use of a `pre-commit` hook, but I'm not quite sure.
You can try using the `prepare-commit-msg` hook. The second argument will be `merge` "if the commit is a merge or a `.git/MERGE_MSG` file exists". A non-zero exit status will abort the commit. I don't think this will work with a fast-forward merge, since there won't be a commit message. More info on hooks: <https://w...
4243174
Should server/database config files, including passwords, be stored in source control?
53
2010-11-22 07:22:50
<p>I'm looking to hear some best practices...</p> <p>Assuming a web application that interacts with a few different production servers (databases, etc.)... should the configuration files that include database passwords be stored in source control (e.g., git, svn)?</p> <p>If not, what's the best way to keep track of s...
12,735
137,067
2014-06-03 08:40:15
4,319,411
28
2010-11-30 22:34:22
487,064
2010-11-30 22:34:22
https://stackoverflow.com/q/4243174
https://stackoverflow.com/a/4319411
<p>There's no single "silver bullet" answer here and it would all greatly depend on details.</p> <p>First of all, I consider best practice to separate all source code from configuration in separate repository. So, source code remains source code, but it's installation or deployment (with configuration, passwords, etc)...
<p>There's no single "silver bullet" answer here and it would all greatly depend on details.</p> <p>First of all, I consider best practice to separate all source code from configuration in separate repository. So, source code remains source code, but it's installation or deployment (with configuration, passwords, etc)...
63, 119, 220, 456, 3574
config, git, passwords, svn, version-control
<h1>Should server/database config files, including passwords, be stored in source control?</h1> <p>I'm looking to hear some best practices...</p> <p>Assuming a web application that interacts with a few different production servers (databases, etc.)... should the configuration files that include database passwords be s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,169
git
# Should server/database config files, including passwords, be stored in source control? I'm looking to hear some best practices... Assuming a web application that interacts with a few different production servers (databases, etc.)... should the configuration files that include database passwords be stored in source ...
There's no single "silver bullet" answer here and it would all greatly depend on details. First of all, I consider best practice to separate all source code from configuration in separate repository. So, source code remains source code, but it's installation or deployment (with configuration, passwords, etc) is the wh...
9135095
git gc --aggressive push to server?
49
2012-02-03 20:30:08
<p>It seems like <code>git gc --aggressive</code> really cleans up my repo, but when I do <code>git push</code> everything is already up-to-date. Is there a way to clean up the server?</p>
19,681
8,047
2023-03-04 17:21:19
9,138,899
28
2012-02-04 06:24:24
6,309
2023-03-03 13:46:35
https://stackoverflow.com/q/9135095
https://stackoverflow.com/a/9138899
<p>2012: I know that GitHub will run <code>git gc</code> periodically, as the GitHub support mentioned in <del><a href="http://groups.google.com/group/github/browse_thread/thread/8215f1ca7ca18f4a/f9dfeca9eaebbac4?pli=1" rel="noreferrer">this thread</a>.</del></p> <hr /> <p>Since 2012 (up to 2023):</p> <p>I don't know i...
<p>2012: I know that GitHub will run <code>git gc</code> periodically, as the GitHub support mentioned in <del><a href="http://groups.google.com/group/github/browse_thread/thread/8215f1ca7ca18f4a/f9dfeca9eaebbac4?pli=1" rel="noreferrer">this thread</a>.</del></p> <hr /> <p>Since 2012 (up to 2023):</p> <p>I don't know i...
119
git
<h1>git gc --aggressive push to server?</h1> <p>It seems like <code>git gc --aggressive</code> really cleans up my repo, but when I do <code>git push</code> everything is already up-to-date. Is there a way to clean up the server?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,172
git
# git gc --aggressive push to server? It seems like `git gc --aggressive` really cleans up my repo, but when I do `git push` everything is already up-to-date. Is there a way to clean up the server?
2012: I know that GitHub will run `git gc` periodically, as the GitHub support mentioned in ~~[this thread](http://groups.google.com/group/github/browse_thread/thread/8215f1ca7ca18f4a/f9dfeca9eaebbac4?pli=1).~~ --- Since 2012 (up to 2023): I don't know if you can force it yourself, though. I didn't see such a serv...
5316802
Does git log --branches work?
48
2011-03-15 19:19:01
<p>I can't seem to get <code>git log --branches</code> to correctly filter its output. It seems as if Git ignores it.</p> <p>For example, the head of <code>git log --graph --all --decorate</code>, prints:</p> <pre><code>* commit 3ae0d17538f787bdde68f37f6644ffe9652d8dc1 (HEAD, feature/branch-ignore) | Author: Chris Le...
47,549
79,849
2025-12-01 01:37:43
28,334,050
28
2015-02-05 00:17:49
179,332
2015-02-05 00:17:49
https://stackoverflow.com/q/5316802
https://stackoverflow.com/a/28334050
<p>Firstly, (the other) Adam is right that it doesn't make sense to use <code>--all</code> for this: if you only want to see one branch like your question states, why ask for all branches?</p> <p>Secondly, as already stated in comments to other answers, you don't need <code>--branches</code>; just do <code>git log myb...
<p>Firstly, (the other) Adam is right that it doesn't make sense to use <code>--all</code> for this: if you only want to see one branch like your question states, why ask for all branches?</p> <p>Secondly, as already stated in comments to other answers, you don't need <code>--branches</code>; just do <code>git log myb...
119
git
<h1>Does git log --branches work?</h1> <p>I can't seem to get <code>git log --branches</code> to correctly filter its output. It seems as if Git ignores it.</p> <p>For example, the head of <code>git log --graph --all --decorate</code>, prints:</p> <pre><code>* commit 3ae0d17538f787bdde68f37f6644ffe9652d8dc1 (HEAD, fe...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,173
git
# Does git log --branches work? I can't seem to get `git log --branches` to correctly filter its output. It seems as if Git ignores it. For example, the head of `git log --graph --all --decorate`, prints: ``` * commit 3ae0d17538f787bdde68f37f6644ffe9652d8dc1 (HEAD, feature/branch-ignore) | Author: Chris Lewis <chris...
Firstly, (the other) Adam is right that it doesn't make sense to use `--all` for this: if you only want to see one branch like your question states, why ask for all branches? Secondly, as already stated in comments to other answers, you don't need `--branches`; just do `git log mybranch`. Thirdly, I can explain why `...
2590260
When will `git pull --rebase` get me in to trouble?
44
2010-04-07 05:46:24
<p>I understand that when I use <code>git pull --rebase</code>, git will re-write history and move my local commits to occur after all of the commits in the branch I just pulled from. </p> <p>What I don't understand is how this would ever be a bad thing. People talk about getting in to trouble with <code>git pull --...
10,576
30,632
2010-04-08 02:07:18
2,590,276
28
2010-04-07 05:51:43
6,309
2010-04-07 05:51:43
https://stackoverflow.com/q/2590260
https://stackoverflow.com/a/2590276
<p>It is only an issue if you have only published (pushed) some of your commits, because they would be harder to merge to other repos which have already those commits. Since their SHA1 have changed, Git would try to replay them <em>again</em> on those repos.</p> <p>If you have not (pushed any of those commits again), ...
<p>It is only an issue if you have only published (pushed) some of your commits, because they would be harder to merge to other repos which have already those commits. Since their SHA1 have changed, Git would try to replay them <em>again</em> on those repos.</p> <p>If you have not (pushed any of those commits again), ...
119, 4860, 8974
git, pull, rebase
<h1>When will `git pull --rebase` get me in to trouble?</h1> <p>I understand that when I use <code>git pull --rebase</code>, git will re-write history and move my local commits to occur after all of the commits in the branch I just pulled from. </p> <p>What I don't understand is how this would ever be a bad thing. P...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,175
git
# When will `git pull --rebase` get me in to trouble? I understand that when I use `git pull --rebase`, git will re-write history and move my local commits to occur after all of the commits in the branch I just pulled from. What I don't understand is how this would ever be a bad thing. People talk about getting in to...
It is only an issue if you have only published (pushed) some of your commits, because they would be harder to merge to other repos which have already those commits. Since their SHA1 have changed, Git would try to replay them *again* on those repos. If you have not (pushed any of those commits again), any rebase should...
18866837
What happens if I stash changes in a branch and then delete that branch
42
2013-09-18 08:01:47
<p>What happens if I stash changes in a branch and then delete that branch?</p> <p>(1) Do I lose the stashed changes? </p> <p>Example:</p> <pre><code>git stash git checkout other_branch git branch -D previous_branch </code></pre> <p>(2) Also, are the above stash and delete steps equivalent to commiting the changes ...
14,731
1,819,254
2018-02-28 04:35:07
18,867,902
28
2013-09-18 08:59:37
1,256,452
2017-02-18 23:53:32
https://stackoverflow.com/q/18866837
https://stackoverflow.com/a/18867902
<p>(1) No. The changes saved by <code>git stash</code> are saved as a pair (or sometimes trio) of commits. Those commits are referenced by the name <code>stash</code>. If you think of branch names and tags as labels for commits (which is what they <em>are</em>), then you can draw a picture, e.g.:</p> <pre><code> ...
<p>(1) No. The changes saved by <code>git stash</code> are saved as a pair (or sometimes trio) of commits. Those commits are referenced by the name <code>stash</code>. If you think of branch names and tags as labels for commits (which is what they <em>are</em>), then you can draw a picture, e.g.:</p> <pre><code> ...
119, 13091
git, git-stash
<h1>What happens if I stash changes in a branch and then delete that branch</h1> <p>What happens if I stash changes in a branch and then delete that branch?</p> <p>(1) Do I lose the stashed changes? </p> <p>Example:</p> <pre><code>git stash git checkout other_branch git branch -D previous_branch </code></pre> <p>(2...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,176
git
# What happens if I stash changes in a branch and then delete that branch What happens if I stash changes in a branch and then delete that branch? (1) Do I lose the stashed changes? Example: ``` git stash git checkout other_branch git branch -D previous_branch ``` (2) Also, are the above stash and delete steps equ...
(1) No. The changes saved by `git stash` are saved as a pair (or sometimes trio) of commits. Those commits are referenced by the name `stash`. If you think of branch names and tags as labels for commits (which is what they *are*), then you can draw a picture, e.g.: ``` O1 - O2 <-- other_branch ...
14779640
Opposite of git cherry-pick?
41
2013-02-08 19:08:14
<p>Is there an effective opposite of git cherry-pick? For instance some time ago, I had to make some temporary changes to disable a set of features due to a business process not being ready. Now that that business process is ready I'd like to simply remove the commits and their effects. While I could of course just l...
13,786
367,543
2013-02-08 23:30:04
14,779,835
28
2013-02-08 19:20:16
113,586
2013-02-08 19:20:16
https://stackoverflow.com/q/14779640
https://stackoverflow.com/a/14779835
<p>The automated way to undo changes made by another commit is <code>git revert</code>.</p>
<p>The automated way to undo changes made by another commit is <code>git revert</code>.</p>
119
git
<h1>Opposite of git cherry-pick?</h1> <p>Is there an effective opposite of git cherry-pick? For instance some time ago, I had to make some temporary changes to disable a set of features due to a business process not being ready. Now that that business process is ready I'd like to simply remove the commits and their ef...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,177
git
# Opposite of git cherry-pick? Is there an effective opposite of git cherry-pick? For instance some time ago, I had to make some temporary changes to disable a set of features due to a business process not being ready. Now that that business process is ready I'd like to simply remove the commits and their effects. Whi...
The automated way to undo changes made by another commit is `git revert`.
2006351
Gettext .po files under version control
41
2010-01-05 13:46:01
<p>Currently using Gettext on a project and the .po files are nicely kept under version control.</p> <p>PO files of course contain translations, but in addition to that they also contain some metadata - information about the exact files and line numbers where the translatable strings are located.</p> <p>The problem i...
5,204
15,982
2012-07-02 09:27:33
2,021,154
28
2010-01-07 15:04:06
121,332
2010-01-08 14:10:06
https://stackoverflow.com/q/2006351
https://stackoverflow.com/a/2021154
<p>A simple fix would be to apply a grep filter to remove comment metadata from the viewed diff. You can either do this to the <em>output</em> of the version control diff utility:</p> <pre><code>myVersionControl diff REV1 REV2 filea | grep -v '^..#' </code></pre> <p>or you may be able to instruct the version control...
<p>A simple fix would be to apply a grep filter to remove comment metadata from the viewed diff. You can either do this to the <em>output</em> of the version control diff utility:</p> <pre><code>myVersionControl diff REV1 REV2 filea | grep -v '^..#' </code></pre> <p>or you may be able to instruct the version control...
119, 456, 606, 10025, 39829
diff, gettext, git, po-file, version-control
<h1>Gettext .po files under version control</h1> <p>Currently using Gettext on a project and the .po files are nicely kept under version control.</p> <p>PO files of course contain translations, but in addition to that they also contain some metadata - information about the exact files and line numbers where the transl...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,179
git
# Gettext .po files under version control Currently using Gettext on a project and the .po files are nicely kept under version control. PO files of course contain translations, but in addition to that they also contain some metadata - information about the exact files and line numbers where the translatable strings a...
A simple fix would be to apply a grep filter to remove comment metadata from the viewed diff. You can either do this to the *output* of the version control diff utility: ``` myVersionControl diff REV1 REV2 filea | grep -v '^..#' ``` or you may be able to instruct the version control diff utility to ignore these befor...
38391714
Git: Why does rebase result in conflicts while merge does not?
40
2016-07-15 08:44:49
<p>I'm probably not getting something right, but could anyone explain to me why <code>git rebase</code> results in conflicts, while <code>git merge</code> (same branch) does not? </p> <p>For as far as I know <code>git rebase</code> puts the commits from the other branch before the commits I made on my current branch, ...
9,031
2,841,607
2024-12-19 04:51:05
56,930,493
28
2019-07-08 07:49:37
2,841,607
2019-12-03 08:53:28
https://stackoverflow.com/q/38391714
https://stackoverflow.com/a/56930493
<p>I see that sometimes my question is still getting an upvote. Let me explain for those that do not understand the currently chosen answer, because I sure didn't when I read it for the first time.</p> <p>Let's say you have branch <code>master</code> with commits <code>A</code>, <code>B</code> and <code>C</code>.</p> ...
<p>I see that sometimes my question is still getting an upvote. Let me explain for those that do not understand the currently chosen answer, because I sure didn't when I read it for the first time.</p> <p>Let's say you have branch <code>master</code> with commits <code>A</code>, <code>B</code> and <code>C</code>.</p> ...
119, 717, 8974
git, merge, rebase
<h1>Git: Why does rebase result in conflicts while merge does not?</h1> <p>I'm probably not getting something right, but could anyone explain to me why <code>git rebase</code> results in conflicts, while <code>git merge</code> (same branch) does not? </p> <p>For as far as I know <code>git rebase</code> puts the commit...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,180
git
# Git: Why does rebase result in conflicts while merge does not? I'm probably not getting something right, but could anyone explain to me why `git rebase` results in conflicts, while `git merge` (same branch) does not? For as far as I know `git rebase` puts the commits from the other branch before the commits I made ...
I see that sometimes my question is still getting an upvote. Let me explain for those that do not understand the currently chosen answer, because I sure didn't when I read it for the first time. Let's say you have branch `master` with commits `A`, `B` and `C`. Then from commit `C` you create a new branch `mybranch`. ...
29685337
git commit --author doesn't work when global not set
40
2015-04-16 20:28:46
<p>working on a lab machine which has a shared login. don't want to set global git config parameters. </p> <pre><code>git commit --author="username &lt;email&gt;" </code></pre> <p>This used to work on older git versions. now it produces this error:</p> <pre><code>*** Please tell me who you are. Run git config...
115,889
741,808
2025-03-11 11:24:16
29,685,405
28
2015-04-16 20:32:26
2,012,487
2025-03-11 11:24:16
https://stackoverflow.com/q/29685337
https://stackoverflow.com/a/29685405
<p>What if you set the git config info just for the current repository?</p> <pre><code> git config user.email &quot;you@example.com&quot; git config user.name &quot;Your Name&quot; </code></pre> <p>You can also provide this information through <a href="https://git-scm.com/docs/git-commit#_commit_information" rel="no...
<p>What if you set the git config info just for the current repository?</p> <pre><code> git config user.email &quot;you@example.com&quot; git config user.name &quot;Your Name&quot; </code></pre> <p>You can also provide this information through <a href="https://git-scm.com/docs/git-commit#_commit_information" rel="no...
119
git
<h1>git commit --author doesn't work when global not set</h1> <p>working on a lab machine which has a shared login. don't want to set global git config parameters. </p> <pre><code>git commit --author="username &lt;email&gt;" </code></pre> <p>This used to work on older git versions. now it produces this error:</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,181
git
# git commit --author doesn't work when global not set working on a lab machine which has a shared login. don't want to set global git config parameters. ``` git commit --author="username <email>" ``` This used to work on older git versions. now it produces this error: ``` *** Please tell me who you are. Run gi...
What if you set the git config info just for the current repository? ``` git config user.email "you@example.com" git config user.name "Your Name" ``` You can also provide this information through [environment variables](https://git-scm.com/docs/git-commit#_commit_information): ``` GIT_AUTHOR_EMAIL="you@email.com...
9434959
What's the best way to force a merge in git?
35
2012-02-24 17:07:17
<p>I have a project with a dev branch and a production branch. Recently I've been working on a big new set of features in dev, so I haven't merged into production for about two weeks. In the meantime, though, there were some bugs that needed to be fixed in production.</p> <p>For the most part I was able to make the fix...
81,463
1,231,271
2024-05-13 14:27:12
9,435,050
28
2012-02-24 17:14:20
191,215
2012-02-24 17:32:06
https://stackoverflow.com/q/9434959
https://stackoverflow.com/a/9435050
<p>You can just push your dev branch onto the master repo production branch:</p> <pre><code>git push --force upstream-remote dev:production </code></pre> <p><code>upstream-remote</code> may just be <code>origin</code> if you're on a default clone.</p> <p>Updated for mod'ed question:</p> <p>You probably don't want t...
<p>You can just push your dev branch onto the master repo production branch:</p> <pre><code>git push --force upstream-remote dev:production </code></pre> <p><code>upstream-remote</code> may just be <code>origin</code> if you're on a default clone.</p> <p>Updated for mod'ed question:</p> <p>You probably don't want t...
119, 717
git, merge
<h1>What's the best way to force a merge in git?</h1> <p>I have a project with a dev branch and a production branch. Recently I've been working on a big new set of features in dev, so I haven't merged into production for about two weeks. In the meantime, though, there were some bugs that needed to be fixed in productio...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,184
git
# What's the best way to force a merge in git? I have a project with a dev branch and a production branch. Recently I've been working on a big new set of features in dev, so I haven't merged into production for about two weeks. In the meantime, though, there were some bugs that needed to be fixed in production. For t...
You can just push your dev branch onto the master repo production branch: ``` git push --force upstream-remote dev:production ``` `upstream-remote` may just be `origin` if you're on a default clone. Updated for mod'ed question: You probably don't want to `revert` in the git sense but, yes, that's more or less what ...
3515657
In a git merge, how do you just replace your version with the version git says there is a conflict with?
35
2010-08-18 18:58:11
<p>I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let's say my partner already made the changes I was working on, so I just want to replace my A file with their B file - no merge needed. How do I resolve the conflict with git?...
26,075
365,781
2012-12-07 00:10:19
3,517,430
28
2010-08-18 23:02:44
64,313
2010-08-18 23:02:44
https://stackoverflow.com/q/3515657
https://stackoverflow.com/a/3517430
<p>Let's say both you and your partner modified the same file, and is committed to each respective repository.</p> <pre><code>git pull # fetch/merge partners changes # merge fails, conflict git checkout origin FILE_TO_REPLACE # replace changes with partners ver git commit ...
<p>Let's say both you and your partner modified the same file, and is committed to each respective repository.</p> <pre><code>git pull # fetch/merge partners changes # merge fails, conflict git checkout origin FILE_TO_REPLACE # replace changes with partners ver git commit ...
119, 717
git, merge
<h1>In a git merge, how do you just replace your version with the version git says there is a conflict with?</h1> <p>I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let's say my partner already made the changes I was working on...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,185
git
# In a git merge, how do you just replace your version with the version git says there is a conflict with? I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let's say my partner already made the changes I was working on, so I ju...
Let's say both you and your partner modified the same file, and is committed to each respective repository. ``` git pull # fetch/merge partners changes # merge fails, conflict git checkout origin FILE_TO_REPLACE # replace changes with partners ver git commit # fin...
66673759
git branch -M main
33
2021-03-17 13:09:50
<p>One of the things github now recommends is changing the branch to main instead of master.</p> <p>The code given on the github site is:</p> <pre><code>git branch -M main </code></pre> <p>That never works for me, so I thought I would mention it here. I have a hard time believing this problem only occurs with me.</p> ...
48,835
4,629,916
2023-02-08 21:29:35
66,677,601
28
2021-03-17 16:48:22
1,256,452
2023-02-08 21:29:35
https://stackoverflow.com/q/66673759
https://stackoverflow.com/a/66677601
<p><strong>Update:</strong> The <code>-m</code> and <code>-M</code> options to git branch were upgrade in Git 2.30 to allow renaming the not-yet-existing current branch name in special situations, such as when you're in a new, empty repository.</p> <hr /> <p>You mention in <a href="https://stackoverflow.com/a/66673760/...
<p><strong>Update:</strong> The <code>-m</code> and <code>-M</code> options to git branch were upgrade in Git 2.30 to allow renaming the not-yet-existing current branch name in special situations, such as when you're in a new, empty repository.</p> <hr /> <p>You mention in <a href="https://stackoverflow.com/a/66673760/...
119, 1879
branch, git
<h1>git branch -M main</h1> <p>One of the things github now recommends is changing the branch to main instead of master.</p> <p>The code given on the github site is:</p> <pre><code>git branch -M main </code></pre> <p>That never works for me, so I thought I would mention it here. I have a hard time believing this probl...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,187
git
# git branch -M main One of the things github now recommends is changing the branch to main instead of master. The code given on the github site is: ``` git branch -M main ``` That never works for me, so I thought I would mention it here. I have a hard time believing this problem only occurs with me. ``` error: re...
**Update:** The `-m` and `-M` options to git branch were upgrade in Git 2.30 to allow renaming the not-yet-existing current branch name in special situations, such as when you're in a new, empty repository. --- You mention in [your own answer](https://stackoverflow.com/a/66673760/1256452) that `git branch -m main` (o...
12063345
What and where does one potentially lose stuff when git says "forced update"?
33
2012-08-21 21:31:10
<p>I recently received a "forced update" warning from git on a repository which only I commit to. I haven't done any re-basing so I don't know why this happened. What I want to know is, where should I look to find changes that have potentially been lost?</p> <p>To illustrate, let there be three copies of the reposit...
20,222
1,615,367
2025-07-02 13:52:35
12,063,866
28
2012-08-21 22:17:49
582
2012-08-21 22:17:49
https://stackoverflow.com/q/12063345
https://stackoverflow.com/a/12063866
<p>A "forced update" means the remote-tracking branch was recent. This happens if you fetch (or pull) after someone does a force push to the repository.</p> <p>However, when executing the <code>git pull</code>, your local branch won't lose any history. Since the remote branch's history now diverges from your local, <c...
<p>A "forced update" means the remote-tracking branch was recent. This happens if you fetch (or pull) after someone does a force push to the repository.</p> <p>However, when executing the <code>git pull</code>, your local branch won't lose any history. Since the remote branch's history now diverges from your local, <c...
119, 28896, 33720
git, git-fetch, git-pull
<h1>What and where does one potentially lose stuff when git says "forced update"?</h1> <p>I recently received a "forced update" warning from git on a repository which only I commit to. I haven't done any re-basing so I don't know why this happened. What I want to know is, where should I look to find changes that have...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,188
git
# What and where does one potentially lose stuff when git says "forced update"? I recently received a "forced update" warning from git on a repository which only I commit to. I haven't done any re-basing so I don't know why this happened. What I want to know is, where should I look to find changes that have potentiall...
A "forced update" means the remote-tracking branch was recent. This happens if you fetch (or pull) after someone does a force push to the repository. However, when executing the `git pull`, your local branch won't lose any history. Since the remote branch's history now diverges from your local, `git pull` will execute...
3165696
git pull fails with "Untracked working tree file 'blah' would be overwritten by merge", but tree is clean
33
2010-07-02 12:38:32
<p>I've checked in some changes to my local repository that I want to push, but when I do a git pull, I get:</p> <pre><code>paul$ git pull </code></pre> <blockquote> <p>error: Untracked working tree file 'documentation/Android/SwiftKey/buttons.xcf' would be overwritten by merge. Aborting</p> </blockquote> <p>My ...
48,206
268,371
2013-01-25 09:27:30
3,165,958
28
2010-07-02 13:14:37
381,619
2010-07-02 13:14:37
https://stackoverflow.com/q/3165696
https://stackoverflow.com/a/3165958
<p>It's not the commits you've made that touch the file, but the commits that you're pulling. Inspect the remote branch you're tracking to see what's happened. For example, <code>git log master..origin/master</code> will show all the commits that have happened on <em>origin/master</em> since you last pulled. According ...
<p>It's not the commits you've made that touch the file, but the commits that you're pulling. Inspect the remote branch you're tracking to see what's happened. For example, <code>git log master..origin/master</code> will show all the commits that have happened on <em>origin/master</em> since you last pulled. According ...
119
git
<h1>git pull fails with "Untracked working tree file 'blah' would be overwritten by merge", but tree is clean</h1> <p>I've checked in some changes to my local repository that I want to push, but when I do a git pull, I get:</p> <pre><code>paul$ git pull </code></pre> <blockquote> <p>error: Untracked working tree f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,189
git
# git pull fails with "Untracked working tree file 'blah' would be overwritten by merge", but tree is clean I've checked in some changes to my local repository that I want to push, but when I do a git pull, I get: ``` paul$ git pull ``` > error: Untracked working tree file 'documentation/Android/SwiftKey/buttons.xcf...
It's not the commits you've made that touch the file, but the commits that you're pulling. Inspect the remote branch you're tracking to see what's happened. For example, `git log master..origin/master` will show all the commits that have happened on *origin/master* since you last pulled. According to your output above,...
34542204
fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean
32
2015-12-31 06:34:13
<p>When I am trying to clean all untracked files by <code>git clean</code> it shows me the error: </p> <pre><code>fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean </code></pre> <p>How to resolve it?</p>
14,534
1,084,174
2021-05-05 11:09:34
34,542,205
28
2015-12-31 06:34:13
1,084,174
2015-12-31 06:34:13
https://stackoverflow.com/q/34542204
https://stackoverflow.com/a/34542205
<p>You have to either set <code>requireForce</code> to <code>false</code> in your <code>.gitconfig</code> or use the <code>-f</code> or <code>-i</code> flag with this command.</p> <ol> <li><code>git clean -f</code> will force to clean the untracked files even if <code>clean.requireForce</code> is set to true which is...
<p>You have to either set <code>requireForce</code> to <code>false</code> in your <code>.gitconfig</code> or use the <code>-f</code> or <code>-i</code> flag with this command.</p> <ol> <li><code>git clean -f</code> will force to clean the untracked files even if <code>clean.requireForce</code> is set to true which is...
119, 456
git, version-control
<h1>fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean</h1> <p>When I am trying to clean all untracked files by <code>git clean</code> it shows me the error: </p> <pre><code>fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean </code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,190
git
# fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean When I am trying to clean all untracked files by `git clean` it shows me the error: ``` fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean ``` How to resolve it?
You have to either set `requireForce` to `false` in your `.gitconfig` or use the `-f` or `-i` flag with this command. 1. `git clean -f` will force to clean the untracked files even if `clean.requireForce` is set to true which is default. 2. `git clean -i` will give you an interactive way for cleaning each file 3. `git...
12733452
Prevent Git from changing permissions on pull
31
2012-10-04 18:25:21
<p>When I pull change from my repositories, Git change the file permissions (actually, he change the group <code>write</code> permission).</p> <p>If I'm correct, Git should only track executable bit and this anyway can be removed using setting <code>core.filemode</code> to false.</p> <p>But, although the filemode is ...
27,940
1,024,223
2022-08-30 11:52:43
12,735,291
28
2012-10-04 20:24:10
6,309
2022-08-30 11:52:43
https://stackoverflow.com/q/12733452
https://stackoverflow.com/a/12735291
<p>One config setting that <em>might</em> help here is <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>core.sharedRepository</code></a>, presented in the blog post &quot;<a href="http://briantanaka.com/blog/git/" rel="noreferrer">Preserving Group Write on Git Objects in a Collaborative Repository</a...
<p>One config setting that <em>might</em> help here is <a href="http://git-scm.com/docs/git-config" rel="noreferrer"><code>core.sharedRepository</code></a>, presented in the blog post &quot;<a href="http://briantanaka.com/blog/git/" rel="noreferrer">Preserving Group Write on Git Objects in a Collaborative Repository</a...
119, 456
git, version-control
<h1>Prevent Git from changing permissions on pull</h1> <p>When I pull change from my repositories, Git change the file permissions (actually, he change the group <code>write</code> permission).</p> <p>If I'm correct, Git should only track executable bit and this anyway can be removed using setting <code>core.filemode<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,192
git
# Prevent Git from changing permissions on pull When I pull change from my repositories, Git change the file permissions (actually, he change the group `write` permission). If I'm correct, Git should only track executable bit and this anyway can be removed using setting `core.filemode` to false. But, although the fi...
One config setting that *might* help here is [`core.sharedRepository`](http://git-scm.com/docs/git-config), presented in the blog post "[Preserving Group Write on Git Objects in a Collaborative Repository](http://briantanaka.com/blog/git/)": > The solution turned out to be fairly straightforward. > In the file `.git...
13981570
find difference between 2 remote branches
30
2012-12-20 22:27:33
<p>How can I find out what are the differences between 2 remote branches?</p> <p>I tried:</p> <pre><code>git diff --name-status remotes/branch-V4.4..remotes/branch-V4.2 </code></pre> <p>But it gives me a list of files which changes. Is there a way I get a list of commits which shows me the difference between 2 bran...
41,476
286,802
2024-04-15 22:29:44
13,981,721
28
2012-12-20 22:41:06
758,345
2012-12-21 23:52:31
https://stackoverflow.com/q/13981570
https://stackoverflow.com/a/13981721
<p>What you are looking for is probably something like:</p> <pre><code>gitk --left-right remotes/branch-V4.4...remotes/branch-V4.2 </code></pre> <p>or if gitk is not available:</p> <pre><code>git log --oneline --graph --decorate --left-right --boundary --date-order remotes/branch-V4.4...remotes/branch-V4.2 </code></...
<p>What you are looking for is probably something like:</p> <pre><code>gitk --left-right remotes/branch-V4.4...remotes/branch-V4.2 </code></pre> <p>or if gitk is not available:</p> <pre><code>git log --oneline --graph --decorate --left-right --boundary --date-order remotes/branch-V4.4...remotes/branch-V4.2 </code></...
119
git
<h1>find difference between 2 remote branches</h1> <p>How can I find out what are the differences between 2 remote branches?</p> <p>I tried:</p> <pre><code>git diff --name-status remotes/branch-V4.4..remotes/branch-V4.2 </code></pre> <p>But it gives me a list of files which changes. Is there a way I get a list of c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,194
git
# find difference between 2 remote branches How can I find out what are the differences between 2 remote branches? I tried: ``` git diff --name-status remotes/branch-V4.4..remotes/branch-V4.2 ``` But it gives me a list of files which changes. Is there a way I get a list of commits which shows me the difference betw...
What you are looking for is probably something like: ``` gitk --left-right remotes/branch-V4.4...remotes/branch-V4.2 ``` or if gitk is not available: ``` git log --oneline --graph --decorate --left-right --boundary --date-order remotes/branch-V4.4...remotes/branch-V4.2 ``` You might also want to try it without the ...
677753
Mapping between git committers and SVN users
30
2009-03-24 14:54:11
<p>I'm using git-svn to store a "staging" version of some SVN repo, where other users are allowed to pull from this staging repo and commit there changes back to it, then the commits on the staging repo are periodically committed the upstream SVN repo. </p> <p>I want to know if there's a way to map between the git com...
10,074
null
2012-10-18 14:14:42
677,843
28
2009-03-24 15:11:55
6,309
2009-03-25 11:06:54
https://stackoverflow.com/q/677753
https://stackoverflow.com/a/677843
<p><a href="https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/opensource/?p=482" rel="noreferrer">Vincent Danen</a> does mention <a href="http://git-scm.com/docs/git-svn" rel="noreferrer">the -A option when using git svn</a>:</p> <blockquote> <p>So using ~/git as a top-level directory for Git repos...
<p><a href="https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/opensource/?p=482" rel="noreferrer">Vincent Danen</a> does mention <a href="http://git-scm.com/docs/git-svn" rel="noreferrer">the -A option when using git svn</a>:</p> <blockquote> <p>So using ~/git as a top-level directory for Git repos...
63, 119, 6452
git, git-svn, svn
<h1>Mapping between git committers and SVN users</h1> <p>I'm using git-svn to store a "staging" version of some SVN repo, where other users are allowed to pull from this staging repo and commit there changes back to it, then the commits on the staging repo are periodically committed the upstream SVN repo. </p> <p>I wa...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,195
git
# Mapping between git committers and SVN users I'm using git-svn to store a "staging" version of some SVN repo, where other users are allowed to pull from this staging repo and commit there changes back to it, then the commits on the staging repo are periodically committed the upstream SVN repo. I want to know if the...
[Vincent Danen](https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/opensource/?p=482) does mention [the -A option when using git svn](http://git-scm.com/docs/git-svn): > So using ~/git as a top-level directory for Git repositories `[...]` create an authors.txt file. > This file will map the names of...
122424
Build sequencing when using distributed version control
30
2008-09-23 17:23:32
<p>Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902".</p> <p>I'd like to switch over to using a distributed system (probably git) to make it easier to branc...
7,275
14,528
2014-03-07 15:57:51
124,747
28
2008-09-24 00:35:04
2,988
2008-09-24 00:35:04
https://stackoverflow.com/q/122424
https://stackoverflow.com/a/124747
<p>I second the suggestion of using <code>git describe</code>. Provided that you have a sane versioning policy, and you don't do any crazy stuff with your repository, <code>git describe</code> will always be monotonic (at least as monotonic as you can be, when your revision history is a DAG instead of a tree) and uniqu...
<p>I second the suggestion of using <code>git describe</code>. Provided that you have a sane versioning policy, and you don't do any crazy stuff with your repository, <code>git describe</code> will always be monotonic (at least as monotonic as you can be, when your revision history is a DAG instead of a tree) and uniqu...
119, 1783, 3346
build-process, dvcs, git
<h1>Build sequencing when using distributed version control</h1> <p>Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902".</p> <p>I'd like to switch over to usi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,196
git
# Build sequencing when using distributed version control Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902". I'd like to switch over to using a distributed...
I second the suggestion of using `git describe`. Provided that you have a sane versioning policy, and you don't do any crazy stuff with your repository, `git describe` will always be monotonic (at least as monotonic as you can be, when your revision history is a DAG instead of a tree) and unique. A little demonstratio...
54408829
Granular access to directories within monorepo
29
2019-01-28 19:17:08
<p>I've been reading about the advantages of monorepos, but haven't yet found a mitigation for the problem of <a href="https://softwareengineering.stackexchange.com/questions/342757/sharing-parts-of-a-monorepo">sharing parts of a repo</a>:</p> <p>Let's say an organization has a monorepo for a client/server web applica...
10,840
1,269,037
2023-05-30 02:15:51
61,273,621
28
2020-04-17 14:08:30
8,910,547
2023-02-22 22:18:30
https://stackoverflow.com/q/54408829
https://stackoverflow.com/a/61273621
<h2>Consider using <code>git subtree</code>.</h2> <p>With <code>git subtree</code> you will be able to:</p> <ul> <li><p>create a monorepo composed of subtrees, each of which can be linked to separate remote repos.</p> <p><em>Given your example use case, the contractor would be given access to only the remote repo tied ...
<h2>Consider using <code>git subtree</code>.</h2> <p>With <code>git subtree</code> you will be able to:</p> <ul> <li><p>create a monorepo composed of subtrees, each of which can be linked to separate remote repos.</p> <p><em>Given your example use case, the contractor would be given access to only the remote repo tied ...
119, 7500, 122240
access-control, git, monorepo
<h1>Granular access to directories within monorepo</h1> <p>I've been reading about the advantages of monorepos, but haven't yet found a mitigation for the problem of <a href="https://softwareengineering.stackexchange.com/questions/342757/sharing-parts-of-a-monorepo">sharing parts of a repo</a>:</p> <p>Let's say an org...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,197
git
# Granular access to directories within monorepo I've been reading about the advantages of monorepos, but haven't yet found a mitigation for the problem of [sharing parts of a repo](https://softwareengineering.stackexchange.com/questions/342757/sharing-parts-of-a-monorepo): Let's say an organization has a monorepo fo...
## Consider using `git subtree`. With `git subtree` you will be able to: - create a monorepo composed of subtrees, each of which can be linked to separate remote repos. *Given your example use case, the contractor would be given access to only the remote repo tied to a single subtree of the monorepo.* - have a sin...
17910312
Retrieving git log in YYYY-MM-DD format in local time zone
29
2013-07-28 16:26:13
<p>To get <code>YYYY-MM-DD</code> format for dates <code>git log --date=iso</code> is used. To force dates in your local time zone<code>git log --date=local</code> is used.</p> <p>I was trying to combine both the options but it was a failure. So is there a way (<code>git log</code> command) to get date (<code>YYYY-MM...
10,168
2,227,652
2024-01-18 14:29:10
32,990,722
28
2015-10-07 11:13:40
6,309
2015-10-07 11:13:40
https://stackoverflow.com/q/17910312
https://stackoverflow.com/a/32990722
<p>With git 2.7, use:</p> <pre><code>git log --date=iso-local </code></pre> <p>git 2.7 (Q4 2015), which introduces <code>-local</code> as an instruction. </p> <p>It means that, in addition of:</p> <pre><code>--date=(relative|local|default|iso|iso-strict|rfc|short|raw) </code></pre> <p>you will also have:</p> <p...
<p>With git 2.7, use:</p> <pre><code>git log --date=iso-local </code></pre> <p>git 2.7 (Q4 2015), which introduces <code>-local</code> as an instruction. </p> <p>It means that, in addition of:</p> <pre><code>--date=(relative|local|default|iso|iso-strict|rfc|short|raw) </code></pre> <p>you will also have:</p> <p...
119
git
<h1>Retrieving git log in YYYY-MM-DD format in local time zone</h1> <p>To get <code>YYYY-MM-DD</code> format for dates <code>git log --date=iso</code> is used. To force dates in your local time zone<code>git log --date=local</code> is used.</p> <p>I was trying to combine both the options but it was a failure. So is t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,199
git
# Retrieving git log in YYYY-MM-DD format in local time zone To get `YYYY-MM-DD` format for dates `git log --date=iso` is used. To force dates in your local time zone`git log --date=local` is used. I was trying to combine both the options but it was a failure. So is there a way (`git log` command) to get date (`YYYY-...
With git 2.7, use: ``` git log --date=iso-local ``` git 2.7 (Q4 2015), which introduces `-local` as an instruction. It means that, in addition of: ``` --date=(relative|local|default|iso|iso-strict|rfc|short|raw) ``` you will also have: ``` --date=(relative-local|default-local|iso-local|iso-strict-local|rfc-local...
10874149
Git octopus merge with unrelated repositories
29
2012-06-03 21:41:39
<p>I have a bunch of git repositories, each containing one file. I'd like to merge them all together, preferably in one step. What I'm aiming for is this graph:</p> <pre><code>*----¬ mergedrepo/master | \ \ \ | | | * repoA/master | | * repoB/master | | | | | * repoB/... | * repoC/master * repoD/master | * repoD/... </...
3,034
102,441
2020-07-09 16:01:19
31,186,732
28
2015-07-02 14:02:35
393,672
2018-11-14 21:40:47
https://stackoverflow.com/q/10874149
https://stackoverflow.com/a/31186732
<p>I've managed to resolve the problem with octopus merge of unrelated branches. Unfortunately the following applies only to rather simple cases where no real merge conflicts exist.</p> <ol> <li><p>Do a merge as described in the OP. </p> <p><code>git merge --allow-unrelated-histories a/master b/master c/master d/mast...
<p>I've managed to resolve the problem with octopus merge of unrelated branches. Unfortunately the following applies only to rather simple cases where no real merge conflicts exist.</p> <ol> <li><p>Do a merge as described in the OP. </p> <p><code>git merge --allow-unrelated-histories a/master b/master c/master d/mast...
119, 28897
git, git-merge
<h1>Git octopus merge with unrelated repositories</h1> <p>I have a bunch of git repositories, each containing one file. I'd like to merge them all together, preferably in one step. What I'm aiming for is this graph:</p> <pre><code>*----¬ mergedrepo/master | \ \ \ | | | * repoA/master | | * repoB/master | | | | | * rep...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,200
git
# Git octopus merge with unrelated repositories I have a bunch of git repositories, each containing one file. I'd like to merge them all together, preferably in one step. What I'm aiming for is this graph: ``` *----¬ mergedrepo/master | \ \ \ | | | * repoA/master | | * repoB/master | | | | | * repoB/... | * repoC/mas...
I've managed to resolve the problem with octopus merge of unrelated branches. Unfortunately the following applies only to rather simple cases where no real merge conflicts exist. 1. Do a merge as described in the OP. `git merge --allow-unrelated-histories a/master b/master c/master d/master` It will "fail" cla...
28973554
Not possible to fast-forward even with no changes
29
2015-03-10 20:32:25
<p>I ended up in a weird git state. I want to pull from server, only fast forwards.</p> <p>However, even when there were no changes, git keeps telling me "not possible fast-forward".</p> <pre><code>$ git pull -v --ff-only From github.com:username/repo = [up to date] branch -&gt; origin/branch = [up to date]...
69,676
101,152
2021-07-15 08:35:21
28,973,624
28
2015-03-10 20:36:53
12,471
2015-03-10 20:36:53
https://stackoverflow.com/q/28973554
https://stackoverflow.com/a/28973624
<p>This happens when (a) you committed something on that branch earlier, or (b) the history on the remote server changed in a non-standard way (this shouldn't normally happen but repository owners sometimes don't play by the rules).</p> <p>For the following I'm assuming you're on <code>foo</code> and the upstream bran...
<p>This happens when (a) you committed something on that branch earlier, or (b) the history on the remote server changed in a non-standard way (this shouldn't normally happen but repository owners sometimes don't play by the rules).</p> <p>For the following I'm assuming you're on <code>foo</code> and the upstream bran...
119
git
<h1>Not possible to fast-forward even with no changes</h1> <p>I ended up in a weird git state. I want to pull from server, only fast forwards.</p> <p>However, even when there were no changes, git keeps telling me "not possible fast-forward".</p> <pre><code>$ git pull -v --ff-only From github.com:username/repo = [up ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,201
git
# Not possible to fast-forward even with no changes I ended up in a weird git state. I want to pull from server, only fast forwards. However, even when there were no changes, git keeps telling me "not possible fast-forward". ``` $ git pull -v --ff-only From github.com:username/repo = [up to date] branch -> ...
This happens when (a) you committed something on that branch earlier, or (b) the history on the remote server changed in a non-standard way (this shouldn't normally happen but repository owners sometimes don't play by the rules). For the following I'm assuming you're on `foo` and the upstream branch is `origin/foo`. ...
4694104
How can I have it to where "git push" pushes to local repositories?
29
2011-01-14 17:40:14
<p>I can do <code>git remote add origin x@x:~/blah</code> and <code>git push</code> will work. But if I create a local copy <code>git clone ~/blah</code> inside /var, then <code>git remote add local /var/blah</code> inside <code>~/blah</code>, when I try <code>git push</code> it doesn't push the updates.</p> <p>How ca...
43,638
538,610
2018-08-20 03:26:31
4,694,142
28
2011-01-14 17:44:53
27,314
2016-08-02 12:17:58
https://stackoverflow.com/q/4694104
https://stackoverflow.com/a/4694142
<p>By default, <code>git push</code> pushes to origin. If you want to push to a different remote repository (on the same machine or otherwise), you need to do <code>git push &lt;remote-name&gt;</code>. Also keep in mind what mipadi says about non-bare repositories.</p> <p>So in your case, after a <code>git remote ad...
<p>By default, <code>git push</code> pushes to origin. If you want to push to a different remote repository (on the same machine or otherwise), you need to do <code>git push &lt;remote-name&gt;</code>. Also keep in mind what mipadi says about non-bare repositories.</p> <p>So in your case, after a <code>git remote ad...
119
git
<h1>How can I have it to where "git push" pushes to local repositories?</h1> <p>I can do <code>git remote add origin x@x:~/blah</code> and <code>git push</code> will work. But if I create a local copy <code>git clone ~/blah</code> inside /var, then <code>git remote add local /var/blah</code> inside <code>~/blah</code>,...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,202
git
# How can I have it to where "git push" pushes to local repositories? I can do `git remote add origin x@x:~/blah` and `git push` will work. But if I create a local copy `git clone ~/blah` inside /var, then `git remote add local /var/blah` inside `~/blah`, when I try `git push` it doesn't push the updates. How can I m...
By default, `git push` pushes to origin. If you want to push to a different remote repository (on the same machine or otherwise), you need to do `git push <remote-name>`. Also keep in mind what mipadi says about non-bare repositories. So in your case, after a `git remote add local /var/blah`, you would do `git push lo...
39126509
How to resolve git merge conflict, from command line, using a given strategy, for just one file?
28
2016-08-24 14:45:45
<p>Let's say I did a git merge and have a conflict in some file, say <code>package.json</code> or <code>pom.xml</code>, and perhaps some other files.</p> <p>I would like to</p> <ol> <li>automatically resolve merge conflicts for <em>certain files</em> from command line, while</li> <li>letting myself resolve manually a...
16,760
245,966
2019-03-14 09:48:25
39,126,510
28
2016-08-24 14:45:45
245,966
2017-01-27 14:39:30
https://stackoverflow.com/q/39126509
https://stackoverflow.com/a/39126510
<p>This can be achieved using <a href="https://git-scm.com/docs/git-merge-file" rel="noreferrer"><code>git-merge-file</code></a> although its API is rather low-level.</p> <p>In order to have an easy-to-use command, you can use the following bash script (to be imported to <code>.bashrc</code>, or you can also install i...
<p>This can be achieved using <a href="https://git-scm.com/docs/git-merge-file" rel="noreferrer"><code>git-merge-file</code></a> although its API is rather low-level.</p> <p>In order to have an easy-to-use command, you can use the following bash script (to be imported to <code>.bashrc</code>, or you can also install i...
119, 717, 28897
git, git-merge, merge
<h1>How to resolve git merge conflict, from command line, using a given strategy, for just one file?</h1> <p>Let's say I did a git merge and have a conflict in some file, say <code>package.json</code> or <code>pom.xml</code>, and perhaps some other files.</p> <p>I would like to</p> <ol> <li>automatically resolve merg...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,205
git
# How to resolve git merge conflict, from command line, using a given strategy, for just one file? Let's say I did a git merge and have a conflict in some file, say `package.json` or `pom.xml`, and perhaps some other files. I would like to 1. automatically resolve merge conflicts for *certain files* from command lin...
This can be achieved using [`git-merge-file`](https://git-scm.com/docs/git-merge-file) although its API is rather low-level. In order to have an easy-to-use command, you can use the following bash script (to be imported to `.bashrc`, or you can also install it with `npm install -g git-resolve-conflict`): ``` git-reso...
34939445
List file that have changed since last commit with GitPython
27
2016-01-22 05:11:51
<p>I need to have the Python script read in the files that have changed since the last Git commit. Using <a href="https://github.com/gitpython-developers/GitPython" rel="noreferrer">GitPython</a>, how would I get the same output as running from cli:</p> <pre><code>$ git diff --name-only HEAD~1 HEAD </code></pre> <p>...
10,064
650,424
2022-03-18 15:23:02
34,983,128
28
2016-01-24 23:58:41
771,848
2016-01-24 23:58:41
https://stackoverflow.com/q/34939445
https://stackoverflow.com/a/34983128
<p>You need to pass the <code>name_only</code> keyword argument - it would automatically be used as <code>--name-only</code> command-line option when a git command would be issued.</p> <p>The following is the equivalent of <code>git diff --name-only HEAD~1..HEAD</code>:</p> <pre><code>diff = repo.git.diff('HEAD~1..HE...
<p>You need to pass the <code>name_only</code> keyword argument - it would automatically be used as <code>--name-only</code> command-line option when a git command would be issued.</p> <p>The following is the equivalent of <code>git diff --name-only HEAD~1..HEAD</code>:</p> <pre><code>diff = repo.git.diff('HEAD~1..HE...
16, 119, 61013
git, gitpython, python
<h1>List file that have changed since last commit with GitPython</h1> <p>I need to have the Python script read in the files that have changed since the last Git commit. Using <a href="https://github.com/gitpython-developers/GitPython" rel="noreferrer">GitPython</a>, how would I get the same output as running from cli:...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,207
git
# List file that have changed since last commit with GitPython I need to have the Python script read in the files that have changed since the last Git commit. Using [GitPython](https://github.com/gitpython-developers/GitPython), how would I get the same output as running from cli: ``` $ git diff --name-only HEAD~1 HE...
You need to pass the `name_only` keyword argument - it would automatically be used as `--name-only` command-line option when a git command would be issued. The following is the equivalent of `git diff --name-only HEAD~1..HEAD`: ``` diff = repo.git.diff('HEAD~1..HEAD', name_only=True) print(diff) ```
1343597
git branch without history
27
2009-08-27 20:31:08
<p>My git repo contains sensitive passwords which, for reasons out of my control, can't be removed right now. Right now it's all OK because this repo is internal-only, but I've been asked to create a branch that's safe to share with partners.</p> <p>Is there any way to create a branch in git and then remove files fro...
11,136
112,718
2013-02-07 17:47:43
1,343,610
28
2009-08-27 20:35:35
893
2009-08-27 20:35:35
https://stackoverflow.com/q/1343597
https://stackoverflow.com/a/1343610
<p>One thing you could do is create a branch of your repo, edit out the passwords, and then create a shallow clone (with depth 1) of that repository that you would give to the partners. They can make patches and whatnot against that clone, but can't see the whole history and can't push the repo anywhere else. If they'r...
<p>One thing you could do is create a branch of your repo, edit out the passwords, and then create a shallow clone (with depth 1) of that repository that you would give to the partners. They can make patches and whatnot against that clone, but can't see the whole history and can't push the repo anywhere else. If they'r...
119, 1879
branch, git
<h1>git branch without history</h1> <p>My git repo contains sensitive passwords which, for reasons out of my control, can't be removed right now. Right now it's all OK because this repo is internal-only, but I've been asked to create a branch that's safe to share with partners.</p> <p>Is there any way to create a bra...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,209
git
# git branch without history My git repo contains sensitive passwords which, for reasons out of my control, can't be removed right now. Right now it's all OK because this repo is internal-only, but I've been asked to create a branch that's safe to share with partners. Is there any way to create a branch in git and th...
One thing you could do is create a branch of your repo, edit out the passwords, and then create a shallow clone (with depth 1) of that repository that you would give to the partners. They can make patches and whatnot against that clone, but can't see the whole history and can't push the repo anywhere else. If they're j...
13609698
What does this do: git branch -f
26
2012-11-28 16:23:47
<p>I'm trying to figure out how to use this command properly. I believe this is the command and flag I want to essentially make one branch into my other branch (basically delete a branch and create a new branch with the same name with the files of another branch), but I don't know for sure, or if I have the syntax corr...
24,806
1,292,230
2017-06-10 20:48:49
13,609,784
28
2012-11-28 16:27:53
750,495
2017-06-10 20:48:49
https://stackoverflow.com/q/13609698
https://stackoverflow.com/a/13609784
<p>The <code>-f</code> argument stands for <code>--force</code>.</p> <ul> <li>If a branch called <code>master</code> already exists, git will not allow you to overwrite it, unless you use <code>-f</code>.</li> <li>Second parameter (<code>sub-branch</code>) will be used to determine where the <code>master</code> branch...
<p>The <code>-f</code> argument stands for <code>--force</code>.</p> <ul> <li>If a branch called <code>master</code> already exists, git will not allow you to overwrite it, unless you use <code>-f</code>.</li> <li>Second parameter (<code>sub-branch</code>) will be used to determine where the <code>master</code> branch...
119, 1879
branch, git
<h1>What does this do: git branch -f</h1> <p>I'm trying to figure out how to use this command properly. I believe this is the command and flag I want to essentially make one branch into my other branch (basically delete a branch and create a new branch with the same name with the files of another branch), but I don't k...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,211
git
# What does this do: git branch -f I'm trying to figure out how to use this command properly. I believe this is the command and flag I want to essentially make one branch into my other branch (basically delete a branch and create a new branch with the same name with the files of another branch), but I don't know for s...
The `-f` argument stands for `--force`. - If a branch called `master` already exists, git will not allow you to overwrite it, unless you use `-f`. - Second parameter (`sub-branch`) will be used to determine where the `master` branch's `HEAD` should be pointing to.
4264447
Can git's .gitattributes treat all files as binary except a few exceptions?
26
2010-11-24 07:37:33
<p>I have a particular need for git to treat most file extensions as binary except a few extensions.</p> <p>I'd like to treat all file extensions as binary, .pdf .doc .xls etc., except plain text files such as .txt .rb .py etc.</p> <p>I've tried configuring .gitattributes like below to see how this might work:</p> <...
21,256
294,389
2020-10-18 15:23:14
4,264,522
28
2010-11-24 07:52:20
6,309
2020-10-18 15:23:14
https://stackoverflow.com/q/4264447
https://stackoverflow.com/a/4264522
<p><code>binary</code> is a macro setting the attribute crlf and diff (actually here unsetting them)<br /> See &quot;<a href="https://git-scm.com/docs/gitattributes#_using_macro_attributes" rel="noreferrer">USING ATTRIBUTE MACROS</a>&quot; from the <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer"><code>...
<p><code>binary</code> is a macro setting the attribute crlf and diff (actually here unsetting them)<br /> See &quot;<a href="https://git-scm.com/docs/gitattributes#_using_macro_attributes" rel="noreferrer">USING ATTRIBUTE MACROS</a>&quot; from the <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer"><code>...
119
git
<h1>Can git's .gitattributes treat all files as binary except a few exceptions?</h1> <p>I have a particular need for git to treat most file extensions as binary except a few extensions.</p> <p>I'd like to treat all file extensions as binary, .pdf .doc .xls etc., except plain text files such as .txt .rb .py etc.</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,213
git
# Can git's .gitattributes treat all files as binary except a few exceptions? I have a particular need for git to treat most file extensions as binary except a few extensions. I'd like to treat all file extensions as binary, .pdf .doc .xls etc., except plain text files such as .txt .rb .py etc. I've tried configurin...
`binary` is a macro setting the attribute crlf and diff (actually here unsetting them) See "[USING ATTRIBUTE MACROS](https://git-scm.com/docs/gitattributes#_using_macro_attributes)" from the [`.gitattribute` man page](http://git-scm.com/docs/gitattributes). Once an attribute is set or unset, if cannot be changed by ...
22546878
Possible to do "conda build" from github branch?
25
2014-03-20 22:54:37
<p>I know that I can tell conda to build from github as:</p> <pre><code>source: fn: v1.6.0.tar.gz url: https://github.com/SciTools/iris/archive/v1.6.0.tar.gz md5: 24c2d55758325a8f05aadf99748c0d2a </code></pre> <p>or </p> <pre><code>source: git_url: git@github.com:SciTools/iris.git git_tag: v1.6.0 </code><...
4,505
2,005,869
2020-09-30 21:59:55
22,565,201
28
2014-03-21 17:11:48
161,801
2018-05-29 10:22:51
https://stackoverflow.com/q/22546878
https://stackoverflow.com/a/22565201
<p>Just put the branch name in the <code>git_tag</code> section. All it does is <code>git checkout</code> that "tag", so it doesn't have to be an actual git tag. It can be anything that git can <code>checkout</code>. </p> <p>For example, if you want to conda build from branch <code>udunits_xml_path</code>, use:</p> <...
<p>Just put the branch name in the <code>git_tag</code> section. All it does is <code>git checkout</code> that "tag", so it doesn't have to be an actual git tag. It can be anything that git can <code>checkout</code>. </p> <p>For example, if you want to conda build from branch <code>udunits_xml_path</code>, use:</p> <...
119, 133695
conda-build, git
<h1>Possible to do "conda build" from github branch?</h1> <p>I know that I can tell conda to build from github as:</p> <pre><code>source: fn: v1.6.0.tar.gz url: https://github.com/SciTools/iris/archive/v1.6.0.tar.gz md5: 24c2d55758325a8f05aadf99748c0d2a </code></pre> <p>or </p> <pre><code>source: git_url: g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,214
git
# Possible to do "conda build" from github branch? I know that I can tell conda to build from github as: ``` source: fn: v1.6.0.tar.gz url: https://github.com/SciTools/iris/archive/v1.6.0.tar.gz md5: 24c2d55758325a8f05aadf99748c0d2a ``` or ``` source: git_url: git@github.com:SciTools/iris.git git_tag: v1...
Just put the branch name in the `git_tag` section. All it does is `git checkout` that "tag", so it doesn't have to be an actual git tag. It can be anything that git can `checkout`. For example, if you want to conda build from branch `udunits_xml_path`, use: ``` source: git_url: https://github.com/esc24/iris.git g...
20211016
What is wrong with merge commits?
25
2013-11-26 07:32:22
<p>I see a lot of questions where people are asking how that can avoid "pointless" merge commits.</p> <p>What exactly is bad about a merge commit? I find them useful, as you can see exactly where two developers started working, and where there work is merged together. It seems like rebasing, as a lot of answers sugges...
13,067
1,556,475
2013-11-26 07:47:22
20,211,192
28
2013-11-26 07:42:11
1,870,481
2013-11-26 07:47:22
https://stackoverflow.com/q/20211016
https://stackoverflow.com/a/20211192
<p>There are two different kind of merge commits:</p> <ul> <li>Explicit merge commits, which result for example from explicitly merging a feature branch into the main branch</li> <li>and implicit merge commits, which result for example by doing a <code>git pull</code> before trying to push</li> </ul> <p>The explicit ...
<p>There are two different kind of merge commits:</p> <ul> <li>Explicit merge commits, which result for example from explicitly merging a feature branch into the main branch</li> <li>and implicit merge commits, which result for example by doing a <code>git pull</code> before trying to push</li> </ul> <p>The explicit ...
119, 28897, 29934
git, git-merge, git-rebase
<h1>What is wrong with merge commits?</h1> <p>I see a lot of questions where people are asking how that can avoid "pointless" merge commits.</p> <p>What exactly is bad about a merge commit? I find them useful, as you can see exactly where two developers started working, and where there work is merged together. It seem...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,215
git
# What is wrong with merge commits? I see a lot of questions where people are asking how that can avoid "pointless" merge commits. What exactly is bad about a merge commit? I find them useful, as you can see exactly where two developers started working, and where there work is merged together. It seems like rebasing,...
There are two different kind of merge commits: - Explicit merge commits, which result for example from explicitly merging a feature branch into the main branch - and implicit merge commits, which result for example by doing a `git pull` before trying to push The explicit merge commits are usually perfectly fine. You ...
1615488
Clone just the stable and one other branch in git?
25
2009-10-23 19:38:46
<p>I'm just getting started with git and I have a question. My app has 10 other developers working on it, each one having their own branch like dev_XXXXX. So if I do a clone of the repository, do all of their code gets copied to my machine? In that case I dont want that. Suppose my branch is dev_swamy, how do I then cl...
16,524
44,916
2023-02-02 10:16:22
1,616,351
28
2009-10-23 23:01:23
46,058
2009-10-23 23:01:23
https://stackoverflow.com/q/1615488
https://stackoverflow.com/a/1616351
<p>By default <code>git clone</code> would fetch all branches, but those branches would be stored as remote-tracking branches: for example branch 'dev_XXXXX' would be stored as 'origin/dev_XXXXX' (with 'refs/remotes/origin/dev_XXXXX' as full name). Those remote-tracking branches wouldn't be visible in <code>git branch...
<p>By default <code>git clone</code> would fetch all branches, but those branches would be stored as remote-tracking branches: for example branch 'dev_XXXXX' would be stored as 'origin/dev_XXXXX' (with 'refs/remotes/origin/dev_XXXXX' as full name). Those remote-tracking branches wouldn't be visible in <code>git branch...
119, 34099
git, git-clone
<h1>Clone just the stable and one other branch in git?</h1> <p>I'm just getting started with git and I have a question. My app has 10 other developers working on it, each one having their own branch like dev_XXXXX. So if I do a clone of the repository, do all of their code gets copied to my machine? In that case I dont...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,216
git
# Clone just the stable and one other branch in git? I'm just getting started with git and I have a question. My app has 10 other developers working on it, each one having their own branch like dev_XXXXX. So if I do a clone of the repository, do all of their code gets copied to my machine? In that case I dont want tha...
By default `git clone` would fetch all branches, but those branches would be stored as remote-tracking branches: for example branch 'dev_XXXXX' would be stored as 'origin/dev_XXXXX' (with 'refs/remotes/origin/dev_XXXXX' as full name). Those remote-tracking branches wouldn't be visible in `git branch` output: you would ...
48116019
Possible to resolve Git conflict on single file using Ours / Theirs?
24
2018-01-05 14:54:20
<p>I've found many instructions on Stack Overflow and elsewhere for resolving conflicts using the OURS/THEIRS dynamic, in cases where you simply want to overwrite one file with another (particularly binary files). However in almost every example I find, it's always been applied en masse to all conflicts, whereas I only...
28,125
2,779,949
2024-05-09 06:05:16
48,117,629
28
2018-01-05 16:31:42
1,256,452
2022-06-28 03:17:28
https://stackoverflow.com/q/48116019
https://stackoverflow.com/a/48117629
<h3>TL;DR</h3> <p>You will need to <code>git add</code> the final resolution, unless you use a different method to extract the &quot;ours&quot; or &quot;theirs&quot; version.</p> <h3>Long</h3> <p>Each merge tool is independent of Git (Git just runs them and lets them do their things) so for that particular sub-part of ...
<h3>TL;DR</h3> <p>You will need to <code>git add</code> the final resolution, unless you use a different method to extract the &quot;ours&quot; or &quot;theirs&quot; version.</p> <h3>Long</h3> <p>Each merge tool is independent of Git (Git just runs them and lets them do their things) so for that particular sub-part of ...
119, 717, 1231
command-line, git, merge
<h1>Possible to resolve Git conflict on single file using Ours / Theirs?</h1> <p>I've found many instructions on Stack Overflow and elsewhere for resolving conflicts using the OURS/THEIRS dynamic, in cases where you simply want to overwrite one file with another (particularly binary files). However in almost every exam...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,217
git
# Possible to resolve Git conflict on single file using Ours / Theirs? I've found many instructions on Stack Overflow and elsewhere for resolving conflicts using the OURS/THEIRS dynamic, in cases where you simply want to overwrite one file with another (particularly binary files). However in almost every example I fin...
### TL;DR You will need to `git add` the final resolution, unless you use a different method to extract the "ours" or "theirs" version. ### Long Each merge tool is independent of Git (Git just runs them and lets them do their things) so for that particular sub-part of this question, you must consult the merge tool i...
20584267
Git - Remove in between commit
24
2013-12-14 14:05:39
<p>Our team is doing several projects in PHP. We have wrongly committed a folder of One Project to another. Now, we want to remove that particular commit from the Project. If we remove the particular folder/commit from the project then there is no issue for our project.</p> <p>If we just remove the folder and issue the...
36,993
743,290
2025-03-12 14:37:23
20,606,194
28
2013-12-16 08:18:03
743,290
2021-11-07 10:04:28
https://stackoverflow.com/q/20584267
https://stackoverflow.com/a/20606194
<p>I have tried all the provided methods i.e. rebase and cherry-pick. I here to provide full information about both the methods tried and things done by me, to help to understand things with better view</p> <h2>Preparations</h2> <p>To check which is best I have done these things:</p> <ol> <li><p>Fork the remote repo so...
<p>I have tried all the provided methods i.e. rebase and cherry-pick. I here to provide full information about both the methods tried and things done by me, to help to understand things with better view</p> <h2>Preparations</h2> <p>To check which is best I have done these things:</p> <ol> <li><p>Fork the remote repo so...
119
git
<h1>Git - Remove in between commit</h1> <p>Our team is doing several projects in PHP. We have wrongly committed a folder of One Project to another. Now, we want to remove that particular commit from the Project. If we remove the particular folder/commit from the project then there is no issue for our project.</p> <p>If...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,218
git
# Git - Remove in between commit Our team is doing several projects in PHP. We have wrongly committed a folder of One Project to another. Now, we want to remove that particular commit from the Project. If we remove the particular folder/commit from the project then there is no issue for our project. If we just remove...
I have tried all the provided methods i.e. rebase and cherry-pick. I here to provide full information about both the methods tried and things done by me, to help to understand things with better view ## Preparations To check which is best I have done these things: 1. Fork the remote repo so that the original would b...
5164418
Why does git commit after a merge by default?
24
2011-03-02 07:05:56
<p>I'm curious about this behavior and maybe its just because I've come from using SVN and bazaar mostly. (I'm learning git to interface with the excellent github.)</p> <p>It seems counter intuitive to me and as if it would be better for </p> <p><code>git merge [branch] --no-commit</code></p> <p>to be the default to...
15,372
511,710
2012-07-03 18:27:20
5,164,515
28
2011-03-02 07:19:21
6,309
2012-07-03 18:27:20
https://stackoverflow.com/q/5164418
https://stackoverflow.com/a/5164515
<p>The goal set by Linus Torvalds when creating Git was to make all the merges that could be automatically solved... <strong>FAST</strong>. See his <a href="https://git.wiki.kernel.org/index.php/LinusTalk200705Transcript" rel="noreferrer">2007 Google Tech Talk: Linus Torvalds on Git (transcript)</a><br> I.e. hundreds o...
<p>The goal set by Linus Torvalds when creating Git was to make all the merges that could be automatically solved... <strong>FAST</strong>. See his <a href="https://git.wiki.kernel.org/index.php/LinusTalk200705Transcript" rel="noreferrer">2007 Google Tech Talk: Linus Torvalds on Git (transcript)</a><br> I.e. hundreds o...
119, 717
git, merge
<h1>Why does git commit after a merge by default?</h1> <p>I'm curious about this behavior and maybe its just because I've come from using SVN and bazaar mostly. (I'm learning git to interface with the excellent github.)</p> <p>It seems counter intuitive to me and as if it would be better for </p> <p><code>git merge [...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,220
git
# Why does git commit after a merge by default? I'm curious about this behavior and maybe its just because I've come from using SVN and bazaar mostly. (I'm learning git to interface with the excellent github.) It seems counter intuitive to me and as if it would be better for `git merge [branch] --no-commit` to be t...
The goal set by Linus Torvalds when creating Git was to make all the merges that could be automatically solved... **FAST**. See his [2007 Google Tech Talk: Linus Torvalds on Git (transcript)](https://git.wiki.kernel.org/index.php/LinusTalk200705Transcript) I.e. hundreds of merges in less than a few seconds. So a "`-...
32940679
How do I git "subtree split" but maintain the full folder hierarchy?
23
2015-10-05 03:01:34
<p>I've been attempting to detatch a project sub-library into a new repo, but I want to detatch the full folder path, not just the target folder down.</p> <p>When I filter, the resulting folder structure is parented from the target folder rather than the repository root (or an ancestor I specify) which effectively bre...
20,666
531,194
2022-03-11 09:14:57
32,946,929
28
2015-10-05 10:57:50
1,057,909
2022-03-11 09:14:57
https://stackoverflow.com/q/32940679
https://stackoverflow.com/a/32946929
<p><code>git subtree split</code> doesn't appear to offer an option for what you want (but it sounds useful so maybe you could contribute one to the project!)</p> <p>So, there's two ways to do this, depending what you want.</p> <H1>1) Export a single directory (simpler option)</H1> <p>This takes advantage of the fact y...
<p><code>git subtree split</code> doesn't appear to offer an option for what you want (but it sounds useful so maybe you could contribute one to the project!)</p> <p>So, there's two ways to do this, depending what you want.</p> <H1>1) Export a single directory (simpler option)</H1> <p>This takes advantage of the fact y...
119
git
<h1>How do I git "subtree split" but maintain the full folder hierarchy?</h1> <p>I've been attempting to detatch a project sub-library into a new repo, but I want to detatch the full folder path, not just the target folder down.</p> <p>When I filter, the resulting folder structure is parented from the target folder ra...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,221
git
# How do I git "subtree split" but maintain the full folder hierarchy? I've been attempting to detatch a project sub-library into a new repo, but I want to detatch the full folder path, not just the target folder down. When I filter, the resulting folder structure is parented from the target folder rather than the re...
`git subtree split` doesn't appear to offer an option for what you want (but it sounds useful so maybe you could contribute one to the project!) So, there's two ways to do this, depending what you want. # 1) Export a single directory (simpler option) This takes advantage of the fact you want to move to another repo,...
20954566
What is the difference from HEAD, HEAD^, and HEAD~1?
23
2014-01-06 16:31:11
<p>In git, what is the difference between the following?</p> <ul> <li><code>HEAD</code></li> <li><code>HEAD^</code></li> <li><code>HEAD~1</code></li> <li><code>HEAD~2</code></li> </ul> <p>And how do they relate to <code>master</code>? So is there a <code>MASTER^</code>, <code>MASTER~1</code>??</p>
7,278
1,642,231
2014-01-06 16:52:39
20,954,945
28
2014-01-06 16:49:43
123,109
2014-01-06 16:49:43
https://stackoverflow.com/q/20954566
https://stackoverflow.com/a/20954945
<p><code>HEAD</code> is a synonym for the most recent commit on your current branch, whatever it is.</p> <p><code>HEAD^</code> (or <code>HEAD^1</code>) means the first parent of <code>HEAD</code>. A merge commit has multiple parents, so <code>HEAD^2</code> refers to the second <em>immediate</em> parent of <code>HEAD</...
<p><code>HEAD</code> is a synonym for the most recent commit on your current branch, whatever it is.</p> <p><code>HEAD^</code> (or <code>HEAD^1</code>) means the first parent of <code>HEAD</code>. A merge commit has multiple parents, so <code>HEAD^2</code> refers to the second <em>immediate</em> parent of <code>HEAD</...
119
git
<h1>What is the difference from HEAD, HEAD^, and HEAD~1?</h1> <p>In git, what is the difference between the following?</p> <ul> <li><code>HEAD</code></li> <li><code>HEAD^</code></li> <li><code>HEAD~1</code></li> <li><code>HEAD~2</code></li> </ul> <p>And how do they relate to <code>master</code>? So is there a <code>M...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,222
git
# What is the difference from HEAD, HEAD^, and HEAD~1? In git, what is the difference between the following? - `HEAD` - `HEAD^` - `HEAD~1` - `HEAD~2` And how do they relate to `master`? So is there a `MASTER^`, `MASTER~1`??
`HEAD` is a synonym for the most recent commit on your current branch, whatever it is. `HEAD^` (or `HEAD^1`) means the first parent of `HEAD`. A merge commit has multiple parents, so `HEAD^2` refers to the second *immediate* parent of `HEAD` that was involved in the merge that created `HEAD`. `HEAD~1` is the same as ...
14093540
tell git to use ours merge strategy on specific files
23
2012-12-30 18:48:34
<p>I have the following directory structure:</p> <pre><code>/.git /.git/info/attributes /MyProject /MyProject/pom.xml /MyProject/MyCode.java </code></pre> <p>I have branch master and bugfix. On both branches pom.xml and MyCode.java were modified. i would like to merge changes from bugfix to master only for MyCode.jav...
17,762
1,731,475
2025-06-02 15:53:57
14,099,431
28
2012-12-31 08:40:49
1,290,731
2023-07-28 20:07:57
https://stackoverflow.com/q/14093540
https://stackoverflow.com/a/14099431
<p>For locally-modified files:</p> <pre><code>$ git config merge.ours.driver true </code></pre> <p>or even</p> <pre><code>$ git config --global merge.ours.driver true </code></pre> <p>'ours' isn't one of the built-in merge drivers even though it's perfectly clear to you and me what it should do, and it seems git doesn'...
<p>For locally-modified files:</p> <pre><code>$ git config merge.ours.driver true </code></pre> <p>or even</p> <pre><code>$ git config --global merge.ours.driver true </code></pre> <p>'ours' isn't one of the built-in merge drivers even though it's perfectly clear to you and me what it should do, and it seems git doesn'...
119, 28897
git, git-merge
<h1>tell git to use ours merge strategy on specific files</h1> <p>I have the following directory structure:</p> <pre><code>/.git /.git/info/attributes /MyProject /MyProject/pom.xml /MyProject/MyCode.java </code></pre> <p>I have branch master and bugfix. On both branches pom.xml and MyCode.java were modified. i would ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,223
git
# tell git to use ours merge strategy on specific files I have the following directory structure: ``` /.git /.git/info/attributes /MyProject /MyProject/pom.xml /MyProject/MyCode.java ``` I have branch master and bugfix. On both branches pom.xml and MyCode.java were modified. i would like to merge changes from bugfix...
For locally-modified files: ``` $ git config merge.ours.driver true ``` or even ``` $ git config --global merge.ours.driver true ``` 'ours' isn't one of the built-in merge drivers even though it's perfectly clear to you and me what it should do, and it seems git doesn't error out when a custom merge driver is undef...
2458055
Reference Git branch start commit
23
2010-03-16 20:53:09
<p>I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked.</p> <p>Moreover I expect it work for history made from svn repo.</p> <p><a href="https://stackoverflow.com/questions/1006775/git-how-to-reference-the-initial-commit/1007545#1007545">This post</a>...
6,827
293,502
2022-03-30 19:46:39
2,458,173
28
2010-03-16 21:10:46
119,963
2022-03-30 19:46:39
https://stackoverflow.com/q/2458055
https://stackoverflow.com/a/2458173
<p>What you're looking for is the command <code>merge-base</code>:</p> <pre><code>git merge-base master feature-branch </code></pre> <p>will print the best common ancestor of those two branches, i.e. where they forked apart. (The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge-base.html" rel="nofollo...
<p>What you're looking for is the command <code>merge-base</code>:</p> <pre><code>git merge-base master feature-branch </code></pre> <p>will print the best common ancestor of those two branches, i.e. where they forked apart. (The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge-base.html" rel="nofollo...
119, 5036, 5597
commit, git, reference
<h1>Reference Git branch start commit</h1> <p>I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked.</p> <p>Moreover I expect it work for history made from svn repo.</p> <p><a href="https://stackoverflow.com/questions/1006775/git-how-to-reference-the-in...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,224
git
# Reference Git branch start commit I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked. Moreover I expect it work for history made from svn repo. [This post](https://stackoverflow.com/questions/1006775/git-how-to-reference-the-initial-commit/1007545...
What you're looking for is the command `merge-base`: ``` git merge-base master feature-branch ``` will print the best common ancestor of those two branches, i.e. where they forked apart. (The [documentation](http://www.kernel.org/pub/software/scm/git/docs/git-merge-base.html) has pretty pretty pictures to clarify som...
493450
amending a single file in a past commit in git
23
2009-01-29 21:13:24
<p>I want to fix a file in past commit. This might affect all ascending commits.</p> <p>Is there an easy way to do that?</p> <p>Many times when I commit twice I find that I've had error in the first commit, and I wish to fix the error without having to <code>git reset</code> my last good commit.</p> <p>For clarificatio...
12,261
55,094
2022-05-13 18:51:00
493,493
28
2009-01-29 21:22:49
51,831
2009-02-01 00:23:11
https://stackoverflow.com/q/493450
https://stackoverflow.com/a/493493
<p>If you only want to amend the second to last commit (eg. not long ago, especially not before many branches and merges), then I use this procedure:</p> <ol> <li><code>git checkout -b tmp bad-commit</code></li> <li>fix the files</li> <li><code>git commit --amend</code></li> <li><code>git rebase tmp master</code></li>...
<p>If you only want to amend the second to last commit (eg. not long ago, especially not before many branches and merges), then I use this procedure:</p> <ol> <li><code>git checkout -b tmp bad-commit</code></li> <li>fix the files</li> <li><code>git commit --amend</code></li> <li><code>git rebase tmp master</code></li>...
119
git
<h1>amending a single file in a past commit in git</h1> <p>I want to fix a file in past commit. This might affect all ascending commits.</p> <p>Is there an easy way to do that?</p> <p>Many times when I commit twice I find that I've had error in the first commit, and I wish to fix the error without having to <code>git r...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,225
git
# amending a single file in a past commit in git I want to fix a file in past commit. This might affect all ascending commits. Is there an easy way to do that? Many times when I commit twice I find that I've had error in the first commit, and I wish to fix the error without having to `git reset` my last good commit....
If you only want to amend the second to last commit (eg. not long ago, especially not before many branches and merges), then I use this procedure: 1. `git checkout -b tmp bad-commit` 2. fix the files 3. `git commit --amend` 4. `git rebase tmp master` If you have merges in between, you may wanna try `rebase -i -p`, bu...
48786593
Regular fonts for git-gui and gitk have disappeared
21
2018-02-14 11:53:31
<p>I'm on Ubuntu 16.04. Recently, the fonts in my git-gui and gitk have suddenly changed. I have tried the other fonts proposed but none of them correspond to the previous one that I was used to.</p> <p>This is what it looked before the bug (taken from the web) :</p> <p><a href="https://i.sstatic.net/IuB9p.png" rel="...
3,009
4,195,725
2025-02-10 10:55:26
51,037,685
28
2018-06-26 07:53:43
4,195,725
2018-10-23 22:29:39
https://stackoverflow.com/q/48786593
https://stackoverflow.com/a/51037685
<p><strong>UPDATE</strong></p> <p>I finally figured out where this is coming from, and it's because of the Anaconda environment.</p> <p><code>git-gui</code> and <code>gitk</code> use <code>Tcl/Tk</code> and <code>tkinter</code> as a GUI library, and as mentionned <a href="https://stackoverflow.com/a/47787749/4195725"...
<p><strong>UPDATE</strong></p> <p>I finally figured out where this is coming from, and it's because of the Anaconda environment.</p> <p><code>git-gui</code> and <code>gitk</code> use <code>Tcl/Tk</code> and <code>tkinter</code> as a GUI library, and as mentionned <a href="https://stackoverflow.com/a/47787749/4195725"...
30785, 33729
git-gui, gitk
<h1>Regular fonts for git-gui and gitk have disappeared</h1> <p>I'm on Ubuntu 16.04. Recently, the fonts in my git-gui and gitk have suddenly changed. I have tried the other fonts proposed but none of them correspond to the previous one that I was used to.</p> <p>This is what it looked before the bug (taken from the w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,228
git
# Regular fonts for git-gui and gitk have disappeared I'm on Ubuntu 16.04. Recently, the fonts in my git-gui and gitk have suddenly changed. I have tried the other fonts proposed but none of them correspond to the previous one that I was used to. This is what it looked before the bug (taken from the web) : [![enter ...
**UPDATE** I finally figured out where this is coming from, and it's because of the Anaconda environment. `git-gui` and `gitk` use `Tcl/Tk` and `tkinter` as a GUI library, and as mentionned [in this answer](https://stackoverflow.com/a/47787749/4195725): > `tkinter` works linking to a Tk/Tcl interpreter that, loosely...
48458567
How to commit changes to Git repository anonymously
21
2018-01-26 09:23:06
<p>I have an empty git repository (hosted on GitHub or wherever).</p> <p>I want to commit my changes to it <em>anonymously</em> like the below picture. How should I setup my git configuration (preferably project specific config) to achieve that?</p> <p><img src="https://i.sstatic.net/f1WKn.jpg" alt="below picture"></...
12,771
550,478
2018-01-26 09:38:35
48,458,633
28
2018-01-26 09:28:21
2,618,670
2018-01-26 09:28:21
https://stackoverflow.com/q/48458567
https://stackoverflow.com/a/48458633
<p>From inside your local git repository;</p> <pre><code>git config user.name 'Anonymous' git config user.email '&lt;&gt;' </code></pre>
<p>From inside your local git repository;</p> <pre><code>git config user.name 'Anonymous' git config user.email '&lt;&gt;' </code></pre>
119, 53850
git, git-commit
<h1>How to commit changes to Git repository anonymously</h1> <p>I have an empty git repository (hosted on GitHub or wherever).</p> <p>I want to commit my changes to it <em>anonymously</em> like the below picture. How should I setup my git configuration (preferably project specific config) to achieve that?</p> <p><img...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,229
git
# How to commit changes to Git repository anonymously I have an empty git repository (hosted on GitHub or wherever). I want to commit my changes to it *anonymously* like the below picture. How should I setup my git configuration (preferably project specific config) to achieve that? ![below picture](https://i.sstatic...
From inside your local git repository; ``` git config user.name 'Anonymous' git config user.email '<>' ```
38905973
Switch node_modules folder when I change git branch
21
2016-08-11 20:54:23
<p>I'm working with two branches, <code>master</code> and <code>feature-1</code></p> <p>In the master branch I'm using a lib <code>xyz@1.0</code></p> <p>In the branch <code>feature-1</code> I've installed a new version from lib <code>xyz</code> version <code>2.0</code></p> <p><code>feature-1</code> was not merged y...
4,669
6,563,219
2024-10-02 16:48:56
38,907,126
28
2016-08-11 22:33:38
717,372
2024-10-02 16:48:56
https://stackoverflow.com/q/38905973
https://stackoverflow.com/a/38907126
<p>You do things well with git and each time you switch, you have to do your <code>npm i</code>.</p> <p>But perhaps if you switch very often from one branch to the other, you should think about using <a href="https://git-scm.com/docs/git-worktree" rel="nofollow noreferrer">git worktree</a> introduced in some recent git...
<p>You do things well with git and each time you switch, you have to do your <code>npm i</code>.</p> <p>But perhaps if you switch very often from one branch to the other, you should think about using <a href="https://git-scm.com/docs/git-worktree" rel="nofollow noreferrer">git worktree</a> introduced in some recent git...
119, 1879, 46426, 78230
branch, git, node.js, node-modules
<h1>Switch node_modules folder when I change git branch</h1> <p>I'm working with two branches, <code>master</code> and <code>feature-1</code></p> <p>In the master branch I'm using a lib <code>xyz@1.0</code></p> <p>In the branch <code>feature-1</code> I've installed a new version from lib <code>xyz</code> version <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,230
git
# Switch node_modules folder when I change git branch I'm working with two branches, `master` and `feature-1` In the master branch I'm using a lib `xyz@1.0` In the branch `feature-1` I've installed a new version from lib `xyz` version `2.0` `feature-1` was not merged yet on `master` branch, because it's not done. T...
You do things well with git and each time you switch, you have to do your `npm i`. But perhaps if you switch very often from one branch to the other, you should think about using [git worktree](https://git-scm.com/docs/git-worktree) introduced in some recent git versions and **which permit to have another branch check...
30578611
git config --global core.filemode false does not work with git diff
21
2015-06-01 16:31:28
<p>I have set </p> <pre><code> git config --global core.filemode false </code></pre> <p>And checked that my config is ok with <code>git config -l</code></p> <pre><code>... core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.ignorecase=true core.autocrlf=false ... </code...
7,549
2,612,235
2015-06-01 16:45:48
30,578,837
28
2015-06-01 16:44:44
6,309
2015-06-01 16:45:48
https://stackoverflow.com/q/30578611
https://stackoverflow.com/a/30578837
<p>Make sure you don't have multiple entries of that setting and set it locally instead of globally:</p> <pre><code>git config --global --unset-all core.filemode git config --unset-all core.filemode git config core.filemode false </code></pre>
<p>Make sure you don't have multiple entries of that setting and set it locally instead of globally:</p> <pre><code>git config --global --unset-all core.filemode git config --unset-all core.filemode git config core.filemode false </code></pre>
119
git
<h1>git config --global core.filemode false does not work with git diff</h1> <p>I have set </p> <pre><code> git config --global core.filemode false </code></pre> <p>And checked that my config is ok with <code>git config -l</code></p> <pre><code>... core.repositoryformatversion=0 core.filemode=false core.bare=false c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,231
git
# git config --global core.filemode false does not work with git diff I have set ``` git config --global core.filemode false ``` And checked that my config is ok with `git config -l` ``` ... core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.ignorecase=true core.auto...
Make sure you don't have multiple entries of that setting and set it locally instead of globally: ``` git config --global --unset-all core.filemode git config --unset-all core.filemode git config core.filemode false ```
21569406
How does one `git log` tagged commits only?
21
2014-02-05 05:35:34
<p>I'd like to <code>git log</code> all the tagged commits on the master branch (and none of the untagged commits). Is this possible?</p>
7,403
312,785
2025-08-01 17:58:41
21,570,658
28
2014-02-05 07:03:59
1,256,452
2014-02-05 07:03:59
https://stackoverflow.com/q/21569406
https://stackoverflow.com/a/21570658
<p>The secret trick to this is to realize that <code>git log</code> uses the same rules as <code>git rev-list</code>. The latter command has a <code>--tags</code> flag to look at tags. So, as with the other answers so far, if you're willing to look at <em>all</em> tagged commits, this single command will do it:</p> ...
<p>The secret trick to this is to realize that <code>git log</code> uses the same rules as <code>git rev-list</code>. The latter command has a <code>--tags</code> flag to look at tags. So, as with the other answers so far, if you're willing to look at <em>all</em> tagged commits, this single command will do it:</p> ...
119
git
<h1>How does one `git log` tagged commits only?</h1> <p>I'd like to <code>git log</code> all the tagged commits on the master branch (and none of the untagged commits). Is this possible?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,232
git
# How does one `git log` tagged commits only? I'd like to `git log` all the tagged commits on the master branch (and none of the untagged commits). Is this possible?
The secret trick to this is to realize that `git log` uses the same rules as `git rev-list`. The latter command has a `--tags` flag to look at tags. So, as with the other answers so far, if you're willing to look at *all* tagged commits, this single command will do it: ``` git log --no-walk --tags ``` (The `--no-walk...
21394563
Removing sensitive data from Git. "fatal: ambiguous argument 'rm'"
21
2014-01-28 00:23:26
<p>I'm trying to run this command:</p> <pre><code>git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch filename.js' --prune-empty --tag-name-filter cat -- --all </code></pre> <p>but I keep getting this error:</p> <pre><code>fatal: ambiguous argument 'rm': unknown revision or path not in the wor...
7,425
363,004
2022-03-10 10:13:08
21,399,771
28
2014-01-28 07:52:12
6,309
2019-05-30 22:55:11
https://stackoverflow.com/q/21394563
https://stackoverflow.com/a/21399771
<p>It depends on the shell you are using.<br> On Windows, with msysgit for instance, see <a href="https://code.google.com/p/msysgit/issues/detail?id=477#c12" rel="noreferrer">issue 477</a>:</p> <blockquote> <p>Single quotes do not have a special meaning with CMD. Do not expect that they work the same as with a PO...
<p>It depends on the shell you are using.<br> On Windows, with msysgit for instance, see <a href="https://code.google.com/p/msysgit/issues/detail?id=477#c12" rel="noreferrer">issue 477</a>:</p> <blockquote> <p>Single quotes do not have a special meaning with CMD. Do not expect that they work the same as with a PO...
58, 119, 105171
ambiguous-grammar, git, linux
<h1>Removing sensitive data from Git. "fatal: ambiguous argument 'rm'"</h1> <p>I'm trying to run this command:</p> <pre><code>git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch filename.js' --prune-empty --tag-name-filter cat -- --all </code></pre> <p>but I keep getting this error:</p> <pre><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,233
git
# Removing sensitive data from Git. "fatal: ambiguous argument 'rm'" I'm trying to run this command: ``` git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch filename.js' --prune-empty --tag-name-filter cat -- --all ``` but I keep getting this error: ``` fatal: ambiguous argument 'rm': unknown...
It depends on the shell you are using. On Windows, with msysgit for instance, see [issue 477](https://code.google.com/p/msysgit/issues/detail?id=477#c12): > Single quotes do not have a special meaning with CMD. Do not expect that they work > the same as with a POSIX shell. Call filter-branch like this: ``` git filt...
14927827
Rewind remote to a prior commit
21
2013-02-18 00:32:53
<p>As a junior git user, I got overwhelmed by a tough merge and must have done something wrong. I ended up committing my conflict resolutions with a whole mess of garbage inside my source files. The commit shows additions of many lines which look like <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD</code> and <code>&gt;&gt;&gt...
22,957
56,998
2013-02-18 00:54:34
14,927,845
28
2013-02-18 00:34:43
785,065
2013-02-18 00:54:34
https://stackoverflow.com/q/14927827
https://stackoverflow.com/a/14927845
<p><code>checkout</code> moves your current working directory to a previous commit, but it does not modify branch contents. You need to reset the branch back to an old commit, and then push that.</p> <pre><code>git checkout ... git reset --hard 4a3ba7 git push -f </code></pre> <p>that said, if you are already <code>p...
<p><code>checkout</code> moves your current working directory to a previous commit, but it does not modify branch contents. You need to reset the branch back to an old commit, and then push that.</p> <pre><code>git checkout ... git reset --hard 4a3ba7 git push -f </code></pre> <p>that said, if you are already <code>p...
119
git
<h1>Rewind remote to a prior commit</h1> <p>As a junior git user, I got overwhelmed by a tough merge and must have done something wrong. I ended up committing my conflict resolutions with a whole mess of garbage inside my source files. The commit shows additions of many lines which look like <code>&lt;&lt;&lt;&lt;&lt;&...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,234
git
# Rewind remote to a prior commit As a junior git user, I got overwhelmed by a tough merge and must have done something wrong. I ended up committing my conflict resolutions with a whole mess of garbage inside my source files. The commit shows additions of many lines which look like `<<<<<<< HEAD` and `>>>>>>> a7b4de79...
`checkout` moves your current working directory to a previous commit, but it does not modify branch contents. You need to reset the branch back to an old commit, and then push that. ``` git checkout ... git reset --hard 4a3ba7 git push -f ``` that said, if you are already `push -f`ing to change only the most recent c...
20238883
Git Diff and Meld on Windows
20
2013-11-27 09:45:32
<p>Has anyone ever made Meld work with Git on Windows? I am trying to make it work and I have no success. </p> <p>I have Meld installed and when I call it from the command line with two files as parameters it diffs them well so Meld is installed correctly. However I can't make it work with Git (Git Diff). I use versio...
25,722
1,007,758
2020-07-01 10:21:15
20,401,270
28
2013-12-05 13:27:30
6,309
2019-02-16 09:23:32
https://stackoverflow.com/q/20238883
https://stackoverflow.com/a/20401270
<p>Usually, you can find an example on Windows similar to <a href="https://gist.github.com/tacsio/898911" rel="noreferrer">this gist</a>, with meld.exe being in your <code>PATH</code>):</p> <pre><code>git config --global merge.tool meld git config --global mergetool.meld.cmd 'meld.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" ...
<p>Usually, you can find an example on Windows similar to <a href="https://gist.github.com/tacsio/898911" rel="noreferrer">this gist</a>, with meld.exe being in your <code>PATH</code>):</p> <pre><code>git config --global merge.tool meld git config --global mergetool.meld.cmd 'meld.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" ...
119, 9033, 13630, 21628, 33608
difftool, git, git-diff, meld, msysgit
<h1>Git Diff and Meld on Windows</h1> <p>Has anyone ever made Meld work with Git on Windows? I am trying to make it work and I have no success. </p> <p>I have Meld installed and when I call it from the command line with two files as parameters it diffs them well so Meld is installed correctly. However I can't make it ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,235
git
# Git Diff and Meld on Windows Has anyone ever made Meld work with Git on Windows? I am trying to make it work and I have no success. I have Meld installed and when I call it from the command line with two files as parameters it diffs them well so Meld is installed correctly. However I can't make it work with Git (Gi...
Usually, you can find an example on Windows similar to [this gist](https://gist.github.com/tacsio/898911), with meld.exe being in your `PATH`): ``` git config --global merge.tool meld git config --global mergetool.meld.cmd 'meld.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"' git config --global diff.tool meld git ...
6547199
git log since yesterday for working days only
20
2011-07-01 11:12:12
<p>For my daily standups I like to output my commits for a refresher of what I was working on.</p> <p>I have the following alias:</p> <pre><code>standup = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(green)&lt;%an&gt;%Creset' --abbrev-commit --date=relative --committer='me' --al...
2,794
470,112
2015-04-09 10:09:10
6,547,271
28
2011-07-01 11:19:33
85,371
2013-04-28 21:59:56
https://stackoverflow.com/q/6547199
https://stackoverflow.com/a/6547271
<p>Assuming a POSIX-y shell, in my case bash:</p> <pre><code>function yesterworkday() { if [[ "1" == "$(date +%u)" ]] then echo "last friday" else echo "yesterday" fi } git log --since="$(yesterworkday)" </code></pre> <p>Again all credits go to the authors of <code>git</code> for m...
<p>Assuming a POSIX-y shell, in my case bash:</p> <pre><code>function yesterworkday() { if [[ "1" == "$(date +%u)" ]] then echo "last friday" else echo "yesterday" fi } git log --since="$(yesterworkday)" </code></pre> <p>Again all credits go to the authors of <code>git</code> for m...
119, 508, 942
agile, git, logging
<h1>git log since yesterday for working days only</h1> <p>For my daily standups I like to output my commits for a refresher of what I was working on.</p> <p>I have the following alias:</p> <pre><code>standup = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(green)&lt;%an&gt;%Creset...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,237
git
# git log since yesterday for working days only For my daily standups I like to output my commits for a refresher of what I was working on. I have the following alias: ``` standup = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(green)<%an>%Creset' --abbrev-commit --date=relative...
Assuming a POSIX-y shell, in my case bash: ``` function yesterworkday() { if [[ "1" == "$(date +%u)" ]] then echo "last friday" else echo "yesterday" fi } git log --since="$(yesterworkday)" ``` Again all credits go to the authors of `git` for making this insanely easy *by accepting...
4883453
Seamless git svn setup
20
2011-02-03 07:28:49
<p>I am a power git user and a happy one at that.</p> <p>Now, I'm forced to use svn and I am not exactly happy to do so. Not so comfortable using <code>git svn</code> yet.</p> <p>So, here is the setup I'd like and want.</p> <ul> <li>I use a git repo, that is git in all ways with many local branches.</li> <li>I creat...
5,172
55,562
2015-09-05 21:35:37
4,884,993
28
2011-02-03 10:30:03
590,761
2015-09-05 21:35:37
https://stackoverflow.com/q/4883453
https://stackoverflow.com/a/4884993
<p>see <a href="https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git">this question</a> for a introduction to <code>git svn branch</code> and <a href="https://stackoverflow.com/questions/1839606/delete-a-svn-branch-via-git">that question</a> for how to delete remote branches - or...
<p>see <a href="https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git">this question</a> for a introduction to <code>git svn branch</code> and <a href="https://stackoverflow.com/questions/1839606/delete-a-svn-branch-via-git">that question</a> for how to delete remote branches - or...
63, 119, 456, 6452
git, git-svn, svn, version-control
<h1>Seamless git svn setup</h1> <p>I am a power git user and a happy one at that.</p> <p>Now, I'm forced to use svn and I am not exactly happy to do so. Not so comfortable using <code>git svn</code> yet.</p> <p>So, here is the setup I'd like and want.</p> <ul> <li>I use a git repo, that is git in all ways with many ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,238
git
# Seamless git svn setup I am a power git user and a happy one at that. Now, I'm forced to use svn and I am not exactly happy to do so. Not so comfortable using `git svn` yet. So, here is the setup I'd like and want. - I use a git repo, that is git in all ways with many local branches. - I create multiple branches ...
see [this question](https://stackoverflow.com/questions/266395/git-svn-how-do-i-create-a-new-svn-branch-via-git) for a introduction to `git svn branch` and [that question](https://stackoverflow.com/questions/1839606/delete-a-svn-branch-via-git) for how to delete remote branches - or below for a complete summary of the ...
2159567
What is the format of an authors file for git svn, specifically for special characters like backslash or underscore?
20
2010-01-29 02:43:26
<p>I am trying to clone <a href="http://papercut.codeplex.com/" rel="noreferrer">Papercut, an smtp server emulator</a></p> <p>I'm getting the list of SVN authors with <code>svn log -q https://papercut.svn.codeplex.com/svn | grep -e '^r'| awk 'BEGIN {FS="|"};{print $2}'|sort|uniq</code> which is giving me</p> <pre><co...
37,271
28,445
2019-09-11 15:58:02
2,159,652
28
2010-01-29 03:11:09
28,804
2010-01-29 04:31:42
https://stackoverflow.com/q/2159567
https://stackoverflow.com/a/2159652
<p>I hate to be "that guy", but I just gave it a try and it worked fine for me. Here's the copy of the authors file I used:</p> <pre><code>RNO\_MCLWEB = Ronald McDonald &lt;dude@example.com&gt; SND\krobertson_cp = Some Guy &lt;someone@example.com&gt; </code></pre> <p>I did, however, use a slightly different method th...
<p>I hate to be "that guy", but I just gave it a try and it worked fine for me. Here's the copy of the authors file I used:</p> <pre><code>RNO\_MCLWEB = Ronald McDonald &lt;dude@example.com&gt; SND\krobertson_cp = Some Guy &lt;someone@example.com&gt; </code></pre> <p>I did, however, use a slightly different method th...
119, 3429, 6452
codeplex, git, git-svn
<h1>What is the format of an authors file for git svn, specifically for special characters like backslash or underscore?</h1> <p>I am trying to clone <a href="http://papercut.codeplex.com/" rel="noreferrer">Papercut, an smtp server emulator</a></p> <p>I'm getting the list of SVN authors with <code>svn log -q https://p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,239
git
# What is the format of an authors file for git svn, specifically for special characters like backslash or underscore? I am trying to clone [Papercut, an smtp server emulator](http://papercut.codeplex.com/) I'm getting the list of SVN authors with `svn log -q https://papercut.svn.codeplex.com/svn | grep -e '^r'| awk ...
I hate to be "that guy", but I just gave it a try and it worked fine for me. Here's the copy of the authors file I used: ``` RNO\_MCLWEB = Ronald McDonald <dude@example.com> SND\krobertson_cp = Some Guy <someone@example.com> ``` I did, however, use a slightly different method than you did to generate author names, fo...
832222
Why is git pushing to two branches in this git push?
20
2009-05-06 23:04:15
<p>What would possibly cause a 'git push' to try and commit to two branches? I have my own branch I'm working on, which is on the shared repo... and a master branch. Right now I just wanted to push to my personal branch which went through just fine, but it also tried to push to master and got rejected. Looked something...
9,498
40,882
2009-05-07 17:23:51
832,231
28
2009-05-06 23:07:00
62,130
2009-05-07 17:23:51
https://stackoverflow.com/q/832222
https://stackoverflow.com/a/832231
<p>When using <code>git push</code> without any arguments, it will push all local branches that have a corresponding remote branch with the same name. Since your local repository has branches <code>master</code>and <code>mybranch</code>, and also the remote repository has branches <code>master</code>and <code>mybranch<...
<p>When using <code>git push</code> without any arguments, it will push all local branches that have a corresponding remote branch with the same name. Since your local repository has branches <code>master</code>and <code>mybranch</code>, and also the remote repository has branches <code>master</code>and <code>mybranch<...
119, 456
git, version-control
<h1>Why is git pushing to two branches in this git push?</h1> <p>What would possibly cause a 'git push' to try and commit to two branches? I have my own branch I'm working on, which is on the shared repo... and a master branch. Right now I just wanted to push to my personal branch which went through just fine, but it a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,240
git
# Why is git pushing to two branches in this git push? What would possibly cause a 'git push' to try and commit to two branches? I have my own branch I'm working on, which is on the shared repo... and a master branch. Right now I just wanted to push to my personal branch which went through just fine, but it also tried...
When using `git push` without any arguments, it will push all local branches that have a corresponding remote branch with the same name. Since your local repository has branches `master`and `mybranch`, and also the remote repository has branches `master`and `mybranch`, then Git will push both of them. If you want to p...
62225567
Get current git branch with node.js
19
2020-06-05 23:36:14
<p>How can I get the current git branch with node.js without an external library? I need to be able to grab the current branch name to perform another function in my node file.</p> <p><strong>Update with partially working code</strong></p> <p>I'm able to get the branch name with this, but can't seem to log out a mess...
23,936
3,438,917
2023-06-15 05:51:28
62,228,183
28
2020-06-06 06:29:33
7,909,229
2020-06-06 07:03:18
https://stackoverflow.com/q/62225567
https://stackoverflow.com/a/62228183
<p>Please try this works</p> <pre><code>const { exec } = require('child_process'); exec('git rev-parse --abbrev-ref HEAD', (err, stdout, stderr) =&gt; { if (err) { // handle your error } if (typeof stdout === 'string' &amp;&amp; (stdout.trim() === 'master')) { console.log(`The branch is mast...
<p>Please try this works</p> <pre><code>const { exec } = require('child_process'); exec('git rev-parse --abbrev-ref HEAD', (err, stdout, stderr) =&gt; { if (err) { // handle your error } if (typeof stdout === 'string' &amp;&amp; (stdout.trim() === 'master')) { console.log(`The branch is mast...
119, 46426
git, node.js
<h1>Get current git branch with node.js</h1> <p>How can I get the current git branch with node.js without an external library? I need to be able to grab the current branch name to perform another function in my node file.</p> <p><strong>Update with partially working code</strong></p> <p>I'm able to get the branch nam...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,242
git
# Get current git branch with node.js How can I get the current git branch with node.js without an external library? I need to be able to grab the current branch name to perform another function in my node file. **Update with partially working code** I'm able to get the branch name with this, but can't seem to log o...
Please try this works ``` const { exec } = require('child_process'); exec('git rev-parse --abbrev-ref HEAD', (err, stdout, stderr) => { if (err) { // handle your error } if (typeof stdout === 'string' && (stdout.trim() === 'master')) { console.log(`The branch is master`); // Call your ...
52981111
How can I merge changes from an upstream branch to my fork's branch
19
2018-10-25 03:52:35
<p>I want to pull changes from an upstream repo's branch. I have set the upstream repo using: </p> <pre><code>git remote add upstream http://URL-of-master-repo.git </code></pre> <p>and then I tried to pull the changes using </p> <pre><code>git checkout my-local-branch git fetch upstream remote-branch git merge upst...
32,332
1,198,201
2024-04-11 13:07:25
52,981,214
28
2018-10-25 04:06:55
1,456,927
2018-10-25 04:06:55
https://stackoverflow.com/q/52981111
https://stackoverflow.com/a/52981214
<p>A good practice is to have this structure, which looks like you do, but is good to explain for clarification purposes:</p> <pre><code>origin https://github.com/your-username/forked-repository.git (fetch) origin https://github.com/your-username/forked-repository.git (push) upstream https://github.com/original-o...
<p>A good practice is to have this structure, which looks like you do, but is good to explain for clarification purposes:</p> <pre><code>origin https://github.com/your-username/forked-repository.git (fetch) origin https://github.com/your-username/forked-repository.git (push) upstream https://github.com/original-o...
119, 717, 33720
git, git-fetch, merge
<h1>How can I merge changes from an upstream branch to my fork's branch</h1> <p>I want to pull changes from an upstream repo's branch. I have set the upstream repo using: </p> <pre><code>git remote add upstream http://URL-of-master-repo.git </code></pre> <p>and then I tried to pull the changes using </p> <pre><code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,243
git
# How can I merge changes from an upstream branch to my fork's branch I want to pull changes from an upstream repo's branch. I have set the upstream repo using: ``` git remote add upstream http://URL-of-master-repo.git ``` and then I tried to pull the changes using ``` git checkout my-local-branch git fetch upstrea...
A good practice is to have this structure, which looks like you do, but is good to explain for clarification purposes: ``` origin https://github.com/your-username/forked-repository.git (fetch) origin https://github.com/your-username/forked-repository.git (push) upstream https://github.com/original-owner-username/...
15166932
Bitbucket git push as user
19
2013-03-01 21:10:34
<p>1) I create a new repo on bitbucket using the main TEAM user.</p> <p>2) Then i add all development keys that will be able to download this repo.</p> <p>3) Went to a server and made a clone of this repo using the command: </p> <pre><code>git clone ssh://git@bitbucket.org/user/repo.git </code></pre> <p>4) I made s...
23,601
71,577
2017-10-08 03:38:15
15,229,261
28
2013-03-05 16:37:14
316,950
2013-03-05 16:37:14
https://stackoverflow.com/q/15166932
https://stackoverflow.com/a/15229261
<p>You could always setup a second remote on your server using https:</p> <pre><code>git remote add edit-only-origin https://bitbucket.org/user/repo.git </code></pre> <p>Then, you could make small edits, commit and then use the command</p> <pre><code>git push edit-only-origin </code></pre> <p>This would prompt you ...
<p>You could always setup a second remote on your server using https:</p> <pre><code>git remote add edit-only-origin https://bitbucket.org/user/repo.git </code></pre> <p>Then, you could make small edits, commit and then use the command</p> <pre><code>git push edit-only-origin </code></pre> <p>This would prompt you ...
119, 8337
bitbucket, git
<h1>Bitbucket git push as user</h1> <p>1) I create a new repo on bitbucket using the main TEAM user.</p> <p>2) Then i add all development keys that will be able to download this repo.</p> <p>3) Went to a server and made a clone of this repo using the command: </p> <pre><code>git clone ssh://git@bitbucket.org/user/re...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
19,244
git
# Bitbucket git push as user 1) I create a new repo on bitbucket using the main TEAM user. 2) Then i add all development keys that will be able to download this repo. 3) Went to a server and made a clone of this repo using the command: ``` git clone ssh://git@bitbucket.org/user/repo.git ``` 4) I made some changes ...
You could always setup a second remote on your server using https: ``` git remote add edit-only-origin https://bitbucket.org/user/repo.git ``` Then, you could make small edits, commit and then use the command ``` git push edit-only-origin ``` This would prompt you for both your username and password.