/**
Remote branch and tags
*/
$ git checkout -b shopping_cart //switched to a new branch 'shopping_cart' and checkout(Locally)
$ git push origin shopping_cart //Links local branch to the remote branch (remote tracking)
$ git add cart.rb
$ git commit -a -m "Add basic art ability"
$ git push //Now, we put all the local stuff to the remote branch shopping_cart
//If use:
$ git branch
* master
/*You will not see the remote branch, By using:*/
$ git branch -r //list all remote branches
origin/master
origin/shopping_cart
$ git checkout shopping_cart
Switch to a new branch shopping_cart
/*Remote show*/
$ git remote show origin
/*Removing a branch*/
$ git push origin :shopping_cart //deletes remote branch, you still have local branch
$ git branch -d shopping _cart
//It might show the error: The branch 'shopping_cart' is not fully merged.
//If you really want to delete it:
$ git branch -D shopping_cart
/*To clean up deleted remote branches*/
$ git remote prune origin //remove branch reference
/*Remote branch names*/
//heroku-staging: only deploy on the master branch
//if you do:
$ git push heroku-staging staging
Would not work, would push to staging
$ git push heroku-staging staging:master
Will push and deploy staging on keroku
/**
Tagging
*/
/*A tag is a reference to commit relase versioning*/
$ git tag
v0.0.1
v0.0.2
$git checkout v0.0.1 checkout code at commit
//To add a new tag
$ git tag -a v0.0.3 -m "version 0.0.3"
//To push new tags
$ git push --tags
//Retrive tag version
$ git checkout v1.3.1
------------------------------------------
1. create a local branch hamsters
$ git branch hamsters
2. check out the local branch
$ git checkout -b hamsters
3. push local branch to the remote branch
$ git push origin hamsters
4. "git branch -r" does not query the remotes to check for new branches.
In order to see a new remote branch you first have to do a fetch or a pull. So retrieve the remote "weasel" branch
$ git fetch
5. Get a list of remote branches
$ git branch -r
6. delete the remote branch
$ git push origin :weasel
7. Check for stale branches that are tracking "origin"
$ git remote show origin
8. You still have a stale local branch tracking the now-deleted origin/weasel. Clean up your local references.
$ git remote prune origin
9. List tag
$ git tag
10. create new tag
$ git tag -a v1.3.2 -m "Version1.3.2"
11. push tag
$ git push --tags
12. The client is requesting that you roll back to the prior release. (Seriously? What could have gone wrong with the hamsters?) Retrieve the release tagged "v1.3.1".
$ git checkout v1.3.1
13. git checkout tags/1.0.0 -b <new_branch_name>