Simple GIT Workflow Tutorial explains to you how to use GIT and GitHub more efficiently without any harder practices. It will help you to initiate your project with the GIT (version control system) and GitHub.
What is Git?
Git is a version control system that keeps our file changes as version history. We can retrieve the changed version whenever we need it. Git keeps the changes as a commit and each commits belongs to branches.
How to Use Github and Git Workflow
GIT Workflow Step by Step:
Initiate GIT Repository
git init
This command creates a Git local repo (Repository short form ) in the local hard disk. You can open git bash and direct it to the particular folder where we want to initiate the git. And then try this command. It will create a git initialization folder on the folder. Now we created a local git repository.
Pull the existing Github Repository into Local
git pull https://github.com/repository-name
Now we copy the remote git repository into the local one. Git Pull command copies the remote repository to the local hard disk. We suggest using SSH to pull and push the remote repositories.
Create a new Git Branch
git checkout -b new-branch
Generally, a git repository have one branch which is ‘Master’ by default. For new features or updates, we need to add new branches without affecting the master tree. Git checkout command creates a new branch or switches over the existing one.
Check modified files
git status
Git status shows modified files on the git repository on the local disk.
Get all the modified files into the stage for commit
git add --all
Git adds all commands to get the modified files into the stage for committing.
Commit the modified files on track
git commit -m "initial commit1"
We can do the commit with this git commit command. It probably means save the git working tree.
Add Remote Repository
git remote add "origin" https://github.com/repository-name
Add remote repository location by this command.
Upload all files to the remote repository
git push --set-upstream origin new-branch
Push all the modified files only on the new branch into the remote git repository with this command. Later we will add it to the master branch.
you are all done 90% now. Now it’s time to create to merge request to merge the new branch into the Master tree of the repository.
Other Interesting GIT Tutorials
Hope you enjoy the basic workflow of git!
Tell me, What is your Secret Git Workflow?