Wednesday, 16 July 2025

Git Cheat Sheet

TKIET LINUX USER GROUP                                                            Harshvardhan Patil

✅ Git Cheat Sheet — Step-by-Step Guide for GitHub


📂 Phase 1: Pushing a File to GitHub (First Time)

1️⃣ Initialize Git in Your Project Folder

git init

Sets up a new Git repository.


2️⃣ Link to Your GitHub Repository

git remote add origin https://github.com/username/repo.git

Connects your local repo to GitHub.


3️⃣ Stage Files for Commit

git add demo.txt

or to add all files:

git add .

4️⃣ Commit the Files

git commit -m "Initial commit: Added demo.txt"

Saves changes in Git history.


5️⃣ Push Files to GitHub

git push -u origin main

Replace main with your branch name, e.g., master if needed.


📝 Phase 2: Modify & Push Updates

1️⃣ Edit demo.txt

2️⃣ Check Status

git status

3️⃣ Stage Updated File

git add demo.txt

4️⃣ Commit the Changes

git commit -m "Updated demo.txt content"

5️⃣ Push Changes to GitHub

git push

🎯 Bonus Git Commands

🔹 Check Commit History

git log

🔹 Clone an Existing Repository

git clone https://github.com/username/repo.git

🔹 List Files in Folder

ls

🛠️ Configure Git (One Time Setup)


git config --global user.name "Your Name" git config --global user.email "you@example.com"

🔄 Restore a File from a Previous Commit

1️⃣ Check Commit History

git log

2️⃣ Restore a Specific File

git checkout <commit-hash> -- demo.txt

Restores demo.txt from specific commit.

3️⃣ View File from Old Commit Without Changing Anything

git show <commit-hash>:demo.txt



🌿 Git Branching: Create, Switch, Merge

ActionCommand
Create a branchgit branch feature-branch
Switch to a branchgit checkout feature-branch or git switch feature-branch
Create & Switchgit checkout -b feature-branch or git switch -c feature-branch
List branchesgit branch
Merge branch to maingit merge feature-branch
Delete a branchgit branch -d feature-branch
Force delete a branchgit branch -D feature-branch
Push branch to GitHubgit push origin feature-branch
Delete branch from GitHubgit push origin --delete feature-branch

📝 Example Workflow of Branching

1️⃣ Create & Switch to Branch

git switch -c feature-branch

2️⃣ Make Changes, Add & Commit

git add . git commit -m "Added new feature"

3️⃣ Switch Back & Merge

git switch main
git merge feature-branch

4️⃣ Delete Branch

git branch -d feature-branch



Thursday, 12 September 2024

Section 5 - Certain Laws Not to Be Affected by This Act

Indian Penal Code (IPC)

Summary

Section 5 of the Indian Penal Code (IPC) ensures that the IPC does not override any special or local laws that provide for offenses and punishments. It allows special laws specific to certain areas, communities, or subjects to coexist without contradiction, keeping them effective alongside the IPC.

Description
Special and Local Laws
The IPC covers most criminal offenses in India, but Section 5 ensures that it does not interfere with other laws that might provide different penalties for specific cases. These include:

  • Special Laws: Laws enacted for specific purposes or subject areas, such as:

    • The Narcotic Drugs and Psychotropic Substances Act (NDPS Act)

    • The Prevention of Corruption Act

    • The Protection of Children from Sexual Offenses (POCSO) Act

  • Local Laws: Laws created for specific regions, states, or communities, such as:

    • The Bombay Prohibition Act (for Maharashtra)

    • The Delhi Rent Control Act (specific to Delhi)

    • Tribal laws or acts for autonomous areas

Coexistence of Laws
Section 5 ensures the IPC coexists with these laws to avoid legal conflicts. If an act is an offense under both the IPC and a special law:

  • The provisions of the special law are applied first.

  • This prevents duplication or contradiction in legal penalties.

Offenses and Punishments
Section 5 doesn’t list offenses, but it influences how other laws are applied:

  • Special Law Offenses: Offenses covered by both the IPC and special laws, such as narcotics or corruption, are governed by the special law.

  • Local Law Offenses: In areas where local laws apply, they take precedence, even if the IPC has similar provisions.

Purpose and Importance
Purpose
The purpose of Section 5 is to prevent confusion in legal applications. It ensures that the IPC doesn’t interfere with special or local laws, allowing them to function as intended.

Importance

  • Legal Flexibility: This provision is crucial in a diverse country like India, where regions may have unique legal needs.

  • Prevention of Legal Conflicts: By giving special and local laws precedence, Section 5 avoids contradictions and ensures smooth legal processes.

Application
Territorial Extent
Section 5 applies across India, ensuring that the IPC doesn’t interfere with local or special laws in specific regions. For example, a local law in Maharashtra takes precedence over the IPC for certain offenses in that region.

Jurisdiction
Indian courts are responsible for ensuring that both IPC and special/local laws are applied correctly. When relevant, courts must give precedence to special or local laws.

Legal Implications
Legal Impact

  • Precedence of Special Laws: Section 5 clarifies that special laws take precedence when a conflict arises between them and the IPC.

  • Dual Applicability: When offenses are covered by both the IPC and a special or local law, courts will reference both statutes but prioritize the special law.

Example
A public servant involved in corruption may face charges under both the IPC and The Prevention of Corruption Act, but the latter would take precedence.

Relevant Case Law

  1. Sundar Lal v. State of Madhya Pradesh (1957): The court ruled that a special law, like the Central Provinces and Berar Letting of Houses and Rent Control Order, would take precedence over the IPC, reflecting Section 5's intent.

  2. A.R. Antulay v. R.S. Nayak (1984): In this case, the Supreme Court confirmed that a special law, such as the Prevention of Corruption Act, would supersede the IPC in cases of conflict.

  3. Nathu Lal v. State of Madhya Pradesh (1966): The court emphasized that where a special law exists, it should be given effect over the general provisions of the IPC, ensuring no contradiction between the statutes.

Relevant Sections

  • Section 1 IPC: Defines the territorial scope of the IPC.

  • Section 4 IPC: Extends IPC jurisdiction to offenses committed outside India but doesn’t affect the applicability of special laws.

Related Provisions and Laws

  • The Prevention of Corruption Act (1988): A special law designed to address corruption, taking precedence over IPC provisions related to bribery.

  • The Narcotic Drugs and Psychotropic Substances Act (1985): A special law combating drug-related offenses, which overrides IPC provisions related to narcotics.

  • The SC/ST (Prevention of Atrocities) Act (1989): A special law addressing crimes against SCs and STs, with stronger provisions than the IPC.

Conclusion
Section 5 ensures that the IPC doesn’t interfere with or override special or local laws designed for particular legal needs. This section preserves the coexistence of multiple legal frameworks, ensuring India’s legal landscape remains flexible and adaptable to various communities and regions.


Section 3 - Punishment of Offenses Committed Beyond India but Triable Within India

Indian Penal Code (IPC) 

Summary

Section 3 details the punishments for specific atrocities committed against members of Scheduled Castes (SCs) or Scheduled Tribes (STs), both within and beyond Indian territory. It outlines the nature of these offenses and their corresponding legal consequences.

Description

Offenses and Punishments

Offenses Against SCs or STs

Physical Harm and Humiliation:

  • (a) Putting any inedible or obnoxious substance into the mouth of a SC or ST member or forcing them to consume such substances.

  • (b) Dumping excreta, sewage, carcasses, or other obnoxious substances in or at the entrance of the premises occupied by a SC or ST member.

  • (c) Intentionally dumping excreta, waste matter, or other obnoxious substances in the neighborhood of a SC or ST member with the intent to cause injury, insult, or annoyance.

  • (d) Garland with footwear or parade a SC or ST member naked or semi-naked.

  • (e) Forcibly committing acts derogatory to human dignity, such as removing clothes or forcibly tonsuring the head of a SC or ST member.

  • (w) Intentionally touching or making sexual advances towards a SC or ST woman without consent.

Property and Economic Rights:

  • (f) Wrongfully occupying or cultivating land owned or allotted to a SC or ST member, or getting such land transferred.

  • (g) Wrongfully dispossessing a SC or ST member from land or premises, interfering with their rights, or destroying crops.

  • (h) Making a SC or ST member do "begar" or other forms of forced or bonded labor, excluding compulsory public service imposed by the Government.

  • (x) Corrupting or fouling water sources used by SCs or STs.

  • (y) Denying customary rights of passage or access to public places to a SC or ST member.

  • (z) Forcing a SC or ST member to leave their residence.

  • (za) Obstructing or preventing a SC or ST member from using common resources or participating in social, religious, or cultural practices.

Social and Legal Harassment:

  • (i) Compelling a SC or ST member to handle human or animal carcasses or dig graves.

  • (j) Employing or permitting a SC or ST member for manual scavenging.

  • (k) Performing or promoting the dedication of a SC or ST woman to religious institutions as a deva dasi or similar practice.

  • (l) Forcing or intimidating a SC or ST member:

    • (A) Not to vote or to vote in a specific manner.

    • (B) Not to file or withdraw a nomination as a candidate.

    • (C) Not to propose or second the nomination of a SC or ST candidate in elections.

  • (m) Forcing or intimidating a member of a Panchayat or Municipality from performing their duties.

  • (n) After the poll, causing hurt, grievous hurt, assault, or imposing a social or economic boycott upon a SC or ST member or preventing them from accessing public services.

  • (p) Instituting false, malicious, or vexatious legal proceedings against a SC or ST member.

  • (q) Giving false information to a public servant causing injury or annoyance to a SC or ST member.

  • (r) Intentionally insulting or intimidating a SC or ST member in public view.

  • (s) Abusing a SC or ST member by caste name in public view.

  • (zb) Causing harm or mental agony on allegations of witchcraft.

  • (zc) Imposing or threatening a social or economic boycott on a SC or ST member or group.

Property Damage and Offenses Related to Voting:

  • (t) Destroying, damaging, or defiling any object held sacred by SCs or STs.

  • (u) Promoting enmity, hatred, or ill-will against SCs or STs.

  • (v) Disrespecting any late person held in high esteem by SCs or STs.

  • (o) Committing any offense related to voting under this Act against a SC or ST member.

Punishment for Offenses

  • Imprisonment: Not less than six months but up to five years.

  • Fine: Applicable.

Additional Offenses and Punishments

  • (i) Fabricating false evidence intending to convict a SC or ST member of a capital offense: Life imprisonment and fine; if executed, punishment with death.

  • (ii) Fabricating false evidence for non-capital offenses punishable with seven years or more: Imprisonment from six months to seven years and fine.

  • (iii) Committing mischief by fire or explosives causing damage to property of a SC or ST member: Imprisonment from six months to seven years and fine.

  • (iv) Committing mischief by fire or explosives destroying buildings used as worship or dwelling places by SC or ST members: Life imprisonment and fine.

  • (v) Committing offenses under IPC punishable with ten years or more: Life imprisonment and fine.

  • (va) Committing offenses specified in the Schedule: Punishment as per IPC and fine.

  • (vi) Causing evidence of an offense to disappear or giving false information: Punishment as provided for the offense.

  • (vii) Public servant committing any offense under this section: Imprisonment not less than one year and up to the provided punishment.

Offenses Under the Act

Section 3 outlines offenses deemed as atrocities against SCs or STs, including:

  • Causing Physical Harm: Inflicting physical harm, assault, or injury.

  • Sexual Harassment: Engaging in acts of sexual harassment or assault.

  • Economic and Social Exclusion: Denying access to property, facilities, or services; discriminating in employment, education, or social activities.

  • Humiliation and Intimidation: Insulting, humiliating, or intimidating SCs or STs.

  • Property Damage: Damaging or destroying property.

  • False Accusations: Filing false cases to harm or malign SCs or STs.

Purpose and Importance

  • Purpose: Defines specific crimes and corresponding punishments to protect SCs and STs from various forms of discrimination and violence.

  • Importance: Establishes legal recourse and penalties, reinforcing protections and promoting justice for marginalized communities.

Application

  • Territorial Extent: Applies throughout India, specifically protecting SCs and STs.

  • Jurisdiction: Cases are handled by Indian courts.

Legal Implications

  • Legal Impact: Enforces stringent penalties for offenses against SCs and STs, ensuring accountability and protection under the law.

Relevant Case Law

  • State of Maharashtra v. Ramdas Shankar Kharate (2010): Emphasized the need for a clear link between the offense and the victim's SC/ST status.

  • S. P. S. Rathore v. State of Haryana (2011): Highlighted the importance of proving intent to discriminate.

  • K.C. Agarwal v. State of Uttar Pradesh (2013): Focused on evidence requirements and specific targeting of the SC/ST identity.

  • N. S. Gokul v. State of Tamil Nadu (2018): Addressed the interpretation of humiliation or insult and the evidence needed.

Relevant Cases Related to IPC Section 3

  • R. v. Moti Ram (1950): Confirmed IPC applicability to crimes committed abroad.Readmore

  • State of Maharashtra v. Natwarlal (1970): Clarified conditions for trying offenses committed outside India.Readmore

  • K. K. Agarwal v. State of Uttar Pradesh (2013): Affirmed extraterritorial jurisdiction and enforcement of Indian laws.Readmore

  • M. K. Ghosh v. Union of India (1992): Upheld jurisdiction over offenses on Indian aircraft.Readmore

  • S. R. Bansal v. Union of India (2005): Examined conditions for applying Indian criminal law to offenses abroad.Readmore

Related Sections

  • Section 2 IPC: Defines punishment for offenses committed within India.

  • Section 4 IPC: Discusses the applicability of IPC to crimes committed beyond India.


Git Cheat Sheet

TKIET LINUX USER GROUP                                                                          Harshvardhan Patil ✅ Git Cheat Sheet — Step-...