USING GIT WITH GOOGLE DRIVE

Sep 2
07:26

2016

Mahendra Pingale

Mahendra Pingale

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

The above two statements tells us all about Git’s basic functionalities and the ideas it is based upon.

mediaimage

Firstly,USING GIT WITH GOOGLE DRIVE Articles that it is free and open-source and secondly that it is a distributed version control system, which means there are multiple copies of the same project kept on various systems that are simultaneously working on the project.

The second statement tells us about its ease of use as well as a tiny footprint. Commands in Git are simple to understand because it uses English words. Git also claims to have a tiny footprint as it only stores one complete copy of the projects on one system and the remaining copies are stored as incremental changes relative to the original one, thus consuming less hard-drive space and making operations very fast. 

Lets understand how to use Git :-

git init

git add .

git commit -m “first commit”

 

Execute these commands in the root folder of your project and you are all setup for version control on your system.

git init

 

Above statement initializes a bare git repository.

git add .

 

Adds all files in the current directory.

git commit -m “first commit”

 

This will commit the changes that are required and add a message to it.

Tip: (You can also install CygWin for Windows which enables Linux commands on Windows and gives more control)

Now lets set it up on Google Drive:

Create a folder in your Google Drive folder called “git”. You want this folder as git produces a lot of files and you may want other stuff on your google drive besides your code repository.

c: mkdir UsersJoeUserGoogle Drivegit

 

Go to your project folder

 

cd /C/MyProjects/Project1

 

Now, in the projects folder, perform the following git commands

git init

git add .

git commit -m “first commit”

 

Now we go to Google Drive and create a bare git repository

 

cd /C/Users/JoeUser/Google Drive/git

git init –bare project1.git

cd /C/MyProjects/Project1

git remote add origin /C/Users/JoeUser/Google Drive/git/project1.git

git push -u origin master

 

Well, that’s it really. Now you have setup so that when you next time do a “git push” you will do so to Google Drive in the cloud and your code is safe.

 

To checkout this project from another machine, you simply make sure you have Google Drive App on that machine and type

 

cd /the_location_I_want_to_checkout_the_repo

git clone /C/Users/JoeUser/Google Drive/git/project1.git

 

Tip: Before executing the above command make sure that Google Drive has synched properly from the machine where code was originally generated.

Tip: Sometimes on ‘git push’ or ‘git clone’ you may encounter some error like “Reference has invalid format: ‘refs/heads”. Then go into the ‘project1.git’ folder and inside ‘refs/heads’ delete unwanted files like ‘Icon?’ which gets generated automatically by Google Drive.

Today’s Android app development company is smart. Many Mobile app development company provide Google Drive app.