gitpush-tool 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Supercharged Git push tool with automatic GitHub repo creation and pushing
5
5
  Home-page: https://github.com/inevitablegs/gitpush
6
6
  Author: Ganesh Sonawane
@@ -161,6 +161,6 @@ Contributions welcome! Please follow these steps:
161
161
 
162
162
  ## License 📄
163
163
 
164
- MIT - See LICENSE for details.
164
+ MIT - See LICENSE for details.
165
165
 
166
166
  <center>✨ <strong>Happy Coding!</strong> ✨</center>
@@ -0,0 +1 @@
1
+ __version__ = "0.3.2"
@@ -317,6 +317,22 @@ def gh_authenticated():
317
317
  except (subprocess.CalledProcessError, FileNotFoundError):
318
318
  return False
319
319
 
320
+
321
+ def is_local_ahead() -> bool:
322
+ try:
323
+ result = subprocess.run(
324
+ ["git", "rev-list", "--left-right", "--count", "origin/main...HEAD"],
325
+ capture_output=True, text=True, check=True
326
+ )
327
+ behind_ahead = result.stdout.strip().split()
328
+ if len(behind_ahead) == 2:
329
+ behind, ahead = map(int, behind_ahead)
330
+ return ahead > 0
331
+ return False
332
+ except subprocess.CalledProcessError:
333
+ return False
334
+
335
+
320
336
  def authenticate_with_gh():
321
337
  """Authenticate user with GitHub CLI"""
322
338
  print("\n🔑 GitHub authentication required.")
@@ -437,7 +453,11 @@ def standard_git_push(commit_message, branch, remote, force=False, tags=False):
437
453
  else:
438
454
  print("ℹ️ No commit message provided. Pushing only staged changes.")
439
455
 
440
- push_cmd = ["git", "push"]
456
+ if is_local_ahead():
457
+ push_cmd = ["git", "push"]
458
+ else:
459
+ push_cmd = ["git", "push", "origin", "main"]
460
+
441
461
  if force:
442
462
  push_cmd.append("--force-with-lease")
443
463
  print("⚠️ Using safe force push (--force-with-lease).")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Supercharged Git push tool with automatic GitHub repo creation and pushing
5
5
  Home-page: https://github.com/inevitablegs/gitpush
6
6
  Author: Ganesh Sonawane
@@ -6,7 +6,7 @@ long_description = (Path(__file__).parent / "LONG_DESCRIPTION.md").read_text(enc
6
6
 
7
7
  setup(
8
8
  name="gitpush-tool",
9
- version="0.3.1",
9
+ version="0.3.2",
10
10
  packages=find_packages(),
11
11
  install_requires=[],
12
12
  entry_points={
@@ -1 +0,0 @@
1
- __version__ = "0.3.1"
File without changes
File without changes
File without changes