Answers for "Git Commands List"

28

git commands

 …or create a new repository on the command line
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/metinkaya1511/FinraDeck.git 
(GitHub’daki adres)
git push -u origin master
…push an existing repository from the command line
git remote add origin https://github.com/metinkaya1511/FinraDeck.git  
(github adresi)
git push -u origin master 
CREATE BRANCH
-   git branch develop ==> it creates new branch named 'develop' but still 
keep being on master branch
-   git checkout develop ==> it will change your branch to the develop branch
git checkout -b develop ==> it creates also a branch named develop and 
switches to it automatically
DELETE
git branch -d <branch_name> deletes the branch. If we have unmerged changes, 
this command gives a warning and does not delete.  
git branch -D <branch_name> deletes the branch even if it has unmerged changes.
Gives no warning.
SWITCH to Branch
git checkout develop checks out the branch, switches to the branch.
git checkout -b <branch_name> creates a new branch and switches to it.  
git merge <branch_name>  this command takes changes from the given branch, 
and merges with the current branches we are on.
Posted by: Guest on December-04-2020
4

git commands

# Create a Repository or Initialize Git in folder
git init

# Add Files
git add . #All Files
git add <filename> ##Single File

# Commit the Changes
git commit -m "first commit"

# Remote Repository
git remote add "Remote Name" <link from github>
git remote add origin https://github.com/samytech/New-Projects.git  (Git Address with .git in the end)

# View Remote Branches 
git remote -v 

# Pull updated files from branch
git pull <remote_name> <branch_name> 
git pull pro master

# Remove Remote branch from local
git remote remove <branch_name>  ==>  The git remote remove command removes a remote from a local repository.
git remote rm <branch_name> ==> You can use the shorter git remote rm command too.

# Final Step (Push in Master Branch)
git push -u origin master

# Check changes 
git status

# Check Git Log
git log

## CREATE BRANCH ##

# Show Branches
git branch  #show local branches
git branch -a   #show both local and server branches [Server branches in Red color]

# Create & checkout Branhc
git branch <branch_name> 
git branch develop  ==> it creates new branch named 'develop' but still keep being on master branch
git checkout develop ==> it will change your branch to the develop branch
git checkout -b develop ==> it creates also a branch named develop and switches to it automatically

# Delete Branch
git branch -d <branch_name> ==> deletes the branch. If we have unmerged changes, this command gives a warning and does not delete.  
git branch -D <branch_name> ===> deletes the branch even if it has unmerged changes. It gives no warning.

# Merge Branch
git merge <branch_name>  ==>  this command takes changes from the given branch, and merges with the current branches we are on.
Posted by: Guest on October-05-2021
1

git commands

echo "# New-Projects" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/hussainbabar/New-Projects.git
git push -u origin main
Posted by: Guest on August-11-2021
12

git commands

git init
git add *Enter File Name Here*
git commit -m "first commit"
git remote add origin *Enter URL Here*
git push -u origin master
Posted by: Guest on March-16-2020
1

git commands

# Create a Repository
git init

# Add Files
git add . # All files
git add <filename>

# Commit the Changes
git commit -m "Message goes here..."

# Remote Repository
git remote add origin <link from github>

# Final Step
git push -u origin master
Posted by: Guest on August-04-2021
0

Git Commands List

//To add file in commit
git add filePath

//To Commit with message
git commit -m 'Commit message'

//To revert file changes to its head. Replace with head
git checkout -- libs/logs/advertiserApi/advertiserApi.log

//To skip ng lint and commit the code
git commit -m 'ng lint error reverted back' --no-verify

//To reset commit below command
// Below HEAD~1 means it will reset to last 1 commit, HEAD~2 means it will reset to last 2 commits.
git reset HEAD~1
git reset HEAD~2
git reset HEAD~3

git reset --soft HEAD^
git reset --hard HEAD^

//To merge and resolve conflict by using Ours changes or Theirs changes.
git checkout --Xours --Xtheirs

git merge --abort

//To create new branch
git branch branchName

//Display all branches
//For local branches
git branch 
//For remote branches
git branch -r

// delete branch locally
git branch -d localBranchName

// delete branch remotely
git push origin --delete remoteBranchName

//Git stash changes temporary
git stash save "Saving data of story"

//View stashes
git stash list

//Bring stash back and remove from stash
git stash pop

//Bring stash back and keep in stash
git stash apply

//Remove from stash
git stash drop
Posted by: Guest on August-26-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language