GIT Commands

To find all branches
git fetch --all

To find all branches with date time
git for-each-ref --sort=-committerdate refs/remotes/ --format="%(refname:short) %(committerdate)"

To find the commit history of your current branch in Git, you can use the following command in your terminal:
git log
This will show the commit history for the branch you're currently on, including the commit hash, author, date, and commit message.
-If you want a more concise view, you can use:
git log --oneline
This will display each commit on a single line, showing the commit hash and the message.

To view the history with branch and merge information in a graphical format, you can use:
git log --graph --oneline --all --decorate
This provides a clear visualization of branches and merges.

To load a specific commit temporarily without changing your current branch, you can use the following command:
git checkout <commit-hash>
This will put you into a "detached HEAD" state, meaning you're not on any branch but at that specific commit. You can explore the files and test things out. However, since you're in a detached state, any changes made will not be associated with a branch unless you explicitly create a new branch or return to a different branch.

If you want to return to your previous branch, you can use:
git checkout -

Rename Master to Main
-Rename local master branch to main
git branch -m master main
git status
-Rename remote master branch to main
git push -u origin main
git push origin --delete master


Leave a Comment

Your email address will not be published. Required fields are marked *