| Github login | git remote set-url origin https://[email protected]/USERNAME/PROJECTNAME | |
|---|---|---|
| Unstage a file | git reset FILENAME | This will remove the file from the current index without changing anything else. ("about to be committed" list) |
| Revert Uncommitted Changes | |
|---|---|
| Revert everthing | git restore . |
| Revert specific file | git restore FILEPATH/FILENAME |
| Reverting an old pushed commit | |
|---|---|
| git log | Get SHA of the unwanted commit |
| git revert SHA | |
| git push origin main | Push again |
| Exclude files from local repo | |
|---|---|
| Open | .git/info/exclude |
| Add | folderName/ (Excludes folder) |
| folderName/* (Excludes everything in that folder and its subdirectories) |
| Ignore files except a specific file inside a directory | |
|---|---|
| Ignore everything under "directory" | directory/* |
| But don't ignore "another_directory" | !directory/another_directory |
| But ignore everything under "another_directory" | directory/another_directory/* |
| But don't ignore "file_to_be_staged.txt" | !directory/another_directory/file_to_be_staged.txt |