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
2490794
Git-svn: create & push a new branch/tag?
60
2010-03-22 08:31:39
<p>After cloning an SVN repository using git-svn with the <code>-s</code> option (<code>git svn clone http://server/repo -s</code>), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when <code>dcommit</code>ing?</p> <p>For instance; if I were to use git to crea...
25,502
30,478
2018-06-26 15:33:45
2,524,745
74
2010-03-26 16:08:16
28,804
2010-03-26 16:08:16
https://stackoverflow.com/q/2490794
https://stackoverflow.com/a/2524745
<p>You can read all the nitty-gritty details in this <a href="http://trac.parrot.org/parrot/wiki/git-svn-tutorial#TrackingSVNbrancheswithGIT" rel="noreferrer">tutorial</a>, but the gist is basically the following:</p> <pre><code>$ git svn branch -m "Topic branch" my_topic # Create SVN branch called "my_topi...
<p>You can read all the nitty-gritty details in this <a href="http://trac.parrot.org/parrot/wiki/git-svn-tutorial#TrackingSVNbrancheswithGIT" rel="noreferrer">tutorial</a>, but the gist is basically the following:</p> <pre><code>$ git svn branch -m "Topic branch" my_topic # Create SVN branch called "my_topi...
119, 6452
git, git-svn
<h1>Git-svn: create & push a new branch/tag?</h1> <p>After cloning an SVN repository using git-svn with the <code>-s</code> option (<code>git svn clone http://server/repo -s</code>), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when <code>dcommit</code>ing?<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,505
git
# Git-svn: create & push a new branch/tag? After cloning an SVN repository using git-svn with the `-s` option (`git svn clone http://server/repo -s`), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when `dcommit`ing? For instance; if I were to use git to cre...
You can read all the nitty-gritty details in this [tutorial](http://trac.parrot.org/parrot/wiki/git-svn-tutorial#TrackingSVNbrancheswithGIT), but the gist is basically the following: ``` $ git svn branch -m "Topic branch" my_topic # Create SVN branch called "my_topic" $ git checkout --track -b my-topic remo...
1071241
How does git handle folder permission?
56
2009-07-01 20:31:23
<p>I'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode changes</p> <pre><code>#create a test repository with a folder with 777 mode :~$ mkdir -p test/folder :~$ touch test/folder/dummy.txt :~$ cd test :~/test$ chmod 777 folder/ #init git repository :~/test$ git init Initialized empty Git re...
58,744
111,785
2015-09-21 08:41:11
1,071,274
74
2009-07-01 20:38:46
19,563
2009-07-01 20:38:46
https://stackoverflow.com/q/1071241
https://stackoverflow.com/a/1071274
<p>The only 'permissions' bit that <code>git</code> tracks is the executable bit for files, the rest of the mode bits describe what type of file system object the object in each git tree is. <code>git</code> supports files and symlinks (blobs), directories (trees) and the submodules (commits).</p> <p><code>git</code> ...
<p>The only 'permissions' bit that <code>git</code> tracks is the executable bit for files, the rest of the mode bits describe what type of file system object the object in each git tree is. <code>git</code> supports files and symlinks (blobs), directories (trees) and the submodules (commits).</p> <p><code>git</code> ...
119, 218, 359, 5922
directory, git, mode, permissions
<h1>How does git handle folder permission?</h1> <p>I'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode changes</p> <pre><code>#create a test repository with a folder with 777 mode :~$ mkdir -p test/folder :~$ touch test/folder/dummy.txt :~$ cd test :~/test$ chmod 777 folder/ #init git repos...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,507
git
# How does git handle folder permission? I'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode changes ``` #create a test repository with a folder with 777 mode :~$ mkdir -p test/folder :~$ touch test/folder/dummy.txt :~$ cd test :~/test$ chmod 777 folder/ #init git repository :~/test$ git i...
The only 'permissions' bit that `git` tracks is the executable bit for files, the rest of the mode bits describe what type of file system object the object in each git tree is. `git` supports files and symlinks (blobs), directories (trees) and the submodules (commits). `git` is designed to help track source code acros...
1295171
Git: Merge to master while automatically choosing to overwrite master files with branch
50
2009-08-18 16:54:41
<p>I am using Git to track my documentation latex source. I want to keep the master branch full of documents that are suitable for end user release, so when someone needs something, i can just switch to the master branch, compile and hand out the document. </p> <p>I make new branches when a manual needs a major update...
47,252
136,407
2022-03-18 14:05:43
1,295,232
74
2009-08-18 17:04:31
92,584
2022-03-18 14:05:43
https://stackoverflow.com/q/1295171
https://stackoverflow.com/a/1295232
<p>To disregard <code>master</code>, when you have <code>branch</code> checked out then:</p> <pre><code>git merge master --strategy=ours </code></pre> <p><a href="http://schacon.github.com/git/git-merge.html" rel="noreferrer">http://schacon.github.com/git/git-merge.html</a></p> <p>As <strike>'Computer Linguist'</strike...
<p>To disregard <code>master</code>, when you have <code>branch</code> checked out then:</p> <pre><code>git merge master --strategy=ours </code></pre> <p><a href="http://schacon.github.com/git/git-merge.html" rel="noreferrer">http://schacon.github.com/git/git-merge.html</a></p> <p>As <strike>'Computer Linguist'</strike...
119, 717, 1879
branch, git, merge
<h1>Git: Merge to master while automatically choosing to overwrite master files with branch</h1> <p>I am using Git to track my documentation latex source. I want to keep the master branch full of documents that are suitable for end user release, so when someone needs something, i can just switch to the master branch, c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,508
git
# Git: Merge to master while automatically choosing to overwrite master files with branch I am using Git to track my documentation latex source. I want to keep the master branch full of documents that are suitable for end user release, so when someone needs something, i can just switch to the master branch, compile an...
To disregard `master`, when you have `branch` checked out then: ``` git merge master --strategy=ours ``` <http://schacon.github.com/git/git-merge.html> As 'Computer Linguist' [Lilith River](https://stackoverflow.com/users/166893/lilith-river) commented, this will "ignore everything from 'master', even if it has chan...
7463392
Switching a branch after aborting current changes in git
47
2011-09-18 18:15:35
<p>I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a different branch. However, it stops me from switching because there are uncommitted changes. How do I ignore them without stashing them either? ...
70,582
429,850
2020-08-28 11:57:25
7,463,408
74
2011-09-18 18:17:58
85,371
2011-09-18 18:17:58
https://stackoverflow.com/q/7463392
https://stackoverflow.com/a/7463408
<p>Option 1</p> <pre><code>git checkout -f gh-pages </code></pre> <p>Option 2</p> <pre><code>git reset --hard # beware: don't make that a habit git checkout gh-pages </code></pre>
<p>Option 1</p> <pre><code>git checkout -f gh-pages </code></pre> <p>Option 2</p> <pre><code>git reset --hard # beware: don't make that a habit git checkout gh-pages </code></pre>
119, 13091, 76220
git, git-branch, git-stash
<h1>Switching a branch after aborting current changes in git</h1> <p>I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a different branch. However, it stops me from switching because there are uncomm...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,509
git
# Switching a branch after aborting current changes in git I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a different branch. However, it stops me from switching because there are uncommitted cha...
Option 1 ``` git checkout -f gh-pages ``` Option 2 ``` git reset --hard # beware: don't make that a habit git checkout gh-pages ```
65938739
gitk error: autorelease pool page corrupted
45
2021-01-28 14:07:10
<p>Since this morning when I try to use gitk on a project with a git instance it gives me the below error. This never happened to me since today and I have used gitk for months now.</p> <p>The only difference I can point out is that this morning, during an attempt of installation of iStat to monitor my mac mini tempera...
4,750
10,519,115
2022-08-12 23:02:23
65,941,156
74
2021-01-28 16:23:09
10,519,115
2021-06-23 23:10:15
https://stackoverflow.com/q/65938739
https://stackoverflow.com/a/65941156
<p>I solved the issue by resetting gitk configurations with:</p> <pre><code>rm ~/.config/git/gitk </code></pre>
<p>I solved the issue by resetting gitk configurations with:</p> <pre><code>rm ~/.config/git/gitk </code></pre>
119, 369, 1067, 30785
git, gitk, homebrew, macos
<h1>gitk error: autorelease pool page corrupted</h1> <p>Since this morning when I try to use gitk on a project with a git instance it gives me the below error. This never happened to me since today and I have used gitk for months now.</p> <p>The only difference I can point out is that this morning, during an attempt of...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,510
git
# gitk error: autorelease pool page corrupted Since this morning when I try to use gitk on a project with a git instance it gives me the below error. This never happened to me since today and I have used gitk for months now. The only difference I can point out is that this morning, during an attempt of installation o...
I solved the issue by resetting gitk configurations with: ``` rm ~/.config/git/gitk ```
23716553
gitignore not ignoring file
45
2014-05-17 22:09:49
<p>No matter what I put in <code>.gitignore</code> I can <em>not</em> get git to ignore the <code>UserInterfaceState.xcuserstate</code> file below:</p> <pre><code>$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add &lt;file&gt;..." to update wha...
27,598
398,461
2021-07-28 13:37:36
23,716,635
74
2014-05-17 22:21:03
1,870,481
2017-04-17 17:55:57
https://stackoverflow.com/q/23716553
https://stackoverflow.com/a/23716635
<p>You can only ignore unversioned files but that file is already known to git.</p> <p>If you want git to track that file, there is no need to tell git to ignore it.</p> <p>If you don't want git to track that file use <code>git rm</code> and your ignore rule will start working.</p> <p><strong>Caution: <code>git rm</...
<p>You can only ignore unversioned files but that file is already known to git.</p> <p>If you want git to track that file, there is no need to tell git to ignore it.</p> <p>If you don't want git to track that file use <code>git rm</code> and your ignore rule will start working.</p> <p><strong>Caution: <code>git rm</...
119, 908, 25056
git, gitignore, xcode
<h1>gitignore not ignoring file</h1> <p>No matter what I put in <code>.gitignore</code> I can <em>not</em> get git to ignore the <code>UserInterfaceState.xcuserstate</code> file below:</p> <pre><code>$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,511
git
# gitignore not ignoring file No matter what I put in `.gitignore` I can *not* get git to ignore the `UserInterfaceState.xcuserstate` file below: ``` $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committe...
You can only ignore unversioned files but that file is already known to git. If you want git to track that file, there is no need to tell git to ignore it. If you don't want git to track that file use `git rm` and your ignore rule will start working. **Caution: `git rm` will remove the file.** Use `git rm --cached` ...
59861975
VSCode: difference "create branch" and "create branch from"
42
2020-01-22 14:31:58
<p>When trying to create a new branch, from an existing one, I'm faced with these two options: </p> <ol> <li><code>+ Create branch...</code></li> <li><code>+ Create branch from...</code></li> </ol> <p>I don't really understand the difference between these two options.</p>
35,648
3,867,406
2023-08-31 09:53:08
59,862,197
74
2020-01-22 14:42:39
6,487,887
2020-01-22 14:42:39
https://stackoverflow.com/q/59861975
https://stackoverflow.com/a/59862197
<p>Both commands are used to create new branches and switch to the branch after successfully created. But </p> <ol> <li><code>+ Create branch...</code> will <strong>create a new branch from the current branch</strong> you are working on.</li> <li><code>+ Create branch from...</code> will <strong>create a new branch f...
<p>Both commands are used to create new branches and switch to the branch after successfully created. But </p> <ol> <li><code>+ Create branch...</code> will <strong>create a new branch from the current branch</strong> you are working on.</li> <li><code>+ Create branch from...</code> will <strong>create a new branch f...
119, 111608
git, visual-studio-code
<h1>VSCode: difference "create branch" and "create branch from"</h1> <p>When trying to create a new branch, from an existing one, I'm faced with these two options: </p> <ol> <li><code>+ Create branch...</code></li> <li><code>+ Create branch from...</code></li> </ol> <p>I don't really understand the difference between...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,512
git
# VSCode: difference "create branch" and "create branch from" When trying to create a new branch, from an existing one, I'm faced with these two options: 1. `+ Create branch...` 2. `+ Create branch from...` I don't really understand the difference between these two options.
Both commands are used to create new branches and switch to the branch after successfully created. But 1. `+ Create branch...` will **create a new branch from the current branch** you are working on. 2. `+ Create branch from...` will **create a new branch from some other branch** in the git repository.
17865386
git svn clone of a single directory of SVN repository
42
2013-07-25 17:57:53
<p>I am attempting to use <code>git svn</code> to clone a single directory of a SVN repository into a Git repository.</p> <p>If I use <code>git svn clone svn+ssh://path/to/repo/trunk/directory</code>, I get a Git repo without branches that mirror the branches in the source SVN repo.</p> <p>If I use <code>git svn --st...
36,829
86,803
2020-06-20 18:36:27
20,984,359
74
2014-01-07 23:47:52
243,861
2020-06-20 18:36:27
https://stackoverflow.com/q/17865386
https://stackoverflow.com/a/20984359
<p>You don't want the standard layout, you want something like this:</p> <pre><code>git svn clone svn+ssh://path/to/repo/ --trunk=trunk/directory --branches=branches/*/directory --tags=tags/*/directory </code></pre>
<p>You don't want the standard layout, you want something like this:</p> <pre><code>git svn clone svn+ssh://path/to/repo/ --trunk=trunk/directory --branches=branches/*/directory --tags=tags/*/directory </code></pre>
63, 119, 456, 6452
git, git-svn, svn, version-control
<h1>git svn clone of a single directory of SVN repository</h1> <p>I am attempting to use <code>git svn</code> to clone a single directory of a SVN repository into a Git repository.</p> <p>If I use <code>git svn clone svn+ssh://path/to/repo/trunk/directory</code>, I get a Git repo without branches that mirror the branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,513
git
# git svn clone of a single directory of SVN repository I am attempting to use `git svn` to clone a single directory of a SVN repository into a Git repository. If I use `git svn clone svn+ssh://path/to/repo/trunk/directory`, I get a Git repo without branches that mirror the branches in the source SVN repo. If I use ...
You don't want the standard layout, you want something like this: ``` git svn clone svn+ssh://path/to/repo/ --trunk=trunk/directory --branches=branches/*/directory --tags=tags/*/directory ```
6048425
Not currently on any branch + git commit + checkout when not in any branch. Did I lose my changes?
41
2011-05-18 17:09:14
<p>I was not currently on any branch when I commited my changes. I didn't really notice the message and checked out another branch.</p> <p>How can I retrieve my changes? I can't merge or checkout, since there is no branch to merge from.</p>
28,377
290,330
2022-07-14 18:54:50
6,048,609
74
2011-05-18 17:24:28
526,535
2011-05-18 17:31:58
https://stackoverflow.com/q/6048425
https://stackoverflow.com/a/6048609
<p>You can use <code>git reflog</code> to get the commit hash of the commit that you did while in "no branch" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)</p> <p>Something like <code>git merge HEAD@{1}</code></p> <p>You can also <code>git rebase -i</code> and "pick" the...
<p>You can use <code>git reflog</code> to get the commit hash of the commit that you did while in "no branch" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)</p> <p>Something like <code>git merge HEAD@{1}</code></p> <p>You can also <code>git rebase -i</code> and "pick" the...
119, 5597
commit, git
<h1>Not currently on any branch + git commit + checkout when not in any branch. Did I lose my changes?</h1> <p>I was not currently on any branch when I commited my changes. I didn't really notice the message and checked out another branch.</p> <p>How can I retrieve my changes? I can't merge or checkout, since there is...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,514
git
# Not currently on any branch + git commit + checkout when not in any branch. Did I lose my changes? I was not currently on any branch when I commited my changes. I didn't really notice the message and checked out another branch. How can I retrieve my changes? I can't merge or checkout, since there is no branch to me...
You can use `git reflog` to get the commit hash of the commit that you did while in "no branch" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe) Something like `git merge HEAD@{1}` You can also `git rebase -i` and "pick" the commit you want from the reflog.
20033863
Clone specific branch from git
39
2013-11-17 17:31:49
<p>I have a repo in <code>bitbucket</code>, and i am using <code>git</code>.</p> <p>So my branches are </p> <pre><code>master develop_one develop_two </code></pre> <p>When i use <code>git clone git@bitbucket.org:project/project.git</code>, i am getting only the master branch code, but i need to clone/pull only <code...
76,568
1,342,109
2021-11-18 09:38:43
20,033,915
74
2013-11-17 17:36:21
543,643
2013-11-17 17:49:50
https://stackoverflow.com/q/20033863
https://stackoverflow.com/a/20033915
<p>Try:</p> <p><code>git clone git@bitbucket.org:project/project.git -b develop_one --single-branch</code></p> <p>For already cloned repos use:</p> <pre><code>git fetch git checkout develop_one # Or more specific: git checkout --track -b develop_one </code></pre> <p>This will track the develop_one branch from the r...
<p>Try:</p> <p><code>git clone git@bitbucket.org:project/project.git -b develop_one --single-branch</code></p> <p>For already cloned repos use:</p> <pre><code>git fetch git checkout develop_one # Or more specific: git checkout --track -b develop_one </code></pre> <p>This will track the develop_one branch from the r...
119, 3050, 4860, 8337
bitbucket, clone, git, pull
<h1>Clone specific branch from git</h1> <p>I have a repo in <code>bitbucket</code>, and i am using <code>git</code>.</p> <p>So my branches are </p> <pre><code>master develop_one develop_two </code></pre> <p>When i use <code>git clone git@bitbucket.org:project/project.git</code>, i am getting only the master branch c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,515
git
# Clone specific branch from git I have a repo in `bitbucket`, and i am using `git`. So my branches are ``` master develop_one develop_two ``` When i use `git clone git@bitbucket.org:project/project.git`, i am getting only the master branch code, but i need to clone/pull only `develop_one` branch, so how to clone/p...
Try: `git clone git@bitbucket.org:project/project.git -b develop_one --single-branch` For already cloned repos use: ``` git fetch git checkout develop_one # Or more specific: git checkout --track -b develop_one ``` This will track the develop_one branch from the remote.
9007181
Custom log format omits newline at end of output
38
2012-01-25 17:28:25
<p>I'm following the git tutorial at <a href="http://gitimmersion.com/lab_11.html" rel="noreferrer">gitimmersion.com</a> and set up an alias <code>hist</code> to show a custom pretty log output. </p> <p>When I disable git's pager (setting GIT_PAGER to nothing or to <code>cat</code>), the output omits the newline at th...
11,226
138,776
2012-01-25 17:41:55
9,007,395
74
2012-01-25 17:41:55
92,542
2012-01-25 17:41:55
https://stackoverflow.com/q/9007181
https://stackoverflow.com/a/9007395
<p>Try</p> <pre><code>hist = log --pretty="tformat:\"%h %ad | %s%d [%an]\"" --graph --date=short </code></pre> <p><code>format</code> places newlines <em>between</em> commits, <code>tformat</code> places newlines <em>after</em> each commit, thus also after the last one.</p> <p>See <a href="http://linux.die.net/man/1...
<p>Try</p> <pre><code>hist = log --pretty="tformat:\"%h %ad | %s%d [%an]\"" --graph --date=short </code></pre> <p><code>format</code> places newlines <em>between</em> commits, <code>tformat</code> places newlines <em>after</em> each commit, thus also after the last one.</p> <p>See <a href="http://linux.die.net/man/1...
119
git
<h1>Custom log format omits newline at end of output</h1> <p>I'm following the git tutorial at <a href="http://gitimmersion.com/lab_11.html" rel="noreferrer">gitimmersion.com</a> and set up an alias <code>hist</code> to show a custom pretty log output. </p> <p>When I disable git's pager (setting GIT_PAGER to nothing o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,516
git
# Custom log format omits newline at end of output I'm following the git tutorial at [gitimmersion.com](http://gitimmersion.com/lab_11.html) and set up an alias `hist` to show a custom pretty log output. When I disable git's pager (setting GIT_PAGER to nothing or to `cat`), the output omits the newline at the end. H...
Try ``` hist = log --pretty="tformat:\"%h %ad | %s%d [%an]\"" --graph --date=short ``` `format` places newlines *between* commits, `tformat` places newlines *after* each commit, thus also after the last one. See [git-log(1)](http://linux.die.net/man/1/git-log) for details.
4957630
How do you merge in GIT on Windows?
38
2011-02-10 13:25:35
<p>I tried to use GIT however for me the biggest problem with it is that there is no tool for merge'ing. At least the msysgit does not give me anything. How can I merge in GIT? Are there any great tools for it or do I have to use WinMerge or application like that?</p> <p>I use Java and Eclipse.</p>
39,898
30,453
2015-07-20 00:08:44
4,957,674
74
2011-02-10 13:30:27
201,725
2015-02-02 11:25:56
https://stackoverflow.com/q/4957630
https://stackoverflow.com/a/4957674
<p>I suggest <a href="http://kdiff3.sourceforge.net/" rel="noreferrer">kdiff3</a>. Install it and put something like:</p> <pre><code>[merge] tool = kdiff3 [mergetool "kdiff3"] path = c:/Program Files (x86)/KDiff3/kdiff3.exe [diff] tool = kdiff3 guitool = kdiff3 [difftool "kdiff3"] ...
<p>I suggest <a href="http://kdiff3.sourceforge.net/" rel="noreferrer">kdiff3</a>. Install it and put something like:</p> <pre><code>[merge] tool = kdiff3 [mergetool "kdiff3"] path = c:/Program Files (x86)/KDiff3/kdiff3.exe [diff] tool = kdiff3 guitool = kdiff3 [difftool "kdiff3"] ...
17, 53, 64, 119
eclipse, git, java, windows
<h1>How do you merge in GIT on Windows?</h1> <p>I tried to use GIT however for me the biggest problem with it is that there is no tool for merge'ing. At least the msysgit does not give me anything. How can I merge in GIT? Are there any great tools for it or do I have to use WinMerge or application like that?</p> <p>I ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,517
git
# How do you merge in GIT on Windows? I tried to use GIT however for me the biggest problem with it is that there is no tool for merge'ing. At least the msysgit does not give me anything. How can I merge in GIT? Are there any great tools for it or do I have to use WinMerge or application like that? I use Java and Ecl...
I suggest [kdiff3](http://kdiff3.sourceforge.net/). Install it and put something like: ``` [merge] tool = kdiff3 [mergetool "kdiff3"] path = c:/Program Files (x86)/KDiff3/kdiff3.exe [diff] tool = kdiff3 guitool = kdiff3 [difftool "kdiff3"] path = c:/Program Files (x86)/KDiff3/kd...
8634010
Issue with ignoring subdirectory in git
37
2011-12-26 08:10:01
<p>I have a maven multi-modules project which has a depth of around 5 levels.<br> I'm now moving to git and I see that a lot of the content of the <code>target</code> folder is captured by git as "Unstaged Changes".<br> I've googled a lot and searched SO but couldn't find an answer as to how to get git to ignore the <s...
24,400
170,013
2015-10-01 20:48:32
8,634,153
74
2011-12-26 08:39:59
357,743
2015-10-01 20:48:32
https://stackoverflow.com/q/8634010
https://stackoverflow.com/a/8634153
<p>One of the reasons might be that you already committed that files to your repository. In that case adding them to <code>.gitignore</code> doesn't prevent git from tracking these files. To fix that you should first remove them from repository like that:</p> <pre><code>git rm -r target/ </code></pre> <p>(If your pro...
<p>One of the reasons might be that you already committed that files to your repository. In that case adding them to <code>.gitignore</code> doesn't prevent git from tracking these files. To fix that you should first remove them from repository like that:</p> <pre><code>git rm -r target/ </code></pre> <p>(If your pro...
119, 25056
git, gitignore
<h1>Issue with ignoring subdirectory in git</h1> <p>I have a maven multi-modules project which has a depth of around 5 levels.<br> I'm now moving to git and I see that a lot of the content of the <code>target</code> folder is captured by git as "Unstaged Changes".<br> I've googled a lot and searched SO but couldn't fin...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,519
git
# Issue with ignoring subdirectory in git I have a maven multi-modules project which has a depth of around 5 levels. I'm now moving to git and I see that a lot of the content of the `target` folder is captured by git as "Unstaged Changes". I've googled a lot and searched SO but couldn't find an answer as to how to...
One of the reasons might be that you already committed that files to your repository. In that case adding them to `.gitignore` doesn't prevent git from tracking these files. To fix that you should first remove them from repository like that: ``` git rm -r target/ ``` (If your project has modules, you need to include ...
15387812
Git Svn - Found possible branch point
34
2013-03-13 14:15:43
<p>I'm trying to use <code>git svn</code> to clone a SVN repo into Git.</p> <p>I run the following command:</p> <blockquote> <p>C:\Projects>git svn clone -T trunk -b branches -t tags --no-metadata <a href="https://svn.mycompany.com/Projects/MyProject">https://svn.mycompany.com/Projects/MyProject</a> MyProject</p> <...
8,903
131,809
2016-07-07 01:20:05
16,424,101
74
2013-05-07 16:30:32
1,049,464
2016-07-07 01:20:05
https://stackoverflow.com/q/15387812
https://stackoverflow.com/a/16424101
<p>My problem was that due to such a large SVN (files and log) that it kept crashing at some points and when I restarted it created multiple lines of the branches and tags within my .git/config file.</p> <pre><code>branches = branches/*:refs/remotes/svn/branches/* tags = tags/*:refs/remotes/svn/tags/* </code></pre> <...
<p>My problem was that due to such a large SVN (files and log) that it kept crashing at some points and when I restarted it created multiple lines of the branches and tags within my .git/config file.</p> <pre><code>branches = branches/*:refs/remotes/svn/branches/* tags = tags/*:refs/remotes/svn/tags/* </code></pre> <...
119, 6452
git, git-svn
<h1>Git Svn - Found possible branch point</h1> <p>I'm trying to use <code>git svn</code> to clone a SVN repo into Git.</p> <p>I run the following command:</p> <blockquote> <p>C:\Projects>git svn clone -T trunk -b branches -t tags --no-metadata <a href="https://svn.mycompany.com/Projects/MyProject">https://svn.mycom...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,520
git
# Git Svn - Found possible branch point I'm trying to use `git svn` to clone a SVN repo into Git. I run the following command: > C:\Projects>git svn clone -T trunk -b branches -t tags --no-metadata <https://svn.mycompany.com/Projects/MyProject> MyProject And I get the following error: > Found possible branch point...
My problem was that due to such a large SVN (files and log) that it kept crashing at some points and when I restarted it created multiple lines of the branches and tags within my .git/config file. ``` branches = branches/*:refs/remotes/svn/branches/* tags = tags/*:refs/remotes/svn/tags/* ``` I simply removed the dupl...
5324799
Git - remove commits with empty changeset using filter-branch
77
2011-03-16 11:49:52
<p>How do I remove commits which have no changeset using git filter-branch?</p> <p>I rewrote my git history using:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter 'rm -r -f my_folder' -f HEAD </code></pre> <p>this worked out well but now I have lots of commits with empty changes...
22,267
613,109
2014-05-25 10:10:14
5,326,065
73
2011-03-16 13:34:06
119,963
2014-05-25 10:09:53
https://stackoverflow.com/q/5324799
https://stackoverflow.com/a/5326065
<p>Just add on the <code>--prune-empty</code> option:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter 'rm -rf my_folder' --prune-empty -f HEAD </code></pre> <p>(And of course, if you have other refs, you might want to rewrite everything with <code>-- --all</code> instead of just ...
<p>Just add on the <code>--prune-empty</code> option:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter 'rm -rf my_folder' --prune-empty -f HEAD </code></pre> <p>(And of course, if you have other refs, you might want to rewrite everything with <code>-- --all</code> instead of just ...
119, 46509
git, git-filter-branch
<h1>Git - remove commits with empty changeset using filter-branch</h1> <p>How do I remove commits which have no changeset using git filter-branch?</p> <p>I rewrote my git history using:</p> <pre class="lang-bash prettyprint-override"><code>git filter-branch --tree-filter 'rm -r -f my_folder' -f HEAD </code></pre> <p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,523
git
# Git - remove commits with empty changeset using filter-branch How do I remove commits which have no changeset using git filter-branch? I rewrote my git history using: ``` git filter-branch --tree-filter 'rm -r -f my_folder' -f HEAD ``` this worked out well but now I have lots of commits with empty changesets. I w...
Just add on the `--prune-empty` option: ``` git filter-branch --tree-filter 'rm -rf my_folder' --prune-empty -f HEAD ``` (And of course, if you have other refs, you might want to rewrite everything with `-- --all` instead of just `HEAD`.) Note that this isn't compatible with `--commit-filter`; in that case, [Charles...
27885057
zsh theme for full path + display git changes
76
2015-01-11 07:49:20
<p>I'm looking for theme to display a full path + git (branch name + uncommitted changes + added files). Didn't find any. something like this:</p> <pre><code>/full/path/to/repo (master *+) </code></pre> <p>would love a recommendation of one / a tip of how to edit an existing one (I am currently using Godzilla).</p>
94,855
4,391,936
2023-09-06 13:38:15
27,963,926
73
2015-01-15 12:52:19
812,680
2015-06-17 09:21:36
https://stackoverflow.com/q/27885057
https://stackoverflow.com/a/27963926
<p>Run <code>man zshmisc</code> and search for the <code>SIMPLE PROMPT ESCAPES</code> section. This documents escapes which can be used to theme your prompt.</p> <p>To get the full path path of your current working directory use <code>%d</code>.</p> <p>I'm assuming you're using oh-my-zsh. In order to accomplish what...
<p>Run <code>man zshmisc</code> and search for the <code>SIMPLE PROMPT ESCAPES</code> section. This documents escapes which can be used to theme your prompt.</p> <p>To get the full path path of your current working directory use <code>%d</code>.</p> <p>I'm assuming you're using oh-my-zsh. In order to accomplish what...
119, 3791, 28566, 93854
git, oh-my-zsh, zsh, zshrc
<h1>zsh theme for full path + display git changes</h1> <p>I'm looking for theme to display a full path + git (branch name + uncommitted changes + added files). Didn't find any. something like this:</p> <pre><code>/full/path/to/repo (master *+) </code></pre> <p>would love a recommendation of one / a tip of how to edi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,524
git
# zsh theme for full path + display git changes I'm looking for theme to display a full path + git (branch name + uncommitted changes + added files). Didn't find any. something like this: ``` /full/path/to/repo (master *+) ``` would love a recommendation of one / a tip of how to edit an existing one (I am currently ...
Run `man zshmisc` and search for the `SIMPLE PROMPT ESCAPES` section. This documents escapes which can be used to theme your prompt. To get the full path path of your current working directory use `%d`. I'm assuming you're using oh-my-zsh. In order to accomplish what you want, you can create a modified version of the...
35025587
git pull and resolve conflicts
69
2016-01-26 22:51:11
<p>I am learning git and I have a scenario:</p> <ol> <li>My coworker makes changes and pushes the changes to the master.</li> <li>I make changes locally to my master.</li> </ol> <p>So far from my understanding, at this point I can either:</p> <ol> <li>Pull the master that my coworker worked on and fix the merge conf...
171,677
4,663,980
2024-11-21 20:03:09
35,025,978
73
2016-01-26 23:23:25
457,268
2021-04-07 15:09:20
https://stackoverflow.com/q/35025587
https://stackoverflow.com/a/35025978
<p>If there are different changes on both the remote and the local branch, instead of just pulling the master by <a href="https://www.atlassian.com/git/tutorials/syncing/git-pull" rel="noreferrer"><code>git pull</code></a>, I rather would do:</p> <pre><code>git pull --rebase </code></pre> <p>I even have it in my defaul...
<p>If there are different changes on both the remote and the local branch, instead of just pulling the master by <a href="https://www.atlassian.com/git/tutorials/syncing/git-pull" rel="noreferrer"><code>git pull</code></a>, I rather would do:</p> <pre><code>git pull --rebase </code></pre> <p>I even have it in my defaul...
119
git
<h1>git pull and resolve conflicts</h1> <p>I am learning git and I have a scenario:</p> <ol> <li>My coworker makes changes and pushes the changes to the master.</li> <li>I make changes locally to my master.</li> </ol> <p>So far from my understanding, at this point I can either:</p> <ol> <li>Pull the master that my c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,525
git
# git pull and resolve conflicts I am learning git and I have a scenario: 1. My coworker makes changes and pushes the changes to the master. 2. I make changes locally to my master. So far from my understanding, at this point I can either: 1. Pull the master that my coworker worked on and fix the merge conflicts tha...
If there are different changes on both the remote and the local branch, instead of just pulling the master by [`git pull`](https://www.atlassian.com/git/tutorials/syncing/git-pull), I rather would do: ``` git pull --rebase ``` I even have it in my default config so that it will always will do a rebase if required on ...
22631863
Setting up sublimetext 3 as git commit text editor
66
2014-03-25 10:34:33
<p>I'm having trouble setting up sublime as my git commit message editor.</p> <p>Using:</p> <pre><code>git config --global core.editor "subl" </code></pre> <p>Error: error: cannot run subl: No such file or directory error: unable to start editor 'subl' Please supply the message using either -m or -F option.</p> <p>...
38,479
580,187
2022-05-07 13:48:30
22,632,139
73
2014-03-25 10:45:17
933,358
2019-03-03 18:28:50
https://stackoverflow.com/q/22631863
https://stackoverflow.com/a/22632139
<p>You can solve this by putting in a full path</p> <pre><code>git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w" </code></pre> <p>Source: <a href="http://www.sublimetext.com/docs/3/osx_command_line.html" rel="noreferrer">OS X Command Line</a></p> <p><strong>EDIT<...
<p>You can solve this by putting in a full path</p> <pre><code>git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w" </code></pre> <p>Source: <a href="http://www.sublimetext.com/docs/3/osx_command_line.html" rel="noreferrer">OS X Command Line</a></p> <p><strong>EDIT<...
119, 88190
git, sublimetext3
<h1>Setting up sublimetext 3 as git commit text editor</h1> <p>I'm having trouble setting up sublime as my git commit message editor.</p> <p>Using:</p> <pre><code>git config --global core.editor "subl" </code></pre> <p>Error: error: cannot run subl: No such file or directory error: unable to start editor 'subl' Plea...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,526
git
# Setting up sublimetext 3 as git commit text editor I'm having trouble setting up sublime as my git commit message editor. Using: ``` git config --global core.editor "subl" ``` Error: error: cannot run subl: No such file or directory error: unable to start editor 'subl' Please supply the message using either -m or...
You can solve this by putting in a full path ``` git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w" ``` Source: [OS X Command Line](http://www.sublimetext.com/docs/3/osx_command_line.html) **EDIT**: *If the name of the app is not `Sublime Text.app` you will want t...
3838727
Git Post-Receive Hook for Website Staging
60
2010-10-01 11:28:46
<p>I'm trying to set up Git for staging my website so that I can <code>git pull</code> to get the current version to work on locally and then <code>git push</code> to push the changes to the remote server. I've got it set up so that it works the way I want it to, but after I push, I have to manually run <code>git chec...
63,577
440,779
2016-05-27 15:39:59
3,838,804
73
2010-10-01 11:40:57
229,891
2010-10-01 13:37:18
https://stackoverflow.com/q/3838727
https://stackoverflow.com/a/3838804
<p>The answer to your question is here: <a href="http://toroid.org/ams/git-website-howto">http://toroid.org/ams/git-website-howto</a></p> <p>In short, what you want to do is add a "detached work tree" to the bare repository. Normally you think of your work tree as containing the <code>.git</code> directory. Bare re...
<p>The answer to your question is here: <a href="http://toroid.org/ams/git-website-howto">http://toroid.org/ams/git-website-howto</a></p> <p>In short, what you want to do is add a "detached work tree" to the bare repository. Normally you think of your work tree as containing the <code>.git</code> directory. Bare re...
119, 46734
git, git-post-receive
<h1>Git Post-Receive Hook for Website Staging</h1> <p>I'm trying to set up Git for staging my website so that I can <code>git pull</code> to get the current version to work on locally and then <code>git push</code> to push the changes to the remote server. I've got it set up so that it works the way I want it to, but ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,528
git
# Git Post-Receive Hook for Website Staging I'm trying to set up Git for staging my website so that I can `git pull` to get the current version to work on locally and then `git push` to push the changes to the remote server. I've got it set up so that it works the way I want it to, but after I push, I have to manually...
The answer to your question is here: <http://toroid.org/ams/git-website-howto> In short, what you want to do is add a "detached work tree" to the bare repository. Normally you think of your work tree as containing the `.git` directory. Bare repositories do not have a work tree by definition, but you can create one as ...
39401290
How to keep only head changes in a git rebase
58
2016-09-08 22:49:35
<p>I'm currently in the middle of a lengthy rebase going through a dozen or so commits. I've structured things in my dev process such that only the changes from <code>HEAD</code> is what I want to keep - all other conflicts (e.g. commit hash <code>b06a1dd</code>) should be deleted.</p> <p>Is there a way to simply remo...
48,328
6,009,887
2020-04-22 02:54:52
39,401,717
73
2016-09-08 23:44:02
2,747,593
2017-10-07 14:36:35
https://stackoverflow.com/q/39401290
https://stackoverflow.com/a/39401717
<p>If you are willing to start the rebase over (<code>git rebase --abort</code>), then this should do what you need:</p> <pre><code>git rebase -X ours upstream </code></pre> <p>where <code>upstream</code> is the branch you are rebasing onto.</p> <p>As noted in <a href="//stackoverflow.com/a/25576672/2747593">this an...
<p>If you are willing to start the rebase over (<code>git rebase --abort</code>), then this should do what you need:</p> <pre><code>git rebase -X ours upstream </code></pre> <p>where <code>upstream</code> is the branch you are rebasing onto.</p> <p>As noted in <a href="//stackoverflow.com/a/25576672/2747593">this an...
119, 29934
git, git-rebase
<h1>How to keep only head changes in a git rebase</h1> <p>I'm currently in the middle of a lengthy rebase going through a dozen or so commits. I've structured things in my dev process such that only the changes from <code>HEAD</code> is what I want to keep - all other conflicts (e.g. commit hash <code>b06a1dd</code>) s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,529
git
# How to keep only head changes in a git rebase I'm currently in the middle of a lengthy rebase going through a dozen or so commits. I've structured things in my dev process such that only the changes from `HEAD` is what I want to keep - all other conflicts (e.g. commit hash `b06a1dd`) should be deleted. Is there a w...
If you are willing to start the rebase over (`git rebase --abort`), then this should do what you need: ``` git rebase -X ours upstream ``` where `upstream` is the branch you are rebasing onto. As noted in [this answer](//stackoverflow.com/a/25576672/2747593) and elsewhere, the `ours` vs. `theirs` labels are slightly...
53056942
git diff --name-status : What does R100 mean?
55
2018-10-30 03:26:32
<p>When I do e.g. <code>git diff master --name-status</code> I see some lines with the <code>R100</code> prefix on them. </p> <p>What does <strong><code>R100</code></strong> exactly mean?</p> <hr> <p>I would assume <code>R</code> means "moved". I am posting below <a href="https://git-scm.com/docs/git-diff" rel="nor...
14,002
283,296
2023-01-17 09:21:57
53,057,010
73
2018-10-30 03:34:27
1,863,229
2023-01-17 09:21:57
https://stackoverflow.com/q/53056942
https://stackoverflow.com/a/53057010
<p>The <a href="https://git-scm.com/docs/git-status#_changed_tracked_entries" rel="noreferrer">documentation</a> for <code>git status</code> under &quot;Changed Tracked Entries&quot; appears to explain what <code>R100</code> means:</p> <blockquote> <p><code>&lt;X&gt;&lt;score&gt;</code> The rename or copy score (denot...
<p>The <a href="https://git-scm.com/docs/git-status#_changed_tracked_entries" rel="noreferrer">documentation</a> for <code>git status</code> under &quot;Changed Tracked Entries&quot; appears to explain what <code>R100</code> means:</p> <blockquote> <p><code>&lt;X&gt;&lt;score&gt;</code> The rename or copy score (denot...
119
git
<h1>git diff --name-status : What does R100 mean?</h1> <p>When I do e.g. <code>git diff master --name-status</code> I see some lines with the <code>R100</code> prefix on them. </p> <p>What does <strong><code>R100</code></strong> exactly mean?</p> <hr> <p>I would assume <code>R</code> means "moved". I am posting bel...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,531
git
# git diff --name-status : What does R100 mean? When I do e.g. `git diff master --name-status` I see some lines with the `R100` prefix on them. What does **`R100`** exactly mean? --- I would assume `R` means "moved". I am posting below [what I found in the documentation](https://git-scm.com/docs/git-diff), but noth...
The [documentation](https://git-scm.com/docs/git-status#_changed_tracked_entries) for `git status` under "Changed Tracked Entries" appears to explain what `R100` means: > `<X><score>` The rename or copy score (denoting the percentage > of similarity between the source and target of the > move or copy). For example "R1...
27116671
automatically stash save/pop changes on git rebase?
53
2014-11-25 00:17:13
<p>I <code>git rebase</code> a lot. I fetch upstream changes (the main repo I forked from) and then merge to my branches, and then rebase to remove useless merge commits and tree splits.</p> <p>I'm annoyed by:</p> <pre class="lang-bash prettyprint-override"><code> $ git rebase upstream/master Cannot rebase: You ...
32,818
183,132
2025-06-11 17:52:15
27,117,335
73
2014-11-25 01:29:59
1,256,452
2017-05-28 15:31:06
https://stackoverflow.com/q/27116671
https://stackoverflow.com/a/27117335
<p>Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, <code>git rebase</code> now has <code>--autostash</code>. You can configure <code>git rebase</code> to use <code>--autostash</code> by default as well, with <code>git config --global rebase.autoStash true</code>. Please note ...
<p>Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, <code>git rebase</code> now has <code>--autostash</code>. You can configure <code>git rebase</code> to use <code>--autostash</code> by default as well, with <code>git config --global rebase.autoStash true</code>. Please note ...
119, 13091
git, git-stash
<h1>automatically stash save/pop changes on git rebase?</h1> <p>I <code>git rebase</code> a lot. I fetch upstream changes (the main repo I forked from) and then merge to my branches, and then rebase to remove useless merge commits and tree splits.</p> <p>I'm annoyed by:</p> <pre class="lang-bash prettyprint-override"><...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,532
git
# automatically stash save/pop changes on git rebase? I `git rebase` a lot. I fetch upstream changes (the main repo I forked from) and then merge to my branches, and then rebase to remove useless merge commits and tree splits. I'm annoyed by: ``` $ git rebase upstream/master Cannot rebase: You have unstaged ...
Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, `git rebase` now has `--autostash`. You can configure `git rebase` to use `--autostash` by default as well, with `git config --global rebase.autoStash true`. Please note the following sentence from [the documentation](https://www....
9750049
Is it still possible to restore deleted untracked files in git?
50
2012-03-17 12:40:16
<p>let's say yesterday I did some changes on my master branch, and I forgot to add, commit them. and in the morning i did </p> <pre><code>git reset --hard </code></pre> <p>is it possible to restore deleted files in this situation ?</p>
75,735
952,129
2023-03-24 20:36:39
9,751,203
73
2012-03-17 15:27:20
662,615
2012-03-17 15:27:20
https://stackoverflow.com/q/9750049
https://stackoverflow.com/a/9751203
<p>Some better IDEs keep track of your files as a local history. If you removed files externally (say, <code>git reset</code>) you should be able to click in your IDE on parent directory and choose "Compare with local history".</p> <p>I used this feature successfully in <code>PHPStorm</code> IDE when my untracked file...
<p>Some better IDEs keep track of your files as a local history. If you removed files externally (say, <code>git reset</code>) you should be able to click in your IDE on parent directory and choose "Compare with local history".</p> <p>I used this feature successfully in <code>PHPStorm</code> IDE when my untracked file...
119, 51381
git, git-reset
<h1>Is it still possible to restore deleted untracked files in git?</h1> <p>let's say yesterday I did some changes on my master branch, and I forgot to add, commit them. and in the morning i did </p> <pre><code>git reset --hard </code></pre> <p>is it possible to restore deleted files in this situation ?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,534
git
# Is it still possible to restore deleted untracked files in git? let's say yesterday I did some changes on my master branch, and I forgot to add, commit them. and in the morning i did ``` git reset --hard ``` is it possible to restore deleted files in this situation ?
Some better IDEs keep track of your files as a local history. If you removed files externally (say, `git reset`) you should be able to click in your IDE on parent directory and choose "Compare with local history". I used this feature successfully in `PHPStorm` IDE when my untracked files got wiped out by some utility....
3340051
What does the output of git pull actually mean?
49
2010-07-27 00:59:58
<p>I'm trying to gain a more thorough understanding of git.</p> <p>Can someone give me a simple line-by-line explanation of what basic git <code>pull</code> output means? Example: </p> <pre><code>remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (de...
10,738
402,851
2014-09-28 12:07:02
3,340,304
73
2010-07-27 02:07:40
119,963
2014-09-28 12:07:02
https://stackoverflow.com/q/3340051
https://stackoverflow.com/a/3340304
<p>Under the hood, <code>git pull</code> is <code>git fetch</code> followed by <code>git merge</code>. Here's the fetch portion:</p> <pre><code>remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (delta 0) </code></pre> <p>At this point, you've told t...
<p>Under the hood, <code>git pull</code> is <code>git fetch</code> followed by <code>git merge</code>. Here's the fetch portion:</p> <pre><code>remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (delta 0) </code></pre> <p>At this point, you've told t...
119
git
<h1>What does the output of git pull actually mean?</h1> <p>I'm trying to gain a more thorough understanding of git.</p> <p>Can someone give me a simple line-by-line explanation of what basic git <code>pull</code> output means? Example: </p> <pre><code>remote: Counting objects: 11, done. remote: Compressing objects: ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,535
git
# What does the output of git pull actually mean? I'm trying to gain a more thorough understanding of git. Can someone give me a simple line-by-line explanation of what basic git `pull` output means? Example: ``` remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delt...
Under the hood, `git pull` is `git fetch` followed by `git merge`. Here's the fetch portion: ``` remote: Counting objects: 11, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 2), reused 0 (delta 0) ``` At this point, you've told the remote what you want. It finds all the objects it needs t...
10108619
Run two commands during git bisect run
45
2012-04-11 15:00:56
<p>I would essentially like to do <code>git bisect run 'bundle &amp;&amp; bundle exec cucumber'</code>.</p> <p>I want to do this on the commandline - I don't want to write a shell script.</p>
2,287
535,425
2025-05-13 12:25:47
10,108,791
73
2012-04-11 15:11:16
166,749
2012-04-11 15:11:16
https://stackoverflow.com/q/10108619
https://stackoverflow.com/a/10108791
<pre><code>git bisect run sh -c 'bundle &amp;&amp; bundle exec cucumber' </code></pre>
<pre><code>git bisect run sh -c 'bundle &amp;&amp; bundle exec cucumber' </code></pre>
119, 47326
git, git-bisect
<h1>Run two commands during git bisect run</h1> <p>I would essentially like to do <code>git bisect run 'bundle &amp;&amp; bundle exec cucumber'</code>.</p> <p>I want to do this on the commandline - I don't want to write a shell script.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,537
git
# Run two commands during git bisect run I would essentially like to do `git bisect run 'bundle && bundle exec cucumber'`. I want to do this on the commandline - I don't want to write a shell script.
``` git bisect run sh -c 'bundle && bundle exec cucumber' ```
39253307
Export GIT LOG into an Excel file
44
2016-08-31 15:13:57
<p>I have looked into the forum, but with no luck.</p> <p>Requirement :</p> <p>Run GIT LOG (format) command and write the results into an Excel File . </p> <p>I have seen examples wherein with GIT Log command, data can be written into a CSV, but formatting is double the effort.</p> <p>Any utility or approach would ...
51,619
3,398,578
2024-05-11 11:48:50
39,269,572
73
2016-09-01 10:51:23
1,051,589
2016-09-01 10:51:23
https://stackoverflow.com/q/39253307
https://stackoverflow.com/a/39269572
<p>Git gives your the control on how to format the log output using <code>pretty</code> option. Check this out:</p> <pre><code>git log --pretty=format:%h,%an,%ae,%s </code></pre> <p>This prints the log in the format of (hash [abbreviated], author name, author email, subject).</p> <p>To see the full list of format op...
<p>Git gives your the control on how to format the log output using <code>pretty</code> option. Check this out:</p> <pre><code>git log --pretty=format:%h,%an,%ae,%s </code></pre> <p>This prints the log in the format of (hash [abbreviated], author name, author email, subject).</p> <p>To see the full list of format op...
119, 942
git, logging
<h1>Export GIT LOG into an Excel file</h1> <p>I have looked into the forum, but with no luck.</p> <p>Requirement :</p> <p>Run GIT LOG (format) command and write the results into an Excel File . </p> <p>I have seen examples wherein with GIT Log command, data can be written into a CSV, but formatting is double the eff...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,538
git
# Export GIT LOG into an Excel file I have looked into the forum, but with no luck. Requirement : Run GIT LOG (format) command and write the results into an Excel File . I have seen examples wherein with GIT Log command, data can be written into a CSV, but formatting is double the effort. Any utility or approach w...
Git gives your the control on how to format the log output using `pretty` option. Check this out: ``` git log --pretty=format:%h,%an,%ae,%s ``` This prints the log in the format of (hash [abbreviated], author name, author email, subject). To see the full list of format options: ``` git help log ``` And scroll down...
14141344
git status - list last modified date
44
2013-01-03 14:58:41
<p>Using git, is it possible to list an unstaged file's last modified date alongside it's path? using eg. </p> <p><code>git status</code></p> <p>or</p> <p><code>git diff --name-only</code></p>
30,821
1,359,042
2021-06-26 03:57:29
14,142,413
73
2013-01-03 15:56:13
1,093,528
2021-06-26 03:57:29
https://stackoverflow.com/q/14141344
https://stackoverflow.com/a/14142413
<p>Not directly but you can use a pipe:</p> <blockquote> <p>Note: original answer updated based on comments</p> </blockquote> <p>Linux:</p> <pre><code>git status -s | while read mode file; do echo $mode $file $(stat -c %y $file); done </code></pre> <p>Windows:</p> <pre><code>git status -s | while read mode file; do ech...
<p>Not directly but you can use a pipe:</p> <blockquote> <p>Note: original answer updated based on comments</p> </blockquote> <p>Linux:</p> <pre><code>git status -s | while read mode file; do echo $mode $file $(stat -c %y $file); done </code></pre> <p>Windows:</p> <pre><code>git status -s | while read mode file; do ech...
119
git
<h1>git status - list last modified date</h1> <p>Using git, is it possible to list an unstaged file's last modified date alongside it's path? using eg. </p> <p><code>git status</code></p> <p>or</p> <p><code>git diff --name-only</code></p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,539
git
# git status - list last modified date Using git, is it possible to list an unstaged file's last modified date alongside it's path? using eg. `git status` or `git diff --name-only`
Not directly but you can use a pipe: > Note: original answer updated based on comments Linux: ``` git status -s | while read mode file; do echo $mode $file $(stat -c %y $file); done ``` Windows: ``` git status -s | while read mode file; do echo $mode $(date --reference=$file +"%Y-%m-%d %H:%M:%S") $file; done ``` ...
11886132
Can I add a message/note/comment when creating a new branch in Git?
43
2012-08-09 14:52:26
<p>I'm doing some exploratory work where I will most likely be spending 30 min on several different variations of the same task. I want to track them in git so I can jump back and forth between approaches. And if there are 3 or 6 or 9 branches, I might need some more info than the branch name to tell them apart.</p> ...
34,479
263,900
2021-08-05 08:20:30
11,886,179
73
2012-08-09 14:54:48
877,115
2021-08-05 08:20:30
https://stackoverflow.com/q/11886132
https://stackoverflow.com/a/11886179
<p>You want branch descriptions:</p> <pre><code>git branch --edit-description </code></pre> <p>This will open up your editor and let you attach metadata to the branch. You can extract it with:</p> <pre><code>git config branch.&lt;branch&gt;.description </code></pre> <p>A couple of important notes:</p> <ol> <li><p>This ...
<p>You want branch descriptions:</p> <pre><code>git branch --edit-description </code></pre> <p>This will open up your editor and let you attach metadata to the branch. You can extract it with:</p> <pre><code>git config branch.&lt;branch&gt;.description </code></pre> <p>A couple of important notes:</p> <ol> <li><p>This ...
119, 1863, 1966, 76220
comments, git, git-branch, message
<h1>Can I add a message/note/comment when creating a new branch in Git?</h1> <p>I'm doing some exploratory work where I will most likely be spending 30 min on several different variations of the same task. I want to track them in git so I can jump back and forth between approaches. And if there are 3 or 6 or 9 branch...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,541
git
# Can I add a message/note/comment when creating a new branch in Git? I'm doing some exploratory work where I will most likely be spending 30 min on several different variations of the same task. I want to track them in git so I can jump back and forth between approaches. And if there are 3 or 6 or 9 branches, I might...
You want branch descriptions: ``` git branch --edit-description ``` This will open up your editor and let you attach metadata to the branch. You can extract it with: ``` git config branch.<branch>.description ``` A couple of important notes: 1. This is stored locally. By definition it can't be pushed since it's st...
1749323
How can I find out which files have been modified in a branch?
43
2009-11-17 14:38:17
<p>I have two branches: master and bug1. I checked out bug1, did bunch of changes and multiple commits. How do I get a list of all files that were changed on the branch? I'm not interested in hashes, dates or any other commit related details. I just want to get a simple list of touched files.</p>
19,023
209,508
2023-02-21 21:44:43
1,749,354
73
2009-11-17 14:43:38
207,313
2009-11-17 14:43:38
https://stackoverflow.com/q/1749323
https://stackoverflow.com/a/1749354
<pre><code>git diff --name-only master bug1 </code></pre>
<pre><code>git diff --name-only master bug1 </code></pre>
119, 1879, 21628
branch, git, msysgit
<h1>How can I find out which files have been modified in a branch?</h1> <p>I have two branches: master and bug1. I checked out bug1, did bunch of changes and multiple commits. How do I get a list of all files that were changed on the branch? I'm not interested in hashes, dates or any other commit related details. I jus...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,542
git
# How can I find out which files have been modified in a branch? I have two branches: master and bug1. I checked out bug1, did bunch of changes and multiple commits. How do I get a list of all files that were changed on the branch? I'm not interested in hashes, dates or any other commit related details. I just want to...
``` git diff --name-only master bug1 ```
25046570
What does repo init and repo sync actually do?
42
2014-07-30 20:43:30
<p>I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here.</p> <hr> <p>This is such a noob question, and pardon me if it is, but I just want to understand the underlying concepts clearly. Reading repo help and Google's repo comma...
93,151
3,893,122
2025-03-10 16:17:17
25,048,595
73
2014-07-30 23:24:33
1,893,766
2014-07-30 23:24:33
https://stackoverflow.com/q/25046570
https://stackoverflow.com/a/25048595
<p><code>repo</code> is a python wrapper script for <code>git</code>, its Google Source <a href="https://gerrit.googlesource.com/git-repo/" rel="noreferrer">page</a> defines it as</p> <blockquote> <p>repo - The Multiple Git Repository Tool</p> </blockquote> <ol> <li><p><code>repo init</code> command initializes rep...
<p><code>repo</code> is a python wrapper script for <code>git</code>, its Google Source <a href="https://gerrit.googlesource.com/git-repo/" rel="noreferrer">page</a> defines it as</p> <blockquote> <p>repo - The Multiple Git Repository Tool</p> </blockquote> <ol> <li><p><code>repo init</code> command initializes rep...
1386, 7330, 47738, 92175
android, android-source, git-repo, repository
<h1>What does repo init and repo sync actually do?</h1> <p>I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here.</p> <hr> <p>This is such a noob question, and pardon me if it is, but I just want to understand the underlying conc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,543
git
# What does repo init and repo sync actually do? I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here. --- This is such a noob question, and pardon me if it is, but I just want to understand the underlying concepts clearly. Rea...
`repo` is a python wrapper script for `git`, its Google Source [page](https://gerrit.googlesource.com/git-repo/) defines it as > repo - The Multiple Git Repository Tool 1. `repo init` command initializes repo in the current directory. That's, it downloads the latest repo source and a `manifest.xml` file that describe...
6050836
Git - some files are marked as changed but 'git diff' doesn't show anything
42
2011-05-18 20:50:02
<p>I am quite new to Git, thus maybe I am missing something here.</p> <pre><code>dan@one:/var/www/$ git status -s M GoogleChromeExtension.js M ApiClient.js </code></pre> <p>So clearly 2 files have been changed.<br> But when I run:</p> <pre><code>git diff </code></pre> <p>no output is shown. I was expecting to get...
25,650
354,742
2019-12-04 14:35:16
6,051,027
73
2011-05-18 21:06:16
526,535
2011-05-18 21:14:30
https://stackoverflow.com/q/6050836
https://stackoverflow.com/a/6051027
<p>Do a <code>git diff --cached</code> - it compares the HEAD and index, ie stuff added for commit.</p> <p>Just a <code>git diff</code> is between index and working directory, so if all the changes have been staged for commit, you won' see anything in <code>git diff</code> </p> <p>The third form is <code>git diff &lt...
<p>Do a <code>git diff --cached</code> - it compares the HEAD and index, ie stuff added for commit.</p> <p>Just a <code>git diff</code> is between index and working directory, so if all the changes have been staged for commit, you won' see anything in <code>git diff</code> </p> <p>The third form is <code>git diff &lt...
119
git
<h1>Git - some files are marked as changed but 'git diff' doesn't show anything</h1> <p>I am quite new to Git, thus maybe I am missing something here.</p> <pre><code>dan@one:/var/www/$ git status -s M GoogleChromeExtension.js M ApiClient.js </code></pre> <p>So clearly 2 files have been changed.<br> But when I run:<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,544
git
# Git - some files are marked as changed but 'git diff' doesn't show anything I am quite new to Git, thus maybe I am missing something here. ``` dan@one:/var/www/$ git status -s M GoogleChromeExtension.js M ApiClient.js ``` So clearly 2 files have been changed. But when I run: ``` git diff ``` no output is sho...
Do a `git diff --cached` - it compares the HEAD and index, ie stuff added for commit. Just a `git diff` is between index and working directory, so if all the changes have been staged for commit, you won' see anything in `git diff` The third form is `git diff <commit>` which compares working directory and commit. So d...
8134105
Get latest from Git branch
40
2011-11-15 09:27:05
<p>I cloned something from git repository, and switched branch</p> <pre><code>git clone ssh://11.21.3.12:23211/dir1/dir2 dir git branch branch1 </code></pre> <p>I did some modification in my local, and committed it. And somebody else also done clone and he pushed it in git repository.</p> <p>Now I want the clone cop...
368,315
588,747
2021-10-25 14:41:35
8,134,260
73
2011-11-15 09:40:46
11,343
2011-11-15 10:12:48
https://stackoverflow.com/q/8134105
https://stackoverflow.com/a/8134260
<p>Your modifications are in a different branch than the original branch, which simplifies stuff because you get updates in one branch, and your work is in another branch.</p> <p>Assuming the original branch is named <code>master</code>, which the case in 99% of git repos, you have to fetch the state of origin, and me...
<p>Your modifications are in a different branch than the original branch, which simplifies stuff because you get updates in one branch, and your work is in another branch.</p> <p>Assuming the original branch is named <code>master</code>, which the case in 99% of git repos, you have to fetch the state of origin, and me...
119
git
<h1>Get latest from Git branch</h1> <p>I cloned something from git repository, and switched branch</p> <pre><code>git clone ssh://11.21.3.12:23211/dir1/dir2 dir git branch branch1 </code></pre> <p>I did some modification in my local, and committed it. And somebody else also done clone and he pushed it in git reposito...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,545
git
# Get latest from Git branch I cloned something from git repository, and switched branch ``` git clone ssh://11.21.3.12:23211/dir1/dir2 dir git branch branch1 ``` I did some modification in my local, and committed it. And somebody else also done clone and he pushed it in git repository. Now I want the clone copy of...
Your modifications are in a different branch than the original branch, which simplifies stuff because you get updates in one branch, and your work is in another branch. Assuming the original branch is named `master`, which the case in 99% of git repos, you have to fetch the state of origin, and merge `origin/master` u...
33305800
Difference between SHA256withRSA and SHA256 then RSA
39
2015-10-23 15:13:00
<p>What is the difference between compute a signature with the following two methods?</p> <ol> <li>Compute a signature with <code>Signature.getInstance("SHA256withRSA")</code></li> <li>Compute SHA256 with <code>MessageDigest.getInstance("SHA-256")</code> and compute the digest with <code>Signature.getInstance("RSA");<...
54,500
1,908,089
2019-03-01 21:33:38
33,311,324
73
2015-10-23 21:00:48
1,729,265
2015-10-28 15:02:21
https://stackoverflow.com/q/33305800
https://stackoverflow.com/a/33311324
<h1>The difference</h1> <p>The difference between signing with <code>&quot;SHA256withRSA&quot;</code> and computing the SHA256 hash and signing it with <code>&quot;RSA&quot;</code> (= <code>&quot;NONEwithRSA&quot;</code>) is foremost that in the former case the calculated SHA-256 hash value is first encapsulated in a <...
<h1>The difference</h1> <p>The difference between signing with <code>&quot;SHA256withRSA&quot;</code> and computing the SHA256 hash and signing it with <code>&quot;RSA&quot;</code> (= <code>&quot;NONEwithRSA&quot;</code>) is foremost that in the former case the calculated SHA-256 hash value is first encapsulated in a <...
17, 4065, 4172, 17782
bouncycastle, digital-signature, java, rsa
<h1>Difference between SHA256withRSA and SHA256 then RSA</h1> <p>What is the difference between compute a signature with the following two methods?</p> <ol> <li>Compute a signature with <code>Signature.getInstance("SHA256withRSA")</code></li> <li>Compute SHA256 with <code>MessageDigest.getInstance("SHA-256")</code> an...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,546
git
# Difference between SHA256withRSA and SHA256 then RSA What is the difference between compute a signature with the following two methods? 1. Compute a signature with `Signature.getInstance("SHA256withRSA")` 2. Compute SHA256 with `MessageDigest.getInstance("SHA-256")` and compute the digest with `Signature.getInstanc...
# The difference The difference between signing with `"SHA256withRSA"` and computing the SHA256 hash and signing it with `"RSA"` (= `"NONEwithRSA"`) is foremost that in the former case the calculated SHA-256 hash value is first encapsulated in a `DigestInfo` structure ``` DigestInfo ::= SEQUENCE { digestAlgorithm...
42518104
How to remove a commit from the middle of a branch
38
2017-02-28 20:27:06
<p>I've made some commits and have pushed it to my remote repo. One of those I want to remove. It includes only one binary file, which was changed only in that commit in that branch. How to remove it without harm for later commits?</p>
69,055
7,147,393
2023-07-07 17:07:59
42,522,493
73
2017-03-01 03:12:08
4,133,798
2020-10-08 10:56:01
https://stackoverflow.com/q/42518104
https://stackoverflow.com/a/42522493
<p>You can use <code>interactive (-i) rebase</code> to remove a previous commit.</p> <pre><code>$ git log # copy the target commit $ git rebase -i &lt;target-commit&gt;~1 # start rebase from the previous commit of target commit </code></pre> <p>An editor will open with a list of commits, one...
<p>You can use <code>interactive (-i) rebase</code> to remove a previous commit.</p> <pre><code>$ git log # copy the target commit $ git rebase -i &lt;target-commit&gt;~1 # start rebase from the previous commit of target commit </code></pre> <p>An editor will open with a list of commits, one...
119, 53850
git, git-commit
<h1>How to remove a commit from the middle of a branch</h1> <p>I've made some commits and have pushed it to my remote repo. One of those I want to remove. It includes only one binary file, which was changed only in that commit in that branch. How to remove it without harm for later commits?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,547
git
# How to remove a commit from the middle of a branch I've made some commits and have pushed it to my remote repo. One of those I want to remove. It includes only one binary file, which was changed only in that commit in that branch. How to remove it without harm for later commits?
You can use `interactive (-i) rebase` to remove a previous commit. ``` $ git log # copy the target commit $ git rebase -i <target-commit>~1 # start rebase from the previous commit of target commit ``` An editor will open with a list of commits, one per line. Each of these lines begins with...
5543280
How do I get the deleted-branch back in Git?
36
2011-04-04 19:23:07
<p>I'm trying to use Git for our software development. I found that if I delete a branch in Git, I could lose my code forever. That surprised me. I thought as a version control system, it should be able to let me do anything (even stupid one) without worry about harming my work.</p> <p>The steps below are what I did:</...
31,850
83,946
2021-04-10 20:18:44
5,543,479
73
2011-04-04 19:42:23
6,309
2011-04-05 03:59:43
https://stackoverflow.com/q/5543280
https://stackoverflow.com/a/5543479
<p>To avoid the issue in the first place, <a href="https://stackoverflow.com/users/119963/jefromi">Jefromi</a> advices in the comments:</p> <blockquote> <p>Another tip: only use <strong><code>git branch -d</code></strong>, not <code>git branch -D</code>.<br> You'll be warned if you're about to delete something tha...
<p>To avoid the issue in the first place, <a href="https://stackoverflow.com/users/119963/jefromi">Jefromi</a> advices in the comments:</p> <blockquote> <p>Another tip: only use <strong><code>git branch -d</code></strong>, not <code>git branch -D</code>.<br> You'll be warned if you're about to delete something tha...
119
git
<h1>How do I get the deleted-branch back in Git?</h1> <p>I'm trying to use Git for our software development. I found that if I delete a branch in Git, I could lose my code forever. That surprised me. I thought as a version control system, it should be able to let me do anything (even stupid one) without worry about har...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,549
git
# How do I get the deleted-branch back in Git? I'm trying to use Git for our software development. I found that if I delete a branch in Git, I could lose my code forever. That surprised me. I thought as a version control system, it should be able to let me do anything (even stupid one) without worry about harming my w...
To avoid the issue in the first place, [Jefromi](https://stackoverflow.com/users/119963/jefromi) advices in the comments: > Another tip: only use **`git branch -d`**, not `git branch -D`. > You'll be warned if you're about to delete something that might make you lose work, then you can take a second to think before ...
12218420
Add a submodule which can't be removed from the index
35
2012-08-31 15:29:48
<p>I'm trying to add a submodule that already existed (different git remote repository). As I didn't searched before how to do it correctly, I think I've messed up my repository and I need some help to fix it again.</p> <p>I've already deleted all the relevant sections from the .gitmodules and .git/config regarding th...
40,065
221,529
2023-11-11 04:22:18
12,218,980
73
2012-08-31 16:07:23
6,309
2012-08-31 16:07:23
https://stackoverflow.com/q/12218420
https://stackoverflow.com/a/12218980
<p>The only way that message (<code>'repo' already exists in the index</code>) can be displayed is if 'repo' still exists in the index (see <a href="http://git-scm.com/docs/git-rm" rel="noreferrer">this chapter on submodule</a>):</p> <pre><code>$ rm -Rf rack/ $ git submodule add git@github.com:schacon/rack.git rack 'r...
<p>The only way that message (<code>'repo' already exists in the index</code>) can be displayed is if 'repo' still exists in the index (see <a href="http://git-scm.com/docs/git-rm" rel="noreferrer">this chapter on submodule</a>):</p> <pre><code>$ rm -Rf rack/ $ git submodule add git@github.com:schacon/rack.git rack 'r...
119, 41612
git, git-submodules
<h1>Add a submodule which can't be removed from the index</h1> <p>I'm trying to add a submodule that already existed (different git remote repository). As I didn't searched before how to do it correctly, I think I've messed up my repository and I need some help to fix it again.</p> <p>I've already deleted all the rele...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,550
git
# Add a submodule which can't be removed from the index I'm trying to add a submodule that already existed (different git remote repository). As I didn't searched before how to do it correctly, I think I've messed up my repository and I need some help to fix it again. I've already deleted all the relevant sections fr...
The only way that message (`'repo' already exists in the index`) can be displayed is if 'repo' still exists in the index (see [this chapter on submodule](http://git-scm.com/docs/git-rm)): ``` $ rm -Rf rack/ $ git submodule add git@github.com:schacon/rack.git rack 'rack' already exists in the index You have to unstage...
12362027
Problems installing Git with Homebrew
28
2012-09-11 02:45:03
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/12362021/problems-upgrading-git-with-homebrew">Problems Upgrading Git with Homebrew</a> </p> </blockquote> <p>I'm very close here -- I think I just need to create a symbolic link, but I'm not sure how (and why...
29,064
223,134
2012-09-11 02:49:15
12,362,061
73
2012-09-11 02:49:15
10,322
2012-09-11 02:49:15
https://stackoverflow.com/q/12362027
https://stackoverflow.com/a/12362061
<p>All you should need to do is:</p> <pre><code>brew link git </code></pre>
<p>All you should need to do is:</p> <pre><code>brew link git </code></pre>
119, 369, 1067, 71219
git, homebrew, macos, osx-lion
<h1>Problems installing Git with Homebrew</h1> <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/12362021/problems-upgrading-git-with-homebrew">Problems Upgrading Git with Homebrew</a> </p> </blockquote> <p>I'm very close here -- I think I just need to create...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,553
git
# Problems installing Git with Homebrew > **Possible Duplicate:** > [Problems Upgrading Git with Homebrew](https://stackoverflow.com/questions/12362021/problems-upgrading-git-with-homebrew) I'm very close here -- I think I just need to create a symbolic link, but I'm not sure how (and why this is need). I'm on OSX ...
All you should need to do is: ``` brew link git ```
9848347
Can I make 'git diff' only display the line numbers AND changed file names?
354
2012-03-24 01:24:44
<p><strong>This question calls for &quot;line numbers&quot;. If you do not care about line numbers in the output, <a href="https://stackoverflow.com/q/1552340/124486">see this question and answer</a>.</strong></p> <hr /> <p>Basically, I don't want to see the changed content, just the file names and line numbers.</p>
207,801
109,704
2023-03-30 10:57:45
9,855,802
72
2012-03-24 21:32:38
1,256,452
2021-06-14 11:53:38
https://stackoverflow.com/q/9848347
https://stackoverflow.com/a/9855802
<p>Note: if you're <strong>just looking for the names</strong> of changed files (<strong>without</strong> the <strong>line numbers</strong> for lines that were changed), see <a href="https://stackoverflow.com/a/13851260/1256452">another answer here</a>.</p> <hr /> <p>There's no built-in option for this (and I don't thi...
<p>Note: if you're <strong>just looking for the names</strong> of changed files (<strong>without</strong> the <strong>line numbers</strong> for lines that were changed), see <a href="https://stackoverflow.com/a/13851260/1256452">another answer here</a>.</p> <hr /> <p>There's no built-in option for this (and I don't thi...
119, 9033
git, git-diff
<h1>Can I make 'git diff' only display the line numbers AND changed file names?</h1> <p><strong>This question calls for &quot;line numbers&quot;. If you do not care about line numbers in the output, <a href="https://stackoverflow.com/q/1552340/124486">see this question and answer</a>.</strong></p> <hr /> <p>Basically, ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,555
git
# Can I make 'git diff' only display the line numbers AND changed file names? **This question calls for "line numbers". If you do not care about line numbers in the output, [see this question and answer](https://stackoverflow.com/q/1552340/124486).** --- Basically, I don't want to see the changed content, just the f...
Note: if you're **just looking for the names** of changed files (**without** the **line numbers** for lines that were changed), see [another answer here](https://stackoverflow.com/a/13851260/1256452). --- There's no built-in option for this (and I don't think it's all that useful either), but it *is* possible to do t...
1029969
Why is my Git repository so big (folder '.git')?
165
2009-06-22 23:52:08
<p>Consider:</p> <p>145M = .git/objects/pack/</p> <p>I wrote a script to add up the sizes of differences of each commit and the commit before it, going backwards from the tip of each branch. I get 129 MB, which is without compression and without accounting for the same files across branches and common history among bra...
127,483
14,456
2025-07-13 16:38:00
1,036,431
72
2009-06-24 04:40:35
103,421
2025-07-13 15:05:39
https://stackoverflow.com/q/1029969
https://stackoverflow.com/a/1036431
<p>I recently pulled the wrong remote repository into the local one (<code>git remote add ...</code> and <code>git remote update</code>). After deleting the unwanted remote ref, branches and tags I still had 1.4 GB (!) of wasted space in my repository.</p> <p>I was only able to get rid of this by cloning it with <code...
<p>I recently pulled the wrong remote repository into the local one (<code>git remote add ...</code> and <code>git remote update</code>). After deleting the unwanted remote ref, branches and tags I still had 1.4 GB (!) of wasted space in my repository.</p> <p>I was only able to get rid of this by cloning it with <code...
119
git
<h1>Why is my Git repository so big (folder '.git')?</h1> <p>Consider:</p> <p>145M = .git/objects/pack/</p> <p>I wrote a script to add up the sizes of differences of each commit and the commit before it, going backwards from the tip of each branch. I get 129 MB, which is without compression and without accounting for t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,556
git
# Why is my Git repository so big (folder '.git')? Consider: 145M = .git/objects/pack/ I wrote a script to add up the sizes of differences of each commit and the commit before it, going backwards from the tip of each branch. I get 129 MB, which is without compression and without accounting for the same files across ...
I recently pulled the wrong remote repository into the local one (`git remote add ...` and `git remote update`). After deleting the unwanted remote ref, branches and tags I still had 1.4 GB (!) of wasted space in my repository. I was only able to get rid of this by cloning it with `git clone file:///path/to/repository...
4917871
Does git return specific return error codes?
115
2011-02-07 03:34:01
<p>Like merging errors, or rebase errors. Does it have a unique error code?</p>
120,282
416,842
2019-09-30 21:20:19
4,917,997
72
2011-02-07 04:08:51
478,288
2011-02-07 04:08:51
https://stackoverflow.com/q/4917871
https://stackoverflow.com/a/4917997
<p>I set-up a test to fail. This is what I got:</p> <pre><code>$ git merge newbranch Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result. $ echo $? 1 </code></pre> <p>Git returns <code>0</code> when it merges correctly, as expected.</p...
<p>I set-up a test to fail. This is what I got:</p> <pre><code>$ git merge newbranch Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result. $ echo $? 1 </code></pre> <p>Git returns <code>0</code> when it merges correctly, as expected.</p...
119
git
<h1>Does git return specific return error codes?</h1> <p>Like merging errors, or rebase errors. Does it have a unique error code?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,557
git
# Does git return specific return error codes? Like merging errors, or rebase errors. Does it have a unique error code?
I set-up a test to fail. This is what I got: ``` $ git merge newbranch Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result. $ echo $? 1 ``` Git returns `0` when it merges correctly, as expected.
4315948
git partial merge, not whole branch
78
2010-11-30 16:23:10
<p>I've read about some tricks with merge in <a href="https://stackoverflow.com/questions/1807036/git-merging-public-and-private-branches-while-while-keeping-certain-files-intact">Git: merging public and private branches while while keeping certain files intact in both branches</a> and others and not found a solution.<...
74,659
455,491
2023-07-13 11:39:41
4,316,039
72
2010-11-30 16:31:42
28,804
2010-11-30 16:31:42
https://stackoverflow.com/q/4315948
https://stackoverflow.com/a/4316039
<p>There are a couple things you can do.</p> <p>One, you can <em>cherry-pick</em> the changes you want, which applies only a single commit. For example, if there's a change that only touches <code>config.xml</code>, you can cherry-pick it with</p> <pre><code>$ git cherry-pick $COMMIT_ID_YOU_WANT </code></pre> <p>You...
<p>There are a couple things you can do.</p> <p>One, you can <em>cherry-pick</em> the changes you want, which applies only a single commit. For example, if there's a change that only touches <code>config.xml</code>, you can cherry-pick it with</p> <pre><code>$ git cherry-pick $COMMIT_ID_YOU_WANT </code></pre> <p>You...
119, 717
git, merge
<h1>git partial merge, not whole branch</h1> <p>I've read about some tricks with merge in <a href="https://stackoverflow.com/questions/1807036/git-merging-public-and-private-branches-while-while-keeping-certain-files-intact">Git: merging public and private branches while while keeping certain files intact in both branc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,559
git
# git partial merge, not whole branch I've read about some tricks with merge in [Git: merging public and private branches while while keeping certain files intact in both branches](https://stackoverflow.com/questions/1807036/git-merging-public-and-private-branches-while-while-keeping-certain-files-intact) and others a...
There are a couple things you can do. One, you can *cherry-pick* the changes you want, which applies only a single commit. For example, if there's a change that only touches `config.xml`, you can cherry-pick it with ``` $ git cherry-pick $COMMIT_ID_YOU_WANT ``` You could also just grab `config.xml` from the developm...
16041790
What is the best way to resolve Rails orphaned migrations?
66
2013-04-16 16:03:43
<p>I have been switching between branches in a project and each of them have different migrations... This is the scenario:</p> <blockquote> <p>$ rake db:migrate:status</p> </blockquote> <pre><code> Status Migration ID Migration Name -------------------------------------------------- ... up 2013030715...
37,157
684,957
2023-07-18 22:45:00
16,155,349
72
2013-04-22 19:39:59
684,957
2022-06-17 20:01:07
https://stackoverflow.com/q/16041790
https://stackoverflow.com/a/16155349
<p>I ended up solving the problem like this:</p> <p><strong>(1)</strong> Go to the branches that has the migration files and roll them back. This is not trivial when you have many branches which are will result in many conflicts if you try to merge them. So I use this commands to find out the branches of each orphan mi...
<p>I ended up solving the problem like this:</p> <p><strong>(1)</strong> Go to the branches that has the migration files and roll them back. This is not trivial when you have many branches which are will result in many conflicts if you try to merge them. So I use this commands to find out the branches of each orphan mi...
97, 119, 4984, 40039, 64108
git, migration, rails-migrations, ruby-on-rails, ruby-on-rails-3
<h1>What is the best way to resolve Rails orphaned migrations?</h1> <p>I have been switching between branches in a project and each of them have different migrations... This is the scenario:</p> <blockquote> <p>$ rake db:migrate:status</p> </blockquote> <pre><code> Status Migration ID Migration Name ----------...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,561
git
# What is the best way to resolve Rails orphaned migrations? I have been switching between branches in a project and each of them have different migrations... This is the scenario: > $ rake db:migrate:status ``` Status Migration ID Migration Name -------------------------------------------------- ... up ...
I ended up solving the problem like this: **(1)** Go to the branches that has the migration files and roll them back. This is not trivial when you have many branches which are will result in many conflicts if you try to merge them. So I use this commands to find out the branches of each orphan migration belongs to. S...
34526346
Git pull asks me to write merge message
65
2015-12-30 09:11:51
<p>I pull from <strong>my branch</strong>:</p> <pre><code>git checkout mybranchSample git fetch git pull origin master </code></pre> <p>Then, Git gives me the following message:</p> <blockquote> <p>Please enter a commit message to explain why this merge is necessary,<br> especially if it merges an updated upstre...
82,747
3,326,275
2020-01-17 21:57:31
34,526,389
72
2015-12-30 09:14:43
871,050
2015-12-30 09:16:29
https://stackoverflow.com/q/34526346
https://stackoverflow.com/a/34526389
<p><code>git pull</code> is basically two actions at once: <code>git fetch</code> followed by a <code>git merge</code> (unless you use <code>git pull --rebase</code>, in which case you can guess what happens).</p> <p>The reason you're seeing this is because Git can't do a <strong>fast-forward</strong> merge, like it c...
<p><code>git pull</code> is basically two actions at once: <code>git fetch</code> followed by a <code>git merge</code> (unless you use <code>git pull --rebase</code>, in which case you can guess what happens).</p> <p>The reason you're seeing this is because Git can't do a <strong>fast-forward</strong> merge, like it c...
119, 28896, 28897
git, git-merge, git-pull
<h1>Git pull asks me to write merge message</h1> <p>I pull from <strong>my branch</strong>:</p> <pre><code>git checkout mybranchSample git fetch git pull origin master </code></pre> <p>Then, Git gives me the following message:</p> <blockquote> <p>Please enter a commit message to explain why this merge is necessary...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,562
git
# Git pull asks me to write merge message I pull from **my branch**: ``` git checkout mybranchSample git fetch git pull origin master ``` Then, Git gives me the following message: > Please enter a commit message to explain why this merge is necessary, > especially if it merges an updated upstream into a topic bra...
`git pull` is basically two actions at once: `git fetch` followed by a `git merge` (unless you use `git pull --rebase`, in which case you can guess what happens). The reason you're seeing this is because Git can't do a **fast-forward** merge, like it can most of the time. The reason for that is usually because you've ...
28105472
SourceTree very slow with many repositories
63
2015-01-23 08:04:25
<p>I work on a lot of small projects on daily basis and need to switch often.</p> <ul> <li>I have over 50 Git Repositories in Sourcetree.</li> <li>Usually 5 projects are open in "Tabs".</li> </ul> <p>Switching from "Tab" in SourceTree is very slow. Sometimes up to 15 seconds. How can I improve this behaviour?</p> <p...
48,064
2,614,299
2021-09-10 18:19:54
31,718,684
72
2015-07-30 08:25:26
371,917
2015-07-30 08:25:26
https://stackoverflow.com/q/28105472
https://stackoverflow.com/a/31718684
<p>I know this is an old question, but you could also try this:</p> <p><a href="https://stackoverflow.com/a/24045966/371917">https://stackoverflow.com/a/24045966/371917</a></p> <pre><code>$ git config --global core.preloadindex true $ git config --global core.fscache true $ git config --global gc.auto 256 </code></pr...
<p>I know this is an old question, but you could also try this:</p> <p><a href="https://stackoverflow.com/a/24045966/371917">https://stackoverflow.com/a/24045966/371917</a></p> <pre><code>$ git config --global core.preloadindex true $ git config --global core.fscache true $ git config --global gc.auto 256 </code></pr...
119, 598, 7330, 90056
atlassian-sourcetree, git, performance, repository
<h1>SourceTree very slow with many repositories</h1> <p>I work on a lot of small projects on daily basis and need to switch often.</p> <ul> <li>I have over 50 Git Repositories in Sourcetree.</li> <li>Usually 5 projects are open in "Tabs".</li> </ul> <p>Switching from "Tab" in SourceTree is very slow. Sometimes up to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,563
git
# SourceTree very slow with many repositories I work on a lot of small projects on daily basis and need to switch often. - I have over 50 Git Repositories in Sourcetree. - Usually 5 projects are open in "Tabs". Switching from "Tab" in SourceTree is very slow. Sometimes up to 15 seconds. How can I improve this behavi...
I know this is an old question, but you could also try this: <https://stackoverflow.com/a/24045966/371917> ``` $ git config --global core.preloadindex true $ git config --global core.fscache true $ git config --global gc.auto 256 ``` Secondly, here is a post that explains that `git gc --aggressive` [may not be a gre...
4600445
Git log output to XML, JSON, or YAML?
63
2011-01-05 02:56:12
<p>This is a pretty simple question: as a Git newbie I was wondering if there's a way for me to output my git log to a file, preferably in some kind of serialized format like XML, JSON, or YAML. Any suggestions?</p>
49,082
417,872
2025-06-24 06:42:02
4,600,561
72
2011-01-05 03:23:52
495,999
2014-10-13 15:29:21
https://stackoverflow.com/q/4600445
https://stackoverflow.com/a/4600561
<p>to output to a file:</p> <pre><code>git log &gt; filename.log </code></pre> <p>To specify a format, like you want everything on one line</p> <pre><code>git log --pretty=oneline &gt;filename.log </code></pre> <p>or you want it a format to be emailed via a program like sendmail</p> <pre><code>git log --pretty=ema...
<p>to output to a file:</p> <pre><code>git log &gt; filename.log </code></pre> <p>To specify a format, like you want everything on one line</p> <pre><code>git log --pretty=oneline &gt;filename.log </code></pre> <p>or you want it a format to be emailed via a program like sendmail</p> <pre><code>git log --pretty=ema...
119, 345, 456, 942, 5310
file, git, io, logging, version-control
<h1>Git log output to XML, JSON, or YAML?</h1> <p>This is a pretty simple question: as a Git newbie I was wondering if there's a way for me to output my git log to a file, preferably in some kind of serialized format like XML, JSON, or YAML. Any suggestions?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,564
git
# Git log output to XML, JSON, or YAML? This is a pretty simple question: as a Git newbie I was wondering if there's a way for me to output my git log to a file, preferably in some kind of serialized format like XML, JSON, or YAML. Any suggestions?
to output to a file: ``` git log > filename.log ``` To specify a format, like you want everything on one line ``` git log --pretty=oneline >filename.log ``` or you want it a format to be emailed via a program like sendmail ``` git log --pretty=email |email-sending-script.sh ``` to generate JSON, YAML or XML it lo...
17070293
git apply changes from one commit onto another branch
62
2013-06-12 16:07:32
<p>I want to do something similar to git rebase but without collapsing parallel commits.</p> <p>Let's say I have the following commits:</p> <pre><code> B (bar) / A-C-D (foo) </code></pre> <p>Now I want to take the changes that D introduced to C in branch foo, and apply them to B in branch bar. so that I end up wit...
49,982
899,470
2024-04-16 22:04:46
17,070,336
72
2013-06-12 16:10:12
1,646,106
2013-06-12 16:10:12
https://stackoverflow.com/q/17070293
https://stackoverflow.com/a/17070336
<p>Yes:</p> <pre><code>git checkout -b mergebranch B git cherry-pick D </code></pre>
<p>Yes:</p> <pre><code>git checkout -b mergebranch B git cherry-pick D </code></pre>
119, 8974, 36489, 78810
cherry-pick, git, git-cherry-pick, rebase
<h1>git apply changes from one commit onto another branch</h1> <p>I want to do something similar to git rebase but without collapsing parallel commits.</p> <p>Let's say I have the following commits:</p> <pre><code> B (bar) / A-C-D (foo) </code></pre> <p>Now I want to take the changes that D introduced to C in bran...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,565
git
# git apply changes from one commit onto another branch I want to do something similar to git rebase but without collapsing parallel commits. Let's say I have the following commits: ``` B (bar) / A-C-D (foo) ``` Now I want to take the changes that D introduced to C in branch foo, and apply them to B in branch ba...
Yes: ``` git checkout -b mergebranch B git cherry-pick D ```
14605231
Git merge branch into master
62
2013-01-30 13:29:12
<p>I have a master branch and a working <code>branch_1</code>. I want to 'move' <code>branch_1</code> exactly as it is to <code>master</code>. So I want something like this:</p> <pre><code>git checkout master git merge branch_1 # I don't know what is correct... </code></pre> <p>Things which I did but I got loads of f...
78,647
990,194
2023-02-26 01:32:10
14,605,307
72
2013-01-30 13:33:22
498,699
2014-03-13 14:41:15
https://stackoverflow.com/q/14605231
https://stackoverflow.com/a/14605307
<p>Conflicts are going to happen if both branches have changes to the files. This is a good thing. <strong>Keeping your branches up-to-date with each other will prevent some of them</strong> . However over all, conflicts are not bad. The rebase option can also prevent many of them from happening.</p> <pre><code>gi...
<p>Conflicts are going to happen if both branches have changes to the files. This is a good thing. <strong>Keeping your branches up-to-date with each other will prevent some of them</strong> . However over all, conflicts are not bad. The rebase option can also prevent many of them from happening.</p> <pre><code>gi...
119, 28897, 76220
git, git-branch, git-merge
<h1>Git merge branch into master</h1> <p>I have a master branch and a working <code>branch_1</code>. I want to 'move' <code>branch_1</code> exactly as it is to <code>master</code>. So I want something like this:</p> <pre><code>git checkout master git merge branch_1 # I don't know what is correct... </code></pre> <p>T...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,566
git
# Git merge branch into master I have a master branch and a working `branch_1`. I want to 'move' `branch_1` exactly as it is to `master`. So I want something like this: ``` git checkout master git merge branch_1 # I don't know what is correct... ``` Things which I did but I got loads of files messed up with annoying...
Conflicts are going to happen if both branches have changes to the files. This is a good thing. **Keeping your branches up-to-date with each other will prevent some of them** . However over all, conflicts are not bad. The rebase option can also prevent many of them from happening. ``` git merge branch_1 ``` If you ar...
26349191
Fatal: ambiguous argument '<branch_name>': both revision and filename
52
2014-10-13 21:31:13
<p>Here is what I did:</p> <ul> <li>I ran <code>git checkout -b branch_name</code>.</li> <li>I made some commits on <code>branch_name</code>.</li> <li>I checked out the <code>master</code> branch and did a fast-foward merge.</li> </ul> <p>When I run <code>git log branch_name --oneline</code>, I get the following mess...
50,987
1,708,393
2024-10-21 13:08:49
26,349,250
72
2014-10-13 21:35:36
4,021,077
2014-10-13 21:35:36
https://stackoverflow.com/q/26349191
https://stackoverflow.com/a/26349250
<p>It's telling you that you have a branch named 'branch_name' and also a file or a directory named 'branch_name'.</p> <p>If you want the command to treat 'branch_name' as a branch use</p> <pre><code>git log --oneline branch_name -- </code></pre> <p>if you want it to treat 'branch_name' as a file use </p> <pre><cod...
<p>It's telling you that you have a branch named 'branch_name' and also a file or a directory named 'branch_name'.</p> <p>If you want the command to treat 'branch_name' as a branch use</p> <pre><code>git log --oneline branch_name -- </code></pre> <p>if you want it to treat 'branch_name' as a file use </p> <pre><cod...
119, 456
git, version-control
<h1>Fatal: ambiguous argument '<branch_name>': both revision and filename</h1> <p>Here is what I did:</p> <ul> <li>I ran <code>git checkout -b branch_name</code>.</li> <li>I made some commits on <code>branch_name</code>.</li> <li>I checked out the <code>master</code> branch and did a fast-foward merge.</li> </ul> <p>...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,569
git
# Fatal: ambiguous argument '': both revision and filename Here is what I did: - I ran `git checkout -b branch_name`. - I made some commits on `branch_name`. - I checked out the `master` branch and did a fast-foward merge. When I run `git log branch_name --oneline`, I get the following message: ``` fatal: ambiguous...
It's telling you that you have a branch named 'branch_name' and also a file or a directory named 'branch_name'. If you want the command to treat 'branch_name' as a branch use ``` git log --oneline branch_name -- ``` if you want it to treat 'branch_name' as a file use ``` git log --oneline -- branch_name ```
12092714
How to git reset --hard everything but 4 files
51
2012-08-23 13:28:48
<p>Assuming nothing is staged, what's the recommended way to reset all the work you've done, except for files:</p> <pre><code>app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb </code></pre> <p>Other dirty files exist in app/models/ and app/views/ that I don't want to keep.</p>
30,611
726,295
2025-07-30 06:29:12
12,096,327
72
2012-08-23 16:36:05
438,742
2023-06-12 18:11:38
https://stackoverflow.com/q/12092714
https://stackoverflow.com/a/12096327
<p>As you described the problem, it doesn't look like you want do <code>reset</code>. The simplest thing for this is:</p> <pre><code>git add app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb git checkout . </code></pre> <p>so, it adds your 4 files into the index, and checks out clean versions (i.e. ...
<p>As you described the problem, it doesn't look like you want do <code>reset</code>. The simplest thing for this is:</p> <pre><code>git add app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb git checkout . </code></pre> <p>so, it adds your 4 files into the index, and checks out clean versions (i.e. ...
119
git
<h1>How to git reset --hard everything but 4 files</h1> <p>Assuming nothing is staged, what's the recommended way to reset all the work you've done, except for files:</p> <pre><code>app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb </code></pre> <p>Other dirty files exist in app/models/ and app/vi...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,570
git
# How to git reset --hard everything but 4 files Assuming nothing is staged, what's the recommended way to reset all the work you've done, except for files: ``` app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb ``` Other dirty files exist in app/models/ and app/views/ that I don't want to keep.
As you described the problem, it doesn't look like you want do `reset`. The simplest thing for this is: ``` git add app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb git checkout . ``` so, it adds your 4 files into the index, and checks out clean versions (i.e. discards changes) for other files. ...
3710192
How do I move a commit between branches in Git?
49
2010-09-14 15:06:42
<p>I'm sure this is a simple thing that has been asked and answered, but I don't know what terms to search for. I have this:</p> <pre><code> /--master--X--Y A--B \--C--D--E </code></pre> <p>Where I commited <code>C</code>, <code>D</code>, and <code>E</code> (locally only) on a branch, but then I realized that <c...
21,754
138,841
2024-03-21 08:27:01
3,710,351
72
2010-09-14 15:24:47
28,804
2024-03-19 18:55:38
https://stackoverflow.com/q/3710192
https://stackoverflow.com/a/3710351
<p>You can use <code>git cherry-pick</code> to grab <code>C</code>, and put it on <code>Y</code>. Assuming <code>Y</code> exists as the tip of a branch called <code>branch-Y</code>, you can run the following commands:</p> <pre><code>git checkout branch-Y git cherry-pick C </code></pre> <p>So now <code>C</code> is on to...
<p>You can use <code>git cherry-pick</code> to grab <code>C</code>, and put it on <code>Y</code>. Assuming <code>Y</code> exists as the tip of a branch called <code>branch-Y</code>, you can run the following commands:</p> <pre><code>git checkout branch-Y git cherry-pick C </code></pre> <p>So now <code>C</code> is on to...
119, 76220, 78810
git, git-branch, git-cherry-pick
<h1>How do I move a commit between branches in Git?</h1> <p>I'm sure this is a simple thing that has been asked and answered, but I don't know what terms to search for. I have this:</p> <pre><code> /--master--X--Y A--B \--C--D--E </code></pre> <p>Where I commited <code>C</code>, <code>D</code>, and <code>E</code...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,571
git
# How do I move a commit between branches in Git? I'm sure this is a simple thing that has been asked and answered, but I don't know what terms to search for. I have this: ``` /--master--X--Y A--B \--C--D--E ``` Where I commited `C`, `D`, and `E` (locally only) on a branch, but then I realized that `D` and `...
You can use `git cherry-pick` to grab `C`, and put it on `Y`. Assuming `Y` exists as the tip of a branch called `branch-Y`, you can run the following commands: ``` git checkout branch-Y git cherry-pick C ``` So now `C` is on top of `Y`. But `D` and `E` also still contain `C` (cherry-picking doesn't move a commit, it ...
4468322
Switch current branch in git bare repository
48
2010-12-17 06:40:40
<p>I actually want to remove a branch in the bare repository i am working with, but this task hits a dead end because I cannot switch away from the master repository without a 'work tree' which a bare repository does not have.</p> <p>When I run <code>git branch -d master</code> the output is:</p> <pre><code>error: Ca...
12,840
305,340
2010-12-17 06:51:49
4,468,341
72
2010-12-17 06:44:58
501,250
2010-12-17 06:51:49
https://stackoverflow.com/q/4468322
https://stackoverflow.com/a/4468341
<p>Try this instead of <code>git checkout</code>:</p> <pre><code>git symbolic-ref HEAD refs/heads/develop </code></pre> <p>Then you should be able to delete master.</p>
<p>Try this instead of <code>git checkout</code>:</p> <pre><code>git symbolic-ref HEAD refs/heads/develop </code></pre> <p>Then you should be able to delete master.</p>
119, 37230, 76220
git, git-branch, git-checkout
<h1>Switch current branch in git bare repository</h1> <p>I actually want to remove a branch in the bare repository i am working with, but this task hits a dead end because I cannot switch away from the master repository without a 'work tree' which a bare repository does not have.</p> <p>When I run <code>git branch -d ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,572
git
# Switch current branch in git bare repository I actually want to remove a branch in the bare repository i am working with, but this task hits a dead end because I cannot switch away from the master repository without a 'work tree' which a bare repository does not have. When I run `git branch -d master` the output is...
Try this instead of `git checkout`: ``` git symbolic-ref HEAD refs/heads/develop ``` Then you should be able to delete master.
244695
How to combine two branches from two different repositories in a single repository?
48
2008-10-28 20:18:36
<p>The structures of my Git repositories look like this:</p> <pre><code>A-B-C-D-E-F # master branch in separate repo1 A-B-C-D-E-G-H # master branch in separate repo2 </code></pre> <p>A-H are simple commits. As you can see the repositories are related (repo2 is a fork of repo1). I'm trying to combine these two repos...
26,481
20,467
2018-04-16 22:32:54
245,240
72
2008-10-28 23:18:09
101
2018-04-16 22:32:54
https://stackoverflow.com/q/244695
https://stackoverflow.com/a/245240
<p>You can treat another git repository on the same filesystem as a remote repo.</p> <p>In the first, do the following:</p> <pre><code>git remote add &lt;name&gt; /path/to/other/repo/.git git fetch &lt;name&gt; git branch &lt;name&gt; &lt;name&gt;/master #optional </code></pre> <p>Now they're both branches in a sing...
<p>You can treat another git repository on the same filesystem as a remote repo.</p> <p>In the first, do the following:</p> <pre><code>git remote add &lt;name&gt; /path/to/other/repo/.git git fetch &lt;name&gt; git branch &lt;name&gt; &lt;name&gt;/master #optional </code></pre> <p>Now they're both branches in a sing...
119
git
<h1>How to combine two branches from two different repositories in a single repository?</h1> <p>The structures of my Git repositories look like this:</p> <pre><code>A-B-C-D-E-F # master branch in separate repo1 A-B-C-D-E-G-H # master branch in separate repo2 </code></pre> <p>A-H are simple commits. As you can see t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,573
git
# How to combine two branches from two different repositories in a single repository? The structures of my Git repositories look like this: ``` A-B-C-D-E-F # master branch in separate repo1 A-B-C-D-E-G-H # master branch in separate repo2 ``` A-H are simple commits. As you can see the repositories are related (repo...
You can treat another git repository on the same filesystem as a remote repo. In the first, do the following: ``` git remote add <name> /path/to/other/repo/.git git fetch <name> git branch <name> <name>/master #optional ``` Now they're both branches in a single repository. You can switch between them with git checko...
4082175
How can I check which commits have not been pushed to origin?
46
2010-11-02 21:17:44
<p>I have made commits to my local branch (let's just say master) and have 'git pull'd down changes that others have made. When I run a 'git status', I see something like:</p> <pre><code># Your branch is ahead of 'origin/master' by 4 commits. </code></pre> <p>How can I see a list of the four commits that I have made ...
22,362
97,101
2010-11-02 22:49:30
4,082,762
72
2010-11-02 22:43:04
150,032
2010-11-02 22:49:30
https://stackoverflow.com/q/4082175
https://stackoverflow.com/a/4082762
<pre><code>git diff --stat origin/master </code></pre> <p>will show the changed files.</p> <pre><code>git log origin/master..master </code></pre> <p>will show the commits.</p>
<pre><code>git diff --stat origin/master </code></pre> <p>will show the changed files.</p> <pre><code>git log origin/master..master </code></pre> <p>will show the commits.</p>
119
git
<h1>How can I check which commits have not been pushed to origin?</h1> <p>I have made commits to my local branch (let's just say master) and have 'git pull'd down changes that others have made. When I run a 'git status', I see something like:</p> <pre><code># Your branch is ahead of 'origin/master' by 4 commits. </cod...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,574
git
# How can I check which commits have not been pushed to origin? I have made commits to my local branch (let's just say master) and have 'git pull'd down changes that others have made. When I run a 'git status', I see something like: ``` # Your branch is ahead of 'origin/master' by 4 commits. ``` How can I see a list...
``` git diff --stat origin/master ``` will show the changed files. ``` git log origin/master..master ``` will show the commits.
10330080
git-diff: Only show changes staged for committing
44
2012-04-26 08:49:54
<p>I want to see diff on files that I've added to commit (<code>git add something</code>). I can do this:</p> <pre><code>git diff HEAD `git status -s | grep ^M | cut -c 4-` </code></pre> <p>Is there a shorter way?</p>
12,113
126,529
2012-04-26 08:54:02
10,330,093
72
2012-04-26 08:50:36
298,479
2012-04-26 08:50:36
https://stackoverflow.com/q/10330080
https://stackoverflow.com/a/10330093
<p>You can use <code>git diff --staged</code> (or <code>git diff --cached</code>) to see the diff that will be used when committing.</p> <p>From the manpage:</p> <blockquote> <p><code>git diff [--options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;...]</code><br> This form is to view the changes you staged for ...
<p>You can use <code>git diff --staged</code> (or <code>git diff --cached</code>) to see the diff that will be used when committing.</p> <p>From the manpage:</p> <blockquote> <p><code>git diff [--options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;...]</code><br> This form is to view the changes you staged for ...
119, 9033
git, git-diff
<h1>git-diff: Only show changes staged for committing</h1> <p>I want to see diff on files that I've added to commit (<code>git add something</code>). I can do this:</p> <pre><code>git diff HEAD `git status -s | grep ^M | cut -c 4-` </code></pre> <p>Is there a shorter way?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,576
git
# git-diff: Only show changes staged for committing I want to see diff on files that I've added to commit (`git add something`). I can do this: ``` git diff HEAD `git status -s | grep ^M | cut -c 4-` ``` Is there a shorter way?
You can use `git diff --staged` (or `git diff --cached`) to see the diff that will be used when committing. From the manpage: > `git diff [--options] --cached [<commit>] [--] [<path>...]` > This form is to view the changes you staged for the next commit relative to the named `<commit>`. Typically you would want com...
20069297
Bower "Git not in the PATH" error
28
2013-11-19 10:42:38
<p>I just installed git and bower via NPM for a project. It's a first time use.</p> <p>Then I tried running <code>bower install jQuery</code> for example, I get this specific error:</p> <p><code>ENOGIT git is not installed or not in the PATH</code></p> <p>Where can I actually define paths and how, and when we say PA...
77,125
1,966,211
2017-03-12 19:59:56
20,069,763
72
2013-11-19 11:03:26
2,137,601
2016-05-02 08:41:24
https://stackoverflow.com/q/20069297
https://stackoverflow.com/a/20069763
<p>Install <a href="https://msysgit.github.io/" rel="noreferrer">msysgit</a>, as stated in <a href="https://github.com/bower/bower#a-note-for-windows-users" rel="noreferrer">the Bower documentation</a>:</p> <blockquote> <p>To use Bower on Windows, you must install msysgit correctly. Be sure to check the option shown be...
<p>Install <a href="https://msysgit.github.io/" rel="noreferrer">msysgit</a>, as stated in <a href="https://github.com/bower/bower#a-note-for-windows-users" rel="noreferrer">the Bower documentation</a>:</p> <blockquote> <p>To use Bower on Windows, you must install msysgit correctly. Be sure to check the option shown be...
3, 119, 46426
git, javascript, node.js
<h1>Bower "Git not in the PATH" error</h1> <p>I just installed git and bower via NPM for a project. It's a first time use.</p> <p>Then I tried running <code>bower install jQuery</code> for example, I get this specific error:</p> <p><code>ENOGIT git is not installed or not in the PATH</code></p> <p>Where can I actual...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,580
git
# Bower "Git not in the PATH" error I just installed git and bower via NPM for a project. It's a first time use. Then I tried running `bower install jQuery` for example, I get this specific error: `ENOGIT git is not installed or not in the PATH` Where can I actually define paths and how, and when we say PATHs, what...
Install [msysgit](https://msysgit.github.io/), as stated in [the Bower documentation](https://github.com/bower/bower#a-note-for-windows-users): > To use Bower on Windows, you must install msysgit correctly. Be sure to check the option shown below: > > [ ] Use Git bash only > > [x] Run Git from the Windows Command Prom...
4277773
How to get latest tag name?
26
2010-11-25 13:51:19
<p>How to get latest tag name (like version) of current branch?</p>
43,604
481,374
2016-10-27 07:12:04
4,277,828
72
2010-11-25 13:57:53
6,309
2016-10-27 07:12:04
https://stackoverflow.com/q/4277773
https://stackoverflow.com/a/4277828
<p><strong><a href="http://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a></strong> should be enough</p> <blockquote> <p>The command finds the most recent tag that is reachable from a commit.<br> If the tag points to the commit, then only the tag is shown....
<p><strong><a href="http://www.kernel.org/pub/software/scm/git/docs/git-describe.html" rel="noreferrer"><code>git describe</code></a></strong> should be enough</p> <blockquote> <p>The command finds the most recent tag that is reachable from a commit.<br> If the tag points to the commit, then only the tag is shown....
119
git
<h1>How to get latest tag name?</h1> <p>How to get latest tag name (like version) of current branch?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,581
git
# How to get latest tag name? How to get latest tag name (like version) of current branch?
**[`git describe`](http://www.kernel.org/pub/software/scm/git/docs/git-describe.html)** should be enough > The command finds the most recent tag that is reachable from a commit. > If the tag points to the commit, then only the tag is shown. > Otherwise, it suffixes the tag name with the number of additional commit...
6310208
Overriding remote git repository with my repository
25
2011-06-10 17:50:24
<p>The remote repository contains a bad version. I have the copy of a good version locally. I want to replace everything that's on the remote repository with my current repository (the remote repository has a few more commits (including a merge) that should not have happened).</p> <p>If I try to push, it tells me I ne...
24,286
732,284
2011-06-10 17:53:21
6,310,229
72
2011-06-10 17:51:57
148,870
2011-06-10 17:51:57
https://stackoverflow.com/q/6310208
https://stackoverflow.com/a/6310229
<p>Use the <code>--force</code>, Luke.</p> <p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer">http://www.kernel.org/pub/software/scm/git/docs/git-push.html</a></p>
<p>Use the <code>--force</code>, Luke.</p> <p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer">http://www.kernel.org/pub/software/scm/git/docs/git-push.html</a></p>
119
git
<h1>Overriding remote git repository with my repository</h1> <p>The remote repository contains a bad version. I have the copy of a good version locally. I want to replace everything that's on the remote repository with my current repository (the remote repository has a few more commits (including a merge) that should n...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,582
git
# Overriding remote git repository with my repository The remote repository contains a bad version. I have the copy of a good version locally. I want to replace everything that's on the remote repository with my current repository (the remote repository has a few more commits (including a merge) that should not have h...
Use the `--force`, Luke. <http://www.kernel.org/pub/software/scm/git/docs/git-push.html>
1220309
git difftool, open all diff files immediately, not in serial
294
2009-08-03 00:52:51
<p>The default git diff behavior is to open each diff file in serial (wait for previous file to be closed before opening next file). </p> <p>I'm looking for a way to open all the files at once - in BeyondCompare for example this would open all the files in tabs within the same BC window.</p> <p>This would make it eas...
74,530
93,451
2022-12-13 22:17:34
1,291,578
71
2009-08-18 03:04:30
93,451
2019-03-05 17:29:49
https://stackoverflow.com/q/1220309
https://stackoverflow.com/a/1291578
<p>Here's what I settled on...</p> <p>Copy the following code to a file called <code>git-diffall</code> (no extension):</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh git diff --name-only "$@" | while read filename; do git difftool "$@" --no-prompt "$filename" &amp; done </code></pre> <p>Place the...
<p>Here's what I settled on...</p> <p>Copy the following code to a file called <code>git-diffall</code> (no extension):</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/sh git diff --name-only "$@" | while read filename; do git difftool "$@" --no-prompt "$filename" &amp; done </code></pre> <p>Place the...
119, 33608
difftool, git
<h1>git difftool, open all diff files immediately, not in serial</h1> <p>The default git diff behavior is to open each diff file in serial (wait for previous file to be closed before opening next file). </p> <p>I'm looking for a way to open all the files at once - in BeyondCompare for example this would open all the f...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,583
git
# git difftool, open all diff files immediately, not in serial The default git diff behavior is to open each diff file in serial (wait for previous file to be closed before opening next file). I'm looking for a way to open all the files at once - in BeyondCompare for example this would open all the files in tabs with...
Here's what I settled on... Copy the following code to a file called `git-diffall` (no extension): ``` #!/bin/sh git diff --name-only "$@" | while read filename; do git difftool "$@" --no-prompt "$filename" & done ``` Place the file in the `cmd` folder of your git install dir (eg `C:\Program Files (x86)\Git\cmd`...
2500586
Setting git default flags on commands
96
2010-03-23 14:17:16
<p>I want to know if there is a way to set a flag by default for git command. Specifically, I want to set the <code>--abbrev-commit</code> flag so that when executing <code>git log</code>, I want to execute <code>git log --abbrev-commit</code>.</p> <p>Unlike the question "<a href="https://stackoverflow.com/questions/1...
27,622
109,305
2022-09-14 19:45:25
11,884,798
71
2012-08-09 13:42:03
804,147
2012-08-09 13:42:03
https://stackoverflow.com/q/2500586
https://stackoverflow.com/a/11884798
<p>Since git version 1.7.6, git config has gained a log.abbrevCommit option which can be set to true. Thus the answer is upgrade to at least 1.7.6 (current as of this writing is 1.7.11.4) and use:</p> <pre><code>git config --global log.abbrevCommit true </code></pre>
<p>Since git version 1.7.6, git config has gained a log.abbrevCommit option which can be set to true. Thus the answer is upgrade to at least 1.7.6 (current as of this writing is 1.7.11.4) and use:</p> <pre><code>git config --global log.abbrevCommit true </code></pre>
119, 942
git, logging
<h1>Setting git default flags on commands</h1> <p>I want to know if there is a way to set a flag by default for git command. Specifically, I want to set the <code>--abbrev-commit</code> flag so that when executing <code>git log</code>, I want to execute <code>git log --abbrev-commit</code>.</p> <p>Unlike the question ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,584
git
# Setting git default flags on commands I want to know if there is a way to set a flag by default for git command. Specifically, I want to set the `--abbrev-commit` flag so that when executing `git log`, I want to execute `git log --abbrev-commit`. Unlike the question "[is there any way to set a flag by default for a...
Since git version 1.7.6, git config has gained a log.abbrevCommit option which can be set to true. Thus the answer is upgrade to at least 1.7.6 (current as of this writing is 1.7.11.4) and use: ``` git config --global log.abbrevCommit true ```
11261088
What does “~ (END)” mean when displayed in a terminal?
85
2012-06-29 11:38:18
<p>I'm running through the gitimmersion.com labs and every time I run a: git hist --all command it seems to break terminal and throw this:</p> <blockquote> <p>~<br/> ~<br/> ~<br/> ~<br/> (END)</p> </blockquote> <p>and I'm not able to type any more commands. So I end up closing that terminal window and start...
107,358
1,491,045
2025-02-21 15:19:25
11,261,214
71
2012-06-29 11:47:22
718,180
2012-06-29 12:07:01
https://stackoverflow.com/q/11261088
https://stackoverflow.com/a/11261214
<p>Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The <code>~</code> characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of ou...
<p>Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The <code>~</code> characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of ou...
119, 391
git, terminal
<h1>What does “~ (END)” mean when displayed in a terminal?</h1> <p>I'm running through the gitimmersion.com labs and every time I run a: git hist --all command it seems to break terminal and throw this:</p> <blockquote> <p>~<br/> ~<br/> ~<br/> ~<br/> (END)</p> </blockquote> <p>and I'm not able to type any m...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,585
git
# What does “~ (END)” mean when displayed in a terminal? I'm running through the gitimmersion.com labs and every time I run a: git hist --all command it seems to break terminal and throw this: > ~ > ~ > ~ > ~ > (END) and I'm not able to type any more commands. So I end up closing that terminal window and sta...
Git pipes long output into what's called a pager by default, which can make it easier to view the output if it doesn't fit on a screen. The `~` characters indicate that those lines were not in the original output, but it's showing them so that you can scroll down past the bottom (i.e. the last line of output can go up ...
15653066
How to track but not stage and how to unstage but not untrack?
84
2013-03-27 06:30:58
<p>I have two concise questions:</p> <ul> <li>How I can track files but without staging them ?</li> <li>How I can unstage files for commit without untracking them ?</li> </ul> <p><strong>NOTE:</strong> <em>I know that I can do an initial commit to track the files and start from there with my files tracked. But is pos...
32,145
null
2025-02-08 23:48:18
15,653,161
71
2013-03-27 06:40:44
6,309
2017-10-18 11:43:03
https://stackoverflow.com/q/15653066
https://stackoverflow.com/a/15653161
<p>Update (May 2015)</p> <blockquote> <p>I tried to use <code>git add -N &lt;expr&gt;</code> but it tracks the file and add it for commit:</p> </blockquote> <p>That is no longer the case with the upcoming Git 2.5 (Q2 2015).<br> See "<a href="https://stackoverflow.com/a/30341632/6309">File doesn′t get into the commi...
<p>Update (May 2015)</p> <blockquote> <p>I tried to use <code>git add -N &lt;expr&gt;</code> but it tracks the file and add it for commit:</p> </blockquote> <p>That is no longer the case with the upcoming Git 2.5 (Q2 2015).<br> See "<a href="https://stackoverflow.com/a/30341632/6309">File doesn′t get into the commi...
119
git
<h1>How to track but not stage and how to unstage but not untrack?</h1> <p>I have two concise questions:</p> <ul> <li>How I can track files but without staging them ?</li> <li>How I can unstage files for commit without untracking them ?</li> </ul> <p><strong>NOTE:</strong> <em>I know that I can do an initial commit t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,586
git
# How to track but not stage and how to unstage but not untrack? I have two concise questions: - How I can track files but without staging them ? - How I can unstage files for commit without untracking them ? **NOTE:** *I know that I can do an initial commit to track the files and start from there with my files trac...
Update (May 2015) > I tried to use `git add -N <expr>` but it tracks the file and add it for commit: That is no longer the case with the upcoming Git 2.5 (Q2 2015). See "[File doesn′t get into the commit after using `git add -N`](https://stackoverflow.com/a/30341632/6309)" --- Original answer (March 2013) > How ...
12054223
git - new user trying to do pull and getting some confusing messages
83
2012-08-21 11:50:36
<p>I am pretty new to git. I have been primarily checking stuff into a repository, but now I want to get the latest changes from another developer.</p> <p>I tried to simply do a command like <code>git pull</code> something ran, but it came back with a message like this:</p> <pre><code>There is no tracking information...
98,936
731,255
2022-08-04 09:42:47
12,054,269
71
2012-08-21 11:53:28
978,515
2012-08-21 11:58:34
https://stackoverflow.com/q/12054223
https://stackoverflow.com/a/12054269
<p>I think you missed the name of the remote when pulling:</p> <pre><code>git pull &lt;remote&gt; my_branch_name </code></pre> <p>Run this command:</p> <pre><code>git remote -v </code></pre> <p>And check what is the name of the remote you want to pull from</p> <p>EDIT:</p> <p>If you are new to Git, I would recomm...
<p>I think you missed the name of the remote when pulling:</p> <pre><code>git pull &lt;remote&gt; my_branch_name </code></pre> <p>Run this command:</p> <pre><code>git remote -v </code></pre> <p>And check what is the name of the remote you want to pull from</p> <p>EDIT:</p> <p>If you are new to Git, I would recomm...
119
git
<h1>git - new user trying to do pull and getting some confusing messages</h1> <p>I am pretty new to git. I have been primarily checking stuff into a repository, but now I want to get the latest changes from another developer.</p> <p>I tried to simply do a command like <code>git pull</code> something ran, but it came b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,587
git
# git - new user trying to do pull and getting some confusing messages I am pretty new to git. I have been primarily checking stuff into a repository, but now I want to get the latest changes from another developer. I tried to simply do a command like `git pull` something ran, but it came back with a message like thi...
I think you missed the name of the remote when pulling: ``` git pull <remote> my_branch_name ``` Run this command: ``` git remote -v ``` And check what is the name of the remote you want to pull from EDIT: If you are new to Git, I would recommend you [this book](http://git-scm.com/book). It covers from basic to a...
8978650
How do I move my local Git repository to a remote Git repository
79
2012-01-23 21:12:47
<p>I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while keeping the history intact?</p> <p>Thanks!</p> <p>EDIT: Thanks for all the great answers. The response I choose make...
100,787
321,721
2021-06-26 01:34:46
8,978,681
71
2012-01-23 21:15:10
112,968
2012-01-23 21:15:10
https://stackoverflow.com/q/8978650
https://stackoverflow.com/a/8978681
<p>On your server create the git repositories as bare repository</p> <pre><code>git init --bare repo.git </code></pre> <p>then, push the commits of your local repository</p> <pre><code>git push --mirror ssh://yourserver/~/repo.git </code></pre>
<p>On your server create the git repositories as bare repository</p> <pre><code>git init --bare repo.git </code></pre> <p>then, push the commits of your local repository</p> <pre><code>git push --mirror ssh://yourserver/~/repo.git </code></pre>
119
git
<h1>How do I move my local Git repository to a remote Git repository</h1> <p>I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while keeping the history intact?</p> <p>Thanks!<...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,588
git
# How do I move my local Git repository to a remote Git repository I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while keeping the history intact? Thanks! EDIT: Thanks for...
On your server create the git repositories as bare repository ``` git init --bare repo.git ``` then, push the commits of your local repository ``` git push --mirror ssh://yourserver/~/repo.git ```
7993413
git submodules with modified and untracked content - why and how to remove it?
75
2011-11-03 10:34:45
<p>this is what my <code>git status</code>' result looks like:</p> <pre><code># On branch master # Changed but not updated: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;..." to discard changes in working directory) # (commit or discard the untracked or mo...
81,367
223,852
2024-08-05 22:41:18
7,993,703
71
2011-11-03 10:57:14
223,092
2011-11-03 10:57:14
https://stackoverflow.com/q/7993413
https://stackoverflow.com/a/7993703
<p>One of the tracked files in <code>vim/bundle/pathogen</code> has been modified somehow. There is also some untracked (and unignored) content in the submodule <code>vim/bundle/sparkup</code>. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run <code>g...
<p>One of the tracked files in <code>vim/bundle/pathogen</code> has been modified somehow. There is also some untracked (and unignored) content in the submodule <code>vim/bundle/sparkup</code>. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run <code>g...
119
git
<h1>git submodules with modified and untracked content - why and how to remove it?</h1> <p>this is what my <code>git status</code>' result looks like:</p> <pre><code># On branch master # Changed but not updated: # (use "git add &lt;file&gt;..." to update what will be committed) # (use "git checkout -- &lt;file&gt;...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,590
git
# git submodules with modified and untracked content - why and how to remove it? this is what my `git status`' result looks like: ``` # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working director...
One of the tracked files in `vim/bundle/pathogen` has been modified somehow. There is also some untracked (and unignored) content in the submodule `vim/bundle/sparkup`. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run `git status`. (In the case of untr...
39847781
Which are the plumbing and porcelain commands?
73
2016-10-04 08:40:18
<p>For <strong><code>git</code> commands</strong> there is this distinction between "plumbing" and "porcelain" commands. How can I determine what would be classified as a plumbing one or a porcelain one? i.e. What is the border line that allows me to differentiate?</p> <p>I'm not asking what a porcelain or plumbing ...
19,987
2,262,522
2022-03-10 17:12:13
39,848,551
71
2016-10-04 09:19:00
1,256,452
2020-05-31 11:01:12
https://stackoverflow.com/q/39847781
https://stackoverflow.com/a/39848551
<p>As <a href="https://stackoverflow.com/a/39848056/1256452">blue112 noted</a>, the dividing line is fuzzy. <a href="https://www.kernel.org/pub/software/scm/git/docs/git.html" rel="noreferrer">The very first documentation page</a>, however, has an explicit list (and <a href="https://stackoverflow.com/questions/3984778...
<p>As <a href="https://stackoverflow.com/a/39848056/1256452">blue112 noted</a>, the dividing line is fuzzy. <a href="https://www.kernel.org/pub/software/scm/git/docs/git.html" rel="noreferrer">The very first documentation page</a>, however, has an explicit list (and <a href="https://stackoverflow.com/questions/3984778...
119
git
<h1>Which are the plumbing and porcelain commands?</h1> <p>For <strong><code>git</code> commands</strong> there is this distinction between "plumbing" and "porcelain" commands. How can I determine what would be classified as a plumbing one or a porcelain one? i.e. What is the border line that allows me to differentia...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,591
git
# Which are the plumbing and porcelain commands? For **`git` commands** there is this distinction between "plumbing" and "porcelain" commands. How can I determine what would be classified as a plumbing one or a porcelain one? i.e. What is the border line that allows me to differentiate? I'm not asking what a porcelai...
As [blue112 noted](https://stackoverflow.com/a/39848056/1256452), the dividing line is fuzzy. [The very first documentation page](https://www.kernel.org/pub/software/scm/git/docs/git.html), however, has an explicit list (and [as R.M. notes below](https://stackoverflow.com/questions/39847781/which-are-the-plumbing-and-p...
41718822
How to "resolve fatal: Not a git repository"?
71
2017-01-18 11:57:54
<p>I was trying to remove one sub-module from the project</p> <p>Tried <strong>rm -rf .git/modules/submodulePath</strong> </p> <p>After that I am having the issue</p> <p><strong>fatal: Not a git repository</strong></p>
110,712
3,916,927
2023-06-13 13:42:59
41,719,020
71
2017-01-18 12:07:37
6,107,715
2023-06-13 13:42:59
https://stackoverflow.com/q/41718822
https://stackoverflow.com/a/41719020
<p>These two files contains absolute submodule path:</p> <pre class="lang-none prettyprint-override"><code>{submodule}/.git .git/modules/{submodule}/config </code></pre> <p>So, if you moved the repo, the absolute path in these two files are not valid, and cause the 'not a git repository' error. Just fix these files man...
<p>These two files contains absolute submodule path:</p> <pre class="lang-none prettyprint-override"><code>{submodule}/.git .git/modules/{submodule}/config </code></pre> <p>So, if you moved the repo, the absolute path in these two files are not valid, and cause the 'not a git repository' error. Just fix these files man...
119, 41612
git, git-submodules
<h1>How to "resolve fatal: Not a git repository"?</h1> <p>I was trying to remove one sub-module from the project</p> <p>Tried <strong>rm -rf .git/modules/submodulePath</strong> </p> <p>After that I am having the issue</p> <p><strong>fatal: Not a git repository</strong></p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,592
git
# How to "resolve fatal: Not a git repository"? I was trying to remove one sub-module from the project Tried **rm -rf .git/modules/submodulePath** After that I am having the issue **fatal: Not a git repository**
These two files contains absolute submodule path: ``` {submodule}/.git .git/modules/{submodule}/config ``` So, if you moved the repo, the absolute path in these two files are not valid, and cause the 'not a git repository' error. Just fix these files manually. **Update:** 1. Delete the relevant section from the .gi...
43662048
Getting 'fatal: empty ident name not allowed' when doing 'Git commit --amend'
67
2017-04-27 15:31:14
<p>I am doing a <code>git commit --amend</code> and I get this error:</p> <blockquote> <p>fatal: empty ident name (for &lt;&gt;) not allowed</p> </blockquote> <p>I've found a bunch of stuff saying I need to set my <code>user.email</code> and <code>user.name</code>, but I have. This is the the result when I do a <code>g...
126,643
873,268
2024-06-28 19:50:54
43,662,115
71
2017-04-27 15:34:32
3,448,527
2024-06-28 19:50:54
https://stackoverflow.com/q/43662048
https://stackoverflow.com/a/43662115
<p>Set global <code>user.name</code> and <code>user.email</code> first by order like below.</p> <pre><code>$ git config --global user.name &quot;dzou&quot; $ git config --global user.email &quot;dzou@company.com&quot; </code></pre> <p><strong>NB:</strong> careful, use double quote instead of single quotes</p>
<p>Set global <code>user.name</code> and <code>user.email</code> first by order like below.</p> <pre><code>$ git config --global user.name &quot;dzou&quot; $ git config --global user.email &quot;dzou@company.com&quot; </code></pre> <p><strong>NB:</strong> careful, use double quote instead of single quotes</p>
119
git
<h1>Getting 'fatal: empty ident name not allowed' when doing 'Git commit --amend'</h1> <p>I am doing a <code>git commit --amend</code> and I get this error:</p> <blockquote> <p>fatal: empty ident name (for &lt;&gt;) not allowed</p> </blockquote> <p>I've found a bunch of stuff saying I need to set my <code>user.email</c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,593
git
# Getting 'fatal: empty ident name not allowed' when doing 'Git commit --amend' I am doing a `git commit --amend` and I get this error: > fatal: empty ident name (for <>) not allowed I've found a bunch of stuff saying I need to set my `user.email` and `user.name`, but I have. This is the the result when I do a `git ...
Set global `user.name` and `user.email` first by order like below. ``` $ git config --global user.name "dzou" $ git config --global user.email "dzou@company.com" ``` **NB:** careful, use double quote instead of single quotes
40148442
Mainline parent number when cherry picking merge commits
65
2016-10-20 07:47:48
<p>Suppose this is my git history</p> <pre> Z / A -- C -- D \ / B </pre> <p>My HEAD is currently at <code>Z</code>. I want to cherry-pick <code>B</code> and <code>C</code>. If my understanding is correct, I should do this:</p> <pre><code>git cherry-pick B git cherry-pick C -m 1 git commit --allow-empty </c...
65,401
404,623
2016-10-21 01:24:46
40,166,605
71
2016-10-21 00:34:53
2,747,593
2016-10-21 00:34:53
https://stackoverflow.com/q/40148442
https://stackoverflow.com/a/40166605
<p>My understanding based off <a href="//stackoverflow.com/a/12628579/2747593">this answer</a> is that parent 1 is the branch being merged into, and parent 2 is the branch being merged from. So in your case, parent 1 is <code>A</code>, and parent 2 is <code>B</code>. Since a cherry-pick is really applying the diff betw...
<p>My understanding based off <a href="//stackoverflow.com/a/12628579/2747593">this answer</a> is that parent 1 is the branch being merged into, and parent 2 is the branch being merged from. So in your case, parent 1 is <code>A</code>, and parent 2 is <code>B</code>. Since a cherry-pick is really applying the diff betw...
119, 36489, 78810
cherry-pick, git, git-cherry-pick
<h1>Mainline parent number when cherry picking merge commits</h1> <p>Suppose this is my git history</p> <pre> Z / A -- C -- D \ / B </pre> <p>My HEAD is currently at <code>Z</code>. I want to cherry-pick <code>B</code> and <code>C</code>. If my understanding is correct, I should do this:</p> <pre><code>git...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,595
git
# Mainline parent number when cherry picking merge commits Suppose this is my git history ``` Z / A -- C -- D \ / B ``` My HEAD is currently at `Z`. I want to cherry-pick `B` and `C`. If my understanding is correct, I should do this: ``` git cherry-pick B git cherry-pick C -m 1 git commit --allow-empty...
My understanding based off [this answer](//stackoverflow.com/a/12628579/2747593) is that parent 1 is the branch being merged into, and parent 2 is the branch being merged from. So in your case, parent 1 is `A`, and parent 2 is `B`. Since a cherry-pick is really applying the diff between two commits, you use `-m 1` to a...
5901300
How do I view previous diff commits using Git?
60
2011-05-05 16:44:31
<p>How do I view previous diff commits using Git?</p> <p>I have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my code. By the way, I'm using Tower as a GUI on top of Git....
28,838
259,912
2018-07-19 20:35:55
5,901,385
71
2011-05-05 16:51:00
589,149
2014-07-28 10:09:03
https://stackoverflow.com/q/5901300
https://stackoverflow.com/a/5901385
<pre><code>git log --full-diff -p your_file_path </code></pre> <p>Check out: <br> <a href="http://git-scm.com/docs/git-log">http://git-scm.com/docs/git-log</a></p>
<pre><code>git log --full-diff -p your_file_path </code></pre> <p>Check out: <br> <a href="http://git-scm.com/docs/git-log">http://git-scm.com/docs/git-log</a></p>
119, 606
diff, git
<h1>How do I view previous diff commits using Git?</h1> <p>How do I view previous diff commits using Git?</p> <p>I have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,597
git
# How do I view previous diff commits using Git? How do I view previous diff commits using Git? I have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my code. By the way,...
``` git log --full-diff -p your_file_path ``` Check out: <http://git-scm.com/docs/git-log>
460297
Git - finding the SHA1 of an individual file in the index
57
2009-01-20 06:50:03
<p>I've added a file to the 'index' with: </p> <pre><code>git add myfile.java </code></pre> <p>How do I find out the SHA1 of this file?</p>
65,189
52,416
2023-01-28 00:50:14
460,422
71
2009-01-20 08:04:05
19,563
2009-01-20 08:04:05
https://stackoverflow.com/q/460297
https://stackoverflow.com/a/460422
<p>You want the <code>-s</code> option to <code>git ls-files</code>. This gives you the mode and sha1 hash of the file in the index.</p> <pre><code>git ls-files -s myfile.java </code></pre> <p>Note that you do not want <code>git hash-object</code> as this gives you the sha1 id of the file in the working tree as it cu...
<p>You want the <code>-s</code> option to <code>git ls-files</code>. This gives you the mode and sha1 hash of the file in the index.</p> <pre><code>git ls-files -s myfile.java </code></pre> <p>Note that you do not want <code>git hash-object</code> as this gives you the sha1 id of the file in the working tree as it cu...
119, 3190
git, sha1
<h1>Git - finding the SHA1 of an individual file in the index</h1> <p>I've added a file to the 'index' with: </p> <pre><code>git add myfile.java </code></pre> <p>How do I find out the SHA1 of this file?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,598
git
# Git - finding the SHA1 of an individual file in the index I've added a file to the 'index' with: ``` git add myfile.java ``` How do I find out the SHA1 of this file?
You want the `-s` option to `git ls-files`. This gives you the mode and sha1 hash of the file in the index. ``` git ls-files -s myfile.java ``` Note that you do not want `git hash-object` as this gives you the sha1 id of the file in the working tree as it currently is, not of the file that you've added to the index. ...
5248103
Git revert last commit in heroku
55
2011-03-09 15:34:40
<p>I made acommit and pushed it to origin and heroku</p> <p>Then I realised it was wrong, so I did</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>But when I'm pushing to Heroku Im getting</p> <pre><code>To git@heroku.com:app.git ! [rejected] master -&gt; master (non-fast-forward) error: failed to p...
33,594
471,313
2013-09-17 16:19:03
5,248,205
71
2011-03-09 15:43:06
93,252
2012-07-19 00:16:50
https://stackoverflow.com/q/5248103
https://stackoverflow.com/a/5248205
<p>If you've reverted the commit locally you may need to <code>git push</code> with a <code>-f</code> option to force the commit in.</p> <p>Also, you may want to have a look at <a href="https://devcenter.heroku.com/articles/releases" rel="noreferrer">Heroku releases</a> which may help too.</p>
<p>If you've reverted the commit locally you may need to <code>git push</code> with a <code>-f</code> option to force the commit in.</p> <p>Also, you may want to have a look at <a href="https://devcenter.heroku.com/articles/releases" rel="noreferrer">Heroku releases</a> which may help too.</p>
119, 8279
git, heroku
<h1>Git revert last commit in heroku</h1> <p>I made acommit and pushed it to origin and heroku</p> <p>Then I realised it was wrong, so I did</p> <pre><code>git reset --soft HEAD^ </code></pre> <p>But when I'm pushing to Heroku Im getting</p> <pre><code>To git@heroku.com:app.git ! [rejected] master -&gt; ma...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,601
git
# Git revert last commit in heroku I made acommit and pushed it to origin and heroku Then I realised it was wrong, so I did ``` git reset --soft HEAD^ ``` But when I'm pushing to Heroku Im getting ``` To git@heroku.com:app.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs...
If you've reverted the commit locally you may need to `git push` with a `-f` option to force the commit in. Also, you may want to have a look at [Heroku releases](https://devcenter.heroku.com/articles/releases) which may help too.
3150394
How can I undelete a file previously deleted in Git's history?
53
2010-06-30 14:49:55
<p>Using <a href="https://stackoverflow.com/questions/3147097/how-to-prepend-the-past-to-a-git-repository/3148117#3148117">Chris's answer</a> on another question, I could prepend a snapshot-history to my Git repository. Since one of the files is not part of my history, but only in the snapshots, the first original comm...
33,571
321,973
2025-05-26 14:45:33
3,150,528
71
2010-06-30 15:03:53
321,973
2025-05-26 14:45:33
https://stackoverflow.com/q/3150394
https://stackoverflow.com/a/3150528
<p>I got it:</p> <pre class="lang-bash prettyprint-override"><code>git tag originalHead # Just in case git rebase -i &lt;id of the parent of the commit that deleted the file&gt; # Change pick to edit for that commit git checkout &lt;id of the previous commit&gt; &lt;filename&gt; # Thanks for reminding, kubi git commit ...
<p>I got it:</p> <pre class="lang-bash prettyprint-override"><code>git tag originalHead # Just in case git rebase -i &lt;id of the parent of the commit that deleted the file&gt; # Change pick to edit for that commit git checkout &lt;id of the previous commit&gt; &lt;filename&gt; # Thanks for reminding, kubi git commit ...
119, 1318, 7330, 50016
git, history, repository, undelete
<h1>How can I undelete a file previously deleted in Git's history?</h1> <p>Using <a href="https://stackoverflow.com/questions/3147097/how-to-prepend-the-past-to-a-git-repository/3148117#3148117">Chris's answer</a> on another question, I could prepend a snapshot-history to my Git repository. Since one of the files is no...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,602
git
# How can I undelete a file previously deleted in Git's history? Using [Chris's answer](https://stackoverflow.com/questions/3147097/how-to-prepend-the-past-to-a-git-repository/3148117#3148117) on another question, I could prepend a snapshot-history to my Git repository. Since one of the files is not part of my history...
I got it: ``` git tag originalHead # Just in case git rebase -i <id of the parent of the commit that deleted the file> # Change pick to edit for that commit git checkout <id of the previous commit> <filename> # Thanks for reminding, kubi git commit --amend git rebase --continue git tag -d originalHead ``` Unfortunate...
44105166
How to pull a new submodule
51
2017-05-22 05:22:30
<p>Tried looking for answers on this site and others: <a href="https://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules#1032653">StackOverflow - Easy way pull latest of all submodules</a></p> <p>They all seem to want to talk about if you are controlling them, not if someone else added one, an...
41,935
1,091,943
2023-07-22 17:52:55
44,438,733
71
2017-06-08 14:38:47
4,392,277
2022-10-27 22:16:42
https://stackoverflow.com/q/44105166
https://stackoverflow.com/a/44438733
<p>When you want to pull a specific new module, you can use the following command:</p> <pre><code>git submodule update --init local/path/to/submodule/folder </code></pre> <p>If you wish to initialize all new submodules however. you can omit the path to the folder like so:</p> <pre><code>git submodule update --init </co...
<p>When you want to pull a specific new module, you can use the following command:</p> <pre><code>git submodule update --init local/path/to/submodule/folder </code></pre> <p>If you wish to initialize all new submodules however. you can omit the path to the folder like so:</p> <pre><code>git submodule update --init </co...
119, 41612
git, git-submodules
<h1>How to pull a new submodule</h1> <p>Tried looking for answers on this site and others: <a href="https://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules#1032653">StackOverflow - Easy way pull latest of all submodules</a></p> <p>They all seem to want to talk about if you are controlling th...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,603
git
# How to pull a new submodule Tried looking for answers on this site and others: [StackOverflow - Easy way pull latest of all submodules](https://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules#1032653) They all seem to want to talk about if you are controlling them, not if someone else add...
When you want to pull a specific new module, you can use the following command: ``` git submodule update --init local/path/to/submodule/folder ``` If you wish to initialize all new submodules however. you can omit the path to the folder like so: ``` git submodule update --init ```
31668163
Geographic / geospatial distance between 2 lists of lat/lon points (coordinates)
51
2015-07-28 05:42:02
<p>I have 2 lists (<code>list1</code>, <code>list2</code>) with latitude / longitudes of various locations. One list (<code>list2</code>) has locality names that <code>list1</code> does not have. </p> <p>I want an approximate locality for every point in list1 as well. So I want to take a point in <code>list1</code>, t...
36,171
5,030,377
2024-03-03 11:07:15
31,668,415
71
2015-07-28 05:59:11
2,204,410
2024-03-03 11:07:15
https://stackoverflow.com/q/31668163
https://stackoverflow.com/a/31668415
<p>To calculate the geographic distance between two points with latitude/longitude coordinates, you can use several formula's. The package <code>geosphere</code> has the <code>distCosine</code>, <code>distHaversine</code>, <code>distVincentySphere</code> and <code>distVincentyEllipsoid</code> for calculating the distan...
<p>To calculate the geographic distance between two points with latitude/longitude coordinates, you can use several formula's. The package <code>geosphere</code> has the <code>distCosine</code>, <code>distHaversine</code>, <code>distVincentySphere</code> and <code>distVincentyEllipsoid</code> for calculating the distan...
4452, 6238, 20301
distance, latitude-longitude, r
<h1>Geographic / geospatial distance between 2 lists of lat/lon points (coordinates)</h1> <p>I have 2 lists (<code>list1</code>, <code>list2</code>) with latitude / longitudes of various locations. One list (<code>list2</code>) has locality names that <code>list1</code> does not have. </p> <p>I want an approximate loc...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,604
git
# Geographic / geospatial distance between 2 lists of lat/lon points (coordinates) I have 2 lists (`list1`, `list2`) with latitude / longitudes of various locations. One list (`list2`) has locality names that `list1` does not have. I want an approximate locality for every point in list1 as well. So I want to take a p...
To calculate the geographic distance between two points with latitude/longitude coordinates, you can use several formula's. The package `geosphere` has the `distCosine`, `distHaversine`, `distVincentySphere` and `distVincentyEllipsoid` for calculating the distance. Of these, the `distVincentyEllipsoid` is considered th...
18331048
How to create a Git attributes file
50
2013-08-20 09:03:48
<p>I would like to add an attributes file to my Git repository as described <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">here</a>. It indicates that I should include <code>.gitattributes</code> in the root folder of my repository.</p> <ul> <li><p>Is <code>.gitattributes</code> simply a file or is ...
59,863
958,580
2023-07-14 13:18:05
18,332,321
71
2013-08-20 10:05:56
958,580
2023-07-14 13:18:05
https://stackoverflow.com/q/18331048
https://stackoverflow.com/a/18332321
<h3><strong>Is <code>.gitattributes</code> a file or a folder ? How do I create it ?</strong></h3> <ul> <li><p><strong>Windows :</strong> Create a new text file (Right click&gt;new&gt;text file) within windows explorer and rename it (Shortcut : <code>F2</code>) as follows</p> <pre><code>.gitattributes. </code></pre> </...
<h3><strong>Is <code>.gitattributes</code> a file or a folder ? How do I create it ?</strong></h3> <ul> <li><p><strong>Windows :</strong> Create a new text file (Right click&gt;new&gt;text file) within windows explorer and rename it (Shortcut : <code>F2</code>) as follows</p> <pre><code>.gitattributes. </code></pre> </...
119, 56102
git, gitattributes
<h1>How to create a Git attributes file</h1> <p>I would like to add an attributes file to my Git repository as described <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">here</a>. It indicates that I should include <code>.gitattributes</code> in the root folder of my repository.</p> <ul> <li><p>Is <co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,607
git
# How to create a Git attributes file I would like to add an attributes file to my Git repository as described [here](https://git-scm.com/docs/gitattributes). It indicates that I should include `.gitattributes` in the root folder of my repository. - Is `.gitattributes` simply a file or is it a folder ? How do I creat...
### **Is `.gitattributes` a file or a folder ? How do I create it ?** - **Windows :** Create a new text file (Right click>new>text file) within windows explorer and rename it (Shortcut : `F2`) as follows ``` .gitattributes. ``` ***Note :** That is `DOT` + `gitattributes` + `DOT`, windows will remove the traili...
48417505
fatal: ssh variant 'simple' does not support setting port
49
2018-01-24 08:04:24
<p>When I clone a remote GitLab project, I get the following error:</p> <pre><code>error fatal: ssh variant 'simple' does not support setting port </code></pre> <p>I tried to re-install TortoiseGit, but this did not solve the issue.</p>
59,337
7,638,799
2020-01-06 17:04:50
48,417,901
71
2018-01-24 08:29:27
3,906,760
2019-02-25 15:03:39
https://stackoverflow.com/q/48417505
https://stackoverflow.com/a/48417901
<p>The internal behavior of Git (>=2.16.0) for SSH tool detection changed and <code>TortoiseGitPlink</code> is not detected any more as <code>ssh</code> or <code>plink</code> compatible.</p> <p>This only affects if the SSH URL contains a port or you have configured Git to use the Protocol version 2. For now, you need ...
<p>The internal behavior of Git (>=2.16.0) for SSH tool detection changed and <code>TortoiseGitPlink</code> is not detected any more as <code>ssh</code> or <code>plink</code> compatible.</p> <p>This only affects if the SSH URL contains a port or you have configured Git to use the Protocol version 2. For now, you need ...
119, 386, 31409
git, ssh, tortoisegit
<h1>fatal: ssh variant 'simple' does not support setting port</h1> <p>When I clone a remote GitLab project, I get the following error:</p> <pre><code>error fatal: ssh variant 'simple' does not support setting port </code></pre> <p>I tried to re-install TortoiseGit, but this did not solve the issue.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,608
git
# fatal: ssh variant 'simple' does not support setting port When I clone a remote GitLab project, I get the following error: ``` error fatal: ssh variant 'simple' does not support setting port ``` I tried to re-install TortoiseGit, but this did not solve the issue.
The internal behavior of Git (>=2.16.0) for SSH tool detection changed and `TortoiseGitPlink` is not detected any more as `ssh` or `plink` compatible. This only affects if the SSH URL contains a port or you have configured Git to use the Protocol version 2. For now, you need to set the environment variable `GIT_SSH_VA...
367262
git commit - setting timestamps into the future
46
2008-12-15 01:24:11
<p>I need to make some commits using Git but I would like the timestamp in git-log to be in the future.</p> <p>How can I do a commit in git that causes a future timestamp to register in the git-log?</p>
19,898
null
2024-02-10 14:08:06
367,475
71
2008-12-15 04:30:00
39,975
2008-12-15 04:30:00
https://stackoverflow.com/q/367262
https://stackoverflow.com/a/367475
<p>You should wait a bit.</p> <p>Or you can do this:</p> <pre><code>/tmp/x 604% env GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!' [master]: created 6348548: "Future!" 1 files changed, 1 insertions(+), 0 deletions(-) /tmp/x 605% git log Author: Dustin Sallings &lt;dustin@spy.net&gt; Date...
<p>You should wait a bit.</p> <p>Or you can do this:</p> <pre><code>/tmp/x 604% env GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!' [master]: created 6348548: "Future!" 1 files changed, 1 insertions(+), 0 deletions(-) /tmp/x 605% git log Author: Dustin Sallings &lt;dustin@spy.net&gt; Date...
119
git
<h1>git commit - setting timestamps into the future</h1> <p>I need to make some commits using Git but I would like the timestamp in git-log to be in the future.</p> <p>How can I do a commit in git that causes a future timestamp to register in the git-log?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,610
git
# git commit - setting timestamps into the future I need to make some commits using Git but I would like the timestamp in git-log to be in the future. How can I do a commit in git that causes a future timestamp to register in the git-log?
You should wait a bit. Or you can do this: ``` /tmp/x 604% env GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!' [master]: created 6348548: "Future!" 1 files changed, 1 insertions(+), 0 deletions(-) /tmp/x 605% git log Author: Dustin Sallings <dustin@spy.net> Date: Wed Dec 19 15:14:05 202...
11068145
Git search all diffs
45
2012-06-17 00:53:59
<p>I'm trying to search for changes in my git history relating to a very specific variable name.</p> <p>I've tried doing this: </p> <pre><code>git diff HEAD~25000 | grep -in mydistinctvariablename </code></pre> <p>The results don't tell me which commit the result lines are from and it takes quite a bit of time (abo...
25,382
null
2024-04-23 12:04:09
11,069,489
71
2012-06-17 06:53:09
291,641
2023-04-06 13:29:45
https://stackoverflow.com/q/11068145
https://stackoverflow.com/a/11069489
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-log.html" rel="noreferrer">git log</a> is generally the command to use when examining commit history. <code>git log --grep</code> can be used to search for regular expressions in the commit message.</p> <p>What you are after is <code>git log -S</code> whic...
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-log.html" rel="noreferrer">git log</a> is generally the command to use when examining commit history. <code>git log --grep</code> can be used to search for regular expressions in the commit message.</p> <p>What you are after is <code>git log -S</code> whic...
119, 606, 816, 1271
diff, git, grep, search
<h1>Git search all diffs</h1> <p>I'm trying to search for changes in my git history relating to a very specific variable name.</p> <p>I've tried doing this: </p> <pre><code>git diff HEAD~25000 | grep -in mydistinctvariablename </code></pre> <p>The results don't tell me which commit the result lines are from and it ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,611
git
# Git search all diffs I'm trying to search for changes in my git history relating to a very specific variable name. I've tried doing this: ``` git diff HEAD~25000 | grep -in mydistinctvariablename ``` The results don't tell me which commit the result lines are from and it takes quite a bit of time (about 5-7 minut...
[git log](http://www.kernel.org/pub/software/scm/git/docs/git-log.html) is generally the command to use when examining commit history. `git log --grep` can be used to search for regular expressions in the commit message. What you are after is `git log -S` which searches the commit content simply or `git log -G` which ...
18264621
How do I push different branches to different heroku apps?
43
2013-08-16 01:51:36
<p>I've been working on a web-app that gets pushed to heroku. The source is hosted on GitHub.</p> <p>So <code>git push</code> pushes the master branch to GutHub.</p> <p>My git branch 'master' is connected to Heroku app '<code>my-app-staging</code>'</p> <p>So <code>git push heroku</code> pushes the app to <code>my-ap...
15,899
917,187
2013-08-16 02:02:38
18,264,690
71
2013-08-16 02:02:38
1,964,165
2013-08-16 02:02:38
https://stackoverflow.com/q/18264621
https://stackoverflow.com/a/18264690
<p>You should add another remote for my-app-prod named prod-heroku (replace GIT_URL with the Git URL that you can find in the settings page of my-app-prod in heroku):</p> <pre><code>git remote add prod-heroku GIT_URL git push prod-heroku production:master </code></pre> <p>This will push your local branch production t...
<p>You should add another remote for my-app-prod named prod-heroku (replace GIT_URL with the Git URL that you can find in the settings page of my-app-prod in heroku):</p> <pre><code>git remote add prod-heroku GIT_URL git push prod-heroku production:master </code></pre> <p>This will push your local branch production t...
119, 8279, 20002, 50545, 76220
dev-to-production, git, git-branch, heroku, staging
<h1>How do I push different branches to different heroku apps?</h1> <p>I've been working on a web-app that gets pushed to heroku. The source is hosted on GitHub.</p> <p>So <code>git push</code> pushes the master branch to GutHub.</p> <p>My git branch 'master' is connected to Heroku app '<code>my-app-staging</code>'</...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,613
git
# How do I push different branches to different heroku apps? I've been working on a web-app that gets pushed to heroku. The source is hosted on GitHub. So `git push` pushes the master branch to GutHub. My git branch 'master' is connected to Heroku app '`my-app-staging`' So `git push heroku` pushes the app to `my-ap...
You should add another remote for my-app-prod named prod-heroku (replace GIT_URL with the Git URL that you can find in the settings page of my-app-prod in heroku): ``` git remote add prod-heroku GIT_URL git push prod-heroku production:master ``` This will push your local branch production to the remote branch master ...
12604824
How do I rebase while skipping a particular commit?
43
2012-09-26 15:07:44
<p>Is there a way to rebase a branch onto another while skipping a particular (conflicting) commit on the other branch?</p> <p>For example, I want to rebase <code>mybranch</code> onto <code>master</code>, but master contains a commit that will conflict with the commits in master, so I prefer to undo that commit comple...
44,033
864,358
2012-09-26 15:36:24
12,604,880
71
2012-09-26 15:11:10
1,065,190
2012-09-26 15:25:44
https://stackoverflow.com/q/12604824
https://stackoverflow.com/a/12604880
<p>Use interactive rebase:</p> <pre><code>git rebase -i master </code></pre> <p>An editor will open and you will have a list of commits like this:</p> <pre><code>pick b8f7c25 Fix 1 pick 273b0bb Fix 2 pick 6aaea1b Fix 3 </code></pre> <p>Just delete the commit you want to skip. It will be omitted while rebasing your ...
<p>Use interactive rebase:</p> <pre><code>git rebase -i master </code></pre> <p>An editor will open and you will have a list of commits like this:</p> <pre><code>pick b8f7c25 Fix 1 pick 273b0bb Fix 2 pick 6aaea1b Fix 3 </code></pre> <p>Just delete the commit you want to skip. It will be omitted while rebasing your ...
119, 8974, 29934, 84381
git, git-interactive-rebase, git-rebase, rebase
<h1>How do I rebase while skipping a particular commit?</h1> <p>Is there a way to rebase a branch onto another while skipping a particular (conflicting) commit on the other branch?</p> <p>For example, I want to rebase <code>mybranch</code> onto <code>master</code>, but master contains a commit that will conflict with ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,614
git
# How do I rebase while skipping a particular commit? Is there a way to rebase a branch onto another while skipping a particular (conflicting) commit on the other branch? For example, I want to rebase `mybranch` onto `master`, but master contains a commit that will conflict with the commits in master, so I prefer to ...
Use interactive rebase: ``` git rebase -i master ``` An editor will open and you will have a list of commits like this: ``` pick b8f7c25 Fix 1 pick 273b0bb Fix 2 pick 6aaea1b Fix 3 ``` Just delete the commit you want to skip. It will be omitted while rebasing your branch onto master. **P.S.** If you cannot see the...
12486653
git push to existing remote branch
42
2012-09-18 23:45:12
<p>How do I push changes from a local git branch to an existing non-master remote branch? If I do a "git push", it tries to push changes in all local branches to the remotes they are tracking.</p>
74,136
1,373,341
2012-09-18 23:54:04
12,486,664
71
2012-09-18 23:46:25
893
2012-09-18 23:46:25
https://stackoverflow.com/q/12486653
https://stackoverflow.com/a/12486664
<p>To do this you use a <code>refspec</code>, as explained in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer"><code>git push</code> documentation</a>. For example:</p> <pre><code>git push origin local_branch_name:remote_branch_name </code></pre>
<p>To do this you use a <code>refspec</code>, as explained in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="noreferrer"><code>git push</code> documentation</a>. For example:</p> <pre><code>git push origin local_branch_name:remote_branch_name </code></pre>
119, 28898
git, git-push
<h1>git push to existing remote branch</h1> <p>How do I push changes from a local git branch to an existing non-master remote branch? If I do a "git push", it tries to push changes in all local branches to the remotes they are tracking.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,615
git
# git push to existing remote branch How do I push changes from a local git branch to an existing non-master remote branch? If I do a "git push", it tries to push changes in all local branches to the remotes they are tracking.
To do this you use a `refspec`, as explained in the [`git push` documentation](https://www.kernel.org/pub/software/scm/git/docs/git-push.html). For example: ``` git push origin local_branch_name:remote_branch_name ```
40505643
How to do a git commit with a subject line and message body?
37
2016-11-09 11:14:42
<p>I want to improve the way I do git commits and I've been reading around the web. I followed the site here <a href="http://chris.beams.io/posts/git-commit/" rel="noreferrer">http://chris.beams.io/posts/git-commit/</a> and this lead me to <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration" rel="...
46,986
296,775
2022-06-07 20:52:59
40,506,149
71
2016-11-09 11:41:13
4,265,352
2022-06-07 20:52:59
https://stackoverflow.com/q/40505643
https://stackoverflow.com/a/40506149
<p>The easiest way to do it is to run <code>git commit</code> without <code>-m</code> and the message.</p> <p>(<code>git commit -a</code> is a shortcut for <code>git add -u; git commit</code>, with some other minor technical differences)</p> <p>It will start an editor where you can enter the commit message on multiple ...
<p>The easiest way to do it is to run <code>git commit</code> without <code>-m</code> and the message.</p> <p>(<code>git commit -a</code> is a shortcut for <code>git add -u; git commit</code>, with some other minor technical differences)</p> <p>It will start an editor where you can enter the commit message on multiple ...
119, 5597
commit, git
<h1>How to do a git commit with a subject line and message body?</h1> <p>I want to improve the way I do git commits and I've been reading around the web. I followed the site here <a href="http://chris.beams.io/posts/git-commit/" rel="noreferrer">http://chris.beams.io/posts/git-commit/</a> and this lead me to <a href="h...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,616
git
# How to do a git commit with a subject line and message body? I want to improve the way I do git commits and I've been reading around the web. I followed the site here <http://chris.beams.io/posts/git-commit/> and this lead me to <https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration> where I can set my de...
The easiest way to do it is to run `git commit` without `-m` and the message. (`git commit -a` is a shortcut for `git add -u; git commit`, with some other minor technical differences) It will start an editor where you can enter the commit message on multiple lines. Then you save the file and when the editor exits, `g...
50763439
make git branch show branches inline (version 2.17.1)
32
2018-06-08 15:01:31
<p>Before git version <strong>2.17.1</strong> (no more than 4 versions back), when you ran</p> <pre><code>git branch </code></pre> <p>you would get an inline list of branches and your terminal was ready for a new command. </p> <p>In version <strong>2.17.1</strong> you get a list of branches as a new screen, and have...
4,605
5,017,391
2018-06-14 15:22:43
50,763,740
71
2018-06-08 15:18:15
578,288
2018-06-14 15:22:43
https://stackoverflow.com/q/50763439
https://stackoverflow.com/a/50763740
<p>The <a href="https://git-scm.com/docs/git-config#git-config-pagerltcmdgt" rel="noreferrer">config setting <code>pager.<i>&lt;cmd&gt;</i></code></a> works for me:</p> <pre class="lang-sh prettyprint-override"><code>git config --global pager.branch 'false' </code></pre> <p>Before running that command, <code>git bran...
<p>The <a href="https://git-scm.com/docs/git-config#git-config-pagerltcmdgt" rel="noreferrer">config setting <code>pager.<i>&lt;cmd&gt;</i></code></a> works for me:</p> <pre class="lang-sh prettyprint-override"><code>git config --global pager.branch 'false' </code></pre> <p>Before running that command, <code>git bran...
119
git
<h1>make git branch show branches inline (version 2.17.1)</h1> <p>Before git version <strong>2.17.1</strong> (no more than 4 versions back), when you ran</p> <pre><code>git branch </code></pre> <p>you would get an inline list of branches and your terminal was ready for a new command. </p> <p>In version <strong>2.17....
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,617
git
# make git branch show branches inline (version 2.17.1) Before git version **2.17.1** (no more than 4 versions back), when you ran ``` git branch ``` you would get an inline list of branches and your terminal was ready for a new command. In version **2.17.1** you get a list of branches as a new screen, and have to ...
The [config setting `pager.<cmd>`](https://git-scm.com/docs/git-config#git-config-pagerltcmdgt) works for me: ``` git config --global pager.branch 'false' ``` Before running that command, `git branch` used a pager. After that command, `git branch` printed the list of branches directly to the terminal.
6533222
How do I check out a particular version in Git from 'git log'?
31
2011-06-30 10:12:57
<p>My <code>git log</code> is showing something as:</p> <pre><code>enter code here [git_trial]$ git log commit 4c5bc66ae50780cf8dcaf032da98422aea6e2cf7 Author: king &lt;king@king.ap.com&gt; Date: Thu Jun 30 15:09:55 2011 +0530 This is third commit commit 8072be67ddd310bc200cab0dccb8bcb2ec4f922c Author: king &lt;...
77,630
575,281
2019-08-05 19:44:55
6,533,287
71
2011-06-30 10:18:54
320,615
2011-06-30 10:18:54
https://stackoverflow.com/q/6533222
https://stackoverflow.com/a/6533287
<p>You can checkout a commit using <code>git checkout sha-of-commit</code> which you already have.</p> <p>But you cannot commit anything (as you're not in a branch, you're in a static commit).</p> <p>If you need to commit anything on top of that commit, you need to check it out into a branch using <code>git checkout ...
<p>You can checkout a commit using <code>git checkout sha-of-commit</code> which you already have.</p> <p>But you cannot commit anything (as you're not in a branch, you're in a static commit).</p> <p>If you need to commit anything on top of that commit, you need to check it out into a branch using <code>git checkout ...
58, 119
git, linux
<h1>How do I check out a particular version in Git from 'git log'?</h1> <p>My <code>git log</code> is showing something as:</p> <pre><code>enter code here [git_trial]$ git log commit 4c5bc66ae50780cf8dcaf032da98422aea6e2cf7 Author: king &lt;king@king.ap.com&gt; Date: Thu Jun 30 15:09:55 2011 +0530 This is third co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,618
git
# How do I check out a particular version in Git from 'git log'? My `git log` is showing something as: ``` enter code here [git_trial]$ git log commit 4c5bc66ae50780cf8dcaf032da98422aea6e2cf7 Author: king <king@king.ap.com> Date: Thu Jun 30 15:09:55 2011 +0530 This is third commit commit 8072be67ddd310bc200cab0d...
You can checkout a commit using `git checkout sha-of-commit` which you already have. But you cannot commit anything (as you're not in a branch, you're in a static commit). If you need to commit anything on top of that commit, you need to check it out into a branch using `git checkout sha-of-commit -b testing-a-commit...
64211386
Gitbook-cli install error TypeError: cb.apply is not a function inside graceful-fs
30
2020-10-05 15:12:15
<p>When executing any <code>gitbook</code> command in the terminal, the following error is thrown:</p> <pre><code>/home/travis/.nvm/versions/node/v12.18.3/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287 if (cb) cb.apply(this, arguments) ^ TypeError: cb.appl...
23,750
4,630,050
2024-01-16 00:14:33
64,211,387
71
2020-10-05 15:12:15
4,630,050
2020-10-05 15:18:03
https://stackoverflow.com/q/64211386
https://stackoverflow.com/a/64211387
<p>The issue was originally a problem inside <code>graceful-fs</code> but they solved it in <a href="https://github.com/isaacs/node-graceful-fs/commit/168bdb8f0bb3174e8499d4bc5878deead4172c39" rel="noreferrer">this commit</a> I believe.</p> <p>The problem is that GitBook is still using outdated dependencies that pull i...
<p>The issue was originally a problem inside <code>graceful-fs</code> but they solved it in <a href="https://github.com/isaacs/node-graceful-fs/commit/168bdb8f0bb3174e8499d4bc5878deead4172c39" rel="noreferrer">this commit</a> I believe.</p> <p>The problem is that GitBook is still using outdated dependencies that pull i...
46426, 61387, 105279
gitbook, node.js, npm
<h1>Gitbook-cli install error TypeError: cb.apply is not a function inside graceful-fs</h1> <p>When executing any <code>gitbook</code> command in the terminal, the following error is thrown:</p> <pre><code>/home/travis/.nvm/versions/node/v12.18.3/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/po...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,619
git
# Gitbook-cli install error TypeError: cb.apply is not a function inside graceful-fs When executing any `gitbook` command in the terminal, the following error is thrown: ``` /home/travis/.nvm/versions/node/v12.18.3/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287 if (cb) c...
The issue was originally a problem inside `graceful-fs` but they solved it in [this commit](https://github.com/isaacs/node-graceful-fs/commit/168bdb8f0bb3174e8499d4bc5878deead4172c39) I believe. The problem is that GitBook is still using outdated dependencies that pull in versions of graceful-fs without the fix. The ...
1303315
Comparing changes in commits to the current file by Git
29
2009-08-20 00:15:47
<p><strong>How can you show the differences of a file in the last 5 commits to the current uncommitted file by Git-show?</strong></p> <p>I made a change to my file which breaks my code. However, I do not know where the change is.</p> <p>I would like to compare the current uncommitted files to the recent commit (HEAD)...
22,907
54,964
2018-11-21 12:34:10
1,303,394
71
2009-08-20 00:44:38
132,012
2009-08-20 00:44:38
https://stackoverflow.com/q/1303315
https://stackoverflow.com/a/1303394
<p>Here is my cheat-sheet:</p> <pre><code># uncommited file to HEAD git diff &lt;path&gt; # uncommited file to before last commit git diff HEAD^ -- &lt;path&gt; #last commit to before last commit git diff HEAD^ HEAD -- &lt;path&gt; #difference between HEAD and n-th grandparent git diff HEAD~n HEAD -- &lt;path&gt; ...
<p>Here is my cheat-sheet:</p> <pre><code># uncommited file to HEAD git diff &lt;path&gt; # uncommited file to before last commit git diff HEAD^ -- &lt;path&gt; #last commit to before last commit git diff HEAD^ HEAD -- &lt;path&gt; #difference between HEAD and n-th grandparent git diff HEAD~n HEAD -- &lt;path&gt; ...
119
git
<h1>Comparing changes in commits to the current file by Git</h1> <p><strong>How can you show the differences of a file in the last 5 commits to the current uncommitted file by Git-show?</strong></p> <p>I made a change to my file which breaks my code. However, I do not know where the change is.</p> <p>I would like to ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,620
git
# Comparing changes in commits to the current file by Git **How can you show the differences of a file in the last 5 commits to the current uncommitted file by Git-show?** I made a change to my file which breaks my code. However, I do not know where the change is. I would like to compare the current uncommitted file...
Here is my cheat-sheet: ``` # uncommited file to HEAD git diff <path> # uncommited file to before last commit git diff HEAD^ -- <path> #last commit to before last commit git diff HEAD^ HEAD -- <path> #difference between HEAD and n-th grandparent git diff HEAD~n HEAD -- <path> #Another cool feature is whatchanged c...
58622854
Cloning a Bitbucket repository via ssh
25
2019-10-30 10:04:06
<p>How do I clone a repository from Bitbucket via <code>ssh</code> instead of <code>http</code>? I already have <code>git</code> installed in my local machine (Windows).</p>
68,578
12,296,279
2019-10-30 10:58:57
58,623,548
71
2019-10-30 10:41:27
12,267,245
2019-10-30 10:41:27
https://stackoverflow.com/q/58622854
https://stackoverflow.com/a/58623548
<ol> <li>Generate an SSH key: <code>ssh-keygen -t rsa -C "your-email-address"</code></li> <li>Press Enter key until a randomart image is generated.</li> <li>Log into Bitbucket -> <code>View profile</code> -> <code>Manage account</code> -> <code>SSH keys</code> -> <code>Add key</code></li> <li>Paste the key you have gen...
<ol> <li>Generate an SSH key: <code>ssh-keygen -t rsa -C "your-email-address"</code></li> <li>Press Enter key until a randomart image is generated.</li> <li>Log into Bitbucket -> <code>View profile</code> -> <code>Manage account</code> -> <code>SSH keys</code> -> <code>Add key</code></li> <li>Paste the key you have gen...
119, 386, 8337, 34099
bitbucket, git, git-clone, ssh
<h1>Cloning a Bitbucket repository via ssh</h1> <p>How do I clone a repository from Bitbucket via <code>ssh</code> instead of <code>http</code>? I already have <code>git</code> installed in my local machine (Windows).</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,622
git
# Cloning a Bitbucket repository via ssh How do I clone a repository from Bitbucket via `ssh` instead of `http`? I already have `git` installed in my local machine (Windows).
1. Generate an SSH key: `ssh-keygen -t rsa -C "your-email-address"` 2. Press Enter key until a randomart image is generated. 3. Log into Bitbucket -> `View profile` -> `Manage account` -> `SSH keys` -> `Add key` 4. Paste the key you have generated in Step 1 in the text box. To get the key, run the following command:...
3240881
Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?
167
2010-07-13 19:47:59
<p>Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me:</p> <pre> $ git status vendor | grep modified: # modified: vendor/rails (modified content) </pre> <pre> $ git diff vendor/ diff --git a/vendor/rails b/vendor/rails --- a/vendor/rails +...
74,668
13,989
2021-09-28 12:49:58
3,340,998
70
2010-07-27 05:34:00
13,989
2012-02-09 07:03:18
https://stackoverflow.com/q/3240881
https://stackoverflow.com/a/3340998
<p>Update: See (and upvote) <a href="https://stackoverflow.com/users/691578/nilshaldenwang">nilshaldenwang</a>'s <a href="https://stackoverflow.com/a/5542452/6309">answer</a> regarding the possibility to add to the <code>.gitmodules</code> file a config parameter for ignoring dirty state of a given submodule.</p> <pre...
<p>Update: See (and upvote) <a href="https://stackoverflow.com/users/691578/nilshaldenwang">nilshaldenwang</a>'s <a href="https://stackoverflow.com/a/5542452/6309">answer</a> regarding the possibility to add to the <code>.gitmodules</code> file a config parameter for ignoring dirty state of a given submodule.</p> <pre...
119, 32868, 41612
git, git-config, git-submodules
<h1>Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?</h1> <p>Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me:</p> <pre> $ git status vendor | grep modified: # modified: vendor/rails (modifie...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,623
git
# Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc? Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me: ``` $ git status vendor | grep modified: # modified: vendor/rails (modified content) ``` ...
Update: See (and upvote) [nilshaldenwang](https://stackoverflow.com/users/691578/nilshaldenwang)'s [answer](https://stackoverflow.com/a/5542452/6309) regarding the possibility to add to the `.gitmodules` file a config parameter for ignoring dirty state of a given submodule. ``` ignore = dirty ``` --- So git 1.7.2 is...
15141338
Embed git commit hash in a .NET dll
156
2013-02-28 17:00:53
<p>I'm building a C# application, using Git as my version control.</p> <p>Is there a way to automatically embed the last commit hash in the executable when I build my application?</p> <p>For example, printing the commit hash to console would look something like:</p> <pre><code>class PrintCommitHash { private String...
73,911
499,721
2024-06-30 07:49:06
15,143,783
70
2013-02-28 19:14:54
102,536
2013-02-28 19:20:26
https://stackoverflow.com/q/15141338
https://stackoverflow.com/a/15143783
<p>We use tags in git to track versions.</p> <pre><code>git tag -a v13.3.1 -m "version 13.3.1" </code></pre> <p>You can get the version with hash from git via:</p> <pre><code>git describe --long </code></pre> <p>Our build process puts the git hash in the AssemblyInformationalVersion attribute of the AssemblyInfo.cs...
<p>We use tags in git to track versions.</p> <pre><code>git tag -a v13.3.1 -m "version 13.3.1" </code></pre> <p>You can get the version with hash from git via:</p> <pre><code>git describe --long </code></pre> <p>Our build process puts the git hash in the AssemblyInformationalVersion attribute of the AssemblyInfo.cs...
9, 119
c#, git
<h1>Embed git commit hash in a .NET dll</h1> <p>I'm building a C# application, using Git as my version control.</p> <p>Is there a way to automatically embed the last commit hash in the executable when I build my application?</p> <p>For example, printing the commit hash to console would look something like:</p> <pre><co...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,624
git
# Embed git commit hash in a .NET dll I'm building a C# application, using Git as my version control. Is there a way to automatically embed the last commit hash in the executable when I build my application? For example, printing the commit hash to console would look something like: ``` class PrintCommitHash { ...
We use tags in git to track versions. ``` git tag -a v13.3.1 -m "version 13.3.1" ``` You can get the version with hash from git via: ``` git describe --long ``` Our build process puts the git hash in the AssemblyInformationalVersion attribute of the AssemblyInfo.cs file: ``` [assembly: AssemblyInformationalVersion...
37311494
How to get git to show commits in a specified date range for author date?
153
2016-05-18 23:08:52
<p>Apparently <a href="https://stackoverflow.com/a/11189286/281545">this</a>:</p> <pre><code>git log --all --after="&lt;date&gt; 00:00" --before="&lt;date&gt; 23:59" --author="&lt;author&gt;" </code></pre> <p>filters commits based on the <em>committer date</em>. How can I make it show commits for a specified author d...
114,105
281,545
2021-08-25 16:42:31
37,311,766
70
2016-05-18 23:41:52
1,256,452
2017-12-12 15:30:19
https://stackoverflow.com/q/37311494
https://stackoverflow.com/a/37311766
<p>You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about <em>viewing</em> the author date, it's about <em>selecting commits by</em> the author date, a la <code>--since</code>/<code>--after</code> and <code>--until</code>/<code>--before</code>. These selectors use the <em>com...
<p>You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about <em>viewing</em> the author date, it's about <em>selecting commits by</em> the author date, a la <code>--since</code>/<code>--after</code> and <code>--until</code>/<code>--before</code>. These selectors use the <em>com...
119, 74295
git, git-show
<h1>How to get git to show commits in a specified date range for author date?</h1> <p>Apparently <a href="https://stackoverflow.com/a/11189286/281545">this</a>:</p> <pre><code>git log --all --after="&lt;date&gt; 00:00" --before="&lt;date&gt; 23:59" --author="&lt;author&gt;" </code></pre> <p>filters commits based on t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,625
git
# How to get git to show commits in a specified date range for author date? Apparently [this](https://stackoverflow.com/a/11189286/281545): ``` git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>" ``` filters commits based on the *committer date*. How can I make it show commits for a spec...
You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about *viewing* the author date, it's about *selecting commits by* the author date, a la `--since`/`--after` and `--until`/`--before`. These selectors use the *committer* date, not the author date. Consider as an extreme example ...
1485578
Change a Git remote HEAD to point to something besides master
140
2009-09-28 05:42:57
<p>How do I set a Git remote's HEAD reference to point to something besides "master"?</p> <p>My project has a policy not to use a "master" branch (all branches are to have meaningful names). Furthermore, the canonical master repository is only accessible via ssh://, with no shell access (like GitHub or Unfuddle).</p> ...
248,507
2,938
2023-04-18 08:07:13
1,485,590
70
2009-09-28 05:49:37
6,309
2023-04-18 08:07:13
https://stackoverflow.com/q/1485578
https://stackoverflow.com/a/1485590
<p>There was almost the <a href="http://groups.google.com/group/github/browse_thread/thread/eb3046a7b4c8bec7/b64ee724a0db5471" rel="nofollow noreferrer">same question on GitHub</a> a year ago.</p> <p>The idea was to rename the master branch:</p> <pre><code>git branch -m master development git branch -m published master...
<p>There was almost the <a href="http://groups.google.com/group/github/browse_thread/thread/eb3046a7b4c8bec7/b64ee724a0db5471" rel="nofollow noreferrer">same question on GitHub</a> a year ago.</p> <p>The idea was to rename the master branch:</p> <pre><code>git branch -m master development git branch -m published master...
119, 41346, 76220
git, git-branch, git-remote
<h1>Change a Git remote HEAD to point to something besides master</h1> <p>How do I set a Git remote's HEAD reference to point to something besides "master"?</p> <p>My project has a policy not to use a "master" branch (all branches are to have meaningful names). Furthermore, the canonical master repository is only acce...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,626
git
# Change a Git remote HEAD to point to something besides master How do I set a Git remote's HEAD reference to point to something besides "master"? My project has a policy not to use a "master" branch (all branches are to have meaningful names). Furthermore, the canonical master repository is only accessible via ssh:/...
There was almost the [same question on GitHub](http://groups.google.com/group/github/browse_thread/thread/eb3046a7b4c8bec7/b64ee724a0db5471) a year ago. The idea was to rename the master branch: ``` git branch -m master development git branch -m published master git push -f origin master ``` > Making master have wha...
4855561
Difference between git remote add and git clone
82
2011-01-31 20:10:45
<p>What does the <code>clone</code> command do? Is there any equivalent to it in svn?</p> <p>What is the difference between </p> <pre><code>git remote add test git://github.com/user/test.git </code></pre> <p>And </p> <pre><code>git clone git://github.com/user/test.git </code></pre> <p>Does the name of the created ...
72,936
149,008
2024-10-06 10:47:48
4,855,592
70
2011-01-31 20:13:36
569,106
2011-01-31 20:13:36
https://stackoverflow.com/q/4855561
https://stackoverflow.com/a/4855592
<p><code>git remote add</code> just creates an entry in your git config that specifies a name for a particular URL. You must have an existing git repo to use this.</p> <p><code>git clone</code> creates a new git repository by copying an existing one located at the URI you specify.</p>
<p><code>git remote add</code> just creates an entry in your git config that specifies a name for a particular URL. You must have an existing git repo to use this.</p> <p><code>git clone</code> creates a new git repository by copying an existing one located at the URI you specify.</p>
119, 34099, 41346
git, git-clone, git-remote
<h1>Difference between git remote add and git clone</h1> <p>What does the <code>clone</code> command do? Is there any equivalent to it in svn?</p> <p>What is the difference between </p> <pre><code>git remote add test git://github.com/user/test.git </code></pre> <p>And </p> <pre><code>git clone git://github.com/user...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,629
git
# Difference between git remote add and git clone What does the `clone` command do? Is there any equivalent to it in svn? What is the difference between ``` git remote add test git://github.com/user/test.git ``` And ``` git clone git://github.com/user/test.git ``` Does the name of the created repo matter?
`git remote add` just creates an entry in your git config that specifies a name for a particular URL. You must have an existing git repo to use this. `git clone` creates a new git repository by copying an existing one located at the URI you specify.
6889830
equivalence of: git log --exclude-author?
79
2011-07-31 13:49:49
<p>At work we have a git repo where the majority of all commits are automated commits by a bot user. There are times when I prefer to view a git log from that repo, but without seeing the auto commits. I guess it could be described as an inverted "git log --author" or a "git log --exclude-author=botuser", if such as op...
23,924
218,514
2025-12-09 02:11:37
20,359,396
70
2013-12-03 18:58:30
25,616
2019-01-14 16:56:28
https://stackoverflow.com/q/6889830
https://stackoverflow.com/a/20359396
<p>From <a href="https://coderwall.com/p/tzdzwa" rel="noreferrer">https://coderwall.com/p/tzdzwa</a> :</p> <pre><code>git log --perl-regexp --author='^((?!excluded-author-regex).*)$' </code></pre> <p>This worked for me.</p> <p>If you don't want to specify <code>--perl-regexp</code> every time you can do:</p> <pre><...
<p>From <a href="https://coderwall.com/p/tzdzwa" rel="noreferrer">https://coderwall.com/p/tzdzwa</a> :</p> <pre><code>git log --perl-regexp --author='^((?!excluded-author-regex).*)$' </code></pre> <p>This worked for me.</p> <p>If you don't want to specify <code>--perl-regexp</code> every time you can do:</p> <pre><...
119
git
<h1>equivalence of: git log --exclude-author?</h1> <p>At work we have a git repo where the majority of all commits are automated commits by a bot user. There are times when I prefer to view a git log from that repo, but without seeing the auto commits. I guess it could be described as an inverted "git log --author" or ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,630
git
# equivalence of: git log --exclude-author? At work we have a git repo where the majority of all commits are automated commits by a bot user. There are times when I prefer to view a git log from that repo, but without seeing the auto commits. I guess it could be described as an inverted "git log --author" or a "git lo...
From <https://coderwall.com/p/tzdzwa> : ``` git log --perl-regexp --author='^((?!excluded-author-regex).*)$' ``` This worked for me. If you don't want to specify `--perl-regexp` every time you can do: ``` git config --global grep.patternType perl ```
24677866
git ignore all files except one extension and folder structure
76
2014-07-10 13:30:36
<p>What I want is to ignore all kind of files except the .php ones, but with this .gitignore I'm also ignoring folders...</p> <pre><code>#ignore all kind of files * #except php files !*.php </code></pre> <p>Is there a way to tell git to accept my project folder structure while keeping the track only of the .php files?<...
44,548
2,192,660
2024-01-05 13:59:56
24,678,813
70
2014-07-10 14:10:49
1,860,929
2014-07-10 14:17:04
https://stackoverflow.com/q/24677866
https://stackoverflow.com/a/24678813
<p>This is simple, just add another entry <code>!my_folder</code> in your <code>.gitignore</code></p> <pre><code>#ignore all kind of files * #except php files !*.php !my_folder </code></pre> <p>The last line will take special care of <code>my_folder</code>, and will not ignore any php files within it; but files withi...
<p>This is simple, just add another entry <code>!my_folder</code> in your <code>.gitignore</code></p> <pre><code>#ignore all kind of files * #except php files !*.php !my_folder </code></pre> <p>The last line will take special care of <code>my_folder</code>, and will not ignore any php files within it; but files withi...
119, 25056
git, gitignore
<h1>git ignore all files except one extension and folder structure</h1> <p>What I want is to ignore all kind of files except the .php ones, but with this .gitignore I'm also ignoring folders...</p> <pre><code>#ignore all kind of files * #except php files !*.php </code></pre> <p>Is there a way to tell git to accept my p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,631
git
# git ignore all files except one extension and folder structure What I want is to ignore all kind of files except the .php ones, but with this .gitignore I'm also ignoring folders... ``` #ignore all kind of files * #except php files !*.php ``` Is there a way to tell git to accept my project folder structure while k...
This is simple, just add another entry `!my_folder` in your `.gitignore` ``` #ignore all kind of files * #except php files !*.php !my_folder ``` The last line will take special care of `my_folder`, and will not ignore any php files within it; but files within other folders will still be ignored because of the first p...
6248917
How to avoid specifying absolute file path while git-add
68
2011-06-06 07:26:11
<p>Using <code>git add</code> command becomes tedious once the file path becomes lengthy. For e.g. <code>git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.java</code><br/> Is it possible to bypass specifying absolute file path? May be using some kind of pattern or something?<br/></p> <p>I know t...
27,056
417,175
2021-05-25 06:27:12
6,248,994
70
2011-06-06 07:36:38
720,346
2011-06-06 07:36:38
https://stackoverflow.com/q/6248917
https://stackoverflow.com/a/6248994
<p>For unix-like systems you can always use the star to point to files, e.g.</p> <pre><code> git add *DSManager.java </code></pre> <p>will include all DSManager.java files git can find within your source tree starting in your current working directory.</p>
<p>For unix-like systems you can always use the star to point to files, e.g.</p> <pre><code> git add *DSManager.java </code></pre> <p>will include all DSManager.java files git can find within your source tree starting in your current working directory.</p>
119, 34792
git, git-add
<h1>How to avoid specifying absolute file path while git-add</h1> <p>Using <code>git add</code> command becomes tedious once the file path becomes lengthy. For e.g. <code>git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.java</code><br/> Is it possible to bypass specifying absolute file path? May...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,632
git
# How to avoid specifying absolute file path while git-add Using `git add` command becomes tedious once the file path becomes lengthy. For e.g. `git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.java` Is it possible to bypass specifying absolute file path? May be using some kind of pattern or ...
For unix-like systems you can always use the star to point to files, e.g. ``` git add *DSManager.java ``` will include all DSManager.java files git can find within your source tree starting in your current working directory.
3824050
Telling if a Git commit is a Merge/Revert commit
65
2010-09-29 17:03:39
<p>I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that.</p> <p>What I came up with so far (and I definitely don't want to depend on the commit message here) is to check <code>HASH^2</code> and see if I don't get a...
31,326
171,428
2024-02-07 04:13:13
3,824,122
70
2010-09-29 17:12:01
54,157
2024-02-07 04:13:13
https://stackoverflow.com/q/3824050
https://stackoverflow.com/a/3824122
<p>Figuring out if something is a merge is easy. That's all commits with more than one parent. To check for that, you can do, for example</p> <pre><code>$ git cat-file -p $commit_id </code></pre> <p>If there's more than one `parent' line in the output, you found a merge.</p> <p>For reverts it's not as easy. Generally r...
<p>Figuring out if something is a merge is easy. That's all commits with more than one parent. To check for that, you can do, for example</p> <pre><code>$ git cat-file -p $commit_id </code></pre> <p>If there's more than one `parent' line in the output, you found a merge.</p> <p>For reverts it's not as easy. Generally r...
119, 28897, 53850, 117987
git, git-commit, git-hash, git-merge
<h1>Telling if a Git commit is a Merge/Revert commit</h1> <p>I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that.</p> <p>What I came up with so far (and I definitely don't want to depend on the commit message here...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,633
git
# Telling if a Git commit is a Merge/Revert commit I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that. What I came up with so far (and I definitely don't want to depend on the commit message here) is to check `H...
Figuring out if something is a merge is easy. That's all commits with more than one parent. To check for that, you can do, for example ``` $ git cat-file -p $commit_id ``` If there's more than one `parent' line in the output, you found a merge. For reverts it's not as easy. Generally reverts are just normal commits ...
21661263
GitFlow: safely merge develop changes to a feature branch
58
2014-02-09 15:54:17
<p>Recently I started working on a big features, so I created a new <code>feature/xyz</code> branch. Problem is that this feature is big, so it will take me ~3 months to complete it. I would like to safely merge progress that has been made in <code>develop</code> to my feature branch, without worrying that changes from...
40,408
338,473
2018-04-03 12:27:06
21,674,420
70
2014-02-10 10:20:17
3,099,074
2018-04-03 12:27:06
https://stackoverflow.com/q/21661263
https://stackoverflow.com/a/21674420
<h2><strong>The only safety is in learned, discerning and frequent merges.</strong></h2> <p>Only you understand how the code on <code>develop</code> and <code>feature/xyz</code> aligns, no one else. It is only you who can merge the two flows correctly in a discerning way. Even with the default merging strategies, whic...
<h2><strong>The only safety is in learned, discerning and frequent merges.</strong></h2> <p>Only you understand how the code on <code>develop</code> and <code>feature/xyz</code> aligns, no one else. It is only you who can merge the two flows correctly in a discerning way. Even with the default merging strategies, whic...
119, 64339
git, git-flow
<h1>GitFlow: safely merge develop changes to a feature branch</h1> <p>Recently I started working on a big features, so I created a new <code>feature/xyz</code> branch. Problem is that this feature is big, so it will take me ~3 months to complete it. I would like to safely merge progress that has been made in <code>deve...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,635
git
# GitFlow: safely merge develop changes to a feature branch Recently I started working on a big features, so I created a new `feature/xyz` branch. Problem is that this feature is big, so it will take me ~3 months to complete it. I would like to safely merge progress that has been made in `develop` to my feature branch...
## **The only safety is in learned, discerning and frequent merges.** Only you understand how the code on `develop` and `feature/xyz` aligns, no one else. It is only you who can merge the two flows correctly in a discerning way. Even with the default merging strategies, which are far less dangerous than `-S ours` or `...
39497307
is it dangerous to create a branch with same name as a deleted branch?
57
2016-09-14 18:29:52
<p>I've been working on a feature in a branch; call it 'foo'. I'm done for now and merging it into master and would like to delete it locally and remotely. But sometime in the future I may start working on this feature again and will be tempted to create a new branch also called 'foo'.</p> <p>I don't think this will b...
34,638
1,368,860
2016-09-14 19:04:36
39,497,631
70
2016-09-14 18:50:17
945,336
2016-09-14 19:04:36
https://stackoverflow.com/q/39497307
https://stackoverflow.com/a/39497631
<p>No, it's not a problem.</p> <p>The behaviour would be the same, as if the branch has not been deleted: Git will try to merge (or rebase) them when someone pulls the <em>new</em> branch. If there are conflicts, they would be there in either case.</p> <p>Branches are, simply, pointers to commits. If you delete a bra...
<p>No, it's not a problem.</p> <p>The behaviour would be the same, as if the branch has not been deleted: Git will try to merge (or rebase) them when someone pulls the <em>new</em> branch. If there are conflicts, they would be there in either case.</p> <p>Branches are, simply, pointers to commits. If you delete a bra...
119
git
<h1>is it dangerous to create a branch with same name as a deleted branch?</h1> <p>I've been working on a feature in a branch; call it 'foo'. I'm done for now and merging it into master and would like to delete it locally and remotely. But sometime in the future I may start working on this feature again and will be tem...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,636
git
# is it dangerous to create a branch with same name as a deleted branch? I've been working on a feature in a branch; call it 'foo'. I'm done for now and merging it into master and would like to delete it locally and remotely. But sometime in the future I may start working on this feature again and will be tempted to c...
No, it's not a problem. The behaviour would be the same, as if the branch has not been deleted: Git will try to merge (or rebase) them when someone pulls the *new* branch. If there are conflicts, they would be there in either case. Branches are, simply, pointers to commits. If you delete a branch, and create another ...
15844542
git: symlink/reference to a file in an external repository
57
2013-04-05 22:16:38
<p>Is it possible in git to have a "link" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full directory:</p> <pre><code>my-project/ class1.java class2.java logback.xml (link to a particular file, say https://github.com/theHiliku...
42,107
1,086,540
2021-12-17 15:09:55
27,770,463
70
2015-01-04 21:18:31
2,876,370
2016-04-07 08:21:03
https://stackoverflow.com/q/15844542
https://stackoverflow.com/a/27770463
<p>Git has features that you can use to achieve what you need. It supports file system symlinks and it supports submodules. Submodules is already a standard way to handle references to other repositories. You can use them in conjunction with a way to reference files locally. That can be handled directly using relative ...
<p>Git has features that you can use to achieve what you need. It supports file system symlinks and it supports submodules. Submodules is already a standard way to handle references to other repositories. You can use them in conjunction with a way to reference files locally. That can be handled directly using relative ...
119
git
<h1>git: symlink/reference to a file in an external repository</h1> <p>Is it possible in git to have a "link" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full directory:</p> <pre><code>my-project/ class1.java class2.java logb...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,637
git
# git: symlink/reference to a file in an external repository Is it possible in git to have a "link" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full directory: ``` my-project/ class1.java class2.java logback.xml (link to a p...
Git has features that you can use to achieve what you need. It supports file system symlinks and it supports submodules. Submodules is already a standard way to handle references to other repositories. You can use them in conjunction with a way to reference files locally. That can be handled directly using relative sym...
9944898
Bitbucket: Update a fork to merge changes of master repo?
56
2012-03-30 14:26:36
<p>I am working with a bitbucket git repo I have read-only access to, so I created a fork to work on my features. </p> <p>Question: How do I update my fork to include changes made to the original repo made by the owner? </p> <p>On github, it seems one has to do the following, so I suspect it's a similar to this: </p>...
35,178
789,070
2024-03-11 17:19:11
9,946,742
70
2012-03-30 16:18:03
110,204
2018-02-28 06:49:22
https://stackoverflow.com/q/9944898
https://stackoverflow.com/a/9946742
<p>Just like GitHub, you have to pull the commits down to your own machine, merge, and then push them back to your fork on Bitbucket.</p> <p>If you go to your fork on Bitbucket you can click "compare fork" to get to a page where you see incoming and outgoing commits. If you go to the "incoming" tab, you will see instr...
<p>Just like GitHub, you have to pull the commits down to your own machine, merge, and then push them back to your fork on Bitbucket.</p> <p>If you go to your fork on Bitbucket you can click "compare fork" to get to a page where you see incoming and outgoing commits. If you go to the "incoming" tab, you will see instr...
119, 3346, 8337, 79324
bitbucket, dvcs, git, git-fork
<h1>Bitbucket: Update a fork to merge changes of master repo?</h1> <p>I am working with a bitbucket git repo I have read-only access to, so I created a fork to work on my features. </p> <p>Question: How do I update my fork to include changes made to the original repo made by the owner? </p> <p>On github, it seems one...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10
16,639
git
# Bitbucket: Update a fork to merge changes of master repo? I am working with a bitbucket git repo I have read-only access to, so I created a fork to work on my features. Question: How do I update my fork to include changes made to the original repo made by the owner? On github, it seems one has to do the following,...
Just like GitHub, you have to pull the commits down to your own machine, merge, and then push them back to your fork on Bitbucket. If you go to your fork on Bitbucket you can click "compare fork" to get to a page where you see incoming and outgoing commits. If you go to the "incoming" tab, you will see instructions li...