Thursday, October 19, 2017

My simple cheat-sheet of Git bash commands

This post has several assumptions!

1) You are working on a Windows machine with https://git-for-windows.github.io/ already installed.
2) You already have a Github user and have created a repository with content
3) Assumes you already have created a github ssh key and its already working - I will make a blog post about doing this easily soon!
4) This also only works when you are only working on the ONE default branch!!

Essential Github bash commands:

To clone something you have in the Github site to your PC

On the webpage:
- Go to your profile and click on the repo
- Find the "clone or download" button
- Click Get SSH if you need, and copy something like git@github.com:arielsanchezmora/arielsanchezmora.github.io.git to your clipboard.

Open Git Bash:
- Find the directory where you want to copy the repository to
- In the Git Bash Window type "cd /c/....(the path, but in linux format. use "pwd" if you get lost on how to format it)
- Git clone [what you had copied from the webpage: git@github.com....]
(type ssh key password if needed)

To return changes to Github

Change to the cloned folder (it will have a hidden .git folder) before executing the below. The other files should have changed before you run these commands.

git status to see the changes (red is unstaged changes)
git add . (the dot means all files/subfolders)
git status (green shows changes have been staged)
git commit -m "add a comment to your code change" (otherwise, hi vi!)
git status will show your local branch is ahead of the Github site
git push origin master will sync your changes back to Github :)

4 comments:

  1. Git is a version control system (VCS) created for a single task: managing changes to your files. It lets you track every change a software project goes through, as well as where those changes came from. This makes Git an essential tool for managing large projects, but it can also open up a vast array of possibilities for your personal workflow.

    ReplyDelete
  2. Machine Learning is a study that makes computers act without being explicitly programmed. It corresponds to a core sub-area of Artificial Intelligence. When exposed to new data, computer programs grow and develop by themselves. Machine Learning experts are widely contributing in making the software applications more scalable all over the world. Machine Learning training is available very simply in the present scenario and one can avail it to assure a career with tremendous growth. Currently, there are technologies that are helping businesses in this matter. One example is Machine Learning which is basically a form of Artificial intelligence. The primary aim of this approach is to enhance the software applications in every aspect.

    ReplyDelete