[RUBY] (Git) Basic command

Basic commands

** Basic steps to update files ** The rough flow is as follows

-Add file -Commit the file -Update the file

python


git add .
git commit -m "Any comment" //commit(Save the contents of Git)
git push origin <branch-name> //Upload remotely

How to use the git init command

In a nutshell, Git's init command is a command used to ** "create a new repository" **.

python


$ git init

How to use the git status command

This command is for displaying the status of the working tree.

python


$ git status

How to use the git checkout command

Git checkout is a command used for ** "when you want to switch branches" ** in a nutshell. In other words, a command to use when you want to escape from the branch you are currently working on and work on another working branch.

python


$git checkout branch name

git checkout is a command to switch branches

python


git checkout -b <branch name> 

How to use the git branch command

List all branches in the repository.

python


$ git branch

How to use git pull origin master

If you write this code after merging, it will be pulled request to the repository.

python


$ git pull origin master //The latest repository information is downloaded

How to use git log --oneline

Concisely display the commit you write on one line

python


git log --oneline

If the commit isn't merged but you want to move on to the next task.

python


git add
git stash

↓ #Switch to the master branch
git branch -d <branch-name> #Delete branch
git checkout -b <branch-name> #Make a new branch
git stash pop #Add what you just copied to a new branch
git log – oneline #Make sure the commit log is correct

Used when canceling a commit When to cancel? a. When you make a mistake in commit b. When you forgot to write the code c. When you no longer need to commit

python


git reset HEAD^ --soft

python


git push -u origin <branch-name>

python


git -u origin <branch-name> -f
 



 






Recommended Posts

(Git) Basic command
docker basic command
Docker Compact Manual (1: Basic / Basic Command)
Git branch creation / deletion / convenient command [Git command]
Command Pattern
Basic type-java
Basic knowledge
Command docker-compose