If you know any of the Software Developer around and never heard them talking about GitHub? maybe they are having hard time managing their software versions and you could be the one telling them about the Powerful tool- "GitHub"
As the picture describes it all, if you have GitHub taking your back, you turn out to be a powerful Developer taking down challenges of managing your code. This tool is used by over 40 million people to learn, share and work together to build software.
Our primary discussion here would be around using git commands to manage code at different stages. So, without wasting further time, let's get started.
Before you get going with Software Development, the first thing you need to do is setup a Git Repository.
Option 1: How to create a repository on GUI? check here.
Option 2: You can create local repository using command below and later push it (we will see this in some time) to your GitHub account.
Command: git init
Description: This will initialize a local Git repository
Once you have your repository created, it's time we set up respective endpoints from where your teammates can push their versions or features of the software.
How to set it up?
In the Window, type:
Command:
git config --global user.name <github userID>
Description: set a name that is identifiable for credit when review version history .
Command:
git config --global user.email <valid-email>
Description: set an email address that will be associated with each history marker .
Command:
git config --global color.ui auto
Description: set automatic command line coloring for Git for easy reviewing.
Command:
git clone <URL from GitHub link copied earlier>
Description: retrieve an entire repository from a hosted location via URL.
If you have reached this stage, that means you have already started coding your version of the Software and ready to use other git commands to manage and share your code with others on the GitHub repository you created above.
A. Stage and Snapshot:
git status
git reset [file]
git diff
B. Branch and Merge
git branch
git branch [branch-name]
git checkout
git merge [branch]
git log
C. Inspect and Compare
git log
git log branchB..branchA
git log --follow [file]
git diff branchB...branchA
D. Share and Update
git remote add [alias] [url]
git fetch [alias]
git merge [alias]/[branch]
git push [alias] [branch]
git pull
E. Tracking Path Changes
git rm [file]
git mv [existing-path] [new-path]
git log --stat -M
F. Rewrite History
git rebase [branch]
git reset --hard [commit]
G. Temporary Commits
git stash
git stash list
git stash pop
git stash drop
If you want to make your life little easy after writing huge lines of code, you could manage your code using GIT's GUI version instead of commands we saw above.
Installations available for different versions as below,
GitHub for Windows | GitHub for Mac
For Linux and Solaris platforms, the latest release is available on the official Git web site
I hope this content has been informative for you and would like to thank you for investing 7 mins of your valuable time reading this article.