Git Branching*

 

  • this string worked for re-configuring my remote repo in eclipse...
  • .. need to look into the specs on this
  • ..my repo wasn't fetching new branches so I might have created a new branch that wasn't in the remote repo & things got off track
+refs/heads/*:refs/remotes/origin/*

 

 

Create branch & add file

Create branch phase0

git branch phase0

git checkout phase0

add file phase0.txt

git commit -m "message"

git push origin phase0

 

Checkout Master branch & add file

git checkout master

add master-phase0.txt

commit

push

 

 

Checkout Phase0 branch & update file

change phase0.txt

git commit  -m "message"

git push origin phase0

 

 

 

 

 

 

 

 

 

 

 

Creating a Branch & Making a Change

W:\w\git\bitbucketstationlocations>git branch future-plans

Checkout the branch

W:\w\git\bitbucketstationlocations>git checkout future-plans
Switched to branch 'future-plans'

Modify Locations.txt

Add

<p>

    <b>Mars</b><br>

    Recreation Department

</p>

git status

W:\w\git\bitbucketstationlocations>git status
On branch future-plans
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   locations.txt

no changes added to commit (use "git add" and/or "git commit -a")

W:\w\git\bitbucketstationlocations>git add stationlocations

git commit ( branch )

W:\w\git\bitbucketstationlocations>git commit -m "making a change in a branch"
[future-plans 87f7b66] making a change in a branch
1 file changed, 7 insertions(+)

Fast-Forward Merge

When only the Branch has changed & Master has NOT changed, the fast-forward merge simply imports the branch histories & move the Master pointer to the branch.

git status

W:\w\git\bitbucketstationlocations>git status
On branch future-plans
nothing to commit, working tree clean

git checkout master

W:\w\git\bitbucketstationlocations>git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

get merge future-plans

W:\w\git\bitbucketstationlocations>git merge future-plans
Updating b15c6bf..b92edb6
Fast-forward
 locations.txt    | 2 +-
 stationlocations | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Deleting A branch

git branch -d future-plans

W:\w\git\bitbucketstationlocations>git branch -d future-plans
Deleted branch future-plans (was b92edb6).

git status

W:\w\git\bitbucketstationlocations>git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

git push origin master

W:\w\git\bitbucketstationlocations>git push origin master
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Password for 'https://unityconstruct@bitbucket.org':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://bitbucket.org/unityconstruct/bitbucketstationlocations.git
   b15c6bf..b92edb6  master -> master

BitBucket Results

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Tags