What is Source Code Management & version control :

  • While working on important projects like websites, software, desktop or mobile application it becomes necessary to handle the source code at a safe place. Specifically in websites & applications requires regular updates & each time the source will be updated too. So it’s important to keep the back up of the source code.
  • Also, there are some cases where multiple persons working as a team on the same project so at that time they will work on the similar source code. So at that time its good to maintain the backup regularly so if any issue arrives at any stage we can roll back the changes or can recover from the issue by using back source.
  • Developers often keep the backup on their local systems or the generic servers where whole organization source code is maintained. Now consider a case when if any hardware issue arrives & you couldn’t be able to recover the source from the local system it can become severe issue & cost you a lot. So there would be a common solution where we should be able to manage the latest source code as well as we can manage version control.

 

What is Bitbucket & how it helps :

  • Bitbucket is basically a hosting service which allows you to sign in for free & allows to create repositories where you can take backup of your source code & perform some advanced operations as well
  • Storing a source code on bitbucket is not only free but it’s also a safe option. Consider if you are working on 40-50 projects where it becomes tidy for you to keep back of all of the projects on your local system. Now if you use Bitbucket, in that case, you can manage all of your source codes & keep your system free
  • What you can do is once you complete the update of your app or website then upload final source on bitbucket
  • Now later on when new version update arrives you can get the latest source from the bitbucket do modifications whatever requires & once you finish you can resubmit the changes back to the bitbucket server

 

Key benefits of using Bitbucket :

  • If you are an individual developer, It provides a free sign in & can upload unlimited repositories. For the organization, it provides management repositories up to 5 persons into a single team
  • Easy & quick to set up & uploads. Also can create unlimited repositories
  • It’s a safe option as it also allows you to keep your repositories private where. If you keep it private no other persons will find your repositories
  • Allows advance operations like push changes, version control

Read more: Set up UILocalNotification in iOS Swift/Objective C

If you are new to bitbucket source code management & haven’t tried it yet that you must read this carefully.

Here is step by step explanation of source code management using Bitbucket,

  • If you are new to bitbucket & haven’t signed in yet than Signup first.

https://bitbucket.org/account/signin/

  • Ok, so we have bitbucket account now next step is to make sure our system is ready for it or not. So go to Application folder & see if you have Github desktop application installed or not. If no than download it from here & install: https://desktop.github.com
  • Now if you are first time uploading git repository of your source code then create a new repository on bitbucket. For that go to Bitbucket site & click on a + button on left panel & select repository & fill up the details.
  • Now repository is created & ready to receive the source code. So the next step is keeping the copy of your source code to a desktop. Note: reason, why I prefer to keep it on a desktop, is in any other path there might be a chance to have white spaces on the file path & that may not allow working some of the commands on terminal. So always prefer to keep the copy of your source code on the desktop & also make sure it’s not compressed file. Keep it unzipped.
  • Open terminal & navigate to the desktop path

$ cd desktop

  • Now go inside your project folder

$ cd project-name

  • Initialise git command like this :

$ git init

  • Add ‘.’ (dot) Reference for the first commit on your repository

$ git add.

  • Now perform initial commit by adding some text to the readme file like this (You can change text written between single quotes) :

$ git commit -m  ‘Initial commit with contributors’

  • Now its time to add repository path origin URL

$ git remote add origin your_repository_UR

Like this: $ git remote add origin https://[email protected]/MyComp/myapp.git

  • Finally, the last option is to push your source to the bitbucket server.

$ git push origin master -f

Once above steps followed it will first ask for the password of your bitbucket account for the first time only. Later on, it will be saved to your keychain account & will be accessed directly from there.

Share
Share