Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created March 11, 2009 14:39
Show Gist options
  • Select an option

  • Save gerhard/77495 to your computer and use it in GitHub Desktop.

Select an option

Save gerhard/77495 to your computer and use it in GitHub Desktop.
### FETCHES REMOTE CONTENT, DOESN'T MERGE
gerhardlazu@dino:aspire (master) $ git fetch github
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git@github.com:jgp/aspire
7ed735f..2773252 master -> github/master
* [new branch] springbok2 -> github/springbok2
### CREATED A NEW BRANCH TO TRACK THE REMOTE ONE
gerhardlazu@dino:aspire (master) $ git checkout -b tmp_branch github/springbok
Branch tmp_branch set up to track remote branch refs/remotes/github/springbok.
Switched to a new branch "tmp_branch"
gerhardlazu@dino:aspire (tmp_branch) $ touch test.txt
gerhardlazu@dino:aspire (tmp_branch) $ gst
# On branch tmp_branch
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test.txt
nothing added to commit but untracked files present (use "git add" to track)
gerhardlazu@dino:aspire (tmp_branch) $ git add .
gerhardlazu@dino:aspire (tmp_branch) $ gc -m "Temporary commit"
Created commit 4bbcbaf: Temporary commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt
### PUSHING THE TIP OF THE CURRENT BRANCH TO REMOTE SPRINGBOK BRANCH
gerhardlazu@dino:aspire (tmp_branch) $ git push github HEAD:springbok
warning: no threads support, ignoring pack.threads
Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 270 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
To git@github.com:jgp/aspire.git
a957699..4bbcbaf HEAD -> springbok
### DELETING LAST COMMIT
gerhardlazu@dino:aspire (tmp_branch) $ git reset --hard HEAD^
HEAD is now at a957699 If there's content in the database for the register partial, don't display the one in the partial
### FORCE UPDATING REMOTE SPRINGBOK BRANCH - DELETING LAST COMMIT
gerhardlazu@dino:aspire (tmp_branch) $ git push -f github HEAD:springbok
warning: no threads support, ignoring pack.threads
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:jgp/aspire.git
+ 4bbcbaf...a957699 HEAD -> springbok (forced update)
gerhardlazu@dino:aspire (tmp_branch) $ git checkout springbok
Switched to branch "springbok"
gerhardlazu@dino:aspire (springbok) $ git branch -d tmp_branch
Deleted branch tmp_branch.
### MERGING REMOTE SPRINGBOK2 INTO LOCAL SPRINGBOK
gerhardlazu@dino:aspire (springbok) $ git merge github/springbok2
Updating a957699..bc5b1ae
Fast forward
config/environments/production.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
### PUSHING LOCAL COMMITS TO GITHUB
gerhardlazu@dino:aspire (springbok) $ git push github
warning: no threads support, ignoring pack.threads
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:jgp/aspire.git
a957699..bc5b1ae springbok -> springbok
! [rejected] master -> master (non-fast forward) <<< THIS ONE IS AHEAD OF MY LOCAL MASTER, NEEDS MERGING FIRST, THEN I CAN COMMIT
error: failed to push some refs to 'git@github.com:jgp/aspire.git'
### DELETING REMOTE SPRINGBOK2 BRANCH
gerhardlazu@dino:aspire (springbok) $ git push github :springbok2
To git@github.com:jgp/aspire.git
- [deleted] springbok2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment