Git Quick Start ( Bitbucket )

Create BitBucket Repo

Repository View

Clone Repo Button & Modal

 

Create a batch file to simplify git operations.

I prefer to leave path settings alone & manage in environment settings in startup scripts

set path=%path%;C:\a\d\apps\git\bin
W:
cd W:\w\git
cmd /K

Go to Git Repos folder

cd w:\w\git

git clone

W:\w\git>C:\a\d\apps\git\bin\git clone https://unityconstruct@bitbucket.org/unityconstruct/bitbucketstationlocations.git

Cloning into 'bitbucketstationlocations'...
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Password for 'https://unityconstruct@bitbucket.org':
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.

W:\w\git>cd bitbucketstationlocations

W:\w\git\bitbucketstationlocations>dir
Volume in drive W is W[500
Volume Serial Number is 9821-D068

 Directory of W:\w\git\bitbucketstationlocations

09/02/2018  12:43 AM    <DIR>          .
09/02/2018  12:43 AM    <DIR>          ..
09/02/2018  12:43 AM             2,666 README.md
               1 File(s)          2,666 bytes
               2 Dir(s)  335,946,764,288 bytes free

git clone NO HISTORY

git clone --depth 1 

Create a text file in the repo

W:\w\git\bitbucketstationlocations>echo "Earth's Moon" >> locations.txt

W:\w\git\bitbucketstationlocations>dir

09/02/2018  12:44 AM                17 locations.txt
09/02/2018  12:43 AM             2,666 README.md

git Status

W:\w\git\bitbucketstationlocations>git status

On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        locations.txt

nothing added to commit but untracked files present (use "git add" to track)

git add

W:\w\git\bitbucketstationlocations>git add locations.txt

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

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   locations.txt

git commit

W:\w\git\bitbucketstationlocations>git commit -m "Initial Commit"
[master ab660e6] Initial Commit
 1 file changed, 1 insertion(+)
 create mode 100644 locations.txt

git push origin master

W:\w\git\bitbucketstationlocations>git commit -m "Initial Commit"
[master ab660e6] Initial Commit
 1 file changed, 1 insertion(+)
 create mode 100644 locations.txt

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: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 283 bytes | 283.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://bitbucket.org/unityconstruct/bitbucketstationlocations.git
   eccbc4b..ab660e6  master -> master

git status

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

nothing to commit, working tree clean

 

Add File to BitBucket Repo

<images>

git pull

W:\w\git\bitbucketstationlocations>git pull --all
Fetching origin
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Password for 'https://unityconstruct@bitbucket.org':
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://bitbucket.org/unityconstruct/bitbucketstationlocations
   ab660e6..b15c6bf  master     -> origin/master
Updating ab660e6..b15c6bf
Fast-forward
 stationlocations | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 stationlocations

 

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

<Images>

 

Tags