Git: go back to a specific commit and discard all commits after it permanently


To permanently go back to a specific commit and discard all commits after it, you can use the following Git commands:

1) Reset to the specific commit:

git reset --hard <commit-hash>

Replace <commit-hash> with the hash of the specific commit you want to reset to. This will move your branch pointer back to that commit and discard any changes in the working directory and staging area.

2) Force push the reset (if working with a remote branch):

If you’re working on a branch that is shared with others or is pushed to a remote repository (e.g., origin), you’ll need to force push the changes to discard the later commits on the remote as well:

git push origin <branch-name> --force

Replace <branch-name> with the name of your branch.

Caution

This is a destructive operation: All the commits after the specified one will be lost permanently unless they exist in another branch or are otherwise referenced.

Make sure you’re certain before running these commands, especially when using --force, as it changes the history on the remote repository, which can affect other collaborators.

Desktop Environment (Change)

https://support.system76.com/articles/desktop-environment/#different-desktop-environments

Change Default Display Manager:

sudo dpkg-reconfigure gdm3 

Check which display manager is running:

systemctl status display-manager.service  or  $ cat /etc/X11/default-display-manager 

Restart GDM:

sudo systemctl restart gdm

Ubuntu + RDP on Oracle Cloud

The first one works the best. Open an SSH connection to the server and run these commands:

sudo su
cd ~
apt update
apt upgrade
apt -y install lxqt sddm xrdp
systemctl status xrdp

The XRDP port needs to be open in Oracle Cloud and search for ‘Virtual Cloud Networks’. Then select the network and go to the ‘Security Lists’ and click on the default one. Then add ingress rules:

The open the port in iptables by editing /etc/iptables/rules.v4

Make a copy of the rule for port 22 and change the value to 3389

Then run:

iptables-restore < /etc/iptables/rules.v4

Create a file in your home folder (/root) called .xsession

nano .xsession

Alternative videos – they may install a different desktop:

OpenSSH SSH-2 private key (old PEM format)

Taken from here: https://stackoverflow.com/questions/60884217/openssh-ssh-2-private-key-old-pem-format-on-azure-linux-vm

You’ve used ssh-keygen to create a private key file called id_rsa.ppk. However this is an OpenSSH-format private key and needs to be converted to Putty’s own format to use in Putty.

Your options are:

  1. Use this key with command-line SSH (it’s in the correct format). You can either
    1. specify the file on the command line e.g. ssh -i id_rsa.ppk azureuser@vm
    2. make a folder C:\Users\Aquib\.ssh and move it there as C:\Users\Aquib\.ssh\id_rsa (no extension): ssh will now load this file by default to use for all servers that you try to connect to
    3. if you don’t want to use this for all servers, or e.g. if you already have a default id_rsa that you use with git, you can set up a C:\Users\Aquib\.ssh\config file that tells SSH where to find the key and tell it which servers it should use it for.
  2. Convert this file into the right format to use with Putty:
    1. In Puttygen, in the ‘Conversions’ menu choose ‘Import’ and load id_rsa.ppk
    2. ‘Save private key’ to a different file
    3. Use this new file with Putty, either on the connection properties menu or run Pageant (the Putty key agent) and ‘Add key’ the new file. (You can e.g. create a shortcut to pageant in your Startup menu and give it the key file name as a commandline parameter so this is loaded automatically for you.)

NextCloud Setup – 200GB Free Cloud Storage on Oracle Cloud

https://www.youtube.com/watch?v=iBODItwRFvU