Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

repository commands

# Main git commands

# Configurations

git config --global user.name "Sam Smith"
git config --global user.email sam@example.com

# New Repository

git init

# Copy local repository

git clone /path/to/repository 

# Copy local repository for remote servers

git clone username@host:/path/to/repository

# Add files

git add <filename>

git add *

# Git Commits

git commit -m "Commit message"

# Commit any files added with git add command

git commit -a

# Push changes to master branch

git push origin master

# Check the status of files

git status

# Connect to remote repository

git remote add origin <server>

# Provide a list of recently configured remote repositories

git remote -v

# Create new branch then switch to it

git checkout -b <branchname>

# Switch branches

git checkout <branchname>

#List all branches in repository

git branch

# Delete the feature branch 

git branch -d <branchname>

# Push selected branch to your remote repository

git push origin <branchname>

# Push all branches to remote repository

git push --all origin

# Delete a branch on the remote repository

git push origin :<branchname>

# Fetch and merge changes on remote server to certain directory

git pull

# Merge a different branch into active branch

git merge <branchname>

# View merge conflicts

git diff

git diff --base <filename>

git diff <sourcebranch> <targetbranch>

# Mark changed file

git add <filename>

# Utilise tagging to mark a certain changeset

git tag 1.0.0 <commitID>

# Get changeset ID

git log

# Push all tags to remote repository

git push --tags origin

# Undo local changes, replace changes

git checkout -- <filename>

# Drop all changes and commits

git fetch origin

git reset --hard origin/master

# Search the working directory for foo(); (example)

git grep "foo()"
Comment

PREVIOUS NEXT
Code Example
Shell :: how to run bash scripts 
Shell :: how to run mongodb shell 
Shell :: afficher le contenu de la variable path 
Shell :: linux extract tar.gz 
Shell :: git reflog reset 
Shell :: git: create and remove git alias command 
Shell :: install expo react native 
Shell :: sed add word to end of line 
Shell :: how to give permission to a user in linux on a folder 
Shell :: kubectl exec run command inside pod 
Shell :: install react dependencies 
Shell :: how to start ssh agent service windows powershell 
Shell :: link local to remote git 
Shell :: github add multiple credentials windows 
Shell :: close tcp port on mac 
Shell :: tar zip multiple files 
Shell :: bash variable lowercase 
Shell :: how to add images to git readme 
Shell :: npm install --save-dev @angular/cli@latest 
Shell :: Flutter doctor error - Android sdkmanager tool not found. Windows 
Shell :: bash multiline ech 
Shell :: install composer on ubuntu 20.04 
Shell :: xrandr 1366 
Shell :: npm install version 
Shell :: git push asking for username after setting up ssh key 
Shell :: linux read text file command line 
Shell :: raspberry pi install vscode via command line 
Shell :: convert ppk to pem 
Shell :: git clone https 
Shell :: how to create new repository in github 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =