Skip to content
June 1, 2026
  • Linkedin
  • Twitter
  • Facebook
  • Youtube

Daily CyberSecurity

Zero-hour alerts. Unmatched analysis.

Primary Menu
  • Home
  • CVE Watchtower
  • Cyber Criminals
  • Data Leak
  • Linux
  • Malware
  • Vulnerability
  • Submit Press Release
  • Vulnerability Report
Light/Dark Button
  • Home
  • Technique
  • Some useful git commands
  • Technique

Some useful git commands

Ddos May 25, 2017 4 minutes read
git commands

In the case of project management with Git, there are some frequently encountered problems that are complicated to deal with. This article records some common commands and operations.

Modify the description of a submission

Sometimes we need to modify the description of the time before the submission of information, no operation can be done directly, but the use of rebasing command can be achieved.

For example, we want to modify the penultimate submission of the description information:

$ git rebase -i HEAD~3

Note: here HEAD ~ followed by 3 instead of 2, because here refers to the submission of the submitted parent to be modified.

And then will enter the text editing interface, as shown below

Will be modified to submit the previous pick to edit, save and exit.

This time to perform

$ git commit --amend

You can modify the description of the submission, modify and save and exit.

$ git rebase --continue

After the execution of this order, subsequent submissions will not change.

Note: Do not modify the commit that has been pushed to the remote repository! 

View, delete, rename remote branch

View all branches (including remote branches)

$ git branch -a

When a branch has been merged into the main branch, we usually delete the branch, if only git branch -d is to delete the local branch

To delete a remote branch, use the following command

$ git push origin --delete <branchName>

Renaming a branch is not very common, you can first delete the remote branch, and then rename the local branch, then rename the local branch pushed to the remote warehouse

$ git push --delete origin <branchName>

$ git branch -m <branchName> <newBranchName>

$ git push origin <newBranchName>

Merge multiple submissions

For example, to merge the last two submissions, in fact, and modify the information submitted a description of a bit similar.

$ git rebase -i HEAD~2

After the same will enter the text editing interface, the beginning of the second line of the pick to squash or s , save and exit.

At this time git will be submitted twice to merge and prompts you to enter the new submission information, save the exit after the successful completion of the merger of the two completed.

Force the remote repository back to the specified commit

When we develop some critical mistakes and make sure that the development work that is now done is meaningless, it may be necessary to roll back to the previous version.

$ git reset --hard <commit_id>

$ git push origin HEAD --force

In addition, the reset command has several optional parameters

  • Git reset – mixed: This is the default way, without any parameters git reset, instant this way, it back to a version, only to retain the source, return commit and index information.
  • Git reset – soft: roll back to a version, only back the commit information, will not return to the index file level. If you have to submit, you can directly commit.
  • Git reset-hard: completely back to a version, the local source will become the last version of the content.

Reset after reset-hard

Use git reset --hardafter, perhaps only to find it was a wrong action, then we want to revert to the previous version.

This time with git log is not seen before the submission of historical records.

You need $ git reflogto find the ID HEAD We need to restore, and then use the reset command to restore back.

View the contents of a specified file

For example, to see the contents of the test.cpp file submitted by f4869b0, the path to test.cpp needs to use the pathname relative to the git directory, using the following command:

$ git show f4869b0:test.cpp

The contents of the file will be displayed on the interface, you can use the file to redirect to another file, and then follow-up operation.

Share this article:

Facebook Post LinkedIn Telegram

Related posts:

  1. CVE-2022-41903 & CVE-2022-23521: Critical RCE flaws in Git
  2. Critical Git Vulnerability CVE-2024-32002: Researcher Unveils RCE Exploit with PoC
  3. Git Project Patches 3 Flaws: RCE, Arbitrary File Writes & Buffer Overflow
  4. CISA Adds Citrix and Git Flaws to Known Exploited Vulnerabilities Catalog
  5. OpenSSH Flaw (CVE-2025-61984) Allows Remote Code Execution via Usernames
Tags: git git commands

Search

Translation

CVE WATCHTOWER
🚨

Receive alerts for vulnerabilities being exploited in the wild.

⚡

Get notified instantly when a Proof of Concept (PoC) exploit is published.

🔍

Access critical info on vulnerabilities even when marked as "RESERVED".

🧠

Insights powered by decades of expertise and global intelligence sources.

🎯

Customize alerts with up to 10 keywords for your specific tech stack.

📊

Export the raw CVE database for SIEM integration and reporting.

Upgrade Package

🔴 Live Critical Threats

  • CVE-2026-48879CVSS 9.8
    Incorrect Privilege Assignment vulnerability in Sergey AIWU allows Privilege Escalation. This issue...
  • CVE-2026-48866CVSS 9.6
    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability...
  • CVE-2026-42682CVSS 9.1
    Missing Authorization vulnerability in Tomdever wpForo Forum allows Exploiting Incorrectly Configured Access...
  • CVE-2026-42680CVSS 9.8
    Incorrect Privilege Assignment vulnerability in Wasiliy Strecker / ContestGallery developer Contest Gallery...
  • CVE-2026-47413CVSS 9.6
    ## Summary **Type:** Privilege escalation / cross-tenant member injection. The `POST /workspaces/{workspace_id}/members`...
  • CVE-2026-47428CVSS 9.6
    ## Summary Vitest browser mode served `/__vitest_test__/` with the `otelCarrier` query parameter...
  • CVE-2026-7858CVSS 9.8
    A Deserialization of Untrusted Data vulnerability affecting Teamwork Cloud from No Magic...
  • CVE-2026-48188CVSS 9.1
    An improper Input Validation vulnerability in OTRS or ((OTRS)) Community Edition database layer...
  • CVE-2026-10187CVSS 9.8
    A vulnerability was detected in Totolink N300RH 6.1c.1353_B20190305. Affected by this issue...
  • CVE-2018-25412CVSS 9.8
    Delta Sql 1.8.2 contains an arbitrary file upload vulnerability that allows unauthenticated...
Powered by CVE WATCHTOWER

Recent Zero-Day Vulnerabilities

  • Exploited in the Wild: Critical OWA Spoofing Flaw (CVE-2026-42897) Hits On-Premises Exchange Servers
  • Exploited in the Wild: Maximum CVSS 10 SD-WAN Flaw (CVE-2026-20182) Grants Admin Control
  • Exploited in the Wild: Critical 9.8 CVSS RCE Hits Canon GUARDIANWALL MailSuite
  • Exploit Code Released: Public PoC Dumps for Windows BitLocker Bypass and SYSTEM Elevation Zero-Days
  • Exploited in the Wild: “Dirty Frag” Linux Vulnerability Grants Instant Root Access
  • Under Active Attack: Ivanti EPMM Zero-Day Exploited in the Wild via Harvested Admin Credentials
Our Websites
  • Penetration Testing Tools
  • The Daily Information Technology
  • Daily CyberSecurity

    • About SecurityOnline.info
    • Advertise with us
    • Announcement
    • Contact
    • Contributor Register
    • Login
    • About SecurityOnline.info
    • Advertise on SecurityOnline.info
    • Contact Us

    When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works

    • Disclaimer
    • Privacy Policy
    • DMCA NOTICE
    • Linkedin
    • Twitter
    • Facebook
    • Youtube
    Copyright Daily CyberSecurity © All rights reserved.