Git command line integration

2 min read

Hello and welcome to brand new tutorial on how to interact with GitHub, Bitbucket source code repository.

Benefits of working

if you know commands to interact with git , you can integrate git with any type of existing or new projects for managing your source code. 

You can run automated scripts to take build your code and push it to apple or android apps store.

Process

Lets start then , I am writing tutorial on the basis of mac but the rules are same for other OS like windows and linux. 

  • Create empty folder 
  • Change dir , cd to empty folder
  • Write command git init in terminal (command line in windows).

Running this command will initialise an empty git repository.  To understand this better see below image, 

So in git integration system for source code management , repeat this. there are 3 concepts , which needs to be taken care. 

  1. Local folder where all your source file will reside.
  2. Local Repository which is the copy of remote repository. 
  3. Remote repository will reside on remote server for source code management for eg Github, Bitbucket

Now its the local repository that gets integrated with repository. 

Continuing with our initial discussion ,

  • Write command to create a dummy text file inside the folder. for eg nano test.txt and write few lines in that file, save it.
  • At this point the file is in your local folder. we need to add this file to our local repository first and then it can be sent to remote repository later. Use  command git add <filename> replace <filename> with the name of file which you add.  
  • conceptually git add only adds to the buffer that is between local folder and local repository. to add your file to local repository in actual you need to write command git commit -m “some commit message”

Wait a minute if you want to study how a GUI IDE like android studio can be used with Github you would like to read my another blog post

Following an advice , Learning via repetition, To recap what we did so far , we have 

  1. created a local folder , 
  2. initialised it with local git repository
  3. created and added  a test text file to buffer.
  4. committed test text file to  local repository 

Now we just have to sync our local repository with remote repository. But hey , first we need to create remote repository. Head to your web browser and open  Github, or  Bitbucket

For git hub you may get below screen

For bitbucket you may get below screen 

Visit any of the weblink and create a remote repository.  you may visit my other blog links for GitHub or bitbucket , if you find any difficulty in creating remote repository. Once you created remote repository , get its https:// url. 

In continuation with our initial discussion , you can connect local repository with remote repository by using command git remote add origin <https url>

Very soon I will be adding a video tutorial (as free you tube video) for this blog so you can see all the above in action. 

Link

Last but not the least , you may visit Link to youtube list for different youtube videos. And thats bring us to end of tutorial Thanks for reading. 

Happy Coding. 

One Reply to “Git command line integration”

Leave a Reply

Your email address will not be published. Required fields are marked *