I was working on a project for GE power. GitHub was the version
control tool being used for code check-in and check-out. Here, I list the
commands being used, so that it can act as a reference for me and others at a future
date.
https://gitforwindows.org/
Setup and configuration for the 1st time use on windows machine using GitBash
1)
Download “gitbash” for windows from below link
and install it: -
2)
To create and register ssh key to sync data from
GitHub repository, follow instruction from below link for windows: -
3) After step-2 above. Open GitBash and enter below
command(s):
4) eval $(ssh-agent -s)
5) ssh-add /D/Srinivas/Git_SSHKeys/id_rsa (replace this with the path and filename you created
to store SSHkeys in step-2 above)
6) Open .pub file in notepad and copy the public
key.
7) Add the key to GitHub, follow instruction from
below link for windows: -
8) Copy the SSH URL (not https) from GitHub
"CloneorDownload" button and cd to the directory/path were you want
to download or sync GitHub code. Example: cd /D/Srinivas/My_SourceCode/directoryname
and issue below command: -
End of first time setup and configuration steps.
Some GitHub commands you may use regularly using GitBash
1) To create a local branch for development from
master(default) branch:
git
checkout -b YourLocalBranchName master/origin
List of commands to
push changes in your local branch to GitHub
1) Go to local branch other than master, where you
made changes to existing files or added new files.
2) git add .
3) git status (inspects the contents of working
directory and staging area)
4) git commit -m "Your comments"
5) git push origin YourLocalBranchName
6) Browse to GitHub and see if your changes are now
visible.
Note:
You have to commit code changes to your current local/dev branch, before checking-out
(switching) to a different branch, else your current changes are copied to
different
branch your check-out to.
Creating pull request
using GitBash
1) First sync your local directory with origin/upstream, using below command:
1) First sync your local directory with origin/upstream, using below command:
git fetch origin
2) Go to git hub and create new pull request
(follow instruction form below link, under “Create pull request” sub heading,
if link doesn’t work, do google search for the same)