Configuring, Using GitHub Branching and Merging
Recently, I had to work with a repository on GitHub, below are my notes on configuration, usage etc..
To work with git there are many helpful utility’s. one rely widely used helpful utility is called bash-it, it will help with your branching and many more, available here
First, sign-up for a GitHub account, easily done on http://github.com
Then, go to http://github.com/new
. create a new repository, simple steps to follow.
Below, I am working with a repository named coreos-kubernetes-generator
First lest clone the repository.
git clone https://github.com/elik1001/coreos-kubernetes-generator
To add a file readme.txt, run the below.
git add readme.txt
To add all files/folder
git add .
git add -A
To commit the file to your local cloned git repository.
git commit -m "Adding readme.txt"
To push all your changes to the master branch, just run the below.
To get the latest changes
Now, lets create a new branch, I will name this branch Version-02.
git branch Version-02
Now lets switch to the new branch Version-02.
git uses the checkout
option to switch to a different branch(or back to master).
git checkout Version-02
Same as above, to add all changes.
git add .
To set the executable bit on a file, just run the below.
git update-index --chmod=+x bin/clone_zfs.py
To commit all changes.
git commit -am "reason for change"
Finally, to push all changes to github.
git push origin Version-02
Now, login to github and merge and apply all changes to the master (if all is correct).
Since I am using tow-factor authentication so called Tow-step authentication, the extra steps below are required.
Lets configure our local Github properties.
git config --global user.email "email@example.com"
git config --global user.name "Eli"
The below will help for two factor authentication.
Enable user/password cache
git config --global credential.helper cache
Next time you push changes to github, it will ask for your user login name.
Then for password use your GitHub API/Two-factor key.
Like what you’re reading? please provide feedback, any feedback is appreciated.