tengkuiqbal

Basic git

Mon, July 1, 2024 - 1 min read
git

Delete Local Branch

Removes a local branch.

git branch -d branch_name
git branch -D branch_name

Push branch local to Remote Branch

Pushes a local branch to the remote repository.

git push -u origin BRANCH

Delete Remote Branch

Removes a branch from the remote repository.

git branch -d <branch_name>

Cancel Modified (Force Revoke Edit)

Discards all local changes and resets the working directory to the last committed state.

git reset --hard HEAD

Clear Cache gitignore

Removes cached files from the repository and updates the index according to .gitignore.

git rm -r --cached .
git add .
git commit -m “remove ignored files”

Clone specific branch

Clones a specific branch from a remote repository.

git clone -b [email protected]:path/path.git

Remote path

Displays or sets the URL for a remote repository.

git remote set-url origin [email protected]:path/path.git

Merge

Combines changes from one branch into another.

git checkout master
git pull origin master
git merge test
git push origin master