GIT

Clone an existing repository

>_ git clone [url]
copy

Initialize new version-controlled project

>_ git init
copy

Save changes to the repository

>_ git add . git commit -m "first commit"
copy

Current state of the repository

>_ git status
copy

Create a new branch

>_ git branch [branchName]
copy

List all remote or local branches

>_ git branch -a
copy

Delete a branch

>_ git branch -d [branchName]
copy

Merge changes into current branch

>_ git merge [branchName]
copy

Checkout an existing branch

>_ git checkout [branchName]
copy

Checkout and create a new branch with that name

>_ git checkout -b [newBranch]
copy

Create a tag

>_ git tag [tagName]
copy

Delete the tag

>_ git tag -d [tagName]
copy

Push tags

>_ git push --tags
copy

Get the latest version of a repository

>_ git pull [branchName] [remoteURL/remoteName]
copy

Add remote repository

>_ git remote add origin [url]
copy

Define the author name to be used for all commits

>_ git config --global user. name [name]
copy

Define the author email to be used for all commits

>_ git config --global user.email [email]
copy

Helpful guides that come with Git

>_ git help -g
copy

Undo the previous commit

>_ git revert HEAD^
copy

Forget about files that were tracked but are now in .gitignore

>_ git rm -r --cached . git add . git commit -am "remove ignored files"
copy

Send local commits to the remote repository

>_ git push [remoteURL/remoteName] [branch]
copy

Store current work with untracked files

>_ git stash -u
copy

Bring stashed work back to the working directory

>_ git stash pop
copy

Remove a file from the working index (cached)

>_ git rm --cached [fileName]
copy

Delete a file (force)

>_ git rm -f [fileName]
copy

Remove an entire directory from the working index (cached)

>_ git rm -r --cached [directoryName]
copy

Delete an entire directory (force)

>_ git rm -r -f [fileName]
copy

Delete a remote branch

>_ git push origin :[branchName]
copy
Copied to clipboard
free 100$ digital ocean credit