So given an instance of LibGit2Sharp Branch how do you work out what commit that it was initially created from?
How to detect what commit a branch has been created from in LibGit2Sharp
881 Views Asked by Simon At
1
There are 1 best solutions below
Related Questions in GIT
- Push mysql database script to server using git
- Git show's file path
- Git > diffs filtered, show only certain changed classes/files
- Pushing to git repository hosted by Visual studio online without entering user name and password
- How do I create my own Git branch to work on?
- Git init --bare giving error fatal: Out of memory? mmap failed: No such device
- Sub-directory into independent repository and later merge back into main repository
- How to find the Git Revision Hash in a synced SVN repo using SubGit?
- eclipse errors when try to change to master git branch
- How to have Heroku build my development branch on a staging server?
- Is "Merged in" a commit message created by bitbucket, or git?
- Git: Multiple projects under one directory
- Permission denied hg-git
- Is it possible to clone a private git repo without adding ssh keys
- Track file in master repository which is ignored in submodule
Related Questions in LIBGIT2
- Is it possible to remote access and parse git revision history?
- pygit2 appears to return the wrong flags for repo.status()
- Linking against libgit2 in Clion not working
- Safely free libgit2 objects
- How to obtain files included in initial commit using git2r (libgit2)?
- libgit2 in long running process: How to close open handles?
- Performing a "fast-forward" merge with Rugged
- Is there a specific protocol to add everything to Git using Rugged?
- Does Repository.walk traverse all commits
- Git porcelain commands via pygit2?
- Where to set username and password in git_clone in libgit2?
- How to set the credentials in pygit2.clone_repository?
- How to checkout a revision by SHA-1 hash with pygit2?
- Git as a storage backend
- Using LibGit2Sharp to truncate GIT commit history
Related Questions in LIBGIT2SHARP
- LibGit2Sharp authentication in server side application
- LibGit2Sharp get repository changes after pull
- how to retrieve list of local git repos via libgit2sharp?
- how to clone GitHub repo locally via libgit2sharp?
- LibGit2Sharp Find what files were updated/added/deleted after pull
- Build project using LibGit2Sharp, have it run on .NET & Mono (Windows, Linux, Mac)
- Checkout windows style line breaks
- Repository.RemoveUntrackedFiles() : access denied
- Trouble authenticating with SshUserKeyCredentials in libgit2sharp-SSH
- Is it possible to remote access and parse git revision history?
- Libgit2Sharp : How to get author details from Diff.Compare?
- What is the LibGit2Sharp equivalent of 'git checkout --ours'?
- Index.RetrieveStatus On files that don't change length return unaltered
- Using LibGit2Sharp to truncate GIT commit history
- libgit2sharp: how to set multiple values with same key
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A
Branchis merely an object depicting a githeadreference. Aheadis a text file, mostly living under the.git/refs/headshierarchy. This text file contains the hash of thecommitthisheadcurrently points to. Similarly, aBranchbears aTipproperty which points to aCommit.When working with git repositories and performing actions such as committing, resetting, rebasing... the
headfile is updated with different hashes, pointing to different commits.A
headkeeps no track of previous pointed at commits. Neither does theBranch.With git, when creating a new branch, a new reflog is created. Git takes care of adding a first entry with a message identifying the object the branch has been created from.
Given an existing branch
backupCreating a new branch will create and feed its reflog
Of course, that also works when directly creating a branch from a commit
LibGit2Sharp exposes the reflog as well. For instance, the following code will enumerate the log entries for a specific
Branch.So "good news", the reflog may contain what you're after ;-)
but...
Note: As of today, LibGit2Sharp doesn't create an entry when creating or removing a branch. However, this is currently tackled by the amazing @dahlbyk as part of Pull Request #499