Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git tutorial

# 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

git basics

//To see all the created branch within a repository
$ git branch -a
Comment

PREVIOUS NEXT
Code Example
Shell :: git lang 
Shell :: laravel sail install php extensions 
Shell :: brew upgrade casks 
Shell :: kubernetes on windows 10 
Shell :: rsync only updated files 
Shell :: python compile dlib without cuda 
Shell :: how many repositories can be created in github 
Shell :: tail command in linux 
Shell :: uniq linux 
Shell :: linux create executable 
Shell :: how to call a batch file from another batch file 
Shell :: How to push to a new repositiory in github 
Shell :: how to install xfce 
Shell :: delete branches gitlab 
Shell :: how to install nvm in ubuntu 18.04 
Shell :: how to install pycord 
Shell :: bash replace comma with newline 
Shell :: Octave Install Packages Commands 
Shell :: until loop bash 
Shell :: how to remove windows 10 built in apps powershell 
Shell :: how to push another account git 
Shell :: extract tar.gz 
Shell :: line number in nano editor 
Shell :: git clone commit hash 
Shell :: get working directory rstudio 
Shell :: gem install rails version 
Shell :: insert a line at a line number sed 
Shell :: install steam on ubuntu 
Shell :: remove all branches deleted on remote 
Shell :: how to start nginx in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =