Difference between revisions of "Git"

From Athenaeum
Jump to: navigation, search
m (1 revision imported)
 
Line 1: Line 1:
 
[[Category:linux]]
 
[[Category:linux]]
 +
=Random=
 
*To list tags
 
*To list tags
 
:<pre>git tag -l</pre>
 
:<pre>git tag -l</pre>
Line 5: Line 6:
 
*Extract a tag from a git repo
 
*Extract a tag from a git repo
 
:<pre>git archive --format zip --output /full/path/to/zipfile.zip {tag name}</pre>
 
:<pre>git archive --format zip --output /full/path/to/zipfile.zip {tag name}</pre>
 +
 +
=Rename A Branch=
 +
1. Rename branch locally
 +
<pre>git branch -m old_branch new_branch</pre>
 +
2. Delete the old branch
 +
<pre>git push origin :old_branch</pre>
 +
3. Push the new branch, set local branch to track the new remote
 +
<pre>git push --set-upstream origin new_branch</pre>

Latest revision as of 10:46, 5 April 2019

Random

  • To list tags
git tag -l
  • Extract a tag from a git repo
git archive --format zip --output /full/path/to/zipfile.zip {tag name}

Rename A Branch

1. Rename branch locally

git branch -m old_branch new_branch

2. Delete the old branch

git push origin :old_branch

3. Push the new branch, set local branch to track the new remote

git push --set-upstream origin new_branch