refresh on Git basic commands

  • git add . *initiate the changes in the directory at a snapshot like a photo in the staging/staged area before it is finally updated to the remote repository with this git commit command.
  • git commit -m “[write in concise update message of that file]” ***make the language concise for other developers to access and understand…***
  • git push *this git command send changes from the local repository/environment to remote repository to be updated in git commits.
  • git init command can be done both locally on your computer or remotely/in the cloud on GitHub.com is best when starting up a new repository aka repo
  • git clone is when we take GitHub’s HTTP or SSH link to clone the repo into our local text editor to begin working on files of an application and its projects aka an already existing repository that is worked on
  • Read more on git init
https://git-scm.com/docs/git-init
  • git config- -global user.name “name”
  • git config- -global user.email “name@email.com”
  • When working with GitHub, our name and e-mail are what will help track these changes. Here is a tutorial that covers setting up Git on your local machine at the timestamp of 4:16.
  • We want to be able to track all the changes done by us and who made what changes when collaborations in our environment.
  • enter git config -l **-l means “list” to make sure our machine will display all settings, currently.
https://youtu.be/kHkQnuYzwoo
Saved Changes Visualization. We can check it with “git diff”, “git log”, “git status” https://www.youtube.com/watch?v=Vb0Ghkkc2hk&list=PLg7s6cbtAD17Gw5u8644bgKhgRLiJXdX4&index=5
  • git log command tracks all the git commits starting with the most recent commit listed first in that descending order
  • git reflog command only track and highlights the one and most recent commit
  • git diff command aims at revealing comparisons with commits, branches, a single file across revisions of branches, etc. or just between what is a snapshot of commits between the working and staging areas
  • git status command reveals the state of the working directory and the staging area, except for the project’s history commits, so for that use git log command. Otherwise, the git status command displays staged, unstaged, and untracked files.
Git commands: git reflog, git log, git diff, git status
  • .gitignore tells us which file we do not want under version control
Screenshot Demo of GitHub Desktop by The Coder Coder performing a merge from the feature — 1 branch to the main of the Github repository. On the left behind this notification window are the view Changes and History tabs, the Commit box at the lower left-handed corner, and the tabs on which branch to update.
  • GitHub Docs: Creating a personal access token documentation walkthrough
  • PATs “are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line” (GitHub Docs)
  • PATs can be customized on who and when the repository is accessed. For security purposes, when can set an expiration date on PATs. (GitHub Docs)
  • Most importantly, “GitHub automatically removes personal access tokens that haven’t been used in a year” (GitHub Docs)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Toni T Diep

Toni T Diep

multilingual Software Engineer, always learning and growing.