Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

top git commands

git code .                                //Open vs code
git status                                //Show file status
git status -s                             //show short file status
git add <filename>                        //Add the particular file to staging area
git add .                                  //Add all the file to the staging area
git commit --amend                        //Add these changes to the last commit (will have to use vim editor)
git commit -m "message"                   //Commit the files in the staging area    
git commit -am "message"                  //Will commit without adding the file to the staging area
git checkout --<filename>                 //will restore the file from the last commit
git checkout -f                           //All the files will be replaced with last commit
git checkout -b <branch name> 		   	  //Create a branch
git branch 								//To see the branches
git branch -d <branch name>				//To delete a branch
git branch -v 							//will show the branch and its last commit
git branch --merged 					//will show the branches that are merged
git branch --no-merged 					//will show the branches that are not merged
git merge <branch name>					//while in a branch you can merge another branch
git log                                   //Show all the commits
git log -n                                //n can be replaced by any number "will show last n commits"
git log -p                                //Will show detailed discription of the commits  
git log -p -n                             //use of n is similar as described above  
git log --stat                            //will show short detailing of the commits  
git log --stat -n                         //use of n is similar as described above    
git log --since=n.days                    //commit of last n days/weeks/months "days can be replaced by weeks,months"
git rm --cached <filename>                //will remove to file from the tracking area 
git rm -rf                                //will uninitialized the current repository              
git rm <filename>                         //will delete the file  
git mv <Present filename> <The filename after the change>  //to Rename the file
git clone <URL>                           //Cloning a repository in the current folder
git clone <URL> foldername                //Cloning the repository in the given folder name (Folder will be created by itself) 
git config --global alias. <new name> 'old command'  //while create an alias command for the given command
git remote 						//Show all the name of remote repository
git remote -v 					//Show all the path (fetch/push) of the remote repository
git remote add <name> url			//Add a remote repository
git remote rm <name>				//To remove a remote
git push <remote name> <branch name>	//To push a branch to remote repository
git push <remote name> <branch name>:<branch name you want to have in the remote repository>
git reset HEAD						//To move to a previous commit



More commands can be found on this website
//website https://git-scm.com/docs/git-log
Comment

popular git command

git fetch --all

# create new branch from origin `main` branch.
git checkout -b prefix/new_branch_name origin/staging

# commit and push your work to your own branch.
git commit -m "<type>(scope?): <message>"
git push

# update new codes from origin `staging` branch.
git pull --rebase origin staging
git push --force
Comment

PREVIOUS NEXT
Code Example
Shell :: pip install package to specific directory 
Shell :: bash print odd or even lines 
Shell :: copy ssh remote server 
Shell :: git configure default editor 
Shell :: windows download torchvision 
Shell :: install laravel globally ubuntu 
Shell :: ubuntu times new roman font 
Shell :: install discord bot on server 
Shell :: windows terminal starting directory 
Shell :: how to remove v4l2loopback 
Shell :: create a virtual environment python 3.8 
Shell :: homebrew zsh completion 
Shell :: search commit git 
Shell :: git increase buffer size 
Shell :: how to delete unstaged files that were recently added locally 
Shell :: maven create project from archetype command line 
Shell :: array length bash 
Shell :: install nvidia cuda toolkit ubuntu 20.04 
Shell :: ssh keygen linux 
Shell :: ubuntu install tar.xz 
Shell :: rename pc powershell 
Shell :: linux file path 
Shell :: install gatsby typography 
Shell :: remove file from stage git 
Shell :: install build-essential centos 8 
Shell :: install opencv 
Shell :: tar compress 
Shell :: rsync with ssh key 
Shell :: image converter linux 
Shell :: multi line comment in bash shell 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =