GIS4DEV / GIS4DEV.github.io

Open Source GIScience & GIS for Development
1 stars 12 forks source link

other helpful git commands #45

Open derrickburt opened 3 years ago

derrickburt commented 3 years ago

git push --force This is kind of a last-ditch effort if you have merge conflicts that you cannot resolve. I would only recommend using this command when a single file is staged.

git reset This will remove any staged changes. i.e.) If you stage a file that is too large and keep getting an error (even if you have deleted the file from the cybergis environment), this command will remove the staged file.

git mergetool a safe way to track the differences that are causing merge conflicts. Opens up a GUI in the terminal and allows you to resolve the changes while storing backup copies of conflicting files (so you are able to sift thru the copies on both sides of the commit).

derrickburt commented 3 years ago

remote set-url origin https://github.com/emample_user/repository_name If you rename your repository, it does not change the file path, and thus you will not be able to push and pull changes from cybergisx to your repository (or vice versa) until you reset the url with the above command.

josephholler commented 3 years ago

Also, github doesn't accept passwords from command line anymore. You need to use a token instead, and here's how to create one: https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

josephholler commented 3 years ago

and it helps to know that shift + insert can paste into the command line from windows!