The title of this blog post is a parody of Stanley Kubrick's magnus opus, Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb. I was and still am absolutely terrified of the terminal, i was absolutely terrified of using git hub on the command line interface , i totally noobed out and used the source control VS code button, and i still didn't understand github actions/cli/the terminal. I got my buddy (shout out C.Scott!) to baby me and hold my hand whilst i went through the my first actions , git add ., git commit -m "" , git status etc. etc. all of them foreign to me, i felt like a hacker in that film swordfish, really strange film in hindsight.
Command | What it does |
---|---|
cd | The cd command helps the directory tree navigation in macOS. | cd .. | Parent directory | ls | List Directories aka View the contents of a directory with the ls command |
git add filename_here | How to add a file to the staging area in Git: The command below will add a file to the staging area. Just replace filename_here with the name of the file you want to add to the staging area. |
git init | Initialise a new repo: To create a new repo, you'll use the git init command. git init is a one-time command you use during the initial setup of a new repo. Executing this command will create a new .git subdirectory in your current working directory. This will also create a new main branch. |
git add . | If you want to add all files in your project to the staging area, you can use a wildcard . and every file will be added for you. |
git clone < repo url > | Cloning an existing repository: git clone |
git add fil* | With the asterisk in the command below, you can add all files starting with 'fil' in the staging area |
git status | This command will show the status of the current repository including staged, unstaged, and untracked files. |
git commit | This command will open a text editor in the terminal where you can write a full commit message. |
git commit -m "your commit message here" | You can add a commit message without opening the editor. This command lets you only specify a short summary for your commit message. |
git log | This command shows the commit history for the current repository |
git branch branch_name | By default, you have one branch, the main branch. With this command, you can create a new branch. Git won't switch to it automatically – you will need to do it manually with the next command. |
git checkout branch_name | When you want to use a different or a newly created branch you can use this command |
git push | When all your work is ready to be saved on a remote repository, you can push all changes using the command below |
git pull | If other team members are working on your repository, you can retrieve the latest changes made to the remote repository with the command below |