Quick guide to roll a git [–version-control] on windows 10 and connect remote
All you need….
- git [ www.git-scm.com ]
- notepad ++ or similar [ www.notepad-plus-plus.org ]
- GitHub account or similar [ www.github.com/join?source=header-home ]
Step 1
Download git and install [leave everything as is, but install notepad++ or similar to use as code editor, unless you like to use vim].
Sign up for GitHub and create a repository.
Step 2
From the command line [cmd], move to the directory you want to contain your .git repository.
cd folder/folder2
Type the following command to create your git username and e-mail:
git config --global user.name "<your name>"
git config --global user.email "<your e-mail>"
Once done, find the new created repository on GitHub - clone or download repository address, then type:
git clone https://github.com/YourUserName/RepositoryName.git
There should be a new folder in the current directory, move into it:
cd RepositoryName
List the remote repositories:
git remote
You should see [origin]. Now see if the path is the correct one, with:
git remote -v
Done. You have successfully connected your git repository.
Step 3
Let’s create a new file and push it to your online repository.
start notepad NewFile.txt
Check current status of your branch and untracked files.
git status
Should look similar to this:
On branch master
Your branch is up to date with "origin/master".
Untracked files:
(use "git add <file>..." to incude in what will be committed)
NewFile.txt
nothing added to commit but untracked files present (use "git add" to track)
Add the file to git as mentioned under [status] above or [add .] for all files.
git add NewFile.txt
git add .
The file is now in [staging] try to run [git status] again. You should see your file in green that should be committed. To commit the file with a note run:
git commit -m "First file"
Finally, your file moved from your workspace to your local repository and now needs to be pushed to the remote repository.
git push
Note: There are also the following commands, you need most likely, if you either work on different PC’s or with other people on the same repository [no comments]:
git pull
git fetch
git push origin master
git branch <New Branch>
git branch -a
git checkout <Branch Name>
git push --set-upstream origin <Branch Name>
git merge <Branch Name>
git branch -d <Branch Name>
git push origin --delete <Branch Name>