An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
August 17, 2022 03:32 pm GMT
Original Link: https://dev.to/avinashvagh/git-useful-command-and-mastering-the-terminal-27p6
Beginner guide to GIT and mastering the Terminal
Hey guys,
Here I will list down all the Basic GIT operation command and basic Terminal command. I'm sure it will helps you.
Create a Repository
create a new local repository
git init project_name
download the existing repository
git clone github_repo_url
Observe Repository
list a new or modified files not commited
git status
show full change history
git log
Branches
list all local branches
git branch
list all local and remote branches
git branch repo_name
switch to branch
git checkout my_branch
create a new local branch
git branch new_branch
delete a branch
git branch -d my_branch
Making Changes
stage a file (ready for commit)
git add file_name
stage all changed files
git add .
commit all staged files
git commit -m "some comment"
change last commit
git commit --amend
unstage file. keeping file changes.
git reset file_name
Synchronize
get all updates(branches) from remote repository
git fetch --all
updates current branch with remote branch changes
git pull origin branch_name
updates remote branch with local changes
git push origin branch_name
Basics steps of working with GIT
1. git clone remote_repository_url2. git add .3. git commit -m "comment"4. git push origin master// this steps are basically mostly used
TERMINAL COMMAND
There are 5 types of terminal basically.
- Git Bash
- Command Prompt
- PowerShell
- JavaScript debug terminal
- zsh
Here I will list down all basic command you need to work with the terminal
ls// list all your home directory
pwd// show you where you're in home directory.It will show the exact path
cd folder_name/location_name/desktop// for changing directory
clear// for clearing everything in terminal
cd ..// it will go back one directory
cd/users/your_pc_user_name/project// if you directly want to go into some directory they you can use it like this command
cd /// it will take you to root directory
mkdir folder_name// make a directory
mkdir folder1 folder2// two folder at a time you can create in one go
man ls// list directory content
ls -l// it will show directory created/updated time
ls -l// more information
ls -a// it will show hidden file
ls -la// both command at the same time & you've to write dash only once
touch file_name(file.txt/ file.html/file.css/file.js)// create a file from command line
touch file.hmtl file.css file.js// create a three file at a time
rm file.css// it will remove the specific file
rmdir folder_name// remove only empty folder
rm -rf folder_name// it will remove folder with all content inside it
That's it for now guys, see you in the next article.
If you like my blog, follow me for more updates. You can follow me on Twitter & can connect with me on LinkedIn, Meanwhile you can checkout my Hashnode Blog.
one line from series I'm watching:
"To Win, You Have To Attack" - Light Yagami (Deathnote)
Stay fit, Keep coding, Keep exploring & Be happy with what you do.
Original Link: https://dev.to/avinashvagh/git-useful-command-and-mastering-the-terminal-27p6
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To