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 :: bash shell for windows 
Shell :: create a bootable usb drive ubuntu 
Shell :: crear usuario linux comandos 
Shell :: git squash command 
Shell :: bash search history 
Shell :: how to remove package files in linux 
Shell :: git merging to branch from branch 
Shell :: docker compose commands 
Shell :: how to install macos from usb 
Shell :: how to install node_module 
Shell :: download file github 
Shell :: how to start xfce4 sudo command 
Shell :: How to clean up the git repo and reduce its disk size 
Shell :: ubuntu battery and network utilities install 
Shell :: how to make my PS1 in linux the pwd 
Shell :: hsp hFP ubuntu "solved" 
Shell :: pyinstaller onefile hidden window 
Shell :: cd n directories back 
Shell :: active directory update Home folder path powershell 
Shell :: cmd NETWORK SERVICE 
Shell :: ignore pre-commit hook 
Shell :: login authentication in android using volley github 
Shell :: no vnc download 
Shell :: grep Nth line after pattern 
Shell :: git command change to previous comit 
Shell :: which repository is made when expo init 
Shell :: iina github 
Shell :: facebook signin does not working on facbook app works only when no app is installed 
Shell :: como descargar asobe xd en ubutnu 
Shell :: ssh replace file raspberry pi 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =