
Git for beginners
Install Git windows 10 :
Download the Git from official website git-scm.com, and download the latest version of Git. Current version is 2.24.x. Click here to download.
Right click on downloaded Git file and run as administrator, then follow information dialogue to go further installation.
Create git repository on github.com.
If you do not have account, you can create it for free.
- Create a new repository on GitHub. To avoid errors, we are not going to initialise the new repository with README, license, or gitignore files. We can add these files after our project has been pushed to GitHub.
Create local git repository
Create directory.
mkdir demo
Change to demo directory
cd demo
Now initialise git in current directory
git init
Create demo.txt and README.md file
To add created files to git, use following command [ dot (.) is used to add all file for tracking in git]
git add .
To push the added files to GitHub repository we need to commit these files in our local repository.
git commit -m \”first commit\”
At the top of your GitHub repository\’s Quick Setup page, click to copy the remote repository URL.
In the Command prompt, add the URL for the remote repository where your local repository will be pushed.
git remote add origin remote repository URL
# Sets the new remote
git remote -v
# Verifies the new remote URL
Push the changes in your local repository to GitHub.
git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin
// TODO
- create branch
- delete branch
- pull changes from remote
Tag:beginner