| git push origin <tag_name>
|
https://snipt.net/embed/c26ef96bd24d69db2273cdd03991bcc9/
/raw/c26ef96bd24d69db2273cdd03991bcc9/
c26ef96bd24d69db2273cdd03991bcc9
text
Text only
1
2025-04-03T15:27:42
True
False
False
Jun 08, 2023 at 01:55 PM
/api/public/snipt/122/
push-with-tag
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git push origin <tag_name>
</span></pre></div>
</td></tr></table>
git
| git branch -D branch_name
git push ascend -d branch_name
|
https://snipt.net/embed/d03543e5094e8e9327d0e09d790ce137/
/raw/d03543e5094e8e9327d0e09d790ce137/
d03543e5094e8e9327d0e09d790ce137
text
Text only
3
2025-04-03T18:51:29
True
False
False
May 22, 2023 at 07:44 PM
/api/public/snipt/121/
delete-branch-local-and-remote
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git branch -D branch_name
</span><span id="L-2"><a name="L-2"></a>git push ascend -d branch_name
</span></pre></div>
</td></tr></table>
git
| git revert -m 1 <merge-commit-hash>
|
https://snipt.net/embed/d9432524940114c0aa385cebc14a0780/
/raw/d9432524940114c0aa385cebc14a0780/
d9432524940114c0aa385cebc14a0780
text
Text only
1
2025-04-03T18:51:30
True
False
False
Apr 14, 2023 at 01:28 PM
/api/public/snipt/120/
revert-merge-commit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git revert -m 1 <merge-commit-hash>
</span></pre></div>
</td></tr></table>
git
| git commit --amend -m "xxxx merge into xx resolve conflict"
|
https://snipt.net/embed/4b22fc4298bdcb821c6e3618c53d674c/
/raw/4b22fc4298bdcb821c6e3618c53d674c/
4b22fc4298bdcb821c6e3618c53d674c
text
Text only
1
2025-04-03T18:52:19
True
False
False
/api/public/snipt/119/
update-last-commit-message
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git commit --amend -m "xxxx merge into xx resolve conflict"
</span></pre></div>
</td></tr></table>
git
| # Check the log to get the hash
git log --oneline
git reset --hard <hash>
|
https://snipt.net/embed/31a8fbd4a05e38940ca39a079524ee64/
/raw/31a8fbd4a05e38940ca39a079524ee64/
31a8fbd4a05e38940ca39a079524ee64
text
Text only
5
2025-04-03T18:49:38
True
False
False
Sep 24, 2021 at 01:16 PM
/api/public/snipt/118/
git-revert-to-previous-commit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a># Check the log to get the hash
</span><span id="L-2"><a name="L-2"></a>git log --oneline
</span><span id="L-3"><a name="L-3"></a>
</span><span id="L-4"><a name="L-4"></a>git reset --hard <hash>
</span></pre></div>
</td></tr></table>
git
| git push -f <remote> <branch>
e.g. git push -f origin master <-- Don't use master
Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.
|
https://snipt.net/embed/501243ea466193f664fac3097323f58c/
/raw/501243ea466193f664fac3097323f58c/
501243ea466193f664fac3097323f58c
text
Text only
5
2025-04-03T15:32:05
True
False
False
/api/public/snipt/113/
force-push-branch
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git push -f <remote> <branch>
</span><span id="L-2"><a name="L-2"></a>
</span><span id="L-3"><a name="L-3"></a>e.g. git push -f origin master <-- Don't use master
</span><span id="L-4"><a name="L-4"></a>
</span><span id="L-5"><a name="L-5"></a>Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.
</span></pre></div>
</td></tr></table>
git
| git log origin/master..hotfix57981
git fetch origin
git merge origin/master
git diff origin/master..hotfxi57981
|
https://snipt.net/embed/3ca7979752696c6264ebb3ce025b65c2/
/raw/3ca7979752696c6264ebb3ce025b65c2/
3ca7979752696c6264ebb3ce025b65c2
text
Text only
7
2025-03-28T14:02:44
True
False
False
Nov 06, 2020 at 07:14 PM
/api/public/snipt/112/
git-compare-to-master
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a>
<a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git log origin/master..hotfix57981
</span><span id="L-2"><a name="L-2"></a>
</span><span id="L-3"><a name="L-3"></a>git fetch origin
</span><span id="L-4"><a name="L-4"></a>git merge origin/master
</span><span id="L-5"><a name="L-5"></a>
</span><span id="L-6"><a name="L-6"></a>git diff origin/master..hotfxi57981
</span></pre></div>
</td></tr></table>
git
| git checkout -b [name_of_your_new_branch]
git push -u ascend [name_of_your_new_branch]
No Need: git branch --set-upstream-to=origin/[name_of_your_new_branch] [name_of_your_new_branch]
|
https://snipt.net/embed/0c2c73ce066fea216bf19f062b6b8433/
/raw/0c2c73ce066fea216bf19f062b6b8433/
0c2c73ce066fea216bf19f062b6b8433
text
Text only
3
2025-04-03T18:12:12
True
False
False
Oct 06, 2022 at 07:42 PM
/api/public/snipt/110/
create-branch
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git checkout -b [name_of_your_new_branch]
</span><span id="L-2"><a name="L-2"></a>git push -u ascend [name_of_your_new_branch]
</span><span id="L-3"><a name="L-3"></a>No Need: git branch --set-upstream-to=origin/[name_of_your_new_branch] [name_of_your_new_branch]
</span></pre></div>
</td></tr></table>
git
| git init
git add .
git commit
git remote add origin https://jbmckee@bitbucket.org/jbmckee/snaprsend.git
git push -u origin master
|
https://snipt.net/embed/a08e51b4dff275fc1d931fd7584c3799/
/raw/a08e51b4dff275fc1d931fd7584c3799/
a08e51b4dff275fc1d931fd7584c3799
text
Text only
6
2025-04-02T17:50:47
True
False
False
May 16, 2018 at 02:12 AM
/api/public/snipt/60/
existing-files-to-git
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git init
</span><span id="L-2"><a name="L-2"></a>git add .
</span><span id="L-3"><a name="L-3"></a>git commit
</span><span id="L-4"><a name="L-4"></a>git remote add origin https://jbmckee@bitbucket.org/jbmckee/snaprsend.git
</span><span id="L-5"><a name="L-5"></a>git push -u origin master
</span></pre></div>
</td></tr></table>
git
| git fetch --all
git reset --hard origin/master
git reset --hard ascend/master
Better to discard changes:
git checkout -- .
Remove all untracked:
git clean -fd
|
Expand
Collapse
(10 lines)
https://snipt.net/embed/83e604a1f31d49dd00b3d08c109a13ce/
/raw/83e604a1f31d49dd00b3d08c109a13ce/
83e604a1f31d49dd00b3d08c109a13ce
text
Text only
10
2025-04-02T01:11:58
True
False
False
/api/public/snipt/7/
hard-pull-overwrite
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a>
<a href="#L-2">2</a>
<a href="#L-3">3</a>
<a href="#L-4">4</a>
<a href="#L-5">5</a>
<a href="#L-6">6</a>
<a href="#L-7">7</a>
<a href="#L-8">8</a>
<a href="#L-9">9</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git fetch --all
</span><span id="L-2"><a name="L-2"></a>git reset --hard origin/master
</span><span id="L-3"><a name="L-3"></a>git reset --hard ascend/master
</span><span id="L-4"><a name="L-4"></a>
</span><span id="L-5"><a name="L-5"></a>Better to discard changes:
</span><span id="L-6"><a name="L-6"></a>git checkout -- .
</span><span id="L-7"><a name="L-7"></a>
</span><span id="L-8"><a name="L-8"></a>Remove all untracked:
</span><span id="L-9"><a name="L-9"></a>git clean -fd
</span></pre></div>
</td></tr></table>
git