Git tips

From regional-training
Revision as of 20:50, 9 August 2022 by Ralph (talk | contribs) (Created page with "=reset git working to master= * update all your refs to the latest git fetch --all * Backup your current branch: git checkout -b backup-master * Then, you have two options: git reset --hard origin/master git reset --hard origin/<branch_name> =git tags= * add a local tag git tag -a tagname [checkin-version] -m 'message' * delete a local tag git tag -d tagname * push one tag to remote git push origin tag * push multiple tags git push --tags * delete a re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

reset git working to master

  • update all your refs to the latest
git fetch --all
  • Backup your current branch:
git checkout -b backup-master
  • Then, you have two options:
git reset --hard origin/master
git reset --hard origin/<branch_name>

git tags

  • add a local tag
 git tag -a tagname [checkin-version] -m 'message'
  • delete a local tag
 git tag -d tagname
  • push one tag to remote
 git push origin tag
  • push multiple tags
git push --tags
  • delete a remote tag
git push origin --delete tag
  • obtain all tags from remote
git fetch --all --tags

It is customary to prefix version tag names with V followed by the version.

references


category