| domain | mahmoudashraf.dev |
| summary | The provided snippet is a Git alias, named `gcln`, designed to keep local branches synchronized with the remote repository by removing any deleted branches. Here's how it works:
1. `git fetch -p`: This command fetches all updates from the remote repository while preserving local branch configurations. The `-p` flag ensures that the local branch pointers remain up-to-date, even if the remote branch has been deleted or rearranged.
2. `git branch -vv`: Displays detailed information about all local branches, including their heads and the target branches of any merges or rebases. This is useful for identifying which branches have been removed in the remote repository.
3. `grep : gone`: Filters the output from `git branch -vv`, looking specifically for lines containing ': gone', which indicates deleted branches in the remote repository.
4. `awk print 1`: Isolates the first column of the filtered output, which contains the names of the deleted branches.
5. `xargs -r git branch -DM`: Uses `xargs` to pass the extracted branch names as arguments to `git branch`, removing (or "cleaning") them locally using the `-D` flag. The `-M` flag ensures that only local branches are affected, not remote ones.
In summary, this Git alias simplifies keeping local branches up-to-date with the remote repository by automatically removing deleted branches and synchronizing branch configurations. |
| title | Home – Mahmoud Ashraf |
| description | Mahmoud Ashraf is a Front-end developer based in Alexandria, Egypt. |
| keywords | recent, thoughts, front, using, blogs, branches, branch, games, website, blog, uses, contact, tracker, light, mode, welcome, space |
| upstreams |
|
| downstreams |
|
| nslookup | A 35.157.26.135, A 63.176.8.218 |
| created | 2025-11-08 |
| updated | 2025-11-08 |
| summarized | 2025-11-13 |
|
|