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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
40561234 | Can you change .git folder location? | 23 | 2016-11-12 09:00:44 | <p>All git repos create .git folder inside working directory. Can you change this folder location?</p>
| 15,703 | 1,223,666 | 2024-07-19 06:00:49 | 40,561,395 | 30 | 2016-11-12 09:21:40 | 4,265,352 | 2016-11-12 09:30:48 | https://stackoverflow.com/q/40561234 | https://stackoverflow.com/a/40561395 | <p>You can tell Git to create the <code>.git</code> directory somewhere else when you create the repository:</p>
<pre><code>git init --separate-git-dir=/path/to/dot-git-directory .
</code></pre>
<p><code>git init</code> is used to create a new local repository but you can also run <code>git init</code> in an existing... | <p>You can tell Git to create the <code>.git</code> directory somewhere else when you create the repository:</p> <pre><code>git init --separate-git-dir=/path/to/dot-git-directory . </code></pre> <p><code>git init</code> is used to create a new local repository but you can also run <code>git init</code> in an existing... | 119 | git | <h1>Can you change .git folder location?</h1>
<p>All git repos create .git folder inside working directory. Can you change this folder location?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,960 | git | # Can you change .git folder location?
All git repos create .git folder inside working directory. Can you change this folder location? | You can tell Git to create the `.git` directory somewhere else when you create the repository:
```
git init --separate-git-dir=/path/to/dot-git-directory .
```
`git init` is used to create a new local repository but you can also run `git init` in an existing repository to re-initialize some of its properties. The loc... |
30805098 | How to display last N tags in GIT | 23 | 2015-06-12 14:08:19 | <p>Is there a way to display last N tags in git?</p>
<p>I am not interested in a pattern because this can change. For example let's say I have these tags and I want to get last 3 of them:</p>
<pre><code>v1.0.0
v1.0.1
v2.0.0
v2.1.0
v3.0.0
</code></pre>
<p>Based on the <a href="https://git-scm.com/book/en/v2/Git-Basic... | 12,719 | 900,145 | 2022-11-14 08:16:46 | 30,811,825 | 30 | 2015-06-12 20:38:51 | 2,790,048 | 2015-06-12 20:59:41 | https://stackoverflow.com/q/30805098 | https://stackoverflow.com/a/30811825 | <p>This can be done with <code>git tag --sort</code> option which is introduced in Git v 2.0.0.</p>
<p>Note: I'm using the minus sign <code>-</code> to get reverse sorting order (default is oldest to newest).</p>
<p>Replace <code><number></code> with an actual natural number.</p>
<h1>UNIX, Linux, OS X</h1>
<p... | <p>This can be done with <code>git tag --sort</code> option which is introduced in Git v 2.0.0.</p> <p>Note: I'm using the minus sign <code>-</code> to get reverse sorting order (default is oldest to newest).</p> <p>Replace <code><number></code> with an actual natural number.</p> <h1>UNIX, Linux, OS X</h1> <p... | 119, 60718 | git, git-tag | <h1>How to display last N tags in GIT</h1>
<p>Is there a way to display last N tags in git?</p>
<p>I am not interested in a pattern because this can change. For example let's say I have these tags and I want to get last 3 of them:</p>
<pre><code>v1.0.0
v1.0.1
v2.0.0
v2.1.0
v3.0.0
</code></pre>
<p>Based on the <a hre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,962 | git | # How to display last N tags in GIT
Is there a way to display last N tags in git?
I am not interested in a pattern because this can change. For example let's say I have these tags and I want to get last 3 of them:
```
v1.0.0
v1.0.1
v2.0.0
v2.1.0
v3.0.0
```
Based on the [Pro Git](https://git-scm.com/book/en/v2/Git-B... | This can be done with `git tag --sort` option which is introduced in Git v 2.0.0.
Note: I'm using the minus sign `-` to get reverse sorting order (default is oldest to newest).
Replace `<number>` with an actual natural number.
# UNIX, Linux, OS X
```
git tag --sort=-version:refname | head -n <number>
```
From `man... |
11648105 | Git Merge Conflict - Remote File Deleted, Local File Changed | 23 | 2012-07-25 10:52:25 | <p>I merged in changes from another branch but I am getting conflicts because a file has been deleted on the remote branch but has changes on local branch.</p>
<p>I would like to delete the file - I tried <code>git rm path/to/file</code> but it says <code>file: needs merge</code>. What is the best way of removing the ... | 21,158 | 475,624 | 2019-07-27 20:54:37 | 11,648,149 | 30 | 2012-07-25 10:55:00 | 410,126 | 2016-01-30 14:59:21 | https://stackoverflow.com/q/11648105 | https://stackoverflow.com/a/11648149 | <p>Try using the <code>--force</code> parameter:</p>
<pre><code>git rm --force <file>
</code></pre>
<p>If you want to keep the file in filesystem:</p>
<pre><code>git rm --cached <file>
</code></pre>
| <p>Try using the <code>--force</code> parameter:</p> <pre><code>git rm --force <file> </code></pre> <p>If you want to keep the file in filesystem:</p> <pre><code>git rm --cached <file> </code></pre> | 119, 28897, 106113 | git, git-merge, git-merge-conflict | <h1>Git Merge Conflict - Remote File Deleted, Local File Changed</h1>
<p>I merged in changes from another branch but I am getting conflicts because a file has been deleted on the remote branch but has changes on local branch.</p>
<p>I would like to delete the file - I tried <code>git rm path/to/file</code> but it says... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,963 | git | # Git Merge Conflict - Remote File Deleted, Local File Changed
I merged in changes from another branch but I am getting conflicts because a file has been deleted on the remote branch but has changes on local branch.
I would like to delete the file - I tried `git rm path/to/file` but it says `file: needs merge`. What ... | Try using the `--force` parameter:
```
git rm --force <file>
```
If you want to keep the file in filesystem:
```
git rm --cached <file>
``` |
10362868 | Git reset and checkout by single command | 23 | 2012-04-28 10:57:52 | <p>Consider I've staged for committing a file (e.g. <code>db/schema.rb</code>) that I didn't intended to change. I need to do:</p>
<pre><code>git reset db/schema.rb
git checkout db/schema.rb
</code></pre>
<p>Can I do it by single command?</p>
| 1,490 | 126,529 | 2020-01-27 19:55:57 | 10,363,056 | 30 | 2012-04-28 11:26:45 | 619,292 | 2012-04-28 11:26:45 | https://stackoverflow.com/q/10362868 | https://stackoverflow.com/a/10363056 | <p>I tried this one and works well for me:</p>
<pre><code>git checkout HEAD -- path
</code></pre>
| <p>I tried this one and works well for me:</p> <pre><code>git checkout HEAD -- path </code></pre> | 119, 37230, 51381 | git, git-checkout, git-reset | <h1>Git reset and checkout by single command</h1>
<p>Consider I've staged for committing a file (e.g. <code>db/schema.rb</code>) that I didn't intended to change. I need to do:</p>
<pre><code>git reset db/schema.rb
git checkout db/schema.rb
</code></pre>
<p>Can I do it by single command?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,964 | git | # Git reset and checkout by single command
Consider I've staged for committing a file (e.g. `db/schema.rb`) that I didn't intended to change. I need to do:
```
git reset db/schema.rb
git checkout db/schema.rb
```
Can I do it by single command? | I tried this one and works well for me:
```
git checkout HEAD -- path
``` |
24726041 | Import an eclipse android project with version control system into Android Studio | 22 | 2014-07-13 18:44:05 | <p>I am trying to import an eclipse project with version control system into Android Studio. </p>
<p>Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project first from eclipse to import it into Android-Studio.</p>
<p>I have an eclipse Android Project... | 7,390 | 1,365,653 | 2017-03-25 01:48:28 | 24,741,965 | 30 | 2014-07-14 17:09:15 | 1,365,653 | 2015-07-12 01:00:21 | https://stackoverflow.com/q/24726041 | https://stackoverflow.com/a/24741965 | <p>Here is the step by step solution to do it.</p>
<ol>
<li>Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp")
Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't
get triggered and android studio uses old import wizard.</l... | <p>Here is the step by step solution to do it.</p> <ol> <li>Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp") Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't get triggered and android studio uses old import wizard.</l... | 119, 1386, 32307, 91905 | android, android-studio, git, gradle | <h1>Import an eclipse android project with version control system into Android Studio</h1>
<p>I am trying to import an eclipse project with version control system into Android Studio. </p>
<p>Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project fir... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,966 | git | # Import an eclipse android project with version control system into Android Studio
I am trying to import an eclipse project with version control system into Android Studio.
Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project first from eclipse t... | Here is the step by step solution to do it.
1. Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp")
Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't
get triggered and android studio uses old import wizard.
2. Android... |
15925079 | Why does git ls-files --ignore require exclude patterns? | 22 | 2013-04-10 11:53:20 | <p>What is the logic behind the requirement to use an exclude pattern with the command <code>git ls-files --ignored</code>?</p>
<p>From <code>git help ls-files</code>:</p>
<blockquote>
<p><code>-i, --ignored</code></p>
<p>Show only ignored files in the output. When showing files in the index, print only those matched b... | 20,567 | 887,168 | 2022-07-25 09:52:59 | 15,927,713 | 30 | 2013-04-10 13:47:42 | 912,144 | 2022-07-25 09:52:59 | https://stackoverflow.com/q/15925079 | https://stackoverflow.com/a/15927713 | <p>First of all let me make sure you are not confusing <code>--ignored</code> with <code>--others</code>.</p>
<p><code>--others</code> is the option you would give to list untracked files. From the manual of <code>git-ls-files</code> (emphasis mine):</p>
<blockquote>
<p><code>-o, --others</code></p>
<p>Show other <stro... | <p>First of all let me make sure you are not confusing <code>--ignored</code> with <code>--others</code>.</p> <p><code>--others</code> is the option you would give to list untracked files. From the manual of <code>git-ls-files</code> (emphasis mine):</p> <blockquote> <p><code>-o, --others</code></p> <p>Show other <stro... | 119 | git | <h1>Why does git ls-files --ignore require exclude patterns?</h1>
<p>What is the logic behind the requirement to use an exclude pattern with the command <code>git ls-files --ignored</code>?</p>
<p>From <code>git help ls-files</code>:</p>
<blockquote>
<p><code>-i, --ignored</code></p>
<p>Show only ignored files in the o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,967 | git | # Why does git ls-files --ignore require exclude patterns?
What is the logic behind the requirement to use an exclude pattern with the command `git ls-files --ignored`?
From `git help ls-files`:
> `-i, --ignored`
>
> Show only ignored files in the output. When showing files in the index, print only those matched by ... | First of all let me make sure you are not confusing `--ignored` with `--others`.
`--others` is the option you would give to list untracked files. From the manual of `git-ls-files` (emphasis mine):
> `-o, --others`
>
> Show other **(i.e. untracked)** files in the output
That said, let's see what `--ignored` does. Reg... |
45053222 | How can I merge the last two commits? | 21 | 2017-07-12 09:06:29 | <p>I want to combine my last two git commits. Here is the result of <code>git log</code>:</p>
<p><a href="https://i.sstatic.net/FMdMT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FMdMT.png" alt="A partial git log with commits in a red box" /></a></p>
<p>You can see my last two commits highlighted in t... | 19,921 | 5,259,594 | 2025-09-14 22:56:02 | 45,053,983 | 30 | 2017-07-12 09:37:41 | 4,265,352 | 2025-09-12 10:59:14 | https://stackoverflow.com/q/45053222 | https://stackoverflow.com/a/45053983 | <p>There are many ways to do it (using <code>rebase</code> or <code>reset</code>).</p>
<p>The approach using <a href="https://git-scm.com/docs/git-reset" rel="nofollow noreferrer"><code>git reset</code></a>:</p>
<ol>
<li>No matter the approach, before anything else make sure the working copy is clean. Use <a href="http... | <p>There are many ways to do it (using <code>rebase</code> or <code>reset</code>).</p> <p>The approach using <a href="https://git-scm.com/docs/git-reset" rel="nofollow noreferrer"><code>git reset</code></a>:</p> <ol> <li>No matter the approach, before anything else make sure the working copy is clean. Use <a href="http... | 119, 28897, 29934 | git, git-merge, git-rebase | <h1>How can I merge the last two commits?</h1>
<p>I want to combine my last two git commits. Here is the result of <code>git log</code>:</p>
<p><a href="https://i.sstatic.net/FMdMT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FMdMT.png" alt="A partial git log with commits in a red box" /></a></p>
<p>Y... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,973 | git | # How can I merge the last two commits?
I want to combine my last two git commits. Here is the result of `git log`:
[](https://i.sstatic.net/FMdMT.png)
You can see my last two commits highlighted in the red box: `6aa74e47a35bb88a7f97366dd... | There are many ways to do it (using `rebase` or `reset`).
The approach using [`git reset`](https://git-scm.com/docs/git-reset):
1. No matter the approach, before anything else make sure the working copy is clean. Use [`git status`](https://git-scm.com/docs/git-status) to find out. If there are uncommitted changes eit... |
23920380 | How to change default branch when using arc diff? | 21 | 2014-05-28 19:35:34 | <p>The first time I used arc diff to submit a branch, it asked me which branch to compare changes to. I entered <code>origin/master</code>. This compares it to all the changes that have been made to the Master branch. Now it always uses the Master to compare it to which I want to change to <code>origin/develop</code>.<... | 5,917 | 1,081,482 | 2014-06-14 07:13:09 | 24,217,546 | 30 | 2014-06-14 07:13:09 | 1,520,518 | 2014-06-14 07:13:09 | https://stackoverflow.com/q/23920380 | https://stackoverflow.com/a/24217546 | <p>Not sure why this is downvoted, but there are numerous occasions where we intend to create revisions diffed against a different branch.</p>
<p>When you selected <code>origin/master</code>, <code>arc</code> writes this info to a file <code>.git/arc/default-relative-commit</code>.</p>
<p>Edit this file to contain a ... | <p>Not sure why this is downvoted, but there are numerous occasions where we intend to create revisions diffed against a different branch.</p> <p>When you selected <code>origin/master</code>, <code>arc</code> writes this info to a file <code>.git/arc/default-relative-commit</code>.</p> <p>Edit this file to contain a ... | 119, 80205, 95672 | arcanist, git, phabricator | <h1>How to change default branch when using arc diff?</h1>
<p>The first time I used arc diff to submit a branch, it asked me which branch to compare changes to. I entered <code>origin/master</code>. This compares it to all the changes that have been made to the Master branch. Now it always uses the Master to compare it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,974 | git | # How to change default branch when using arc diff?
The first time I used arc diff to submit a branch, it asked me which branch to compare changes to. I entered `origin/master`. This compares it to all the changes that have been made to the Master branch. Now it always uses the Master to compare it to which I want to ... | Not sure why this is downvoted, but there are numerous occasions where we intend to create revisions diffed against a different branch.
When you selected `origin/master`, `arc` writes this info to a file `.git/arc/default-relative-commit`.
Edit this file to contain a different relative commit branch to contain,
`ori... |
8638562 | git clean: What does "Would not remove" mean? | 21 | 2011-12-26 19:29:34 | <p>When I run <code>git clean --dry-run</code> the results are a bit like:</p>
<pre><code>Would remove an_untracked_file
Would remove an_untracked_file_2
Would not remove some_unrelated_folder/subfolder/
</code></pre>
<p>The "unrelated" folders are tracked and have had no changes, so I would not expect git to remove ... | 13,899 | 489,549 | 2020-07-25 22:33:53 | 8,638,628 | 30 | 2011-12-26 19:39:21 | 582 | 2011-12-26 19:39:21 | https://stackoverflow.com/q/8638562 | https://stackoverflow.com/a/8638628 | <p>By default, <code>git clean</code> doesn't remove folders. It's telling you that it sees an untracked folder, but it won't remove it. Give it the <code>-d</code> flag to instruct it to remove directories as well, as in <code>git clean -d -n</code></p>
| <p>By default, <code>git clean</code> doesn't remove folders. It's telling you that it sees an untracked folder, but it won't remove it. Give it the <code>-d</code> flag to instruct it to remove directories as well, as in <code>git clean -d -n</code></p> | 119, 68596 | git, git-clean | <h1>git clean: What does "Would not remove" mean?</h1>
<p>When I run <code>git clean --dry-run</code> the results are a bit like:</p>
<pre><code>Would remove an_untracked_file
Would remove an_untracked_file_2
Would not remove some_unrelated_folder/subfolder/
</code></pre>
<p>The "unrelated" folders are tracked and ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,976 | git | # git clean: What does "Would not remove" mean?
When I run `git clean --dry-run` the results are a bit like:
```
Would remove an_untracked_file
Would remove an_untracked_file_2
Would not remove some_unrelated_folder/subfolder/
```
The "unrelated" folders are tracked and have had no changes, so I would not expect git... | By default, `git clean` doesn't remove folders. It's telling you that it sees an untracked folder, but it won't remove it. Give it the `-d` flag to instruct it to remove directories as well, as in `git clean -d -n` |
7965850 | Delete branches listed by git branch -a | 21 | 2011-11-01 11:38:30 | <p>The command <code>git branch -a</code> lists a bunch of branches that are NOT on the repository, and NOT local branches. How can these be deleted? </p>
<pre><code>* develop
master
remotes/origin/cloner
</code></pre>
<p>For example, <code>remotes/origin/cloner</code> used to exist in the repo, but it has since ... | 5,164 | 463,833 | 2021-06-01 17:05:17 | 7,965,867 | 30 | 2011-11-01 11:40:12 | 6,236 | 2011-11-01 21:27:30 | https://stackoverflow.com/q/7965850 | https://stackoverflow.com/a/7965867 | <p>If you have remote-tracking branches (such as <code>origin/cloner</code> in this case) which are left over after the corresponding branch has been deleted in the remote repository, you can delete all such remote-tracking branches with:</p>
<pre>
git remote prune origin
</pre>
<p>The <a href="http://schacon.github.... | <p>If you have remote-tracking branches (such as <code>origin/cloner</code> in this case) which are left over after the corresponding branch has been deleted in the remote repository, you can delete all such remote-tracking branches with:</p> <pre> git remote prune origin </pre> <p>The <a href="http://schacon.github.... | 119 | git | <h1>Delete branches listed by git branch -a</h1>
<p>The command <code>git branch -a</code> lists a bunch of branches that are NOT on the repository, and NOT local branches. How can these be deleted? </p>
<pre><code>* develop
master
remotes/origin/cloner
</code></pre>
<p>For example, <code>remotes/origin/cloner</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,977 | git | # Delete branches listed by git branch -a
The command `git branch -a` lists a bunch of branches that are NOT on the repository, and NOT local branches. How can these be deleted?
```
* develop
master
remotes/origin/cloner
```
For example, `remotes/origin/cloner` used to exist in the repo, but it has since been de... | If you have remote-tracking branches (such as `origin/cloner` in this case) which are left over after the corresponding branch has been deleted in the remote repository, you can delete all such remote-tracking branches with:
```
git remote prune origin
```
The [documentation for `git remote`](http://schacon.github.co... |
4699230 | Git make remote master point to another branch | 21 | 2011-01-15 11:08:38 | <p>We got a 'dev' branch thats been functioning as de-facto master for quite a while.</p>
<p>Is there a way to make my remote/master just point to the same place as remote/dev ? (no merging / rebasing / extra work). </p>
<p>(More or less a rename of dev to master)</p>
<p>Thanks in advance</p>
| 12,552 | 192,008 | 2011-01-15 11:28:17 | 4,699,241 | 30 | 2011-01-15 11:12:01 | 28,411 | 2011-01-15 11:12:01 | https://stackoverflow.com/q/4699230 | https://stackoverflow.com/a/4699241 | <p>Checkout master branch, reset it to dev, push.
This will affect users downstream who may have branches off your remote/master. </p>
<pre><code>git checkout master
git reset --hard remote/dev
git push -f
</code></pre>
<p>This will cause you to lose any commits you have made since your remote and dev diverged, bu... | <p>Checkout master branch, reset it to dev, push. This will affect users downstream who may have branches off your remote/master. </p> <pre><code>git checkout master git reset --hard remote/dev git push -f </code></pre> <p>This will cause you to lose any commits you have made since your remote and dev diverged, bu... | 119 | git | <h1>Git make remote master point to another branch</h1>
<p>We got a 'dev' branch thats been functioning as de-facto master for quite a while.</p>
<p>Is there a way to make my remote/master just point to the same place as remote/dev ? (no merging / rebasing / extra work). </p>
<p>(More or less a rename of dev to maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,978 | git | # Git make remote master point to another branch
We got a 'dev' branch thats been functioning as de-facto master for quite a while.
Is there a way to make my remote/master just point to the same place as remote/dev ? (no merging / rebasing / extra work).
(More or less a rename of dev to master)
Thanks in advance | Checkout master branch, reset it to dev, push.
This will affect users downstream who may have branches off your remote/master.
```
git checkout master
git reset --hard remote/dev
git push -f
```
This will cause you to lose any commits you have made since your remote and dev diverged, but you will end up with the sa... |
53834304 | How do I git clone from a Windows machine over ssh? | 20 | 2018-12-18 13:38:37 | <p>I can do <code>ssh windowsmachine</code> from Linux to access a Windows machine, and from there I can <code>git init --bare foo.git</code>, telling me <code>Initialized empty Git repository in C:/Users/unhammer/foo.git/</code></p>
<p>but how do I clone that from the unix side?</p>
<pre><code>$ git clone ssh://wind... | 11,171 | 69,663 | 2019-01-09 08:43:58 | 54,106,128 | 30 | 2019-01-09 08:43:58 | 69,663 | 2019-01-09 08:43:58 | https://stackoverflow.com/q/53834304 | https://stackoverflow.com/a/54106128 | <p>The easiest solution is to <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration#configuring-the-default-shell-for-openssh-in-windows" rel="noreferrer">change the default Windows OpenSSH shell to bash</a>. You can do this easily from powershell on the Windows m... | <p>The easiest solution is to <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration#configuring-the-default-shell-for-openssh-in-windows" rel="noreferrer">change the default Windows OpenSSH shell to bash</a>. You can do this easily from powershell on the Windows m... | 64, 119, 386 | git, ssh, windows | <h1>How do I git clone from a Windows machine over ssh?</h1>
<p>I can do <code>ssh windowsmachine</code> from Linux to access a Windows machine, and from there I can <code>git init --bare foo.git</code>, telling me <code>Initialized empty Git repository in C:/Users/unhammer/foo.git/</code></p>
<p>but how do I clone th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,981 | git | # How do I git clone from a Windows machine over ssh?
I can do `ssh windowsmachine` from Linux to access a Windows machine, and from there I can `git init --bare foo.git`, telling me `Initialized empty Git repository in C:/Users/unhammer/foo.git/`
but how do I clone that from the unix side?
```
$ git clone ssh://win... | The easiest solution is to [change the default Windows OpenSSH shell to bash](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration#configuring-the-default-shell-for-openssh-in-windows). You can do this easily from powershell on the Windows machine:
```
powershell
New-Ite... |
43544919 | git: revert all committed files in a directory to master | 20 | 2017-04-21 14:12:08 | <p>I have a feature branch <code>feature-1-branch</code> created from master.
A lot of time as passed and I created a lot of commits on <code>feature-1-branch</code>.</p>
<p>Now I want to revert commit all changes in a specific directory, lets say <code>src/modules/feature-2</code> I made in branch <code>feature-1-bran... | 13,752 | 1,409,685 | 2020-12-16 07:20:27 | 43,545,012 | 30 | 2017-04-21 14:16:46 | 4,133,798 | 2020-12-16 07:20:27 | https://stackoverflow.com/q/43544919 | https://stackoverflow.com/a/43545012 | <p>Just checkout <em>src/modules/feature-2</em> directory from <code>feature-1</code> branch to <code>origin/master</code> branch.</p>
<pre><code>$ git checkout feature-1-branch
$ git fetch
$ git checkout origin/master src/modules/feature-2/
</code></pre>
<p>Now, You have identical <em>src/modules/feature-2</em> direct... | <p>Just checkout <em>src/modules/feature-2</em> directory from <code>feature-1</code> branch to <code>origin/master</code> branch.</p> <pre><code>$ git checkout feature-1-branch $ git fetch $ git checkout origin/master src/modules/feature-2/ </code></pre> <p>Now, You have identical <em>src/modules/feature-2</em> direct... | 119, 34403 | git, git-revert | <h1>git: revert all committed files in a directory to master</h1>
<p>I have a feature branch <code>feature-1-branch</code> created from master.
A lot of time as passed and I created a lot of commits on <code>feature-1-branch</code>.</p>
<p>Now I want to revert commit all changes in a specific directory, lets say <code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,982 | git | # git: revert all committed files in a directory to master
I have a feature branch `feature-1-branch` created from master.
A lot of time as passed and I created a lot of commits on `feature-1-branch`.
Now I want to revert commit all changes in a specific directory, lets say `src/modules/feature-2` I made in branch `f... | Just checkout *src/modules/feature-2* directory from `feature-1` branch to `origin/master` branch.
```
$ git checkout feature-1-branch
$ git fetch
$ git checkout origin/master src/modules/feature-2/
```
Now, You have identical *src/modules/feature-2* directory in both `master` and `feature-1-branch` branch. |
13341374 | git ignore directories "build" and all their contents but not "build.xml" | 20 | 2012-11-12 09:43:02 | <p>I am using <strong>git</strong> in a project where <strong>Ant</strong> is the build system.
Since I do not wish to add "build" directories to <strong>git</strong> but need to add <strong>build.xml</strong> files I have resorted to the following two lines in my <strong>.gitignore</strong> files:</p>
<pre><code>buil... | 71,101 | 274,677 | 2023-04-27 11:47:31 | 13,341,567 | 30 | 2012-11-12 09:56:57 | 365,237 | 2022-01-14 06:36:21 | https://stackoverflow.com/q/13341374 | https://stackoverflow.com/a/13341567 | <p>No, there is no better way, that's pretty much the way to do it. To be precise,</p>
<pre><code>build/*
!build/build.xml
</code></pre>
<p>As you want to have the folder and ignore all other files in it except build.xml.</p>
<p>Note though that common directory layout for Ant is that build.xml is in the app root folde... | <p>No, there is no better way, that's pretty much the way to do it. To be precise,</p> <pre><code>build/* !build/build.xml </code></pre> <p>As you want to have the folder and ignore all other files in it except build.xml.</p> <p>Note though that common directory layout for Ant is that build.xml is in the app root folde... | 119, 142, 25056 | ant, git, gitignore | <h1>git ignore directories "build" and all their contents but not "build.xml"</h1>
<p>I am using <strong>git</strong> in a project where <strong>Ant</strong> is the build system.
Since I do not wish to add "build" directories to <strong>git</strong> but need to add <strong>build.xml</strong> files I have resorted to th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,984 | git | # git ignore directories "build" and all their contents but not "build.xml"
I am using **git** in a project where **Ant** is the build system.
Since I do not wish to add "build" directories to **git** but need to add **build.xml** files I have resorted to the following two lines in my **.gitignore** files:
```
build/... | No, there is no better way, that's pretty much the way to do it. To be precise,
```
build/*
!build/build.xml
```
As you want to have the folder and ignore all other files in it except build.xml.
Note though that common directory layout for Ant is that build.xml is in the app root folder, whereas build folder only co... |
5128806 | Is there a difference between git reset --hard HEAD and git checkout .? | 20 | 2011-02-26 18:16:36 | <p>If I make changes to the working tree and have not yet committed, and I would like to revert the changes I have made, is there a difference between</p>
<pre><code>git reset --hard HEAD
</code></pre>
<p>and</p>
<pre><code>git checkout .
</code></pre>
<p>?</p>
| 8,970 | 298,065 | 2018-05-28 12:54:22 | 5,128,839 | 30 | 2011-02-26 18:21:02 | 112,968 | 2011-03-01 01:22:01 | https://stackoverflow.com/q/5128806 | https://stackoverflow.com/a/5128839 | <p><code>git checkout -- .</code> will obviously only work on the current directory (and subdirectories thereof), <code>git reset --hard</code> will operate on the complete working tree.</p>
<p><code>git checkout -- .</code> will only update the working tree and leave already staged files as is, whereas <code>git rese... | <p><code>git checkout -- .</code> will obviously only work on the current directory (and subdirectories thereof), <code>git reset --hard</code> will operate on the complete working tree.</p> <p><code>git checkout -- .</code> will only update the working tree and leave already staged files as is, whereas <code>git rese... | 119, 12309 | git, revert | <h1>Is there a difference between git reset --hard HEAD and git checkout .?</h1>
<p>If I make changes to the working tree and have not yet committed, and I would like to revert the changes I have made, is there a difference between</p>
<pre><code>git reset --hard HEAD
</code></pre>
<p>and</p>
<pre><code>git checkout... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,985 | git | # Is there a difference between git reset --hard HEAD and git checkout .?
If I make changes to the working tree and have not yet committed, and I would like to revert the changes I have made, is there a difference between
```
git reset --hard HEAD
```
and
```
git checkout .
```
? | `git checkout -- .` will obviously only work on the current directory (and subdirectories thereof), `git reset --hard` will operate on the complete working tree.
`git checkout -- .` will only update the working tree and leave already staged files as is, whereas `git reset --hard` will match index and working tree with... |
5086342 | How do I include --no-pager in a Git alias? | 20 | 2011-02-23 02:21:31 | <p>I created a Git alias based off of the <a href="http://gitimmersion.com/index.html" rel="noreferrer">Git Immersion</a> tutorial by EdgeCase that looks like this:</p>
<pre><code>hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
</code></pre>
<p>But now it seems to be paging the results — Termi... | 5,220 | 629,429 | 2018-05-25 22:11:46 | 5,086,460 | 30 | 2011-02-23 02:43:42 | 119,963 | 2012-04-09 21:54:26 | https://stackoverflow.com/q/5086342 | https://stackoverflow.com/a/5086460 | <p>You can do that easily by just turning it into a shell command:</p>
<pre><code>hist = "!git --no-pager log ..."
</code></pre>
| <p>You can do that easily by just turning it into a shell command:</p> <pre><code>hist = "!git --no-pager log ..." </code></pre> | 119, 391, 1448, 32868 | alias, git, git-config, terminal | <h1>How do I include --no-pager in a Git alias?</h1>
<p>I created a Git alias based off of the <a href="http://gitimmersion.com/index.html" rel="noreferrer">Git Immersion</a> tutorial by EdgeCase that looks like this:</p>
<pre><code>hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,986 | git | # How do I include --no-pager in a Git alias?
I created a Git alias based off of the [Git Immersion](http://gitimmersion.com/index.html) tutorial by EdgeCase that looks like this:
```
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
```
But now it seems to be paging the results — Terminal show... | You can do that easily by just turning it into a shell command:
```
hist = "!git --no-pager log ..."
``` |
50991701 | Merging two branches, how do I accept one branch for all conflicts | 19 | 2018-06-22 15:58:20 | <p>Im merging two branches together, lets say branchA and branchB. They have about 100 files that conflict.</p>
<p>branchB has the accepted work for everything and is 100% what I need. I don't want to force push branchB or anything.</p>
<p>Is there a way I can merge the two and just say for any conflict accept whats... | 21,594 | 4,214,533 | 2018-06-22 19:37:07 | 50,994,582 | 30 | 2018-06-22 19:37:07 | 1,256,452 | 2018-06-22 19:37:07 | https://stackoverflow.com/q/50991701 | https://stackoverflow.com/a/50994582 | <p>Given what you asked, the answer is the simple sequence:</p>
<pre><code>git checkout branchA
git merge -X theirs branchB
</code></pre>
<p>Before you blindly apply this, make sure you know what you are doing! You also say that you used <code>-s</code> and <code>-x</code>, but <code>git merge</code> does not have a... | <p>Given what you asked, the answer is the simple sequence:</p> <pre><code>git checkout branchA git merge -X theirs branchB </code></pre> <p>Before you blindly apply this, make sure you know what you are doing! You also say that you used <code>-s</code> and <code>-x</code>, but <code>git merge</code> does not have a... | 119, 28897 | git, git-merge | <h1>Merging two branches, how do I accept one branch for all conflicts</h1>
<p>Im merging two branches together, lets say branchA and branchB. They have about 100 files that conflict.</p>
<p>branchB has the accepted work for everything and is 100% what I need. I don't want to force push branchB or anything.</p>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,987 | git | # Merging two branches, how do I accept one branch for all conflicts
Im merging two branches together, lets say branchA and branchB. They have about 100 files that conflict.
branchB has the accepted work for everything and is 100% what I need. I don't want to force push branchB or anything.
Is there a way I can merg... | Given what you asked, the answer is the simple sequence:
```
git checkout branchA
git merge -X theirs branchB
```
Before you blindly apply this, make sure you know what you are doing! You also say that you used `-s` and `-x`, but `git merge` does not have a `-x` option. (Perhaps you meant `-X`. Showing the *actual co... |
26116899 | Generating patch file from an old stash | 19 | 2014-09-30 09:09:24 | <p>I wish to create a <code>.patch</code> file based on the diff of an old stash that I can view with <code>git stash show -p stash@{2}</code></p>
<p>I tried this, but no luck:</p>
<pre><code>git format-patch stash@{2} --stdout > file.patch
</code></pre>
<p>I assumed it would work like a normal commit? Apologies ... | 5,184 | 1,025,702 | 2014-09-30 09:37:26 | 26,117,064 | 30 | 2014-09-30 09:17:01 | 4,323 | 2014-09-30 09:17:01 | https://stackoverflow.com/q/26116899 | https://stackoverflow.com/a/26117064 | <p>The output of <code>git stash show -p</code> is itself a valid patch. You can use it directly:</p>
<pre><code>git stash show -p stash@{2} > file.patch
</code></pre>
| <p>The output of <code>git stash show -p</code> is itself a valid patch. You can use it directly:</p> <pre><code>git stash show -p stash@{2} > file.patch </code></pre> | 119 | git | <h1>Generating patch file from an old stash</h1>
<p>I wish to create a <code>.patch</code> file based on the diff of an old stash that I can view with <code>git stash show -p stash@{2}</code></p>
<p>I tried this, but no luck:</p>
<pre><code>git format-patch stash@{2} --stdout > file.patch
</code></pre>
<p>I assum... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,989 | git | # Generating patch file from an old stash
I wish to create a `.patch` file based on the diff of an old stash that I can view with `git stash show -p stash@{2}`
I tried this, but no luck:
```
git format-patch stash@{2} --stdout > file.patch
```
I assumed it would work like a normal commit? Apologies for being most l... | The output of `git stash show -p` is itself a valid patch. You can use it directly:
```
git stash show -p stash@{2} > file.patch
``` |
15095561 | Cannot do git-svn fetch behind proxy | 19 | 2013-02-26 17:34:38 | <p>I'm trying to mirror a svn repo using git-svn.</p>
<p>I'm doing </p>
<pre><code>git svn clone http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind
</code></pre>
<p>And I'm getting</p>
<pre><code>Initialized empty Git repository in f:/gstest/WorldWind/.git/
RA layer request failed: PROPFIND request failed on '/svn... | 13,202 | 1,000,738 | 2013-10-15 09:00:57 | 15,450,176 | 30 | 2013-03-16 14:00:02 | 641,955 | 2013-03-27 07:36:07 | https://stackoverflow.com/q/15095561 | https://stackoverflow.com/a/15450176 | <p>I had the exact same problem.</p>
<p>And the solution is finding the correct Subversion configuration directory. At least in my case the native <code>svn.exe</code> uses the file <code>C:\Users\MYUSER\AppData\Roaming\Subversion\servers</code>, but <code>git-svn</code> uses <code>~/.subversion/servers</code>. And I ... | <p>I had the exact same problem.</p> <p>And the solution is finding the correct Subversion configuration directory. At least in my case the native <code>svn.exe</code> uses the file <code>C:\Users\MYUSER\AppData\Roaming\Subversion\servers</code>, but <code>git-svn</code> uses <code>~/.subversion/servers</code>. And I ... | 63, 119, 6452 | git, git-svn, svn | <h1>Cannot do git-svn fetch behind proxy</h1>
<p>I'm trying to mirror a svn repo using git-svn.</p>
<p>I'm doing </p>
<pre><code>git svn clone http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind
</code></pre>
<p>And I'm getting</p>
<pre><code>Initialized empty Git repository in f:/gstest/WorldWind/.git/
RA layer re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,991 | git | # Cannot do git-svn fetch behind proxy
I'm trying to mirror a svn repo using git-svn.
I'm doing
```
git svn clone http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind
```
And I'm getting
```
Initialized empty Git repository in f:/gstest/WorldWind/.git/
RA layer request failed: PROPFIND request failed on '/svn/trunk... | I had the exact same problem.
And the solution is finding the correct Subversion configuration directory. At least in my case the native `svn.exe` uses the file `C:\Users\MYUSER\AppData\Roaming\Subversion\servers`, but `git-svn` uses `~/.subversion/servers`. And I mean this path `~/.subversion/servers` in the Git Bash... |
508276 | How do I view git diff with textmate | 19 | 2009-02-03 18:18:07 | <p>I have my editor setup to be textmate but when I do a git diff it uses vi to show me the diff output, is there any way to set it to show the diff in textmate?</p>
| 11,159 | 3,041 | 2016-04-04 15:02:54 | 508,346 | 30 | 2009-02-03 18:37:05 | 17,773 | 2009-02-03 18:37:05 | https://stackoverflow.com/q/508276 | https://stackoverflow.com/a/508346 | <p>I normally pipe the contents to mate like this:</p>
<pre><code>git diff | mate -
</code></pre>
| <p>I normally pipe the contents to mate like this:</p> <pre><code>git diff | mate - </code></pre> | 119, 606, 1342 | diff, git, textmate | <h1>How do I view git diff with textmate</h1>
<p>I have my editor setup to be textmate but when I do a git diff it uses vi to show me the diff output, is there any way to set it to show the diff in textmate?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,992 | git | # How do I view git diff with textmate
I have my editor setup to be textmate but when I do a git diff it uses vi to show me the diff output, is there any way to set it to show the diff in textmate? | I normally pipe the contents to mate like this:
```
git diff | mate -
``` |
42888832 | Can't push/pull to bitbucket via SSH using IPv6 | 18 | 2017-03-19 16:07:58 | <p><strong>When I can push/pull to bitbucket:</strong></p>
<ul>
<li>From my work computer via ssh key <code>id_rsa_bitbucket_work</code></li>
<li>From my laptop, but only when logged into VPN (Cisco AnyConnect) via ssh key <code>id_rsa_bitbucket</code>. My VPN has a static IP.</li>
<li>Always using https.</li>
</ul>
... | 7,102 | 7,735,643 | 2023-08-25 02:44:05 | 42,891,232 | 30 | 2017-03-19 19:32:27 | 7,735,643 | 2017-04-13 03:10:39 | https://stackoverflow.com/q/42888832 | https://stackoverflow.com/a/42891232 | <p><strong>Updated after lots of help from Bitbucket support:</strong></p>
<p>After much more research, the problem appears to be on my router's end (Linksys E3200) and is somehow related to IPv6. I have no trouble accessing IPv6-only sites, and everything works fine with github (this is because github is IPv4 only). ... | <p><strong>Updated after lots of help from Bitbucket support:</strong></p> <p>After much more research, the problem appears to be on my router's end (Linksys E3200) and is somehow related to IPv6. I have no trouble accessing IPv6-only sites, and everything works fine with github (this is because github is IPv4 only). ... | 119, 386, 633, 8337, 10485 | bitbucket, git, ipv6, ssh, vpn | <h1>Can't push/pull to bitbucket via SSH using IPv6</h1>
<p><strong>When I can push/pull to bitbucket:</strong></p>
<ul>
<li>From my work computer via ssh key <code>id_rsa_bitbucket_work</code></li>
<li>From my laptop, but only when logged into VPN (Cisco AnyConnect) via ssh key <code>id_rsa_bitbucket</code>. My VPN h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,994 | git | # Can't push/pull to bitbucket via SSH using IPv6
**When I can push/pull to bitbucket:**
- From my work computer via ssh key `id_rsa_bitbucket_work`
- From my laptop, but only when logged into VPN (Cisco AnyConnect) via ssh key `id_rsa_bitbucket`. My VPN has a static IP.
- Always using https.
**When I cannot push/pu... | **Updated after lots of help from Bitbucket support:**
After much more research, the problem appears to be on my router's end (Linksys E3200) and is somehow related to IPv6. I have no trouble accessing IPv6-only sites, and everything works fine with github (this is because github is IPv4 only). However, there is somet... |
9971332 | Git create a new branch with only a specified directory and its history then push to new repository | 18 | 2012-04-02 05:35:08 | <p>I'd like to create a new branch in my repo that only includes files from a specific directory in master <em>and its history</em> then push that branch to a new repository.</p>
<p>...or something equivalent – for instance it may be possible to push a directory to a new repository to a new repo without creating a bra... | 20,460 | 14,572 | 2015-07-01 12:13:46 | 31,160,999 | 30 | 2015-07-01 12:13:46 | 112,968 | 2015-07-01 12:13:46 | https://stackoverflow.com/q/9971332 | https://stackoverflow.com/a/31160999 | <p>Why don't you want to use <code>git filter-branch</code>? It's been built specifically for tasks such as the one you want.</p>
<pre><code>git branch subdir_branch HEAD
git filter-branch --subdirectory-filter dir/to/filter -- subdir_branch
git push git://.../new_repo.git subdir_branch:master
</code></pre>
<p>This w... | <p>Why don't you want to use <code>git filter-branch</code>? It's been built specifically for tasks such as the one you want.</p> <pre><code>git branch subdir_branch HEAD git filter-branch --subdirectory-filter dir/to/filter -- subdir_branch git push git://.../new_repo.git subdir_branch:master </code></pre> <p>This w... | 119, 1879, 46509 | branch, git, git-filter-branch | <h1>Git create a new branch with only a specified directory and its history then push to new repository</h1>
<p>I'd like to create a new branch in my repo that only includes files from a specific directory in master <em>and its history</em> then push that branch to a new repository.</p>
<p>...or something equivalent –... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,995 | git | # Git create a new branch with only a specified directory and its history then push to new repository
I'd like to create a new branch in my repo that only includes files from a specific directory in master *and its history* then push that branch to a new repository.
...or something equivalent – for instance it may be... | Why don't you want to use `git filter-branch`? It's been built specifically for tasks such as the one you want.
```
git branch subdir_branch HEAD
git filter-branch --subdirectory-filter dir/to/filter -- subdir_branch
git push git://.../new_repo.git subdir_branch:master
```
This will give you only the contents of your... |
16271906 | "cannot pull into a repository with state: merging_resolved" | 18 | 2013-04-29 05:44:19 | <p>After some pulling, merging and conflict resolving, my GIT is stuck. This is what I tried to do (with EGit) on the main project:</p>
<ul>
<li>"Pull" returns "cannot pull into a repository with state: merging_resolved"</li>
<li>"Fetch from upstream" returns "No ref to fetch from GeniusWebSocket - origin - everything... | 51,769 | 827,927 | 2019-12-18 12:00:39 | 16,273,416 | 30 | 2013-04-29 07:34:57 | 6,309 | 2018-04-25 06:55:31 | https://stackoverflow.com/q/16271906 | https://stackoverflow.com/a/16273416 | <p>Since you have finished your merge, and if you don't have any pending changes, you can try a <code>git reset --hard</code>, and see if the issue persists.
(See <a href="http://wiki.eclipse.org/EGit/User_Guide#Resetting_your_current_HEAD" rel="noreferrer">EGit reset your current HEAD</a>)</p>
<hr>
<p><a href="https... | <p>Since you have finished your merge, and if you don't have any pending changes, you can try a <code>git reset --hard</code>, and see if the issue persists. (See <a href="http://wiki.eclipse.org/EGit/User_Guide#Resetting_your_current_HEAD" rel="noreferrer">EGit reset your current HEAD</a>)</p> <hr> <p><a href="https... | 119, 717, 43702 | egit, git, merge | <h1>"cannot pull into a repository with state: merging_resolved"</h1>
<p>After some pulling, merging and conflict resolving, my GIT is stuck. This is what I tried to do (with EGit) on the main project:</p>
<ul>
<li>"Pull" returns "cannot pull into a repository with state: merging_resolved"</li>
<li>"Fetch from upstrea... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,996 | git | # "cannot pull into a repository with state: merging_resolved"
After some pulling, merging and conflict resolving, my GIT is stuck. This is what I tried to do (with EGit) on the main project:
- "Pull" returns "cannot pull into a repository with state: merging_resolved"
- "Fetch from upstream" returns "No ref to fetch... | Since you have finished your merge, and if you don't have any pending changes, you can try a `git reset --hard`, and see if the issue persists.
(See [EGit reset your current HEAD](http://wiki.eclipse.org/EGit/User_Guide#Resetting_your_current_HEAD))
---
[Ankit Marothi](https://stackoverflow.com/users/3611104/ankit-ma... |
12730344 | Can't see remote branch | 18 | 2012-10-04 15:09:50 | <p>I'm stil learning git and not sure how some basic things work. I created a local branch by doing:</p>
<pre><code>git branch AppStore
</code></pre>
<p>I can't remember exactly how I pushed this branch to github.com, but I can see MyBranch on the repository. When I do </p>
<pre><code>git branch -a
</code></pre>
<... | 54,479 | 207,524 | 2018-05-22 16:27:38 | 12,730,505 | 30 | 2012-10-04 15:18:51 | 6,309 | 2012-10-04 16:42:24 | https://stackoverflow.com/q/12730344 | https://stackoverflow.com/a/12730505 | <p>You need to publish your branch on your upstream repo, while tracking it locally (making sure your local branch keep in synch with that new remote branch: see "<a href="https://stackoverflow.com/questions/4693588/git-what-is-a-tracking-branch/4697054#4697054">What is a tracking branch</a>")</p>
<pre><code>git push ... | <p>You need to publish your branch on your upstream repo, while tracking it locally (making sure your local branch keep in synch with that new remote branch: see "<a href="https://stackoverflow.com/questions/4693588/git-what-is-a-tracking-branch/4697054#4697054">What is a tracking branch</a>")</p> <pre><code>git push ... | 119 | git | <h1>Can't see remote branch</h1>
<p>I'm stil learning git and not sure how some basic things work. I created a local branch by doing:</p>
<pre><code>git branch AppStore
</code></pre>
<p>I can't remember exactly how I pushed this branch to github.com, but I can see MyBranch on the repository. When I do </p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,997 | git | # Can't see remote branch
I'm stil learning git and not sure how some basic things work. I created a local branch by doing:
```
git branch AppStore
```
I can't remember exactly how I pushed this branch to github.com, but I can see MyBranch on the repository. When I do
```
git branch -a
```
I see this:
```
ARC
*... | You need to publish your branch on your upstream repo, while tracking it locally (making sure your local branch keep in synch with that new remote branch: see "[What is a tracking branch](https://stackoverflow.com/questions/4693588/git-what-is-a-tracking-branch/4697054#4697054)")
```
git push --set-upstream origin App... |
65349887 | Azure Devops Repos - Revert back to a previous commit like the recent ones never existed | 17 | 2020-12-17 23:40:21 | <p>I know that you can revert back to a previous commit but it doesn't sound like the history will be gone. How can I revert back to a previous commit and make sure the commits that came after are gone forever?</p>
| 82,137 | 6,179,613 | 2024-07-25 06:32:27 | 65,351,668 | 30 | 2020-12-18 04:05:57 | 11,882,186 | 2020-12-18 04:05:57 | https://stackoverflow.com/q/65349887 | https://stackoverflow.com/a/65351668 | <p><a href="https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified#_git_reset" rel="noreferrer">Git reset</a> command can achieve this.</p>
<p>You can run the <code>git reset --hard</code> command to revert back to a previous commit. Then run <code>git push --force</code> command to wipe out all the commits came af... | <p><a href="https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified#_git_reset" rel="noreferrer">Git reset</a> command can achieve this.</p> <p>You can run the <code>git reset --hard</code> command to revert back to a previous commit. Then run <code>git push --force</code> command to wipe out all the commits came af... | 119, 14158, 34403, 116537, 134848 | azure, azure-devops, azure-repos, git, git-revert | <h1>Azure Devops Repos - Revert back to a previous commit like the recent ones never existed</h1>
<p>I know that you can revert back to a previous commit but it doesn't sound like the history will be gone. How can I revert back to a previous commit and make sure the commits that came after are gone forever?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 18,998 | git | # Azure Devops Repos - Revert back to a previous commit like the recent ones never existed
I know that you can revert back to a previous commit but it doesn't sound like the history will be gone. How can I revert back to a previous commit and make sure the commits that came after are gone forever? | [Git reset](https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified#_git_reset) command can achieve this.
You can run the `git reset --hard` command to revert back to a previous commit. Then run `git push --force` command to wipe out all the commits came after this commit on server.
```
git clone <repo_url> #clon... |
28790561 | confused about creating nested branches in git | 17 | 2015-03-01 05:45:10 | <p>I just started using git and started collaborating with other developers on same code. I have worked a little with SVN before but never had to collaborate with other people on my codebase.
Now with collaborators working on same code, I need an efficient workflow. While searching for such, I found <a href="http://nv... | 17,175 | 4,619,406 | 2015-03-01 06:24:21 | 28,790,783 | 30 | 2015-03-01 06:24:21 | 1,256,452 | 2015-03-01 06:24:21 | https://stackoverflow.com/q/28790561 | https://stackoverflow.com/a/28790783 | <p><strong>TL;DR version:</strong> just <code>git checkout -b develop/feature</code> initially (you'll need to <em>not</em> have a branch named <code>develop</code> for this to work though!).</p>
<hr>
<p>Branches don't really "nest" for a ridiculously simple reason: a branch name (like <code>newFeature</code>) merely... | <p><strong>TL;DR version:</strong> just <code>git checkout -b develop/feature</code> initially (you'll need to <em>not</em> have a branch named <code>develop</code> for this to work though!).</p> <hr> <p>Branches don't really "nest" for a ridiculously simple reason: a branch name (like <code>newFeature</code>) merely... | 119, 1879, 3610 | branch, git, nested | <h1>confused about creating nested branches in git</h1>
<p>I just started using git and started collaborating with other developers on same code. I have worked a little with SVN before but never had to collaborate with other people on my codebase.
Now with collaborators working on same code, I need an efficient workfl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,001 | git | # confused about creating nested branches in git
I just started using git and started collaborating with other developers on same code. I have worked a little with SVN before but never had to collaborate with other people on my codebase.
Now with collaborators working on same code, I need an efficient workflow. While ... | **TL;DR version:** just `git checkout -b develop/feature` initially (you'll need to *not* have a branch named `develop` for this to work though!).
---
Branches don't really "nest" for a ridiculously simple reason: a branch name (like `newFeature`) merely stands in for some commit-ID, i.e., some SHA-1 "true name" of s... |
21208697 | Select all geospatial points inside a bounding box | 17 | 2014-01-18 19:16:40 | <p>I have a table called 'flags' in a MySQL database with 400,000 rows. This table is made up of geospatial points that represent different positions around the UK.</p>
<p>The application I'm creating uses Google Maps. On the map is a button that should toggle the flags visibility on the map. It's my job now to create... | 15,341 | 2,273,902 | 2019-03-16 19:42:40 | 21,209,365 | 30 | 2014-01-18 20:19:16 | 205,608 | 2019-03-16 19:42:40 | https://stackoverflow.com/q/21208697 | https://stackoverflow.com/a/21209365 | <p>Presumably the x and y items in your POINT data in your <code>geometry</code> column is in degrees of latitude and longitude.</p>
<p>To do this lookup efficiently in MySQL, you'll need a few things.</p>
<ul>
<li>A MyISAM table (or MySQL Version 5.7 and beyond and either InnoDB or MyISAM)</li>
<li>A NOT NULL qualif... | <p>Presumably the x and y items in your POINT data in your <code>geometry</code> column is in degrees of latitude and longitude.</p> <p>To do this lookup efficiently in MySQL, you'll need a few things.</p> <ul> <li>A MyISAM table (or MySQL Version 5.7 and beyond and either InnoDB or MyISAM)</li> <li>A NOT NULL qualif... | 21, 22, 12620, 20301 | geospatial, latitude-longitude, mysql, sql | <h1>Select all geospatial points inside a bounding box</h1>
<p>I have a table called 'flags' in a MySQL database with 400,000 rows. This table is made up of geospatial points that represent different positions around the UK.</p>
<p>The application I'm creating uses Google Maps. On the map is a button that should toggl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,002 | git | # Select all geospatial points inside a bounding box
I have a table called 'flags' in a MySQL database with 400,000 rows. This table is made up of geospatial points that represent different positions around the UK.
The application I'm creating uses Google Maps. On the map is a button that should toggle the flags visi... | Presumably the x and y items in your POINT data in your `geometry` column is in degrees of latitude and longitude.
To do this lookup efficiently in MySQL, you'll need a few things.
- A MyISAM table (or MySQL Version 5.7 and beyond and either InnoDB or MyISAM)
- A NOT NULL qualification on your geometry column
- A spa... |
42725864 | Dotnet MVC 5 .gitignore | 16 | 2017-03-10 19:00:39 | <p>I'm looking for a working piece of code for an MVC 5 .gitignore file.</p>
<p>Previously I used a file from <a href="https://github.com/github/gitignore/blob/master/VisualStudio.gitignore" rel="noreferrer" title="Github Visual Studio Gitignore">Github Visual Studio Gitignore</a></p>
<p>The problem is that I noticed... | 14,526 | 6,237,879 | 2022-05-26 08:51:20 | 42,728,261 | 30 | 2017-03-10 21:47:20 | 2,280,523 | 2020-07-19 12:59:04 | https://stackoverflow.com/q/42725864 | https://stackoverflow.com/a/42728261 | <p><strong>Update 2020/07 - for those who are dotnet developers, I now use:</strong></p>
<pre><code>dotnet new gitignore
</code></pre>
<p><strong>Pretty much the same stuff as before with a few things added - and now <em>someone else</em> is keeping it up to date!</strong></p>
<hr />
<p>Here's one I use:</p>
<pre><code... | <p><strong>Update 2020/07 - for those who are dotnet developers, I now use:</strong></p> <pre><code>dotnet new gitignore </code></pre> <p><strong>Pretty much the same stuff as before with a few things added - and now <em>someone else</em> is keeping it up to date!</strong></p> <hr /> <p>Here's one I use:</p> <pre><code... | 119, 470, 33953 | asp.net-mvc, git, visual-studio | <h1>Dotnet MVC 5 .gitignore</h1>
<p>I'm looking for a working piece of code for an MVC 5 .gitignore file.</p>
<p>Previously I used a file from <a href="https://github.com/github/gitignore/blob/master/VisualStudio.gitignore" rel="noreferrer" title="Github Visual Studio Gitignore">Github Visual Studio Gitignore</a></p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,003 | git | # Dotnet MVC 5 .gitignore
I'm looking for a working piece of code for an MVC 5 .gitignore file.
Previously I used a file from [Github Visual Studio Gitignore](https://github.com/github/gitignore/blob/master/VisualStudio.gitignore "Github Visual Studio Gitignore")
The problem is that I noticed there are still files c... | **Update 2020/07 - for those who are dotnet developers, I now use:**
```
dotnet new gitignore
```
**Pretty much the same stuff as before with a few things added - and now *someone else* is keeping it up to date!**
---
Here's one I use:
```
## Ignore Visual Studio temporary files, build results, and
## files genera... |
39581777 | git update-index --assume-unchanged not working for me | 15 | 2016-09-19 20:42:59 | <p>I am in a project building a web app. We use Git for version control and Gulp for task automation. I would like to temporarily ignore files to a certain folder, the build folder. We tend to commit changes to that folder at the end of the day (or at the end of a coding session).</p>
<p>After some research I found th... | 8,281 | 4,227,610 | 2022-04-27 16:02:41 | 39,583,010 | 30 | 2016-09-19 22:26:55 | 4,233,593 | 2016-09-19 22:26:55 | https://stackoverflow.com/q/39581777 | https://stackoverflow.com/a/39583010 | <p>You're not supposed to change the file with that bit.</p>
<blockquote>
<p>When the "assume unchanged" bit is on, <strong>the user promises not to change the file</strong> and allows Git to assume that the working tree file matches what is recorded in the index.</p>
</blockquote>
<p>It's intended to save time on ... | <p>You're not supposed to change the file with that bit.</p> <blockquote> <p>When the "assume unchanged" bit is on, <strong>the user promises not to change the file</strong> and allows Git to assume that the working tree file matches what is recorded in the index.</p> </blockquote> <p>It's intended to save time on ... | 119 | git | <h1>git update-index --assume-unchanged not working for me</h1>
<p>I am in a project building a web app. We use Git for version control and Gulp for task automation. I would like to temporarily ignore files to a certain folder, the build folder. We tend to commit changes to that folder at the end of the day (or at the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,006 | git | # git update-index --assume-unchanged not working for me
I am in a project building a web app. We use Git for version control and Gulp for task automation. I would like to temporarily ignore files to a certain folder, the build folder. We tend to commit changes to that folder at the end of the day (or at the end of a ... | You're not supposed to change the file with that bit.
> When the "assume unchanged" bit is on, **the user promises not to change the file** and allows Git to assume that the working tree file matches what is recorded in the index.
It's intended to save time on big projects.
> This is sometimes helpful when working w... |
39471072 | How to create a local push destination on a hard disk using Git | 15 | 2016-09-13 13:15:06 | <p>I want to make a local push destination on my hard disk on <em>Git</em>, and use that destination(folder) for <em>push</em> and <em>pull</em> instead of adding an remote repository.
How do I do that in <em>Git</em>?</p>
| 6,911 | 6,009,769 | 2020-01-10 14:08:36 | 39,471,686 | 30 | 2016-09-13 13:45:09 | 1,988,796 | 2020-01-10 14:08:36 | https://stackoverflow.com/q/39471072 | https://stackoverflow.com/a/39471686 | <p>Follow these steps:</p>
<ol>
<li><p>Go to the folder you want to have your <strong>remote</strong> in</p>
<pre><code>$ cd /path/to/my-remote
</code></pre></li>
<li><p>Create a bare repository there via <a href="https://git-scm.com/docs/git-init" rel="noreferrer">git init</a></p>
<pre><code>$ git init --bare
</cod... | <p>Follow these steps:</p> <ol> <li><p>Go to the folder you want to have your <strong>remote</strong> in</p> <pre><code>$ cd /path/to/my-remote </code></pre></li> <li><p>Create a bare repository there via <a href="https://git-scm.com/docs/git-init" rel="noreferrer">git init</a></p> <pre><code>$ git init --bare </cod... | 119 | git | <h1>How to create a local push destination on a hard disk using Git</h1>
<p>I want to make a local push destination on my hard disk on <em>Git</em>, and use that destination(folder) for <em>push</em> and <em>pull</em> instead of adding an remote repository.
How do I do that in <em>Git</em>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,007 | git | # How to create a local push destination on a hard disk using Git
I want to make a local push destination on my hard disk on *Git*, and use that destination(folder) for *push* and *pull* instead of adding an remote repository.
How do I do that in *Git*? | Follow these steps:
1. Go to the folder you want to have your **remote** in
```
$ cd /path/to/my-remote
```
2. Create a bare repository there via [git init](https://git-scm.com/docs/git-init)
```
$ git init --bare
```
3. Go to the repository you want to work in and add a new remote pointing to the ... |
9368394 | Untrack tracked file in Git -- but only in specific branch? | 15 | 2012-02-20 21:05:42 | <p>Originally, I had everything contained in my master branch.</p>
<p>Then, I decided to split into Mac and Windows branches, and have the master branch only track the source code files. So I began to only stage changes to source code files when in the master branch, and merge those source code changes with the Mac an... | 10,745 | 257,583 | 2016-02-18 14:17:55 | 9,368,435 | 30 | 2012-02-20 21:09:10 | 216,074 | 2012-02-20 21:09:10 | https://stackoverflow.com/q/9368394 | https://stackoverflow.com/a/9368435 | <pre><code>git rm --cached projectFile
</code></pre>
<p>Will delete the file in the index, so it will no longer be tracked, but won’t physically delete it.</p>
| <pre><code>git rm --cached projectFile </code></pre> <p>Will delete the file in the index, so it will no longer be tracked, but won’t physically delete it.</p> | 119, 456 | git, version-control | <h1>Untrack tracked file in Git -- but only in specific branch?</h1>
<p>Originally, I had everything contained in my master branch.</p>
<p>Then, I decided to split into Mac and Windows branches, and have the master branch only track the source code files. So I began to only stage changes to source code files when in t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,009 | git | # Untrack tracked file in Git -- but only in specific branch?
Originally, I had everything contained in my master branch.
Then, I decided to split into Mac and Windows branches, and have the master branch only track the source code files. So I began to only stage changes to source code files when in the master branch... | ```
git rm --cached projectFile
```
Will delete the file in the index, so it will no longer be tracked, but won’t physically delete it. |
52718582 | Xcode's "rebase local changes onto upstream changes"? | 14 | 2018-10-09 10:15:42 | <p>What "rebase local changes onto upstream changes" in Pull menu option mean?
Can it possibly anyhow change remote branches?</p>
| 11,470 | 8,738,724 | 2018-12-19 09:38:21 | 53,848,339 | 30 | 2018-12-19 09:38:21 | 9,215,033 | 2018-12-19 09:38:21 | https://stackoverflow.com/q/52718582 | https://stackoverflow.com/a/53848339 | <p>Looks like it is doing <code>git pull --rebase</code> (vs just <code>git pull</code>).</p>
<p>Consider this:<br>
remote origin/master has commits: c1 -> c2 -> <strong>c3</strong><br>
and your local master looks like: c1 -> c2 -> <strong>c4</strong></p>
<p>If you don't use "Rebase" option, Pull will <strong>merge</... | <p>Looks like it is doing <code>git pull --rebase</code> (vs just <code>git pull</code>).</p> <p>Consider this:<br> remote origin/master has commits: c1 -> c2 -> <strong>c3</strong><br> and your local master looks like: c1 -> c2 -> <strong>c4</strong></p> <p>If you don't use "Rebase" option, Pull will <strong>merge</... | 119, 908 | git, xcode | <h1>Xcode's "rebase local changes onto upstream changes"?</h1>
<p>What "rebase local changes onto upstream changes" in Pull menu option mean?
Can it possibly anyhow change remote branches?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,011 | git | # Xcode's "rebase local changes onto upstream changes"?
What "rebase local changes onto upstream changes" in Pull menu option mean?
Can it possibly anyhow change remote branches? | Looks like it is doing `git pull --rebase` (vs just `git pull`).
Consider this:
remote origin/master has commits: c1 -> c2 -> **c3**
and your local master looks like: c1 -> c2 -> **c4**
If you don't use "Rebase" option, Pull will **merge** `c3` into your `c4` commit.
With "Rebase" - Pull will first copy `c3` to... |
28284890 | In Git, how can I list all files that exist in branch A that do not exist in branch B | 14 | 2015-02-02 19:06:05 | <p>Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch?</p>
<p>Background: Someone deleted some history and then pushed origin/master. Some team members have been saying they are missing some files. I think I have recovered the missing fil... | 4,419 | 821,880 | 2015-02-02 21:29:29 | 28,286,409 | 30 | 2015-02-02 20:45:24 | 4,021,077 | 2015-02-02 20:45:24 | https://stackoverflow.com/q/28284890 | https://stackoverflow.com/a/28286409 | <p>You can use <a href="http://git-scm.com/docs/git-diff-tree">git diff-tree</a> to achieve what you want</p>
<p>use <code>-r</code> to recursively descend through subtree and<code>--diff-filter</code> to restrict output to only certain types of diffs (for instance, deletions=D)</p>
<p><code>git diff-tree -r --diff-f... | <p>You can use <a href="http://git-scm.com/docs/git-diff-tree">git diff-tree</a> to achieve what you want</p> <p>use <code>-r</code> to recursively descend through subtree and<code>--diff-filter</code> to restrict output to only certain types of diffs (for instance, deletions=D)</p> <p><code>git diff-tree -r --diff-f... | 119, 9033, 76220, 105913 | git, git-branch, git-diff, git-diff-tree | <h1>In Git, how can I list all files that exist in branch A that do not exist in branch B</h1>
<p>Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch?</p>
<p>Background: Someone deleted some history and then pushed origin/master. Some team... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,013 | git | # In Git, how can I list all files that exist in branch A that do not exist in branch B
Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch?
Background: Someone deleted some history and then pushed origin/master. Some team members have be... | You can use [git diff-tree](http://git-scm.com/docs/git-diff-tree) to achieve what you want
use `-r` to recursively descend through subtree and`--diff-filter` to restrict output to only certain types of diffs (for instance, deletions=D)
`git diff-tree -r --diff-filter=D branchA branchB` |
13318715 | How do programs like gitolite work? | 14 | 2012-11-10 02:39:57 | <p>I am curious as to how programs such as gitolite work -- specifically how do they interact with the SSH protocol to provide a tailored experience. Can somebody provide an example of how I might accomplish something like the following and where I might learn more about this topic?</p>
<pre><code>→ ssh git@github.com... | 9,481 | 1,813,844 | 2024-01-09 19:58:02 | 13,320,256 | 30 | 2012-11-10 07:41:51 | 6,309 | 2024-01-09 19:58:02 | https://stackoverflow.com/q/13318715 | https://stackoverflow.com/a/13320256 | <p>gitolite in itself is an <a href="http://gitolite.com/gitolite/concepts/#authentication-and-authorisation" rel="nofollow noreferrer">authorization</a> layer which doesn't need ssh.<br />
It only needs to know <em>who</em> is calling it, in order to authorize or not that person to do git commands.</p>
<p>SSH is used ... | <p>gitolite in itself is an <a href="http://gitolite.com/gitolite/concepts/#authentication-and-authorisation" rel="nofollow noreferrer">authorization</a> layer which doesn't need ssh.<br /> It only needs to know <em>who</em> is calling it, in order to authorize or not that person to do git commands.</p> <p>SSH is used ... | 386, 39151 | gitolite, ssh | <h1>How do programs like gitolite work?</h1>
<p>I am curious as to how programs such as gitolite work -- specifically how do they interact with the SSH protocol to provide a tailored experience. Can somebody provide an example of how I might accomplish something like the following and where I might learn more about thi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,014 | git | # How do programs like gitolite work?
I am curious as to how programs such as gitolite work -- specifically how do they interact with the SSH protocol to provide a tailored experience. Can somebody provide an example of how I might accomplish something like the following and where I might learn more about this topic?
... | gitolite in itself is an [authorization](http://gitolite.com/gitolite/concepts/#authentication-and-authorisation) layer which doesn't need ssh.
It only needs to know *who* is calling it, in order to authorize or not that person to do git commands.
SSH is used for authentication (but you can use an Http Apache for au... |
47024826 | Spring Cloud Config Server using SSH key for Git and running in Docker | 13 | 2017-10-30 21:57:07 | <p>I found many questions and tutorials before finally putting this all together. Wanted to document it so somebody else can save many hours of frustration.</p>
<p>I am trying to get a private git repository on BitBucket to work with Spring Boot Config Server using deploy keys and have it run in Docker. I am runnin... | 33,018 | 794,274 | 2019-01-08 19:46:25 | 47,024,827 | 30 | 2017-10-30 21:57:07 | 794,274 | 2017-10-30 21:57:07 | https://stackoverflow.com/q/47024826 | https://stackoverflow.com/a/47024827 | <p>First piece is the configuration. You want to ignore the standard private key and use one provided as an environment variable. (SSH_KEY). Also, the git repo is an EV (GIT_URL) but you can hardcode if you want.</p>
<pre><code>spring:
cloud:
config:
server:
git:
uri: ${GIT_URL}
... | <p>First piece is the configuration. You want to ignore the standard private key and use one provided as an environment variable. (SSH_KEY). Also, the git repo is an EV (GIT_URL) but you can hardcode if you want.</p> <pre><code>spring: cloud: config: server: git: uri: ${GIT_URL} ... | 119, 25308, 90304, 119002, 125853 | docker, git, spring-boot-configuration, spring-cloud-config, ssh-keys | <h1>Spring Cloud Config Server using SSH key for Git and running in Docker</h1>
<p>I found many questions and tutorials before finally putting this all together. Wanted to document it so somebody else can save many hours of frustration.</p>
<p>I am trying to get a private git repository on BitBucket to work with Spr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,015 | git | # Spring Cloud Config Server using SSH key for Git and running in Docker
I found many questions and tutorials before finally putting this all together. Wanted to document it so somebody else can save many hours of frustration.
I am trying to get a private git repository on BitBucket to work with Spring Boot Config Se... | First piece is the configuration. You want to ignore the standard private key and use one provided as an environment variable. (SSH_KEY). Also, the git repo is an EV (GIT_URL) but you can hardcode if you want.
```
spring:
cloud:
config:
server:
git:
uri: ${GIT_URL}
ignore-local... |
39468125 | Restore git files deleted after git merge --abort | 13 | 2016-09-13 10:44:56 | <p>I've lost files added to git during "merge conflict" phase.</p>
<p>Step by step:</p>
<pre><code>git pull
git status
</code></pre>
<p>Git informs me about "merge conflict", that's okay. Then I create a new file and add it to git.</p>
<pre><code>vi test.txt
git add test.txt
</code></pre>
<p>After that, abort merg... | 8,479 | 5,028,874 | 2024-02-06 07:36:53 | 39,469,723 | 30 | 2016-09-13 12:09:21 | 86,072 | 2016-09-13 12:42:45 | https://stackoverflow.com/q/39468125 | https://stackoverflow.com/a/39469723 | <p>What have you tried with <code>git fsck</code> ?</p>
<p>see this SO question : <a href="https://stackoverflow.com/questions/10782978">Recover files that were added to the index but then removed by a git reset</a></p>
<hr>
<p>The general answer is : the sequence of instructions you typed has removed the file from ... | <p>What have you tried with <code>git fsck</code> ?</p> <p>see this SO question : <a href="https://stackoverflow.com/questions/10782978">Recover files that were added to the index but then removed by a git reset</a></p> <hr> <p>The general answer is : the sequence of instructions you typed has removed the file from ... | 119, 28896, 28897 | git, git-merge, git-pull | <h1>Restore git files deleted after git merge --abort</h1>
<p>I've lost files added to git during "merge conflict" phase.</p>
<p>Step by step:</p>
<pre><code>git pull
git status
</code></pre>
<p>Git informs me about "merge conflict", that's okay. Then I create a new file and add it to git.</p>
<pre><code>vi test.tx... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,016 | git | # Restore git files deleted after git merge --abort
I've lost files added to git during "merge conflict" phase.
Step by step:
```
git pull
git status
```
Git informs me about "merge conflict", that's okay. Then I create a new file and add it to git.
```
vi test.txt
git add test.txt
```
After that, abort merge:
`... | What have you tried with `git fsck` ?
see this SO question : [Recover files that were added to the index but then removed by a git reset](https://stackoverflow.com/questions/10782978)
---
The general answer is : the sequence of instructions you typed has removed the file from tracking (and from the disk), there is n... |
19936187 | git diff :: overriding .gitconfig external tool | 13 | 2013-11-12 17:41:35 | <p>I've configured <code>git</code> to use <code>meld</code> as an external diff tool:</p>
<pre><code>$ cat ~/.gitconfig | grep -A2 "\[diff\]"
[diff]
tool = vimdiff
external = git-meld
</code></pre>
<p>... where <code>git-meld</code> is:</p>
<pre><code>$ cat $(which git-meld)
#!/bin/bash
meld $2 $5
<... | 5,694 | 274,677 | 2014-07-07 14:05:48 | 19,936,510 | 30 | 2013-11-12 17:58:23 | null | 2013-11-12 17:58:23 | https://stackoverflow.com/q/19936187 | https://stackoverflow.com/a/19936510 | <p>For your general question: pretty much all options can be overridden on the command line using <code>-c</code>:</p>
<blockquote>
<p>-c <name>=<value></p>
<p>Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected i... | <p>For your general question: pretty much all options can be overridden on the command line using <code>-c</code>:</p> <blockquote> <p>-c <name>=<value></p> <p>Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected i... | 119, 9033, 13630 | git, git-diff, meld | <h1>git diff :: overriding .gitconfig external tool</h1>
<p>I've configured <code>git</code> to use <code>meld</code> as an external diff tool:</p>
<pre><code>$ cat ~/.gitconfig | grep -A2 "\[diff\]"
[diff]
tool = vimdiff
external = git-meld
</code></pre>
<p>... where <code>git-meld</code> is:</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,017 | git | # git diff :: overriding .gitconfig external tool
I've configured `git` to use `meld` as an external diff tool:
```
$ cat ~/.gitconfig | grep -A2 "\[diff\]"
[diff]
tool = vimdiff
external = git-meld
```
... where `git-meld` is:
```
$ cat $(which git-meld)
#!/bin/bash
meld $2 $5
```
However sometime... | For your general question: pretty much all options can be overridden on the command line using `-c`:
> -c <name>=<value>
>
> Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated... |
18907689 | Issue with git pull master is out of sync with origin master | 13 | 2013-09-20 01:48:43 | <p>These are the sequence of steps I have performed:</p>
<ol>
<li>committed my changes in branch to local master (commit id <code>dc9afg2k</code>)</li>
<li><code>git fetch origin master && git merge origin master</code></li>
<li><code>git checkout master</code> </li>
<li><code>git pull</code> (this pulled all ... | 22,114 | 1,769,790 | 2013-09-20 05:24:20 | 18,909,381 | 30 | 2013-09-20 05:24:20 | 6,309 | 2013-09-20 05:24:20 | https://stackoverflow.com/q/18907689 | https://stackoverflow.com/a/18909381 | <p>An out of sync <code>master</code> can happen when the remote repo has received a <a href="https://stackoverflow.com/a/15030429/6309">forced push</a> (<code>git push --force</code>) which rewrite the history.</p>
<p>If you have done commits of your own on master:</p>
<ul>
<li><p>make a branch (to remember the curr... | <p>An out of sync <code>master</code> can happen when the remote repo has received a <a href="https://stackoverflow.com/a/15030429/6309">forced push</a> (<code>git push --force</code>) which rewrite the history.</p> <p>If you have done commits of your own on master:</p> <ul> <li><p>make a branch (to remember the curr... | 119, 28896, 33720, 76220 | git, git-branch, git-fetch, git-pull | <h1>Issue with git pull master is out of sync with origin master</h1>
<p>These are the sequence of steps I have performed:</p>
<ol>
<li>committed my changes in branch to local master (commit id <code>dc9afg2k</code>)</li>
<li><code>git fetch origin master && git merge origin master</code></li>
<li><code>git ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,018 | git | # Issue with git pull master is out of sync with origin master
These are the sequence of steps I have performed:
1. committed my changes in branch to local master (commit id `dc9afg2k`)
2. `git fetch origin master && git merge origin master`
3. `git checkout master`
4. `git pull` (this pulled all recent changes)
5. `... | An out of sync `master` can happen when the remote repo has received a [forced push](https://stackoverflow.com/a/15030429/6309) (`git push --force`) which rewrite the history.
If you have done commits of your own on master:
- make a branch (to remember the current master state)
git branch old_master
- make sure y... |
3140356 | Working in sync with SVN upstream | 13 | 2010-06-29 11:54:31 | <p>I'm working on a project that is using code from an OpenSource project. One of the requirements is to push as much code back to upstream as possible.</p>
<p>The remote project is using Subversion (not very well).</p>
<p>My current setup looks like this:</p>
<pre><code>[Remote SVN] (git svn fetch)-> [My public ... | 7,451 | 211,659 | 2010-12-11 21:39:00 | 3,220,481 | 30 | 2010-07-10 19:08:07 | 123,109 | 2010-07-10 19:08:07 | https://stackoverflow.com/q/3140356 | https://stackoverflow.com/a/3220481 | <p>The <a href="http://git-scm.com/docs/git-svn" rel="noreferrer"><code>git svn</code> documentation</a> recommends the following workflow when dealing with Subversion branches:</p>
<pre># Clone a repo (like git clone):
git svn clone http://svn.example.com/project -T trunk -b branches -t tags
# Append svn:ignore sett... | <p>The <a href="http://git-scm.com/docs/git-svn" rel="noreferrer"><code>git svn</code> documentation</a> recommends the following workflow when dealing with Subversion branches:</p> <pre># Clone a repo (like git clone): git svn clone http://svn.example.com/project -T trunk -b branches -t tags # Append svn:ignore sett... | 63, 119, 1835, 6452 | git, git-svn, open-source, svn | <h1>Working in sync with SVN upstream</h1>
<p>I'm working on a project that is using code from an OpenSource project. One of the requirements is to push as much code back to upstream as possible.</p>
<p>The remote project is using Subversion (not very well).</p>
<p>My current setup looks like this:</p>
<pre><code>[R... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,019 | git | # Working in sync with SVN upstream
I'm working on a project that is using code from an OpenSource project. One of the requirements is to push as much code back to upstream as possible.
The remote project is using Subversion (not very well).
My current setup looks like this:
```
[Remote SVN] (git svn fetch)-> [My p... | The [`git svn` documentation](http://git-scm.com/docs/git-svn) recommends the following workflow when dealing with Subversion branches:
```
# Clone a repo (like git clone):
git svn clone http://svn.example.com/project -T trunk -b branches -t tags
# Append svn:ignore settings to the default git exclude file:
git svn s... |
63810361 | How to use Meld as git mergetool & difftool on WSL2? | 12 | 2020-09-09 11:08:11 | <p>From WSL2 (Ubuntu) how could one use Meld installed natively on Windows as the git merge and diff tool?
So that commands like <code>git mergetool</code> & <code>git difftool</code> from WSL open Meld on Windows.</p>
| 6,574 | 107,152 | 2020-09-09 12:33:47 | 63,810,362 | 30 | 2020-09-09 11:08:11 | 107,152 | 2020-09-09 12:33:47 | https://stackoverflow.com/q/63810361 | https://stackoverflow.com/a/63810362 | <p>Make <code>meld</code> easily accessible in WSL by linking it:</p>
<pre><code>sudo ln -s /mnt/c/Program\ Files\ \(x86\)/Meld/Meld.exe /usr/local/bin/meld
</code></pre>
<p>In WSL edit <code>~/.gitconfig</code> and add:</p>
<pre><code>[diff]
tool = meld
[difftool "meld"]
cmd = meld \"$(w... | <p>Make <code>meld</code> easily accessible in WSL by linking it:</p> <pre><code>sudo ln -s /mnt/c/Program\ Files\ \(x86\)/Meld/Meld.exe /usr/local/bin/meld </code></pre> <p>In WSL edit <code>~/.gitconfig</code> and add:</p> <pre><code>[diff] tool = meld [difftool "meld"] cmd = meld \"$(w... | 119, 13630, 119526 | git, meld, windows-subsystem-for-linux | <h1>How to use Meld as git mergetool & difftool on WSL2?</h1>
<p>From WSL2 (Ubuntu) how could one use Meld installed natively on Windows as the git merge and diff tool?
So that commands like <code>git mergetool</code> & <code>git difftool</code> from WSL open Meld on Windows.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,020 | git | # How to use Meld as git mergetool & difftool on WSL2?
From WSL2 (Ubuntu) how could one use Meld installed natively on Windows as the git merge and diff tool?
So that commands like `git mergetool` & `git difftool` from WSL open Meld on Windows. | Make `meld` easily accessible in WSL by linking it:
```
sudo ln -s /mnt/c/Program\ Files\ \(x86\)/Meld/Meld.exe /usr/local/bin/meld
```
In WSL edit `~/.gitconfig` and add:
```
[diff]
tool = meld
[difftool "meld"]
cmd = meld \"$(wslpath -aw $LOCAL)\" \"$(wslpath -aw $REMOTE)\"
[merge]
tool = m... |
18885644 | Pre Commit hook git error | 12 | 2013-09-19 03:15:51 | <p>I am trying to execute a pre commit git hook in python to check if files have line lengths less than 80 chars. However i get a no such file/directory error. i am on fedora and have set the #!usr/bin/python.help would be appreciated</p>
<pre><code>#!/usr/bin/env python
#-*- mode: python -*-
from subprocess import P... | 18,114 | 2,793,781 | 2014-09-18 07:59:38 | 18,886,088 | 30 | 2013-09-19 04:15:13 | 8,747 | 2013-09-19 04:15:13 | https://stackoverflow.com/q/18885644 | https://stackoverflow.com/a/18886088 | <p>Your pre-commit file has extraneous carriage returns in it. This can happen if you edit the file in Windows and copy the file to a Linux computer.</p>
<p>Try these commands:</p>
<pre><code>cp .git/hooks/pre-commit /tmp/pre-commit
tr -d '\r' < /tmp/pre-commit > .git/hooks/pre-commit
</code></pre>
<p>And then... | <p>Your pre-commit file has extraneous carriage returns in it. This can happen if you edit the file in Windows and copy the file to a Linux computer.</p> <p>Try these commands:</p> <pre><code>cp .git/hooks/pre-commit /tmp/pre-commit tr -d '\r' < /tmp/pre-commit > .git/hooks/pre-commit </code></pre> <p>And then... | 16, 119 | git, python | <h1>Pre Commit hook git error</h1>
<p>I am trying to execute a pre commit git hook in python to check if files have line lengths less than 80 chars. However i get a no such file/directory error. i am on fedora and have set the #!usr/bin/python.help would be appreciated</p>
<pre><code>#!/usr/bin/env python
#-*- mode: p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,021 | git | # Pre Commit hook git error
I am trying to execute a pre commit git hook in python to check if files have line lengths less than 80 chars. However i get a no such file/directory error. i am on fedora and have set the #!usr/bin/python.help would be appreciated
```
#!/usr/bin/env python
#-*- mode: python -*-
from subp... | Your pre-commit file has extraneous carriage returns in it. This can happen if you edit the file in Windows and copy the file to a Linux computer.
Try these commands:
```
cp .git/hooks/pre-commit /tmp/pre-commit
tr -d '\r' < /tmp/pre-commit > .git/hooks/pre-commit
```
And then rerun your `git` command. |
4841078 | Why `(map digitToInt) . show` is so fast? | 12 | 2011-01-30 04:03:49 | <p>Converting non-negative <code>Integer</code> to its list of digits is commonly done like this:</p>
<pre><code>import Data.Char
digits :: Integer -> [Int]
digits = (map digitToInt) . show
</code></pre>
<p>I was trying to find a more direct way to perform the task, without involving a string conversion, but I'm ... | 1,289 | 138,830 | 2011-01-31 02:12:11 | 4,842,308 | 30 | 2011-01-30 10:11:21 | 493,746 | 2011-01-30 10:11:21 | https://stackoverflow.com/q/4841078 | https://stackoverflow.com/a/4842308 | <p>Seeing as I can't add comments yet, I'll do a little bit more work and just analyze all of them. I'm putting the analysis at the top; however, the relevant data is below. (Note: all of this is done in 6.12.3 as well - no GHC 7 magic yet.)</p>
<hr>
<p><strong>Analysis:</strong></p>
<p><strong>Version 1:</strong>... | <p>Seeing as I can't add comments yet, I'll do a little bit more work and just analyze all of them. I'm putting the analysis at the top; however, the relevant data is below. (Note: all of this is done in 6.12.3 as well - no GHC 7 magic yet.)</p> <hr> <p><strong>Analysis:</strong></p> <p><strong>Version 1:</strong>... | 598, 1925, 9914, 19287 | digits, ghc, haskell, performance | <h1>Why `(map digitToInt) . show` is so fast?</h1>
<p>Converting non-negative <code>Integer</code> to its list of digits is commonly done like this:</p>
<pre><code>import Data.Char
digits :: Integer -> [Int]
digits = (map digitToInt) . show
</code></pre>
<p>I was trying to find a more direct way to perform the ta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,022 | git | # Why `(map digitToInt) . show` is so fast?
Converting non-negative `Integer` to its list of digits is commonly done like this:
```
import Data.Char
digits :: Integer -> [Int]
digits = (map digitToInt) . show
```
I was trying to find a more direct way to perform the task, without involving a string conversion, but ... | Seeing as I can't add comments yet, I'll do a little bit more work and just analyze all of them. I'm putting the analysis at the top; however, the relevant data is below. (Note: all of this is done in 6.12.3 as well - no GHC 7 magic yet.)
---
**Analysis:**
**Version 1:** show is pretty good for ints, especially thos... |
62593521 | How to authenticate when I try to git clone from azure git? | 10 | 2020-06-26 11:11:30 | <p>I try to clone my app service from git local rep from azure platform to local env (on PC).
But when I do</p>
<pre><code>git clone < https://adminusername@my.azure.url.torepo/appser.git>
</code></pre>
<p>console asks me about authentication with adminusername login. But what the password? It is not MicrosoftA... | 47,282 | 10,379,066 | 2023-11-14 13:55:16 | 62,630,309 | 30 | 2020-06-29 02:22:37 | 7,460,777 | 2020-06-29 02:22:37 | https://stackoverflow.com/q/62593521 | https://stackoverflow.com/a/62630309 | <blockquote>
<p>How to authenticate when I try to git clone from azure git?</p>
</blockquote>
<p>You could use your personal access token (PAT) or SSH to authenticate when you try to git clone from azure git.</p>
<p><a href="https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-token... | <blockquote> <p>How to authenticate when I try to git clone from azure git?</p> </blockquote> <p>You could use your personal access token (PAT) or SSH to authenticate when you try to git clone from azure git.</p> <p><a href="https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-token... | 119, 14158, 84219, 116537 | azure, azure-devops, azure-git-deployment, git | <h1>How to authenticate when I try to git clone from azure git?</h1>
<p>I try to clone my app service from git local rep from azure platform to local env (on PC).
But when I do</p>
<pre><code>git clone < https://adminusername@my.azure.url.torepo/appser.git>
</code></pre>
<p>console asks me about authentication ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,023 | git | # How to authenticate when I try to git clone from azure git?
I try to clone my app service from git local rep from azure platform to local env (on PC).
But when I do
```
git clone < https://adminusername@my.azure.url.torepo/appser.git>
```
console asks me about authentication with adminusername login. But what the ... | > How to authenticate when I try to git clone from azure git?
You could use your personal access token (PAT) or SSH to authenticate when you try to git clone from azure git.
[Authenticate with personal access tokens](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-a... |
15193565 | How to undo git init on a home directory? | 10 | 2013-03-04 02:17:40 | <p>I did <code>git init</code> and <code>git add .</code> on my home directory, which slowed every operation down, I think, because the directory is so large. How can I undo <code>git init</code> of the home directory? </p>
| 11,171 | 1,781,548 | 2025-02-13 17:40:55 | 15,193,576 | 30 | 2013-03-04 02:19:43 | 380,757 | 2013-03-04 02:19:43 | https://stackoverflow.com/q/15193565 | https://stackoverflow.com/a/15193576 | <p>You can just do <code>rm -rf $HOME/.git</code> to remove all the version control information stored by git, which undoes whatever <code>git init</code> did.</p>
<p>But I highly doubt that running <code>git init</code> could slow anything down.</p>
| <p>You can just do <code>rm -rf $HOME/.git</code> to remove all the version control information stored by git, which undoes whatever <code>git init</code> did.</p> <p>But I highly doubt that running <code>git init</code> could slow anything down.</p> | 119 | git | <h1>How to undo git init on a home directory?</h1>
<p>I did <code>git init</code> and <code>git add .</code> on my home directory, which slowed every operation down, I think, because the directory is so large. How can I undo <code>git init</code> of the home directory? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,024 | git | # How to undo git init on a home directory?
I did `git init` and `git add .` on my home directory, which slowed every operation down, I think, because the directory is so large. How can I undo `git init` of the home directory? | You can just do `rm -rf $HOME/.git` to remove all the version control information stored by git, which undoes whatever `git init` did.
But I highly doubt that running `git init` could slow anything down. |
53325544 | Jenkins Pipeline Git Push | 9 | 2018-11-15 18:11:29 | <p>Is there as way to have a stage like so in a Jenkinsfile:</p>
<pre><code>stage('Create Branch & Push Branch') {
steps {
script {
sh "git checkout -b release/${NEW_TAG}"
sh "git push --set-upstream
}
}
}
</code></... | 41,339 | 4,127,155 | 2021-08-29 09:48:05 | 53,326,235 | 30 | 2018-11-15 18:59:37 | 4,127,155 | 2018-11-15 18:59:37 | https://stackoverflow.com/q/53325544 | https://stackoverflow.com/a/53326235 | <p>I've made this work using:</p>
<pre><code>withCredentials([usernamePassword(credentialsId: 'ci-github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/my-org/my-repo.git')
}
</code></... | <p>I've made this work using:</p> <pre><code>withCredentials([usernamePassword(credentialsId: 'ci-github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/my-org/my-repo.git') } </code></... | 119, 64999, 118285 | git, jenkins, jenkins-pipeline | <h1>Jenkins Pipeline Git Push</h1>
<p>Is there as way to have a stage like so in a Jenkinsfile:</p>
<pre><code>stage('Create Branch & Push Branch') {
steps {
script {
sh "git checkout -b release/${NEW_TAG}"
sh "git push --set-upstream
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,025 | git | # Jenkins Pipeline Git Push
Is there as way to have a stage like so in a Jenkinsfile:
```
stage('Create Branch & Push Branch') {
steps {
script {
sh "git checkout -b release/${NEW_TAG}"
sh "git push --set-upstream
}
}
... | I've made this work using:
```
withCredentials([usernamePassword(credentialsId: 'ci-github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/my-org/my-repo.git')
}
```
After reading <htt... |
4249696 | Unstage all deleted files in Git | 9 | 2010-11-22 20:04:28 | <p>I want to unstage all file deletes. Is there an easy way?</p>
<p>I want to apply this to the file pattern of all deletes.</p>
| 6,420 | 244,005 | 2016-10-30 16:23:16 | 4,249,799 | 30 | 2010-11-22 20:15:00 | 119,963 | 2010-11-22 20:15:00 | https://stackoverflow.com/q/4249696 | https://stackoverflow.com/a/4249799 | <p>The output of <code>git status --porcelain</code> is a great way to build one-liners and scripts for tasks like this:</p>
<pre><code>git status --porcelain | awk '$1 == "D" {print $2}' | xargs git reset HEAD
</code></pre>
| <p>The output of <code>git status --porcelain</code> is a great way to build one-liners and scripts for tasks like this:</p> <pre><code>git status --porcelain | awk '$1 == "D" {print $2}' | xargs git reset HEAD </code></pre> | 119, 34792, 37510, 74978 | delete-file, git, git-add, git-stage | <h1>Unstage all deleted files in Git</h1>
<p>I want to unstage all file deletes. Is there an easy way?</p>
<p>I want to apply this to the file pattern of all deletes.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,026 | git | # Unstage all deleted files in Git
I want to unstage all file deletes. Is there an easy way?
I want to apply this to the file pattern of all deletes. | The output of `git status --porcelain` is a great way to build one-liners and scripts for tasks like this:
```
git status --porcelain | awk '$1 == "D" {print $2}' | xargs git reset HEAD
``` |
2916845 | Different default remote (tracking branch) for git pull and git push | 88 | 2010-05-26 21:12:01 | <p>Is there a way to set up a git repository, so that <code>git pull</code> defaults to one remote and <code>git push</code> defaults to another? I know I can set <em>both</em> by changing the value of the <code>remote</code> variable in branch section of <code>.git/config</code>, but how to do it for each direction se... | 22,195 | 41,071 | 2021-10-01 14:29:49 | 2,917,001 | 29 | 2010-05-26 21:37:47 | 193,688 | 2016-04-30 22:01:29 | https://stackoverflow.com/q/2916845 | https://stackoverflow.com/a/2917001 | <p>For Git 1.6.4 and later, set <code>remote.<name>.pushurl</code> with <em>git config</em>.</p>
<p>One might use this to pull using the read-only <code>https:</code> protocol and push using an ssh-based protocol.</p>
<hr>
<p>Say <code>origin</code>'s url (<code>remote.origin.url</code>) is <code>https://git.e... | <p>For Git 1.6.4 and later, set <code>remote.<name>.pushurl</code> with <em>git config</em>.</p> <p>One might use this to pull using the read-only <code>https:</code> protocol and push using an ssh-based protocol.</p> <hr> <p>Say <code>origin</code>'s url (<code>remote.origin.url</code>) is <code>https://git.e... | 119, 1879 | branch, git | <h1>Different default remote (tracking branch) for git pull and git push</h1>
<p>Is there a way to set up a git repository, so that <code>git pull</code> defaults to one remote and <code>git push</code> defaults to another? I know I can set <em>both</em> by changing the value of the <code>remote</code> variable in bran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,029 | git | # Different default remote (tracking branch) for git pull and git push
Is there a way to set up a git repository, so that `git pull` defaults to one remote and `git push` defaults to another? I know I can set *both* by changing the value of the `remote` variable in branch section of `.git/config`, but how to do it for... | For Git 1.6.4 and later, set `remote.<name>.pushurl` with *git config*.
One might use this to pull using the read-only `https:` protocol and push using an ssh-based protocol.
---
Say `origin`'s url (`remote.origin.url`) is `https://git.example.com/some/repo.git`. It is read-only, but you have write access through th... |
9542665 | remote rejected master -> master (pre-receive hook declined) | 86 | 2012-03-03 01:48:31 | <p>I'm working in rails 3.2 and I receive an error when I try to push to heroku:</p>
<pre><code> git push heroku master
Counting objects: 496, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (435/435), done.
Writing objects: 100% (496/496), 5.17 MiB | 249 KiB/s, done.
Total 496 (delta 125), re... | 262,473 | 1,241,571 | 2022-07-16 06:55:58 | 9,543,539 | 29 | 2012-03-03 04:46:06 | 526,535 | 2017-03-29 21:58:40 | https://stackoverflow.com/q/9542665 | https://stackoverflow.com/a/9543539 | <p>Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed ... | <p>Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed ... | 119 | git | <h1>remote rejected master -> master (pre-receive hook declined)</h1>
<p>I'm working in rails 3.2 and I receive an error when I try to push to heroku:</p>
<pre><code> git push heroku master
Counting objects: 496, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (435/435), done.
Writing objects:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,030 | git | # remote rejected master -> master (pre-receive hook declined)
I'm working in rails 3.2 and I receive an error when I try to push to heroku:
```
git push heroku master
Counting objects: 496, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (435/435), done.
Writing objects: 100% (496/496), 5.1... | Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed it ... |
58126421 | cannot lock ref 'refs/remotes/origin/master' | 77 | 2019-09-27 00:50:52 | <p>I always got <code>cannot lock ref 'refs/remotes/origin/master'</code> when I execute <code>git pull</code> first time if there are some updates.</p>
<p>The full console log is belows.</p>
<pre><code>D:\code\react-native\expo-multi-screen-starter>git pull
error: cannot lock ref 'refs/remotes/origin/master': is ... | 133,473 | 2,109,620 | 2024-12-20 17:26:33 | 73,487,864 | 29 | 2022-08-25 12:52:31 | 4,454,665 | 2022-08-25 12:52:31 | https://stackoverflow.com/q/58126421 | https://stackoverflow.com/a/73487864 | <p>I was able to fix it by just deleting <code>.git/refs/remotes/</code> and it was restored automatically.</p>
| <p>I was able to fix it by just deleting <code>.git/refs/remotes/</code> and it was restored automatically.</p> | 119 | git | <h1>cannot lock ref 'refs/remotes/origin/master'</h1>
<p>I always got <code>cannot lock ref 'refs/remotes/origin/master'</code> when I execute <code>git pull</code> first time if there are some updates.</p>
<p>The full console log is belows.</p>
<pre><code>D:\code\react-native\expo-multi-screen-starter>git pull
er... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,031 | git | # cannot lock ref 'refs/remotes/origin/master'
I always got `cannot lock ref 'refs/remotes/origin/master'` when I execute `git pull` first time if there are some updates.
The full console log is belows.
```
D:\code\react-native\expo-multi-screen-starter>git pull
error: cannot lock ref 'refs/remotes/origin/master': i... | I was able to fix it by just deleting `.git/refs/remotes/` and it was restored automatically. |
620253 | git push rejected | 69 | 2009-03-06 20:16:16 | <p>I give up!
Whenever I try to push I get a stupid: </p>
<pre><code>! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:companyX/projectX.git'
</code></pre>
<p>Our team has a new git setup. Instead of making private branches I now Forked our main repository (... | 272,987 | 74,865 | 2024-09-21 09:43:11 | 620,291 | 29 | 2009-03-06 20:31:25 | 72,247 | 2009-03-06 20:31:25 | https://stackoverflow.com/q/620253 | https://stackoverflow.com/a/620291 | <p>When doing a push, try specifying the refspec for the upstream master:</p>
<pre><code>git push upstream upstreammaster:master
</code></pre>
| <p>When doing a push, try specifying the refspec for the upstream master:</p> <pre><code>git push upstream upstreammaster:master </code></pre> | 119, 4236 | git, push | <h1>git push rejected</h1>
<p>I give up!
Whenever I try to push I get a stupid: </p>
<pre><code>! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:companyX/projectX.git'
</code></pre>
<p>Our team has a new git setup. Instead of making private branches I now F... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,032 | git | # git push rejected
I give up!
Whenever I try to push I get a stupid:
```
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:companyX/projectX.git'
```
Our team has a new git setup. Instead of making private branches I now Forked our main repository (on github)... | When doing a push, try specifying the refspec for the upstream master:
```
git push upstream upstreammaster:master
``` |
7949036 | Moving a git repository | 67 | 2011-10-31 00:51:54 | <p>This question may be dumb, but I've been wondering it for a while. It's about git repositories, but I assume it's the same for local repositories for other DVCS'.</p>
<p>Lets say my project is like this when it starts:</p>
<ul>
<li>Project
<ul>
<li>.git</li>
<li>all the other folders in the project</li>
</ul></li>... | 52,640 | 468,539 | 2017-03-23 14:36:00 | 7,949,056 | 29 | 2011-10-31 00:54:58 | 56,541 | 2011-10-31 00:54:58 | https://stackoverflow.com/q/7949036 | https://stackoverflow.com/a/7949056 | <p>Yes, everything in <code>.git</code> is relative. If you have added the repository as a named remote to another repository, you would have to change the remote URL in that other repository, though.</p>
| <p>Yes, everything in <code>.git</code> is relative. If you have added the repository as a named remote to another repository, you would have to change the remote URL in that other repository, though.</p> | 119, 7330 | git, repository | <h1>Moving a git repository</h1>
<p>This question may be dumb, but I've been wondering it for a while. It's about git repositories, but I assume it's the same for local repositories for other DVCS'.</p>
<p>Lets say my project is like this when it starts:</p>
<ul>
<li>Project
<ul>
<li>.git</li>
<li>all the other folde... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,033 | git | # Moving a git repository
This question may be dumb, but I've been wondering it for a while. It's about git repositories, but I assume it's the same for local repositories for other DVCS'.
Lets say my project is like this when it starts:
- Project
- .git
- all the other folders in the project
So that's how it w... | Yes, everything in `.git` is relative. If you have added the repository as a named remote to another repository, you would have to change the remote URL in that other repository, though. |
5966290 | Rails 3 and Heroku: automatically "rake db:migrate" on push? | 65 | 2011-05-11 14:53:29 | <p>I have a slight annoyance with my heroku push/deploy process, which otherwise has been a joy to discover and use. </p>
<p>If i add a new migration to my app, the only way i can get it up onto the heroku server is to do a push to the heroku remote. This uploads it and restarts the app. But it doesn't run the migr... | 24,699 | 138,557 | 2016-08-22 10:37:02 | 6,270,001 | 29 | 2011-06-07 18:36:42 | 122,087 | 2011-06-07 18:36:42 | https://stackoverflow.com/q/5966290 | https://stackoverflow.com/a/6270001 | <p>Here is a rake task that wraps up everything into a one-liner (and also supports rollback):</p>
<p><a href="https://gist.github.com/362873" rel="noreferrer">https://gist.github.com/362873</a></p>
<p>You still might wind up deploying on top of your boss's demo, but at least you don't waste time typing between the <... | <p>Here is a rake task that wraps up everything into a one-liner (and also supports rollback):</p> <p><a href="https://gist.github.com/362873" rel="noreferrer">https://gist.github.com/362873</a></p> <p>You still might wind up deploying on top of your boss's demo, but at least you don't waste time typing between the <... | 119, 4984, 8279 | git, heroku, ruby-on-rails | <h1>Rails 3 and Heroku: automatically "rake db:migrate" on push?</h1>
<p>I have a slight annoyance with my heroku push/deploy process, which otherwise has been a joy to discover and use. </p>
<p>If i add a new migration to my app, the only way i can get it up onto the heroku server is to do a push to the heroku remot... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,034 | git | # Rails 3 and Heroku: automatically "rake db:migrate" on push?
I have a slight annoyance with my heroku push/deploy process, which otherwise has been a joy to discover and use.
If i add a new migration to my app, the only way i can get it up onto the heroku server is to do a push to the heroku remote. This uploads it... | Here is a rake task that wraps up everything into a one-liner (and also supports rollback):
<https://gist.github.com/362873>
You still might wind up deploying on top of your boss's demo, but at least you don't waste time typing between the `git push` and the `rake db:migrate`. |
2212857 | How do you move multiple files in git? | 62 | 2010-02-06 10:56:51 | <p>I try:</p>
<p><code>git mv a.py b.py src/</code></p>
<p>and get</p>
<p><code>fatal: multiple sources for the same target, source=b.py, destination=src/b.py</code></p>
<p>Using the -n flag, like so <code>git mv -n a.py b.py src/</code>
gives me:</p>
<pre><code>Checking rename of 'a.py' to 'src/b.py'
Checking ren... | 54,550 | 196,678 | 2024-04-05 16:08:39 | 2,212,888 | 29 | 2010-02-06 11:12:48 | 19,563 | 2010-02-06 11:12:48 | https://stackoverflow.com/q/2212857 | https://stackoverflow.com/a/2212888 | <p>This has been fixed in the current master branch of git, it's in v1.7.0-rc0 but not in a release build yet.</p>
<p><a href="http://git.kernel.org/?p=git/git.git;a=commit;h=af82559b435aa2a18f38a4f47a93729c8dc543d3" rel="noreferrer">http://git.kernel.org/?p=git/git.git;a=commit;h=af82559b435aa2a18f38a4f47a93729c8dc54... | <p>This has been fixed in the current master branch of git, it's in v1.7.0-rc0 but not in a release build yet.</p> <p><a href="http://git.kernel.org/?p=git/git.git;a=commit;h=af82559b435aa2a18f38a4f47a93729c8dc543d3" rel="noreferrer">http://git.kernel.org/?p=git/git.git;a=commit;h=af82559b435aa2a18f38a4f47a93729c8dc54... | 119 | git | <h1>How do you move multiple files in git?</h1>
<p>I try:</p>
<p><code>git mv a.py b.py src/</code></p>
<p>and get</p>
<p><code>fatal: multiple sources for the same target, source=b.py, destination=src/b.py</code></p>
<p>Using the -n flag, like so <code>git mv -n a.py b.py src/</code>
gives me:</p>
<pre><code>Chec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,036 | git | # How do you move multiple files in git?
I try:
`git mv a.py b.py src/`
and get
`fatal: multiple sources for the same target, source=b.py, destination=src/b.py`
Using the -n flag, like so `git mv -n a.py b.py src/`
gives me:
```
Checking rename of 'a.py' to 'src/b.py'
Checking rename of 'b.py' to 'src/b.py'
fatal... | This has been fixed in the current master branch of git, it's in v1.7.0-rc0 but not in a release build yet.
<http://git.kernel.org/?p=git/git.git;a=commit;h=af82559b435aa2a18f38a4f47a93729c8dc543d3>
In the mean time the simplest thing to do is to either `git mv` the files individually or to just use `mv` and then upd... |
27379818 | Git: Possible to use same submodule working copy by multiple projects? | 53 | 2014-12-09 13:14:35 | <p>I'm new to Git.
Lets say, I have two git repositories that have the same library added as submodule:</p>
<pre><code>/home/projects/project1/library_XYZ
/home/projects/project2/library_XYZ
</code></pre>
<p>Also lets say, I'm working on the projects <em>and</em> the library simultaneously. When I did changes to the ... | 23,845 | 1,444,073 | 2025-01-28 16:45:50 | 27,384,763 | 29 | 2014-12-09 17:11:30 | 1,290,731 | 2014-12-21 19:49:40 | https://stackoverflow.com/q/27379818 | https://stackoverflow.com/a/27384763 | <p>Setting up shared dependencies as submodules is easy. The <code>git submodule</code> command doesn't do it automatically, but a submodule is nothing more than a nested repository -- and git doesn't require any actual repository or its worktree to be in any particular place.</p>
<p>Set up a libraryXYZ repo for use ... | <p>Setting up shared dependencies as submodules is easy. The <code>git submodule</code> command doesn't do it automatically, but a submodule is nothing more than a nested repository -- and git doesn't require any actual repository or its worktree to be in any particular place.</p> <p>Set up a libraryXYZ repo for use ... | 119, 41612 | git, git-submodules | <h1>Git: Possible to use same submodule working copy by multiple projects?</h1>
<p>I'm new to Git.
Lets say, I have two git repositories that have the same library added as submodule:</p>
<pre><code>/home/projects/project1/library_XYZ
/home/projects/project2/library_XYZ
</code></pre>
<p>Also lets say, I'm working on ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,037 | git | # Git: Possible to use same submodule working copy by multiple projects?
I'm new to Git.
Lets say, I have two git repositories that have the same library added as submodule:
```
/home/projects/project1/library_XYZ
/home/projects/project2/library_XYZ
```
Also lets say, I'm working on the projects *and* the library si... | Setting up shared dependencies as submodules is easy. The `git submodule` command doesn't do it automatically, but a submodule is nothing more than a nested repository -- and git doesn't require any actual repository or its worktree to be in any particular place.
Set up a libraryXYZ repo for use as a shared submodule
... |
3817967 | Correct Git workflow for shared feature branch? | 46 | 2010-09-29 00:27:11 | <p>I am trying to figure out the right workflow for this situation:</p>
<p>On the shared repo, we have these branches:</p>
<pre><code>-master
-feature
</code></pre>
<p>The <em>feature</em> branch is a <strong>shared</strong> branch, since many developers are working on a new feature together. They are actively pushi... | 13,356 | 158,876 | 2015-04-15 13:48:06 | 3,818,645 | 29 | 2010-09-29 04:04:31 | 6,309 | 2010-09-29 04:04:31 | https://stackoverflow.com/q/3817967 | https://stackoverflow.com/a/3818645 | <p>For a shared branch, I would go with #3, and use it as an "integration" branch to consolidate their work.<br>
The developers would have to use rebase to constantly replay their <code>private</code> branch on top of <code>feature</code> before merging back their work to <code>feature</code>, that way they are:</p>
<... | <p>For a shared branch, I would go with #3, and use it as an "integration" branch to consolidate their work.<br> The developers would have to use rebase to constantly replay their <code>private</code> branch on top of <code>feature</code> before merging back their work to <code>feature</code>, that way they are:</p> <... | 119, 758, 1879 | branch, git, workflow | <h1>Correct Git workflow for shared feature branch?</h1>
<p>I am trying to figure out the right workflow for this situation:</p>
<p>On the shared repo, we have these branches:</p>
<pre><code>-master
-feature
</code></pre>
<p>The <em>feature</em> branch is a <strong>shared</strong> branch, since many developers are w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,038 | git | # Correct Git workflow for shared feature branch?
I am trying to figure out the right workflow for this situation:
On the shared repo, we have these branches:
```
-master
-feature
```
The *feature* branch is a **shared** branch, since many developers are working on a new feature together. They are actively pushing ... | For a shared branch, I would go with #3, and use it as an "integration" branch to consolidate their work.
The developers would have to use rebase to constantly replay their `private` branch on top of `feature` before merging back their work to `feature`, that way they are:
- solving any merge conflict locally (in th... |
14330050 | How to get Git 1.8 in Cygwin? | 41 | 2013-01-15 02:00:37 | <p>According to <a href="http://cygwin.com/packages/git/" rel="noreferrer">http://cygwin.com/packages/git/</a> the latest available Cygwin package is 1.7.9-1.</p>
<p>I would like to update git to at least 1.8.0.</p>
<p>Can I do this?</p>
| 16,282 | 1,074,455 | 2014-05-22 12:19:14 | 14,331,998 | 29 | 2013-01-15 06:07:41 | 1,965,396 | 2013-06-22 16:12:09 | https://stackoverflow.com/q/14330050 | https://stackoverflow.com/a/14331998 | <p>To install <code>git 1.8.0</code> you need to compile the source code. </p>
<p>You need to clone the git repository (<code>git clone https://github.com/git/git.git</code>), enter the git directory, change the current version to 1.8.0 or other version that you want (<code>git checkout v.1.8.0</code>) and type the fo... | <p>To install <code>git 1.8.0</code> you need to compile the source code. </p> <p>You need to clone the git repository (<code>git clone https://github.com/git/git.git</code>), enter the git directory, change the current version to 1.8.0 or other version that you want (<code>git checkout v.1.8.0</code>) and type the fo... | 119, 1731 | cygwin, git | <h1>How to get Git 1.8 in Cygwin?</h1>
<p>According to <a href="http://cygwin.com/packages/git/" rel="noreferrer">http://cygwin.com/packages/git/</a> the latest available Cygwin package is 1.7.9-1.</p>
<p>I would like to update git to at least 1.8.0.</p>
<p>Can I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,040 | git | # How to get Git 1.8 in Cygwin?
According to <http://cygwin.com/packages/git/> the latest available Cygwin package is 1.7.9-1.
I would like to update git to at least 1.8.0.
Can I do this? | To install `git 1.8.0` you need to compile the source code.
You need to clone the git repository (`git clone https://github.com/git/git.git`), enter the git directory, change the current version to 1.8.0 or other version that you want (`git checkout v.1.8.0`) and type the following commands:
```
make configure
./conf... |
6238590 | Set Git submodule to shallow clone & sparse checkout? | 40 | 2011-06-04 18:25:32 | <p>Many vendor Objective-C libraries (e.g., <code>facebook-ios-sdk</code>) instruct you to copy a certain subset of its repo's files/dirs into your Xcode project. One problem with this is then you do not know what revision of the vendor code you have. Another is that if you make changes to the vendor code, it's not eas... | 38,351 | 242,933 | 2022-10-04 12:25:22 | 17,693,008 | 29 | 2013-07-17 06:49:17 | 6,309 | 2016-08-11 11:43:59 | https://stackoverflow.com/q/6238590 | https://stackoverflow.com/a/17693008 | <p>With <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt" rel="noreferrer">git1.8.4 (July 2013)</a>, in <a href="https://stackoverflow.com/a/17692710/6309">addition git shallow update for submodule</a> (<code>git submodule update --depth 1</code>), you now can have a <strong>custom updat... | <p>With <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt" rel="noreferrer">git1.8.4 (July 2013)</a>, in <a href="https://stackoverflow.com/a/17692710/6309">addition git shallow update for submodule</a> (<code>git submodule update --depth 1</code>), you now can have a <strong>custom updat... | 119, 3050, 41612, 50925, 74346 | clone, git, git-submodules, shallow-clone, sparse-checkout | <h1>Set Git submodule to shallow clone & sparse checkout?</h1>
<p>Many vendor Objective-C libraries (e.g., <code>facebook-ios-sdk</code>) instruct you to copy a certain subset of its repo's files/dirs into your Xcode project. One problem with this is then you do not know what revision of the vendor code you have. Anoth... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,042 | git | # Set Git submodule to shallow clone & sparse checkout?
Many vendor Objective-C libraries (e.g., `facebook-ios-sdk`) instruct you to copy a certain subset of its repo's files/dirs into your Xcode project. One problem with this is then you do not know what revision of the vendor code you have. Another is that if you ma... | With [git1.8.4 (July 2013)](https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt), in [addition git shallow update for submodule](https://stackoverflow.com/a/17692710/6309) (`git submodule update --depth 1`), you now can have a **custom update**:
> In addition to the choice from "rebase, merge, or c... |
14307086 | Tab completion for aliased sub commands in zsh: alias gco='git checkout' | 40 | 2013-01-13 19:10:09 | <p>I have an alias: <code>alias gco='git checkout'</code></p>
<p>How can I add tab completion as if I had typed <code>git checkout</code>?</p>
<p>For my <code>alias g='git'</code> I use <code>compdef g='git'</code>.</p>
<p>I've been trying to use <code>compdef</code> but I've not had any success.</p>
| 18,493 | 958,409 | 2017-01-26 11:35:11 | 14,307,127 | 29 | 2013-01-13 19:14:29 | 273,566 | 2013-01-13 19:14:29 | https://stackoverflow.com/q/14307086 | https://stackoverflow.com/a/14307127 | <p>You don’t need to do anything, especially <code>compdef g='git'</code>, it should work without any configuration. You would need something only if you used function in place of an alias.</p>
| <p>You don’t need to do anything, especially <code>compdef g='git'</code>, it should work without any configuration. You would need something only if you used function in place of an alias.</p> | 119, 3791, 12891 | git, tab-completion, zsh | <h1>Tab completion for aliased sub commands in zsh: alias gco='git checkout'</h1>
<p>I have an alias: <code>alias gco='git checkout'</code></p>
<p>How can I add tab completion as if I had typed <code>git checkout</code>?</p>
<p>For my <code>alias g='git'</code> I use <code>compdef g='git'</code>.</p>
<p>I've been tr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,043 | git | # Tab completion for aliased sub commands in zsh: alias gco='git checkout'
I have an alias: `alias gco='git checkout'`
How can I add tab completion as if I had typed `git checkout`?
For my `alias g='git'` I use `compdef g='git'`.
I've been trying to use `compdef` but I've not had any success. | You don’t need to do anything, especially `compdef g='git'`, it should work without any configuration. You would need something only if you used function in place of an alias. |
28222703 | When and how does git use deltas for storage? | 38 | 2015-01-29 19:13:07 | <p>Reading git's documentation one of the things they stress a lot is that git stores snapshots and not deltas. Since I saw a course on Git saying that Git stores differences between versions of files I tried the following: I initialized a git repository on an empty folder, created a file <code>lorem.txt</code> contain... | 8,215 | 1,620,696 | 2019-12-17 21:24:44 | 28,226,103 | 29 | 2015-01-29 22:45:13 | 43,681 | 2015-01-29 22:45:13 | https://stackoverflow.com/q/28222703 | https://stackoverflow.com/a/28226103 | <p>Git only uses deltas in "packfiles". Initially, each git object is written as a separate file (as you found). Later, git can pack many objects into one file, called a "pack file". The pack file is then compressed, which automatically exploits any repetitions between the files in the packfile (or repetitions inside f... | <p>Git only uses deltas in "packfiles". Initially, each git object is written as a separate file (as you found). Later, git can pack many objects into one file, called a "pack file". The pack file is then compressed, which automatically exploits any repetitions between the files in the packfile (or repetitions inside f... | 119 | git | <h1>When and how does git use deltas for storage?</h1>
<p>Reading git's documentation one of the things they stress a lot is that git stores snapshots and not deltas. Since I saw a course on Git saying that Git stores differences between versions of files I tried the following: I initialized a git repository on an empt... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,045 | git | # When and how does git use deltas for storage?
Reading git's documentation one of the things they stress a lot is that git stores snapshots and not deltas. Since I saw a course on Git saying that Git stores differences between versions of files I tried the following: I initialized a git repository on an empty folder,... | Git only uses deltas in "packfiles". Initially, each git object is written as a separate file (as you found). Later, git can pack many objects into one file, called a "pack file". The pack file is then compressed, which automatically exploits any repetitions between the files in the packfile (or repetitions inside file... |
10415837 | Interactive rebase of a branch with its point of divergence from master | 38 | 2012-05-02 14:30:11 | <p>Let's say I have a topic branch whose entire history I want to rewrite since it was originally created from master for a pull request. For whatever reason, it is not easy or obvious using <code>git log</code> to determine the commit hash I want to pass to</p>
<pre><code>git rebase -i <commit>
</code></pre>
<... | 19,495 | 64,669 | 2020-09-15 16:01:59 | 10,417,889 | 29 | 2012-05-02 16:31:03 | 1,253,222 | 2012-05-02 16:31:03 | https://stackoverflow.com/q/10415837 | https://stackoverflow.com/a/10417889 | <p>Maybe I'm misunderstanding your question, but I think <code>git rebase -i master</code> should do what you want. It will figure out the merge base and rebase the entire branch from that point to the current HEAD so that it appears to have been branched from the current tip of master.</p>
<p>Also, if master has not ... | <p>Maybe I'm misunderstanding your question, but I think <code>git rebase -i master</code> should do what you want. It will figure out the merge base and rebase the entire branch from that point to the current HEAD so that it appears to have been branched from the current tip of master.</p> <p>Also, if master has not ... | 119, 8974 | git, rebase | <h1>Interactive rebase of a branch with its point of divergence from master</h1>
<p>Let's say I have a topic branch whose entire history I want to rewrite since it was originally created from master for a pull request. For whatever reason, it is not easy or obvious using <code>git log</code> to determine the commit has... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,046 | git | # Interactive rebase of a branch with its point of divergence from master
Let's say I have a topic branch whose entire history I want to rewrite since it was originally created from master for a pull request. For whatever reason, it is not easy or obvious using `git log` to determine the commit hash I want to pass to
... | Maybe I'm misunderstanding your question, but I think `git rebase -i master` should do what you want. It will figure out the merge base and rebase the entire branch from that point to the current HEAD so that it appears to have been branched from the current tip of master.
Also, if master has not advanced, then rebasi... |
5823772 | Append ticket number using git commit hooks? | 38 | 2011-04-28 19:15:03 | <p>So my branch is named after bugtracker ticket number, something like "issue-1234", and we have a convention to always write down ticket number in commit message. I'm wondering if it's possible to append the ticket number in commit message automatically when I'm working on an issue-* branch without me expli... | 31,043 | 67,914 | 2024-11-12 15:45:14 | 5,824,876 | 29 | 2011-04-28 20:53:55 | 119,963 | 2024-11-08 12:29:30 | https://stackoverflow.com/q/5823772 | https://stackoverflow.com/a/5824876 | <p>You missed a hook. The one you want is <code>commit-msg</code>:</p>
<blockquote>
<p>This hook is invoked by git commit, and can be bypassed with --no-verify option. It takes a single parameter, the name of the file that holds the proposed commit log message. Exiting with non-zero status causes the git commit to abor... | <p>You missed a hook. The one you want is <code>commit-msg</code>:</p> <blockquote> <p>This hook is invoked by git commit, and can be bypassed with --no-verify option. It takes a single parameter, the name of the file that holds the proposed commit log message. Exiting with non-zero status causes the git commit to abor... | 119, 43087 | git, githooks | <h1>Append ticket number using git commit hooks?</h1>
<p>So my branch is named after bugtracker ticket number, something like "issue-1234", and we have a convention to always write down ticket number in commit message. I'm wondering if it's possible to append the ticket number in commit message automatically ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,047 | git | # Append ticket number using git commit hooks?
So my branch is named after bugtracker ticket number, something like "issue-1234", and we have a convention to always write down ticket number in commit message. I'm wondering if it's possible to append the ticket number in commit message automatically when I'm working on... | You missed a hook. The one you want is `commit-msg`:
> This hook is invoked by git commit, and can be bypassed with --no-verify option. It takes a single parameter, the name of the file that holds the proposed commit log message. Exiting with non-zero status causes the git commit to abort.
So for example:
```
#!/bin... |
25515393 | How do I add existing eclipse java project to git | 35 | 2014-08-26 21:25:48 | <p>How do I add an existing java project in eclipse to git?</p>
<p>I noticed when creating the project there was an option to add to source control but I can't find this option for an existing project. Is this possible from the git plugin in eclipse or must it be done from the command line? (I am using a Mac)</p>
| 73,361 | 2,266,295 | 2018-05-01 17:24:59 | 48,036,841 | 29 | 2017-12-30 18:41:35 | 6,356,060 | 2017-12-30 18:41:35 | https://stackoverflow.com/q/25515393 | https://stackoverflow.com/a/48036841 | <p>An alternative route (I have found the built-in Eclipse tool to be finicky at times):</p>
<ol>
<li>Open up your terminal</li>
<li>Navigate to your project directory</li>
<li>Type <code>git init</code> to create a repository</li>
<li>Assuming you already have files in that folder, type <code>git add --all</code> to ... | <p>An alternative route (I have found the built-in Eclipse tool to be finicky at times):</p> <ol> <li>Open up your terminal</li> <li>Navigate to your project directory</li> <li>Type <code>git init</code> to create a repository</li> <li>Assuming you already have files in that folder, type <code>git add --all</code> to ... | 17, 53, 119 | eclipse, git, java | <h1>How do I add existing eclipse java project to git</h1>
<p>How do I add an existing java project in eclipse to git?</p>
<p>I noticed when creating the project there was an option to add to source control but I can't find this option for an existing project. Is this possible from the git plugin in eclipse or must it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,048 | git | # How do I add existing eclipse java project to git
How do I add an existing java project in eclipse to git?
I noticed when creating the project there was an option to add to source control but I can't find this option for an existing project. Is this possible from the git plugin in eclipse or must it be done from th... | An alternative route (I have found the built-in Eclipse tool to be finicky at times):
1. Open up your terminal
2. Navigate to your project directory
3. Type `git init` to create a repository
4. Assuming you already have files in that folder, type `git add --all` to add all your files to the repository (Note: if you sk... |
9335486 | Git: how to roll back to last push/commit | 35 | 2012-02-17 21:13:41 | <p>I am programming. I add beautiful code and commit and push it to my repo like:</p>
<pre><code>git add *
git commit
//writes message
git push unfuddle master
</code></pre>
<p>Now i go in and screw everything up. I have not issued a git command since I push the beauty. How do i make my local files go back to what... | 44,620 | 742,422 | 2017-03-15 03:26:18 | 9,335,529 | 29 | 2012-02-17 21:17:01 | 492,969 | 2012-02-17 21:17:01 | https://stackoverflow.com/q/9335486 | https://stackoverflow.com/a/9335529 | <p>You can reset to HEAD: <code>git reset --hard HEAD</code></p>
| <p>You can reset to HEAD: <code>git reset --hard HEAD</code></p> | 119, 456 | git, version-control | <h1>Git: how to roll back to last push/commit</h1>
<p>I am programming. I add beautiful code and commit and push it to my repo like:</p>
<pre><code>git add *
git commit
//writes message
git push unfuddle master
</code></pre>
<p>Now i go in and screw everything up. I have not issued a git command since I push the be... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,049 | git | # Git: how to roll back to last push/commit
I am programming. I add beautiful code and commit and push it to my repo like:
```
git add *
git commit
//writes message
git push unfuddle master
```
Now i go in and screw everything up. I have not issued a git command since I push the beauty. How do i make my local files ... | You can reset to HEAD: `git reset --hard HEAD` |
2874347 | How to display available branches in Android source tree? | 35 | 2010-05-20 13:54:13 | <p>Following directions on Android's main website to pull down sources, I'm looking at this command to initialize repo for the cupcake branch:</p>
<p><code>repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake</code></p>
<p>How can I view all available branches besides cupcake, i.e eclair, donut,... | 32,798 | 204,317 | 2019-06-10 22:54:58 | 2,880,510 | 29 | 2010-05-21 08:17:13 | 111,430 | 2016-07-01 19:34:58 | https://stackoverflow.com/q/2874347 | https://stackoverflow.com/a/2880510 | <p>It doesn't seem to be possible using the "repo" script, but you can query the list of available branches using git:</p>
<pre><code>$ git clone https://android.googlesource.com/platform/manifest.git
$ cd manifest
$ git branch -r
</code></pre>
<p>If you don't want to clone the repository just for this, you can see t... | <p>It doesn't seem to be possible using the "repo" script, but you can query the list of available branches using git:</p> <pre><code>$ git clone https://android.googlesource.com/platform/manifest.git $ cd manifest $ git branch -r </code></pre> <p>If you don't want to clone the repository just for this, you can see t... | 119, 1386, 7330, 42420 | android, android-ndk, git, repository | <h1>How to display available branches in Android source tree?</h1>
<p>Following directions on Android's main website to pull down sources, I'm looking at this command to initialize repo for the cupcake branch:</p>
<p><code>repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake</code></p>
<p>How ca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,050 | git | # How to display available branches in Android source tree?
Following directions on Android's main website to pull down sources, I'm looking at this command to initialize repo for the cupcake branch:
`repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake`
How can I view all available branches be... | It doesn't seem to be possible using the "repo" script, but you can query the list of available branches using git:
```
$ git clone https://android.googlesource.com/platform/manifest.git
$ cd manifest
$ git branch -r
```
If you don't want to clone the repository just for this, you can see the branches on the [web int... |
35145400 | git checkout my_branch vs. git checkout origin/my_branch | 34 | 2016-02-02 05:00:39 | <p>I was on <code>branch1</code> when I checkout <code>branch2</code> like this (both branches are existing).</p>
<p><code>git checkout origin/branch2</code></p>
<p>then I got a detached head error:</p>
<pre><code>You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and y... | 19,425 | 4,975,822 | 2016-02-02 05:30:39 | 35,145,539 | 29 | 2016-02-02 05:13:19 | 1,256,452 | 2016-02-02 05:13:19 | https://stackoverflow.com/q/35145400 | https://stackoverflow.com/a/35145539 | <p>The "detached HEAD" message is a warning, not an error.</p>
<p>The reason for it is simple enough. Git has two states you can be in with respect to branches:</p>
<ul>
<li>on a branch, or</li>
<li>not on a branch.</li>
</ul>
<p>When you are on a branch and make new commits, the branch automatically advances to in... | <p>The "detached HEAD" message is a warning, not an error.</p> <p>The reason for it is simple enough. Git has two states you can be in with respect to branches:</p> <ul> <li>on a branch, or</li> <li>not on a branch.</li> </ul> <p>When you are on a branch and make new commits, the branch automatically advances to in... | 119 | git | <h1>git checkout my_branch vs. git checkout origin/my_branch</h1>
<p>I was on <code>branch1</code> when I checkout <code>branch2</code> like this (both branches are existing).</p>
<p><code>git checkout origin/branch2</code></p>
<p>then I got a detached head error:</p>
<pre><code>You are in 'detached HEAD' state. You... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,051 | git | # git checkout my_branch vs. git checkout origin/my_branch
I was on `branch1` when I checkout `branch2` like this (both branches are existing).
`git checkout origin/branch2`
then I got a detached head error:
```
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and yo... | The "detached HEAD" message is a warning, not an error.
The reason for it is simple enough. Git has two states you can be in with respect to branches:
- on a branch, or
- not on a branch.
When you are on a branch and make new commits, the branch automatically advances to include the new commits.
When you are *not* ... |
61994014 | Should .last_build_id be commited? | 33 | 2020-05-25 00:15:30 | <p>I was wondering if <code>.last_build_id</code> file should be commited since everytime I'm testing locally it creates a new hash.</p>
| 3,866 | 7,232,617 | 2020-05-29 08:52:28 | 61,996,187 | 29 | 2020-05-25 05:12:51 | 10,751,129 | 2020-05-25 05:12:51 | https://stackoverflow.com/q/61994014 | https://stackoverflow.com/a/61996187 | <p>I do not think it is necessary to commit this. This is kind of like a binary file itself, everytime you make a change and run a program, the file <em>will</em> change.
<code>last_build_id</code> should be put into the <code>.gitignore</code>.</p>
<p>Best</p>
| <p>I do not think it is necessary to commit this. This is kind of like a binary file itself, everytime you make a change and run a program, the file <em>will</em> change. <code>last_build_id</code> should be put into the <code>.gitignore</code>.</p> <p>Best</p> | 119, 115695 | flutter, git | <h1>Should .last_build_id be commited?</h1>
<p>I was wondering if <code>.last_build_id</code> file should be commited since everytime I'm testing locally it creates a new hash.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,052 | git | # Should .last_build_id be commited?
I was wondering if `.last_build_id` file should be commited since everytime I'm testing locally it creates a new hash. | I do not think it is necessary to commit this. This is kind of like a binary file itself, everytime you make a change and run a program, the file *will* change.
`last_build_id` should be put into the `.gitignore`.
Best |
4271938 | Make git master HEAD point to current HEAD of branch | 33 | 2010-11-24 22:03:37 | <p>I have to admit that I haven't played with gits advanced features but on my current project I had to.</p>
<p>The situation:
Someone tried to implement some features and comitted them to the master, now I was called to do what this other person tried to do (but failed), therefore, the first thing I did was </p>
<pr... | 41,027 | 336,039 | 2014-05-23 09:11:25 | 4,272,014 | 29 | 2010-11-24 22:14:15 | 501,250 | 2010-11-24 22:14:15 | https://stackoverflow.com/q/4271938 | https://stackoverflow.com/a/4272014 | <p>You can do this, if the remote repository accepts forced pushes:</p>
<pre><code>git push --force origin clean_start:master
</code></pre>
<p>Note that if anyone else has the repository cloned, <strong>a push from them could potentially undo this</strong>. If you want to merge your local master branch and the remot... | <p>You can do this, if the remote repository accepts forced pushes:</p> <pre><code>git push --force origin clean_start:master </code></pre> <p>Note that if anyone else has the repository cloned, <strong>a push from them could potentially undo this</strong>. If you want to merge your local master branch and the remot... | 119, 1879, 12309, 17492 | branch, git, head, revert | <h1>Make git master HEAD point to current HEAD of branch</h1>
<p>I have to admit that I haven't played with gits advanced features but on my current project I had to.</p>
<p>The situation:
Someone tried to implement some features and comitted them to the master, now I was called to do what this other person tried to d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,054 | git | # Make git master HEAD point to current HEAD of branch
I have to admit that I haven't played with gits advanced features but on my current project I had to.
The situation:
Someone tried to implement some features and comitted them to the master, now I was called to do what this other person tried to do (but failed), ... | You can do this, if the remote repository accepts forced pushes:
```
git push --force origin clean_start:master
```
Note that if anyone else has the repository cloned, **a push from them could potentially undo this**. If you want to merge your local master branch and the remote master branch, but keep the file tree f... |
29118876 | git push is very slow for a branch | 30 | 2015-03-18 09:55:03 | <p>We have a git repo that is quite large (ios app resources). I appreciate that git is going to be slow when working with it, but if I create a new branch and edit a couple of files (not binary ones) and push, it takes forever.</p>
<p>It feels like the entire repo is being pushed. I was under the impression that git ... | 55,486 | 275,095 | 2022-07-17 15:24:41 | 29,119,601 | 29 | 2015-03-18 10:29:57 | 1,256,452 | 2015-03-18 10:29:57 | https://stackoverflow.com/q/29118876 | https://stackoverflow.com/a/29119601 | <p>You're using a "smart" transport (this is a good thing), so you do get deltas, or more specifically, "delta compression". But that's not to say that git pushes diffs.</p>
<p>Both push and fetch work the same way here: on a smart transport, your git calls up the remote and both ends have a mini conversation to figu... | <p>You're using a "smart" transport (this is a good thing), so you do get deltas, or more specifically, "delta compression". But that's not to say that git pushes diffs.</p> <p>Both push and fetch work the same way here: on a smart transport, your git calls up the remote and both ends have a mini conversation to figu... | 119 | git | <h1>git push is very slow for a branch</h1>
<p>We have a git repo that is quite large (ios app resources). I appreciate that git is going to be slow when working with it, but if I create a new branch and edit a couple of files (not binary ones) and push, it takes forever.</p>
<p>It feels like the entire repo is being ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,056 | git | # git push is very slow for a branch
We have a git repo that is quite large (ios app resources). I appreciate that git is going to be slow when working with it, but if I create a new branch and edit a couple of files (not binary ones) and push, it takes forever.
It feels like the entire repo is being pushed. I was un... | You're using a "smart" transport (this is a good thing), so you do get deltas, or more specifically, "delta compression". But that's not to say that git pushes diffs.
Both push and fetch work the same way here: on a smart transport, your git calls up the remote and both ends have a mini conversation to figure out who ... |
4609841 | Git merge and keep separate? | 30 | 2011-01-05 22:25:59 | <p>Is there a way to update a side branch with information from another (master or other), and then have the two continue? Like a rebase, but keeping the old data there?</p>
<p>Original:</p>
<pre><code>A---B---C---G---H master
\
D---E---F branchA
</code></pre>
<p>Result:</p>
<pre><code>A---B... | 20,840 | 144,756 | 2011-01-05 22:36:00 | 4,609,885 | 29 | 2011-01-05 22:33:41 | 501,250 | 2011-01-05 22:33:41 | https://stackoverflow.com/q/4609841 | https://stackoverflow.com/a/4609885 | <p>If your history goes up to H or L on master and F on branchA (that is, J and K do not yet exist), then yes, simply check out branch A and merge:</p>
<pre><code>git checkout branchA
git merge H # Use H's commit identifier if it's not the tip of master
</code></pre>
<p>This will merge the changes into branchA and ... | <p>If your history goes up to H or L on master and F on branchA (that is, J and K do not yet exist), then yes, simply check out branch A and merge:</p> <pre><code>git checkout branchA git merge H # Use H's commit identifier if it's not the tip of master </code></pre> <p>This will merge the changes into branchA and ... | 119 | git | <h1>Git merge and keep separate?</h1>
<p>Is there a way to update a side branch with information from another (master or other), and then have the two continue? Like a rebase, but keeping the old data there?</p>
<p>Original:</p>
<pre><code>A---B---C---G---H master
\
D---E---F branchA
</code></... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,057 | git | # Git merge and keep separate?
Is there a way to update a side branch with information from another (master or other), and then have the two continue? Like a rebase, but keeping the old data there?
Original:
```
A---B---C---G---H master
\
D---E---F branchA
```
Result:
```
A---B---C---G---H-... | If your history goes up to H or L on master and F on branchA (that is, J and K do not yet exist), then yes, simply check out branch A and merge:
```
git checkout branchA
git merge H # Use H's commit identifier if it's not the tip of master
```
This will merge the changes into branchA and will not disturb the master... |
53305965 | What's the best encrypted git credential helper for Linux? | 29 | 2018-11-14 17:41:49 | <p>I've been looking for a good encrypted git credential helper for Linux (something that can store passwords in an encrypted way, and retrieve them later, conforming to the git-credential protocol), and I'm really surprised that not much seems to be turning up.</p>
<p>In all of the git docs and related git-credential... | 28,357 | 3,417,282 | 2024-08-06 08:54:34 | 53,307,245 | 29 | 2018-11-14 19:12:20 | 7,976,758 | 2023-05-11 16:22:49 | https://stackoverflow.com/q/53305965 | https://stackoverflow.com/a/53307245 | <p>This is what we have in git sources: <a href="https://github.com/git/git/tree/master/contrib/credential" rel="nofollow noreferrer">https://github.com/git/git/tree/master/contrib/credential</a></p>
<p>So you can use <code>gnome-keyring</code> (deprecated), <code>libsecret</code> or gpg-encrypted <code>.netrc</code>.<... | <p>This is what we have in git sources: <a href="https://github.com/git/git/tree/master/contrib/credential" rel="nofollow noreferrer">https://github.com/git/git/tree/master/contrib/credential</a></p> <p>So you can use <code>gnome-keyring</code> (deprecated), <code>libsecret</code> or gpg-encrypted <code>.netrc</code>.<... | 119, 132586 | git, git-credential-manager | <h1>What's the best encrypted git credential helper for Linux?</h1>
<p>I've been looking for a good encrypted git credential helper for Linux (something that can store passwords in an encrypted way, and retrieve them later, conforming to the git-credential protocol), and I'm really surprised that not much seems to be t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,058 | git | # What's the best encrypted git credential helper for Linux?
I've been looking for a good encrypted git credential helper for Linux (something that can store passwords in an encrypted way, and retrieve them later, conforming to the git-credential protocol), and I'm really surprised that not much seems to be turning up... | This is what we have in git sources: <https://github.com/git/git/tree/master/contrib/credential>
So you can use `gnome-keyring` (deprecated), `libsecret` or gpg-encrypted `.netrc`.
`libsecret` could be used with any Linux distribution without GNOME, I believe.
```
git config --global credential.helper /usr/share/doc... |
30359921 | How do you stash only files that have been added? | 29 | 2015-05-20 20:37:10 | <p>For example, a <code>git status</code> gives the following:</p>
<pre><code>Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: app/src/[....]
modified: app/src/[....]
new file: app/src/[....]
deleted: app/src/[....]
modified: app/src/[....]
modi... | 24,057 | 2,729,534 | 2024-06-26 12:57:10 | 30,361,365 | 29 | 2015-05-20 22:20:13 | 1,256,452 | 2015-05-21 08:48:24 | https://stackoverflow.com/q/30359921 | https://stackoverflow.com/a/30361365 | <p>Git's basic storage mechanism is "the commit"—in fact, all <code>git stash</code> does is make a couple of somewhat unusual commits—so <a href="https://stackoverflow.com/a/30360109/1256452">Nick Volynkin's answer</a> is a correct one. It could perhaps use a bit of expansion though, and there are easier (w... | <p>Git's basic storage mechanism is "the commit"—in fact, all <code>git stash</code> does is make a couple of somewhat unusual commits—so <a href="https://stackoverflow.com/a/30360109/1256452">Nick Volynkin's answer</a> is a correct one. It could perhaps use a bit of expansion though, and there are easier (w... | 119, 13091 | git, git-stash | <h1>How do you stash only files that have been added?</h1>
<p>For example, a <code>git status</code> gives the following:</p>
<pre><code>Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: app/src/[....]
modified: app/src/[....]
new file: app/src/[....]
deleted... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,060 | git | # How do you stash only files that have been added?
For example, a `git status` gives the following:
```
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: app/src/[....]
modified: app/src/[....]
new file: app/src/[....]
deleted: app/src/[....]
modified: a... | Git's basic storage mechanism is "the commit"—in fact, all `git stash` does is make a couple of somewhat unusual commits—so [Nick Volynkin's answer](https://stackoverflow.com/a/30360109/1256452) is a correct one. It could perhaps use a bit of expansion though, and there are easier (well, potentially easier) methods.
I... |
33152725 | git diff gives ambigious argument error | 28 | 2015-10-15 15:35:55 | <p>I recently moved from SVN to git, and trying to learn my way around git.
I need to find the files that have changed between 2 branches of my repository. I use the following command to that:</p>
<pre><code>git diff branch_2..branch_1
</code></pre>
<p>I get the follwing error:</p>
<pre><code>fatal: ambiguous argume... | 30,048 | 3,029,063 | 2023-06-29 10:21:40 | 33,153,205 | 29 | 2015-10-15 15:57:36 | 1,832,539 | 2015-10-15 16:09:08 | https://stackoverflow.com/q/33152725 | https://stackoverflow.com/a/33153205 | <p>If you are simply doing:</p>
<pre><code>git diff branch2..branch1
</code></pre>
<p>This will not work, as listed in your git branch list, your 'remotes' are specified as "origin". What this actually means is that you have those branches on your remote, but they aren't actually checked out locally. </p>
<p>So you ... | <p>If you are simply doing:</p> <pre><code>git diff branch2..branch1 </code></pre> <p>This will not work, as listed in your git branch list, your 'remotes' are specified as "origin". What this actually means is that you have those branches on your remote, but they aren't actually checked out locally. </p> <p>So you ... | 119, 9033 | git, git-diff | <h1>git diff gives ambigious argument error</h1>
<p>I recently moved from SVN to git, and trying to learn my way around git.
I need to find the files that have changed between 2 branches of my repository. I use the following command to that:</p>
<pre><code>git diff branch_2..branch_1
</code></pre>
<p>I get the follwi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,061 | git | # git diff gives ambigious argument error
I recently moved from SVN to git, and trying to learn my way around git.
I need to find the files that have changed between 2 branches of my repository. I use the following command to that:
```
git diff branch_2..branch_1
```
I get the follwing error:
```
fatal: ambiguous a... | If you are simply doing:
```
git diff branch2..branch1
```
This will not work, as listed in your git branch list, your 'remotes' are specified as "origin". What this actually means is that you have those branches on your remote, but they aren't actually checked out locally.
So you have two options here. Try these, a... |
31874670 | Merge parent branch into child branch | 28 | 2015-08-07 09:45:28 | <p>I'm using bitbucket and sourcetree and I've done this:</p>
<p>I have a develop branch. From this branch I have created a feature branch.</p>
<p>After creating I have fix some errors on develop branch and push it to this branch only.</p>
<p>How can I have these fixes in the feature branch? I think I have to merge ... | 55,581 | 68,571 | 2015-08-07 19:06:34 | 31,884,954 | 29 | 2015-08-07 19:06:34 | 5,103,359 | 2015-08-07 19:06:34 | https://stackoverflow.com/q/31874670 | https://stackoverflow.com/a/31884954 | <p>You want to bring changes from development branch to feature branch. So first switch to feature branch and merge development branch into it. In case you want the commits from develop branch too, use the non fast forward merge <code>--no-ff</code> approach. Else do not use <code>--no-ff</code>.</p>
<pre><code>git ch... | <p>You want to bring changes from development branch to feature branch. So first switch to feature branch and merge development branch into it. In case you want the commits from develop branch too, use the non fast forward merge <code>--no-ff</code> approach. Else do not use <code>--no-ff</code>.</p> <pre><code>git ch... | 119, 717, 1879, 90056 | atlassian-sourcetree, branch, git, merge | <h1>Merge parent branch into child branch</h1>
<p>I'm using bitbucket and sourcetree and I've done this:</p>
<p>I have a develop branch. From this branch I have created a feature branch.</p>
<p>After creating I have fix some errors on develop branch and push it to this branch only.</p>
<p>How can I have these fixes ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,062 | git | # Merge parent branch into child branch
I'm using bitbucket and sourcetree and I've done this:
I have a develop branch. From this branch I have created a feature branch.
After creating I have fix some errors on develop branch and push it to this branch only.
How can I have these fixes in the feature branch? I think... | You want to bring changes from development branch to feature branch. So first switch to feature branch and merge development branch into it. In case you want the commits from develop branch too, use the non fast forward merge `--no-ff` approach. Else do not use `--no-ff`.
```
git checkout feature
git merge --no-ff dev... |
7259472 | Remove commits from a single branch in Git | 28 | 2011-08-31 15:31:41 | <p>I have two branches, master and feature1. I was working on feature1 when I realized that I needed to work on something else unrelated. Unfortunately, I forgot to branch from the master, and instead created my feature2 branch from feature1. Now I want to merge feature2 into master, but cannot because there are parts ... | 15,879 | 169,491 | 2011-08-31 18:02:03 | 7,259,570 | 29 | 2011-08-31 15:38:43 | 223,092 | 2011-08-31 18:02:03 | https://stackoverflow.com/q/7259472 | https://stackoverflow.com/a/7259570 | <p>If it's only you working on your <code>feature2</code> branch and you haven't shared it with other people, it's fine to rebase that branch before merging. You could do the following, for example:</p>
<pre><code>git checkout feature2
git rebase --onto master feature1 feature2
</code></pre>
<p>... which will rewrit... | <p>If it's only you working on your <code>feature2</code> branch and you haven't shared it with other people, it's fine to rebase that branch before merging. You could do the following, for example:</p> <pre><code>git checkout feature2 git rebase --onto master feature1 feature2 </code></pre> <p>... which will rewrit... | 119, 1879 | branch, git | <h1>Remove commits from a single branch in Git</h1>
<p>I have two branches, master and feature1. I was working on feature1 when I realized that I needed to work on something else unrelated. Unfortunately, I forgot to branch from the master, and instead created my feature2 branch from feature1. Now I want to merge featu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,063 | git | # Remove commits from a single branch in Git
I have two branches, master and feature1. I was working on feature1 when I realized that I needed to work on something else unrelated. Unfortunately, I forgot to branch from the master, and instead created my feature2 branch from feature1. Now I want to merge feature2 into ... | If it's only you working on your `feature2` branch and you haven't shared it with other people, it's fine to rebase that branch before merging. You could do the following, for example:
```
git checkout feature2
git rebase --onto master feature1 feature2
```
... which will rewrite your `feature2` branch, leaving it so... |
2333828 | How to edit Git "add patch" hunks/diffs/lines during selective staging? | 28 | 2010-02-25 12:13:10 | <p>I have a source file where 2 features have been added. In order to allow cherry-picking, I'd like to commit that in 2 phases: one for each feature. Until now, in similar situations, using <code>git add -p</code> served me well, to commit one feature while leaving the local files in their final stage.</p>
<p>However... | 9,215 | 19,966 | 2013-07-14 19:12:04 | 2,333,917 | 29 | 2010-02-25 12:28:13 | 95,706 | 2010-02-25 12:28:13 | https://stackoverflow.com/q/2333828 | https://stackoverflow.com/a/2333917 | <p>As Alan says, edit the patch by pressing <code>e</code> (instead of <code>s</code>) during <code>git add -p</code>. This will launch your editor with that hunk of the patch so that you can manually edit it. There are comments within the text that explain how to properly discard modifications and it's actually pretty... | <p>As Alan says, edit the patch by pressing <code>e</code> (instead of <code>s</code>) during <code>git add -p</code>. This will launch your editor with that hunk of the patch so that you can manually edit it. There are comments within the text that explain how to properly discard modifications and it's actually pretty... | 119, 2132, 2193, 5597, 34792 | commit, git, git-add, patch, split | <h1>How to edit Git "add patch" hunks/diffs/lines during selective staging?</h1>
<p>I have a source file where 2 features have been added. In order to allow cherry-picking, I'd like to commit that in 2 phases: one for each feature. Until now, in similar situations, using <code>git add -p</code> served me well, to commi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,064 | git | # How to edit Git "add patch" hunks/diffs/lines during selective staging?
I have a source file where 2 features have been added. In order to allow cherry-picking, I'd like to commit that in 2 phases: one for each feature. Until now, in similar situations, using `git add -p` served me well, to commit one feature while ... | As Alan says, edit the patch by pressing `e` (instead of `s`) during `git add -p`. This will launch your editor with that hunk of the patch so that you can manually edit it. There are comments within the text that explain how to properly discard modifications and it's actually pretty easy.
When you are done, note that... |
43522516 | How to answer the git prompt in npm init for a local repo | 26 | 2017-04-20 14:33:26 | <p>I already have a workspace in a local private repo of the form:</p>
<p>../Workspace/ComponentA/</p>
<p>This is already checked into git. I then go to init a new component at:</p>
<p>../Workspace/ComponentB</p>
<p>so, inside ComponentB, I run npm init, and then gets to the git question, but I don't know what the ... | 31,922 | 223,936 | 2020-10-11 22:17:58 | 43,522,793 | 29 | 2017-04-20 14:44:28 | 7,050,130 | 2017-04-20 15:07:51 | https://stackoverflow.com/q/43522516 | https://stackoverflow.com/a/43522793 | <p><strong>UPDATE</strong> based on comment discussion:</p>
<p>IIRC <code>npm init</code> just wants to know what it should write to the attributes of the <code>repository</code> key in <code>package.json</code>. This is optional, so if you don't have a URL you want to publish in the <code>package.json</code> you sho... | <p><strong>UPDATE</strong> based on comment discussion:</p> <p>IIRC <code>npm init</code> just wants to know what it should write to the attributes of the <code>repository</code> key in <code>package.json</code>. This is optional, so if you don't have a URL you want to publish in the <code>package.json</code> you sho... | 119, 117464 | git, npm-init | <h1>How to answer the git prompt in npm init for a local repo</h1>
<p>I already have a workspace in a local private repo of the form:</p>
<p>../Workspace/ComponentA/</p>
<p>This is already checked into git. I then go to init a new component at:</p>
<p>../Workspace/ComponentB</p>
<p>so, inside ComponentB, I run npm ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,067 | git | # How to answer the git prompt in npm init for a local repo
I already have a workspace in a local private repo of the form:
../Workspace/ComponentA/
This is already checked into git. I then go to init a new component at:
../Workspace/ComponentB
so, inside ComponentB, I run npm init, and then gets to the git questi... | **UPDATE** based on comment discussion:
IIRC `npm init` just wants to know what it should write to the attributes of the `repository` key in `package.json`. This is optional, so if you don't have a URL you want to publish in the `package.json` you should just be able to hit enter and move on.
In the case where you do... |
12292582 | How do I make git block commits if user email isn't set? | 26 | 2012-09-06 03:30:29 | <p>I have separate email addresses that I use for work projects vs open source projects, and I want to ensure that I use the correct one for each type of project.</p>
<p>Obviously the solution is to set the repository specific configuration appropriately, unfortunately I keep forgetting to set it until I'm a few commi... | 5,170 | 1,612 | 2016-05-01 19:59:30 | 12,292,895 | 29 | 2012-09-06 04:15:11 | 6,309 | 2016-05-01 19:59:30 | https://stackoverflow.com/q/12292582 | https://stackoverflow.com/a/12292895 | <p>New Update (February 2016, for git 2.8)</p>
<p>git 2.8 (March 2016) will add a new solution:</p>
<p>See <a href="https://github.com/git/git/commit/4d5c2956969a6690db2bbb2f3ff40459c09d7646" rel="noreferrer">commit 4d5c295</a> (06 Feb 2016) by <a href="https://github.com/da-x" rel="noreferrer">Dan Aloni (<code>da-x<... | <p>New Update (February 2016, for git 2.8)</p> <p>git 2.8 (March 2016) will add a new solution:</p> <p>See <a href="https://github.com/git/git/commit/4d5c2956969a6690db2bbb2f3ff40459c09d7646" rel="noreferrer">commit 4d5c295</a> (06 Feb 2016) by <a href="https://github.com/da-x" rel="noreferrer">Dan Aloni (<code>da-x<... | 119 | git | <h1>How do I make git block commits if user email isn't set?</h1>
<p>I have separate email addresses that I use for work projects vs open source projects, and I want to ensure that I use the correct one for each type of project.</p>
<p>Obviously the solution is to set the repository specific configuration appropriatel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,068 | git | # How do I make git block commits if user email isn't set?
I have separate email addresses that I use for work projects vs open source projects, and I want to ensure that I use the correct one for each type of project.
Obviously the solution is to set the repository specific configuration appropriately, unfortunately... | New Update (February 2016, for git 2.8)
git 2.8 (March 2016) will add a new solution:
See [commit 4d5c295](https://github.com/git/git/commit/4d5c2956969a6690db2bbb2f3ff40459c09d7646) (06 Feb 2016) by [Dan Aloni (`da-x`)](https://github.com/da-x).
Helped-by: [Eric Sunshine (`sunshineco`)](https://github.com/sunshine... |
4108778 | What is the difference between clone and mkdir->cd->init->remote-add->pull? | 26 | 2010-11-05 18:11:17 | <p>After setting up a repo on Github, there seems to be two ways to pull that repo into a local repo.</p>
<p>Firstly, I could create a directory, initialize a blank repo, add a remote and then pull changes from the remote.</p>
<pre><code>> mkdir "exampleProject"
> cd "exampleProject"
> git init
> git remo... | 9,768 | 236,587 | 2010-11-05 18:58:02 | 4,108,923 | 29 | 2010-11-05 18:30:17 | 119,963 | 2010-11-05 18:58:02 | https://stackoverflow.com/q/4108778 | https://stackoverflow.com/a/4108923 | <p>A lot of commands, whether git commands or common programs, do things in one line you could otherwise do in ten. It's always good to save work!</p>
<p>That said, your steps are close to, but not entirely the same as, what <code>git clone</code> does. I can think of a few differences, all to do with branches:</p>
<... | <p>A lot of commands, whether git commands or common programs, do things in one line you could otherwise do in ten. It's always good to save work!</p> <p>That said, your steps are close to, but not entirely the same as, what <code>git clone</code> does. I can think of a few differences, all to do with branches:</p> <... | 119, 3346, 28896, 34099 | dvcs, git, git-clone, git-pull | <h1>What is the difference between clone and mkdir->cd->init->remote-add->pull?</h1>
<p>After setting up a repo on Github, there seems to be two ways to pull that repo into a local repo.</p>
<p>Firstly, I could create a directory, initialize a blank repo, add a remote and then pull changes from the remote.</p>
<pre><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,070 | git | # What is the difference between clone and mkdir->cd->init->remote-add->pull?
After setting up a repo on Github, there seems to be two ways to pull that repo into a local repo.
Firstly, I could create a directory, initialize a blank repo, add a remote and then pull changes from the remote.
```
> mkdir "exampleProjec... | A lot of commands, whether git commands or common programs, do things in one line you could otherwise do in ten. It's always good to save work!
That said, your steps are close to, but not entirely the same as, what `git clone` does. I can think of a few differences, all to do with branches:
- If, for some reason, the... |
56491420 | How to clone a Git repository from a Docker container | 25 | 2019-06-07 09:15:05 | <p>We have a tool which needs to clone several Git repositories for aggregating documentation data. We want to put that tool in a Docker container for easily running it locally and with Jenkins, and enabling reproducibility.</p>
<p>The Git repositories are hosted on a private server requiring authentication with SSH k... | 39,953 | 2,716,245 | 2019-06-15 05:05:02 | 56,527,389 | 29 | 2019-06-10 13:27:52 | 5,465,973 | 2019-06-13 08:23:25 | https://stackoverflow.com/q/56491420 | https://stackoverflow.com/a/56527389 | <p>You can use something like:</p>
<pre><code>echo "git-user:x:$(id -u):$(id -g):Git User:/tmp:/bin/bash" > /tmp/fake_passwd # See below why to use this
docker run \
-u $(id -u):$(id -g) \
-w /tmp \
-v $HOME/.ssh:/path/to/.ssh \
-v /tmp/fake_passwd:/etc/passwd \
--entrypoint sh \
-it \
alpine/... | <p>You can use something like:</p> <pre><code>echo "git-user:x:$(id -u):$(id -g):Git User:/tmp:/bin/bash" > /tmp/fake_passwd # See below why to use this docker run \ -u $(id -u):$(id -g) \ -w /tmp \ -v $HOME/.ssh:/path/to/.ssh \ -v /tmp/fake_passwd:/etc/passwd \ --entrypoint sh \ -it \ alpine/... | 119, 25308, 90304 | docker, git, ssh-keys | <h1>How to clone a Git repository from a Docker container</h1>
<p>We have a tool which needs to clone several Git repositories for aggregating documentation data. We want to put that tool in a Docker container for easily running it locally and with Jenkins, and enabling reproducibility.</p>
<p>The Git repositories are... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,071 | git | # How to clone a Git repository from a Docker container
We have a tool which needs to clone several Git repositories for aggregating documentation data. We want to put that tool in a Docker container for easily running it locally and with Jenkins, and enabling reproducibility.
The Git repositories are hosted on a pri... | You can use something like:
```
echo "git-user:x:$(id -u):$(id -g):Git User:/tmp:/bin/bash" > /tmp/fake_passwd # See below why to use this
docker run \
-u $(id -u):$(id -g) \
-w /tmp \
-v $HOME/.ssh:/path/to/.ssh \
-v /tmp/fake_passwd:/etc/passwd \
--entrypoint sh \
-it \
alpine/git
# commands... |
56283415 | How do I clone a repository that includes Git LFS files? | 25 | 2019-05-23 21:54:49 | <p>On my Ubuntu system, I installed Git LFS as well as Git, and cloned a repo that has some of its files managed by Git LFS. But those files didn't download, other than a marker file. (I didn't realize they weren't the whole file until I checked the file size, because they displayed in my file system with the right nam... | 34,454 | 338,638 | 2025-01-24 21:02:44 | 56,284,009 | 29 | 2019-05-23 23:15:50 | 8,705,432 | 2019-05-23 23:15:50 | https://stackoverflow.com/q/56283415 | https://stackoverflow.com/a/56284009 | <p><code>git lfs install</code> does two things: it sets up hooks in your local repository, and it adjusts your global (i.e., user-specific) configuration to contain the filter commands necessary for Git LFS to work properly.</p>
<p>If you're not in a repository yet, you probably want to run <code>git lfs install --sk... | <p><code>git lfs install</code> does two things: it sets up hooks in your local repository, and it adjusts your global (i.e., user-specific) configuration to contain the filter commands necessary for Git LFS to work properly.</p> <p>If you're not in a repository yet, you probably want to run <code>git lfs install --sk... | 119, 115244 | git, git-lfs | <h1>How do I clone a repository that includes Git LFS files?</h1>
<p>On my Ubuntu system, I installed Git LFS as well as Git, and cloned a repo that has some of its files managed by Git LFS. But those files didn't download, other than a marker file. (I didn't realize they weren't the whole file until I checked the file... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,072 | git | # How do I clone a repository that includes Git LFS files?
On my Ubuntu system, I installed Git LFS as well as Git, and cloned a repo that has some of its files managed by Git LFS. But those files didn't download, other than a marker file. (I didn't realize they weren't the whole file until I checked the file size, be... | `git lfs install` does two things: it sets up hooks in your local repository, and it adjusts your global (i.e., user-specific) configuration to contain the filter commands necessary for Git LFS to work properly.
If you're not in a repository yet, you probably want to run `git lfs install --skip-repo` and let it instal... |
37488178 | Jenkinsfile get current tag | 25 | 2016-05-27 16:18:10 | <p>Is there a way to get the current tag ( or null if there is none ) for a job in a Jenkinsfile? The background is that I only want to build some artifacts ( android APKs ) when this commit has a tag.
I tried:</p>
<pre><code>env.TAG_NAME
</code></pre>
<p>and</p>
<pre><code>binding.variables.get("TAG_NAME")
</code>... | 73,064 | 322,642 | 2022-08-17 07:55:29 | 39,988,692 | 29 | 2016-10-12 00:20:28 | 912,190 | 2016-10-12 00:20:28 | https://stackoverflow.com/q/37488178 | https://stackoverflow.com/a/39988692 | <p>I'd consider <code>returnStdout</code> rather than writing to a file:</p>
<p><code>sh(returnStdout: true, script: "git tag --sort version:refname | tail -1").trim()</code></p>
| <p>I'd consider <code>returnStdout</code> rather than writing to a file:</p> <p><code>sh(returnStdout: true, script: "git tag --sort version:refname | tail -1").trim()</code></p> | 119, 64999, 119414 | git, jenkins, jenkins-2 | <h1>Jenkinsfile get current tag</h1>
<p>Is there a way to get the current tag ( or null if there is none ) for a job in a Jenkinsfile? The background is that I only want to build some artifacts ( android APKs ) when this commit has a tag.
I tried:</p>
<pre><code>env.TAG_NAME
</code></pre>
<p>and</p>
<pre><code>bind... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,074 | git | # Jenkinsfile get current tag
Is there a way to get the current tag ( or null if there is none ) for a job in a Jenkinsfile? The background is that I only want to build some artifacts ( android APKs ) when this commit has a tag.
I tried:
```
env.TAG_NAME
```
and
```
binding.variables.get("TAG_NAME")
```
both are a... | I'd consider `returnStdout` rather than writing to a file:
`sh(returnStdout: true, script: "git tag --sort version:refname | tail -1").trim()` |
36206842 | How to make git consider .strings files as text file instead of binary file | 25 | 2016-03-24 17:54:10 | <p>Every time we make changes to the <strong>.strings</strong> files (for iOS localization) from different branches, we will have conflicts. </p>
<p>The reason seems to be that git consider the <strong>.strings</strong> as binary files instead of text files. Sometimes it is a little annoying because git won't help mer... | 6,616 | 1,035,008 | 2021-09-29 10:56:27 | 36,207,066 | 29 | 2016-03-24 18:05:09 | 2,295,034 | 2016-03-24 18:05:09 | https://stackoverflow.com/q/36206842 | https://stackoverflow.com/a/36207066 | <p>Create a <code>.gitattributes</code> file at the root of your repo with this contents:</p>
<pre><code>*.strings diff
</code></pre>
<p>More information: <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">https://git-scm.com/docs/gitattributes</a></p>
| <p>Create a <code>.gitattributes</code> file at the root of your repo with this contents:</p> <pre><code>*.strings diff </code></pre> <p>More information: <a href="https://git-scm.com/docs/gitattributes" rel="noreferrer">https://git-scm.com/docs/gitattributes</a></p> | 119 | git | <h1>How to make git consider .strings files as text file instead of binary file</h1>
<p>Every time we make changes to the <strong>.strings</strong> files (for iOS localization) from different branches, we will have conflicts. </p>
<p>The reason seems to be that git consider the <strong>.strings</strong> as binary file... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,075 | git | # How to make git consider .strings files as text file instead of binary file
Every time we make changes to the **.strings** files (for iOS localization) from different branches, we will have conflicts.
The reason seems to be that git consider the **.strings** as binary files instead of text files. Sometimes it is a ... | Create a `.gitattributes` file at the root of your repo with this contents:
```
*.strings diff
```
More information: <https://git-scm.com/docs/gitattributes> |
7633299 | Simple git post-commit hook to copy committed files to a certain folder | 25 | 2011-10-03 09:39:06 | <p>I would like to automatically copy the committed files to a certain folder so they can be viewed in a browser, but I would like to do this without having to create a bare repository that mirrors the main repository (as shown <a href="http://toroid.org/ams/git-website-howto">here</a>) and I would like this to happen ... | 17,385 | 246,311 | 2023-10-06 09:01:06 | 7,637,053 | 29 | 2011-10-03 15:24:06 | 223,092 | 2011-10-03 15:24:06 | https://stackoverflow.com/q/7633299 | https://stackoverflow.com/a/7637053 | <p>A good way of doing this is to create a <code>post-commit</code> that runs <code>git checkout -f</code> with the work tree set to the directory that is exposed by your web server and the git directory set to the <code>.git</code> directory in your development repository. For example, you could create a <code>.git/h... | <p>A good way of doing this is to create a <code>post-commit</code> that runs <code>git checkout -f</code> with the work tree set to the directory that is exposed by your web server and the git directory set to the <code>.git</code> directory in your development repository. For example, you could create a <code>.git/h... | 119, 190, 10250, 43087, 61840 | deployment, git, githooks, post-commit, post-commit-hook | <h1>Simple git post-commit hook to copy committed files to a certain folder</h1>
<p>I would like to automatically copy the committed files to a certain folder so they can be viewed in a browser, but I would like to do this without having to create a bare repository that mirrors the main repository (as shown <a href="ht... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,076 | git | # Simple git post-commit hook to copy committed files to a certain folder
I would like to automatically copy the committed files to a certain folder so they can be viewed in a browser, but I would like to do this without having to create a bare repository that mirrors the main repository (as shown [here](http://toroid... | A good way of doing this is to create a `post-commit` that runs `git checkout -f` with the work tree set to the directory that is exposed by your web server and the git directory set to the `.git` directory in your development repository. For example, you could create a `.git/hooks/post-commit` file that did:
```
#!/b... |
4163895 | git - setting a commit's parent without rebase | 24 | 2010-11-12 10:54:20 | <p>I used <code>git-svn</code> to create a git mirror of an SVN repository. The structure inside the SVN was a little off-standard, so git created a branch that has no common commit with the <code>master</code> branch.</p>
<pre><code> A---B---C topic
D---E---F---G master
</code></pre>
<p>I know that commit <co... | 6,546 | 990,443 | 2024-01-27 15:18:23 | 4,164,767 | 29 | 2010-11-12 12:46:48 | 112,968 | 2024-01-27 15:18:23 | https://stackoverflow.com/q/4163895 | https://stackoverflow.com/a/4164767 | <p>Have a look at grafts (the graft file can be found in <code>.git/info/grafts</code>). The format is pretty simple:</p>
<pre><code><commit sha1> <parent1 sha1> <parent2 sha1> … <parentN sha1>
</code></pre>
<p>This makes git believe that a commit has different parents than it actually has.</p>
... | <p>Have a look at grafts (the graft file can be found in <code>.git/info/grafts</code>). The format is pretty simple:</p> <pre><code><commit sha1> <parent1 sha1> <parent2 sha1> … <parentN sha1> </code></pre> <p>This makes git believe that a commit has different parents than it actually has.</p> ... | 119, 8974 | git, rebase | <h1>git - setting a commit's parent without rebase</h1>
<p>I used <code>git-svn</code> to create a git mirror of an SVN repository. The structure inside the SVN was a little off-standard, so git created a branch that has no common commit with the <code>master</code> branch.</p>
<pre><code> A---B---C topic
D---E... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,080 | git | # git - setting a commit's parent without rebase
I used `git-svn` to create a git mirror of an SVN repository. The structure inside the SVN was a little off-standard, so git created a branch that has no common commit with the `master` branch.
```
A---B---C topic
D---E---F---G master
```
I know that commit `A`... | Have a look at grafts (the graft file can be found in `.git/info/grafts`). The format is pretty simple:
```
<commit sha1> <parent1 sha1> <parent2 sha1> … <parentN sha1>
```
This makes git believe that a commit has different parents than it actually has.
In newer versions of Git, you want to use the [replace mechanis... |
24634092 | git submodule update not functioning | 23 | 2014-07-08 14:13:37 | <p>I have a repository with various nested submodules. Committing and pushing works pretty well and the changes are visible at GitHub as expected.</p>
<p>In the testing/production environments, new releases of this project are being deployed using these commands:</p>
<pre><code>git pull --recurse-submodules
git submo... | 27,535 | 2,066,215 | 2023-05-12 05:46:42 | 24,635,535 | 29 | 2014-07-08 15:15:33 | 6,309 | 2020-08-31 20:53:42 | https://stackoverflow.com/q/24634092 | https://stackoverflow.com/a/24635535 | <p>You need to make sure your submodules are following a branch, or they will only be checked out at a specific SHA1 (not at the latest of a branch, but the <a href="https://stackoverflow.com/a/19354410/6309">special entry of the index of your parent repo</a>)</p>
<p>See "<a href="https://stackoverflow.com/a/18799... | <p>You need to make sure your submodules are following a branch, or they will only be checked out at a specific SHA1 (not at the latest of a branch, but the <a href="https://stackoverflow.com/a/19354410/6309">special entry of the index of your parent repo</a>)</p> <p>See "<a href="https://stackoverflow.com/a/18799... | 119 | git | <h1>git submodule update not functioning</h1>
<p>I have a repository with various nested submodules. Committing and pushing works pretty well and the changes are visible at GitHub as expected.</p>
<p>In the testing/production environments, new releases of this project are being deployed using these commands:</p>
<pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,081 | git | # git submodule update not functioning
I have a repository with various nested submodules. Committing and pushing works pretty well and the changes are visible at GitHub as expected.
In the testing/production environments, new releases of this project are being deployed using these commands:
```
git pull --recurse-s... | You need to make sure your submodules are following a branch, or they will only be checked out at a specific SHA1 (not at the latest of a branch, but the [special entry of the index of your parent repo](https://stackoverflow.com/a/19354410/6309))
See "[Git submodules: Specify a branch/tag](https://stackoverflow.com/a/... |
6860893 | Git fetch and pull with no arguments | 23 | 2011-07-28 14:44:31 | <p>I have a git branch checked out named <code>foo</code>.</p>
<pre><code>> git status
# On branch foo
nothing to commit (working directory clean)
</code></pre>
<p>It was originally checked out using this command:</p>
<pre><code>> git checkout origin/foo -b foo --track
</code></pre>
<p>I want to get updates t... | 14,937 | 139,010 | 2021-10-18 08:58:46 | 6,861,747 | 29 | 2011-07-28 15:40:49 | 223,092 | 2021-10-18 08:58:46 | https://stackoverflow.com/q/6860893 | https://stackoverflow.com/a/6861747 | <p>Unfortunately, whether they are equivalent or not in general depends on which branch you are on, your configuration, phase of the moon, etc.</p>
<p>You can figure this out from the <code>git pull</code> man page, as I've described below, but I would generally try to avoid having to work that out by doing: <code>git ... | <p>Unfortunately, whether they are equivalent or not in general depends on which branch you are on, your configuration, phase of the moon, etc.</p> <p>You can figure this out from the <code>git pull</code> man page, as I've described below, but I would generally try to avoid having to work that out by doing: <code>git ... | 119, 28896, 33720 | git, git-fetch, git-pull | <h1>Git fetch and pull with no arguments</h1>
<p>I have a git branch checked out named <code>foo</code>.</p>
<pre><code>> git status
# On branch foo
nothing to commit (working directory clean)
</code></pre>
<p>It was originally checked out using this command:</p>
<pre><code>> git checkout origin/foo -b foo --t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,083 | git | # Git fetch and pull with no arguments
I have a git branch checked out named `foo`.
```
> git status
# On branch foo
nothing to commit (working directory clean)
```
It was originally checked out using this command:
```
> git checkout origin/foo -b foo --track
```
I want to get updates to this branch from the remot... | Unfortunately, whether they are equivalent or not in general depends on which branch you are on, your configuration, phase of the moon, etc.
You can figure this out from the `git pull` man page, as I've described below, but I would generally try to avoid having to work that out by doing: `git fetch origin` and then `g... |
5339838 | Cloning a git-svn repository with svn metadata | 23 | 2011-03-17 13:42:24 | <p>I've cloned my main repository with <code>git-svn clone svn://url/trunk --stdlayout</code>. Now I want to clone the repository, with the svn meta data. So that I'll be able to <code>git-svn rebase</code> it to the main server.</p>
<p>Note, I don't want to push commits between two <code>git-svn</code> clones, I simp... | 7,031 | 55,094 | 2014-07-12 02:45:55 | 5,340,967 | 29 | 2011-03-17 15:09:11 | 55,094 | 2014-07-12 02:40:02 | https://stackoverflow.com/q/5339838 | https://stackoverflow.com/a/5340967 | <p>It's in the <a href="http://git-scm.com/docs/git-svn">docs</a>. What you should do is:</p>
<pre><code>git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
</code></pre>
<p>to fetch the <code>svn</code> meta-branches. Then you'll be able to <code>git-svn rebase</code> without fetc... | <p>It's in the <a href="http://git-scm.com/docs/git-svn">docs</a>. What you should do is:</p> <pre><code>git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*' git fetch </code></pre> <p>to fetch the <code>svn</code> meta-branches. Then you'll be able to <code>git-svn rebase</code> without fetc... | 63, 119, 6452 | git, git-svn, svn | <h1>Cloning a git-svn repository with svn metadata</h1>
<p>I've cloned my main repository with <code>git-svn clone svn://url/trunk --stdlayout</code>. Now I want to clone the repository, with the svn meta data. So that I'll be able to <code>git-svn rebase</code> it to the main server.</p>
<p>Note, I don't want to push... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,084 | git | # Cloning a git-svn repository with svn metadata
I've cloned my main repository with `git-svn clone svn://url/trunk --stdlayout`. Now I want to clone the repository, with the svn meta data. So that I'll be able to `git-svn rebase` it to the main server.
Note, I don't want to push commits between two `git-svn` clones,... | It's in the [docs](http://git-scm.com/docs/git-svn). What you should do is:
```
git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
```
to fetch the `svn` meta-branches. Then you'll be able to `git-svn rebase` without fetching everything from scratch.
---
Quoting from the docs:
... |
61138832 | Improve azure pipeline performance by reducing checkout time | 22 | 2020-04-10 10:55:37 | <p>We have been using azure devops for a while now, and we have a very large suite in a repository, with an extensive yaml pipeline. It has all kinds of parallel jobs, and we have multiple hosted agents available to run the jobs in parallel. In order to speed up builds, I'm doing all kinds of optimizations (like cachin... | 21,910 | 1,141,404 | 2023-07-23 18:39:06 | 61,143,153 | 29 | 2020-04-10 15:07:09 | 7,146,596 | 2020-04-10 15:12:20 | https://stackoverflow.com/q/61138832 | https://stackoverflow.com/a/61143153 | <p>The checkout behaviour can be customized by the <code>checkout</code> keyword. In particular it is possible to specify the <code>fetchDepth</code> (defaults to no limit) to do a shallow fetch, which could improve performance.</p>
<p>From the Azure devops docs on <a href="https://learn.microsoft.com/en-us/azure/devo... | <p>The checkout behaviour can be customized by the <code>checkout</code> keyword. In particular it is possible to specify the <code>fetchDepth</code> (defaults to no limit) to do a shallow fetch, which could improve performance.</p> <p>From the Azure devops docs on <a href="https://learn.microsoft.com/en-us/azure/devo... | 119, 116537, 119596 | azure-devops, azure-pipelines, git | <h1>Improve azure pipeline performance by reducing checkout time</h1>
<p>We have been using azure devops for a while now, and we have a very large suite in a repository, with an extensive yaml pipeline. It has all kinds of parallel jobs, and we have multiple hosted agents available to run the jobs in parallel. In order... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,085 | git | # Improve azure pipeline performance by reducing checkout time
We have been using azure devops for a while now, and we have a very large suite in a repository, with an extensive yaml pipeline. It has all kinds of parallel jobs, and we have multiple hosted agents available to run the jobs in parallel. In order to speed... | The checkout behaviour can be customized by the `checkout` keyword. In particular it is possible to specify the `fetchDepth` (defaults to no limit) to do a shallow fetch, which could improve performance.
From the Azure devops docs on [Shallow Fetch](https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/pipeli... |
39465453 | How to force pull before push | 22 | 2016-09-13 08:28:23 | <p>Every time I want to push my commits (<code>git commit -m "message"</code>, <code>git push origin <branch></code>), I do a pull (<code>git pull origin <branch></code>).<br>
Is there any way to make git do a pull before performing my push? (on the same branch)</p>
| 13,491 | 6,006,686 | 2016-09-21 22:14:43 | 39,627,389 | 29 | 2016-09-21 22:14:43 | 4,117,083 | 2016-09-21 22:14:43 | https://stackoverflow.com/q/39465453 | https://stackoverflow.com/a/39627389 | <p>The Git way to do this is with <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">customize Git hooks</a>.</p>
<p>In your case, you will need to go to the <code>.git/hooks</code> directory on your repository, and add a file named <code>pre-push</code>, which is a script of your choice, e.g. (bash in... | <p>The Git way to do this is with <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">customize Git hooks</a>.</p> <p>In your case, you will need to go to the <code>.git/hooks</code> directory on your repository, and add a file named <code>pre-push</code>, which is a script of your choice, e.g. (bash in... | 119, 28896, 28898 | git, git-pull, git-push | <h1>How to force pull before push</h1>
<p>Every time I want to push my commits (<code>git commit -m "message"</code>, <code>git push origin <branch></code>), I do a pull (<code>git pull origin <branch></code>).<br>
Is there any way to make git do a pull before performing my push? (on the same branch)</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,090 | git | # How to force pull before push
Every time I want to push my commits (`git commit -m "message"`, `git push origin <branch>`), I do a pull (`git pull origin <branch>`).
Is there any way to make git do a pull before performing my push? (on the same branch) | The Git way to do this is with [customize Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).
In your case, you will need to go to the `.git/hooks` directory on your repository, and add a file named `pre-push`, which is a script of your choice, e.g. (bash in this example)
```
#!/bin/bash
echo "pull... |
20380013 | Git merge strategies: spaces make default shows no conflict and bring unexpected results | 22 | 2013-12-04 15:59:16 | <p>After many trials, I got this simple test case scenario:</p>
<pre><code>a --> b --> c -- (master)
\ \
--> d --> b' --> e (branch)
</code></pre>
<p>Where:</p>
<ul>
<li><code>b'</code> is a cherry pick of <code>b</code></li>
<li><code>e</code> is a <em>merge</em> from <code>master... | 7,856 | 274,502 | 2013-12-04 16:21:48 | 20,380,529 | 29 | 2013-12-04 16:21:48 | 69,755 | 2013-12-04 16:21:48 | https://stackoverflow.com/q/20380013 | https://stackoverflow.com/a/20380529 | <p>The basic problem is that there is no formal model for what it means to do correct automated merges that do the right thing in every case. In fact, "the right thing" can differ for different use cases in ways which the merge algorithm has no idea about. There have been a variety of attempts to come up with a single,... | <p>The basic problem is that there is no formal model for what it means to do correct automated merges that do the right thing in every case. In fact, "the right thing" can differ for different use cases in ways which the merge algorithm has no idea about. There have been a variety of attempts to come up with a single,... | 119, 717, 28897 | git, git-merge, merge | <h1>Git merge strategies: spaces make default shows no conflict and bring unexpected results</h1>
<p>After many trials, I got this simple test case scenario:</p>
<pre><code>a --> b --> c -- (master)
\ \
--> d --> b' --> e (branch)
</code></pre>
<p>Where:</p>
<ul>
<li><code>b'</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,091 | git | # Git merge strategies: spaces make default shows no conflict and bring unexpected results
After many trials, I got this simple test case scenario:
```
a --> b --> c -- (master)
\ \
--> d --> b' --> e (branch)
```
Where:
- `b'` is a cherry pick of `b`
- `e` is a *merge* from `master`.
`b'` was ... | The basic problem is that there is no formal model for what it means to do correct automated merges that do the right thing in every case. In fact, "the right thing" can differ for different use cases in ways which the merge algorithm has no idea about. There have been a variety of attempts to come up with a single, co... |
11226439 | git blame - ignore uncommitted changes | 22 | 2012-06-27 12:40:04 | <p>Partial output from <code>git blame <file></code>:</p>
<pre><code> ...
d6182477 (<author> 2012-06-22 09:44:02 -0400 239) ...
d6182477 (<author> 2012-06-22 09:44:02 -0400 240) ...
25f98f3f (<author> 2012-06-15 15:44:00 -0400 245) ...
25f98f3f (<aut... | 3,292 | 718,180 | 2012-06-27 15:10:07 | 11,226,471 | 29 | 2012-06-27 12:41:41 | 718,180 | 2012-06-27 12:41:41 | https://stackoverflow.com/q/11226439 | https://stackoverflow.com/a/11226471 | <pre><code>git blame HEAD <file>
</code></pre>
<p>From the <code>git blame</code> manual:</p>
<blockquote>
<p>Annotates each line in the given file with information from the
revision which last modified the line. <strong>Optionally, start annotating
from the given revision.</strong></p>
</blockquote>
| <pre><code>git blame HEAD <file> </code></pre> <p>From the <code>git blame</code> manual:</p> <blockquote> <p>Annotates each line in the given file with information from the revision which last modified the line. <strong>Optionally, start annotating from the given revision.</strong></p> </blockquote> | 119, 21455 | blame, git | <h1>git blame - ignore uncommitted changes</h1>
<p>Partial output from <code>git blame <file></code>:</p>
<pre><code> ...
d6182477 (<author> 2012-06-22 09:44:02 -0400 239) ...
d6182477 (<author> 2012-06-22 09:44:02 -0400 240) ...
25f98f3f (<author> 2012-06... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,093 | git | # git blame - ignore uncommitted changes
Partial output from `git blame <file>`:
```
...
d6182477 (<author> 2012-06-22 09:44:02 -0400 239) ...
d6182477 (<author> 2012-06-22 09:44:02 -0400 240) ...
25f98f3f (<author> 2012-06-15 15:44:00 -0400 245) ...
25f98f3f (<author> ... | ```
git blame HEAD <file>
```
From the `git blame` manual:
> Annotates each line in the given file with information from the
> revision which last modified the line. **Optionally, start annotating
> from the given revision.** |
9848585 | Does git rm remove all history of a file? | 22 | 2012-03-24 02:17:53 | <p>My project has a file <code>foo</code> that I've been using and checking in with <code>git</code>. I just did some refactoring so that I no longer need the file at all. If I do <code>git rm foo</code>, will the file still exist in older commits? Will I be able to check out an older commit and work with the file?<... | 11,588 | 394,763 | 2012-03-24 14:08:32 | 9,848,596 | 29 | 2012-03-24 02:19:16 | 1,024,637 | 2012-03-24 02:19:16 | https://stackoverflow.com/q/9848585 | https://stackoverflow.com/a/9848596 | <p>No, <code>git rm</code> (plus the commit) writes a new tree that reflects the file is no longer present. The entire history of the file, including creation, modifications, and eventual deletion, is present in the history.</p>
| <p>No, <code>git rm</code> (plus the commit) writes a new tree that reflects the file is no longer present. The entire history of the file, including creation, modifications, and eventual deletion, is present in the history.</p> | 119, 5610 | git, rm | <h1>Does git rm remove all history of a file?</h1>
<p>My project has a file <code>foo</code> that I've been using and checking in with <code>git</code>. I just did some refactoring so that I no longer need the file at all. If I do <code>git rm foo</code>, will the file still exist in older commits? Will I be able to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,094 | git | # Does git rm remove all history of a file?
My project has a file `foo` that I've been using and checking in with `git`. I just did some refactoring so that I no longer need the file at all. If I do `git rm foo`, will the file still exist in older commits? Will I be able to check out an older commit and work with the ... | No, `git rm` (plus the commit) writes a new tree that reflects the file is no longer present. The entire history of the file, including creation, modifications, and eventual deletion, is present in the history. |
849265 | Do you need to create a branch to check out a specific git revision? | 22 | 2009-05-11 17:57:28 | <p>A common thing I'd like to do is revert my working copy to a particular revision, do some testing, and then bring it back to the head of my current master. In the past I have naively done a "git checkout hash" only to lose my head. I've since learned I can create a branch and check that out, switch back and delete... | 17,661 | 5,222 | 2011-06-06 13:36:48 | 850,658 | 29 | 2009-05-12 00:33:21 | 36,723 | 2009-05-12 00:33:21 | https://stackoverflow.com/q/849265 | https://stackoverflow.com/a/850658 | <p>Assuming you're already on a branch (which you always should be for changes you want to keep), you can just do</p>
<pre><code>git checkout <revision to check out>
</code></pre>
<p>This will take you off the topic branch you were working on into (no branch), in which the working copy refers directly to a comm... | <p>Assuming you're already on a branch (which you always should be for changes you want to keep), you can just do</p> <pre><code>git checkout <revision to check out> </code></pre> <p>This will take you off the topic branch you were working on into (no branch), in which the working copy refers directly to a comm... | 119 | git | <h1>Do you need to create a branch to check out a specific git revision?</h1>
<p>A common thing I'd like to do is revert my working copy to a particular revision, do some testing, and then bring it back to the head of my current master. In the past I have naively done a "git checkout hash" only to lose my head. I've ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,096 | git | # Do you need to create a branch to check out a specific git revision?
A common thing I'd like to do is revert my working copy to a particular revision, do some testing, and then bring it back to the head of my current master. In the past I have naively done a "git checkout hash" only to lose my head. I've since learn... | Assuming you're already on a branch (which you always should be for changes you want to keep), you can just do
```
git checkout <revision to check out>
```
This will take you off the topic branch you were working on into (no branch), in which the working copy refers directly to a commit ID rather than a branch name a... |
18743715 | Git: Two initial commits | 21 | 2013-09-11 14:18:41 | <p>I have a project which recently began using version control.<br>
There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current <code>master</code> branch.</p>
<p>I ... | 4,260 | 760,706 | 2019-03-29 17:50:44 | 18,743,811 | 29 | 2013-09-11 14:22:51 | 2,725,031 | 2019-03-29 17:50:44 | https://stackoverflow.com/q/18743715 | https://stackoverflow.com/a/18743811 | <p><code>git checkout</code> has an option for exactly such use case: <code>--orphan</code>. </p>
<p>From the Git manual:</p>
<blockquote>
<p><code>--orphan <new_branch></code></p>
<p>Create a new orphan branch, named <code><new_branch></code>, started from <code><start_point></code> and swit... | <p><code>git checkout</code> has an option for exactly such use case: <code>--orphan</code>. </p> <p>From the Git manual:</p> <blockquote> <p><code>--orphan <new_branch></code></p> <p>Create a new orphan branch, named <code><new_branch></code>, started from <code><start_point></code> and swit... | 119, 1879 | branch, git | <h1>Git: Two initial commits</h1>
<p>I have a project which recently began using version control.<br>
There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,098 | git | # Git: Two initial commits
I have a project which recently began using version control.
There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current `master` branch... | `git checkout` has an option for exactly such use case: `--orphan`.
From the Git manual:
> `--orphan <new_branch>`
>
> Create a new orphan branch, named `<new_branch>`, started from `<start_point>` and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history... |
9153134 | Get a preview of "git add -u"? | 21 | 2012-02-05 21:18:14 | <p>I'm trying to write a .gitignore file. I'd like to get a preview of everything that would be added if I were to run "git add -u". Is that possible? Or, if I ran "git add -u", and some stuff got added that I don't want, can I undo the entire thing? Then I'll tweak my .gitignore some more and repeat.</p>
<p>Thanks</p... | 4,446 | 291,701 | 2021-12-01 21:28:01 | 9,153,143 | 29 | 2012-02-05 21:20:45 | 356,746 | 2012-02-05 21:27:05 | https://stackoverflow.com/q/9153134 | https://stackoverflow.com/a/9153143 | <p>I think you're looking for:</p>
<p><code>git add -n</code></p>
<p>.. which is the <code>--dry-run</code> short switch :) </p>
<p>Edit: from the root of the repository, try:</p>
<p><code>git add -n .</code></p>
<p>If you were to mistakenly add files that were supposed to be ignored, and you didn't catch it in th... | <p>I think you're looking for:</p> <p><code>git add -n</code></p> <p>.. which is the <code>--dry-run</code> short switch :) </p> <p>Edit: from the root of the repository, try:</p> <p><code>git add -n .</code></p> <p>If you were to mistakenly add files that were supposed to be ignored, and you didn't catch it in th... | 119 | git | <h1>Get a preview of "git add -u"?</h1>
<p>I'm trying to write a .gitignore file. I'd like to get a preview of everything that would be added if I were to run "git add -u". Is that possible? Or, if I ran "git add -u", and some stuff got added that I don't want, can I undo the entire thing? Then I'll tweak my .gitignore... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,100 | git | # Get a preview of "git add -u"?
I'm trying to write a .gitignore file. I'd like to get a preview of everything that would be added if I were to run "git add -u". Is that possible? Or, if I ran "git add -u", and some stuff got added that I don't want, can I undo the entire thing? Then I'll tweak my .gitignore some mor... | I think you're looking for:
`git add -n`
.. which is the `--dry-run` short switch :)
Edit: from the root of the repository, try:
`git add -n .`
If you were to mistakenly add files that were supposed to be ignored, and you didn't catch it in the dry run, you'd just use:
`git reset HEAD --`
.. which would essentia... |
4225363 | How to Unstage and Discard in a single command in git | 21 | 2010-11-19 13:19:31 | <p>In git,<br>
to unstage a file <code>git reset HEAD <filename></code> is used<br>
to discard changes <code>git checkout <filename></code> is used</p>
<p>Is there a way to combine these two commands in one?</p>
| 9,856 | 285,727 | 2010-11-19 14:29:09 | 4,225,416 | 29 | 2010-11-19 13:27:25 | 279,627 | 2010-11-19 13:27:25 | https://stackoverflow.com/q/4225363 | https://stackoverflow.com/a/4225416 | <p>Try</p>
<pre><code>git checkout HEAD <filename>
</code></pre>
| <p>Try</p> <pre><code>git checkout HEAD <filename> </code></pre> | 119 | git | <h1>How to Unstage and Discard in a single command in git</h1>
<p>In git,<br>
to unstage a file <code>git reset HEAD <filename></code> is used<br>
to discard changes <code>git checkout <filename></code> is used</p>
<p>Is there a way to combine these two commands in one?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,101 | git | # How to Unstage and Discard in a single command in git
In git,
to unstage a file `git reset HEAD <filename>` is used
to discard changes `git checkout <filename>` is used
Is there a way to combine these two commands in one? | Try
```
git checkout HEAD <filename>
``` |
49034675 | Git: How can I split a branch by file (not by commit)? | 20 | 2018-02-28 16:50:24 | <p><strong>Bottom Line:</strong></p>
<p>I want to split up a pull request into two smaller pull requests with different subsets of files. I do not want to split by commit, I want to split by file.</p>
<p><strong>Details:</strong></p>
<p>Suppose I have a branch <code>branch_1</code> (off of the <code>master</code> ... | 7,927 | 851,699 | 2021-06-04 06:11:04 | 55,741,703 | 29 | 2019-04-18 08:09:49 | 3,206,284 | 2019-04-18 10:08:40 | https://stackoverflow.com/q/49034675 | https://stackoverflow.com/a/55741703 | <p>A slightly more convenient way of selecting specific files:</p>
<ul>
<li>create <code>branch_2</code> from <code>master</code></li>
<li>merge <code>branch_1</code> into <code>branch_2</code> with --no-commit and --squash</li>
<li>revert specific files you want excluded from the new branch (*)</li>
<li>commit remain... | <p>A slightly more convenient way of selecting specific files:</p> <ul> <li>create <code>branch_2</code> from <code>master</code></li> <li>merge <code>branch_1</code> into <code>branch_2</code> with --no-commit and --squash</li> <li>revert specific files you want excluded from the new branch (*)</li> <li>commit remain... | 119, 1879, 28897, 64512, 76220 | branch, git, git-branch, git-merge, pull-request | <h1>Git: How can I split a branch by file (not by commit)?</h1>
<p><strong>Bottom Line:</strong></p>
<p>I want to split up a pull request into two smaller pull requests with different subsets of files. I do not want to split by commit, I want to split by file.</p>
<p><strong>Details:</strong></p>
<p>Suppose I have ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,103 | git | # Git: How can I split a branch by file (not by commit)?
**Bottom Line:**
I want to split up a pull request into two smaller pull requests with different subsets of files. I do not want to split by commit, I want to split by file.
**Details:**
Suppose I have a branch `branch_1` (off of the `master` branch) in which... | A slightly more convenient way of selecting specific files:
- create `branch_2` from `master`
- merge `branch_1` into `branch_2` with --no-commit and --squash
- revert specific files you want excluded from the new branch (*)
- commit remaining files in `branch_2`
Now you can either repeat the procedure again with inv... |
43845851 | Make git log produce command output 'inline' | 20 | 2017-05-08 10:55:41 | <p>I do not know how to better word this.</p>
<p>When I run any git log command, it produces an output in a 'window' of its own. I need to hit q to come back to the prompt and then all the log display is gone.</p>
<p>Is there any way to produce the log output 'inline' so the log output is displayed followed by the pr... | 8,272 | 3,282,596 | 2020-07-12 13:31:38 | 43,898,328 | 29 | 2017-05-10 16:42:06 | 2,424,184 | 2017-05-10 16:42:06 | https://stackoverflow.com/q/43845851 | https://stackoverflow.com/a/43898328 | <p>The reason the output of <code>git log</code> does not stay in the terminal history after <code>git</code> exits is that the pager program <code>git</code> uses to display its output emits <a href="https://unix.stackexchange.com/questions/288962/what-does-1049h-and-1h-ansi-escape-sequences-do">escape sequences</a> t... | <p>The reason the output of <code>git log</code> does not stay in the terminal history after <code>git</code> exits is that the pager program <code>git</code> uses to display its output emits <a href="https://unix.stackexchange.com/questions/288962/what-does-1049h-and-1h-ansi-escape-sequences-do">escape sequences</a> t... | 119, 942 | git, logging | <h1>Make git log produce command output 'inline'</h1>
<p>I do not know how to better word this.</p>
<p>When I run any git log command, it produces an output in a 'window' of its own. I need to hit q to come back to the prompt and then all the log display is gone.</p>
<p>Is there any way to produce the log output 'inl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,104 | git | # Make git log produce command output 'inline'
I do not know how to better word this.
When I run any git log command, it produces an output in a 'window' of its own. I need to hit q to come back to the prompt and then all the log display is gone.
Is there any way to produce the log output 'inline' so the log output ... | The reason the output of `git log` does not stay in the terminal history after `git` exits is that the pager program `git` uses to display its output emits [escape sequences](https://unix.stackexchange.com/questions/288962/what-does-1049h-and-1h-ansi-escape-sequences-do) to switch to the alternate display buffer to kee... |
26617862 | Git shallow fetch of a new tag | 20 | 2014-10-28 20:26:48 | <p>If I clone a repository with max depth of 1 at a tag, it works and pulls down just that. If I then want to do a fetch with or without depth of 1 for a new tag, it does some processing, but the tag never shows up under 'git tag'. If I supply the --tags option, it downloads the whole repository rather than just the ... | 7,799 | 4,004,509 | 2014-10-28 22:03:29 | 26,619,302 | 29 | 2014-10-28 22:03:29 | 231,573 | 2014-10-28 22:03:29 | https://stackoverflow.com/q/26617862 | https://stackoverflow.com/a/26619302 | <p>You can use the full <code><refspec></code> format:</p>
<pre><code>git fetch --depth 1 origin refs/tags/1.1:refs/tags/1.1
</code></pre>
<p>Or, as specified in <a href="http://git-scm.com/docs/git-fetch#_options" rel="noreferrer">git-fetch options</a> (under <code><refspec></code>):</p>
<blockquote>
... | <p>You can use the full <code><refspec></code> format:</p> <pre><code>git fetch --depth 1 origin refs/tags/1.1:refs/tags/1.1 </code></pre> <p>Or, as specified in <a href="http://git-scm.com/docs/git-fetch#_options" rel="noreferrer">git-fetch options</a> (under <code><refspec></code>):</p> <blockquote> ... | 119, 74346 | git, shallow-clone | <h1>Git shallow fetch of a new tag</h1>
<p>If I clone a repository with max depth of 1 at a tag, it works and pulls down just that. If I then want to do a fetch with or without depth of 1 for a new tag, it does some processing, but the tag never shows up under 'git tag'. If I supply the --tags option, it downloads th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,105 | git | # Git shallow fetch of a new tag
If I clone a repository with max depth of 1 at a tag, it works and pulls down just that. If I then want to do a fetch with or without depth of 1 for a new tag, it does some processing, but the tag never shows up under 'git tag'. If I supply the --tags option, it downloads the whole rep... | You can use the full `<refspec>` format:
```
git fetch --depth 1 origin refs/tags/1.1:refs/tags/1.1
```
Or, as specified in [git-fetch options](http://git-scm.com/docs/git-fetch#_options) (under `<refspec>`):
> *`tag <tag>`* means the same as *`refs/tags/<tag>:refs/tags/<tag>`*; it
> requests fetching everything up ... |
16440433 | Merge a branch with Git Flow keeping the branch still alive | 20 | 2013-05-08 12:15:13 | <p>I'm starting using <a href="https://github.com/nvie/gitflow" rel="noreferrer">git flow</a> and I understand that doing:</p>
<pre><code>git flow feature start my-feature
git flow feature finish my-feature
</code></pre>
<p>I create a feature and then, when i've finished my changes, I merge it with the develop branch... | 12,587 | 580,131 | 2018-10-24 09:10:58 | 16,440,520 | 29 | 2013-05-08 12:19:29 | 572,644 | 2013-08-21 20:28:53 | https://stackoverflow.com/q/16440433 | https://stackoverflow.com/a/16440520 | <p>Simply use <code>git flow feature finish -k my-feature</code></p>
<p>Reference: <a href="https://github.com/nvie/gitflow/wiki/Command-Line-Arguments" rel="noreferrer">https://github.com/nvie/gitflow/wiki/Command-Line-Arguments</a></p>
<p>About your second question:</p>
<p>You normally don't merge feature branches... | <p>Simply use <code>git flow feature finish -k my-feature</code></p> <p>Reference: <a href="https://github.com/nvie/gitflow/wiki/Command-Line-Arguments" rel="noreferrer">https://github.com/nvie/gitflow/wiki/Command-Line-Arguments</a></p> <p>About your second question:</p> <p>You normally don't merge feature branches... | 119, 717, 64339 | git, git-flow, merge | <h1>Merge a branch with Git Flow keeping the branch still alive</h1>
<p>I'm starting using <a href="https://github.com/nvie/gitflow" rel="noreferrer">git flow</a> and I understand that doing:</p>
<pre><code>git flow feature start my-feature
git flow feature finish my-feature
</code></pre>
<p>I create a feature and th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,106 | git | # Merge a branch with Git Flow keeping the branch still alive
I'm starting using [git flow](https://github.com/nvie/gitflow) and I understand that doing:
```
git flow feature start my-feature
git flow feature finish my-feature
```
I create a feature and then, when i've finished my changes, I merge it with the develo... | Simply use `git flow feature finish -k my-feature`
Reference: <https://github.com/nvie/gitflow/wiki/Command-Line-Arguments>
About your second question:
You normally don't merge feature branches repeatedly into `develop`. You merge `develop` into the feature branches (i.e. the other way around) or rebase the feature ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.