Git and Version Control
Basic Commands in folder creation
- To go to a respected named folder πcd name
- To create a new folderπ mkdir name
- List items inside the folder π ls
- To create a new file in the project folderπ touch name
Git Commands
- Initialize Git π git init
- To see the hidden files in project πls -a
- Check for staging area files πgit status
- Adding files to staging area π git add filename
- Commit files π git commit -m "message"
- To see the commit log π git log
- To see changes between previous and new files π git diff
- To get the previous version of file π git checkout filename
Remote Repositories (Git Hub)
- First, create a repository in GitHub ( Public or Private)
- Get the link from the repository dashboard
- Add this command in your git bash π git remote add origin "copied link"
- Push to the repository π git push -u origin master
- origin - name of the remote
- master - name of the branch
Git Ignore - You can save secret keys, API's in this file
- Create git ignore file πtouch .gitignore
- Then add the files to the .gitignore file in the project structure
Git Cloning
- Clone a repository from remote repo (GitHub) π git clone "copied URL"
Branching
- To create new branch π git branch "name"
- To see all the branches π git branch
- To switch to a new branch π git checkout "branch name"
- To delete new branch π git branch -d "branch name"
Merging
- To merge a branch π git merge "branch name"
Author - Nisansali Nikapotha

Comments
Post a Comment