Git and GitHub

Git and GitHub

One of the biggest reasons why I love to be a tech person is "Problem Solving". Where you face some problems there is always someone to help you in your journey.

Programming is not a profession, it's a passion to solve problems. Early days of programming when programmers face a problem working together or in a team a solution pop-up as a Git & GitHub. It resolves every issue regarding programming/coding in more than one developer.

What is Git?

A software maintained by Linux, used for a version control system to manage source code history. Git is installed locally on your system and doesn't use any management feature. It is an open-source license.

What is GitHub?

GitHub is a website maintained by Microsoft, used for hosting services for git repositories.GitHub has a built-in user-management feature. It includes a free tier and a pay-for-user tier. It has an active marketplace for tool integration.

Now we talk about How to use different Commands of Git with GitHub and how we can easily resolve our GitHub-related problems.

#Problem01: How to remove the commit which we did mistakenly?

Solution:

First check logs of the all commits:

git log

then remove the last commit with:

git reset --Head Commit_ID

then push the remaining commits to the origin:

git push origin +branch_name(your master/main branch)

#Problem02: How to undo a recent commit?

Solution:

Git reset --Head~

Note: The last tillet is used for changes, if you want to access all the changes which were made in the last commit you can get all of them.

#Problem03: How to amend changes in Commit?

Solution:

Git Commit am

#Problem04: How to rename any branch of the repository?

Solution:

git branch -m old_name_of_branch new_name_of_branch

#Problem05: How to clean untracked files?

Solution:

git clean -n (show untracked file)

git clean -f (remove the untracked file)

#Problem06: How to remove the git ignore file which we uploaded first but now want to remove?

Solution:

git rm --cached file_name

Let's Learn together :)

Like
Reply

To view or add a comment, sign in

More articles by Sajjad Ali

  • Single Page Application

    What is a Single Page Application? Single page application is a web application or website that interacts with the user…

  • Yarn vs npm

    Package Manager: A package manager enables you to install, uninstall, manage packages’ dependencies and binaries, as…

    4 Comments

Others also viewed

Explore content categories