How we use git in our codebase on Github

in #utopian-io7 years ago

What is git

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. This is how I understand it. It allow me to create versions of my files and allow me to have the most correct version reserve somewhere where I can always add latest version edits.

Image we want to write a book

Let me take you along a simple process of writing a story book. Normally, I would have

-- Introduction
-- Chapter One
-- Chapter Two
-- Chapter Three
-- Conclusion

Let me use git to help me write the story book.

I start off having the book structure above written on a draft paper.
I would put all my edits in a folder I can name Project

Create a new git enabled folder

     $  git init

We normally do this on a terminal.

Do not mind the black screen you can also do it using one of the *GUIs *

Now I pick my pen, in this case my text editor and start writing some text into a new file I call introduction.txt. This new file would contain the introduction to the book. Very similar to taking a piece of paper and writing my first introduction draft.

And I save it in the PROJECT folder like so

    Project
     ├── .git/
     ├── introduction.txt

Git would keep track of this new add.

To keep my writing and editin process neat, I get a file rack that would contain the several drafts.

Similarly this can be done on git

Create a branch in Git called intro_draft

I create a branch where I could start writing a draft of the introduction to the new book (codebase). I decide to call the new branch intro_draft. Just similarly to doing it with my rack to keep my work tidy and easy to spot.

 $  git checkout -b [name_of_your_new_branch]  

 $  git checkout -b intro_draft

The branch intro_draft would contain every thing from my main copy to the new edits.
When I am done with my introduction draft and I feel it is good, I can have my closest friend Ayo go through it. He give me his recommendation and I add it to the new introduction draft **(intro_draft).

Commit Changes

I make sure I am in the *intro_draft* branch

Now in my introduction.txt I added the text of my introduction

I use git status to see the different drafts I have.

     $ git status


This shows the new draft

Add new changes

Use git add . to add new changes to the branch so that git would be aware of the changes made.

    git add .

Commit change

Use the git commit -m "Added the introduction to my new book" and use the -m to add a message for your commit to you remember what the draft stands for.

   git commit -m "Added the introduction to my new book"

This is similar to adding my draft on my rack.

Merge a branch to another branch

On git, the *master would contain the correct copy or clean copy of my book (codebase). We can create a new branch called *develop that would contain edits that are in development. Or in the book context, a rack that contain clean drafts. That is drafts of my book good for first read by my editor/publisher.

We do that in git with a simple command called *merge*

Now I move to develop branch if I have created it or I create it like so

     git checkout -b develop

Now the merge

    git merge intro_draft

This command would merge the changes in the intro_draft to develop

Online Git Repo

The internet has made sharing and collaboration very easy. Now several people can continue working on Design projects, Book writing, Document review, Policies, Graphic Design online and in realtime. With Google Doc I can write my thesis and allow my Professor to review and edit it for me. He can be in Zanzibar under some lovely palm tree with his wife while I am in Tamale.
With

In the I would explain how to use the github repos.

If you learn something, kindly upvote or share.

Thank you in anticipation. On @Steem we share, we collaborate and we get steemed.

Sort:  

Dear friend, you do not appear to be following @wafrica. Follow @wafrica to get a valuable upvote on your quality post!

Resteemed & upvoted

  • I upvoted akk the posts on the #yensesa tag

@enockagbo1 and his friends were all upvoted by @ackza and myself just now

Glad to see an inside look at the coding here! More of this will be appreciated in the future because steem does upvote its coder and programming community ..once they get noticed. The system does work to weed out un-persistent people and overall is a great way to start this decentralized business model. I wish @yensesa the best of luck

Have you good job

Coin Marketplace

STEEM 0.23
TRX 0.21
JST 0.035
BTC 97816.08
ETH 3416.41
USDT 1.00
SBD 3.21