PageSourceSearch

https://git-scm.com/js/application.min.9fa9fb38ef6c02fbb5e3624499214101f82d3b15ce4ba8856f64c2c3456798c8.js

js git-scm.com collected 2026-09-24 06:03:15 UTC 15,229 bytes, 39 lines download raw bytes

1popped="state"in window.history,initialURL=location.href;const baseURLPrefix=(()=>{const e=Array.from(document.getElementsByTagName("script")).pop().getAttribute("src");return e.replace(/^(?:[a-z]*:\/\/[^/]*)?(.*\/)(assets|js)\/[^/]+.js(\?.*)?$/,"$1")})();$(document).ready(function(){BrowserFallbacks.init(),DarkMode.init(),GitTurns20.init(),Search.init(),Dropdowns.init(),Forms.init(),Downloads.init(),DownloadBox.init(),InstallPageLink.init(),PostelizeAnchor.init(),Print.init()});function onPopState(e){if(window.history&&window.history.pushState)return $(window).on("popstate",function(){var t;if(initialPop=!popped&&location.href===initialURL,popped=!0,initialPop)return;e()})}var DownloadBox={init:function(){$("#gui-os-filter").addClass("visible");var e=window.session.browser.os;e=="Mac"?($("#download-link").text("Install for Mac").attr("href",`${baseURLPrefix}install/mac`),$("#gui-os-filter").attr("data-os","mac"),$("#gui-os-filter").text("Only show GUIs for my OS (Mac)")):e=="Windows"?($("#download-link").text("Install for Windows").attr("href",`${baseURLPrefix}install/windows`),$("#gui-os-filter").attr("data-os","windows"),$("#gui-os-filter").text("Only show GUIs for my OS (Windows)")):e=="Linux"&&($("#download-link").text("Install for Linux").attr("href",`${baseURLPrefix}install/linux`),$("#gui-os-filter").attr("data-os","linux"),$("#gui-os-filter").text("Only show GUIs for my OS (Linux)"))}},BrowserFallbacks={init:function(){BrowserFallbacks.initPlaceholders()},initPlaceholders:function(){Modernizr.input.placeholder||$("input[placeholder], textarea[placeholder]").each(function(){$(this).defaultValue($(this).attr("placeholder"),"active","inactive")})}},GitTurns20={keySequence:"20",keySequenceOffset:0,init:function(){const e=new Date;if(e.getFullYear()===2025&&e.getMonth()===3&&e.getDate()===7)this.celebrate();else{let t=0,e=0;$("#tagline").on("click",n=>{e===0||n.timeStamp>t+e*1e3?(t=n.timeStamp,e=1):++e===6&&(this.celebrate(),e=0)})}},keydown:function(e){if(this.keySequenceOffset>=this.keySequence.length)return;
1this.keySequence[this.keySequenceOffset]===e.key&&++this.keySequenceOffset===this.keySequence.length&&(this.celebrate(),this.keySequenceOffset=0)},celebrate:function(){document.documentElement.dataset.celebration="git-turns-20",$("#tagline").html('<a href="https://discord.gg/UcjvsNQR">--20th-anniversary</a>'),$("#masthead").length&&(async()=>{await import("https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js");const e=200,t={origin:{y:.7},disableForReducedMotion:!0};for(const[n,s]of[[.25,{spread:26,startVelocity:55}],[.2,{spread:60}],[.35,{spread:100,decay:.91,scalar:.8}],[.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}],[.1,{spread:120,startVelocity:45}]])window.confetti({...t,...s,particleCount:Math.floor(e*n)})})().catch(console.error)}},Search={searching:!1,currentSearch:"",selectedIndex:0,init:function(){Search.displayFullSearchResults(),Search.observeFocus(),Search.observeTextEntry(),Search.observeResultsClicks(),Search.installKeyboardShortcuts()},observeFocus:function(){$("form#search input").on("focus",function(){$(this).parent("form#search").switchClass("","focus",200)}),$("form#search input").on("blur",function(){Search.resetForm()})},observeTextEntry:function(){$("form#search input").on("keyup",function(){Search.runSearch()}),$("form#search input").on("keydown",function(e){switch($("#search-results").not(":visible")&&e.which!=27&&($("#search-results").fadeIn(.2),Search.highlight(Search.selectedIndex)),e.which){case 13:return Search.selectResultOption(),!1;break;case 27:Search.resetForm();break;case 38:e.preventDefault(),Search.resultsNav("up");break;case 40:e.preventDefault(),Search.resultsNav("down");break}})},observeResultsClicks:function(){$("#search-results").on("mousedown",function(e){e.preventDefault()})},installKeyboardShortcuts:function(){$(document).on("keydown",function(e){e.target.tagName.toUpperCase()!=="INPUT"&&["s","S","/"].includes(e.key)?(e.preventDefault(),$("form#search input").trigger("focus")):e.target.tagName.toUpperCase()!=="INPUT"&&GitTurns20.keydown(e)})}
1,runSearch:function(){var e=$("#search-text").val();if(e.length<2)return!1;if(Search.searching)clearTimeout(Search.timeout),Search.timeout=setTimeout(function(){Search.searching=!1,Search.runSearch()},300);else if(Search.searching=!0,e!=Search.currentSearch){Search.currentSearch=e;const t=document.querySelector("html")?.getAttribute("lang"),n=`${baseURLPrefix}search/results?search=${encodeURIComponent(e)}${t&&`&language=${encodeURIComponent(t)}`}`;$("#search-results").html(`
2          <header> Search Results </header>
3          <table>
4            <tbody>
5              <tr class="show-all">
6               <td class="category"> &nbsp; </td>
7                <td class="matches">
8                  <ul>
9                    <li>
10                      <a class="highlight" id="show-results-label">
11                        Searching for <span id="search-term">&nbsp;</span>...
12                      </a>
13                    </li>
14                  </ul>
15                </td>
16              </tr>
17              <tr style="display:none">
18                <td class="category">Reference</td>
19                <td class="matches">
20                  <ul id="ul-reference"></ul>
21                </td>
22              </tr>
23              <tr style="display:none">
24                <td class="category">Book</td>
25                <td class="matches">
26                  <ul id="ul-book"></ul>
27                </td>
28              </tr>
29              <tr id="row-any">
30                <td class="category"> &nbsp; </td>
31                <td class="matches">
32                  <ul>
33                    <li><button id="load-more-results">Loading</button></li>
34                  </ul>
35                </td>
36              </tr>
37            </tbody>
38          </table>
39        `),$("#search-term").text(e),$("#show-results-label").attr("href",n),this.initializeSearchIndex(async()=>{const t=await Search.pagefind.debouncedSearch(e);if(t===null||t.results.length===0){$("#show-results-label").text("No matching pages found.");return}$("#show-results-label").text("Show all results...");const n=$("#load-more-results");n.text(`Loading ${t.results.length<2?"result":`${t.results.length} results`}`),n.loading=!1;const o=$("#ul-reference"),i=$("#ul-book"),r=10;let s=0;const c=e=>{for(;e<s&&typeof t.results[e].data=="object";){const n=t.results[e++];n.data.meta.category==="Reference"?(o.children().length===0&&o.parent().parent().css("display","table-row"),o.append(n.li)):n.data.meta.category==="Book"&&(i.children().length===0&&i.parent().parent().css("display","table-row"),i.append(n.li))}},a=()=>{if(n.loading||s>=t.results.length)return;n.loading=!0;const o=s+r;for(;s<o;){const e=t.results[s];if(e.li=$("<li><a>&hellip;</a></li>"),e.li.insertBefore(n),(async n=>{e.data=await t.results[s].data(),(!n||typeof t.results[n-1].data=="object")&&c(n),e.data.meta.title=e.data.meta.title.replace(/^Git - (.*) Documentation$/,"$1"),e.data.url=e.data.url.replace(/\.html$/,"");const o=$("<a>");o.attr("href",e.data.url),o.text(e.data.meta.title),e.li.empty().append(o)})(s).catch(t=>{console.log(t),e.li.html(`<i>Error loading result</i>`)}),++s>=t.results.length){n.remove();return}}const e=t.results.length-s;n.text(`Load ${e} more ${e<2?"result":"results"}`),n.loading=!1};a(),n.on("click",a),Search.searching=!1})}},selectResultOption:function(){var t=$("#search-results a")[Search.selectedIndex],e=$(t).attr("href");if(!e){const t=$("#search-text").val();if(!t)return;const n=document.querySelector("html")?.getAttribute("lang");e=`${baseURLPrefix}search/results?search=${encodeURIComponent(t)}${n&&`&language=${encodeURIComponent(n)}`}`}window.location.href=e,selectedIndex=0},resultsNav:function(e){Search.selectedIndex+=e=="down"?1:-1,Search.highlight(Search.selectedIndex)},highlight:function(e){var t=$("#search-results a").removeClass("highlight");$(t[e]).addClass("highlight")},resetForm:function(){$("form#search").switchClass("focus","",200),$("#search-results").fadeOut(.2),Search.selectedIndex=0},getQueryValue:function(e){const n=window.location.search.substring(1),t=`${e}=`;return n.split("&").filter(e=>e.startsWith(t)).map(e=>decodeURIComponent(e.substring(t.length).replace(/\+/g,"%20"))).pop()},initializeSearchIndex:function(e){if(Search.pagefind){e().catch(console.log);return}(async()=>{const s=`${baseURLPrefix}pagefind/pagefind.js`.replace(/^\.\//,"../");Search.pagefind=await import(s);const t={ranking:{pageLength:.1,termFrequency:.1,termSaturation:2,termSimilarity:9}},n=this.getQueryValue("language");n&&(t.language=n),await Search.pagefind.options(t),await Search.pagefind.init(),await e()})().catch(console.log)},displayFullSearchResults:function(){if(!$("#search-div").length)return;const t=this.getQueryValue("language"),n=new PagefindUI({element:"#search-div",showEmptyFilters:!1,showSubResults:!0,showImages:!1,language:t,ranking:{pageLength:.1,termFrequency:.1,termSaturation:2,termSimilarity:9},processResult:function(e){return e.url=e.url.replace(/\.html$/,""),e}}),e=this.getQueryValue("search");e&&($("#search-div input").val(e),n.triggerSearch(e))}},Dropdowns={init:function(){Dropdowns.observeTriggers()}
39,observeTriggers:function(){var e=$(".dropdown-trigger");e.on("click",function(t){t.preventDefault(),$(this).toggleClass("active"),$("#"+$(this).attr("data-panel-id")).toggle(),e.each((e,t)=>{if(t===this)return;$(t).removeClass("active"),$("#"+$(t).attr("data-panel-id")).hide()})})}},Forms={init:function(){Forms.observeCopyableInputs()},observeCopyableInputs:function(){$("input.copyable").on("click",function(){$(this).select()})}},Downloads={init:function(){Downloads.observeGUIOSFilter(),Downloads.observePopState(),Downloads.filterGUIS(),Downloads.postProcessDownloadPage()},getOSFromQueryString:function(){const t=window.location.search.substring(1),e=`os=`;return t.split("&").filter(t=>t.startsWith(e)).map(t=>decodeURIComponent(t.substring(e.length).replace(/\+/g,"%20"))).pop()},getOSFilter:function(e){return e=e||Downloads.getOSFromQueryString(),e==="linux"||e==="mac"||e==="windows"||e==="android"||e==="ios"?e:""},capitalizeOS:function(e){const t={linux:"Linux",mac:"Mac",windows:"Windows",android:"Android",ios:"iOS"};return t[e]},filterGUIS:function(e){var n,t=Downloads.getOSFilter(e),s=Downloads.capitalizeOS(t);$("a.gui-os-filter").not("[data-os='"+t+"']").removeClass("selected"),$("a.gui-os-filter").filter("[data-os='"+t+"']").addClass("selected"),t===""?($("ul.gui-thumbnails li").removeClass("masked"),$("#os-filter-count").hide()):($("ul.gui-thumbnails li").filter("."+t).removeClass("masked"),$("ul.gui-thumbnails li").not("."+t).addClass("masked"),n=$("ul.gui-thumbnails li."+t).length,$("#os-filter-count strong").html(n),$("#os-filter-count .os").html(s),$("#os-filter-count").show())},observeGUIOSFilter:function(){$("a.gui-os-filter").on("click",function(e){e.preventDefault();var n,t=$(this).attr("data-os");if(window.history&&window.history.pushState){n=t===""?`${baseURLPrefix}downloads/guis`:`${baseURLPrefix}downloads/guis?os=${t}`;try{history.pushState(null,$(this).html(),n)}catch(e){`${e}`.indexOf("The operation is insecure")<0&&console.log(e)}}Downloads.filterGUIS(t)})},observePopState:function(){onPopState(function(){Downloads.filterGUIS()})},postProcessReleaseDate:function(e,t){const n=Math.floor((Date.now()-Date.parse($("#auto-download-date").html()))/864e5);if(n<0)return t;const o=(e,t)=>`${e} ${t}${e>1?"s":""} ago`;let s=o(n,"day");const i=(e,t)=>{const n=Math.floor(e),s=e-n;return s<.25?`about ${o(n,t)}`:s<.75?`over ${o(n,t)}`:`almost ${o(n+1,t)}`};return n==0?s="today":n==1?s="yesterday":n>365*.75?s=i(n/365.25,"year"):n>45&&(s=i(n/30.4,"month")),`<strong>${s}</strong>, `},adjustForWindowsARM64:function(){if(!navigator.userAgentData)return;navigator.userAgentData.getHighEntropyValues(["architecture","platform","bitness"]).then(function(e){if(e.platform!=="Windows"||e.bitness!=="64"||e.architecture!=="arm")return;const t=$("#auto-download-link"),n=$("#auto-download-version"),s=$("#auto-download-architecture"),o=$("#auto-download-date");t.length&&n.length&&s.length&&o.length&&(s.html("ARM64"),t.attr("href","https://github.com/git-for-windows/git/releases/download/v2.55.0.windows.5/Git-2.55.0.5-arm64.exe"),n.html("2.55.0(5)"),o.html("2026-08-20"))})},postProcessDownloadPage:function(){Downloads.adjustForWindowsARM64(),$("#relative-release-date").html(Downloads.postProcessReleaseDate)}},DarkMode={init:function(){const e=$("#dark-mode-button");if(!e.length)return;const t=window.matchMedia("(prefers-color-scheme: dark)").matches,n=localStorage.getItem("theme");(t&&n!=="light"||!t&&n==="dark")&&e.attr("src",`${baseURLPrefix}images/light-mode.svg`),e.addClass("active"),e.on("click",function(n){n.preventDefault();let s;t?s=document.documentElement.dataset.theme==="light"?"dark":"light":s=document.documentElement.dataset.theme==="dark"?"light":"dark",document.documentElement.dataset.theme=s,t===(s==="dark")?localStorage.removeItem("theme"):localStorage.setItem("theme",s),e.attr("src",`${baseURLPrefix}images/${s==="dark"?"light":"dark"}-mode.svg`)})}},PostelizeAnchor={init:function(){const e=window.location.hash;if(!e||!e.startsWith("#")||e.length<2||document.querySelector(CSS.escape(e))!==null)return;const t=e.slice(1),n=t.length/2,o=[...document.querySelectorAll("[id]")].map(e=>e.id),s=o.reduce((e,s)=>{const o=PostelizeAnchor.wuLevenshtein(t,s,n);return o<e.d&&(e.d=o,e.id=s),e},{d:n}).id;s&&(window.location.hash=`#${s}`)},wuLevenshtein:function(e,t,n){const o=e.length,s=t.length;if(o===0)return s;if(s===0)return o;const a=o+s+1,i=new Array(a).fill(0),r=s;n===0[0]&&(n=o+s);for(let a=0;a<n;a++)for(let c=Math.max(-s,-a);c<=o&&c<=a;c+=2){const l=c+r;let n;c===-a||c!==a&&i[l-1]<i[l+1]?n=i[l+1]:n=i[l-1]+1;let d=n-c;for(;n<o&&d<s&&e[n]===t[d];)n++,d++;if(i[l]=n,n>=o&&d>=s)return a}return n}},Graphviz={render:function(){let e;
39[...document.querySelectorAll("pre[class=graphviz]")].forEach(async t=>{e||(e=await Viz.instance());const i={format:"svg",graphAttributes:{bgcolor:"transparent"},engine:t.getAttribute("engine")||"dot"},s=e.renderString(t.innerText,i),n=document.createElement("img");n.setAttribute("src",`data:image/svg+xml;utf8,${encodeURIComponent(s.substring(s.indexOf("<svg")))}`);const o=t.getAttribute("alt");o&&n.setAttribute("alt",o),t.parentNode.insertBefore(n,t),t.style.display="none"})}},InstallPageLink={init:function(){const e=document.querySelector(".install-link");if(!e)return;const t=window.session?.browser?.os;t==="Mac"?e.href=e.href.replace("/install","/install/mac"):t==="Windows"?e.href=e.href.replace("/install","/install/windows"):t==="Linux"&&(e.href=e.href.replace("/install","/install/linux"))}},Print={init:function(){Print.tagline=$("#tagline"),Print.scrollToTop=$("#scrollToTop"),window.matchMedia("print").addListener(e=>{Print.toggle(e.matches)})},toggle:function(e){e?(Print.taglineBackup=Print.tagline.html(),Print.tagline.html("--print-out"),Print.scrollToTopDisplay=Print.scrollToTop.attr("display"),Print.scrollToTop.attr("display","none")):(Print.tagline.html(Print.taglineBackup||"--as-git-as-it-gets"),Print.scrollToTop.attr("display",Print.scrollToTopDisplay))}}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.