git overwrite remote files
git push -fe.g. git push -f origin main
Here is what the above code is Doing:
1. git fetch –all
2. git checkout -b
3. git reset –hard
4. git push -f
git push -fe.g. git push -f origin main
Here is what the above code is Doing:
1. git fetch –all
2. git checkout -b
3. git reset –hard
4. git push -f
#how to copie files using ssh #copy a file from B to A while logged into B: scp /path/to/file username@a:/path/to/destination #to copy a file from B to A while logged into A: scp username@b:/path/to/file /path/to/destination Here is what the above code is Doing: 1. ssh into the remote machine 2. cd to the directory where…
# This would only work when you have virtualenv activated. # Kinda obvious, but I guess I’ll point it out. # Just type in this in your shell: deactivate Here is what the above code is Doing: 1. It’s creating a virtual environment called “venv” 2. It’s activating the virtual environment 3. It’s installing the…
# Basic syntax: grep -o -E ‘.{0,3}string.{0,4}’ your_file.txt # Where: # – This expression returns 3 characters before string and 4 after # -o specifies returning only the matching text, not the entire line # -E specifies allowing extended regular expressions (some answers # change this to -P, but that doesn’t work on macOS) Here…
“Repository Name” was causing problem. I found that this name can NOT include upper case letters or spaces. After I changed the name to all lower cases, and replaced spaces with “_”, everything is back to normal. Here is what the above code is Doing: 1. It creates a new repository on GitHub. 2. It…
for i in *; do echo $i; done Here is what the above code is Doing: 1. The first line is a comment. 2. The second line is a shebang. 3. The third line is a for loop. 4. The fourth line is a command. 5. The fifth line is a comment.
* */ !.gitignore Here is what the above code is Doing: 1. We’re creating a new file called .gitignore. 2. We’re opening the file in write mode. 3. We’re writing the contents of the file. 4. We’re closing the file.