- Visual Studio Community Edition
- Visual Studio Code
- Git for Windows
- GitHub Desktop
- .NET Framework 4.6.2 Developer Pack
- Go to your email and find a invitation of repository
RushuiGuan/learning
and accept the invitation.
- Create a local folder: c:\Github
- Background Read
- Run Git Bash
- Observe
- The colored text is called a shell prompt or prompt
- The prompt by default should be of the following format:
[user]@[machine] MINGW64 ~
[user]@[machine]
is green;[user]
is your current windows login;[machine]
is your machin host name.MINGW64
is pink; it has something to do with the version of your bash shell. Not important.~
is yellow. Perhaps the most useful information in the prompt. It indicates your current working directory as well as your repo branch once you are in a git hub repository.~
means that you are currently in your default profile folder.
- Go to your default folder
- command (type and press enter):
cd ~
- command (type and press enter):
- Edit your bash profile
- command:
notepad .bash_profile
- Copy and paste the following text to the notepad
cd /c/github alias code="/C/Program\ Files/Microsoft\ VS\ Code/bin/code"
- Save and close the notepad
- command:
- Restart Git Bash
- Verify that Your prompt is:
[UserName]@[MachineName] MINGW64 /c/github
- Verify that Visual Studio Code can be launched by typing in the command:
code
- Setup the default code editor for bash shell
- Command:
git config --global core.editor "code --wait"
- Command:
- Learn: the
cd
command and path string in bash shellcd
means current directory.- In bash shell, your path starts with
/
(the first one is called root, not slash),/c
is your c drive and/c/github
is the folder github directly under your c drive. cd /c/github
means changing your current directory to/c/github
..
means the parent directory. If you are in/c/github
, commandcd ..
will bring you to its parent directory:/c
.
means your current directory.- command:
ls
ls
command will list all files and folders in the current directory.
- Reading: Github Hello World
- Run Git Bash
- Go to the working folder
- command:
cd /c/github
- command:
- Clone the learning repository
- command:
git clone https://github.com/RushuiGuan/learning
- command:
- Go to the learning repo folder
- command:
cd learning
- Without specifying the
/
(root), thecd
command is setting a location relative to your current location. Since your current location is/c/github
, the new location should be/c/github/learning
- Without specifying the
- Verify: Your prompt should reflect the new location
- Verify: Your prompt should now have something new in light blue
(master)
. This tells you that you are current 1. in a git repository; 2. in the master branch. - Verify:
- command:
ls
- You should see a list a files that has been cloned from the git repository https://github.com/RushuiGuan/learning.
- command:
- command:
- Run Git Bash
- Go to the directory
/c/github/learning
- Make sure that you are in the
master
branch- Command:
git checkout master
- Command:
- Create your local branch
- Command:
git branch tuan
- By typing this command, a new branch
tuan
will be created from your current branchmaster
- Command:
- Switch to the branch that you have just created
- Command:
git checkout tuan
- Command:
- Push your newly created local branch to the remote repository (cloud).
- Command:
git push --set-upstream origin tuan
- Note: you only need to use flag
--set-upstream
when it is the first push. The flag associates your local repo tuan with the remote repo of the same name.
- Command:
- Verify
- Browse to https://github.com/RushuiGuan/learning and you should see the new branch under the branch dropdown.
- Run Git Bash
- Go to directory
/c/github/learning
- Make sure that your current branch is
tuan
- Command:
code readme.md
code
will open the app "Visual Studio Code"readme.md
is a parameter to the "Visual Studio Code" program and tells it to open the file.
- Make some changes to the
readme.md
file. Any change is fine and save. - Go back to the Git Bash.
- Assuming your current folder and your current branch didn't change.
- In order to send your change to the cloud, remember three things
- Stage - Prepare your changes to be committed. This step allows you to commit only the changes that you have staged.
- Command:
git add .
- Command:
- Commit - Commit your change to the local repo.
- Command:
git commit . -m "type a message about what you had changed!"
- Command:
- Push - Push your change to the cloud.
- Command:
git push
- Command:
- Stage - Prepare your changes to be committed. This step allows you to commit only the changes that you have staged.
- Verify
- Click on this link: https://github.com/RushuiGuan/learning/tree/tuan
- Notice that the link brings you to your branch.
- Github automatically displays the current readme.md file in the repo directory. You should be able to see your changes on the screen.
- Notice that your change is not in any other branches.
- Celebrate!!!
- Repeat this section for practics.