Skip to content

Instantly share code, notes, and snippets.

@pfmaggi
Last active February 11, 2016 13:40
Show Gist options
  • Save pfmaggi/0728df4e30b45e1804f4 to your computer and use it in GitHub Desktop.
Save pfmaggi/0728df4e30b45e1804f4 to your computer and use it in GitHub Desktop.
Git bits and Pieces

Create a tag and push it to remote

First we can list the current tags

git tag

Then we create a new tag

git tag <tag_name>

and then we push it to remote

git push --tags

Git Fetch remote over local repository (loosing local changes)

First of all we fetch remote :

git fetch --all

Then we switch to the branch; in this case master, can be whatever branch you've in your repository

git reset --hard origin/master

Create a new branch and push to remote

Taken from answer on stackoverflow:

In recent Git 1.7.0+ you can do the following:

$ git checkout -b feature_branch_name

... edit files, add and commit ...

$ git push -u origin feature_branch_name

Delete files from the repo

Once the files are deleted locally (with git rm --cached), you would still need to do:

$ git add -A .
$ git commit -m "record deletion"
$ git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment