Skip to content

Instantly share code, notes, and snippets.

@cocomatias
Last active June 27, 2021 16:35
Show Gist options
  • Save cocomatias/9bd72e00529f0f45a4c0a47fe2a0873e to your computer and use it in GitHub Desktop.
Save cocomatias/9bd72e00529f0f45a4c0a47fe2a0873e to your computer and use it in GitHub Desktop.
Git important Commands

Git important Commands

Add remote Repo

  • git init
  • git remote add origin GITHUB_REPO_LINK
  • git pull origin master Pull the .gitignore and README.md files from github

Create a local branch and push those changes to github:

(Create a local branch, put all your changes to that branch and finally push that branch to github)

  • git checkout -b NAME_OF_NEW_BRANCH
  • git add .
  • git commit -m "Description of modified or created archives"
  • git push -f origin NAME_OF_NEW_BRANCH

When .gitignore is not working

(This commands will remove all your added changes saved on cache and then add those changes again but with .gitignore taking into account)

  • git rm -rf --cached .
  • git add .

Delete a branch

  • git push origin --delete NAME_OF_BRANCH

Creating tags

(Create tag and push to Github repo)

  • git tag NAME_OF_TAG -a It will open a file, and there you put your tag description. Similar to a README file
  • git push --tags Push tag to github repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment