Push and Pull Operation is Git

We suggest to go through below posts if you are new to Git.

Distributed Version Control System: Git

Git Installation for Windows and Linux

Setting Up Central/Remote Git Repository in Bitbucket

Clone Process in Git and Local Repository Operations


Push changes from your local Git repository to Bitbucket –

1.) git push – Run “git push origin master” which means push changes to the master branch on origin (where origin is the Bitbucket server).

[root@thinknyx~]#pwd
/home/thinknyx/repo/thinknyxdemo

[root@thinknyx~]#git push origin master
Password for ‘https://[email protected]’:
Counting objects: 4, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 370 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://[email protected]/thinknyxtechnologies/thinknyxdemo.git
* [new branch]      master -> master
[root@thinknyx~]#

2.) Now go to Bitbucket and check the changes are reflected or not. Then click commit, and approve the changes if they seems to be okay.

Pull changes from Central Bitbucket repository –

1.) Lets create a file inside “thinknyxdemo” repository, login to Bitbucket, click source and then “new file”.

2.) Created “demothree” file and commit it and approve it from commit section.

3.) Now lets pull the changes from Bitbucket to local repository.

[root@thinknyx~]#pwd
/home/thinknyx/repo/thinknyxdemo

[root@thinknyx~]#git pull –all
Fetching origin
Password for ‘https://[email protected]’:
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/thinknyxtechnologies/thinknyxdemo
c06e9fc..6f0ac28  master     -> origin/master
Updating c06e9fc..6f0ac28
Fast-forward
demothree | 1 +
1 file changed, 1 insertion(+)
create mode 100644 demothree
[root@thinknyx~]#

[root@thinknyx~]#ls -lrt
total 12
-rw-r–r– 1 root root 47 May 15 01:55 demofile
-rw-r–r– 1 root root 59 May 15 01:55 demotwofile
-rw-r–r– 1 root root 54 May 15 02:58 demothree

[root@thinknyx~]#cat demothree
“This is a Pull Demo for Git by Thinknyx Technologies”

With this demo we are all done with essentials Git setup and operations. Next we will move with Branching in Git in our next posts.

Leave a Comment

Your email address will not be published.