
I am a commercial real estate professional making a career pivot & loving every second. 🏢🚀💻
As a software engineer from a non-traditional background I can help others on their journey to join the tech industry.
Search for a command to run...

I am a commercial real estate professional making a career pivot & loving every second. 🏢🚀💻
As a software engineer from a non-traditional background I can help others on their journey to join the tech industry.
I enjoy reading it, and I also bookmarked it for reference. Thank you for sharing
Hopefully, this helps you the next time you forget a Git command. Thanks for reading!
My goal with this series is to train people with zero coding experience and turning them into high-earning software engineers.
Getting my first job in the tech industry was one of the hardest things I've done. One tip I have for anyone trying to make the switch is that it's a numbers game. According to my career coach, it takes on average 600 job applications for bootcamp gr...
The scariest thing when learning how to code is running into bugs. Early on in your coding journey, even the smallest bug may seem like an insurmountable challenge. Luckily, we have modern web browsers and tools to help us tackle these challenges. ...

The hardest part of becoming a software engineer is starting. New developers may feel overwhelmed and never take the first step. Before writing a line of code every developer needs to first set up their dev environment. This article is to help non-de...

Functional programming is a way of programming that creates clean and maintainable code. It was something that I wanted to get into and have started to learn in these last few months. The company I am working at now uses functional programming heavil...

Writing blog articles is one of the most tedious and difficult things I have done. I'm sure a lot of you can relate if you're on Hashnode. If you don't know I also run another blog called Coffee Informer where I write articles about coffee. I've trie...

It's your 10th time searching how to vertically align a div in CSS, and you're clicking the same forum post or w3 school link for the 100th time. We've all been there... I'm sure that most programmers have used w3 school or stack overflow to quickly ...

Git is one of the most useful tools that any developer has up their sleeves. No matter what kind of development you are doing, understanding how to use Git will be a valuable asset that can save your butt.
There is often a lot of anxiety with Git, but if you understand Git and everything you can do with it, there is no reason to fear.
I will do my best to explain Git, how to use it, and provide a list of all the most common commands that you may need to use. Bookmark this page for easy access to the most useful Git commands.
Git is a version control system. It tracks any changes made to files in a directory and keeps a record of previous versions of these files. This allows you to easily revert code changes with bugs. It also enables collaboration. Multiple people can work on the same code and use Git to merge their code into one branch once they are finished.

It is extremely important to learn how to use Git if you want to land a job in the tech industry. In any professional setting, you will probably be using some form of Git to collaborate with other members of your team. In my personal experience, both the companies I worked at used GitHub.
Usually, Git stores your files locally, but with GitHub, you can have an online location where your files and version history are stored. When working with multiple people this is a godsend, although merge conflicts make me sad.
When using Git it is important to realize that you aren't doing it for yourself. Git best practices are important because you will be working with other people and they need to be able to understand and follow what you are doing.
Make sure you are committing often. Having a history of your code is helpful for testing and bailing you out if something happens to any unsaved files. It's like saving at a checkpoint in a video game, you can always just go back to a save point if you reach a dead end.
Create multiple branches and don't always directly push onto master or main. This is important once you start collaborating with others. It prevents you from pushing up buggy code which gives a clear distinction between what is a work in progress and what is tested and merged into the main branch.
I like following Conventional Commits which is a convention to name which helps you create an explicit commit history. This makes it easier to read and allows you to use automated tools such as automating CHANGELOGs. You should check out the website and read about how it works. If you think it fits your coding style feel free to adopt it into your toolbox!
I mentioned previously that you will need to work with others when using Git. This is where Git really shines because of how easily it lets you asynchronously work on the same code someone else is.

Pull requests are the preferred way of reviewing and merging code. Usually once you are finished with a feature on your local branch you will push up the code to the remote repository (Github). Then you will open up a pull request/merge request. This notifies others that your code needs to be reviewed. Usually, collaborators will leave comments that you will need to fix. Once approved you can merge your code onto the main branch.
Resolving merge conflicts is not as big of a deal as it may seem. It will happen all the time because multiple people will be touching the same files. This only happens with Git cannot automatically merge 2 branches. Usually, what you have to do is check with the other developer that made the change and collaborate to make a solution that works for both of you.
Branching strategies are the last part of working with others. There will usually be an already established strategy when you are joining a company. The most common strategies are single branch, feature branching, and git flow. Single branch strategies are usually for when you are not working with others and pushing all changes to a single branch. Feature branching strategies create new branches for each new feature or bug, then merge them into the main branch. Git flow has 2 ongoing branches, usually main and develop. Features are developed on the develop branch and then merged into the main branch as a release.
This command creates a new git repository and it is usually one of the first things you do when starting a new project.
remote-name repository-name or urlThis is usually the second command you would run when creating a new project. Adds a remote tracking branch and remote-name is usually origin. You usually put the repository url after the remote-name.
Example: git remote add origin https://github.com/user/repo.git
Checks your current changes in your directory and shows you what has been staged, what hasn't, and any new files.
directoryAdds the files in the specified directory to be staged for the next commit. You can specify files to add through the directory. You can do this command as many times as you like and add as many files as you like to be staged before you commit.
Example: git add . or git add ./folder
commit-message"This command commits to staging with a message. Commits are saved changes and explain to others what you have done in the project. Good commit messages are an important way to provide useful information in case you did something wrong and need to look back to previous changes to revert code.
Below this list, you will find a short guide to conventional commits.
Example:
Bad commit git commit -m "do the thing"
Good commit git commit -m "BREAKING CHANGE: 'extends' key in config file is now used for extending other config files"
commit-message"Combines the top 2 commands and allows you to add and commit to staging at once. This only works on files that Git is already tracking. If you added new files to your repository you will still have to do git add directory
Example: git commit -am "feat: Zhu Li, do the thing!"
branch-nameCreates a new branch with your branch name. This doesn't switch you to your new branch, it just creates it. Branching is great because it allows you to create a branch from the main source code to work on code in an isolated location.
Example: git branch new-feature
branch-nameUpdates your files in your local repository to match the files on the branch in the tree. Any changes on you make to your code will bet kept on this branch and can be commited to the branch.
Example: git checkout old-feature
branch-nameThis combines the top 2 commands by creating a new branch and then switching to it. Equivalent to using git branch branch-name then git checkout branch-name.
Example: git checkout -b feature
branch-nameDeletes a branch in your local Git. You should typically do this after you merge in your code on your branch to the main branch. You can always recreate your branch in the future if you need to. Git will also tell you if there are unmerged changes on your branch so you should not be afraid to delete old branches with merged code.
Example: git branch -D merged-branch
commit-hashResets your local files to the specific commit-hash. This is a potentially dangerous command if you have uncommitted changes. Any untracked files or directories will be discarded and you will not be able to recover them
Example: git branch -D 4c85240745b8ae1fe405ad5893ad66cd2a8afee3 or git branch -D HEAD (resets your files to HEAD)
Pushes your code from your local repository to the remote repository. If you are using GitHub the files in the repository will reflect the same files as your local repository after pushing.
This is the same command as above but it allows you to rewrite the history on the remote repository with your local history. When doing this you must be careful because it may be easy to delete history and code accidentally, especially if you are working with other people.
remote-name branch-name repository-nameUpstream branches are the remote repository's way of tracking your local branch. They are also called the remote tracking branch. You have to set up an upstream branch before you start pushing your code to the remote repository.
Example: git push --set-upstream origin new-feature
remote-name branch-name repository-nameThis does the exact same thing as the above command
Example: git push -u origin new-feature
Fetch downloads commits, files, and refs from a remote repository on your local repo. It allows you to see what others have been working on and lets you test their code on your local repository.
Incorporates changes from a remote repository into the current branch. If your current branch is behind the remote, then by default it will fast-forward the current branch to match the remote.
commit-hash-source commit-hash-destinationDiff shows the difference between a commit and one of the commit's ancestors. You use the commit hash in the command to specify which commits to compare.
Example: git diff 0da94be 59ff30c
branch-nameIncorporates any changes from a different branch into your current branch. Git will attempt to automatically merge any commits for you. However, if there are files that are changed by both branches you will need to manually resolve any conflicts.
commit-hashTakes the changes from a specific commit and adds them to your current branch. You specify the commit by the commit hash. This is great in a team setting where you can cherry-pick specific pieces of code to test or use in your own local repository.
Example: git cherry-pick 59ff30c
Before you can collaborate with other developers knowing how to use Git is a prerequisite. That means if you're trying to break into the tech industry learning how to use Git is imperative.
Now that you know how to use Git the next thing you should do is create a developer portfolio showcasing all your projects. You can read my guide on that here.
