Git 2.46 is here with new features like pseudo-merge bitmaps, more capable credential helpers, and a new git config command. Check out our coverage on some of the highlights here. https://lnkd.in/gCsu6ww9
Git 2.46 introduces new features and tools
More Relevant Posts
-
🚀 Exciting News: Git 2.45 Release Highlights! 🚀 The latest version of Git, 2.45, is out now, bringing with it some groundbreaking updates and the dedication of 96 contributors, including 38 newcomers. This release introduces promising experimental features like reftable support for efficient repository management and steps forward in SHA-256 interoperability, enhancing security and performance. 🔗 For those eager to explore, initializing a new repository with reftable is straightforward: ``` $ git init --ref-format=reftable /path/to/repo ``` This release not only boosts functionality but also enhances user experience with detailed logging and config options, promising a smoother Git journey. Stay tuned as we continue to embrace these advances, ensuring your Git experience is more robust and streamlined than ever! #Git245 #OpenSource #DeveloperTools #GitHubUpdates #TechNews #Developer #Dev https://lnkd.in/eUiDrVt8
To view or add a comment, sign in
-
🚀 𝗨𝗻𝗹𝗼𝗰𝗸𝗶𝗻𝗴 𝗚𝗶𝘁 𝗞𝗻𝗼𝘄𝗹𝗲𝗱𝗴𝗲: 𝗚𝗶𝘁 𝗟𝗙𝗦 𝗙𝗶𝗹𝗲 𝗟𝗼𝗰𝗸𝗶𝗻𝗴 Recently, I encountered an issue with a "file is locked" error in Git. I wasn’t aware Git also supports file locking, similar to SVN’s concept, through 𝗚𝗶𝘁 𝗟𝗙𝗦 (https://lnkd.in/dj3-WatR). 🌟 After a deep dive, I discovered that Git LFS allows us to lock files so other users can’t make changes until the owner unlocks them. It’s a handy feature for managing critical files in collaborative environments. To resolve my situation, I needed to unlock all the files. So, I rolled up my sleeves and created a small shell script to automate the process 💡: 𝙜𝙞𝙩 𝙡𝙛𝙨 𝙡𝙤𝙘𝙠𝙨 | 𝙖𝙬𝙠 '{𝙥𝙧𝙞𝙣𝙩 𝙨𝙪𝙗𝙨𝙩𝙧($𝙉𝙁, 4)}' | 𝙭𝙖𝙧𝙜𝙨 -𝙄 {} 𝙜𝙞𝙩 𝙡𝙛𝙨 𝙪𝙣𝙡𝙤𝙘𝙠 --𝙛𝙤𝙧𝙘𝙚 --𝙞𝙙={} 💡 It’s always exciting to learn something new and share solutions with the community! Have you used Git LFS file locking before? Let’s discuss. 🤝 #Git #GitLFS #Collaboration #Coding
To view or add a comment, sign in
-
Check this out: so I accidentally pushed up something to git that was... less than ideal. 1. get a fresh clone: `gh repo clone you/the-repo` 2. `cd the-repo` 3. `git filter-repo --invert-paths --path .secret/stuff.json` 4. your local remote config will have been wiped out: `git remote add origin <repo_url>` 5. caution, rewrites history: `git push origin --force --all` 6. see that it's gone: `git log --follow -- .secret/stuff.json` 7. and whoops that bad boy unsigned all your commits: `git filter-branch -f --commit-filter 'git commit-tree -S "$@";' -- --all` 8. one more time: `git push origin --force --all` You'll still need to treat that data as compromised, but it's nice to clean it out. Browse a commit you know had the file on GitHub and you'll see it gone. Nice deal.
To view or add a comment, sign in
-
For those who want/need to remove credentials that were pushed to a git repo. Use BFG Repo Cleaner. https://lnkd.in/ggQ-aju6 https://lnkd.in/gtQsrJuU https://lnkd.in/gU_wEGMD Downloaded BFG binary .jar (from 1st website above): https://lnkd.in/gCCn3jZ8 Put in ~/bin You can add an alias in .bashrc: # BFG Repo-Cleaner alias bfg='java -jar ~/bin/bfg-1.14.0.jar' For cleaning/scrubbing passwords/AWS Access Keys/API Keys from branches and tags create a file called "passwords.txt" Example: passwords.txt: WFcgwmWrk4QFvkdXndVy AKIA3UXOKPRJQ2DIAZW6 7ae426f2-228d-4729-8e54-51b48a4ca85b Example Run: Make a backup copy of your repo!!! This is what you will use to recover with if something goes horribly wrong. mkdir MyRepoBackup cd MyRepoBackup git clone https://lnkd.in/gYnFJ57T git clone --mirror https://lnkd.in/gYnFJ57T cd .. Next Do BFG Run - This will replace values in passwords.txt with ***REMOVED***: git clone --mirror https://lnkd.in/gYnFJ57T bfg --replace-text passwords.txt my-repo.git cd my-repo.git git reflog expire --expire=now --all && git gc --prune=now --aggressive If Gitlab: [PROJECT] --> Settings --> Repository --> Protect Branch --> [ALL_BRANCHES] (Change to allow force push) Also may need to unprotect tags: [ALL_TAGS] git push [PROJECT] --> Settings --> Repository --> Protect Branch --> [ALL_BRANCHES] (Change to NOT allow force push) Also may need to re-protect tags: [ALL_TAGS] Else: git push Re-clone the repo to verify credentials are gone: git clone https://lnkd.in/gYnFJ57T Note: If you get git commit errrors like: ! [remote rejected] refs/merge-requests/10/head -> refs/merge-requests/10/head (deny updating a hidden ref) ! [remote rejected] refs/pipelines/293992771 -> refs/pipelines/293992771 (deny updating a hidden ref) This is ok as git won't update actime (unmerged) merge requests/pull requests or Gitlab deployment environments. From Author: This is something I could cover with better documentation - issue #16 relates to this. The refs beginning 'refs/pull' are synthetic read-only refs created by GitHub - you can't update (and therefore 'clean') them, because they reflect branches that may well actually come from other repositories - ones that submitted pull-requests to you. https://lnkd.in/gXT6vDuA https://lnkd.in/gYi7wh59 So any refs with 'refs/pull' or 'refs/pipeline' won't get updated I hope this helps you get started with BFG Repo Cleaner.
To view or add a comment, sign in
-
POST UPDATE 😁 Our article expands on a patch file, also known as a diff file, contains changes to be applied to a file or files in a Git repository, helping to avoid human error when manually applying changes. It outlines the use of the 'git diff' command to output changes between two sources within a Git repository, such as files, commits, or branches, with examples provided for each use case. The process of creating a patch file is demonstrated using the 'git diff' command followed by redirection to a `.patch` or `.diff` file. Showing how to apply a shared patch file to the local branch of a Git repository using the `git apply` command and refers to its man page for more information. Go more: https://lnkd.in/dFW7jprk
To view or add a comment, sign in
-
Meet Git Stash: Your Secret Chest of Unfinished Code https://ift.tt/m6178tr Photo by Stefan Steinbauer on Unsplash Mastering Git A powerful Git feature for temporarily saving code in progress Imagine discovering a critical bug that needs an immediate fix while you are working halfway through a code change. Your attempt to switch branch fails because of uncommitted changes in your current feature branch. These changes aren’t ready for a commit but are too valuable to discard. In such a situation where you need to switch contexts quickly, git stash offers an elegant solution to temporarily store your unfinished code safely without committing. In this post, we will explore how to use git stash effectively. 📍 1. Stashing Imagine we are writing a letter with a pen and a paper, but suddenly we had to write another more urgent letter and send it away. Our desk can hold only one letter. It would be too wasteful to throw our unfinished letter since it took us some time to write what’s written so far. Instead of throwing it away, we can put it away in a secure chest so that we can pick it up and continue once we finish this more time-sensitive letter. This will allow us to get straight on to writing this more urgent letter and send it quickly while saving our work on the other letter. In this analogy, halfway written letter is the uncommitted changes. Stashing is like putting our unfinished code into a secure chest. The vanilla git stash command will stash away uncommitted (i.e. staged and unstaged) changes in the tracked files: git stash We can give stash a description to make it more informative for future reference: git stash push -m "<stash-description>" # Recommended method git stash save "<stash-description>" # Legacy method With this command, untracked files will remain in your working directory. To stash away untracked files in addition to the modified tracked files, we can use -u: git stash push -u -m "<stash-description>" If we want to also stash away ignored files in addition to the modified tracked files and untracked files, we can use -a: git stash push -a -m "<stash-description>" In some cases, it’s more useful to be more selective with our stash. Here’s how we can stash specific files: git stash push -m "<stash-description>" -- <file1-path> <file2-path> Instead of file paths, we can also specify directory paths. 📍 2. Viewing list of stashes Continuing on our letter analogy, viewing list of stashes is like opening our secure chest and seeing what half-written letters are inside. To view existing stashes, use: git stash list This command shows a list of all stashes with their index and description. The most recent stash will be on top and named as stash@{0}. Output looks something like this: stash@{0}: WIP on main: 1234567 Commit message stash@{1}: WIP on feature-branch: 89abcdef Another commit message 💡 It is good practice to keep only a few stashes to avoid confusion and getting mixed...
To view or add a comment, sign in
-
To work better with repositories and updates of any size, I updated the AI-powered Git commit message generator with a few options: --include-content: Include file content in the analysis (disabled by default) --include-history: Include file commit history in the analysis (disabled by default) --context-lines N: Number of context lines to show in git diff (default: 3)
To view or add a comment, sign in
-
20 Git Command-Line Tricks Every Developer Should Know (Part 2): 11. List All Branches (Local and Remote) See which branches are available. git branch -a 12. Clean Untracked Files and Directories Quickly remove unwanted files that are not tracked by Git. git clean -fd Use -n for a dry run to preview what will be removed. 13. Track an Upstream Branch Keep your local branch in sync with a remote branch. git branch --set-upstream-to=origin/main 14. Squash Commits with Interactive Rebase Combine multiple commits into one. git rebase -i HEAD~n # Replace 'n' with the number of commits 15. View the File at a Specific Commit Check a file's state at a particular commit. git show <commit-hash>:path/to/file 16. Edit the .gitignore After Committing If you forgot to ignore certain files, update .gitignore. echo "node_modules/" >> .gitignore git rm -r --cached node_modules/ git commit -m "Update .gitignore" 17. Revert a Pushed Commit Undo changes from a specific commit without changing history. git revert <commit-hash> 18. Fetch Only Metadata Want to avoid fetching the whole repository? git fetch --dry-run This lets you see what would be fetched without actually downloading data. 19. Blame a Line of Code Find out who wrote a specific line in a file. git blame path/to/file 20. Reset a File to the Last Commit Discard local changes to a specific file. git checkout -- path/to/file [dev.to]
To view or add a comment, sign in
-
-
Seemingly helpful recently. Basically this will return all of the branches and commits while also listing the changes in the files. This could probably be done more eloquently but here we are. git fetch --all && for branch in $(git branch -r | grep -v '\->'); do echo "Branch: $branch"; git log --pretty=format:"%H" $branch | while read commit; do echo "Commit: $commit"; git show --pretty="format:" --name-only $commit; git show $commit; done; done
To view or add a comment, sign in
Bachelor of Computer Application
7moWhat is a git