Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Thursday, December 13, 2012

git deleting remote branch

deleting a remote branch is rather clunky, but easy:

git push origin :branch

please ensure that you have the colon (:) infront of your branch name to ensure that the branch will deleted.

git memorizing branches


First, you must create your branch locally
git checkout -b your_branch
After that, you can work locally in your branch, when you are ready to share the branch, push it. The next command push the branch to the remote repository origin and tracks it
git push -u origin your_branch
Teammates can reach your branch, by doing:
git fetch
git checkout origin/your_branch
You can continue working in the branch and pushing whenever you want without passing arguments to git push (argumentless git push will push the master to remote master, your_branch local to remote your_branch, etc...)
git push
Teammates can push to your branch by doing commits and then push explicitly
... work ...
git commit
... work ...
git commit
git push origin HEAD:refs/heads/your_branch
Or tracking the branch to avoid the arguments to git push
git checkout --track -b your_branch origin/your_branch
... work ...
git commit
... work ...
git commit
git push
Found at stackoverflow

Thursday, August 23, 2012

relocating a git repository

Recently I started creating a new project, with the amazing name 'alchemy'. Sadly it turned out that this name was already taken on google code. So to start working on it I had to create a temporary project on google code and once I managed to get my greedy fingers on the others project name (successful I might add!) ...

...I had now the challenge to move my dozen or so lines of codes over to the new repository.

Now I'm the first one to admit, I'm still kinda green with 'git' and have only used it in the past on 1 or 2 little project and never on anything real. So how complicate will it be to move the code and not loose your complete history of commit (all 7 of them...)

Surprisingly easy it turns out, just issue the following magic commands and you are all set.

  1. git remote add alchemy https://code.google.com/p/alchemy/
  2. git push alchemy master
  3. git remote rm origin
  4. git remote add origin https://code.google.com/p/alchemy/
  5. git remote rm alchemy
Now looking at this, I'm quite sure I could had simplified this even more, but for now it got the job done.