This is a demo git repo with a list of commands as a cheat sheet.
-
Change into the required folder: PC:
cd %HOME%\Source\Repos\
MAC:cd ~/Source/Repos
-
Create New Folder:
mkdir Project-Name
-
Change into the new folder
cd Project-Name
-
Initialise with git
git init
-
Change master to main
git branch -m master main
-
Check the status
git status
-
Create a .gitignore MAC:
touch .gitignore
PC:echo "" > .gitignore
-
Add required "ignores" to the .gitignore file. Recommend that you use a known .gitignore or head to http://gitignore.io
-
Check the status
git status
-
Add and commit the ignore file to version control
git add .gitignore
git commit -m "Original Commit
-
Verify commit
git status
git add filename
git add -A
git add foldername/*
git add.
git log
git branch Branch_name
git checkout Branch_name
git checkout main
git status
git merge Branch_name
git status
git log
Before you ca use remote repository(repo) you need to have created it on the remote system
We will use GitHub for this purpose, other remote repositories that use Git are also valid
- Head to http://github.com
- If you do not have an account, create a github account
- Create a new repo making sure that:
- Do not add a README.md
- Do not add a License
- Do not add a .gitignore
- In other words: Do not add anything to the blank repo
git remote add origin https://github.com/bijit85/git-command-help.git
origin = alias for the remote
git push -u origin main
git clone https://github.com/bijit85/git-command-help.git
Cloning allows you to work on code on a new machine
Go to https://www.git-tower.com/windows
Heading1 | Heading2 | Heading3 |
---|